##// END OF EJS Templates
Add the time controller.
perrinel -
r176:c3e91a6962e0
parent child
Show More
@@ -0,0 +1,37
1 #ifndef SCIQLOP_TIMECONTROLLER_H
2 #define SCIQLOP_TIMECONTROLLER_H
3
4 #include <Data/SqpDateTime.h>
5
6 #include <QLoggingCategory>
7 #include <QObject>
8
9 #include <Common/spimpl.h>
10
11
12 Q_DECLARE_LOGGING_CATEGORY(LOG_TimeController)
13
14 /**
15 * @brief The TimeController class aims to handle the Time parameters notification in SciQlop.
16 */
17 class TimeController : public QObject {
18 Q_OBJECT
19 public:
20 explicit TimeController(QObject *parent = 0);
21
22 SqpDateTime dateTime() const noexcept;
23
24 signals:
25 /// Signal emitted to notify that time parameters has beed updated
26 void timeUpdated(SqpDateTime time);
27
28 public slots:
29 /// Slot called when a new dateTime has been defined. Call timeUpdated signal
30 void onTimeToUpdate(SqpDateTime dateTime);
31
32 private:
33 class TimeControllerPrivate;
34 spimpl::unique_impl_ptr<TimeControllerPrivate> impl;
35 };
36
37 #endif // SCIQLOP_TIMECONTROLLER_H
@@ -0,0 +1,26
1 #include "Time/TimeController.h"
2
3 Q_LOGGING_CATEGORY(LOG_TimeController, "TimeController")
4
5 struct TimeController::TimeControllerPrivate {
6
7 SqpDateTime m_DateTime;
8 };
9
10 TimeController::TimeController(QObject *parent)
11 : QObject{parent}, impl{spimpl::make_unique_impl<TimeControllerPrivate>()}
12 {
13 qCDebug(LOG_TimeController()) << tr("TimeController construction");
14 }
15
16 SqpDateTime TimeController::dateTime() const noexcept
17 {
18 return impl->m_DateTime;
19 }
20
21 void TimeController::onTimeToUpdate(SqpDateTime dateTime)
22 {
23 impl->m_DateTime = dateTime;
24
25 emit timeUpdated(dateTime);
26 }
General Comments 4
Under Review
author

Pull request updated. Auto status change to "Under Review"

Changed commits:
  * 1 added
  * 0 removed

Changed files:
  * M gui/include/Visualization/VisualizationGraphWidget.h
  * M gui/src/Visualization/VisualizationGraphWidget.cpp
Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now