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