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