MMMPlayerGuiPlugin.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 Lesser General Public License as
6* published by the Free Software Foundation; either version 2 of
7* the License, or (at your option) any later version.
8*
9* ArmarX is distributed in the hope that it will be useful, but
10* WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU Lesser General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with this program. If not, see <http://www.gnu.org/licenses/>.
16*
17* @package ArmarX::Component::ObjectExaminerGuiPlugin
18* @author Nikolaus Vahrenkamp ( vahrenkamp at kit dot edu)
19* @copyright 2012
20* @license http://www.gnu.org/licenses/gpl.txt
21* GNU General Public License
22
23*/
24
25#pragma once
26
27/* ArmarX headers */
32
35
37
38#include <RobotComponents/gui-plugins/MMMPlayerPlugin/ui_MMMPlayerGuiPlugin.h>
39
41
42/* Qt headers */
43#include <string>
44
45#include <QFileDialog>
46#include <QLayout>
47#include <QListWidget>
48#include <QMainWindow>
49#include <QTimer>
50
51#include <RobotAPI/interface/components/TrajectoryPlayerInterface.h>
53
54#include <RobotComponents/interface/components/MMMPlayerInterface.h>
55
56namespace armarx
57{
59
60 /*!
61 \class MMMPlayerGuiPlugin
62 \brief This plugin provides a widget with which the MMMPlayer can be controlled.
63
64 \see MMMPlayerWidget
65 */
67 {
68 Q_OBJECT
69 Q_INTERFACES(ArmarXGuiInterface)
70 Q_PLUGIN_METADATA(IID "ArmarXGuiInterface/1.00")
71 public:
73
74 QString
75 getPluginName() override
76 {
77 return "MMMPlayerGuiPlugin";
78 }
79 };
80
81 /*!
82 \class MMMPlayerWidget
83 \brief With this widget the MMMPlayer can be controlled.
84
85 \ingroup RobotAPI-ArmarXGuiPlugins ArmarXGuiPlugins
86 \see MMMPlayerGuiPlugin
87 */
89 {
90 Q_OBJECT
91 public:
93
95 {
96 }
97
98 // inherited from Component
99 void onInitComponent() override;
100 void onConnectComponent() override;
101 void onExitComponent() override;
102 void onDisconnectComponent() override;
103
104 // inherited of ArmarXWidget
105 static QString
107 {
108 return "RobotControl.MMMPlayerGUI";
109 }
110
111 static QIcon
113 {
114 return QIcon(":icons/MMM.png");
115 }
116
117 QPointer<QDialog>
118 getConfigDialog(QWidget* parent = 0) override
119 {
120 if (!dialog)
121 {
122 dialog = new MMMPlayerConfigDialog(parent);
123 }
124
125 return qobject_cast<MMMPlayerConfigDialog*>(dialog);
126 }
127
128 bool onClose() override;
129
130
131 void loadSettings(QSettings* settings) override;
132 void saveSettings(QSettings* settings) override;
133 // void configured();
134
136 void loadTrajPlayer();
137 void setSpeed(double value);
138 signals:
139
140 private slots:
141
142 void on_initializeButton_clicked();
143
144 void on_startButton_clicked();
145
146 void on_previewButton_clicked();
147
148 void on_pauseButton_clicked();
149
150 void on_stopButton_clicked();
151
152 void configFileSelected();
153
154 void updateSlider();
155
156 void setupJointList();
157
158 void setupMotionList();
159
160 void on_loopPlayback_toggled(bool state);
161
162 void jointListChanged(QListWidgetItem* joint);
163
164 void motionChanged(int);
165
166 void on_spinBoxFPS_valueChanged(double value);
167
168 void on_controlMode_changed(int controlMode);
169
170 void on_enableRobotPoseUnit_toggled(bool state);
171
172 protected:
173 void connectSlots();
174
175 std::string configFile;
176 Ui::MMMPlayerGuiPlugin ui;
177 MMMPlayerInterfacePrx MMMLoader;
178 TrajectoryPlayerInterfacePrx trajPlayer;
179
180 private:
181 QPointer<QWidget> __widget;
182 QPointer<MMMPlayerConfigDialog> dialog;
183 QFileDialog* fileDialog2;
184 QListWidget* jointList;
185
186 QTimer* updateTimer;
187 bool isComponentCreated;
188 };
189
190 //using MMMPlayerGuiPluginPtr = boost::shared_ptr<MMMPlayerWidget>;
191} // namespace armarx
The main gui interface.
QString getPluginName() override
void onInitComponent() override
Pure virtual hook for the subclass.
bool onClose() override
If you overwrite this method, make sure to call this implementation at the end of your implementation...
MMMPlayerInterfacePrx MMMLoader
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.
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.
TrajectoryPlayerInterfacePrx trajPlayer
Ui::MMMPlayerGuiPlugin ui
void onExitComponent() override
Hook for subclass.
This file offers overloads of toIce() and fromIce() functions for STL container types.