ClockWidgetController.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarXGui::gui-plugins::ClockWidgetController
19 * @author Clemens Wallrath ( uagzs at student dot kit dot edu )
20 * @date 2015
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25#pragma once
26
27#include <QTimer>
28
30#include <ArmarXCore/interface/core/TimeServerInterface.h>
31
32#include <ArmarXGui/gui-plugins/ClockPlugin/ui_ClockWidget.h>
35
36namespace armarx
37{
38 /**
39 * \page ArmarXGui-GuiPlugins-Clock Clock
40 * \brief The Clock allows viewing and manipulating the time.
41 *
42 * \image html Clock.png
43 * When synchronized time is available, the user can start/stop/step the
44 * progression of time. The current timeserver time is shown.
45 *
46 * Othewise the current system time is shown.
47 *
48 * \see \ref ArmarXSimulation-HowTos-Timeserver
49 * \see ClockGuiPlugin
50 */
51
52 /**
53 * \class ClockGuiPlugin
54 * \ingroup ArmarXGuiPlugins
55 * \brief ClockGuiPlugin a gui plugin to show and manipulate the time
56 *
57 * The ClockGuiPlugin shows the time provided by TimeUtil::GetTime(), i.e. the local time or the Timeserver's time, depending on the ArmarX.UseTimeServer property.
58 * It also allows to control the TimeServer (start/stop/step the time and change the speed)
59 */
60
61 /**
62 * \class ClockWidgetController
63 * \brief ClockWidgetController allows showing and manipulating the time
64 *
65 * \see ClockGuiPlugin
66 */
68 public ArmarXComponentWidgetControllerTemplate<ClockWidgetController>
69 {
70 Q_OBJECT
71
72 public:
73 /**
74 * Controller Constructor
75 */
76 explicit ClockWidgetController();
77
78 /**
79 * Controller destructor
80 */
81 ~ClockWidgetController() override;
82
83 /**
84 * @see ArmarXWidgetController::loadSettings()
85 */
86 void loadSettings(QSettings* settings) override;
87
88 /**
89 * @see ArmarXWidgetController::saveSettings()
90 */
91 void saveSettings(QSettings* settings) override;
92
93 /**
94 * Returns the Widget name displayed in the ArmarXGui to create an
95 * instance of this class.
96 */
97 static QString
99 {
100 return "Clock";
101 }
102
103 /**
104 * \see armarx::Component::onInitComponent()
105 */
106 void onInitComponent() override;
107
108 /**
109 * \see armarx::Component::onConnectComponent()
110 */
111 void onConnectComponent() override;
112
113 /**
114 * \see armarx::Component::onConnectComponent()
115 */
116 void onDisconnectComponent() override;
117
118 public slots:
119 /* QT slot declarations */
120 void updateGui();
121 void startButtonPressed();
122 void stepButtonPressed();
123 void stopButtonPressed();
124 void speedChanged(double newSpeed);
125
126 signals:
127 /* QT signal declarations */
128
129 private:
130 /**
131 * Widget Form
132 */
133 Ui::ClockWidget widget;
134 QTimer* updateTimer;
135 TimeServerInterfacePtr timeServerPtr;
136
137 IceUtil::Time lastChangeSystemTime;
138 IceUtil::Time lastChangeTime;
139
140 /**
141 * number of iterations of the update function
142 */
143 size_t iteration;
144
145 // ArmarXWidgetController interface
146 public:
147 static QIcon
149 {
150 return QIcon(":icons/Time-And-Date-Clock-icon.png");
151 }
152 };
153} // namespace armarx
#define ARMARXCOMPONENT_IMPORT_EXPORT
void loadSettings(QSettings *settings) override
void saveSettings(QSettings *settings) override
ClockWidgetController()
Controller Constructor.
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
This file offers overloads of toIce() and fromIce() functions for STL container types.