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
59namespace 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
94namespace 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
148
149 void
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
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
A config-dialog containing one (or multiple) proxy finders.
void connectGui(std::string observerName)
void onInitComponent() override
Pure virtual hook for the subclass.
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void onConnectComponent() override
Pure virtual hook for the subclass.
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
void disconnectMemory()
Disconnects the interface from memory.
void connectGui(std::string observerName)
Notify widgets of new connection.
void disconnectGui()
Notify affected widgets to clear all saved state.
This file offers overloads of toIce() and fromIce() functions for STL container types.