author | unc0rr |
Tue, 17 Feb 2009 12:58:25 +0000 | |
changeset 1802 | dd148e2506e2 |
parent 1800 | f1df2eb32a16 |
child 1812 | 3d4692e825e7 |
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; |
184 | 219 |
}; |
220 |
||
1153 | 221 |
class PageNet : public AbstractPage |
184 | 222 |
{ |
223 |
Q_OBJECT |
|
224 |
||
225 |
public: |
|
226 |
PageNet(QWidget* parent = 0); |
|
227 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
228 |
QPushButton* BtnUpdateSList; |
665 | 229 |
QTableView * tvServersList; |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
230 |
QPushButton * BtnBack; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
231 |
QPushButton * BtnNetConnect; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
232 |
QPushButton * BtnNetSvrStart; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
233 |
QPushButton * BtnSpecifyServer; |
1395 | 234 |
QPushButton * BtnOfficialServer; |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
235 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
236 |
private: |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
237 |
QGroupBox * ConnGroupBox; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
238 |
QGridLayout * GBClayout; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
239 |
|
646 | 240 |
private slots: |
241 |
void slotConnect(); |
|
242 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
243 |
public slots: |
646 | 244 |
void updateServersList(); |
245 |
||
246 |
signals: |
|
665 | 247 |
void connectClicked(const QString & host, quint16 port); |
646 | 248 |
}; |
249 |
||
1153 | 250 |
class PageNetServer : public AbstractPage |
646 | 251 |
{ |
252 |
Q_OBJECT |
|
253 |
||
254 |
public: |
|
255 |
PageNetServer(QWidget* parent = 0); |
|
256 |
||
257 |
QPushButton *BtnBack; |
|
258 |
QPushButton *BtnStart; |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
259 |
QPushButton *BtnDefault; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
260 |
QLabel *labelSD; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
261 |
QLineEdit *leServerDescr; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
262 |
QLabel *labelPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
263 |
QSpinBox *sbPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
264 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
265 |
private slots: |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
266 |
void setDefaultPort(); |
184 | 267 |
}; |
268 |
||
1153 | 269 |
class PageNetGame : public AbstractPage |
184 | 270 |
{ |
271 |
Q_OBJECT |
|
272 |
||
273 |
public: |
|
274 |
PageNetGame(QWidget* parent = 0); |
|
275 |
||
276 |
QPushButton *BtnBack; |
|
277 |
QPushButton *BtnGo; |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
278 |
QPushButton *BtnMaster; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
279 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
280 |
QAction * startGame; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
281 |
QAction * restrictJoins; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
282 |
QAction * restrictTeamAdds; |
461 | 283 |
|
284 |
HWChatWidget* pChatWidget; |
|
322 | 285 |
|
286 |
TeamSelWidget* pNetTeamsWidget; |
|
287 |
GameCFGWidget* pGameCFG; |
|
1648 | 288 |
|
289 |
public slots: |
|
290 |
void setReadyStatus(bool isReady); |
|
1649 | 291 |
void setMasterMode(bool isMaster); |
184 | 292 |
}; |
293 |
||
1153 | 294 |
class PageInfo : public AbstractPage |
187 | 295 |
{ |
296 |
Q_OBJECT |
|
297 |
||
298 |
public: |
|
299 |
PageInfo(QWidget* parent = 0); |
|
300 |
||
301 |
QPushButton *BtnBack; |
|
302 |
About *about; |
|
303 |
}; |
|
304 |
||
1150 | 305 |
class PageSinglePlayer : public AbstractPage |
586 | 306 |
{ |
307 |
Q_OBJECT |
|
308 |
||
309 |
public: |
|
310 |
PageSinglePlayer(QWidget* parent = 0); |
|
311 |
||
312 |
QPushButton *BtnSimpleGamePage; |
|
313 |
QPushButton *BtnTrainPage; |
|
1150 | 314 |
QPushButton *BtnMultiplayer; |
315 |
QPushButton *BtnLoad; |
|
316 |
QPushButton *BtnDemos; |
|
586 | 317 |
QPushButton *BtnBack; |
318 |
GameCFGWidget *gameCFG; |
|
319 |
}; |
|
320 |
||
1153 | 321 |
class PageTraining : public AbstractPage |
587 | 322 |
{ |
323 |
Q_OBJECT |
|
324 |
||
325 |
public: |
|
326 |
PageTraining(QWidget* parent = 0); |
|
327 |
||
328 |
QPushButton *BtnStartTrain; |
|
329 |
QPushButton *BtnBack; |
|
330 |
}; |
|
331 |
||
684 | 332 |
class PageSelectWeapon : public AbstractPage |
600 | 333 |
{ |
334 |
Q_OBJECT |
|
335 |
||
336 |
public: |
|
337 |
PageSelectWeapon(QWidget* parent = 0); |
|
338 |
||
683 | 339 |
QPushButton *BtnSave; |
340 |
QPushButton *BtnDefault; |
|
718 | 341 |
QPushButton *BtnDelete; |
600 | 342 |
QPushButton *BtnBack; |
1312 | 343 |
SelWeaponWidget* pWeapons; |
600 | 344 |
}; |
306 | 345 |
|
686 | 346 |
class PageInGame : public AbstractPage |
347 |
{ |
|
348 |
Q_OBJECT |
|
349 |
||
350 |
public: |
|
351 |
PageInGame(QWidget* parent = 0); |
|
352 |
}; |
|
353 |
||
1311 | 354 |
class PageRoomsList : public AbstractPage |
355 |
{ |
|
356 |
Q_OBJECT |
|
357 |
||
358 |
public: |
|
359 |
PageRoomsList(QWidget* parent = 0); |
|
1312 | 360 |
|
1314 | 361 |
QLineEdit * roomName; |
1399 | 362 |
QTableWidget * roomsList; |
1312 | 363 |
QPushButton * BtnBack; |
364 |
QPushButton * BtnCreate; |
|
365 |
QPushButton * BtnJoin; |
|
366 |
QPushButton * BtnRefresh; |
|
1522 | 367 |
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
|
368 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
369 |
public slots: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
370 |
void setRoomsList(const QStringList & list); |
1314 | 371 |
|
372 |
private slots: |
|
373 |
void onCreateClick(); |
|
374 |
void onJoinClick(); |
|
1315 | 375 |
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
|
376 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
377 |
signals: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
378 |
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
|
379 |
void askForJoinRoom(const QString &); |
1315 | 380 |
void askForRoomList(); |
1311 | 381 |
}; |
382 |
||
1800 | 383 |
class PageConnecting : public AbstractPage |
384 |
{ |
|
385 |
Q_OBJECT |
|
386 |
||
387 |
public: |
|
388 |
PageConnecting(QWidget* parent = 0); |
|
389 |
}; |
|
390 |
||
184 | 391 |
#endif // PAGES_H |