SkillManagerMonitorWidgetController.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 RobotAPI::gui-plugins::SkillManagerMonitorWidgetController
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 <memory>
26 #include <optional>
27 #include <regex>
28 #include <string>
29 
30 #include <SimoxUtility/algorithm/string.h>
31 
33 
36 
37 // modals
39 
40 // debug
41 #include <QAction>
42 #include <QClipboard>
43 #include <QDoubleSpinBox>
44 #include <QGridLayout>
45 #include <QMenu>
46 #include <QTextBrowser>
47 
51 
52 #include "aronTreeWidget/Data.h"
57 
58 //configSk
59 namespace armarx
60 {
61 
62  QPointer<QDialog>
64  {
65  if (!dialog)
66  {
67  dialog = new SimpleConfigDialog(parent);
68  dialog->addProxyFinder<skills::manager::dti::SkillManagerInterfacePrx>(
69  "SkillMemory", "", "SkillMem*");
70  }
71  return qobject_cast<SimpleConfigDialog*>(dialog);
72  }
73 
74  void
76  {
77  observerName = dialog->getProxyName("SkillMemory");
78  }
79 
80  void
82  {
83  observerName = settings->value("SkillMemory", "SkillMemory").toString().toStdString();
84  }
85 
86  void
88  {
89  settings->setValue("SkillMemory", QString::fromStdString(observerName));
90  }
91 } // namespace armarx
92 
93 // Others
94 namespace armarx
95 {
97  {
98 
99  widget.setupUi(getWidget());
100 
101  // setup memory
102  this->mem_wrapper = std::make_shared<skills::gui::SkillManagerWrapper>();
103 
104  viewer = std::make_unique<armarx::skills::gui::SkillMemoryGUI>(
105  widget.treeWidgetSkillExecutions,
106  widget.groupBoxSkillExecutions->layout(),
107 
108  widget.groupBoxSkills,
109  widget.splitter,
110 
111  widget.groupBoxSkillDetails,
112  widget.splitter,
113 
114  widget.updateWidgetLayout,
115 
116  widget.stopAllLayout,
117 
118  widget.connectionStatusLabel,
119 
120  this->mem_wrapper);
121 
122  connectSignals();
123  }
124 
125  void
126  SkillManagerMonitorWidgetController::connectSignals()
127  {
128  // disconnect
129  connect(this,
131  this->mem_wrapper.get(),
133  connect(this,
135  this->viewer.get(),
137 
138  // connect
139  connect(this,
141  viewer.get(),
143  }
144 
146  {
147  }
148 
149  void
151  {
152  usingProxy(observerName);
153  }
154 
155  void
157  {
158 
159  getProxy(this->memory, observerName, 1000);
160  connected = true;
161  mem_wrapper->connectMemory(this->memory);
162  emit connectGui(observerName);
163  }
164 
165  void
167  {
168  connected = false;
169  memory = nullptr;
170  emit disconnectGui();
171  }
172 
173 } // namespace armarx
armarx::SkillManagerMonitorWidgetController::connectGui
void connectGui(std::string observerName)
armarx::skills::gui::SkillMemoryGUI::disconnectGui
void disconnectGui()
Notify affected widgets to clear all saved state.
Data.h
armarx::skills::gui::SkillManagerWrapper::disconnectMemory
void disconnectMemory()
Disconnects the interface from memory.
Definition: SkillManagerWrapper.cpp:170
armarx::SkillManagerMonitorWidgetController::SkillManagerMonitorWidgetController
SkillManagerMonitorWidgetController()
Controller Constructor.
Definition: SkillManagerMonitorWidgetController.cpp:96
armarx::skills::gui::SkillMemoryGUI::connectGui
void connectGui(std::string observerName)
Notify widgets of new connection.
AronTreeWidgetTextInputModalController.h
armarx::memory
Brief description of class memory.
Definition: memory.h:39
NLohmannJSONConverter.h
SkillManagerMonitorWidgetController.h
AronTreeWidgetModalCreator.h
Skill.h
armarx::SkillManagerMonitorWidgetController::disconnectGui
void disconnectGui()
armarx::SkillManagerMonitorWidgetController::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: SkillManagerMonitorWidgetController.cpp:81
SkillExecutionRequest.h
armarx::SkillManagerMonitorWidgetController::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: SkillManagerMonitorWidgetController.cpp:156
armarx::SkillManagerMonitorWidgetController::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: SkillManagerMonitorWidgetController.cpp:63
SkillDescriptionWidget.h
armarx::ArmarXWidgetController::getWidget
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
Definition: ArmarXWidgetController.cpp:54
armarx::ManagedIceObject::getProxy
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
Definition: ManagedIceObject.cpp:393
armarx::SkillManagerMonitorWidgetController::~SkillManagerMonitorWidgetController
virtual ~SkillManagerMonitorWidgetController()
Controller destructor.
Definition: SkillManagerMonitorWidgetController.cpp:145
AronTreeWidgetConverter.h
AronTreeWidgetCreator.h
armarx::ManagedIceObject::usingProxy
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Definition: ManagedIceObject.cpp:151
armarx::SkillManagerMonitorWidgetController::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: SkillManagerMonitorWidgetController.cpp:75
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::SkillManagerMonitorWidgetController::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: SkillManagerMonitorWidgetController.cpp:87
armarx::SkillManagerMonitorWidgetController::onDisconnectComponent
void onDisconnectComponent()
Hook for subclass.
Definition: SkillManagerMonitorWidgetController.cpp:166
armarx::SkillManagerMonitorWidgetController::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: SkillManagerMonitorWidgetController.cpp:150
armarx::SimpleConfigDialog
A config-dialog containing one (or multiple) proxy finders.
Definition: SimpleConfigDialog.h:84