/
RfkWindow.h
112 lines (93 loc) · 1.77 KB
/
RfkWindow.h
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#ifndef RFK_WINDOW
#define RFK_WINDOW 1
#include <QStackedWidget>
#include "RfkView.h"
/**
* The main window of the game. Contains the view.
*/
class RfkWindow: public QStackedWidget {
Q_OBJECT
public:
/**
* Constructs the window.
*/
RfkWindow();
/**
* Returns our view, so that it can be manipulated
* by other classes.
*
* \result The view
*/
RfkView* view();
protected:
/**
* Called when the user presses a key.
*
* \param event Details of the keypress.
*/
void keyPressEvent(QKeyEvent *event);
public slots:
/**
* Received when the game begins.
* \bug Use camelcase.
*/
void play_game();
/**
* Received when the demo begins.
* \bug Should probably be private.
*/
void playDemo();
/**
* Received when the help is requested.
* \bug Should probably be private.
*/
void showHelp();
/**
* Received when the game is won.
*/
void gameWon();
/**
* Received when the game restarts (either because it's
* being ended early, or because it's been won and the
* user wants to play again).
*/
void restart();
/**
* Makes kitten close or open its eyes.
*/
void timerEvent(QTimerEvent *event);
signals:
/**
* Sent when the demo should begin.
*/
void startDemo();
private:
/**
* A view of the board.
*/
RfkView *m_view;
/**
* Kitten's eyes, closed.
*/
QLabel *m_blink;
/**
* ID of the timer that makes kitten blink.
*/
int m_blinkTimer;
/**
* Starts kitten blinking.
*/
void startBlinking();
/**
* Stops kitten blinking.
*/
void stopBlinking();
/**
* Creates the front screen. This exists to simplify
* the constructor.
*
* \result The front screen.
*/
QWidget* prepare_front_screen();
};
#endif