-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclock.hpp
More file actions
47 lines (36 loc) · 932 Bytes
/
clock.hpp
File metadata and controls
47 lines (36 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef CLOCK_HPP
#define CLOCK_HPP
#include "clock_parameters.hpp"
#include <QObject>
class QTimer;
enum class ClockStage : unsigned char {
Work,
ShortBreak,
LongBreak
};
class Clock : public QObject {
Q_OBJECT
public:
explicit Clock (QObject* parent = nullptr);
int secondsRemains () const;
ClockParameters parameters () const;
void setParameters (const ClockParameters& parameters);
ClockStage nextStage () const;
void setNextStage (ClockStage stage);
public slots:
void start (ClockStage stage);
void stop ();
private slots:
void onSecondTimeout ();
void onStageCompeted ();
signals:
void secondTimeout ();
void stageCompeted ();
private:
QTimer* m_timer;
int m_secondsRemains;
int m_shortBreaks;
ClockStage m_currentStage;
ClockParameters m_parameters;
};
#endif // CLOCK_HPP