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 */
27 #include <RobotAPI/gui-plugins/HapticUnitPlugin/ui_HapticUnitGuiPlugin.h>
32 
33 /* Qt headers */
34 #include <QMainWindow>
35 #include <QtCore/QTimer>
36 #include <RobotAPI/interface/units/WeissHapticUnit.h>
37 
38 #include <string>
39 #include <QLayout>
41 
42 
43 namespace armarx
44 {
45  class HapticUnitConfigDialog;
46 
48  public ArmarXGuiPlugin
49  {
50  Q_OBJECT
51  Q_INTERFACES(ArmarXGuiInterface)
52  Q_PLUGIN_METADATA(IID "ArmarXGuiInterface/1.00")
53  public:
55  QString getPluginName() override
56  {
57  return "HapticUnitGuiPlugin";
58  }
59  };
60 
61  /*!
62  \page RobotAPI-GuiPlugins-HapticUnitPlugin HapticUnitPlugin
63  \brief With this widget the HapticUnit can be controlled.
64  */
66  public ArmarXComponentWidgetControllerTemplate<HapticUnitWidget>
67  {
68  Q_OBJECT
69  public:
71  ~HapticUnitWidget() override
72  {}
73 
74  // inherited from Component
75  void onInitComponent() override;
76  void onConnectComponent() override;
77  void onExitComponent() override;
78  void onDisconnectComponent() override;
79 
80  // inherited of ArmarXWidget
81  static QString GetWidgetName()
82  {
83  return "RobotControl.HapticUnitGUI";
84  }
85  static QIcon GetWidgetIcon()
86  {
87  return QIcon("://icons/haptic-hand.png");
88  }
89 
90  QPointer<QDialog> getConfigDialog(QWidget* parent = 0) override;
91  void loadSettings(QSettings* settings) override;
92  void saveSettings(QSettings* settings) override;
93  void configured() override;
94 
95  public slots:
96  void updateData();
97  void onContextMenu(QPoint pos);
98 
99  signals:
100  void doUpdateDisplayWidgets();
101 
102  private slots:
103  void updateDisplayWidgets();
104  void onCheckBoxOffsetFilterStateChanged(int state);
105 
106  protected:
107  void connectSlots();
108 
109  Ui::HapticUnitGuiPlugin ui;
110 
111  private:
112 
113  void createMatrixWidgets();
114 
115  private:
116 
117  std::string hapticObserverProxyName;
118  std::string hapticUnitProxyName;
119  ObserverInterfacePrx hapticObserverProxy;
120  WeissHapticUnitInterfacePrx weissHapticUnit;
121 
122  QPointer<QWidget> __widget;
123  QPointer<HapticUnitConfigDialog> dialog;
124 
125  QTimer* updateTimer;
126 
127  std::map<std::string, MatrixDatafieldDisplayWidget*> matrixDisplays;
128  std::map<MatrixDatafieldDisplayWidget*, std::string> channelNameReverseMap;
129  std::map<MatrixDatafieldDisplayWidget*, std::string> deviceNameReverseMap;
130 
131  };
132  //using HapticUnitGuiPluginPtr = std::shared_ptr<HapticUnitWidget>;
133 }
134 
armarx::HapticUnitWidget::connectSlots
void connectSlots()
Definition: HapticUnitGuiPlugin.cpp:178
armarx::HapticUnitWidget::updateData
void updateData()
Definition: HapticUnitGuiPlugin.cpp:114
armarx::HapticUnitWidget::~HapticUnitWidget
~HapticUnitWidget() override
Definition: HapticUnitGuiPlugin.h:71
armarx::HapticUnitWidget::ui
Ui::HapticUnitGuiPlugin ui
Definition: HapticUnitGuiPlugin.h:109
armarx::ArmarXGuiPlugin
Definition: ArmarXGuiPlugin.h:46
armarx::HapticUnitWidget
Definition: HapticUnitGuiPlugin.h:65
armarx::HapticUnitWidget::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent=0) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: HapticUnitGuiPlugin.cpp:98
armarx::HapticUnitWidget::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: HapticUnitGuiPlugin.cpp:92
armarx::HapticUnitWidget::onContextMenu
void onContextMenu(QPoint pos)
Definition: HapticUnitGuiPlugin.cpp:131
armarx::HapticUnitWidget::configured
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
Definition: HapticUnitGuiPlugin.cpp:109
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
Observer.h
armarx::HapticUnitWidget::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: HapticUnitGuiPlugin.cpp:173
armarx::HapticUnitWidget::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: HapticUnitGuiPlugin.cpp:168
ArmarXGuiInterface
The main gui interface.
Definition: ArmarXGuiInterface.h:74
ArmarXGuiPlugin.h
ArmarXComponentWidgetController.h
armarx::HapticUnitWidget::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: HapticUnitGuiPlugin.cpp:75
armarx::HapticUnitWidget::GetWidgetName
static QString GetWidgetName()
Definition: HapticUnitGuiPlugin.h:81
armarx::HapticUnitWidget::HapticUnitWidget
HapticUnitWidget()
Definition: HapticUnitGuiPlugin.cpp:51
Component.h
armarx::HapticUnitWidget::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: HapticUnitGuiPlugin.cpp:67
armarx::HapticUnitGuiPlugin::HapticUnitGuiPlugin
HapticUnitGuiPlugin()
Definition: HapticUnitGuiPlugin.cpp:45
MatrixDatafieldDisplayWidget.h
armarx::HapticUnitWidget::doUpdateDisplayWidgets
void doUpdateDisplayWidgets()
armarx::HapticUnitWidget::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: HapticUnitGuiPlugin.cpp:87
armarx::HapticUnitGuiPlugin::getPluginName
QString getPluginName() override
Definition: HapticUnitGuiPlugin.h:55
armarx::HapticUnitGuiPlugin
Definition: HapticUnitGuiPlugin.h:47
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::HapticUnitWidget::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: HapticUnitGuiPlugin.h:85