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