Changeset View
Changeset View
Standalone View
Standalone View
mainwindow.h
Show All 24 Lines | |||||
25 | #include <QPointer> | 25 | #include <QPointer> | ||
26 | 26 | | |||
27 | #include "gamewidget.h" | 27 | #include "gamewidget.h" | ||
28 | 28 | | |||
29 | class QAction; | 29 | class QAction; | ||
30 | class QStatusBar; | 30 | class QStatusBar; | ||
31 | class KToggleAction; | 31 | class KToggleAction; | ||
32 | 32 | | |||
33 | 33 | /** | |||
34 | * KbounceMainWindow class | ||||
35 | * | ||||
36 | * Inherits from KXmlGuiWindow | ||||
37 | * @see mainwindow.cpp | ||||
38 | * @see gamewidget.h | ||||
39 | */ | ||||
34 | class KBounceMainWindow : public KXmlGuiWindow | 40 | class KBounceMainWindow : public KXmlGuiWindow | ||
35 | { | 41 | { | ||
36 | Q_OBJECT | 42 | Q_OBJECT | ||
43 | | ||||
37 | public: | 44 | public: | ||
45 | /** | ||||
46 | * Constructor to set window configurations | ||||
47 | * @see mainwindow.cpp | ||||
48 | */ | ||||
38 | KBounceMainWindow(); | 49 | KBounceMainWindow(); | ||
50 | | ||||
51 | /** | ||||
52 | * KbounceMainWindow destructor | ||||
53 | * @see mainwindow.cpp | ||||
54 | */ | ||||
39 | ~KBounceMainWindow(); | 55 | ~KBounceMainWindow(); | ||
40 | 56 | | |||
41 | protected slots: | 57 | protected slots: | ||
58 | | ||||
59 | /** | ||||
60 | * Event to start a new game | ||||
61 | * @see mainwindow.cpp | ||||
62 | */ | ||||
42 | void newGame(); | 63 | void newGame(); | ||
64 | | ||||
65 | /** | ||||
66 | * Event to pause / restart the current game | ||||
67 | * @see mainwindow.cpp | ||||
68 | */ | ||||
43 | void pauseGame(); | 69 | void pauseGame(); | ||
70 | | ||||
71 | /** | ||||
72 | * Event to close the game | ||||
73 | * @see mainwindow.cpp | ||||
74 | */ | ||||
44 | void closeGame(); | 75 | void closeGame(); | ||
76 | | ||||
77 | /** | ||||
78 | * Event to run the game over | ||||
79 | * @see mainwindow.cpp | ||||
80 | */ | ||||
45 | void gameOverNow(); | 81 | void gameOverNow(); | ||
82 | | ||||
83 | /** | ||||
84 | * Extra configurations | ||||
85 | * @see mainwindow.cpp | ||||
86 | */ | ||||
46 | void configureSettings(); | 87 | void configureSettings(); | ||
88 | | ||||
89 | /** | ||||
90 | * Read user settings and apply them | ||||
91 | * @see mainwindow.cpp | ||||
92 | */ | ||||
47 | void readSettings(); | 93 | void readSettings(); | ||
94 | | ||||
95 | /** | ||||
96 | * ? | ||||
97 | * PS.: Bug 184606 (solved) | ||||
98 | * @see mainwindow.cpp | ||||
99 | */ | ||||
48 | void settingsChanged(); | 100 | void settingsChanged(); | ||
49 | void setSounds( bool val ); | 101 | | ||
102 | /** | ||||
103 | * Event to set game sounds | ||||
104 | * @param isEnable flag to enable / disable game sound | ||||
105 | * @see mainwindow.cpp | ||||
106 | */ | ||||
107 | void setSounds(bool isEnable); | ||||
108 | | ||||
109 | /** | ||||
110 | * Bring up the standard kde high score dialog | ||||
111 | * @see mainwindow.cpp | ||||
112 | */ | ||||
50 | void showHighscore(); | 113 | void showHighscore(); | ||
114 | | ||||
115 | /** | ||||
116 | * Event to display game level | ||||
117 | * @param level level to display | ||||
118 | * @see mainwindow.cpp | ||||
119 | */ | ||||
51 | void displayLevel( int level ); | 120 | void displayLevel(int level); | ||
121 | | ||||
122 | /** | ||||
123 | * Event to display game score | ||||
124 | * @param score score to display | ||||
125 | * @see mainwindow.cpp | ||||
126 | */ | ||||
52 | void displayScore( int score ); | 127 | void displayScore(int score); | ||
128 | | ||||
129 | /** | ||||
130 | * Event to display game filled percentage | ||||
131 | * @param percentage to display | ||||
132 | * @see mainwindow.cpp | ||||
133 | */ | ||||
53 | void displayFilled( int filled ); | 134 | void displayFilled(int filled); | ||
135 | | ||||
136 | /** | ||||
137 | * Event to display game lives | ||||
138 | * @param lives lives to display | ||||
139 | * @see mainwindow.cpp | ||||
140 | */ | ||||
54 | void displayLives( int lives ); | 141 | void displayLives(int lives); | ||
142 | | ||||
143 | /** | ||||
144 | * Event to display game time | ||||
145 | * @param time time to display | ||||
146 | * @see mainwindow.cpp | ||||
147 | */ | ||||
55 | void displayTime( int time ); | 148 | void displayTime(int time); | ||
149 | | ||||
150 | /** | ||||
151 | * Event to control state changes on the game | ||||
152 | * @param state Current state | ||||
153 | * @see mainwindow.cpp | ||||
154 | */ | ||||
56 | void gameStateChanged( KBounceGameWidget::State state ); | 155 | void gameStateChanged(KBounceGameWidget::State state); | ||
156 | | ||||
57 | protected: | 157 | protected: | ||
158 | | ||||
159 | /** | ||||
160 | * Create the user interface and their respective action events | ||||
161 | * @see mainwindow.cpp | ||||
162 | */ | ||||
58 | void initXMLUI(); | 163 | void initXMLUI(); | ||
164 | | ||||
165 | /** | ||||
166 | * Add current score to highscore | ||||
167 | * @see mainwindow.cpp | ||||
168 | */ | ||||
59 | void highscore(); | 169 | void highscore(); | ||
60 | 170 | | |||
171 | /** | ||||
172 | * XmlGui "focus out" event | ||||
173 | * @param *ev Event context | ||||
174 | * @see mainwindow.cpp | ||||
175 | */ | ||||
61 | void focusOutEvent( QFocusEvent * ) Q_DECL_OVERRIDE; | 176 | void focusOutEvent( QFocusEvent * ) Q_DECL_OVERRIDE; | ||
62 | void focusInEvent ( QFocusEvent * ) Q_DECL_OVERRIDE; | | |||
63 | | ||||
64 | KBounceGameWidget* m_gameWidget; | | |||
65 | 177 | | |||
66 | QStatusBar* m_statusBar; | 178 | /** | ||
67 | 179 | * XmlGui "focus in" event | |||
68 | KToggleAction *m_pauseAction, *m_backgroundShowAction, *m_soundAction; | 180 | * @param *ev Event context | ||
69 | QAction *m_newAction; | 181 | * @see mainwindow.cpp | ||
182 | */ | ||||
183 | void focusInEvent ( QFocusEvent * ) Q_DECL_OVERRIDE; | ||||
70 | 184 | | |||
71 | QPointer<QLabel> levelLabel = new QLabel; | 185 | KToggleAction *kBounceMainWindow_pauseAction, *kBounceMainWindow_backgroundShowAction, *kBounceMainWindow_soundAction; | ||
72 | QPointer<QLabel> scoreLabel = new QLabel; | 186 | KBounceGameWidget* kBounceMainWindow_gameWidget; | ||
73 | QPointer<QLabel> filledLabel = new QLabel; | 187 | QStatusBar* kBounceMainWindow_statusBar; | ||
74 | QPointer<QLabel> livesLabel = new QLabel; | 188 | QAction *kBounceMainWindow_newAction; | ||
75 | QPointer<QLabel> timeLabel = new QLabel; | 189 | | ||
190 | QPointer<QLabel> kBounceMainWindow_levelLabel = new QLabel; | ||||
191 | QPointer<QLabel> kBounceMainWindow_scoreLabel = new QLabel; | ||||
192 | QPointer<QLabel> kBounceMainWindow_filledLabel = new QLabel; | ||||
193 | QPointer<QLabel> kBounceMainWindow_livesLabel = new QLabel; | ||||
194 | QPointer<QLabel> kBounceMainWindow_timeLabel = new QLabel; | ||||
76 | }; | 195 | }; | ||
77 | 196 | | |||
78 | #endif // KBOUNCE_MAINWINDOW_H | 197 | #endif | ||
198 | No newline at end of file |