author | unc0rr |
Tue, 24 Feb 2009 19:38:49 +0000 | |
changeset 1837 | 650884b2e8c1 |
parent 1812 | 3d4692e825e7 |
child 1840 | 4747f0232b88 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
1395 | 3 |
* Copyright (c) 2006-2008 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; |
|
1377 | 42 |
class QTextBrowser; |
1399 | 43 |
class QTableWidget; |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
44 |
class QAction; |
665 | 45 |
|
46 |
class GameCFGWidget; |
|
184 | 47 |
class TeamSelWidget; |
48 |
class DemosList; |
|
49 |
class SquareLabel; |
|
187 | 50 |
class About; |
297 | 51 |
class FPSEdit; |
461 | 52 |
class HWChatWidget; |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
600
diff
changeset
|
53 |
class SelWeaponWidget; |
1192 | 54 |
class IconedGroupBox; |
184 | 55 |
|
684 | 56 |
class AbstractPage : public QWidget |
57 |
{ |
|
58 |
public: |
|
59 |
||
60 |
protected: |
|
61 |
AbstractPage(QWidget* parent = 0) { |
|
62 |
font14 = new QFont("MS Shell Dlg", 14); |
|
63 |
} |
|
64 |
virtual ~AbstractPage() {}; |
|
65 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
66 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) { |
684 | 67 |
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
|
68 |
if (!iconed) { |
1148 | 69 |
butt->setFont(*font14); |
70 |
butt->setText(btname); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
71 |
//butt->setStyleSheet("background-color: #0d0544"); |
1148 | 72 |
} else { |
73 |
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
|
74 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 75 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
76 |
butt->setFixedSize(sz); |
1148 | 77 |
butt->setIconSize(sz); |
78 |
butt->setFlat(true); |
|
1149 | 79 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 80 |
} |
684 | 81 |
grid->addWidget(butt, wy, wx); |
82 |
return butt; |
|
83 |
}; |
|
84 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
85 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { |
692 | 86 |
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
|
87 |
if (!iconed) { |
1148 | 88 |
butt->setFont(*font14); |
89 |
butt->setText(btname); |
|
90 |
} else { |
|
91 |
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
|
92 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 93 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
94 |
butt->setFixedSize(sz); |
1148 | 95 |
butt->setIconSize(sz); |
96 |
butt->setFlat(true); |
|
1149 | 97 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 98 |
} |
692 | 99 |
grid->addWidget(butt, wy, wx, rowSpan, columnSpan); |
100 |
return butt; |
|
101 |
}; |
|
102 |
||
1443 | 103 |
QPushButton* addButton(QString btname, QBoxLayout* box, int where, bool iconed = false) { |
684 | 104 |
QPushButton* butt = new QPushButton(this); |
1443 | 105 |
if (!iconed) { |
106 |
butt->setFont(*font14); |
|
107 |
butt->setText(btname); |
|
108 |
} else { |
|
109 |
const QIcon& lp=QIcon(btname); |
|
110 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
111 |
butt->setIcon(lp); |
|
112 |
butt->setFixedSize(sz); |
|
113 |
butt->setIconSize(sz); |
|
114 |
butt->setFlat(true); |
|
115 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
116 |
} |
|
684 | 117 |
box->addWidget(butt, where); |
118 |
return butt; |
|
119 |
}; |
|
120 |
||
121 |
QFont * font14; |
|
122 |
}; |
|
123 |
||
124 |
class PageMain : public AbstractPage |
|
184 | 125 |
{ |
126 |
Q_OBJECT |
|
127 |
||
128 |
public: |
|
129 |
PageMain(QWidget* parent = 0); |
|
130 |
||
131 |
QPushButton *BtnSinglePlayer; |
|
132 |
QPushButton *BtnNet; |
|
133 |
QPushButton *BtnSetup; |
|
187 | 134 |
QPushButton *BtnInfo; |
184 | 135 |
QPushButton *BtnExit; |
136 |
}; |
|
137 |
||
692 | 138 |
class PageEditTeam : public AbstractPage |
184 | 139 |
{ |
140 |
Q_OBJECT |
|
141 |
||
142 |
public: |
|
143 |
PageEditTeam(QWidget* parent = 0); |
|
144 |
QGroupBox *GBoxHedgehogs; |
|
145 |
QGroupBox *GBoxTeam; |
|
146 |
QGroupBox *GBoxFort; |
|
147 |
QComboBox *CBFort; |
|
148 |
SquareLabel *FortPreview; |
|
149 |
QComboBox *CBGrave; |
|
336 | 150 |
QComboBox *CBTeamLvl; |
1659 | 151 |
QComboBox *CBVoicepack; |
184 | 152 |
QGroupBox *GBoxBinds; |
153 |
QToolBox *BindsBox; |
|
154 |
QWidget *page_A; |
|
155 |
QWidget *page_W; |
|
156 |
QWidget *page_WP; |
|
157 |
QWidget *page_O; |
|
158 |
QPushButton *BtnTeamDiscard; |
|
159 |
QPushButton *BtnTeamSave; |
|
1684 | 160 |
QPushButton * BtnTestSound; |
184 | 161 |
QLineEdit * TeamNameEdit; |
162 |
QLineEdit * HHNameEdit[8]; |
|
1236 | 163 |
QComboBox * HHHats[8]; |
184 | 164 |
QComboBox * CBBind[BINDS_NUMBER]; |
165 |
||
166 |
public slots: |
|
167 |
void CBFort_activated(const QString & gravename); |
|
168 |
||
169 |
private: |
|
170 |
QLabel * LBind[BINDS_NUMBER]; |
|
1684 | 171 |
|
172 |
private slots: |
|
173 |
void testSound(); |
|
184 | 174 |
}; |
175 |
||
692 | 176 |
class PageMultiplayer : public AbstractPage |
184 | 177 |
{ |
178 |
Q_OBJECT |
|
179 |
||
180 |
public: |
|
181 |
PageMultiplayer(QWidget* parent = 0); |
|
182 |
||
183 |
QPushButton *BtnBack; |
|
184 |
GameCFGWidget *gameCFG; |
|
185 |
TeamSelWidget *teamsSelect; |
|
186 |
QPushButton *BtnStartMPGame; |
|
187 |
}; |
|
188 |
||
692 | 189 |
class PageOptions : public AbstractPage |
184 | 190 |
{ |
191 |
Q_OBJECT |
|
192 |
||
193 |
public: |
|
194 |
PageOptions(QWidget* parent = 0); |
|
195 |
||
597
ec5f057ab268
kdevelop project add, initial weapons scheme button
displacer
parents:
587
diff
changeset
|
196 |
QPushButton* WeaponsButt; |
693 | 197 |
QPushButton* WeaponEdit; |
198 |
QComboBox* WeaponsName; |
|
199 |
||
184 | 200 |
QPushButton *BtnBack; |
1194 | 201 |
IconedGroupBox *teamsBox; |
184 | 202 |
QPushButton *BtnNewTeam; |
203 |
QPushButton *BtnEditTeam; |
|
204 |
QComboBox *CBTeamName; |
|
1193 | 205 |
IconedGroupBox *AGGroupBox; |
184 | 206 |
QComboBox *CBResolution; |
207 |
QCheckBox *CBEnableSound; |
|
1129 | 208 |
QCheckBox *CBEnableMusic; |
184 | 209 |
QCheckBox *CBFullscreen; |
1162 | 210 |
QCheckBox *CBFrontendFullscreen; |
297 | 211 |
QCheckBox *CBShowFPS; |
529 | 212 |
QCheckBox *CBAltDamage; |
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1443
diff
changeset
|
213 |
QCheckBox *CBNameWithDate; |
297 | 214 |
FPSEdit *fpsedit; |
184 | 215 |
QPushButton *BtnSaveOptions; |
647 | 216 |
QLabel *labelNN; |
1777 | 217 |
QSpinBox * volumeBox; |
647 | 218 |
QLineEdit *editNetNick; |
1812 | 219 |
QCheckBox *CBReduceQuality; |
184 | 220 |
}; |
221 |
||
1153 | 222 |
class PageNet : public AbstractPage |
184 | 223 |
{ |
224 |
Q_OBJECT |
|
225 |
||
226 |
public: |
|
227 |
PageNet(QWidget* parent = 0); |
|
228 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
229 |
QPushButton* BtnUpdateSList; |
665 | 230 |
QTableView * tvServersList; |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
231 |
QPushButton * BtnBack; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
232 |
QPushButton * BtnNetConnect; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
233 |
QPushButton * BtnNetSvrStart; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
234 |
QPushButton * BtnSpecifyServer; |
1395 | 235 |
QPushButton * BtnOfficialServer; |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
236 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
237 |
private: |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
238 |
QGroupBox * ConnGroupBox; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
239 |
QGridLayout * GBClayout; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
240 |
|
646 | 241 |
private slots: |
242 |
void slotConnect(); |
|
243 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
244 |
public slots: |
646 | 245 |
void updateServersList(); |
246 |
||
247 |
signals: |
|
665 | 248 |
void connectClicked(const QString & host, quint16 port); |
646 | 249 |
}; |
250 |
||
1153 | 251 |
class PageNetServer : public AbstractPage |
646 | 252 |
{ |
253 |
Q_OBJECT |
|
254 |
||
255 |
public: |
|
256 |
PageNetServer(QWidget* parent = 0); |
|
257 |
||
258 |
QPushButton *BtnBack; |
|
259 |
QPushButton *BtnStart; |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
260 |
QPushButton *BtnDefault; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
261 |
QLabel *labelSD; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
262 |
QLineEdit *leServerDescr; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
263 |
QLabel *labelPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
264 |
QSpinBox *sbPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
265 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
266 |
private slots: |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
267 |
void setDefaultPort(); |
184 | 268 |
}; |
269 |
||
1153 | 270 |
class PageNetGame : public AbstractPage |
184 | 271 |
{ |
272 |
Q_OBJECT |
|
273 |
||
274 |
public: |
|
275 |
PageNetGame(QWidget* parent = 0); |
|
276 |
||
277 |
QPushButton *BtnBack; |
|
278 |
QPushButton *BtnGo; |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
279 |
QPushButton *BtnMaster; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
280 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
281 |
QAction * startGame; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
282 |
QAction * restrictJoins; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
283 |
QAction * restrictTeamAdds; |
461 | 284 |
|
285 |
HWChatWidget* pChatWidget; |
|
322 | 286 |
|
287 |
TeamSelWidget* pNetTeamsWidget; |
|
288 |
GameCFGWidget* pGameCFG; |
|
1648 | 289 |
|
290 |
public slots: |
|
291 |
void setReadyStatus(bool isReady); |
|
1649 | 292 |
void setMasterMode(bool isMaster); |
184 | 293 |
}; |
294 |
||
1153 | 295 |
class PageInfo : public AbstractPage |
187 | 296 |
{ |
297 |
Q_OBJECT |
|
298 |
||
299 |
public: |
|
300 |
PageInfo(QWidget* parent = 0); |
|
301 |
||
302 |
QPushButton *BtnBack; |
|
303 |
About *about; |
|
304 |
}; |
|
305 |
||
1150 | 306 |
class PageSinglePlayer : public AbstractPage |
586 | 307 |
{ |
308 |
Q_OBJECT |
|
309 |
||
310 |
public: |
|
311 |
PageSinglePlayer(QWidget* parent = 0); |
|
312 |
||
313 |
QPushButton *BtnSimpleGamePage; |
|
314 |
QPushButton *BtnTrainPage; |
|
1150 | 315 |
QPushButton *BtnMultiplayer; |
316 |
QPushButton *BtnLoad; |
|
317 |
QPushButton *BtnDemos; |
|
586 | 318 |
QPushButton *BtnBack; |
319 |
GameCFGWidget *gameCFG; |
|
320 |
}; |
|
321 |
||
1153 | 322 |
class PageTraining : public AbstractPage |
587 | 323 |
{ |
324 |
Q_OBJECT |
|
325 |
||
326 |
public: |
|
327 |
PageTraining(QWidget* parent = 0); |
|
328 |
||
329 |
QPushButton *BtnStartTrain; |
|
330 |
QPushButton *BtnBack; |
|
331 |
}; |
|
332 |
||
684 | 333 |
class PageSelectWeapon : public AbstractPage |
600 | 334 |
{ |
335 |
Q_OBJECT |
|
336 |
||
337 |
public: |
|
338 |
PageSelectWeapon(QWidget* parent = 0); |
|
339 |
||
683 | 340 |
QPushButton *BtnSave; |
341 |
QPushButton *BtnDefault; |
|
718 | 342 |
QPushButton *BtnDelete; |
600 | 343 |
QPushButton *BtnBack; |
1312 | 344 |
SelWeaponWidget* pWeapons; |
600 | 345 |
}; |
306 | 346 |
|
686 | 347 |
class PageInGame : public AbstractPage |
348 |
{ |
|
349 |
Q_OBJECT |
|
350 |
||
351 |
public: |
|
352 |
PageInGame(QWidget* parent = 0); |
|
353 |
}; |
|
354 |
||
1311 | 355 |
class PageRoomsList : public AbstractPage |
356 |
{ |
|
357 |
Q_OBJECT |
|
358 |
||
359 |
public: |
|
360 |
PageRoomsList(QWidget* parent = 0); |
|
1312 | 361 |
|
1314 | 362 |
QLineEdit * roomName; |
1399 | 363 |
QTableWidget * roomsList; |
1312 | 364 |
QPushButton * BtnBack; |
365 |
QPushButton * BtnCreate; |
|
366 |
QPushButton * BtnJoin; |
|
367 |
QPushButton * BtnRefresh; |
|
1522 | 368 |
HWChatWidget * chatWidget; |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
369 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
370 |
public slots: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
371 |
void setRoomsList(const QStringList & list); |
1314 | 372 |
|
373 |
private slots: |
|
374 |
void onCreateClick(); |
|
375 |
void onJoinClick(); |
|
1315 | 376 |
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
|
377 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
378 |
signals: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
379 |
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
|
380 |
void askForJoinRoom(const QString &); |
1315 | 381 |
void askForRoomList(); |
1311 | 382 |
}; |
383 |
||
1800 | 384 |
class PageConnecting : public AbstractPage |
385 |
{ |
|
386 |
Q_OBJECT |
|
387 |
||
388 |
public: |
|
389 |
PageConnecting(QWidget* parent = 0); |
|
390 |
}; |
|
391 |
||
184 | 392 |
#endif // PAGES_H |