author | unc0rr |
Wed, 05 Nov 2008 08:02:12 +0000 | |
changeset 1477 | 001a52a108ed |
parent 1457 | 44cc464de8f3 |
child 1487 | b4cc59a6d50a |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
1236 | 3 |
* Copyright (c) 2006-2008 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> |
1252 | 35 |
#include <QTabWidget> |
1377 | 36 |
#include <QTextBrowser> |
1399 | 37 |
#include <QTableWidget> |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
38 |
#include <QAction> |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
39 |
#include <QMenu> |
184 | 40 |
|
41 |
#include "pages.h" |
|
42 |
#include "sdlkeys.h" |
|
43 |
#include "hwconsts.h" |
|
44 |
#include "gamecfgwidget.h" |
|
45 |
#include "teamselect.h" |
|
46 |
#include "gamecfgwidget.h" |
|
47 |
#include "SquareLabel.h" |
|
48 |
#include "mapContainer.h" |
|
187 | 49 |
#include "about.h" |
297 | 50 |
#include "fpsedit.h" |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
51 |
#include "netserverslist.h" |
412 | 52 |
#include "netudpwidget.h" |
461 | 53 |
#include "chatwidget.h" |
579 | 54 |
#include "playrecordpage.h" |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
603
diff
changeset
|
55 |
#include "selectWeapon.h" |
1192 | 56 |
#include "igbox.h" |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
57 |
#include "hats.h" |
184 | 58 |
|
684 | 59 |
PageMain::PageMain(QWidget* parent) : |
60 |
AbstractPage(parent) |
|
184 | 61 |
{ |
62 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1148 | 63 |
//pageLayout->setColumnStretch(0, 1); |
64 |
//pageLayout->setColumnStretch(1, 2); |
|
65 |
//pageLayout->setColumnStretch(2, 1); |
|
184 | 66 |
|
1199 | 67 |
//QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
68 |
//pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); |
|
1148 | 69 |
pageLayout->setRowStretch(0, 1); |
1150 | 70 |
pageLayout->setRowStretch(1, 1); |
71 |
pageLayout->setRowStretch(2, 0); |
|
72 |
pageLayout->setRowStretch(3, 1); |
|
1199 | 73 |
pageLayout->setRowStretch(4, 1); |
184 | 74 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
75 |
BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
1450 | 76 |
BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); |
1150 | 77 |
pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
184 | 78 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
79 |
BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
1450 | 80 |
BtnNet->setToolTip(tr("Network Game (Play a game across a network)")); |
1150 | 81 |
pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
579 | 82 |
|
1199 | 83 |
BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true); |
184 | 84 |
|
1199 | 85 |
//BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
86 |
BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
1212 | 87 |
BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
1150 | 88 |
pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
1199 | 89 |
//pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
184 | 90 |
|
1199 | 91 |
BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
184 | 92 |
} |
93 |
||
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
730
diff
changeset
|
94 |
PageEditTeam::PageEditTeam(QWidget* parent) : |
692 | 95 |
AbstractPage(parent) |
184 | 96 |
{ |
97 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1252 | 98 |
QTabWidget * tbw = new QTabWidget(this); |
1389 | 99 |
QWidget * page1 = new QWidget(this); |
100 |
QWidget * page2 = new QWidget(this); |
|
1252 | 101 |
tbw->addTab(page1, tr("General")); |
102 |
tbw->addTab(page2, tr("Advanced")); |
|
103 |
pageLayout->addWidget(tbw, 0, 0, 1, 3); |
|
104 |
BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
|
105 |
BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);; |
|
1443 | 106 |
BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
107 |
||
1252 | 108 |
QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
109 |
page1Layout->setAlignment(Qt::AlignTop); |
|
110 |
QGridLayout * page2Layout = new QGridLayout(page2); |
|
111 |
||
112 |
// ====== Page 1 ====== |
|
113 |
QVBoxLayout * vbox1 = new QVBoxLayout(); |
|
114 |
QVBoxLayout * vbox2 = new QVBoxLayout(); |
|
115 |
QVBoxLayout * vbox3 = new QVBoxLayout(); |
|
116 |
page1Layout->addLayout(vbox1); |
|
117 |
page1Layout->addLayout(vbox2); |
|
118 |
page1Layout->addLayout(vbox3); |
|
119 |
||
588 | 120 |
GBoxHedgehogs = new QGroupBox(this); |
184 | 121 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
122 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
123 |
QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
|
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
124 |
|
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
125 |
HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
184 | 126 |
for(int i = 0; i < 8; i++) |
127 |
{ |
|
128 |
HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
|
1216
df1b19976e28
Allow team and hh name length be up to 64 letters length
unc0rr
parents:
1212
diff
changeset
|
129 |
HHNameEdit[i]->setMaxLength(64); |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
130 |
HHNameEdit[i]->setMinimumWidth(120); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
131 |
GBHLayout->addWidget(HHNameEdit[i], i, 0); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
132 |
|
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
133 |
HHHats[i] = new QComboBox(GBoxHedgehogs); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
134 |
HHHats[i]->setModel(hatsModel); |
1282 | 135 |
HHHats[i]->setIconSize(QSize(32, 37)); |
136 |
//HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
|
1239 | 137 |
//HHHats[i]->setModelColumn(1); |
1240 | 138 |
//HHHats[i]->setMinimumWidth(132); |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
139 |
GBHLayout->addWidget(HHHats[i], i, 1); |
184 | 140 |
} |
1252 | 141 |
vbox1->addWidget(GBoxHedgehogs); |
142 |
||
143 |
||
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
144 |
GBoxTeam = new QGroupBox(this); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
145 |
GBoxTeam->setTitle(QGroupBox::tr("Team")); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
146 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
147 |
QVBoxLayout * GBTLayout = new QVBoxLayout(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
148 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
149 |
TeamNameEdit->setMaxLength(64); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
150 |
GBTLayout->addWidget(TeamNameEdit); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
151 |
vbox2->addWidget(GBoxTeam); |
1252 | 152 |
|
1290 | 153 |
CBTeamLvl = new QComboBox(GBoxTeam); |
1440 | 154 |
CBTeamLvl->setIconSize(QSize(48, 48)); |
1287 | 155 |
CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
156 |
for(int i = 5; i > 0; i--) |
|
157 |
CBTeamLvl->addItem( |
|
158 |
QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
|
159 |
QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
|
160 |
); |
|
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
161 |
GBTLayout->addWidget(CBTeamLvl); |
1287 | 162 |
|
1290 | 163 |
CBGrave = new QComboBox(GBoxTeam); |
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
164 |
CBGrave->setMaxCount(65535); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
165 |
CBGrave->setIconSize(QSize(32, 32)); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
166 |
GBTLayout->addWidget(CBGrave); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
167 |
|
1252 | 168 |
GBoxFort = new QGroupBox(this); |
169 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
|
170 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
|
171 |
CBFort = new QComboBox(GBoxFort); |
|
172 |
CBFort->setMaxCount(65535); |
|
173 |
GBFLayout->addWidget(CBFort, 0, 0); |
|
174 |
FortPreview = new SquareLabel(GBoxFort); |
|
175 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
176 |
FortPreview->setPixmap(QPixmap()); |
|
177 |
GBFLayout->addWidget(FortPreview, 1, 0); |
|
178 |
vbox3->addWidget(GBoxFort); |
|
179 |
||
180 |
QDir tmpdir; |
|
181 |
tmpdir.cd(datadir->absolutePath()); |
|
182 |
tmpdir.cd("Forts"); |
|
183 |
tmpdir.setFilter(QDir::Files); |
|
184 |
||
1287 | 185 |
connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
1252 | 186 |
CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
1287 | 187 |
|
1252 | 188 |
tmpdir.cd("../Graphics/Graves"); |
189 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
190 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
191 |
{ |
|
1287 | 192 |
QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); |
193 |
QIcon icon(pix.copy(0, 0, 32, 32)); |
|
194 |
CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
|
1252 | 195 |
} |
196 |
||
197 |
vbox1->addStretch(); |
|
198 |
vbox2->addStretch(); |
|
199 |
// vbox3->addStretch(); |
|
200 |
||
201 |
// ====== Page 2 ====== |
|
588 | 202 |
GBoxBinds = new QGroupBox(this); |
184 | 203 |
GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
204 |
QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
|
205 |
BindsBox = new QToolBox(GBoxBinds); |
|
206 |
BindsBox->setLineWidth(0); |
|
207 |
GBBLayout->addWidget(BindsBox); |
|
1389 | 208 |
page_A = new QWidget(this); |
184 | 209 |
BindsBox->addItem(page_A, QToolBox::tr("Actions")); |
1389 | 210 |
page_W = new QWidget(this); |
184 | 211 |
BindsBox->addItem(page_W, QToolBox::tr("Weapons")); |
1389 | 212 |
page_WP = new QWidget(this); |
184 | 213 |
BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); |
1389 | 214 |
page_O = new QWidget(this); |
184 | 215 |
BindsBox->addItem(page_O, QToolBox::tr("Other")); |
1252 | 216 |
page2Layout->addWidget(GBoxBinds, 0, 0); |
184 | 217 |
|
218 |
QStringList binds; |
|
219 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
220 |
{ |
|
221 |
binds << sdlkeys[i][1]; |
|
222 |
} |
|
223 |
||
224 |
quint16 widind = 0, i = 0; |
|
225 |
while (i < BINDS_NUMBER) { |
|
226 |
quint16 num = 0; |
|
1389 | 227 |
QWidget * curW = BindsBox->widget(widind); |
228 |
QGridLayout * pagelayout = new QGridLayout(curW); |
|
184 | 229 |
do { |
1389 | 230 |
LBind[i] = new QLabel(curW); |
184 | 231 |
LBind[i]->setText(QApplication::translate("binds", cbinds[i].name)); |
232 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
233 |
pagelayout->addWidget(LBind[i], num, 0); |
|
1389 | 234 |
CBBind[i] = new QComboBox(curW); |
184 | 235 |
CBBind[i]->addItems(binds); |
236 |
pagelayout->addWidget(CBBind[i], num, 1); |
|
237 |
num++; |
|
238 |
} while (!cbinds[i++].chwidget); |
|
1389 | 239 |
pagelayout->addWidget(new QWidget(curW), num, 0, 1, 2); |
184 | 240 |
widind++; |
241 |
} |
|
242 |
} |
|
243 |
||
244 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
|
245 |
{ |
|
246 |
QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
|
247 |
FortPreview->setPixmap(pix); |
|
248 |
} |
|
249 |
||
1287 | 250 |
PageMultiplayer::PageMultiplayer(QWidget* parent) : |
692 | 251 |
AbstractPage(parent) |
184 | 252 |
{ |
253 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
254 |
||
1218 | 255 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
187 | 256 |
|
184 | 257 |
gameCFG = new GameCFGWidget(this); |
258 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
696 | 259 |
|
1218 | 260 |
pageLayout->setRowStretch(1, 1); |
261 |
||
184 | 262 |
teamsSelect = new TeamSelWidget(this); |
1218 | 263 |
pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
184 | 264 |
|
1218 | 265 |
BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
184 | 266 |
} |
267 |
||
1249
b6670a6ea2d0
Remove 25pix margin on every page, so exit button is almost in the same place on all pages
unc0rr
parents:
1240
diff
changeset
|
268 |
PageOptions::PageOptions(QWidget* parent) : |
692 | 269 |
AbstractPage(parent) |
184 | 270 |
{ |
271 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
427 | 272 |
pageLayout->setColumnStretch(0, 100); |
273 |
pageLayout->setColumnStretch(1, 100); |
|
274 |
pageLayout->setColumnStretch(2, 100); |
|
275 |
pageLayout->setRowStretch(0, 0); |
|
276 |
pageLayout->setRowStretch(1, 0); |
|
719 | 277 |
pageLayout->setRowStretch(2, 0); |
278 |
pageLayout->setRowStretch(3, 100); |
|
279 |
pageLayout->setRowStretch(4, 0); |
|
427 | 280 |
|
1198 | 281 |
|
282 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
283 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
284 |
QHBoxLayout * gbTBLayout = new QHBoxLayout(gbTwoBoxes); |
|
285 |
{ |
|
286 |
teamsBox = new IconedGroupBox(this); |
|
287 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
|
288 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
289 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
290 |
||
291 |
QGridLayout * GBTlayout = new QGridLayout(teamsBox); |
|
292 |
||
293 |
BtnNewTeam = addButton(tr("New team"), GBTlayout, 1, 0); |
|
294 |
||
295 |
CBTeamName = new QComboBox(teamsBox); |
|
296 |
GBTlayout->addWidget(CBTeamName, 0, 0, 1, 2); |
|
184 | 297 |
|
1198 | 298 |
BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 1, 1); |
1199 | 299 |
|
300 |
labelNN = new QLabel(teamsBox); |
|
301 |
labelNN->setText(QLabel::tr("Net nick")); |
|
302 |
GBTlayout->addWidget(labelNN, 2, 0, 1, 2); |
|
303 |
||
304 |
editNetNick = new QLineEdit(teamsBox); |
|
305 |
editNetNick->setMaxLength(20); |
|
306 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
307 |
GBTlayout->addWidget(editNetNick, 3, 0, 1, 2); |
|
308 |
||
1198 | 309 |
gbTBLayout->addWidget(teamsBox); |
310 |
} |
|
184 | 311 |
|
1198 | 312 |
{ |
313 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1199 | 314 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 315 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 316 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 317 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
318 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 319 |
|
1198 | 320 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
321 |
WeaponsName = new QComboBox(this); |
|
322 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
323 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
324 |
gbTBLayout->addWidget(groupWeapons); |
|
325 |
} |
|
184 | 326 |
|
1193 | 327 |
AGGroupBox = new IconedGroupBox(this); |
328 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
184 | 329 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
330 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
693 | 331 |
pageLayout->addWidget(AGGroupBox, 2, 1); |
184 | 332 |
|
427 | 333 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
436 | 334 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
427 | 335 |
QLabel * resolution = new QLabel(AGGroupBox); |
336 |
resolution->setText(QLabel::tr("Resolution")); |
|
337 |
GBAreslayout->addWidget(resolution); |
|
338 |
||
184 | 339 |
CBResolution = new QComboBox(AGGroupBox); |
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); |
1443 | 377 |
BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
184 | 378 |
|
1153 | 379 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
184 | 380 |
} |
381 |
||
1153 | 382 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 383 |
{ |
384 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
385 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
386 |
pageLayout->setColumnStretch(0, 1); |
|
387 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 388 |
pageLayout->setColumnStretch(2, 1); |
421 | 389 |
|
390 |
BtnNetSvrStart = new QPushButton(this); |
|
391 |
BtnNetSvrStart->setFont(*font14); |
|
392 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
1415
6fbfee0e113a
Allow build without net game server: introduce -DWITH_SERVER configuration parameter
unc0rr
parents:
1409
diff
changeset
|
393 |
BtnNetSvrStart->setVisible(haveServer); |
1395 | 394 |
pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
395 |
||
396 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
|
184 | 397 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
398 |
ConnGroupBox = new QGroupBox(this); |
421 | 399 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
400 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
401 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 402 |
GBClayout->setColumnStretch(0, 1); |
421 | 403 |
GBClayout->setColumnStretch(1, 1); |
404 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 405 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
406 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 407 |
BtnNetConnect->setFont(*font14); |
408 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 409 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 410 |
|
665 | 411 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
412 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 413 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 414 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
415 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
416 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
417 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 418 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 419 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
420 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
421 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
422 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
423 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
424 |
|
1395 | 425 |
BtnOfficialServer = new QPushButton(ConnGroupBox); |
426 |
BtnOfficialServer->setFont(*font14); |
|
427 |
BtnOfficialServer->setText(QPushButton::tr("Join official server")); |
|
428 |
GBClayout->addWidget(BtnOfficialServer, 3, 0, 1, 3); |
|
636 | 429 |
|
668 | 430 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 431 |
} |
432 |
||
646 | 433 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
434 |
{ |
1310 | 435 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
659 | 436 |
|
673 | 437 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
438 |
||
665 | 439 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
440 |
|
665 | 441 |
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
|
442 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 443 |
} |
444 |
||
445 |
void PageNet::slotConnect() |
|
446 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
447 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
448 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
449 |
if(!mi.isValid()) |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
450 |
{ |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
451 |
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
|
452 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
453 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
454 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
455 |
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
|
456 |
|
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
|
457 |
emit connectClicked(host, port); |
646 | 458 |
} |
459 |
||
1153 | 460 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 461 |
{ |
462 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
463 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
464 |
pageLayout->setColumnStretch(0, 1); |
|
465 |
pageLayout->setColumnStretch(1, 1); |
|
466 |
pageLayout->setColumnStretch(2, 1); |
|
467 |
||
675 | 468 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
469 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
470 |
|
1153 | 471 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 472 |
|
473 |
BtnStart = new QPushButton(this); |
|
474 |
BtnStart->setFont(*font14); |
|
475 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 476 |
pageLayout->addWidget(BtnStart, 1, 2); |
477 |
||
478 |
QWidget * wg = new QWidget(this); |
|
479 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
480 |
|
675 | 481 |
QGridLayout * wgLayout = new QGridLayout(wg); |
482 |
wgLayout->setColumnStretch(0, 1); |
|
483 |
wgLayout->setColumnStretch(1, 3); |
|
484 |
wgLayout->setColumnStretch(2, 1); |
|
485 |
||
486 |
wgLayout->setRowStretch(0, 0); |
|
487 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
488 |
|
675 | 489 |
QGroupBox * gb = new QGroupBox(wg); |
490 |
wgLayout->addWidget(gb, 0, 1); |
|
491 |
||
492 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
493 |
||
494 |
labelSD = new QLabel(gb); |
|
495 |
labelSD->setText(QLabel::tr("Server name:")); |
|
496 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
497 |
|
675 | 498 |
leServerDescr = new QLineEdit(gb); |
499 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
500 |
||
501 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
502 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 503 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
504 |
|
675 | 505 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
506 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
507 |
sbPort->setMaximum(65535); |
675 | 508 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
509 |
|
675 | 510 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
511 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 512 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
513 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
514 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
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 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
517 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
518 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
519 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
520 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
521 |
|
1153 | 522 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 523 |
{ |
524 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
525 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 526 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 527 |
//pageLayout->setSpacing(1); |
463 | 528 |
pageLayout->setColumnStretch(0, 50); |
529 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 530 |
|
461 | 531 |
// chatwidget |
532 |
pChatWidget = new HWChatWidget(this); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
533 |
pageLayout->addWidget(pChatWidget, 1, 0, 2, 1); |
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 |
|
646 | 543 |
BtnGo = new QPushButton(this); |
184 | 544 |
BtnGo->setFont(*font14); |
1404 | 545 |
BtnGo->setText(QPushButton::tr("Ready")); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
546 |
pageLayout->addWidget(BtnGo, 3, 1); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
547 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
548 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
549 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
550 |
BtnMaster = addButton(tr("Control"), pageLayout, 2, 1); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
551 |
QMenu * menu = new QMenu(BtnMaster); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
552 |
startGame = new QAction(QAction::tr("Start"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
553 |
restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
554 |
restrictJoins->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
555 |
restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
556 |
restrictTeamAdds->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
557 |
menu->addAction(startGame); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
558 |
menu->addAction(restrictJoins); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
559 |
menu->addAction(restrictTeamAdds); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
560 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
561 |
BtnMaster->setMenu(menu); |
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); |
|
1443 | 596 |
QVBoxLayout * vLayout = new QVBoxLayout(this); |
597 |
QHBoxLayout * topLine = new QHBoxLayout(); |
|
598 |
QHBoxLayout * middleLine = new QHBoxLayout(); |
|
599 |
QHBoxLayout * bottomLine = new QHBoxLayout(); |
|
1444 | 600 |
vLayout->addStretch(); |
1443 | 601 |
vLayout->addLayout(topLine); |
1457 | 602 |
vLayout->addSpacing(30); |
1443 | 603 |
vLayout->addLayout(middleLine); |
1444 | 604 |
vLayout->addStretch(); |
1443 | 605 |
vLayout->addLayout(bottomLine); |
586 | 606 |
|
1457 | 607 |
topLine->addStretch(); |
1443 | 608 |
BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); |
1450 | 609 |
BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); |
1457 | 610 |
topLine->addSpacing(60); |
1443 | 611 |
BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); |
1450 | 612 |
BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); |
1457 | 613 |
topLine->addStretch(); |
614 |
||
615 |
||
1443 | 616 |
BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true); |
1450 | 617 |
BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT")); |
1443 | 618 |
|
619 |
BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true); |
|
1444 | 620 |
bottomLine->addStretch(); |
621 |
||
1447 | 622 |
BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); |
1450 | 623 |
BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); |
1443 | 624 |
BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true); |
625 |
BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
|
1450 | 626 |
BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); |
586 | 627 |
} |
628 |
||
1153 | 629 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 630 |
{ |
631 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
632 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
633 |
pageLayout->setColumnStretch(0, 1); |
|
634 |
pageLayout->setColumnStretch(1, 2); |
|
635 |
pageLayout->setColumnStretch(2, 1); |
|
636 |
||
637 |
BtnStartTrain = new QPushButton(this); |
|
638 |
BtnStartTrain->setFont(*font14); |
|
639 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
640 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
641 |
||
1153 | 642 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 643 |
} |
644 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
645 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 646 |
AbstractPage(parent) |
600 | 647 |
{ |
648 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
649 |
|
1168 | 650 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size() - 10, this); |
718 | 651 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 652 |
|
1168 | 653 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 654 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
655 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 656 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
1443 | 657 |
BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
600 | 658 |
} |
659 |
||
1249
b6670a6ea2d0
Remove 25pix margin on every page, so exit button is almost in the same place on all pages
unc0rr
parents:
1240
diff
changeset
|
660 |
PageInGame::PageInGame(QWidget* parent) : |
686 | 661 |
AbstractPage(parent) |
662 |
{ |
|
663 |
QLabel * label = new QLabel(this); |
|
664 |
label->setText("In game..."); |
|
665 |
} |
|
1311 | 666 |
|
667 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
|
668 |
AbstractPage(parent) |
|
669 |
{ |
|
1312 | 670 |
QGridLayout * pageLayout = new QGridLayout(this); |
1314 | 671 |
|
672 |
roomName = new QLineEdit(this); |
|
1334
b58afaadf7ae
Send team removal message to others in room when client disconnects
unc0rr
parents:
1315
diff
changeset
|
673 |
roomName->setMaxLength(60); |
1314 | 674 |
pageLayout->addWidget(roomName, 0, 0); |
1399 | 675 |
|
676 |
roomsList = new QTableWidget(this); |
|
677 |
roomsList->setColumnCount(3); |
|
678 |
roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
|
679 |
roomsList->verticalHeader()->setVisible(false); |
|
680 |
roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
|
681 |
roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
|
682 |
||
1314 | 683 |
pageLayout->addWidget(roomsList, 1, 0, 3, 1); |
1377 | 684 |
serverMessage = new QTextBrowser(this); |
685 |
serverMessage->setOpenExternalLinks(true); |
|
686 |
pageLayout->addWidget(serverMessage, 4, 0, 1, 2); |
|
1312 | 687 |
|
1377 | 688 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
1312 | 689 |
BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
690 |
BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
|
691 |
BtnRefresh = addButton(tr("Refresh"), pageLayout, 2, 1); |
|
1314 | 692 |
|
693 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
|
694 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
|
1315 | 695 |
connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
1314 | 696 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
1311 | 697 |
} |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
698 |
|
1377 | 699 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
700 |
void PageRoomsList::setRoomsList(const QStringList & list) |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
701 |
{ |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
702 |
roomsList->clear(); |
1399 | 703 |
roomsList->setHorizontalHeaderLabels( |
704 |
QStringList() << |
|
705 |
QTableWidget::tr("Room name") << |
|
706 |
QTableWidget::tr("Players number") << |
|
707 |
QTableWidget::tr("Round in progress") |
|
708 |
); |
|
709 |
||
710 |
if (list.size() % 3) |
|
711 |
return; |
|
712 |
||
713 |
roomsList->setRowCount(list.size() / 3); |
|
714 |
for(int i = 0; i < list.size(); i += 3) |
|
715 |
for(int t = 0; t < 3; t++) |
|
716 |
{ |
|
717 |
QTableWidgetItem * item = new QTableWidgetItem(list[i + t]); |
|
718 |
item->setFlags(Qt::ItemIsSelectable); |
|
1400 | 719 |
roomsList->setItem(i / 3, t, item); |
1399 | 720 |
} |
721 |
//roomsList->resizeColumnsToContents(); |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
722 |
} |
1314 | 723 |
|
724 |
void PageRoomsList::onCreateClick() |
|
725 |
{ |
|
726 |
if (roomName->text().size()) |
|
727 |
emit askForCreateRoom(roomName->text()); |
|
728 |
else |
|
729 |
QMessageBox::critical(this, |
|
730 |
tr("Error"), |
|
1315 | 731 |
tr("Please, enter room name"), |
1314 | 732 |
tr("OK")); |
733 |
} |
|
734 |
||
735 |
void PageRoomsList::onJoinClick() |
|
736 |
{ |
|
1399 | 737 |
QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
1314 | 738 |
if (!curritem) |
739 |
{ |
|
740 |
QMessageBox::critical(this, |
|
741 |
tr("Error"), |
|
742 |
tr("Please, select room from the list"), |
|
743 |
tr("OK")); |
|
744 |
return ; |
|
745 |
} |
|
746 |
emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
747 |
} |
|
748 |
||
1315 | 749 |
void PageRoomsList::onRefreshClick() |
750 |
{ |
|
751 |
emit askForRoomList(); |
|
752 |
} |
|
753 |