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 
23 #include <string>
24 
27 
28 
29 namespace armarx
30 {
32  {
33  _widget.setupUi(getWidget());
34  }
35 
36 
38  {
39 
40  }
41 
42 
44  {
45  _debugObserverName = settings->value("DebugObserver", "DebugObserver").toString().toStdString();
46  }
47 
49  {
50  settings->setValue("DebugObserver", QString::fromStdString(_debugObserverName));
51  }
52 
53 
55  {
56  offeringTopic(_debugObserverName);
57  connect(_widget.pushButtonSend, SIGNAL(clicked()), this, SLOT(on_pushButtonSend_clicked()));
58  }
59 
60 
62  {
63  getTopic(_debugObserver, _debugObserverName);
64  }
65 
66  void WriteToDebugObserverGuiPluginWidgetController::on_pushButtonSend_clicked()
67  {
68  const std::string channel = _widget.lineEditChannelName->text().toStdString();
69  const std::string datafield = _widget.lineEditDatafield->text().toStdString();
70  const std::string value = _widget.lineEditValue->text().toStdString();
71 
72  if (datafield.empty() || channel.empty())
73  {
74  return;
75  }
76 
77  _debugObserver->setDebugDatafield(channel, datafield, new Variant{value});
78  }
79 
81  {
82  if (!_dialog)
83  {
84  _dialog = new SimpleConfigDialog(parent);
85  _dialog->addProxyFinder<DebugObserverInterfacePrx>({"DebugObserver", "", "DebugObserver*"});
86  }
87  return qobject_cast<SimpleConfigDialog*>(_dialog);
88  }
90  {
91  _debugObserverName = _dialog->getProxyName("DebugObserver");
92  }
93 }
94 
armarx::WriteToDebugObserverGuiPluginWidgetController::saveSettings
void saveSettings(QSettings *settings) override
Definition: WriteToDebugObserverGuiPluginWidgetController.cpp:48
armarx::WriteToDebugObserverGuiPluginWidgetController::WriteToDebugObserverGuiPluginWidgetController
WriteToDebugObserverGuiPluginWidgetController()
Controller Constructor.
Definition: WriteToDebugObserverGuiPluginWidgetController.cpp:31
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
WriteToDebugObserverGuiPluginWidgetController.h
armarx::WriteToDebugObserverGuiPluginWidgetController::~WriteToDebugObserverGuiPluginWidgetController
virtual ~WriteToDebugObserverGuiPluginWidgetController()
Controller destructor.
Definition: WriteToDebugObserverGuiPluginWidgetController.cpp:37
armarx::WriteToDebugObserverGuiPluginWidgetController::loadSettings
void loadSettings(QSettings *settings) override
Definition: WriteToDebugObserverGuiPluginWidgetController.cpp:43
armarx::WriteToDebugObserverGuiPluginWidgetController::onConnectComponent
void onConnectComponent() override
Definition: WriteToDebugObserverGuiPluginWidgetController.cpp:61
armarx::ManagedIceObject::getTopic
TopicProxyType getTopic(const std::string &name)
Returns a proxy of the specified topic.
Definition: ManagedIceObject.h:451
armarx::ManagedIceObject::offeringTopic
void offeringTopic(const std::string &name)
Registers a topic for retrival after initialization.
Definition: ManagedIceObject.cpp:290
armarx::WriteToDebugObserverGuiPluginWidgetController::onInitComponent
void onInitComponent() override
Definition: WriteToDebugObserverGuiPluginWidgetController.cpp:54
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
armarx::ArmarXWidgetController::getWidget
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
Definition: ArmarXWidgetController.cpp:54
armarx::WriteToDebugObserverGuiPluginWidgetController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent=0) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: WriteToDebugObserverGuiPluginWidgetController.cpp:80
Variant.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::WriteToDebugObserverGuiPluginWidgetController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: WriteToDebugObserverGuiPluginWidgetController.cpp:89
armarx::SimpleConfigDialog
A config-dialog containing one (or multiple) proxy finders.
Definition: SimpleConfigDialog.h:84