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