WriteToDebugObserverGuiPluginWidgetController.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * \package ArmarXGui::gui-plugins::WriteToDebugObserverGuiPluginWidgetController
17 * \author Raphael Grimm ( raphael dot grimm at kit dot edu )
18 * \date 2020
19 * \copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
24
25#include <string>
26
28
29namespace armarx
30{
35
39
40 void
42 {
43 _debugObserverName =
44 settings->value("DebugObserver", "DebugObserver").toString().toStdString();
45 }
46
47 void
49 {
50 settings->setValue("DebugObserver", QString::fromStdString(_debugObserverName));
51 }
52
53 void
55 {
56 offeringTopic(_debugObserverName);
57 connect(_widget.pushButtonSend, SIGNAL(clicked()), this, SLOT(on_pushButtonSend_clicked()));
58 }
59
60 void
62 {
63 getTopic(_debugObserver, _debugObserverName);
64 }
65
66 void
67 WriteToDebugObserverGuiPluginWidgetController::on_pushButtonSend_clicked()
68 {
69 const std::string channel = _widget.lineEditChannelName->text().toStdString();
70 const std::string datafield = _widget.lineEditDatafield->text().toStdString();
71 const std::string value = _widget.lineEditValue->text().toStdString();
72
73 if (datafield.empty() || channel.empty())
74 {
75 return;
76 }
77
78 _debugObserver->setDebugDatafield(channel, datafield, new Variant{value});
79 }
80
81 QPointer<QDialog>
83 {
84 if (!_dialog)
85 {
86 _dialog = new SimpleConfigDialog(parent);
87 _dialog->addProxyFinder<DebugObserverInterfacePrx>(
88 {"DebugObserver", "", "DebugObserver*"});
89 }
90 return qobject_cast<SimpleConfigDialog*>(_dialog);
91 }
92
93 void
95 {
96 _debugObserverName = _dialog->getProxyName("DebugObserver");
97 }
98} // namespace armarx
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
A config-dialog containing one (or multiple) proxy finders.
QPointer< QDialog > getConfigDialog(QWidget *parent=0) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
This file offers overloads of toIce() and fromIce() functions for STL container types.
::IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface > DebugObserverInterfacePrx