AGX Dynamics  2.37.3.2
PlaybackController.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXQT_PLAYBACKCONTROLLER_H
18 #define AGXQT_PLAYBACKCONTROLLER_H
19 
20 #include <agx/TimeStamp.h>
21 #include <agx/agx.h>
22 #include <agxQt/export.h>
23 #include <iostream>
24 
25 #include <agx/PushDisableWarnings.h> // Disabling warnings. Include agx/PopDisableWarnings.h below!
26 #include <QWidget>
27 #include <agxQt/ui_Controller.h>
28 #include <agx/PopDisableWarnings.h> // End of disabled warnings.
29 
30 namespace agxQt
31 {
35  class AGXQT_EXPORT PlaybackControllerWidget : public QWidget
36  {
37  Q_OBJECT
38 
39  public:
41  {
43  PAUSED
44  };
45 
46  public:
47 
48  explicit PlaybackControllerWidget(QWidget *parent = 0);
49  virtual ~PlaybackControllerWidget();
50 
51  void setEnable(bool enable);
52 
53  bool eventFilter(QObject * watched, QEvent * event);
54 
55  public slots:
56  void slotSetPause();
57  void slotSetPlay();
58  void slotInitNewPlayback(float timeStart, float timeEnd, uint maxFrames );
59  void slotInitNewSimulation();
60  void slotTimeChanged(float time);
61 
62  // Public slots used to push buttons the in the GUI
63  void slotPushPlayPause();
64  void slotPushStepForward();
65  void slotPushStepBack();
66  void slotPushIncrementSpeed();
67  void slotPushDecrementSpeed();
68 
69  void slotSetEnableRecordingNotifier(bool enable);
70 
71  signals:
72  void signalSliderTimeJump(float time);
73  void signalPlay();
74  void signalPause();
75  void signalStop();
76  void signalStepForward();
77  void signalStepBack();
78  void signalSpeedChanged(uint speed);
79  void signalEnableJournalLoop(bool enable);
80 
81  // Internal slots
82  private slots:
83  void slotSliderChanged(int value);
84  void slotStopPushed();
85  void slotForwardPushed();
86  void slotBackPushed();
87  void slotPlayPausePushed();
88  void slotSliderPressed();
89  void slotSliderReleased();
90 
91  void slotIncrementSpeedPushed();
92  void slotDecrementSpeedPushed();
93  void slotLoopCheckBoxPressed();
94 
95  protected:
96  void setEnablePlaybackGui(bool enable);
97  void setControllerState(ControllerState state);
98  void connectSignals();
99  void init();
100  void updateTimeLabels();
101  void updateSpeedButtonLabel();
102  QString constructHoverValueString();
103  float getSingleStepValue();
104  float getCurrentTimeFromPlaybackSliderValue(int val);
105 
107  // Variables
109  private:
110  Ui::Controller * m_ui;
111 
112  bool m_enable;
113  bool isInPlayback;
114  agx::UInt m_speedModifier;
115  ControllerState m_state;
116 
117  agx::UInt m_maxFrames;
118  agx::TimeStamp m_startTime;
119  agx::TimeStamp m_endTime;
120 
121  QIcon m_playIcon;
122  QIcon m_stopIcon;
123  QIcon m_pauseIcon;
124  QIcon m_stepForwardIcon;
125  QIcon m_speedForwardIcon;
126  QIcon m_speedBackwardIcon;
127  QIcon m_stepBackIcon;
128 
129  bool m_sliderPressed;
130  };
131 }
132 
133 #endif
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
#define AGXQT_EXPORT
Contains classes/utility functions for connecting AGX to QT with OSG.
Controller for playback.
agx::Real TimeStamp
Definition: TimeStamp.h:26
uint32_t UInt
Definition: Integer.h:34