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