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 
40 #include "MMMPlayerConfigDialog.h"
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 
56 namespace armarx
57 {
58  class MMMPlayerConfigDialog;
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 
135  void startComponent();
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
armarx::MMMPlayerWidget::onInitComponent
void onInitComponent() override
Pure virtual hook for the subclass.
Definition: MMMPlayerGuiPlugin.cpp:103
armarx::MMMPlayerWidget::onExitComponent
void onExitComponent() override
Hook for subclass.
Definition: MMMPlayerGuiPlugin.cpp:175
armarx::MMMPlayerWidget::getConfigDialog
QPointer< QDialog > getConfigDialog(QWidget *parent=0) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
Definition: MMMPlayerGuiPlugin.h:118
armarx::MMMPlayerWidget::startComponent
void startComponent()
armarx::MMMPlayerWidget::setSpeed
void setSpeed(double value)
Definition: MMMPlayerGuiPlugin.cpp:272
armarx::MMMPlayerWidget::~MMMPlayerWidget
~MMMPlayerWidget()
Definition: MMMPlayerGuiPlugin.h:94
armarx::ArmarXGuiPlugin
Definition: ArmarXGuiPlugin.h:46
armarx::MMMPlayerWidget::onClose
bool onClose() override
If you overwrite this method, make sure to call this implementation at the end of your implementation...
Definition: MMMPlayerGuiPlugin.cpp:185
MMMPlayerConfigDialog.h
armarx::MMMPlayerWidget::onDisconnectComponent
void onDisconnectComponent() override
Hook for subclass.
Definition: MMMPlayerGuiPlugin.cpp:180
armarx::MMMPlayerWidget::MMMLoader
MMMPlayerInterfacePrx MMMLoader
Definition: MMMPlayerGuiPlugin.h:177
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
Observer.h
RobotAPIObjectFactories.h
armarx::MMMPlayerWidget::ui
Ui::MMMPlayerGuiPlugin ui
Definition: MMMPlayerGuiPlugin.h:176
ArmarXGuiInterface
The main gui interface.
Definition: ArmarXGuiInterface.h:80
ArmarXGuiPlugin.h
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
ArmarXComponentWidgetController.h
armarx::MMMPlayerWidget::configFile
std::string configFile
Definition: MMMPlayerGuiPlugin.h:175
armarx::MMMPlayerGuiPlugin
This plugin provides a widget with which the MMMPlayer can be controlled.
Definition: MMMPlayerGuiPlugin.h:66
armarx::MMMPlayerWidget::connectSlots
void connectSlots()
Definition: MMMPlayerGuiPlugin.cpp:228
armarx::MMMPlayerWidget::MMMPlayerWidget
MMMPlayerWidget()
Definition: MMMPlayerGuiPlugin.cpp:64
armarx::MMMPlayerWidget::loadTrajPlayer
void loadTrajPlayer()
Definition: MMMPlayerGuiPlugin.cpp:216
Component.h
armarx::MMMPlayerGuiPlugin::MMMPlayerGuiPlugin
MMMPlayerGuiPlugin()
Definition: MMMPlayerGuiPlugin.cpp:59
armarx::MMMPlayerWidget::saveSettings
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
Definition: MMMPlayerGuiPlugin.cpp:211
Trajectory.h
armarx::MMMPlayerWidget::loadSettings
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
Definition: MMMPlayerGuiPlugin.cpp:206
armarx::MMMPlayerWidget::trajPlayer
TrajectoryPlayerInterfacePrx trajPlayer
Definition: MMMPlayerGuiPlugin.h:178
armarx::MMMPlayerGuiPlugin::getPluginName
QString getPluginName() override
Definition: MMMPlayerGuiPlugin.h:75
armarx::MMMPlayerWidget::onConnectComponent
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition: MMMPlayerGuiPlugin.cpp:149
armarx::MMMPlayerWidget::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: MMMPlayerGuiPlugin.h:112
Logging.h
armarx::MMMPlayerWidget::GetWidgetName
static QString GetWidgetName()
Definition: MMMPlayerGuiPlugin.h:106
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::MMMPlayerWidget
With this widget the MMMPlayer can be controlled.
Definition: MMMPlayerGuiPlugin.h:88
Application.h
armarx::MMMPlayerConfigDialog
Definition: MMMPlayerConfigDialog.h:40