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