author | unc0rr |
Fri, 09 Jan 2009 11:28:18 +0000 | |
changeset 1623 | d590e6da04da |
parent 1621 | d1ded2532d3f |
child 1644 | 1e51e80c383c |
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 |
||
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1457
diff
changeset
|
373 |
CBNameWithDate = new QCheckBox(AGGroupBox); |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1457
diff
changeset
|
374 |
CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name")); |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1457
diff
changeset
|
375 |
GBAlayout->addWidget(CBNameWithDate); |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1457
diff
changeset
|
376 |
|
297 | 377 |
fpsedit = new FPSEdit(AGGroupBox); |
427 | 378 |
GBAfpslayout->addWidget(fpsedit); |
184 | 379 |
|
1157 | 380 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 4, 2, true); |
1443 | 381 |
BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
184 | 382 |
|
1153 | 383 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
184 | 384 |
} |
385 |
||
1153 | 386 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 387 |
{ |
388 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
389 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
390 |
pageLayout->setColumnStretch(0, 1); |
|
391 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 392 |
pageLayout->setColumnStretch(2, 1); |
421 | 393 |
|
394 |
BtnNetSvrStart = new QPushButton(this); |
|
395 |
BtnNetSvrStart->setFont(*font14); |
|
396 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
1415
6fbfee0e113a
Allow build without net game server: introduce -DWITH_SERVER configuration parameter
unc0rr
parents:
1409
diff
changeset
|
397 |
BtnNetSvrStart->setVisible(haveServer); |
1395 | 398 |
pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
399 |
||
400 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
|
184 | 401 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
402 |
ConnGroupBox = new QGroupBox(this); |
421 | 403 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
404 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
405 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 406 |
GBClayout->setColumnStretch(0, 1); |
421 | 407 |
GBClayout->setColumnStretch(1, 1); |
408 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 409 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
410 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 411 |
BtnNetConnect->setFont(*font14); |
412 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 413 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 414 |
|
665 | 415 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
416 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 417 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 418 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
419 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
420 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
421 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 422 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 423 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
424 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
425 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
426 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
427 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
428 |
|
1395 | 429 |
BtnOfficialServer = new QPushButton(ConnGroupBox); |
430 |
BtnOfficialServer->setFont(*font14); |
|
431 |
BtnOfficialServer->setText(QPushButton::tr("Join official server")); |
|
432 |
GBClayout->addWidget(BtnOfficialServer, 3, 0, 1, 3); |
|
636 | 433 |
|
668 | 434 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 435 |
} |
436 |
||
646 | 437 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
438 |
{ |
1310 | 439 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
659 | 440 |
|
673 | 441 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
442 |
||
665 | 443 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
444 |
|
665 | 445 |
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
|
446 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 447 |
} |
448 |
||
449 |
void PageNet::slotConnect() |
|
450 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
451 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
452 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
453 |
if(!mi.isValid()) |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
454 |
{ |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
455 |
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
|
456 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
457 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
458 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
459 |
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
|
460 |
|
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
|
461 |
emit connectClicked(host, port); |
646 | 462 |
} |
463 |
||
1153 | 464 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 465 |
{ |
466 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
467 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
468 |
pageLayout->setColumnStretch(0, 1); |
|
469 |
pageLayout->setColumnStretch(1, 1); |
|
470 |
pageLayout->setColumnStretch(2, 1); |
|
471 |
||
675 | 472 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
473 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
474 |
|
1153 | 475 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 476 |
|
477 |
BtnStart = new QPushButton(this); |
|
478 |
BtnStart->setFont(*font14); |
|
479 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 480 |
pageLayout->addWidget(BtnStart, 1, 2); |
481 |
||
482 |
QWidget * wg = new QWidget(this); |
|
483 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
484 |
|
675 | 485 |
QGridLayout * wgLayout = new QGridLayout(wg); |
486 |
wgLayout->setColumnStretch(0, 1); |
|
487 |
wgLayout->setColumnStretch(1, 3); |
|
488 |
wgLayout->setColumnStretch(2, 1); |
|
489 |
||
490 |
wgLayout->setRowStretch(0, 0); |
|
491 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
492 |
|
675 | 493 |
QGroupBox * gb = new QGroupBox(wg); |
494 |
wgLayout->addWidget(gb, 0, 1); |
|
495 |
||
496 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
497 |
||
498 |
labelSD = new QLabel(gb); |
|
499 |
labelSD->setText(QLabel::tr("Server name:")); |
|
500 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
501 |
|
675 | 502 |
leServerDescr = new QLineEdit(gb); |
503 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
504 |
||
505 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
506 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 507 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
508 |
|
675 | 509 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
510 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
511 |
sbPort->setMaximum(65535); |
675 | 512 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
513 |
|
675 | 514 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
515 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 516 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
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 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
519 |
} |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
520 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
521 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
522 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
523 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
524 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
525 |
|
1153 | 526 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 527 |
{ |
528 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
529 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 530 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 531 |
//pageLayout->setSpacing(1); |
463 | 532 |
pageLayout->setColumnStretch(0, 50); |
533 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 534 |
|
461 | 535 |
// chatwidget |
536 |
pChatWidget = new HWChatWidget(this); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
537 |
pageLayout->addWidget(pChatWidget, 1, 0, 2, 1); |
464 | 538 |
pageLayout->setRowStretch(1, 100); |
453 | 539 |
|
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
540 |
pGameCFG = new GameCFGWidget(this); |
322 | 541 |
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
|
542 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
543 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 544 |
pNetTeamsWidget->setAcceptOuter(true); |
461 | 545 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); |
184 | 546 |
|
646 | 547 |
BtnGo = new QPushButton(this); |
184 | 548 |
BtnGo->setFont(*font14); |
1404 | 549 |
BtnGo->setText(QPushButton::tr("Ready")); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
550 |
pageLayout->addWidget(BtnGo, 3, 1); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
551 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
552 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
553 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
554 |
BtnMaster = addButton(tr("Control"), pageLayout, 2, 1); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
555 |
QMenu * menu = new QMenu(BtnMaster); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
556 |
startGame = new QAction(QAction::tr("Start"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
557 |
restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
558 |
restrictJoins->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
559 |
restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
560 |
restrictTeamAdds->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
561 |
menu->addAction(startGame); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
562 |
menu->addAction(restrictJoins); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
563 |
menu->addAction(restrictTeamAdds); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
564 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
565 |
BtnMaster->setMenu(menu); |
184 | 566 |
} |
187 | 567 |
|
1153 | 568 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 569 |
{ |
570 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
571 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
572 |
pageLayout->setColumnStretch(0, 1); |
|
573 |
pageLayout->setColumnStretch(1, 1); |
|
574 |
pageLayout->setColumnStretch(2, 1); |
|
575 |
||
1153 | 576 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 577 |
|
578 |
about = new About(this); |
|
579 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
580 |
} |
|
306 | 581 |
|
1150 | 582 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 583 |
{ |
584 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
1443 | 585 |
QVBoxLayout * vLayout = new QVBoxLayout(this); |
586 |
QHBoxLayout * topLine = new QHBoxLayout(); |
|
587 |
QHBoxLayout * middleLine = new QHBoxLayout(); |
|
588 |
QHBoxLayout * bottomLine = new QHBoxLayout(); |
|
1444 | 589 |
vLayout->addStretch(); |
1443 | 590 |
vLayout->addLayout(topLine); |
1457 | 591 |
vLayout->addSpacing(30); |
1443 | 592 |
vLayout->addLayout(middleLine); |
1444 | 593 |
vLayout->addStretch(); |
1443 | 594 |
vLayout->addLayout(bottomLine); |
586 | 595 |
|
1457 | 596 |
topLine->addStretch(); |
1443 | 597 |
BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); |
1450 | 598 |
BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); |
1457 | 599 |
topLine->addSpacing(60); |
1443 | 600 |
BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); |
1450 | 601 |
BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); |
1457 | 602 |
topLine->addStretch(); |
603 |
||
604 |
||
1443 | 605 |
BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true); |
1450 | 606 |
BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT")); |
1443 | 607 |
|
608 |
BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true); |
|
1444 | 609 |
bottomLine->addStretch(); |
610 |
||
1447 | 611 |
BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); |
1450 | 612 |
BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); |
1443 | 613 |
BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true); |
614 |
BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
|
1450 | 615 |
BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); |
586 | 616 |
} |
617 |
||
1153 | 618 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 619 |
{ |
620 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
621 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
622 |
pageLayout->setColumnStretch(0, 1); |
|
623 |
pageLayout->setColumnStretch(1, 2); |
|
624 |
pageLayout->setColumnStretch(2, 1); |
|
625 |
||
626 |
BtnStartTrain = new QPushButton(this); |
|
627 |
BtnStartTrain->setFont(*font14); |
|
628 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
629 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
630 |
||
1153 | 631 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 632 |
} |
633 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
634 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 635 |
AbstractPage(parent) |
600 | 636 |
{ |
637 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
638 |
|
1576
a02353129a41
Check for deprecated ammo schemes at startup and delete them
unc0rr
parents:
1522
diff
changeset
|
639 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size(), this); |
718 | 640 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 641 |
|
1168 | 642 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 643 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
644 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 645 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
1443 | 646 |
BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
600 | 647 |
} |
648 |
||
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
|
649 |
PageInGame::PageInGame(QWidget* parent) : |
686 | 650 |
AbstractPage(parent) |
651 |
{ |
|
652 |
QLabel * label = new QLabel(this); |
|
653 |
label->setText("In game..."); |
|
654 |
} |
|
1311 | 655 |
|
656 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
|
657 |
AbstractPage(parent) |
|
658 |
{ |
|
1312 | 659 |
QGridLayout * pageLayout = new QGridLayout(this); |
1314 | 660 |
|
661 |
roomName = new QLineEdit(this); |
|
1334
b58afaadf7ae
Send team removal message to others in room when client disconnects
unc0rr
parents:
1315
diff
changeset
|
662 |
roomName->setMaxLength(60); |
1314 | 663 |
pageLayout->addWidget(roomName, 0, 0); |
1399 | 664 |
|
665 |
roomsList = new QTableWidget(this); |
|
666 |
roomsList->setColumnCount(3); |
|
667 |
roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
|
668 |
roomsList->verticalHeader()->setVisible(false); |
|
669 |
roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
|
670 |
roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
|
1522 | 671 |
pageLayout->addWidget(roomsList, 1, 0, 3, 1); |
1584
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
672 |
pageLayout->setRowStretch(2, 100); |
1399 | 673 |
|
1584
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
674 |
chatWidget = new HWChatWidget(this); |
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
675 |
pageLayout->addWidget(chatWidget, 4, 0, 1, 2); |
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
676 |
pageLayout->setRowStretch(4, 350); |
1522 | 677 |
|
1584
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
678 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
1312 | 679 |
BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
680 |
BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
|
1522 | 681 |
BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1); |
1314 | 682 |
|
683 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
|
684 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
|
1315 | 685 |
connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
1314 | 686 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
1311 | 687 |
} |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
688 |
|
1377 | 689 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
690 |
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
|
691 |
{ |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
692 |
roomsList->clear(); |
1399 | 693 |
roomsList->setHorizontalHeaderLabels( |
694 |
QStringList() << |
|
695 |
QTableWidget::tr("Room name") << |
|
696 |
QTableWidget::tr("Players number") << |
|
697 |
QTableWidget::tr("Round in progress") |
|
698 |
); |
|
699 |
||
700 |
if (list.size() % 3) |
|
701 |
return; |
|
702 |
||
703 |
roomsList->setRowCount(list.size() / 3); |
|
704 |
for(int i = 0; i < list.size(); i += 3) |
|
705 |
for(int t = 0; t < 3; t++) |
|
706 |
{ |
|
707 |
QTableWidgetItem * item = new QTableWidgetItem(list[i + t]); |
|
708 |
item->setFlags(Qt::ItemIsSelectable); |
|
1400 | 709 |
roomsList->setItem(i / 3, t, item); |
1399 | 710 |
} |
711 |
//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
|
712 |
} |
1314 | 713 |
|
714 |
void PageRoomsList::onCreateClick() |
|
715 |
{ |
|
716 |
if (roomName->text().size()) |
|
717 |
emit askForCreateRoom(roomName->text()); |
|
718 |
else |
|
719 |
QMessageBox::critical(this, |
|
720 |
tr("Error"), |
|
1315 | 721 |
tr("Please, enter room name"), |
1314 | 722 |
tr("OK")); |
723 |
} |
|
724 |
||
725 |
void PageRoomsList::onJoinClick() |
|
726 |
{ |
|
1399 | 727 |
QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
1314 | 728 |
if (!curritem) |
729 |
{ |
|
730 |
QMessageBox::critical(this, |
|
731 |
tr("Error"), |
|
732 |
tr("Please, select room from the list"), |
|
733 |
tr("OK")); |
|
734 |
return ; |
|
735 |
} |
|
736 |
emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
737 |
} |
|
738 |
||
1315 | 739 |
void PageRoomsList::onRefreshClick() |
740 |
{ |
|
741 |
emit askForRoomList(); |
|
742 |
} |
|
743 |