author | unc0rr |
Sun, 26 Oct 2008 17:17:07 +0000 | |
changeset 1424 | 2b45d88716b0 |
parent 1409 | d1cbe4a57ebf |
child 1443 | e79e4b48c771 |
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)); |
1168 | 75 |
if (btname == ":/res/Save.png") |
76 |
{ |
|
77 |
butt->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
|
78 |
} |
|
1148 | 79 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
80 |
butt->setFixedSize(sz); |
1148 | 81 |
butt->setIconSize(sz); |
82 |
butt->setFlat(true); |
|
1149 | 83 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 84 |
} |
684 | 85 |
grid->addWidget(butt, wy, wx); |
86 |
return butt; |
|
87 |
}; |
|
88 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
89 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { |
692 | 90 |
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
|
91 |
if (!iconed) { |
1148 | 92 |
butt->setFont(*font14); |
93 |
butt->setText(btname); |
|
94 |
} else { |
|
95 |
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
|
96 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 97 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
98 |
butt->setFixedSize(sz); |
1148 | 99 |
butt->setIconSize(sz); |
100 |
butt->setFlat(true); |
|
1149 | 101 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 102 |
} |
692 | 103 |
grid->addWidget(butt, wy, wx, rowSpan, columnSpan); |
104 |
return butt; |
|
105 |
}; |
|
106 |
||
728 | 107 |
QPushButton* addButton(QString btname, QBoxLayout* box, int where) { |
684 | 108 |
QPushButton* butt = new QPushButton(this); |
109 |
butt->setFont(*font14); |
|
728 | 110 |
butt->setText(btname); |
684 | 111 |
box->addWidget(butt, where); |
112 |
return butt; |
|
113 |
}; |
|
114 |
||
115 |
QFont * font14; |
|
116 |
}; |
|
117 |
||
118 |
class PageMain : public AbstractPage |
|
184 | 119 |
{ |
120 |
Q_OBJECT |
|
121 |
||
122 |
public: |
|
123 |
PageMain(QWidget* parent = 0); |
|
124 |
||
125 |
QPushButton *BtnSinglePlayer; |
|
126 |
QPushButton *BtnNet; |
|
127 |
QPushButton *BtnSetup; |
|
187 | 128 |
QPushButton *BtnInfo; |
184 | 129 |
QPushButton *BtnExit; |
130 |
}; |
|
131 |
||
692 | 132 |
class PageEditTeam : public AbstractPage |
184 | 133 |
{ |
134 |
Q_OBJECT |
|
135 |
||
136 |
public: |
|
137 |
PageEditTeam(QWidget* parent = 0); |
|
138 |
QGroupBox *GBoxHedgehogs; |
|
139 |
QGroupBox *GBoxTeam; |
|
140 |
QGroupBox *GBoxFort; |
|
141 |
QComboBox *CBFort; |
|
142 |
SquareLabel *FortPreview; |
|
143 |
QComboBox *CBGrave; |
|
336 | 144 |
QComboBox *CBTeamLvl; |
184 | 145 |
QGroupBox *GBoxBinds; |
146 |
QToolBox *BindsBox; |
|
147 |
QWidget *page_A; |
|
148 |
QWidget *page_W; |
|
149 |
QWidget *page_WP; |
|
150 |
QWidget *page_O; |
|
151 |
QPushButton *BtnTeamDiscard; |
|
152 |
QPushButton *BtnTeamSave; |
|
153 |
QLineEdit * TeamNameEdit; |
|
154 |
QLineEdit * HHNameEdit[8]; |
|
1236 | 155 |
QComboBox * HHHats[8]; |
184 | 156 |
QComboBox * CBBind[BINDS_NUMBER]; |
157 |
||
158 |
public slots: |
|
159 |
void CBFort_activated(const QString & gravename); |
|
160 |
||
161 |
private: |
|
162 |
QLabel * LBind[BINDS_NUMBER]; |
|
163 |
}; |
|
164 |
||
692 | 165 |
class PageMultiplayer : public AbstractPage |
184 | 166 |
{ |
167 |
Q_OBJECT |
|
168 |
||
169 |
public: |
|
170 |
PageMultiplayer(QWidget* parent = 0); |
|
171 |
||
172 |
QPushButton *BtnBack; |
|
173 |
GameCFGWidget *gameCFG; |
|
174 |
TeamSelWidget *teamsSelect; |
|
175 |
QPushButton *BtnStartMPGame; |
|
176 |
}; |
|
177 |
||
692 | 178 |
class PageOptions : public AbstractPage |
184 | 179 |
{ |
180 |
Q_OBJECT |
|
181 |
||
182 |
public: |
|
183 |
PageOptions(QWidget* parent = 0); |
|
184 |
||
597
ec5f057ab268
kdevelop project add, initial weapons scheme button
displacer
parents:
587
diff
changeset
|
185 |
QPushButton* WeaponsButt; |
693 | 186 |
QPushButton* WeaponEdit; |
187 |
QComboBox* WeaponsName; |
|
188 |
||
184 | 189 |
QPushButton *BtnBack; |
1194 | 190 |
IconedGroupBox *teamsBox; |
184 | 191 |
QPushButton *BtnNewTeam; |
192 |
QPushButton *BtnEditTeam; |
|
193 |
QComboBox *CBTeamName; |
|
1193 | 194 |
IconedGroupBox *AGGroupBox; |
184 | 195 |
QComboBox *CBResolution; |
196 |
QCheckBox *CBEnableSound; |
|
1129 | 197 |
QCheckBox *CBEnableMusic; |
184 | 198 |
QCheckBox *CBFullscreen; |
1162 | 199 |
QCheckBox *CBFrontendFullscreen; |
297 | 200 |
QCheckBox *CBShowFPS; |
529 | 201 |
QCheckBox *CBAltDamage; |
297 | 202 |
FPSEdit *fpsedit; |
184 | 203 |
QPushButton *BtnSaveOptions; |
647 | 204 |
QLabel *labelNN; |
205 |
QLineEdit *editNetNick; |
|
184 | 206 |
}; |
207 |
||
1153 | 208 |
class PageNet : public AbstractPage |
184 | 209 |
{ |
210 |
Q_OBJECT |
|
211 |
||
212 |
public: |
|
213 |
PageNet(QWidget* parent = 0); |
|
214 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
215 |
QPushButton* BtnUpdateSList; |
665 | 216 |
QTableView * tvServersList; |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
217 |
QPushButton * BtnBack; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
218 |
QPushButton * BtnNetConnect; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
219 |
QPushButton * BtnNetSvrStart; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
220 |
QPushButton * BtnSpecifyServer; |
1395 | 221 |
QPushButton * BtnOfficialServer; |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
222 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
223 |
private: |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
224 |
QGroupBox * ConnGroupBox; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
225 |
QGridLayout * GBClayout; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
226 |
|
646 | 227 |
private slots: |
228 |
void slotConnect(); |
|
229 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
230 |
public slots: |
646 | 231 |
void updateServersList(); |
232 |
||
233 |
signals: |
|
665 | 234 |
void connectClicked(const QString & host, quint16 port); |
646 | 235 |
}; |
236 |
||
1153 | 237 |
class PageNetServer : public AbstractPage |
646 | 238 |
{ |
239 |
Q_OBJECT |
|
240 |
||
241 |
public: |
|
242 |
PageNetServer(QWidget* parent = 0); |
|
243 |
||
244 |
QPushButton *BtnBack; |
|
245 |
QPushButton *BtnStart; |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
246 |
QPushButton *BtnDefault; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
247 |
QLabel *labelSD; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
248 |
QLineEdit *leServerDescr; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
249 |
QLabel *labelPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
250 |
QSpinBox *sbPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
251 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
252 |
private slots: |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
253 |
void setDefaultPort(); |
184 | 254 |
}; |
255 |
||
1153 | 256 |
class PageNetGame : public AbstractPage |
184 | 257 |
{ |
258 |
Q_OBJECT |
|
259 |
||
260 |
public: |
|
261 |
PageNetGame(QWidget* parent = 0); |
|
262 |
||
263 |
QPushButton *BtnBack; |
|
264 |
QPushButton *BtnGo; |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
265 |
QPushButton *BtnMaster; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
266 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
267 |
QAction * startGame; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
268 |
QAction * restrictJoins; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
269 |
QAction * restrictTeamAdds; |
461 | 270 |
|
271 |
HWChatWidget* pChatWidget; |
|
322 | 272 |
|
273 |
TeamSelWidget* pNetTeamsWidget; |
|
274 |
GameCFGWidget* pGameCFG; |
|
184 | 275 |
}; |
276 |
||
1153 | 277 |
class PageInfo : public AbstractPage |
187 | 278 |
{ |
279 |
Q_OBJECT |
|
280 |
||
281 |
public: |
|
282 |
PageInfo(QWidget* parent = 0); |
|
283 |
||
284 |
QPushButton *BtnBack; |
|
285 |
About *about; |
|
286 |
}; |
|
287 |
||
1153 | 288 |
class PageGameStats : public AbstractPage |
306 | 289 |
{ |
290 |
Q_OBJECT |
|
291 |
||
292 |
public: |
|
293 |
PageGameStats(QWidget* parent = 0); |
|
294 |
||
295 |
QPushButton *BtnBack; |
|
307 | 296 |
QLabel *labelGameStats; |
306 | 297 |
}; |
298 |
||
1150 | 299 |
class PageSinglePlayer : public AbstractPage |
586 | 300 |
{ |
301 |
Q_OBJECT |
|
302 |
||
303 |
public: |
|
304 |
PageSinglePlayer(QWidget* parent = 0); |
|
305 |
||
306 |
QPushButton *BtnSimpleGamePage; |
|
307 |
QPushButton *BtnTrainPage; |
|
1150 | 308 |
QPushButton *BtnMultiplayer; |
309 |
QPushButton *BtnLoad; |
|
310 |
QPushButton *BtnDemos; |
|
586 | 311 |
QPushButton *BtnBack; |
312 |
GameCFGWidget *gameCFG; |
|
313 |
}; |
|
314 |
||
1153 | 315 |
class PageTraining : public AbstractPage |
587 | 316 |
{ |
317 |
Q_OBJECT |
|
318 |
||
319 |
public: |
|
320 |
PageTraining(QWidget* parent = 0); |
|
321 |
||
322 |
QPushButton *BtnStartTrain; |
|
323 |
QPushButton *BtnBack; |
|
324 |
}; |
|
325 |
||
684 | 326 |
class PageSelectWeapon : public AbstractPage |
600 | 327 |
{ |
328 |
Q_OBJECT |
|
329 |
||
330 |
public: |
|
331 |
PageSelectWeapon(QWidget* parent = 0); |
|
332 |
||
683 | 333 |
QPushButton *BtnSave; |
334 |
QPushButton *BtnDefault; |
|
718 | 335 |
QPushButton *BtnDelete; |
600 | 336 |
QPushButton *BtnBack; |
1312 | 337 |
SelWeaponWidget* pWeapons; |
600 | 338 |
}; |
306 | 339 |
|
686 | 340 |
class PageInGame : public AbstractPage |
341 |
{ |
|
342 |
Q_OBJECT |
|
343 |
||
344 |
public: |
|
345 |
PageInGame(QWidget* parent = 0); |
|
346 |
}; |
|
347 |
||
1311 | 348 |
class PageRoomsList : public AbstractPage |
349 |
{ |
|
350 |
Q_OBJECT |
|
351 |
||
352 |
public: |
|
353 |
PageRoomsList(QWidget* parent = 0); |
|
1312 | 354 |
|
1314 | 355 |
QLineEdit * roomName; |
1399 | 356 |
QTableWidget * roomsList; |
1312 | 357 |
QPushButton * BtnBack; |
358 |
QPushButton * BtnCreate; |
|
359 |
QPushButton * BtnJoin; |
|
360 |
QPushButton * BtnRefresh; |
|
1377 | 361 |
QTextBrowser * serverMessage; |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
362 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
363 |
public slots: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
364 |
void setRoomsList(const QStringList & list); |
1314 | 365 |
|
366 |
private slots: |
|
367 |
void onCreateClick(); |
|
368 |
void onJoinClick(); |
|
1315 | 369 |
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
|
370 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
371 |
signals: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
372 |
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
|
373 |
void askForJoinRoom(const QString &); |
1315 | 374 |
void askForRoomList(); |
1311 | 375 |
}; |
376 |
||
184 | 377 |
#endif // PAGES_H |