HapticUnitGuiPlugin.h
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 ArmarX::Component::ObjectExaminerGuiPlugin
17* @author Nikolaus Vahrenkamp ( vahrenkamp at kit dot edu)
18* @copyright 2012
19* @license http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21
22*/
23
24#pragma once
25
26/* ArmarX headers */
29
32
33/* Qt headers */
34#include <string>
35
36#include <QLayout>
37#include <QMainWindow>
38#include <QtCore/QTimer>
39
40#include <RobotAPI/interface/units/WeissHapticUnit.h>
41
43
44// C++ includes
45#include <memory>
46
47// ui_HapticUnitGuiPlugin.h is included by the .cpp, not here: moc textually inlines every
48// #include it can resolve, and parsing the uic-generated header alongside this one
49// makes moc mis-qualify this class as Ui::armarx::*.
50namespace Ui
51{
52 class HapticUnitGuiPlugin;
53}
54
55namespace armarx
56{
58
60 {
61 Q_OBJECT
62 Q_INTERFACES(ArmarXGuiInterface)
63 Q_PLUGIN_METADATA(IID "ArmarXGuiInterface/1.00")
64 public:
66
67 QString
68 getPluginName() override
69 {
70 return "HapticUnitGuiPlugin";
71 }
72 };
73
74 /*!
75 \page RobotAPI-GuiPlugins-HapticUnitPlugin HapticUnitPlugin
76 \brief With this widget the HapticUnit can be controlled.
77 */
79 {
80 Q_OBJECT
81 public:
83
84 // Defined in the .cpp, where Ui::HapticUnitGuiPlugin is complete.
86
87 // inherited from Component
88 void onInitComponent() override;
89 void onConnectComponent() override;
90 void onExitComponent() override;
91 void onDisconnectComponent() override;
92
93 // inherited of ArmarXWidget
94 static QString
96 {
97 return "RobotControl.HapticUnitGUI";
98 }
99
100 static QIcon
102 {
103 return QIcon("://icons/haptic-hand.png");
104 }
105
106 QPointer<QDialog> getConfigDialog(QWidget* parent = 0) override;
107 void loadSettings(QSettings* settings) override;
108 void saveSettings(QSettings* settings) override;
109 void configured() override;
110
111 public slots:
112 void updateData();
113 void onContextMenu(QPoint pos);
114
115 signals:
117
118 private slots:
119 void updateDisplayWidgets();
120 void onCheckBoxOffsetFilterStateChanged(int state);
121
122 protected:
123 void connectSlots();
124
125 std::unique_ptr<Ui::HapticUnitGuiPlugin> ui;
126
127 private:
128 void createMatrixWidgets();
129
130 private:
131 std::string hapticObserverProxyName;
132 std::string hapticUnitProxyName;
133 ObserverInterfacePrx hapticObserverProxy;
134 WeissHapticUnitInterfacePrx weissHapticUnit;
135
136 QPointer<QWidget> __widget;
137 QPointer<HapticUnitConfigDialog> dialog;
138
139 QTimer* updateTimer;
140
141 std::map<std::string, MatrixDatafieldDisplayWidget*> matrixDisplays;
142 std::map<MatrixDatafieldDisplayWidget*, std::string> channelNameReverseMap;
143 std::map<MatrixDatafieldDisplayWidget*, std::string> deviceNameReverseMap;
144 };
145
146 //using HapticUnitGuiPluginPtr = std::shared_ptr<HapticUnitWidget>;
147} // namespace armarx
The main gui interface.
void onInitComponent() override
Pure virtual hook for the subclass.
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.
std::unique_ptr< Ui::HapticUnitGuiPlugin > ui
QPointer< QDialog > getConfigDialog(QWidget *parent=0) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
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 onExitComponent() override
Hook for subclass.
ArmarX Headers.
This file offers overloads of toIce() and fromIce() functions for STL container types.