author | unc0rr |
Thu, 12 Mar 2009 13:54:32 +0000 | |
changeset 1885 | 75489216b5b0 |
parent 1884 | 40e59e9f82ce |
child 1887 | d68939b3f7f0 |
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> |
|
1840 | 26 |
#include <QSignalMapper> |
184 | 27 |
|
28 |
#include "binds.h" |
|
322 | 29 |
#include "mapContainer.h" |
184 | 30 |
|
31 |
class QPushButton; |
|
32 |
class QGroupBox; |
|
33 |
class QComboBox; |
|
34 |
class QLabel; |
|
35 |
class QToolBox; |
|
36 |
class QLineEdit; |
|
665 | 37 |
class QListWidget; |
38 |
class QCheckBox; |
|
39 |
class QSpinBox; |
|
40 |
class QTextEdit; |
|
41 |
class QRadioButton; |
|
42 |
class QTableView; |
|
1377 | 43 |
class QTextBrowser; |
1399 | 44 |
class QTableWidget; |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
45 |
class QAction; |
1885 | 46 |
class QDataWidgetMapper; |
665 | 47 |
|
48 |
class GameCFGWidget; |
|
184 | 49 |
class TeamSelWidget; |
50 |
class DemosList; |
|
51 |
class SquareLabel; |
|
187 | 52 |
class About; |
297 | 53 |
class FPSEdit; |
461 | 54 |
class HWChatWidget; |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
600
diff
changeset
|
55 |
class SelWeaponWidget; |
1192 | 56 |
class IconedGroupBox; |
1885 | 57 |
class FreqSpinBox; |
184 | 58 |
|
684 | 59 |
class AbstractPage : public QWidget |
60 |
{ |
|
1885 | 61 |
Q_OBJECT |
62 |
||
684 | 63 |
public: |
64 |
||
65 |
protected: |
|
66 |
AbstractPage(QWidget* parent = 0) { |
|
67 |
font14 = new QFont("MS Shell Dlg", 14); |
|
68 |
} |
|
69 |
virtual ~AbstractPage() {}; |
|
70 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
71 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) { |
684 | 72 |
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
|
73 |
if (!iconed) { |
1148 | 74 |
butt->setFont(*font14); |
75 |
butt->setText(btname); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
76 |
//butt->setStyleSheet("background-color: #0d0544"); |
1148 | 77 |
} else { |
78 |
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
|
79 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 80 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
81 |
butt->setFixedSize(sz); |
1148 | 82 |
butt->setIconSize(sz); |
83 |
butt->setFlat(true); |
|
1149 | 84 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 85 |
} |
684 | 86 |
grid->addWidget(butt, wy, wx); |
87 |
return butt; |
|
88 |
}; |
|
89 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
90 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { |
692 | 91 |
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
|
92 |
if (!iconed) { |
1148 | 93 |
butt->setFont(*font14); |
94 |
butt->setText(btname); |
|
95 |
} else { |
|
96 |
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
|
97 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 98 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
99 |
butt->setFixedSize(sz); |
1148 | 100 |
butt->setIconSize(sz); |
101 |
butt->setFlat(true); |
|
1149 | 102 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 103 |
} |
692 | 104 |
grid->addWidget(butt, wy, wx, rowSpan, columnSpan); |
105 |
return butt; |
|
106 |
}; |
|
107 |
||
1443 | 108 |
QPushButton* addButton(QString btname, QBoxLayout* box, int where, bool iconed = false) { |
684 | 109 |
QPushButton* butt = new QPushButton(this); |
1443 | 110 |
if (!iconed) { |
111 |
butt->setFont(*font14); |
|
112 |
butt->setText(btname); |
|
113 |
} else { |
|
114 |
const QIcon& lp=QIcon(btname); |
|
115 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
116 |
butt->setIcon(lp); |
|
117 |
butt->setFixedSize(sz); |
|
118 |
butt->setIconSize(sz); |
|
119 |
butt->setFlat(true); |
|
120 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
121 |
} |
|
684 | 122 |
box->addWidget(butt, where); |
123 |
return butt; |
|
124 |
}; |
|
125 |
||
126 |
QFont * font14; |
|
127 |
}; |
|
128 |
||
129 |
class PageMain : public AbstractPage |
|
184 | 130 |
{ |
131 |
Q_OBJECT |
|
132 |
||
133 |
public: |
|
134 |
PageMain(QWidget* parent = 0); |
|
135 |
||
136 |
QPushButton *BtnSinglePlayer; |
|
137 |
QPushButton *BtnNet; |
|
138 |
QPushButton *BtnSetup; |
|
187 | 139 |
QPushButton *BtnInfo; |
184 | 140 |
QPushButton *BtnExit; |
141 |
}; |
|
142 |
||
692 | 143 |
class PageEditTeam : public AbstractPage |
184 | 144 |
{ |
145 |
Q_OBJECT |
|
146 |
||
147 |
public: |
|
148 |
PageEditTeam(QWidget* parent = 0); |
|
1840 | 149 |
QSignalMapper* signalMapper; |
184 | 150 |
QGroupBox *GBoxHedgehogs; |
151 |
QGroupBox *GBoxTeam; |
|
152 |
QGroupBox *GBoxFort; |
|
153 |
QComboBox *CBFort; |
|
154 |
SquareLabel *FortPreview; |
|
155 |
QComboBox *CBGrave; |
|
336 | 156 |
QComboBox *CBTeamLvl; |
1659 | 157 |
QComboBox *CBVoicepack; |
184 | 158 |
QGroupBox *GBoxBinds; |
159 |
QToolBox *BindsBox; |
|
160 |
QWidget *page_A; |
|
161 |
QWidget *page_W; |
|
162 |
QWidget *page_WP; |
|
163 |
QWidget *page_O; |
|
164 |
QPushButton *BtnTeamDiscard; |
|
165 |
QPushButton *BtnTeamSave; |
|
1684 | 166 |
QPushButton * BtnTestSound; |
184 | 167 |
QLineEdit * TeamNameEdit; |
168 |
QLineEdit * HHNameEdit[8]; |
|
1236 | 169 |
QComboBox * HHHats[8]; |
1840 | 170 |
QPushButton * randButton[8]; |
184 | 171 |
QComboBox * CBBind[BINDS_NUMBER]; |
1840 | 172 |
QPushButton * randTeamButton; |
184 | 173 |
|
174 |
public slots: |
|
175 |
void CBFort_activated(const QString & gravename); |
|
176 |
||
177 |
private: |
|
178 |
QLabel * LBind[BINDS_NUMBER]; |
|
1684 | 179 |
|
180 |
private slots: |
|
181 |
void testSound(); |
|
184 | 182 |
}; |
183 |
||
692 | 184 |
class PageMultiplayer : public AbstractPage |
184 | 185 |
{ |
186 |
Q_OBJECT |
|
187 |
||
188 |
public: |
|
189 |
PageMultiplayer(QWidget* parent = 0); |
|
190 |
||
191 |
QPushButton *BtnBack; |
|
192 |
GameCFGWidget *gameCFG; |
|
193 |
TeamSelWidget *teamsSelect; |
|
194 |
QPushButton *BtnStartMPGame; |
|
195 |
}; |
|
196 |
||
692 | 197 |
class PageOptions : public AbstractPage |
184 | 198 |
{ |
199 |
Q_OBJECT |
|
200 |
||
201 |
public: |
|
202 |
PageOptions(QWidget* parent = 0); |
|
203 |
||
597
ec5f057ab268
kdevelop project add, initial weapons scheme button
displacer
parents:
587
diff
changeset
|
204 |
QPushButton* WeaponsButt; |
693 | 205 |
QPushButton* WeaponEdit; |
206 |
QComboBox* WeaponsName; |
|
207 |
||
184 | 208 |
QPushButton *BtnBack; |
1194 | 209 |
IconedGroupBox *teamsBox; |
184 | 210 |
QPushButton *BtnNewTeam; |
211 |
QPushButton *BtnEditTeam; |
|
212 |
QComboBox *CBTeamName; |
|
1193 | 213 |
IconedGroupBox *AGGroupBox; |
184 | 214 |
QComboBox *CBResolution; |
215 |
QCheckBox *CBEnableSound; |
|
1129 | 216 |
QCheckBox *CBEnableMusic; |
184 | 217 |
QCheckBox *CBFullscreen; |
1162 | 218 |
QCheckBox *CBFrontendFullscreen; |
297 | 219 |
QCheckBox *CBShowFPS; |
529 | 220 |
QCheckBox *CBAltDamage; |
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1443
diff
changeset
|
221 |
QCheckBox *CBNameWithDate; |
297 | 222 |
FPSEdit *fpsedit; |
184 | 223 |
QPushButton *BtnSaveOptions; |
647 | 224 |
QLabel *labelNN; |
1777 | 225 |
QSpinBox * volumeBox; |
647 | 226 |
QLineEdit *editNetNick; |
1812 | 227 |
QCheckBox *CBReduceQuality; |
184 | 228 |
}; |
229 |
||
1153 | 230 |
class PageNet : public AbstractPage |
184 | 231 |
{ |
232 |
Q_OBJECT |
|
233 |
||
234 |
public: |
|
235 |
PageNet(QWidget* parent = 0); |
|
236 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
237 |
QPushButton* BtnUpdateSList; |
665 | 238 |
QTableView * tvServersList; |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
239 |
QPushButton * BtnBack; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
240 |
QPushButton * BtnNetConnect; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
241 |
QPushButton * BtnNetSvrStart; |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
242 |
QPushButton * BtnSpecifyServer; |
1395 | 243 |
QPushButton * BtnOfficialServer; |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
244 |
|
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
245 |
private: |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
246 |
QGroupBox * ConnGroupBox; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
247 |
QGridLayout * GBClayout; |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
248 |
|
646 | 249 |
private slots: |
250 |
void slotConnect(); |
|
251 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
612
diff
changeset
|
252 |
public slots: |
646 | 253 |
void updateServersList(); |
254 |
||
255 |
signals: |
|
665 | 256 |
void connectClicked(const QString & host, quint16 port); |
646 | 257 |
}; |
258 |
||
1153 | 259 |
class PageNetServer : public AbstractPage |
646 | 260 |
{ |
261 |
Q_OBJECT |
|
262 |
||
263 |
public: |
|
264 |
PageNetServer(QWidget* parent = 0); |
|
265 |
||
266 |
QPushButton *BtnBack; |
|
267 |
QPushButton *BtnStart; |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
268 |
QPushButton *BtnDefault; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
269 |
QLabel *labelSD; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
270 |
QLineEdit *leServerDescr; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
271 |
QLabel *labelPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
272 |
QSpinBox *sbPort; |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
273 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
274 |
private slots: |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
275 |
void setDefaultPort(); |
184 | 276 |
}; |
277 |
||
1153 | 278 |
class PageNetGame : public AbstractPage |
184 | 279 |
{ |
280 |
Q_OBJECT |
|
281 |
||
282 |
public: |
|
283 |
PageNetGame(QWidget* parent = 0); |
|
284 |
||
285 |
QPushButton *BtnBack; |
|
286 |
QPushButton *BtnGo; |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
287 |
QPushButton *BtnMaster; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
288 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
289 |
QAction * startGame; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
290 |
QAction * restrictJoins; |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
291 |
QAction * restrictTeamAdds; |
461 | 292 |
|
293 |
HWChatWidget* pChatWidget; |
|
322 | 294 |
|
295 |
TeamSelWidget* pNetTeamsWidget; |
|
296 |
GameCFGWidget* pGameCFG; |
|
1648 | 297 |
|
298 |
public slots: |
|
299 |
void setReadyStatus(bool isReady); |
|
1649 | 300 |
void setMasterMode(bool isMaster); |
184 | 301 |
}; |
302 |
||
1153 | 303 |
class PageInfo : public AbstractPage |
187 | 304 |
{ |
305 |
Q_OBJECT |
|
306 |
||
307 |
public: |
|
308 |
PageInfo(QWidget* parent = 0); |
|
309 |
||
310 |
QPushButton *BtnBack; |
|
311 |
About *about; |
|
312 |
}; |
|
313 |
||
1150 | 314 |
class PageSinglePlayer : public AbstractPage |
586 | 315 |
{ |
316 |
Q_OBJECT |
|
317 |
||
318 |
public: |
|
319 |
PageSinglePlayer(QWidget* parent = 0); |
|
320 |
||
321 |
QPushButton *BtnSimpleGamePage; |
|
322 |
QPushButton *BtnTrainPage; |
|
1150 | 323 |
QPushButton *BtnMultiplayer; |
324 |
QPushButton *BtnLoad; |
|
325 |
QPushButton *BtnDemos; |
|
586 | 326 |
QPushButton *BtnBack; |
327 |
GameCFGWidget *gameCFG; |
|
328 |
}; |
|
329 |
||
1153 | 330 |
class PageTraining : public AbstractPage |
587 | 331 |
{ |
332 |
Q_OBJECT |
|
333 |
||
334 |
public: |
|
335 |
PageTraining(QWidget* parent = 0); |
|
336 |
||
337 |
QPushButton *BtnStartTrain; |
|
338 |
QPushButton *BtnBack; |
|
339 |
}; |
|
340 |
||
684 | 341 |
class PageSelectWeapon : public AbstractPage |
600 | 342 |
{ |
343 |
Q_OBJECT |
|
344 |
||
345 |
public: |
|
346 |
PageSelectWeapon(QWidget* parent = 0); |
|
347 |
||
683 | 348 |
QPushButton *BtnSave; |
349 |
QPushButton *BtnDefault; |
|
718 | 350 |
QPushButton *BtnDelete; |
600 | 351 |
QPushButton *BtnBack; |
1312 | 352 |
SelWeaponWidget* pWeapons; |
600 | 353 |
}; |
306 | 354 |
|
686 | 355 |
class PageInGame : public AbstractPage |
356 |
{ |
|
357 |
Q_OBJECT |
|
358 |
||
359 |
public: |
|
360 |
PageInGame(QWidget* parent = 0); |
|
361 |
}; |
|
362 |
||
1311 | 363 |
class PageRoomsList : public AbstractPage |
364 |
{ |
|
365 |
Q_OBJECT |
|
366 |
||
367 |
public: |
|
368 |
PageRoomsList(QWidget* parent = 0); |
|
1312 | 369 |
|
1314 | 370 |
QLineEdit * roomName; |
1399 | 371 |
QTableWidget * roomsList; |
1312 | 372 |
QPushButton * BtnBack; |
373 |
QPushButton * BtnCreate; |
|
374 |
QPushButton * BtnJoin; |
|
375 |
QPushButton * BtnRefresh; |
|
1856
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
376 |
QPushButton * BtnAdmin; |
1522 | 377 |
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
|
378 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
379 |
public slots: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
380 |
void setRoomsList(const QStringList & list); |
1856
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
381 |
void setAdmin(bool); |
1314 | 382 |
|
383 |
private slots: |
|
384 |
void onCreateClick(); |
|
385 |
void onJoinClick(); |
|
1315 | 386 |
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
|
387 |
|
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
388 |
signals: |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
389 |
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
|
390 |
void askForJoinRoom(const QString &); |
1315 | 391 |
void askForRoomList(); |
1311 | 392 |
}; |
393 |
||
1800 | 394 |
class PageConnecting : public AbstractPage |
395 |
{ |
|
396 |
Q_OBJECT |
|
397 |
||
398 |
public: |
|
399 |
PageConnecting(QWidget* parent = 0); |
|
400 |
}; |
|
401 |
||
1884 | 402 |
class PageScheme : public AbstractPage |
403 |
{ |
|
404 |
Q_OBJECT |
|
405 |
||
406 |
public: |
|
407 |
PageScheme(QWidget* parent = 0); |
|
1885 | 408 |
|
409 |
QDataWidgetMapper * mapper; |
|
410 |
||
411 |
private: |
|
412 |
QCheckBox * CB_mode_Forts; |
|
413 |
QCheckBox * CB_teamsDivide; |
|
414 |
QCheckBox * CB_solid; |
|
415 |
QCheckBox * CB_border; |
|
416 |
QSpinBox * SB_TurnTime; |
|
417 |
QSpinBox * SB_InitHealth; |
|
418 |
QSpinBox * SB_SuddenDeath; |
|
419 |
FreqSpinBox * SB_CaseProb; |
|
420 |
QLineEdit * LE_name; |
|
1884 | 421 |
}; |
422 |
||
184 | 423 |
#endif // PAGES_H |