TimerGUIPlugin.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2014 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_PLUGINS_TIMERGUIPLUGIN_HH_
18#define GAZEBO_PLUGINS_TIMERGUIPLUGIN_HH_
19
20#include <mutex>
21#include <string>
22#include <vector>
23#include <ignition/transport/Node.hh>
24
29#ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
30# include <gazebo/transport/transport.hh>
31#endif
32
33namespace gazebo
34{
53 class GZ_PLUGIN_VISIBLE TimerGUIPlugin : public GUIPlugin
54 {
55 Q_OBJECT
56
58 public: TimerGUIPlugin();
59
61 public: virtual ~TimerGUIPlugin();
62
63 // Documentation inherited
64 public: void Load(sdf::ElementPtr _elem);
65
69
72 signals: void SetTime(QString _string);
73
76 signals: void SetStartStopButton(QString _state);
77
81 private: void OnTimerCtrl(ConstGzStringPtr &_msg);
82
84 private: void Start();
85
87 private: void Stop();
88
90 private: void Reset();
91
93 private slots: void OnStartStopButton();
94
97 private slots: void OnSetStartStopButton(QString _state);
98
100 private slots: void OnResetButton();
101
103 private: void PreRender();
104
109 private: bool eventFilter(QObject *_obj, QEvent *_event);
110
112 private: transport::NodePtr node;
113
115 private: transport::SubscriberPtr ctrlSub;
116
118 private: common::Timer timer;
119
121 private: std::vector<event::ConnectionPtr> connections;
122
124 private: std::mutex timerMutex;
125
127 private: QPushButton *startStopButton;
128
130 private: std::string startStyle;
131
133 private: std::string stopStyle;
134
136 private: QPushButton *resetButton;
137
140 private: int posX;
141
144 private: int posY;
145
146 // Place ignition::transport objects at the end of this file to
147 // guarantee they are destructed first.
148
150 private: ignition::transport::Node nodeIgn;
151 };
152}
153
154#endif
A plugin loaded within the gzclient on startup.
Definition GuiPlugin.hh:27
A GUI plugin that displays a timer.
Definition TimerGUIPlugin.hh:54
void SetStartStopButton(QString _state)
A signal used to set the style of the start/stop button.
virtual ~TimerGUIPlugin()
Destructor.
void SetTime(QString _string)
A signal used to set the sim time line edit.
TimerGUIPlugin()
Constructor.
void Load(sdf::ElementPtr _elem)
Load function.
common::Time GetCurrentTime() const
Get the current time listed in the timer.
A Time class, can be used to hold wall- or sim-time.
Definition Time.hh:48
A timer class, used to time things in real world walltime.
Definition Timer.hh:39
boost::shared_ptr< Subscriber > SubscriberPtr
Definition TransportTypes.hh:53
boost::shared_ptr< Node > NodePtr
Definition TransportTypes.hh:57
Forward declarations for the common classes.
Definition Animation.hh:27