author | unc0rr |
Thu, 14 Aug 2008 14:43:40 +0000 | |
changeset 1212 | 9890facbe047 |
parent 1199 | 543d1268847b |
child 1216 | df1b19976e28 |
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 |
#include <QGridLayout> |
|
20 |
#include <QPushButton> |
|
21 |
#include <QGroupBox> |
|
22 |
#include <QComboBox> |
|
311 | 23 |
#include <QCheckBox> |
184 | 24 |
#include <QLabel> |
25 |
#include <QToolBox> |
|
26 |
#include <QLineEdit> |
|
27 |
#include <QListWidget> |
|
28 |
#include <QApplication> |
|
231 | 29 |
#include <QSpinBox> |
452 | 30 |
#include <QTextEdit> |
636 | 31 |
#include <QRadioButton> |
665 | 32 |
#include <QTableView> |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
33 |
#include <QMessageBox> |
673 | 34 |
#include <QHeaderView> |
184 | 35 |
|
36 |
#include "pages.h" |
|
37 |
#include "sdlkeys.h" |
|
38 |
#include "hwconsts.h" |
|
39 |
#include "gamecfgwidget.h" |
|
40 |
#include "teamselect.h" |
|
41 |
#include "gamecfgwidget.h" |
|
42 |
#include "SquareLabel.h" |
|
43 |
#include "mapContainer.h" |
|
187 | 44 |
#include "about.h" |
297 | 45 |
#include "fpsedit.h" |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
46 |
#include "netserverslist.h" |
412 | 47 |
#include "netudpwidget.h" |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
48 |
#include "netwwwwidget.h" |
461 | 49 |
#include "chatwidget.h" |
555 | 50 |
#include "SDLs.h" |
579 | 51 |
#include "playrecordpage.h" |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
603
diff
changeset
|
52 |
#include "selectWeapon.h" |
1192 | 53 |
#include "igbox.h" |
184 | 54 |
|
684 | 55 |
PageMain::PageMain(QWidget* parent) : |
56 |
AbstractPage(parent) |
|
184 | 57 |
{ |
58 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1150 | 59 |
//pageLayout->setMargin(25); |
1148 | 60 |
//pageLayout->setColumnStretch(0, 1); |
61 |
//pageLayout->setColumnStretch(1, 2); |
|
62 |
//pageLayout->setColumnStretch(2, 1); |
|
184 | 63 |
|
1199 | 64 |
//QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
65 |
//pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); |
|
1148 | 66 |
pageLayout->setRowStretch(0, 1); |
1150 | 67 |
pageLayout->setRowStretch(1, 1); |
68 |
pageLayout->setRowStretch(2, 0); |
|
69 |
pageLayout->setRowStretch(3, 1); |
|
1199 | 70 |
pageLayout->setRowStretch(4, 1); |
184 | 71 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
72 |
BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
1150 | 73 |
pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
184 | 74 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
75 |
BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
1150 | 76 |
pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
579 | 77 |
|
1199 | 78 |
BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true); |
184 | 79 |
|
1199 | 80 |
//BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
81 |
BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
1212 | 82 |
BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
1150 | 83 |
pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
1199 | 84 |
//pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
184 | 85 |
|
1199 | 86 |
BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
184 | 87 |
} |
88 |
||
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
730
diff
changeset
|
89 |
PageEditTeam::PageEditTeam(QWidget* parent) : |
692 | 90 |
AbstractPage(parent) |
184 | 91 |
{ |
92 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
310 | 93 |
pageLayout->setColumnStretch(0, 1); |
184 | 94 |
pageLayout->setColumnMinimumWidth(0, 150); |
95 |
pageLayout->setColumnStretch(1, 100); |
|
336 | 96 |
pageLayout->setColumnMinimumWidth(1, 210); |
451 | 97 |
pageLayout->setColumnStretch(2, 75); |
336 | 98 |
pageLayout->setColumnMinimumWidth(2, 110); |
451 | 99 |
pageLayout->setColumnStretch(3, 75); |
336 | 100 |
pageLayout->setColumnMinimumWidth(3, 110); |
184 | 101 |
|
102 |
GBoxTeam = new QGroupBox(this); |
|
103 |
GBoxTeam->setTitle(QGroupBox::tr("Team")); |
|
104 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
105 |
QGridLayout * GBTLayout = new QGridLayout(GBoxTeam); |
|
106 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
|
107 |
TeamNameEdit->setMaxLength(15); |
|
231 | 108 |
GBTLayout->addWidget(TeamNameEdit, 0, 0, 1, 0); |
109 |
||
184 | 110 |
pageLayout->addWidget(GBoxTeam, 0, 0); |
111 |
||
588 | 112 |
GBoxHedgehogs = new QGroupBox(this); |
184 | 113 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
114 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
115 |
QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
|
116 |
for(int i = 0; i < 8; i++) |
|
117 |
{ |
|
118 |
HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
|
119 |
HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20)); |
|
120 |
HHNameEdit[i]->setMaxLength(15); |
|
121 |
GBHLayout->addWidget(HHNameEdit[i]); |
|
122 |
} |
|
123 |
pageLayout->addWidget(GBoxHedgehogs, 1, 0, 2, 1); |
|
124 |
||
1153 | 125 |
BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
184 | 126 |
|
588 | 127 |
GBoxBinds = new QGroupBox(this); |
184 | 128 |
GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
129 |
QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
|
130 |
BindsBox = new QToolBox(GBoxBinds); |
|
131 |
BindsBox->setLineWidth(0); |
|
132 |
GBBLayout->addWidget(BindsBox); |
|
133 |
page_A = new QWidget(); |
|
134 |
BindsBox->addItem(page_A, QToolBox::tr("Actions")); |
|
135 |
page_W = new QWidget(); |
|
136 |
BindsBox->addItem(page_W, QToolBox::tr("Weapons")); |
|
137 |
page_WP = new QWidget(); |
|
138 |
BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); |
|
139 |
page_O = new QWidget(); |
|
140 |
BindsBox->addItem(page_O, QToolBox::tr("Other")); |
|
141 |
pageLayout->addWidget(GBoxBinds, 0, 1, 5, 1); |
|
142 |
||
143 |
QStringList binds; |
|
144 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
145 |
{ |
|
146 |
binds << sdlkeys[i][1]; |
|
147 |
} |
|
148 |
||
149 |
quint16 widind = 0, i = 0; |
|
150 |
while (i < BINDS_NUMBER) { |
|
151 |
quint16 num = 0; |
|
152 |
QGridLayout * pagelayout = new QGridLayout(BindsBox->widget(widind)); |
|
153 |
do { |
|
154 |
LBind[i] = new QLabel(BindsBox->widget(widind)); |
|
155 |
LBind[i]->setText(QApplication::translate("binds", cbinds[i].name)); |
|
156 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
157 |
pagelayout->addWidget(LBind[i], num, 0); |
|
158 |
CBBind[i] = new QComboBox(BindsBox->widget(widind)); |
|
159 |
CBBind[i]->addItems(binds); |
|
160 |
pagelayout->addWidget(CBBind[i], num, 1); |
|
161 |
num++; |
|
162 |
} while (!cbinds[i++].chwidget); |
|
163 |
pagelayout->addWidget(new QWidget(BindsBox->widget(widind)), num, 0, 1, 2); |
|
164 |
widind++; |
|
165 |
} |
|
166 |
||
588 | 167 |
GBoxGrave = new QGroupBox(this); |
184 | 168 |
GBoxGrave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
169 |
GBoxGrave->setTitle(QGroupBox::tr("Grave")); |
|
170 |
QGridLayout * GBGLayout = new QGridLayout(GBoxGrave); |
|
171 |
CBGrave = new QComboBox(GBoxGrave); |
|
172 |
CBGrave->setMaxCount(65535); |
|
173 |
GBGLayout->addWidget(CBGrave, 0, 0, 1, 3); |
|
174 |
GravePreview = new QLabel(GBoxGrave); |
|
175 |
GravePreview->setScaledContents(false); |
|
336 | 176 |
pageLayout->addWidget(GBoxGrave, 0, 3, 2, 1); |
184 | 177 |
GBGLayout->addWidget(GravePreview, 1, 1); |
336 | 178 |
|
179 |
GBoxTeamLvl = new QGroupBox(this); |
|
180 |
GBoxTeamLvl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
181 |
GBoxTeamLvl->setTitle(QGroupBox::tr("Team level")); |
|
182 |
QGridLayout * GBTLLayout = new QGridLayout(GBoxTeamLvl); |
|
183 |
CBTeamLvl = new QComboBox(GBoxTeamLvl); |
|
184 |
CBTeamLvl->addItem(QComboBox::tr("Human")); |
|
427 | 185 |
CBTeamLvl->addItem(QComboBox::tr("Level 5")); |
186 |
CBTeamLvl->addItem(QComboBox::tr("Level 4")); |
|
336 | 187 |
CBTeamLvl->addItem(QComboBox::tr("Level 3")); |
427 | 188 |
CBTeamLvl->addItem(QComboBox::tr("Level 2")); |
189 |
CBTeamLvl->addItem(QComboBox::tr("Level 1")); |
|
336 | 190 |
CBTeamLvl->setMaxCount(6); |
191 |
GBTLLayout->addWidget(CBTeamLvl, 0, 0, 1, 3); |
|
192 |
LevelPict = new QLabel(GBoxTeamLvl); |
|
193 |
LevelPict->setScaledContents(false); |
|
194 |
LevelPict->setFixedSize(32, 32); |
|
195 |
pageLayout->addWidget(GBoxTeamLvl, 0, 2, 2, 1); |
|
196 |
GBTLLayout->addWidget(LevelPict, 1, 1); |
|
184 | 197 |
|
198 |
GBoxFort = new QGroupBox(this); |
|
199 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
|
200 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
|
201 |
CBFort = new QComboBox(GBoxFort); |
|
202 |
CBFort->setMaxCount(65535); |
|
203 |
GBFLayout->addWidget(CBFort, 0, 0); |
|
588 | 204 |
FortPreview = new SquareLabel(GBoxFort); |
310 | 205 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
184 | 206 |
FortPreview->setPixmap(QPixmap()); |
207 |
GBFLayout->addWidget(FortPreview, 1, 0); |
|
336 | 208 |
pageLayout->addWidget(GBoxFort, 2, 2, 1, 2); |
184 | 209 |
|
1168 | 210 |
BtnTeamSave = addButton(":/res/Save.png", pageLayout, 4, 3, true);; |
184 | 211 |
|
212 |
QDir tmpdir; |
|
213 |
tmpdir.cd(datadir->absolutePath()); |
|
214 |
tmpdir.cd("Forts"); |
|
215 |
tmpdir.setFilter(QDir::Files); |
|
216 |
||
603 | 217 |
CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
184 | 218 |
tmpdir.cd("../Graphics/Graves"); |
219 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
220 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
221 |
{ |
|
603 | 222 |
CBGrave->addItem((*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
184 | 223 |
} |
224 |
||
225 |
connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &))); |
|
336 | 226 |
connect(CBTeamLvl, SIGNAL(activated(int)), this, SLOT(CBTeamLvl_activated(int))); |
184 | 227 |
connect(CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
228 |
} |
|
229 |
||
230 |
void PageEditTeam::CBGrave_activated(const QString & gravename) |
|
231 |
{ |
|
232 |
QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + gravename + ".png"); |
|
233 |
GravePreview->setPixmap(pix.copy(0, 0, 32, 32)); |
|
234 |
} |
|
235 |
||
236 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
|
237 |
{ |
|
238 |
QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
|
239 |
FortPreview->setPixmap(pix); |
|
240 |
} |
|
241 |
||
336 | 242 |
void PageEditTeam::CBTeamLvl_activated(int id) |
243 |
{ |
|
244 |
QPixmap pix(QString(":/res/botlevels/%1.png").arg(id)); |
|
245 |
LevelPict->setPixmap(pix); |
|
246 |
} |
|
247 |
||
692 | 248 |
PageMultiplayer::PageMultiplayer(QWidget* parent) : |
249 |
AbstractPage(parent) |
|
184 | 250 |
{ |
251 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
252 |
||
1153 | 253 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 254 |
|
184 | 255 |
gameCFG = new GameCFGWidget(this); |
256 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
696 | 257 |
|
184 | 258 |
teamsSelect = new TeamSelWidget(this); |
259 |
pageLayout->addWidget(teamsSelect, 0, 2, 1, 2); |
|
260 |
||
730 | 261 |
BtnStartMPGame = addButton(tr("Start"), pageLayout, 1, 3); |
184 | 262 |
} |
263 |
||
692 | 264 |
PageOptions::PageOptions(QWidget* parent) : |
265 |
AbstractPage(parent) |
|
184 | 266 |
{ |
267 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
427 | 268 |
pageLayout->setColumnStretch(0, 100); |
269 |
pageLayout->setColumnStretch(1, 100); |
|
270 |
pageLayout->setColumnStretch(2, 100); |
|
271 |
pageLayout->setRowStretch(0, 0); |
|
272 |
pageLayout->setRowStretch(1, 0); |
|
719 | 273 |
pageLayout->setRowStretch(2, 0); |
274 |
pageLayout->setRowStretch(3, 100); |
|
275 |
pageLayout->setRowStretch(4, 0); |
|
427 | 276 |
|
1198 | 277 |
|
278 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
279 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
280 |
QHBoxLayout * gbTBLayout = new QHBoxLayout(gbTwoBoxes); |
|
281 |
{ |
|
282 |
teamsBox = new IconedGroupBox(this); |
|
283 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
|
284 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
285 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
286 |
||
287 |
QGridLayout * GBTlayout = new QGridLayout(teamsBox); |
|
288 |
||
289 |
BtnNewTeam = addButton(tr("New team"), GBTlayout, 1, 0); |
|
290 |
||
291 |
CBTeamName = new QComboBox(teamsBox); |
|
292 |
GBTlayout->addWidget(CBTeamName, 0, 0, 1, 2); |
|
184 | 293 |
|
1198 | 294 |
BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 1, 1); |
1199 | 295 |
|
296 |
labelNN = new QLabel(teamsBox); |
|
297 |
labelNN->setText(QLabel::tr("Net nick")); |
|
298 |
GBTlayout->addWidget(labelNN, 2, 0, 1, 2); |
|
299 |
||
300 |
editNetNick = new QLineEdit(teamsBox); |
|
301 |
editNetNick->setMaxLength(20); |
|
302 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
303 |
GBTlayout->addWidget(editNetNick, 3, 0, 1, 2); |
|
304 |
||
1198 | 305 |
gbTBLayout->addWidget(teamsBox); |
306 |
} |
|
184 | 307 |
|
1198 | 308 |
{ |
309 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1199 | 310 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 311 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 312 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 313 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
314 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 315 |
|
1198 | 316 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
317 |
WeaponsName = new QComboBox(this); |
|
318 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
319 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
320 |
gbTBLayout->addWidget(groupWeapons); |
|
321 |
} |
|
184 | 322 |
|
1193 | 323 |
AGGroupBox = new IconedGroupBox(this); |
324 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
184 | 325 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
326 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
693 | 327 |
pageLayout->addWidget(AGGroupBox, 2, 1); |
184 | 328 |
|
427 | 329 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
436 | 330 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
427 | 331 |
QLabel * resolution = new QLabel(AGGroupBox); |
332 |
resolution->setText(QLabel::tr("Resolution")); |
|
333 |
GBAreslayout->addWidget(resolution); |
|
334 |
||
184 | 335 |
CBResolution = new QComboBox(AGGroupBox); |
555 | 336 |
SDLInteraction sdli; |
337 |
CBResolution->addItems(sdli.getResolutions()); |
|
427 | 338 |
GBAreslayout->addWidget(CBResolution); |
339 |
GBAlayout->addLayout(GBAreslayout); |
|
340 |
||
436 | 341 |
QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); |
427 | 342 |
QLabel * maxfps = new QLabel(AGGroupBox); |
343 |
maxfps->setText(QLabel::tr("FPS limit")); |
|
344 |
GBAfpslayout->addWidget(maxfps); |
|
345 |
GBAlayout->addLayout(GBAfpslayout); |
|
184 | 346 |
|
347 |
CBFullscreen = new QCheckBox(AGGroupBox); |
|
348 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
427 | 349 |
GBAlayout->addWidget(CBFullscreen); |
184 | 350 |
|
1162 | 351 |
CBFrontendFullscreen = new QCheckBox(AGGroupBox); |
352 |
CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); |
|
353 |
GBAlayout->addWidget(CBFrontendFullscreen); |
|
354 |
||
1157 | 355 |
CBEnableSound = new QCheckBox(AGGroupBox); |
184 | 356 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
427 | 357 |
GBAlayout->addWidget(CBEnableSound); |
184 | 358 |
|
1157 | 359 |
CBEnableMusic = new QCheckBox(AGGroupBox); |
1129 | 360 |
CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
361 |
GBAlayout->addWidget(CBEnableMusic); |
|
362 |
||
297 | 363 |
CBShowFPS = new QCheckBox(AGGroupBox); |
364 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
427 | 365 |
GBAlayout->addWidget(CBShowFPS); |
297 | 366 |
|
529 | 367 |
CBAltDamage = new QCheckBox(AGGroupBox); |
368 |
CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); |
|
369 |
GBAlayout->addWidget(CBAltDamage); |
|
370 |
||
297 | 371 |
fpsedit = new FPSEdit(AGGroupBox); |
427 | 372 |
GBAfpslayout->addWidget(fpsedit); |
184 | 373 |
|
1157 | 374 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 4, 2, true); |
184 | 375 |
|
1153 | 376 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
184 | 377 |
} |
378 |
||
1153 | 379 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 380 |
{ |
381 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
382 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
383 |
pageLayout->setColumnStretch(0, 1); |
|
384 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 385 |
pageLayout->setColumnStretch(2, 1); |
421 | 386 |
|
387 |
BtnNetSvrStart = new QPushButton(this); |
|
388 |
BtnNetSvrStart->setFont(*font14); |
|
389 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
617 | 390 |
pageLayout->addWidget(BtnNetSvrStart, 3, 2); |
184 | 391 |
|
636 | 392 |
QGroupBox * NetTypeGroupBox = new QGroupBox(this); |
393 |
NetTypeGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); |
|
668 | 394 |
NetTypeGroupBox->setTitle(QGroupBox::tr("Servers list")); |
636 | 395 |
pageLayout->addWidget(NetTypeGroupBox, 0, 1); |
396 |
||
397 |
QVBoxLayout * GBTlayout = new QVBoxLayout(NetTypeGroupBox); |
|
398 |
rbLocalGame = new QRadioButton(NetTypeGroupBox); |
|
668 | 399 |
rbLocalGame->setText(tr("Local")); |
636 | 400 |
rbLocalGame->setChecked(true); |
401 |
GBTlayout->addWidget(rbLocalGame); |
|
402 |
rbInternetGame = new QRadioButton(NetTypeGroupBox); |
|
668 | 403 |
rbInternetGame->setText(tr("Internet")); |
636 | 404 |
GBTlayout->addWidget(rbInternetGame); |
405 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
406 |
ConnGroupBox = new QGroupBox(this); |
421 | 407 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
408 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
409 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 410 |
GBClayout->setColumnStretch(0, 1); |
421 | 411 |
GBClayout->setColumnStretch(1, 1); |
412 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 413 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
414 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 415 |
BtnNetConnect->setFont(*font14); |
416 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 417 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 418 |
|
665 | 419 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
420 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 421 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 422 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
423 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
424 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
425 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 426 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 427 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
428 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
429 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
430 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
431 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
432 |
|
1153 | 433 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); |
636 | 434 |
|
646 | 435 |
connect(rbLocalGame, SIGNAL(toggled(bool)), this, SLOT(updateServersList())); |
668 | 436 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 437 |
} |
438 |
||
646 | 439 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
440 |
{ |
636 | 441 |
if (rbLocalGame->isChecked()) |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
442 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
667 | 443 |
else |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
444 |
tvServersList->setModel(new HWNetWwwModel(tvServersList)); |
659 | 445 |
|
673 | 446 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
447 |
||
665 | 448 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
449 |
|
665 | 450 |
connect(BtnUpdateSList, SIGNAL(clicked()), static_cast<HWNetServersModel *>(tvServersList->model()), SLOT(updateList())); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
451 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 452 |
} |
453 |
||
454 |
void PageNet::slotConnect() |
|
455 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
456 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
457 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
458 |
if(!mi.isValid()) |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
459 |
{ |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
460 |
QMessageBox::information(this, tr("Error"), tr("Please, select server from the list above")); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
461 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
462 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
463 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
464 |
quint16 port = model->index(mi.row(), 2).data().toUInt(); |
672
08ed55ea1e2a
- Fix a bug when server fails to start, and then connecting to another server on the same host (strange, the fix won't work on my machine)
unc0rr
parents:
671
diff
changeset
|
465 |
|
08ed55ea1e2a
- Fix a bug when server fails to start, and then connecting to another server on the same host (strange, the fix won't work on my machine)
unc0rr
parents:
671
diff
changeset
|
466 |
emit connectClicked(host, port); |
646 | 467 |
} |
468 |
||
1153 | 469 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 470 |
{ |
471 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
472 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
473 |
pageLayout->setColumnStretch(0, 1); |
|
474 |
pageLayout->setColumnStretch(1, 1); |
|
475 |
pageLayout->setColumnStretch(2, 1); |
|
476 |
||
675 | 477 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
478 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
479 |
|
1153 | 480 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 481 |
|
482 |
BtnStart = new QPushButton(this); |
|
483 |
BtnStart->setFont(*font14); |
|
484 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 485 |
pageLayout->addWidget(BtnStart, 1, 2); |
486 |
||
487 |
QWidget * wg = new QWidget(this); |
|
488 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
489 |
|
675 | 490 |
QGridLayout * wgLayout = new QGridLayout(wg); |
491 |
wgLayout->setColumnStretch(0, 1); |
|
492 |
wgLayout->setColumnStretch(1, 3); |
|
493 |
wgLayout->setColumnStretch(2, 1); |
|
494 |
||
495 |
wgLayout->setRowStretch(0, 0); |
|
496 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
497 |
|
675 | 498 |
QGroupBox * gb = new QGroupBox(wg); |
499 |
wgLayout->addWidget(gb, 0, 1); |
|
500 |
||
501 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
502 |
||
503 |
labelSD = new QLabel(gb); |
|
504 |
labelSD->setText(QLabel::tr("Server name:")); |
|
505 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
506 |
|
675 | 507 |
leServerDescr = new QLineEdit(gb); |
508 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
509 |
||
510 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
511 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 512 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
513 |
|
675 | 514 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
515 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
516 |
sbPort->setMaximum(65535); |
675 | 517 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
518 |
|
675 | 519 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
520 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 521 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
522 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
523 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
524 |
} |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
525 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
526 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
527 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
528 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
529 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
530 |
|
1153 | 531 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 532 |
{ |
533 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
534 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 535 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 536 |
//pageLayout->setSpacing(1); |
537 |
//pageLayout->setMargin(1); |
|
463 | 538 |
pageLayout->setColumnStretch(0, 50); |
539 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 540 |
|
461 | 541 |
// chatwidget |
542 |
pChatWidget = new HWChatWidget(this); |
|
543 |
pageLayout->addWidget(pChatWidget, 1, 0); |
|
464 | 544 |
pageLayout->setRowStretch(1, 100); |
453 | 545 |
|
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
546 |
pGameCFG = new GameCFGWidget(this); |
322 | 547 |
pageLayout->addWidget(pGameCFG, 0, 0); |
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
548 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
549 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 550 |
pNetTeamsWidget->setAcceptOuter(true); |
461 | 551 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); |
184 | 552 |
|
1153 | 553 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
184 | 554 |
|
646 | 555 |
BtnGo = new QPushButton(this); |
184 | 556 |
BtnGo->setFont(*font14); |
557 |
BtnGo->setText(QPushButton::tr("Go!")); |
|
492 | 558 |
BtnGo->setEnabled(false); |
461 | 559 |
pageLayout->addWidget(BtnGo, 2, 1); |
184 | 560 |
} |
187 | 561 |
|
1153 | 562 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 563 |
{ |
564 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
565 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
566 |
pageLayout->setColumnStretch(0, 1); |
|
567 |
pageLayout->setColumnStretch(1, 1); |
|
568 |
pageLayout->setColumnStretch(2, 1); |
|
569 |
||
1153 | 570 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 571 |
|
572 |
about = new About(this); |
|
573 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
574 |
} |
|
306 | 575 |
|
1153 | 576 |
PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) |
306 | 577 |
{ |
578 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
579 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
580 |
pageLayout->setColumnStretch(0, 1); |
|
581 |
pageLayout->setColumnStretch(1, 1); |
|
582 |
pageLayout->setColumnStretch(2, 1); |
|
583 |
||
1153 | 584 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
306 | 585 |
|
307 | 586 |
labelGameStats = new QLabel(this); |
587 |
labelGameStats->setTextFormat(Qt::RichText); |
|
588 |
pageLayout->addWidget(labelGameStats, 0, 0, 1, 3); |
|
306 | 589 |
} |
586 | 590 |
|
1150 | 591 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 592 |
{ |
593 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
594 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
595 |
pageLayout->setMargin(25); |
|
596 |
pageLayout->setColumnStretch(0, 1); |
|
597 |
pageLayout->setColumnStretch(1, 2); |
|
598 |
pageLayout->setColumnStretch(2, 1); |
|
588 | 599 |
pageLayout->setRowStretch(0, 1); |
1150 | 600 |
pageLayout->setRowStretch(6, 1); |
586 | 601 |
|
1150 | 602 |
BtnSimpleGamePage = addButton(tr("Simple Game"), pageLayout, 1, 1); |
603 |
BtnTrainPage = addButton(tr("Training"), pageLayout, 2, 1); |
|
604 |
BtnMultiplayer = addButton(tr("Multiplayer"), pageLayout, 3, 1); |
|
605 |
BtnLoad = addButton(tr("Saved games"), pageLayout, 4, 1); |
|
606 |
BtnDemos = addButton(tr("Demos"), pageLayout, 5, 1); |
|
586 | 607 |
|
1153 | 608 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 7, 0, true); |
586 | 609 |
} |
610 |
||
1153 | 611 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 612 |
{ |
613 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
614 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
615 |
pageLayout->setMargin(25); |
|
616 |
pageLayout->setColumnStretch(0, 1); |
|
617 |
pageLayout->setColumnStretch(1, 2); |
|
618 |
pageLayout->setColumnStretch(2, 1); |
|
619 |
||
620 |
BtnStartTrain = new QPushButton(this); |
|
621 |
BtnStartTrain->setFont(*font14); |
|
622 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
623 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
624 |
||
1153 | 625 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 626 |
} |
627 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
628 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 629 |
AbstractPage(parent) |
600 | 630 |
{ |
631 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
632 |
pageLayout->setMargin(25); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
633 |
|
1168 | 634 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size() - 10, this); |
718 | 635 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 636 |
|
1168 | 637 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 638 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
639 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 640 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
600 | 641 |
} |
642 |
||
686 | 643 |
PageInGame::PageInGame(QWidget* parent) : |
644 |
AbstractPage(parent) |
|
645 |
{ |
|
646 |
QLabel * label = new QLabel(this); |
|
647 |
label->setText("In game..."); |
|
648 |
} |