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