author | unc0rr |
Tue, 13 Jan 2009 20:40:43 +0000 | |
changeset 1666 | b66e014510e7 |
parent 1659 | fd593a5e71fb |
child 1684 | b3f4ec08f0a4 |
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; |
|
160 |
QLineEdit * TeamNameEdit; |
|
161 |
QLineEdit * HHNameEdit[8]; |
|
1236 | 162 |
QComboBox * HHHats[8]; |
184 | 163 |
QComboBox * CBBind[BINDS_NUMBER]; |
164 |
||
165 |
public slots: |
|
166 |
void CBFort_activated(const QString & gravename); |
|
167 |
||
168 |
private: |
|
169 |
QLabel * LBind[BINDS_NUMBER]; |
|
170 |
}; |
|
171 |
||
692 | 172 |
class PageMultiplayer : public AbstractPage |
184 | 173 |
{ |
174 |
Q_OBJECT |
|
175 |
||
176 |
public: |
|
177 |
PageMultiplayer(QWidget* parent = 0); |
|
178 |
||
179 |
QPushButton *BtnBack; |
|
180 |
GameCFGWidget *gameCFG; |
|
181 |
TeamSelWidget *teamsSelect; |
|
182 |
QPushButton *BtnStartMPGame; |
|
183 |
}; |
|
184 |
||
692 | 185 |
class PageOptions : public AbstractPage |
184 | 186 |
{ |
187 |
Q_OBJECT |
|
188 |
||
189 |
public: |
|
190 |
PageOptions(QWidget* parent = 0); |
|
191 |
||
597
ec5f057ab268
kdevelop project add, initial weapons scheme button
displacer
parents:
587
diff
changeset
|
192 |
QPushButton* WeaponsButt; |
693 | 193 |
QPushButton* WeaponEdit; |
194 |
QComboBox* WeaponsName; |
|
195 |
||
184 | 196 |
QPushButton *BtnBack; |
1194 | 197 |
IconedGroupBox *teamsBox; |
184 | 198 |
QPushButton *BtnNewTeam; |
199 |
QPushButton *BtnEditTeam; |
|
200 |
QComboBox *CBTeamName; |
|
1193 | 201 |
IconedGroupBox *AGGroupBox; |
184 | 202 |
QComboBox *CBResolution; |
203 |
QCheckBox *CBEnableSound; |
|
1129 | 204 |
QCheckBox *CBEnableMusic; |
184 | 205 |
QCheckBox *CBFullscreen; |
1162 | 206 |
QCheckBox *CBFrontendFullscreen; |
297 | 207 |
QCheckBox *CBShowFPS; |
529 | 208 |
QCheckBox *CBAltDamage; |
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1443
diff
changeset
|
209 |
QCheckBox *CBNameWithDate; |
297 | 210 |
FPSEdit *fpsedit; |
184 | 211 |
QPushButton *BtnSaveOptions; |
647 | 212 |
QLabel *labelNN; |
213 |
QLineEdit *editNetNick; |
|
184 | 214 |
}; |
215 |
||
1153 | 216 |
class PageNet : public AbstractPage |
184 | 217 |
{ |
218 |
Q_OBJECT |
|
219 |
||
220 |
public: |
|
221 |
PageNet(QWidget* parent = 0); |
|
222 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
223 |
QPushButton* BtnUpdateSList; |
665 | 224 |
QTableView * tvServersList; |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
225 |
QPushButton * BtnBack; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
226 |
QPushButton * BtnNetConnect; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
227 |
QPushButton * BtnNetSvrStart; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
228 |
QPushButton * BtnSpecifyServer; |
1395 | 229 |
QPushButton * BtnOfficialServer; |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
230 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
231 |
private: |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
232 |
QGroupBox * ConnGroupBox; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
233 |
QGridLayout * GBClayout; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
234 |
|
646 | 235 |
private slots: |
236 |
void slotConnect(); |
|
237 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
238 |
public slots: |
646 | 239 |
void updateServersList(); |
240 |
||
241 |
signals: |
|
665 | 242 |
void connectClicked(const QString & host, quint16 port); |
646 | 243 |
}; |
244 |
||
1153 | 245 |
class PageNetServer : public AbstractPage |
646 | 246 |
{ |
247 |
Q_OBJECT |
|
248 |
||
249 |
public: |
|
250 |
PageNetServer(QWidget* parent = 0); |
|
251 |
||
252 |
QPushButton *BtnBack; |
|
253 |
QPushButton *BtnStart; |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
254 |
QPushButton *BtnDefault; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
255 |
QLabel *labelSD; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
256 |
QLineEdit *leServerDescr; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
257 |
QLabel *labelPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
258 |
QSpinBox *sbPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
259 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
260 |
private slots: |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
261 |
void setDefaultPort(); |
184 | 262 |
}; |
263 |
||
1153 | 264 |
class PageNetGame : public AbstractPage |
184 | 265 |
{ |
266 |
Q_OBJECT |
|
267 |
||
268 |
public: |
|
269 |
PageNetGame(QWidget* parent = 0); |
|
270 |
||
271 |
QPushButton *BtnBack; |
|
272 |
QPushButton *BtnGo; |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
273 |
QPushButton *BtnMaster; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
274 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
275 |
QAction * startGame; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
276 |
QAction * restrictJoins; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
277 |
QAction * restrictTeamAdds; |
461 | 278 |
|
279 |
HWChatWidget* pChatWidget; |
|
322 | 280 |
|
281 |
TeamSelWidget* pNetTeamsWidget; |
|
282 |
GameCFGWidget* pGameCFG; |
|
1648 | 283 |
|
284 |
public slots: |
|
285 |
void setReadyStatus(bool isReady); |
|
1649 | 286 |
void setMasterMode(bool isMaster); |
184 | 287 |
}; |
288 |
||
1153 | 289 |
class PageInfo : public AbstractPage |
187 | 290 |
{ |
291 |
Q_OBJECT |
|
292 |
||
293 |
public: |
|
294 |
PageInfo(QWidget* parent = 0); |
|
295 |
||
296 |
QPushButton *BtnBack; |
|
297 |
About *about; |
|
298 |
}; |
|
299 |
||
1150 | 300 |
class PageSinglePlayer : public AbstractPage |
586 | 301 |
{ |
302 |
Q_OBJECT |
|
303 |
||
304 |
public: |
|
305 |
PageSinglePlayer(QWidget* parent = 0); |
|
306 |
||
307 |
QPushButton *BtnSimpleGamePage; |
|
308 |
QPushButton *BtnTrainPage; |
|
1150 | 309 |
QPushButton *BtnMultiplayer; |
310 |
QPushButton *BtnLoad; |
|
311 |
QPushButton *BtnDemos; |
|
586 | 312 |
QPushButton *BtnBack; |
313 |
GameCFGWidget *gameCFG; |
|
314 |
}; |
|
315 |
||
1153 | 316 |
class PageTraining : public AbstractPage |
587 | 317 |
{ |
318 |
Q_OBJECT |
|
319 |
||
320 |
public: |
|
321 |
PageTraining(QWidget* parent = 0); |
|
322 |
||
323 |
QPushButton *BtnStartTrain; |
|
324 |
QPushButton *BtnBack; |
|
325 |
}; |
|
326 |
||
684 | 327 |
class PageSelectWeapon : public AbstractPage |
600 | 328 |
{ |
329 |
Q_OBJECT |
|
330 |
||
331 |
public: |
|
332 |
PageSelectWeapon(QWidget* parent = 0); |
|
333 |
||
683 | 334 |
QPushButton *BtnSave; |
335 |
QPushButton *BtnDefault; |
|
718 | 336 |
QPushButton *BtnDelete; |
600 | 337 |
QPushButton *BtnBack; |
1312 | 338 |
SelWeaponWidget* pWeapons; |
600 | 339 |
}; |
306 | 340 |
|
686 | 341 |
class PageInGame : public AbstractPage |
342 |
{ |
|
343 |
Q_OBJECT |
|
344 |
||
345 |
public: |
|
346 |
PageInGame(QWidget* parent = 0); |
|
347 |
}; |
|
348 |
||
1311 | 349 |
class PageRoomsList : public AbstractPage |
350 |
{ |
|
351 |
Q_OBJECT |
|
352 |
||
353 |
public: |
|
354 |
PageRoomsList(QWidget* parent = 0); |
|
1312 | 355 |
|
1314 | 356 |
QLineEdit * roomName; |
1399 | 357 |
QTableWidget * roomsList; |
1312 | 358 |
QPushButton * BtnBack; |
359 |
QPushButton * BtnCreate; |
|
360 |
QPushButton * BtnJoin; |
|
361 |
QPushButton * BtnRefresh; |
|
1522 | 362 |
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
|
363 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
364 |
public slots: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
365 |
void setRoomsList(const QStringList & list); |
1314 | 366 |
|
367 |
private slots: |
|
368 |
void onCreateClick(); |
|
369 |
void onJoinClick(); |
|
1315 | 370 |
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
|
371 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
372 |
signals: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
373 |
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
|
374 |
void askForJoinRoom(const QString &); |
1315 | 375 |
void askForRoomList(); |
1311 | 376 |
}; |
377 |
||
184 | 378 |
#endif // PAGES_H |