SkillDashboardWidgetController.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarXGui::gui-plugins::OperatorViewWidgetController
19 * @author Leonie Leven
20 * @date 2024
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27#include <thread>
28#include <unordered_set>
29
30#include <QApplication>
31#include <QClipboard>
32#include <QLabel>
33#include <QMainWindow>
34#include <QMap>
35#include <QPushButton>
36#include <QString>
37#include <QTimer>
38#include <QToolBar>
39#include <QVBoxLayout>
40#include <QWidget>
41
44
45//#include <ArmarXGui/gui-plugins/DemoStateOperatorView/flowlayout.h>
46#include <stack>
47
51
52#include <RobotAPI/gui-plugins/ui_SkillDashboardWidget_small.h>
53#include <RobotAPI/interface/components/SkillDashboardInterface.h>
54#include <RobotAPI/interface/skills/SkillManagerInterface.h>
55#include <RobotAPI/interface/skills/SkillMemoryInterface.h>
58
59#include "EllipsisPushButton.h"
61
62namespace armarx
63{
64
66 {
67 Q_OBJECT
68 Q_INTERFACES(ArmarXGuiInterface)
69 Q_PLUGIN_METADATA(IID "ArmarXGuiInterface/1.00")
70 public:
72
73 QString
74 getPluginName() override
75 {
76 return "SkillDashboardWidget";
77 }
78 };
79
81 public ArmarXComponentWidgetControllerTemplate<SkillDashboardWidget>
82 {
83 Q_OBJECT
84 public:
85 explicit SkillDashboardWidget();
86
88 {
89 }
90
91 // inherited from Component
92 void onInitComponent() override;
93 void onConnectComponent() override;
94 void onDisconnectComponent() override;
95 void onExitComponent() override;
96
97 // inherited of ArmarXWidget
98 static QString
100 {
101 return "Skills.Dashboard";
102 }
103
104 void loadSettings(QSettings* settings) override;
105 void saveSettings(QSettings* settings) override;
106 QPointer<QDialog> getConfigDialog(QWidget* parent) override;
107 QPointer<QWidget> getCustomTitlebarWidget(QWidget* parent) override;
108
109
110 void configured() override;
111
112 protected:
113 Ui::SkillDashboardWidget ui;
114
115
116 signals:
119 void skillFinished(const std::string& name, skills::core::dto::Execution::Status status);
120
121 private slots:
122 void openConfigWindow(const std::string& name = "",
123 const std::string& id = "",
124 const std::string& args = "",
125 const std::string& iconName = "",
126 const std::string& shortcutId = "");
127 void loadButtons();
128 void editShortcut(const std::string& name);
129 void deleteShortcut(const std::string& name);
130 void executeSkill(const std::string& name);
131 void exportButtons();
132 void activateButton(const std::string& name, skills::core::dto::Execution::Status status);
133 void onShortcutNameChanged();
134 void editMode(bool edit);
135 void enableBlockedButtons();
136 void importButtons();
137 void addFromClipboard();
138 void stopAll();
139 void saveShortcutOrder();
140 void loadPath();
141
142 private:
143 SkillDashboardConfigWindow* configWindow;
144 QVBoxLayout* shortcutLayout;
145 const std::string DEFAULT_SETTINGS_PLUGIN_NAME;
146 const std::string DEFAULT_SETTINGS_CUSTOM_TEXT;
147 QPointer<armarx::SimpleConfigDialog> m_config_dialog;
148 std::string skillDashboardProxyName;
149 std::string skillManagerOberserverName = "SkillManager";
150 SkillDashboardInterfacePrx dashboardPrx;
151 void clearLayout(QLayout* layout);
152 armarx::skills::manager::dti::SkillManagerInterfacePrx managerPrx;
153 std::thread exampleTask;
154 void exampleThreadMethod();
155 void updateShortcutListHeight();
156 std::atomic_bool connected = false;
157 std::map<std::string, EllipsisPushButton*> shortcutButtons;
158 std::map<std::string, QToolButton*> deleteButtons;
159 std::map<std::string, QToolButton*> configButtons;
160 std::map<std::string, skills::manager::dto::SkillExecutionID> runningSkills;
162 std::string currentShortcutName;
163 QAction* editModeAction;
164 QToolButton* recoverButtons;
165 QPointer<QToolBar> customToolbar;
166 bool initGUI = true;
167 bool editModeSetting;
168 MessageWidget* errorMessageArea;
169 };
170} // namespace armarx
The main gui interface.
void onInitComponent() override
Pure virtual hook for the subclass.
QPointer< QWidget > getCustomTitlebarWidget(QWidget *parent) override
getTitleToolbar returns a pointer to the a toolbar widget of this controller.
void onDisconnectComponent() override
Hook for 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.
void skillFinished(const std::string &name, skills::core::dto::Execution::Status status)
void onExitComponent() override
Hook for subclass.
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
This file offers overloads of toIce() and fromIce() functions for STL container types.