author | unc0rr |
Sat, 18 Oct 2008 13:37:03 +0000 | |
changeset 1374 | f33fa81e583d |
parent 1315 | c2f09811bb8c |
child 1377 | a9e768739345 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
486 | 3 |
* Copyright (c) 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef PAGES_H |
|
20 |
#define PAGES_H |
|
21 |
||
22 |
#include <QWidget> |
|
684 | 23 |
#include <QPushButton> |
24 |
#include <QFont> |
|
25 |
#include <QGridLayout> |
|
184 | 26 |
|
27 |
#include "binds.h" |
|
322 | 28 |
#include "mapContainer.h" |
184 | 29 |
|
30 |
class QPushButton; |
|
31 |
class QGroupBox; |
|
32 |
class QComboBox; |
|
33 |
class QLabel; |
|
34 |
class QToolBox; |
|
35 |
class QLineEdit; |
|
665 | 36 |
class QListWidget; |
37 |
class QCheckBox; |
|
38 |
class QSpinBox; |
|
39 |
class QTextEdit; |
|
40 |
class QRadioButton; |
|
41 |
class QTableView; |
|
42 |
||
43 |
class GameCFGWidget; |
|
184 | 44 |
class TeamSelWidget; |
45 |
class DemosList; |
|
46 |
class SquareLabel; |
|
187 | 47 |
class About; |
297 | 48 |
class FPSEdit; |
461 | 49 |
class HWChatWidget; |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
600
diff
changeset
|
50 |
class SelWeaponWidget; |
1192 | 51 |
class IconedGroupBox; |
184 | 52 |
|
684 | 53 |
class AbstractPage : public QWidget |
54 |
{ |
|
55 |
public: |
|
56 |
||
57 |
protected: |
|
58 |
AbstractPage(QWidget* parent = 0) { |
|
59 |
font14 = new QFont("MS Shell Dlg", 14); |
|
60 |
} |
|
61 |
virtual ~AbstractPage() {}; |
|
62 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
63 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) { |
684 | 64 |
QPushButton* butt = new QPushButton(this); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
65 |
if (!iconed) { |
1148 | 66 |
butt->setFont(*font14); |
67 |
butt->setText(btname); |
|
1198 | 68 |
butt->setStyleSheet("background-color: #0d0544"); |
1148 | 69 |
} else { |
70 |
const QIcon& lp=QIcon(btname); |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
71 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1168 | 72 |
if (btname == ":/res/Save.png") |
73 |
{ |
|
74 |
butt->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
|
75 |
} |
|
1148 | 76 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
77 |
butt->setFixedSize(sz); |
1148 | 78 |
butt->setIconSize(sz); |
79 |
butt->setFlat(true); |
|
1149 | 80 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 81 |
} |
684 | 82 |
grid->addWidget(butt, wy, wx); |
83 |
return butt; |
|
84 |
}; |
|
85 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
86 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { |
692 | 87 |
QPushButton* butt = new QPushButton(this); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
88 |
if (!iconed) { |
1148 | 89 |
butt->setFont(*font14); |
90 |
butt->setText(btname); |
|
91 |
} else { |
|
92 |
const QIcon& lp=QIcon(btname); |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
93 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 94 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
95 |
butt->setFixedSize(sz); |
1148 | 96 |
butt->setIconSize(sz); |
97 |
butt->setFlat(true); |
|
1149 | 98 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 99 |
} |
692 | 100 |
grid->addWidget(butt, wy, wx, rowSpan, columnSpan); |
101 |
return butt; |
|
102 |
}; |
|
103 |
||
728 | 104 |
QPushButton* addButton(QString btname, QBoxLayout* box, int where) { |
684 | 105 |
QPushButton* butt = new QPushButton(this); |
106 |
butt->setFont(*font14); |
|
728 | 107 |
butt->setText(btname); |
684 | 108 |
box->addWidget(butt, where); |
109 |
return butt; |
|
110 |
}; |
|
111 |
||
112 |
QFont * font14; |
|
113 |
}; |
|
114 |
||
115 |
class PageMain : public AbstractPage |
|
184 | 116 |
{ |
117 |
Q_OBJECT |
|
118 |
||
119 |
public: |
|
120 |
PageMain(QWidget* parent = 0); |
|
121 |
||
122 |
QPushButton *BtnSinglePlayer; |
|
123 |
QPushButton *BtnNet; |
|
124 |
QPushButton *BtnSetup; |
|
187 | 125 |
QPushButton *BtnInfo; |
184 | 126 |
QPushButton *BtnExit; |
127 |
}; |
|
128 |
||
692 | 129 |
class PageEditTeam : public AbstractPage |
184 | 130 |
{ |
131 |
Q_OBJECT |
|
132 |
||
133 |
public: |
|
134 |
PageEditTeam(QWidget* parent = 0); |
|
135 |
QGroupBox *GBoxHedgehogs; |
|
136 |
QGroupBox *GBoxTeam; |
|
137 |
QGroupBox *GBoxFort; |
|
138 |
QComboBox *CBFort; |
|
139 |
SquareLabel *FortPreview; |
|
140 |
QComboBox *CBGrave; |
|
336 | 141 |
QComboBox *CBTeamLvl; |
184 | 142 |
QGroupBox *GBoxBinds; |
143 |
QToolBox *BindsBox; |
|
144 |
QWidget *page_A; |
|
145 |
QWidget *page_W; |
|
146 |
QWidget *page_WP; |
|
147 |
QWidget *page_O; |
|
148 |
QPushButton *BtnTeamDiscard; |
|
149 |
QPushButton *BtnTeamSave; |
|
150 |
QLineEdit * TeamNameEdit; |
|
151 |
QLineEdit * HHNameEdit[8]; |
|
1236 | 152 |
QComboBox * HHHats[8]; |
184 | 153 |
QComboBox * CBBind[BINDS_NUMBER]; |
154 |
||
155 |
public slots: |
|
156 |
void CBFort_activated(const QString & gravename); |
|
157 |
||
158 |
private: |
|
159 |
QLabel * LBind[BINDS_NUMBER]; |
|
160 |
}; |
|
161 |
||
692 | 162 |
class PageMultiplayer : public AbstractPage |
184 | 163 |
{ |
164 |
Q_OBJECT |
|
165 |
||
166 |
public: |
|
167 |
PageMultiplayer(QWidget* parent = 0); |
|
168 |
||
169 |
QPushButton *BtnBack; |
|
170 |
GameCFGWidget *gameCFG; |
|
171 |
TeamSelWidget *teamsSelect; |
|
172 |
QPushButton *BtnStartMPGame; |
|
173 |
}; |
|
174 |
||
692 | 175 |
class PageOptions : public AbstractPage |
184 | 176 |
{ |
177 |
Q_OBJECT |
|
178 |
||
179 |
public: |
|
180 |
PageOptions(QWidget* parent = 0); |
|
181 |
||
597
ec5f057ab268
kdevelop project add, initial weapons scheme button
displacer
parents:
587
diff
changeset
|
182 |
QPushButton* WeaponsButt; |
693 | 183 |
QPushButton* WeaponEdit; |
184 |
QComboBox* WeaponsName; |
|
185 |
||
184 | 186 |
QPushButton *BtnBack; |
1194 | 187 |
IconedGroupBox *teamsBox; |
184 | 188 |
QPushButton *BtnNewTeam; |
189 |
QPushButton *BtnEditTeam; |
|
190 |
QComboBox *CBTeamName; |
|
1193 | 191 |
IconedGroupBox *AGGroupBox; |
184 | 192 |
QComboBox *CBResolution; |
193 |
QCheckBox *CBEnableSound; |
|
1129 | 194 |
QCheckBox *CBEnableMusic; |
184 | 195 |
QCheckBox *CBFullscreen; |
1162 | 196 |
QCheckBox *CBFrontendFullscreen; |
297 | 197 |
QCheckBox *CBShowFPS; |
529 | 198 |
QCheckBox *CBAltDamage; |
297 | 199 |
FPSEdit *fpsedit; |
184 | 200 |
QPushButton *BtnSaveOptions; |
647 | 201 |
QLabel *labelNN; |
202 |
QLineEdit *editNetNick; |
|
184 | 203 |
}; |
204 |
||
1153 | 205 |
class PageNet : public AbstractPage |
184 | 206 |
{ |
207 |
Q_OBJECT |
|
208 |
||
209 |
public: |
|
210 |
PageNet(QWidget* parent = 0); |
|
211 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
212 |
QPushButton* BtnUpdateSList; |
665 | 213 |
QTableView * tvServersList; |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
214 |
QPushButton * BtnBack; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
215 |
QPushButton * BtnNetConnect; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
216 |
QPushButton * BtnNetSvrStart; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
217 |
QPushButton * BtnSpecifyServer; |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
218 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
219 |
private: |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
220 |
QGroupBox * ConnGroupBox; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
221 |
QGridLayout * GBClayout; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
222 |
|
646 | 223 |
private slots: |
224 |
void slotConnect(); |
|
225 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
226 |
public slots: |
646 | 227 |
void updateServersList(); |
228 |
||
229 |
signals: |
|
665 | 230 |
void connectClicked(const QString & host, quint16 port); |
646 | 231 |
}; |
232 |
||
1153 | 233 |
class PageNetServer : public AbstractPage |
646 | 234 |
{ |
235 |
Q_OBJECT |
|
236 |
||
237 |
public: |
|
238 |
PageNetServer(QWidget* parent = 0); |
|
239 |
||
240 |
QPushButton *BtnBack; |
|
241 |
QPushButton *BtnStart; |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
242 |
QPushButton *BtnDefault; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
243 |
QLabel *labelSD; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
244 |
QLineEdit *leServerDescr; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
245 |
QLabel *labelPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
246 |
QSpinBox *sbPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
247 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
248 |
private slots: |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
249 |
void setDefaultPort(); |
184 | 250 |
}; |
251 |
||
1153 | 252 |
class PageNetGame : public AbstractPage |
184 | 253 |
{ |
254 |
Q_OBJECT |
|
255 |
||
256 |
public: |
|
257 |
PageNetGame(QWidget* parent = 0); |
|
258 |
||
259 |
QPushButton *BtnBack; |
|
260 |
QPushButton *BtnGo; |
|
461 | 261 |
|
262 |
HWChatWidget* pChatWidget; |
|
322 | 263 |
|
264 |
TeamSelWidget* pNetTeamsWidget; |
|
265 |
GameCFGWidget* pGameCFG; |
|
184 | 266 |
}; |
267 |
||
1153 | 268 |
class PageInfo : public AbstractPage |
187 | 269 |
{ |
270 |
Q_OBJECT |
|
271 |
||
272 |
public: |
|
273 |
PageInfo(QWidget* parent = 0); |
|
274 |
||
275 |
QPushButton *BtnBack; |
|
276 |
About *about; |
|
277 |
}; |
|
278 |
||
1153 | 279 |
class PageGameStats : public AbstractPage |
306 | 280 |
{ |
281 |
Q_OBJECT |
|
282 |
||
283 |
public: |
|
284 |
PageGameStats(QWidget* parent = 0); |
|
285 |
||
286 |
QPushButton *BtnBack; |
|
307 | 287 |
QLabel *labelGameStats; |
306 | 288 |
}; |
289 |
||
1150 | 290 |
class PageSinglePlayer : public AbstractPage |
586 | 291 |
{ |
292 |
Q_OBJECT |
|
293 |
||
294 |
public: |
|
295 |
PageSinglePlayer(QWidget* parent = 0); |
|
296 |
||
297 |
QPushButton *BtnSimpleGamePage; |
|
298 |
QPushButton *BtnTrainPage; |
|
1150 | 299 |
QPushButton *BtnMultiplayer; |
300 |
QPushButton *BtnLoad; |
|
301 |
QPushButton *BtnDemos; |
|
586 | 302 |
QPushButton *BtnBack; |
303 |
GameCFGWidget *gameCFG; |
|
304 |
}; |
|
305 |
||
1153 | 306 |
class PageTraining : public AbstractPage |
587 | 307 |
{ |
308 |
Q_OBJECT |
|
309 |
||
310 |
public: |
|
311 |
PageTraining(QWidget* parent = 0); |
|
312 |
||
313 |
QPushButton *BtnStartTrain; |
|
314 |
QPushButton *BtnBack; |
|
315 |
}; |
|
316 |
||
684 | 317 |
class PageSelectWeapon : public AbstractPage |
600 | 318 |
{ |
319 |
Q_OBJECT |
|
320 |
||
321 |
public: |
|
322 |
PageSelectWeapon(QWidget* parent = 0); |
|
323 |
||
683 | 324 |
QPushButton *BtnSave; |
325 |
QPushButton *BtnDefault; |
|
718 | 326 |
QPushButton *BtnDelete; |
600 | 327 |
QPushButton *BtnBack; |
1312 | 328 |
SelWeaponWidget* pWeapons; |
600 | 329 |
}; |
306 | 330 |
|
686 | 331 |
class PageInGame : public AbstractPage |
332 |
{ |
|
333 |
Q_OBJECT |
|
334 |
||
335 |
public: |
|
336 |
PageInGame(QWidget* parent = 0); |
|
337 |
}; |
|
338 |
||
1311 | 339 |
class PageRoomsList : public AbstractPage |
340 |
{ |
|
341 |
Q_OBJECT |
|
342 |
||
343 |
public: |
|
344 |
PageRoomsList(QWidget* parent = 0); |
|
1312 | 345 |
|
1314 | 346 |
QLineEdit * roomName; |
1312 | 347 |
QListWidget * roomsList; |
348 |
QPushButton * BtnBack; |
|
349 |
QPushButton * BtnCreate; |
|
350 |
QPushButton * BtnJoin; |
|
351 |
QPushButton * BtnRefresh; |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
352 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
353 |
public slots: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
354 |
void setRoomsList(const QStringList & list); |
1314 | 355 |
|
356 |
private slots: |
|
357 |
void onCreateClick(); |
|
358 |
void onJoinClick(); |
|
1315 | 359 |
void onRefreshClick(); |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
360 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
361 |
signals: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
362 |
void askForCreateRoom(const QString &); |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
363 |
void askForJoinRoom(const QString &); |
1315 | 364 |
void askForRoomList(); |
1311 | 365 |
}; |
366 |
||
184 | 367 |
#endif // PAGES_H |