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 void loadButtons();
127 void editShortcut(const std::string& name);
128 void deleteShortcut(const std::string& name);
129 void executeSkill(const std::string& name);
130 void exportButtons();
131 void activateButton(const std::string& name, skills::core::dto::Execution::Status status);
132 void onShortcutNameChanged();
133 void editMode(bool edit);
134 void enableBlockedButtons();
135 void importButtons();
136 void addFromClipboard();
137 void stopAll();
138 void saveShortcutOrder();
139 void loadPath();
140
141 private:
142 SkillDashboardConfigWindow* configWindow;
143 QVBoxLayout* shortcutLayout;
144 const std::string DEFAULT_SETTINGS_PLUGIN_NAME;
145 const std::string DEFAULT_SETTINGS_CUSTOM_TEXT;
146 QPointer<armarx::SimpleConfigDialog> m_config_dialog;
147 std::string skillDashboardProxyName;
148 std::string skillManagerOberserverName = "SkillManager";
149 SkillDashboardInterfacePrx dashboardPrx;
150 void clearLayout(QLayout* layout);
151 armarx::skills::manager::dti::SkillManagerInterfacePrx managerPrx;
152 std::thread exampleTask;
153 void exampleThreadMethod();
154 void updateShortcutListHeight();
155 std::atomic_bool connected = false;
156 std::map<std::string, EllipsisPushButton*> shortcutButtons;
157 std::map<std::string, QToolButton*> deleteButtons;
158 std::map<std::string, QToolButton*> configButtons;
159 std::map<std::string, skills::manager::dto::SkillExecutionID> runningSkills;
161 std::string currentShortcutName;
162 QAction* editModeAction;
163 QToolButton* recoverButtons;
164 QPointer<QToolBar> customToolbar;
165 bool initGUI = true;
166 bool editModeSetting;
167 MessageWidget* errorMessageArea;
168 };
169} // 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.