blob: afd643303681dbcfff0ea89569895a3ff164a66a (
plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#ifndef CLOCK_H
#define CLOCK_H
#include <QGraphicsItem>
#include <QTime>
class ClockButton ;
class ClockDisplay ;
class QStateMachine ;
class QState ;
class QTimerState ;
class QSound ;
class QHistoryState ;
class Clock: public QObject, public QGraphicsItem
{
Q_OBJECT
public:
Clock(QGraphicsItem *parent = 0);
void initializeUi();
void initializeStateMachine();
virtual QRectF boundingRect() const;
virtual QPainterPath shape() const;
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
signals:
void anyButtonPressed();
public slots:
void updateTime();
void playSound();
void stopSound();
private:
void initializeDisplaysState(QState *displays);
void initializeAlarmState(QState *alarmState);
void initializeRegularState(QState *regular);
void initializeUpdateState(QState *update);
void initializeOutState(QState *out);
void initializeAlarmUpdateState(QState *update);
QStateMachine *m_stateMachine;
ClockDisplay *m_clockDisplay;
ClockButton *m_buttonA;
ClockButton *m_buttonB;
ClockButton *m_buttonC;
ClockButton *m_buttonD;
QState *m_alarmState;
QState *m_timeState;
QState *m_updateState;
QState *m_regularState;
QHistoryState *m_displaysHistoryState;
QSound *m_alarmSound;
QTime m_time;
};
#endif // CLOCK_H
|