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