TimePanel.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-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 _TIME_PANEL_HH_
18 #define _TIME_PANEL_HH_
19 
20 #include <vector>
21 #include <list>
22 #include <string>
23 
24 #include "gazebo/gui/qt.h"
26 #include "gazebo/msgs/MessageTypes.hh"
27 #include "gazebo/common/Event.hh"
28 #include "gazebo/common/Time.hh"
29 #include "gazebo/util/system.hh"
30 
31 class QLineEdit;
32 class QLabel;
33 
34 namespace gazebo
35 {
36  namespace gui
37  {
38  class GAZEBO_VISIBLE TimePanel : public QWidget
39  {
40  Q_OBJECT
41 
43  public: TimePanel(QWidget *_parent = 0);
44 
46  public: virtual ~TimePanel();
47 
50  signals: void SetSimTime(QString _string);
51 
54  signals: void SetRealTime(QString _string);
55 
58  signals: void SetIterations(QString _string);
59 
61  private slots: void Update();
62 
64  private slots: void OnStepValueChanged(int _value);
65 
69  private: void OnFullScreen(bool &_value);
70 
73  private: void OnStats(ConstWorldStatisticsPtr &_msg);
74 
77  private: static std::string FormatTime(const msgs::Time &_msg);
78 
80  private slots: void OnTimeReset();
81 
83  private: QLineEdit *percentRealTimeEdit;
84 
86  private: QLineEdit *simTimeEdit;
87 
89  private: QLineEdit *realTimeEdit;
90 
92  private: QLineEdit *iterationsEdit;
93 
95  private: transport::NodePtr node;
96 
98  private: transport::SubscriberPtr statsSub;
99 
101  private: transport::PublisherPtr worldControlPub;
102 
104  private: std::vector<event::ConnectionPtr> connections;
105 
107  private: std::list<common::Time> simTimes;
108 
110  private: std::list<common::Time> realTimes;
111 
113  private: boost::mutex mutex;
114 
116  private: QToolButton *stepButton;
117  };
118  }
119 }
120 
121 #endif
boost::shared_ptr< Subscriber > SubscriberPtr
Definition: TransportTypes.hh:53
Forward declarations for transport.
Definition: TimePanel.hh:38
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
boost::shared_ptr< Publisher > PublisherPtr
Definition: TransportTypes.hh:49
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48