author | unc0rr |
Sat, 16 Aug 2008 14:28:44 +0000 | |
changeset 1223 | 41d7283934c1 |
parent 1218 | ada50f82ea53 |
child 1225 | f882a92ef872 |
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); |
|
1216
df1b19976e28
Allow team and hh name length be up to 64 letters length
unc0rr
parents:
1212
diff
changeset
|
107 |
TeamNameEdit->setMaxLength(64); |
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)); |
|
1216
df1b19976e28
Allow team and hh name length be up to 64 letters length
unc0rr
parents:
1212
diff
changeset
|
120 |
HHNameEdit[i]->setMaxLength(64); |
184 | 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 |
||
1218 | 253 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
187 | 254 |
|
184 | 255 |
gameCFG = new GameCFGWidget(this); |
256 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
696 | 257 |
|
1218 | 258 |
pageLayout->setRowStretch(1, 1); |
259 |
||
184 | 260 |
teamsSelect = new TeamSelWidget(this); |
1218 | 261 |
pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
184 | 262 |
|
1218 | 263 |
BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
184 | 264 |
} |
265 |
||
692 | 266 |
PageOptions::PageOptions(QWidget* parent) : |
267 |
AbstractPage(parent) |
|
184 | 268 |
{ |
269 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
427 | 270 |
pageLayout->setColumnStretch(0, 100); |
271 |
pageLayout->setColumnStretch(1, 100); |
|
272 |
pageLayout->setColumnStretch(2, 100); |
|
273 |
pageLayout->setRowStretch(0, 0); |
|
274 |
pageLayout->setRowStretch(1, 0); |
|
719 | 275 |
pageLayout->setRowStretch(2, 0); |
276 |
pageLayout->setRowStretch(3, 100); |
|
277 |
pageLayout->setRowStretch(4, 0); |
|
427 | 278 |
|
1198 | 279 |
|
280 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
281 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
282 |
QHBoxLayout * gbTBLayout = new QHBoxLayout(gbTwoBoxes); |
|
283 |
{ |
|
284 |
teamsBox = new IconedGroupBox(this); |
|
285 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
|
286 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
287 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
288 |
||
289 |
QGridLayout * GBTlayout = new QGridLayout(teamsBox); |
|
290 |
||
291 |
BtnNewTeam = addButton(tr("New team"), GBTlayout, 1, 0); |
|
292 |
||
293 |
CBTeamName = new QComboBox(teamsBox); |
|
294 |
GBTlayout->addWidget(CBTeamName, 0, 0, 1, 2); |
|
184 | 295 |
|
1198 | 296 |
BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 1, 1); |
1199 | 297 |
|
298 |
labelNN = new QLabel(teamsBox); |
|
299 |
labelNN->setText(QLabel::tr("Net nick")); |
|
300 |
GBTlayout->addWidget(labelNN, 2, 0, 1, 2); |
|
301 |
||
302 |
editNetNick = new QLineEdit(teamsBox); |
|
303 |
editNetNick->setMaxLength(20); |
|
304 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
305 |
GBTlayout->addWidget(editNetNick, 3, 0, 1, 2); |
|
306 |
||
1198 | 307 |
gbTBLayout->addWidget(teamsBox); |
308 |
} |
|
184 | 309 |
|
1198 | 310 |
{ |
311 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1199 | 312 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 313 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 314 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 315 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
316 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 317 |
|
1198 | 318 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
319 |
WeaponsName = new QComboBox(this); |
|
320 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
321 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
322 |
gbTBLayout->addWidget(groupWeapons); |
|
323 |
} |
|
184 | 324 |
|
1193 | 325 |
AGGroupBox = new IconedGroupBox(this); |
326 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
184 | 327 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
328 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
693 | 329 |
pageLayout->addWidget(AGGroupBox, 2, 1); |
184 | 330 |
|
427 | 331 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
436 | 332 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
427 | 333 |
QLabel * resolution = new QLabel(AGGroupBox); |
334 |
resolution->setText(QLabel::tr("Resolution")); |
|
335 |
GBAreslayout->addWidget(resolution); |
|
336 |
||
184 | 337 |
CBResolution = new QComboBox(AGGroupBox); |
555 | 338 |
SDLInteraction sdli; |
339 |
CBResolution->addItems(sdli.getResolutions()); |
|
427 | 340 |
GBAreslayout->addWidget(CBResolution); |
341 |
GBAlayout->addLayout(GBAreslayout); |
|
342 |
||
436 | 343 |
QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); |
427 | 344 |
QLabel * maxfps = new QLabel(AGGroupBox); |
345 |
maxfps->setText(QLabel::tr("FPS limit")); |
|
346 |
GBAfpslayout->addWidget(maxfps); |
|
347 |
GBAlayout->addLayout(GBAfpslayout); |
|
184 | 348 |
|
349 |
CBFullscreen = new QCheckBox(AGGroupBox); |
|
350 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
427 | 351 |
GBAlayout->addWidget(CBFullscreen); |
184 | 352 |
|
1162 | 353 |
CBFrontendFullscreen = new QCheckBox(AGGroupBox); |
354 |
CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); |
|
355 |
GBAlayout->addWidget(CBFrontendFullscreen); |
|
356 |
||
1157 | 357 |
CBEnableSound = new QCheckBox(AGGroupBox); |
184 | 358 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
427 | 359 |
GBAlayout->addWidget(CBEnableSound); |
184 | 360 |
|
1157 | 361 |
CBEnableMusic = new QCheckBox(AGGroupBox); |
1129 | 362 |
CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
363 |
GBAlayout->addWidget(CBEnableMusic); |
|
364 |
||
297 | 365 |
CBShowFPS = new QCheckBox(AGGroupBox); |
366 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
427 | 367 |
GBAlayout->addWidget(CBShowFPS); |
297 | 368 |
|
529 | 369 |
CBAltDamage = new QCheckBox(AGGroupBox); |
370 |
CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); |
|
371 |
GBAlayout->addWidget(CBAltDamage); |
|
372 |
||
297 | 373 |
fpsedit = new FPSEdit(AGGroupBox); |
427 | 374 |
GBAfpslayout->addWidget(fpsedit); |
184 | 375 |
|
1157 | 376 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 4, 2, true); |
184 | 377 |
|
1153 | 378 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
184 | 379 |
} |
380 |
||
1153 | 381 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 382 |
{ |
383 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
384 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
385 |
pageLayout->setColumnStretch(0, 1); |
|
386 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 387 |
pageLayout->setColumnStretch(2, 1); |
421 | 388 |
|
389 |
BtnNetSvrStart = new QPushButton(this); |
|
390 |
BtnNetSvrStart->setFont(*font14); |
|
391 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
617 | 392 |
pageLayout->addWidget(BtnNetSvrStart, 3, 2); |
184 | 393 |
|
636 | 394 |
QGroupBox * NetTypeGroupBox = new QGroupBox(this); |
395 |
NetTypeGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); |
|
668 | 396 |
NetTypeGroupBox->setTitle(QGroupBox::tr("Servers list")); |
636 | 397 |
pageLayout->addWidget(NetTypeGroupBox, 0, 1); |
398 |
||
399 |
QVBoxLayout * GBTlayout = new QVBoxLayout(NetTypeGroupBox); |
|
400 |
rbLocalGame = new QRadioButton(NetTypeGroupBox); |
|
668 | 401 |
rbLocalGame->setText(tr("Local")); |
636 | 402 |
rbLocalGame->setChecked(true); |
403 |
GBTlayout->addWidget(rbLocalGame); |
|
404 |
rbInternetGame = new QRadioButton(NetTypeGroupBox); |
|
668 | 405 |
rbInternetGame->setText(tr("Internet")); |
636 | 406 |
GBTlayout->addWidget(rbInternetGame); |
407 |
||
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
408 |
ConnGroupBox = new QGroupBox(this); |
421 | 409 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
410 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
411 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 412 |
GBClayout->setColumnStretch(0, 1); |
421 | 413 |
GBClayout->setColumnStretch(1, 1); |
414 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 415 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
416 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 417 |
BtnNetConnect->setFont(*font14); |
418 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 419 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 420 |
|
665 | 421 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
422 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 423 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 424 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
425 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
426 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
427 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 428 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 429 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
430 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
431 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
432 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
433 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
434 |
|
1153 | 435 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); |
636 | 436 |
|
646 | 437 |
connect(rbLocalGame, SIGNAL(toggled(bool)), this, SLOT(updateServersList())); |
668 | 438 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 439 |
} |
440 |
||
646 | 441 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
442 |
{ |
636 | 443 |
if (rbLocalGame->isChecked()) |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
444 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
667 | 445 |
else |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
446 |
tvServersList->setModel(new HWNetWwwModel(tvServersList)); |
659 | 447 |
|
673 | 448 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
449 |
||
665 | 450 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
451 |
|
665 | 452 |
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
|
453 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 454 |
} |
455 |
||
456 |
void PageNet::slotConnect() |
|
457 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
458 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
459 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
460 |
if(!mi.isValid()) |
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 |
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
|
463 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
464 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
465 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
466 |
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
|
467 |
|
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
|
468 |
emit connectClicked(host, port); |
646 | 469 |
} |
470 |
||
1153 | 471 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 472 |
{ |
473 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
474 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
475 |
pageLayout->setColumnStretch(0, 1); |
|
476 |
pageLayout->setColumnStretch(1, 1); |
|
477 |
pageLayout->setColumnStretch(2, 1); |
|
478 |
||
675 | 479 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
480 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
481 |
|
1153 | 482 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 483 |
|
484 |
BtnStart = new QPushButton(this); |
|
485 |
BtnStart->setFont(*font14); |
|
486 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 487 |
pageLayout->addWidget(BtnStart, 1, 2); |
488 |
||
489 |
QWidget * wg = new QWidget(this); |
|
490 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
491 |
|
675 | 492 |
QGridLayout * wgLayout = new QGridLayout(wg); |
493 |
wgLayout->setColumnStretch(0, 1); |
|
494 |
wgLayout->setColumnStretch(1, 3); |
|
495 |
wgLayout->setColumnStretch(2, 1); |
|
496 |
||
497 |
wgLayout->setRowStretch(0, 0); |
|
498 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
499 |
|
675 | 500 |
QGroupBox * gb = new QGroupBox(wg); |
501 |
wgLayout->addWidget(gb, 0, 1); |
|
502 |
||
503 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
504 |
||
505 |
labelSD = new QLabel(gb); |
|
506 |
labelSD->setText(QLabel::tr("Server name:")); |
|
507 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
508 |
|
675 | 509 |
leServerDescr = new QLineEdit(gb); |
510 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
511 |
||
512 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
513 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 514 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
515 |
|
675 | 516 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
517 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
518 |
sbPort->setMaximum(65535); |
675 | 519 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
520 |
|
675 | 521 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
522 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 523 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
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 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(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 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
528 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
529 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
530 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
531 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
532 |
|
1153 | 533 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 534 |
{ |
535 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
536 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 537 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 538 |
//pageLayout->setSpacing(1); |
539 |
//pageLayout->setMargin(1); |
|
463 | 540 |
pageLayout->setColumnStretch(0, 50); |
541 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 542 |
|
461 | 543 |
// chatwidget |
544 |
pChatWidget = new HWChatWidget(this); |
|
545 |
pageLayout->addWidget(pChatWidget, 1, 0); |
|
464 | 546 |
pageLayout->setRowStretch(1, 100); |
453 | 547 |
|
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 |
pGameCFG = new GameCFGWidget(this); |
322 | 549 |
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
|
550 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
551 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 552 |
pNetTeamsWidget->setAcceptOuter(true); |
461 | 553 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); |
184 | 554 |
|
1153 | 555 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
184 | 556 |
|
646 | 557 |
BtnGo = new QPushButton(this); |
184 | 558 |
BtnGo->setFont(*font14); |
559 |
BtnGo->setText(QPushButton::tr("Go!")); |
|
492 | 560 |
BtnGo->setEnabled(false); |
461 | 561 |
pageLayout->addWidget(BtnGo, 2, 1); |
184 | 562 |
} |
187 | 563 |
|
1153 | 564 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 565 |
{ |
566 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
567 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
568 |
pageLayout->setColumnStretch(0, 1); |
|
569 |
pageLayout->setColumnStretch(1, 1); |
|
570 |
pageLayout->setColumnStretch(2, 1); |
|
571 |
||
1153 | 572 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 573 |
|
574 |
about = new About(this); |
|
575 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
576 |
} |
|
306 | 577 |
|
1153 | 578 |
PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) |
306 | 579 |
{ |
580 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
581 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
582 |
pageLayout->setColumnStretch(0, 1); |
|
583 |
pageLayout->setColumnStretch(1, 1); |
|
584 |
pageLayout->setColumnStretch(2, 1); |
|
585 |
||
1153 | 586 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
306 | 587 |
|
307 | 588 |
labelGameStats = new QLabel(this); |
589 |
labelGameStats->setTextFormat(Qt::RichText); |
|
590 |
pageLayout->addWidget(labelGameStats, 0, 0, 1, 3); |
|
306 | 591 |
} |
586 | 592 |
|
1150 | 593 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 594 |
{ |
595 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
596 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
597 |
pageLayout->setMargin(25); |
|
598 |
pageLayout->setColumnStretch(0, 1); |
|
599 |
pageLayout->setColumnStretch(1, 2); |
|
600 |
pageLayout->setColumnStretch(2, 1); |
|
588 | 601 |
pageLayout->setRowStretch(0, 1); |
1150 | 602 |
pageLayout->setRowStretch(6, 1); |
586 | 603 |
|
1150 | 604 |
BtnSimpleGamePage = addButton(tr("Simple Game"), pageLayout, 1, 1); |
605 |
BtnTrainPage = addButton(tr("Training"), pageLayout, 2, 1); |
|
606 |
BtnMultiplayer = addButton(tr("Multiplayer"), pageLayout, 3, 1); |
|
607 |
BtnLoad = addButton(tr("Saved games"), pageLayout, 4, 1); |
|
608 |
BtnDemos = addButton(tr("Demos"), pageLayout, 5, 1); |
|
586 | 609 |
|
1153 | 610 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 7, 0, true); |
586 | 611 |
} |
612 |
||
1153 | 613 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 614 |
{ |
615 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
616 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
617 |
pageLayout->setMargin(25); |
|
618 |
pageLayout->setColumnStretch(0, 1); |
|
619 |
pageLayout->setColumnStretch(1, 2); |
|
620 |
pageLayout->setColumnStretch(2, 1); |
|
621 |
||
622 |
BtnStartTrain = new QPushButton(this); |
|
623 |
BtnStartTrain->setFont(*font14); |
|
624 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
625 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
626 |
||
1153 | 627 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 628 |
} |
629 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
630 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 631 |
AbstractPage(parent) |
600 | 632 |
{ |
633 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
634 |
pageLayout->setMargin(25); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
635 |
|
1168 | 636 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size() - 10, this); |
718 | 637 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 638 |
|
1168 | 639 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 640 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
641 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 642 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
600 | 643 |
} |
644 |
||
686 | 645 |
PageInGame::PageInGame(QWidget* parent) : |
646 |
AbstractPage(parent) |
|
647 |
{ |
|
648 |
QLabel * label = new QLabel(this); |
|
649 |
label->setText("In game..."); |
|
650 |
} |