LogPlayWidget.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 #ifndef _GAZEBO_LOG_PLAY_WIDGET_HH_
18 #define _GAZEBO_LOG_PLAY_WIDGET_HH_
19 
20 #include "gazebo/common/Time.hh"
21 #include "gazebo/gui/qt.h"
22 #include "gazebo/gui/TimePanel.hh"
23 #include "gazebo/util/system.hh"
24 
25 namespace gazebo
26 {
27  namespace gui
28  {
29  class LogPlayWidgetPrivate;
30  class LogPlayViewPrivate;
31  class TimePanel;
32 
35  class GZ_GUI_VISIBLE LogPlayWidget : public QWidget
36  {
37  Q_OBJECT
38 
41  public: LogPlayWidget(QWidget *_parent = 0);
42 
44  public: virtual ~LogPlayWidget();
45 
48  public: bool IsPaused() const;
49 
53  public: void SetPaused(const bool _paused);
54 
57  public: void EmitSetCurrentTime(const common::Time &_time);
58 
61  public: void EmitSetStartTime(const common::Time &_time);
62 
65  public: void EmitSetEndTime(const common::Time &_time);
66 
68  public slots: void OnPlay();
69 
71  public slots: void OnPause();
72 
74  public slots: void OnStepForward();
75 
77  public slots: void OnStepBack();
78 
80  public slots: void OnRewind();
81 
83  public slots: void OnForward();
84 
87  public slots: void OnSeek(const common::Time &_time);
88 
90  public slots: void OnCurrentTime();
91 
93  signals: void ShowPlay();
94 
96  signals: void HidePlay();
97 
99  signals: void ShowPause();
100 
102  signals: void HidePause();
103 
106  signals: void SetCurrentDays(const QString &);
107 
110  signals: void SetCurrentHours(const QString &);
111 
114  signals: void SetCurrentMinutes(const QString &);
115 
118  signals: void SetCurrentSeconds(const QString &);
119 
122  signals: void SetEndTime(const QString &);
123 
126  signals: void SetCurrentTime(const common::Time &_time);
127 
130  signals: void SetStartTime(const common::Time &_time);
131 
134  signals: void SetEndTime(const common::Time &_time);
135 
138  private: void PublishMultistep(const int _step);
139 
144  private: void SetupButton(QToolButton *_button, QString _icon,
145  bool _isSmall);
146 
149  private: LogPlayWidgetPrivate *dataPtr;
150  };
151 
154  class GZ_GUI_VISIBLE LogPlayView: public QGraphicsView
155  {
156  Q_OBJECT
157 
160  public: LogPlayView(LogPlayWidget *_parent = 0);
161 
164  public slots: void SetCurrentTime(const common::Time &_time);
165 
168  public slots: void SetStartTime(const common::Time &_time);
169 
172  public slots: void SetEndTime(const common::Time &_time);
173 
175  public slots: void DrawTimeline();
176 
179  signals: void Seek(const common::Time &_time);
180 
181  // Documentation inherited
182  protected: void mousePressEvent(QMouseEvent *_event);
183 
184  // Documentation inherited
185  protected: void mouseReleaseEvent(QMouseEvent *_event);
186 
187  // Documentation inherited
188  protected: void mouseMoveEvent(QMouseEvent *_event);
189 
192  private: LogPlayViewPrivate *dataPtr;
193  };
194 
197  class GZ_GUI_VISIBLE CurrentTimeItem: public QObject,
198  public QGraphicsRectItem
199  {
200  Q_OBJECT
201 
203  public: CurrentTimeItem();
204 
205  // Documentation inherited
206  private: virtual void paint(QPainter *_painter,
207  const QStyleOptionGraphicsItem *_option, QWidget *_widget);
208  };
209  }
210 }
211 
212 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
Widget which displays log playback options.
Definition: LogPlayWidget.hh:35
Item which represents the current time within the view.
Definition: LogPlayWidget.hh:197
View for the timeline.
Definition: LogPlayWidget.hh:154
A Time class, can be used to hold wall- or sim-time.
Definition: Time.hh:44