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