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
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: explicit 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
204
205 // Documentation inherited
206 private: virtual void paint(QPainter *_painter,
207 const QStyleOptionGraphicsItem *_option, QWidget *_widget);
208 };
209 }
210}
211
212#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:199
CurrentTimeItem()
Constructor;.
View for the timeline.
Definition LogPlayWidget.hh:155
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 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