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