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