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