LogPlayWidget.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 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_GUI_LOGPLAYWIDGET_HH_
18#define GAZEBO_GUI_LOGPLAYWIDGET_HH_
19
20#include "gazebo/common/Time.hh"
21#include "gazebo/gui/qt.h"
23#include "gazebo/util/system.hh"
24
25namespace 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: explicit 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
94 public slots: void OnRtFactorChanged(const double _value);
95
97 signals: void ShowPlay();
98
100 signals: void HidePlay();
101
103 signals: void ShowPause();
104
106 signals: void HidePause();
107
110 signals: void SetCurrentDays(const QString &);
111
114 signals: void SetCurrentHours(const QString &);
115
118 signals: void SetCurrentMinutes(const QString &);
119
122 signals: void SetCurrentSeconds(const QString &);
123
126 signals: void SetEndTime(const QString &);
127
130 signals: void SetCurrentTime(const common::Time &_time);
131
134 signals: void SetStartTime(const common::Time &_time);
135
138 signals: void SetEndTime(const common::Time &_time);
139
142 private: void PublishMultistep(const int _step);
143
148 private: void SetupButton(QToolButton *_button, QString _icon,
149 bool _isSmall);
150
153 private: LogPlayWidgetPrivate *dataPtr;
154 };
155
158 class GZ_GUI_VISIBLE LogPlayView: public QGraphicsView
159 {
160 Q_OBJECT
161
164 public: explicit LogPlayView(LogPlayWidget *_parent = 0);
165
168 public slots: void SetCurrentTime(const common::Time &_time);
169
172 public slots: void SetStartTime(const common::Time &_time);
173
176 public slots: void SetEndTime(const common::Time &_time);
177
179 public slots: void DrawTimeline();
180
183 signals: void Seek(const common::Time &_time);
184
185 // Documentation inherited
186 protected: void mousePressEvent(QMouseEvent *_event);
187
188 // Documentation inherited
189 protected: void mouseReleaseEvent(QMouseEvent *_event);
190
191 // Documentation inherited
192 protected: void mouseMoveEvent(QMouseEvent *_event);
193
196 private: LogPlayViewPrivate *dataPtr;
197 };
198
201 class GZ_GUI_VISIBLE CurrentTimeItem: public QObject,
202 public QGraphicsRectItem
203 {
204 Q_OBJECT
205
208
209 // Documentation inherited
210 private: virtual void paint(QPainter *_painter,
211 const QStyleOptionGraphicsItem *_option, QWidget *_widget);
212 };
213 }
214}
215
216#endif
gui
Definition KeyEventHandler.hh:29
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
Item which represents the current time within the view.
Definition LogPlayWidget.hh:203
CurrentTimeItem()
Constructor;.
View for the timeline.
Definition LogPlayWidget.hh:159
LogPlayView(LogPlayWidget *_parent=0)
Constructor;.
void SetEndTime(const common::Time &_time)
Set the log end time.
void mouseReleaseEvent(QMouseEvent *_event)
void DrawTimeline()
Draw the timeline.
void Seek(const common::Time &_time)
Qt signal used to seek.
void mousePressEvent(QMouseEvent *_event)
void SetStartTime(const common::Time &_time)
Set the log start time.
void mouseMoveEvent(QMouseEvent *_event)
void SetCurrentTime(const common::Time &_time)
Set the position of the current time item.
Widget which displays log playback options.
Definition LogPlayWidget.hh:36
LogPlayWidget(QWidget *_parent=0)
Constructor.
void SetEndTime(const common::Time &_time)
Qt signal used to set the end time in the view.
void OnRewind()
Jump to the start of the log file.
void EmitSetStartTime(const common::Time &_time)
Emit signal to set start time.
void OnCurrentTime()
Callback when the current time has been edited.
void OnSeek(const common::Time &_time)
Jump to a given time in the log file.
void SetCurrentMinutes(const QString &)
Qt signal used to set the current minute line edit.
virtual ~LogPlayWidget()
Destructor.
void SetPaused(const bool _paused)
Set whether to display the simulation as paused.
void HidePause()
Qt signal to hide the pause button.
void SetStartTime(const common::Time &_time)
Qt signal used to set the start time in the view.
void ShowPlay()
Qt signal to show the play button.
void OnPause()
Pause simulation.
void SetCurrentSeconds(const QString &)
Qt signal used to set the current second line edit.
void SetEndTime(const QString &)
Qt signal used to set the end time line edit.
void OnStepForward()
Step simulation forward.
bool IsPaused() const
Returns if the simulation is displayed as paused.
void OnStepBack()
Step simulation back.
void HidePlay()
Qt signal to hide the play button.
void EmitSetCurrentTime(const common::Time &_time)
Emit signal to set current time.
void EmitSetEndTime(const common::Time &_time)
Emit signal to set end time.
void SetCurrentDays(const QString &)
Qt signal used to set the current day line edit.
void OnRtFactorChanged(const double _value)
Change log play real time factor.
void OnForward()
Jump to the end of the log file.
void ShowPause()
Qt signal to show the pause button.
void SetCurrentTime(const common::Time &_time)
Qt signal used to set the current time in the view.
void SetCurrentHours(const QString &)
Qt signal used to set the current hour line edit.
void OnPlay()
Play simulation.
Forward declarations for the common classes.
Definition Animation.hh:27