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 <ArmarXGui/gui-plugins/ClockPlugin/ui_ClockWidget.h>
28 
31 
33 #include <ArmarXCore/interface/core/TimeServerInterface.h>
34 
35 #include <QTimer>
36 
37 namespace armarx
38 {
39  /**
40  * \page ArmarXGui-GuiPlugins-Clock Clock
41  * \brief The Clock allows viewing and manipulating the time.
42  *
43  * \image html Clock.png
44  * When synchronized time is available, the user can start/stop/step the
45  * progression of time. The current timeserver time is shown.
46  *
47  * Othewise the current system time is shown.
48  *
49  * \see \ref ArmarXSimulation-HowTos-Timeserver
50  * \see ClockGuiPlugin
51  */
52 
53  /**
54  * \class ClockGuiPlugin
55  * \ingroup ArmarXGuiPlugins
56  * \brief ClockGuiPlugin a gui plugin to show and manipulate the time
57  *
58  * 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.
59  * It also allows to control the TimeServer (start/stop/step the time and change the speed)
60  */
61 
62  /**
63  * \class ClockWidgetController
64  * \brief ClockWidgetController allows showing and manipulating the time
65  *
66  * \see ClockGuiPlugin
67  */
70  public ArmarXComponentWidgetControllerTemplate<ClockWidgetController>
71  {
72  Q_OBJECT
73 
74  public:
75  /**
76  * Controller Constructor
77  */
78  explicit ClockWidgetController();
79 
80  /**
81  * Controller destructor
82  */
83  ~ClockWidgetController() override;
84 
85  /**
86  * @see ArmarXWidgetController::loadSettings()
87  */
88  void loadSettings(QSettings* settings) override;
89 
90  /**
91  * @see ArmarXWidgetController::saveSettings()
92  */
93  void saveSettings(QSettings* settings) override;
94 
95  /**
96  * Returns the Widget name displayed in the ArmarXGui to create an
97  * instance of this class.
98  */
99  static QString GetWidgetName()
100  {
101  return "Clock";
102  }
103 
104  /**
105  * \see armarx::Component::onInitComponent()
106  */
107  void onInitComponent() override;
108 
109  /**
110  * \see armarx::Component::onConnectComponent()
111  */
112  void onConnectComponent() override;
113 
114  /**
115  * \see armarx::Component::onConnectComponent()
116  */
117  void onDisconnectComponent() override;
118 
119  public slots:
120  /* QT slot declarations */
121  void updateGui();
122  void startButtonPressed();
123  void stepButtonPressed();
124  void stopButtonPressed();
125  void speedChanged(double newSpeed);
126 
127  signals:
128  /* QT signal declarations */
129 
130  private:
131  /**
132  * Widget Form
133  */
134  Ui::ClockWidget widget;
135  QTimer* updateTimer;
136  TimeServerInterfacePtr timeServerPtr;
137 
138  IceUtil::Time lastChangeSystemTime;
139  IceUtil::Time lastChangeTime;
140 
141  /**
142  * number of iterations of the update function
143  */
144  size_t iteration;
145 
146  // ArmarXWidgetController interface
147  public:
148  static QIcon GetWidgetIcon()
149  {
150  return QIcon(":icons/Time-And-Date-Clock-icon.png");
151  }
152  };
153 }
154 
armarx::ClockWidgetController::GetWidgetIcon
static QIcon GetWidgetIcon()
Definition: ClockWidgetController.h:148
armarx::ArmarXComponentWidgetControllerTemplate
Definition: ArmarXComponentWidgetController.h:69
ArmarXGuiPlugin.h
ArmarXComponentWidgetController.h
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::ClockWidgetController
ClockWidgetController allows showing and manipulating the time.
Definition: ClockWidgetController.h:68
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ClockWidgetController::GetWidgetName
static QString GetWidgetName()
Returns the Widget name displayed in the ArmarXGui to create an instance of this class.
Definition: ClockWidgetController.h:99
ImportExportComponent.h