author | unc0rr |
Fri, 05 Dec 2008 20:03:44 +0000 | |
changeset 1534 | d8e6282abe37 |
parent 1522 | 6794cf8f1e6f |
child 1584 | 90f6a5abad17 |
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; |
184 | 151 |
QGroupBox *GBoxBinds; |
152 |
QToolBox *BindsBox; |
|
153 |
QWidget *page_A; |
|
154 |
QWidget *page_W; |
|
155 |
QWidget *page_WP; |
|
156 |
QWidget *page_O; |
|
157 |
QPushButton *BtnTeamDiscard; |
|
158 |
QPushButton *BtnTeamSave; |
|
159 |
QLineEdit * TeamNameEdit; |
|
160 |
QLineEdit * HHNameEdit[8]; |
|
1236 | 161 |
QComboBox * HHHats[8]; |
184 | 162 |
QComboBox * CBBind[BINDS_NUMBER]; |
163 |
||
164 |
public slots: |
|
165 |
void CBFort_activated(const QString & gravename); |
|
166 |
||
167 |
private: |
|
168 |
QLabel * LBind[BINDS_NUMBER]; |
|
169 |
}; |
|
170 |
||
692 | 171 |
class PageMultiplayer : public AbstractPage |
184 | 172 |
{ |
173 |
Q_OBJECT |
|
174 |
||
175 |
public: |
|
176 |
PageMultiplayer(QWidget* parent = 0); |
|
177 |
||
178 |
QPushButton *BtnBack; |
|
179 |
GameCFGWidget *gameCFG; |
|
180 |
TeamSelWidget *teamsSelect; |
|
181 |
QPushButton *BtnStartMPGame; |
|
182 |
}; |
|
183 |
||
692 | 184 |
class PageOptions : public AbstractPage |
184 | 185 |
{ |
186 |
Q_OBJECT |
|
187 |
||
188 |
public: |
|
189 |
PageOptions(QWidget* parent = 0); |
|
190 |
||
597
ec5f057ab268
kdevelop project add, initial weapons scheme button
displacer
parents:
587
diff
changeset
|
191 |
QPushButton* WeaponsButt; |
693 | 192 |
QPushButton* WeaponEdit; |
193 |
QComboBox* WeaponsName; |
|
194 |
||
184 | 195 |
QPushButton *BtnBack; |
1194 | 196 |
IconedGroupBox *teamsBox; |
184 | 197 |
QPushButton *BtnNewTeam; |
198 |
QPushButton *BtnEditTeam; |
|
199 |
QComboBox *CBTeamName; |
|
1193 | 200 |
IconedGroupBox *AGGroupBox; |
184 | 201 |
QComboBox *CBResolution; |
202 |
QCheckBox *CBEnableSound; |
|
1129 | 203 |
QCheckBox *CBEnableMusic; |
184 | 204 |
QCheckBox *CBFullscreen; |
1162 | 205 |
QCheckBox *CBFrontendFullscreen; |
297 | 206 |
QCheckBox *CBShowFPS; |
529 | 207 |
QCheckBox *CBAltDamage; |
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1443
diff
changeset
|
208 |
QCheckBox *CBNameWithDate; |
297 | 209 |
FPSEdit *fpsedit; |
184 | 210 |
QPushButton *BtnSaveOptions; |
647 | 211 |
QLabel *labelNN; |
212 |
QLineEdit *editNetNick; |
|
184 | 213 |
}; |
214 |
||
1153 | 215 |
class PageNet : public AbstractPage |
184 | 216 |
{ |
217 |
Q_OBJECT |
|
218 |
||
219 |
public: |
|
220 |
PageNet(QWidget* parent = 0); |
|
221 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
222 |
QPushButton* BtnUpdateSList; |
665 | 223 |
QTableView * tvServersList; |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
224 |
QPushButton * BtnBack; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
225 |
QPushButton * BtnNetConnect; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
226 |
QPushButton * BtnNetSvrStart; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
227 |
QPushButton * BtnSpecifyServer; |
1395 | 228 |
QPushButton * BtnOfficialServer; |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
229 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
230 |
private: |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
231 |
QGroupBox * ConnGroupBox; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
232 |
QGridLayout * GBClayout; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
233 |
|
646 | 234 |
private slots: |
235 |
void slotConnect(); |
|
236 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
237 |
public slots: |
646 | 238 |
void updateServersList(); |
239 |
||
240 |
signals: |
|
665 | 241 |
void connectClicked(const QString & host, quint16 port); |
646 | 242 |
}; |
243 |
||
1153 | 244 |
class PageNetServer : public AbstractPage |
646 | 245 |
{ |
246 |
Q_OBJECT |
|
247 |
||
248 |
public: |
|
249 |
PageNetServer(QWidget* parent = 0); |
|
250 |
||
251 |
QPushButton *BtnBack; |
|
252 |
QPushButton *BtnStart; |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
253 |
QPushButton *BtnDefault; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
254 |
QLabel *labelSD; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
255 |
QLineEdit *leServerDescr; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
256 |
QLabel *labelPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
257 |
QSpinBox *sbPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
258 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
259 |
private slots: |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
260 |
void setDefaultPort(); |
184 | 261 |
}; |
262 |
||
1153 | 263 |
class PageNetGame : public AbstractPage |
184 | 264 |
{ |
265 |
Q_OBJECT |
|
266 |
||
267 |
public: |
|
268 |
PageNetGame(QWidget* parent = 0); |
|
269 |
||
270 |
QPushButton *BtnBack; |
|
271 |
QPushButton *BtnGo; |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
272 |
QPushButton *BtnMaster; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
273 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
274 |
QAction * startGame; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
275 |
QAction * restrictJoins; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
276 |
QAction * restrictTeamAdds; |
461 | 277 |
|
278 |
HWChatWidget* pChatWidget; |
|
322 | 279 |
|
280 |
TeamSelWidget* pNetTeamsWidget; |
|
281 |
GameCFGWidget* pGameCFG; |
|
184 | 282 |
}; |
283 |
||
1153 | 284 |
class PageInfo : public AbstractPage |
187 | 285 |
{ |
286 |
Q_OBJECT |
|
287 |
||
288 |
public: |
|
289 |
PageInfo(QWidget* parent = 0); |
|
290 |
||
291 |
QPushButton *BtnBack; |
|
292 |
About *about; |
|
293 |
}; |
|
294 |
||
1153 | 295 |
class PageGameStats : public AbstractPage |
306 | 296 |
{ |
297 |
Q_OBJECT |
|
298 |
||
299 |
public: |
|
300 |
PageGameStats(QWidget* parent = 0); |
|
301 |
||
302 |
QPushButton *BtnBack; |
|
307 | 303 |
QLabel *labelGameStats; |
306 | 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; |
|
1377 | 368 |
QTextBrowser * serverMessage; |
1522 | 369 |
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
|
370 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
371 |
public slots: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
372 |
void setRoomsList(const QStringList & list); |
1314 | 373 |
|
374 |
private slots: |
|
375 |
void onCreateClick(); |
|
376 |
void onJoinClick(); |
|
1315 | 377 |
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
|
378 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
379 |
signals: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
380 |
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
|
381 |
void askForJoinRoom(const QString &); |
1315 | 382 |
void askForRoomList(); |
1311 | 383 |
}; |
384 |
||
184 | 385 |
#endif // PAGES_H |