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