qtopengl_main_window.h
Go to the documentation of this file.
1 
7 #ifndef QTOPENGL_MAIN_WINDOW_H
8 #define QTOPENGL_MAIN_WINDOW_H
9 
10 namespace argos {
11  class CQTOpenGLMainWindow;
12  class CQTOpenGLWidget;
13  class CQTOpenGLLogStream;
14  class CQTOpenGLUserFunctions;
15 }
16 
17 class QMainWindow;
18 class QWidget;
19 class QHBoxLayout;
20 class QPushButton;
21 class QLCDNumber;
22 class QStatusBar;
23 class QDockWidget;
24 class QTextEdit;
25 class QButtonGroup;
26 class QSpinBox;
27 class QDoubleSpinBox;
28 class QActionGroup;
29 
30 #include <argos3/core/utility/configuration/argos_configuration.h>
31 #include <argos3/core/simulator/visualization/visualization.h>
32 #include <QMainWindow>
33 
34 namespace argos {
35 
36  class CQTOpenGLMainWindow : public QMainWindow {
37 
38  Q_OBJECT
39 
40  public:
41 
43  virtual ~CQTOpenGLMainWindow();
44 
46  return *m_pcOpenGLWidget;
47  }
48 
49  inline const CQTOpenGLWidget& GetOpenGLWidget() const {
50  return *m_pcOpenGLWidget;
51  }
52 
54  return *m_pcUserFunctions;
55  }
56 
57  inline const CQTOpenGLUserFunctions& GetUserFunctions() const {
58  return *m_pcUserFunctions;
59  }
60 
61  inline const QString& GetIconDir() const {
62  return m_strIconDir;
63  }
64 
65  inline const QString& GetTextureDir() const {
66  return m_strTextureDir;
67  }
68 
69  inline const QString& GetModelDir() const {
70  return m_strModelDir;
71  }
72 
73  private:
74 
75  void ReadSettingsPreCreation();
76  void ReadSettingsPostCreation();
77  void WriteSettings();
78 
79  void CreateExperimentActions();
80  void CreateCameraActions();
81  void CreatePOVRayActions();
82  void CreateHelpActions();
83 
84  void CreateExperimentToolBar();
85  void CreateExperimentMenu();
86  void CreateCameraToolBar();
87  void CreateCameraMenu();
88  void CreatePOVRayMenu();
89  void CreateHelpMenu();
90 
91  void CreateOpenGLWidget(TConfigurationNode& t_tree);
92  void CreateLogMessageDock();
93  void CreateConnections();
94 
95  void CreateUserFunctions(TConfigurationNode& t_tree);
96 
97  virtual void closeEvent(QCloseEvent* pc_event);
98 
99  signals:
100 
105  void CameraSwitched(int n_camera);
106 
111 
116 
121 
130 
139 
145 
152 
157 
158  public slots:
159 
165  void PlayExperiment();
166 
171  void FastForwardExperiment();
172 
176  void StepExperiment();
177 
183  void PauseExperiment();
184 
188  void TerminateExperiment();
189 
194  void ResetExperiment();
195 
199  void SuspendExperiment();
200 
204  void ResumeExperiment();
205 
206  void CameraXMLPopUp();
207 
208  QString GetCameraXMLData();
209 
210  void SwitchCamera(QAction*);
211 
212  // void POVRaySceneXMLPopUp();
213  // QString GetPOVRaySceneXMLData();
214  // void POVRayScenePreview();
215 
216  private:
217 
218  enum EExperimentState {
219  EXPERIMENT_INITIALIZED = 0,
220  EXPERIMENT_PLAYING,
221  EXPERIMENT_FAST_FORWARDING,
222  EXPERIMENT_PAUSED,
223  EXPERIMENT_SUSPENDED,
224  EXPERIMENT_DONE
225  };
226 
227  private:
228 
229  CQTOpenGLWidget* m_pcOpenGLWidget;
230  QString m_strIconDir;
231  QString m_strTextureDir;
232  QString m_strModelDir;
233 
234  EExperimentState m_eExperimentState;
235 
236  QAction* m_pcPlayAction;
237  QAction* m_pcFastForwardAction;
238  QAction* m_pcStepAction;
239  QAction* m_pcResetAction;
240  QAction* m_pcTerminateAction;
241  QAction* m_pcPauseAction;
242  QAction* m_pcCaptureAction;
243  QAction* m_pcQuitAction;
244  QSpinBox* m_pcDrawFrameEvery;
245  QLCDNumber* m_pcCurrentStepLCD;
246  QToolBar* m_pcExperimentToolBar;
247  QMenu* m_pcExperimentMenu;
248 
249  QAction* m_pcShowCameraXMLAction;
250  QList<QAction*> m_pcSwitchCameraActions;
251  QActionGroup* m_pcSwitchCameraActionGroup;
252  QDoubleSpinBox* m_pcFocalLength;
253  QToolBar* m_pcCameraToolBar;
254  QMenu* m_pcCameraMenu;
255 
256  QAction* m_pcPOVRayXMLAction;
257  QAction* m_pcPOVRayPreviewAction;
258  QMenu* m_pcPOVRayMenu;
259 
260  QAction* m_pcAboutQTAction;
261  QMenu* m_pcHelpMenu;
262 
263  QStatusBar* m_pcStatusbar;
264 
265  QDockWidget* m_pcLogDock;
266  QDockWidget* m_pcLogErrDock;
267  QTextEdit* m_pcDockLogBuffer;
268  QTextEdit* m_pcDockLogErrBuffer;
269  CQTOpenGLLogStream* m_pcLogStream;
270  CQTOpenGLLogStream* m_pcLogErrStream;
271 
272  bool m_bWasLogColored;
273 
274  CQTOpenGLUserFunctions* m_pcUserFunctions;
275  };
276 
277 }
278 
279 #endif
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
void FastForwardExperiment()
Fast forwards the experiment.
void SuspendExperiment()
Suspends an experiment due to an error.
void ExperimentReset()
Emitted when the experiment has been reset.
CQTOpenGLUserFunctions & GetUserFunctions()
void StepExperiment()
Executes one experiment time step.
const CQTOpenGLUserFunctions & GetUserFunctions() const
void PlayExperiment()
Plays the experiment.
void ExperimentSuspended()
Emitted when the experiment has been suspended.
const QString & GetTextureDir() const
const QString & GetModelDir() const
const QString & GetIconDir() const
void ExperimentDone()
Emitted when the experiment is finished.
const CQTOpenGLWidget & GetOpenGLWidget() const
void ExperimentStarted()
Emitted when the experiment has just been started.
CQTOpenGLWidget & GetOpenGLWidget()
void ExperimentResumed()
Emitted when the experiment has just been resumed.
void ResumeExperiment()
Resumes a suspended experiment.
void CameraSwitched(int n_camera)
Emitted whenever the user presses a camera button to switch camera.
void ExperimentPaused()
Emitted when the experiment has been paused.
void ExperimentPlaying()
Emitted when the experiment has (re)started playing.
void ResetExperiment()
Resets the state of the experiment to its state right after initialization.
void PauseExperiment()
Pauses the experiment.
CQTOpenGLMainWindow(TConfigurationNode &t_tree)
void ExperimentFastForwarding()
Emitted when the experiment has (re)started fast-forwarding.
void TerminateExperiment()
Terminates the execution of the experiment.
The QTOpenGL user functions.