author | unc0rr |
Mon, 12 Jan 2009 21:49:41 +0000 | |
changeset 1655 | 16f687fc18e3 |
parent 1649 | 938a0fda0206 |
child 1659 | fd593a5e71fb |
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); |
|
1644 | 276 |
pageLayout->setRowStretch(1, 100); |
719 | 277 |
pageLayout->setRowStretch(2, 0); |
1644 | 278 |
pageLayout->setContentsMargins(7, 7, 7, 0); |
279 |
pageLayout->setSpacing(0); |
|
427 | 280 |
|
1198 | 281 |
|
282 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
283 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
1644 | 284 |
QGridLayout * gbTBLayout = new QGridLayout(gbTwoBoxes); |
285 |
gbTBLayout->setMargin(0); |
|
286 |
gbTBLayout->setSpacing(0); |
|
1198 | 287 |
{ |
288 |
teamsBox = new IconedGroupBox(this); |
|
289 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
|
290 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
291 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
292 |
||
1644 | 293 |
QVBoxLayout * GBTlayout = new QVBoxLayout(teamsBox); |
1198 | 294 |
|
295 |
CBTeamName = new QComboBox(teamsBox); |
|
1644 | 296 |
GBTlayout->addWidget(CBTeamName); |
184 | 297 |
|
1644 | 298 |
QHBoxLayout * layout1 = new QHBoxLayout; |
299 |
GBTlayout->addLayout(layout1); |
|
300 |
BtnNewTeam = addButton(tr("New team"), layout1, 0); |
|
301 |
BtnEditTeam = addButton(tr("Edit team"), layout1, 1); |
|
302 |
layout1->setStretchFactor(BtnNewTeam, 100); |
|
303 |
layout1->setStretchFactor(BtnEditTeam, 100); |
|
304 |
||
305 |
QHBoxLayout * layout2 = new QHBoxLayout; |
|
306 |
GBTlayout->addLayout(layout2); |
|
1199 | 307 |
|
308 |
labelNN = new QLabel(teamsBox); |
|
309 |
labelNN->setText(QLabel::tr("Net nick")); |
|
1644 | 310 |
layout2->addWidget(labelNN); |
1199 | 311 |
|
312 |
editNetNick = new QLineEdit(teamsBox); |
|
313 |
editNetNick->setMaxLength(20); |
|
314 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
1644 | 315 |
layout2->addWidget(editNetNick); |
1199 | 316 |
|
1644 | 317 |
gbTBLayout->addWidget(teamsBox, 0, 0); |
1198 | 318 |
} |
184 | 319 |
|
1198 | 320 |
{ |
321 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1199 | 322 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 323 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 324 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 325 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
326 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 327 |
|
1198 | 328 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
329 |
WeaponsName = new QComboBox(this); |
|
330 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
331 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
1644 | 332 |
gbTBLayout->addWidget(groupWeapons, 1, 0); |
1198 | 333 |
} |
184 | 334 |
|
1644 | 335 |
{ |
336 |
AGGroupBox = new IconedGroupBox(this); |
|
337 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
338 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
339 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
184 | 340 |
|
1644 | 341 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
342 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
|
343 |
QLabel * resolution = new QLabel(AGGroupBox); |
|
344 |
resolution->setText(QLabel::tr("Resolution")); |
|
345 |
GBAreslayout->addWidget(resolution); |
|
427 | 346 |
|
1644 | 347 |
CBResolution = new QComboBox(AGGroupBox); |
348 |
GBAreslayout->addWidget(CBResolution); |
|
349 |
GBAlayout->addLayout(GBAreslayout); |
|
427 | 350 |
|
1644 | 351 |
QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); |
352 |
QLabel * maxfps = new QLabel(AGGroupBox); |
|
353 |
maxfps->setText(QLabel::tr("FPS limit")); |
|
354 |
GBAfpslayout->addWidget(maxfps); |
|
355 |
GBAlayout->addLayout(GBAfpslayout); |
|
184 | 356 |
|
1644 | 357 |
CBFullscreen = new QCheckBox(AGGroupBox); |
358 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
359 |
GBAlayout->addWidget(CBFullscreen); |
|
184 | 360 |
|
1644 | 361 |
CBFrontendFullscreen = new QCheckBox(AGGroupBox); |
362 |
CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); |
|
363 |
GBAlayout->addWidget(CBFrontendFullscreen); |
|
1162 | 364 |
|
1644 | 365 |
CBEnableSound = new QCheckBox(AGGroupBox); |
366 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
|
367 |
GBAlayout->addWidget(CBEnableSound); |
|
184 | 368 |
|
1644 | 369 |
CBEnableMusic = new QCheckBox(AGGroupBox); |
370 |
CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
|
371 |
GBAlayout->addWidget(CBEnableMusic); |
|
1129 | 372 |
|
1644 | 373 |
CBShowFPS = new QCheckBox(AGGroupBox); |
374 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
375 |
GBAlayout->addWidget(CBShowFPS); |
|
297 | 376 |
|
1644 | 377 |
CBAltDamage = new QCheckBox(AGGroupBox); |
378 |
CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); |
|
379 |
GBAlayout->addWidget(CBAltDamage); |
|
529 | 380 |
|
1644 | 381 |
CBNameWithDate = new QCheckBox(AGGroupBox); |
382 |
CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name")); |
|
383 |
GBAlayout->addWidget(CBNameWithDate); |
|
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1457
diff
changeset
|
384 |
|
1644 | 385 |
fpsedit = new FPSEdit(AGGroupBox); |
386 |
GBAfpslayout->addWidget(fpsedit); |
|
387 |
gbTBLayout->addWidget(AGGroupBox, 0, 1, 2, 1); |
|
388 |
} |
|
184 | 389 |
|
1644 | 390 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 2, 2, true); |
1443 | 391 |
BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
184 | 392 |
|
1644 | 393 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
184 | 394 |
} |
395 |
||
1153 | 396 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 397 |
{ |
398 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
399 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
400 |
pageLayout->setColumnStretch(0, 1); |
|
401 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 402 |
pageLayout->setColumnStretch(2, 1); |
421 | 403 |
|
404 |
BtnNetSvrStart = new QPushButton(this); |
|
405 |
BtnNetSvrStart->setFont(*font14); |
|
406 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
1415
6fbfee0e113a
Allow build without net game server: introduce -DWITH_SERVER configuration parameter
unc0rr
parents:
1409
diff
changeset
|
407 |
BtnNetSvrStart->setVisible(haveServer); |
1395 | 408 |
pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
409 |
||
410 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
|
184 | 411 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
412 |
ConnGroupBox = new QGroupBox(this); |
421 | 413 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
414 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
415 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 416 |
GBClayout->setColumnStretch(0, 1); |
421 | 417 |
GBClayout->setColumnStretch(1, 1); |
418 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 419 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
420 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 421 |
BtnNetConnect->setFont(*font14); |
422 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 423 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 424 |
|
665 | 425 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
426 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 427 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 428 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
429 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
430 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
431 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 432 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 433 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
434 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
435 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
436 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
437 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
438 |
|
1395 | 439 |
BtnOfficialServer = new QPushButton(ConnGroupBox); |
440 |
BtnOfficialServer->setFont(*font14); |
|
441 |
BtnOfficialServer->setText(QPushButton::tr("Join official server")); |
|
442 |
GBClayout->addWidget(BtnOfficialServer, 3, 0, 1, 3); |
|
636 | 443 |
|
668 | 444 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 445 |
} |
446 |
||
646 | 447 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
448 |
{ |
1310 | 449 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
659 | 450 |
|
673 | 451 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
452 |
||
665 | 453 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
454 |
|
665 | 455 |
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
|
456 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 457 |
} |
458 |
||
459 |
void PageNet::slotConnect() |
|
460 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
461 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
462 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
463 |
if(!mi.isValid()) |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
464 |
{ |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
465 |
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
|
466 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
467 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
468 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
469 |
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
|
470 |
|
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
|
471 |
emit connectClicked(host, port); |
646 | 472 |
} |
473 |
||
1153 | 474 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 475 |
{ |
476 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
477 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
478 |
pageLayout->setColumnStretch(0, 1); |
|
479 |
pageLayout->setColumnStretch(1, 1); |
|
480 |
pageLayout->setColumnStretch(2, 1); |
|
481 |
||
675 | 482 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
483 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
484 |
|
1153 | 485 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 486 |
|
487 |
BtnStart = new QPushButton(this); |
|
488 |
BtnStart->setFont(*font14); |
|
489 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 490 |
pageLayout->addWidget(BtnStart, 1, 2); |
491 |
||
492 |
QWidget * wg = new QWidget(this); |
|
493 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
494 |
|
675 | 495 |
QGridLayout * wgLayout = new QGridLayout(wg); |
496 |
wgLayout->setColumnStretch(0, 1); |
|
497 |
wgLayout->setColumnStretch(1, 3); |
|
498 |
wgLayout->setColumnStretch(2, 1); |
|
499 |
||
500 |
wgLayout->setRowStretch(0, 0); |
|
501 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
502 |
|
675 | 503 |
QGroupBox * gb = new QGroupBox(wg); |
504 |
wgLayout->addWidget(gb, 0, 1); |
|
505 |
||
506 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
507 |
||
508 |
labelSD = new QLabel(gb); |
|
509 |
labelSD->setText(QLabel::tr("Server name:")); |
|
510 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
511 |
|
675 | 512 |
leServerDescr = new QLineEdit(gb); |
513 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
514 |
||
515 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
516 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 517 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
518 |
|
675 | 519 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
520 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
521 |
sbPort->setMaximum(65535); |
675 | 522 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
523 |
|
675 | 524 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
525 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 526 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
527 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
528 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
529 |
} |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
530 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
531 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
532 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
533 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
534 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
535 |
|
1153 | 536 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 537 |
{ |
538 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
539 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 540 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 541 |
//pageLayout->setSpacing(1); |
463 | 542 |
pageLayout->setColumnStretch(0, 50); |
543 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 544 |
|
461 | 545 |
// chatwidget |
546 |
pChatWidget = new HWChatWidget(this); |
|
1647 | 547 |
pageLayout->addWidget(pChatWidget, 1, 0, 1, 2); |
464 | 548 |
pageLayout->setRowStretch(1, 100); |
453 | 549 |
|
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
550 |
pGameCFG = new GameCFGWidget(this); |
322 | 551 |
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
|
552 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
553 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 554 |
pNetTeamsWidget->setAcceptOuter(true); |
1647 | 555 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1); |
184 | 556 |
|
1649 | 557 |
|
558 |
QHBoxLayout * bottomLayout = new QHBoxLayout; |
|
559 |
pageLayout->addLayout(bottomLayout, 3, 0, 1, 2); |
|
560 |
||
561 |
BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true); |
|
562 |
||
646 | 563 |
BtnGo = new QPushButton(this); |
184 | 564 |
BtnGo->setFont(*font14); |
1648 | 565 |
//BtnGo->setText(QPushButton::tr("Ready")); |
566 |
BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
|
567 |
BtnGo->setIconSize(QSize(25, 34)); |
|
1649 | 568 |
BtnGo->setMinimumWidth(50); |
569 |
BtnGo->setMinimumHeight(50); |
|
570 |
bottomLayout->addWidget(BtnGo, 2); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
571 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
572 |
|
1649 | 573 |
BtnMaster = addButton(tr("Control"), bottomLayout, 3); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
574 |
QMenu * menu = new QMenu(BtnMaster); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
575 |
startGame = new QAction(QAction::tr("Start"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
576 |
restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
577 |
restrictJoins->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
578 |
restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
579 |
restrictTeamAdds->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
580 |
menu->addAction(startGame); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
581 |
menu->addAction(restrictJoins); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
582 |
menu->addAction(restrictTeamAdds); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
583 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
584 |
BtnMaster->setMenu(menu); |
1649 | 585 |
|
586 |
bottomLayout->insertStretch(1, 100); |
|
184 | 587 |
} |
187 | 588 |
|
1648 | 589 |
void PageNetGame::setReadyStatus(bool isReady) |
590 |
{ |
|
591 |
if(isReady) |
|
592 |
BtnGo->setIcon(QIcon(":/res/lightbulb_on.png")); |
|
593 |
else |
|
594 |
BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
|
595 |
} |
|
596 |
||
1649 | 597 |
void PageNetGame::setMasterMode(bool isMaster) |
598 |
{ |
|
599 |
BtnMaster->setVisible(isMaster); |
|
600 |
} |
|
601 |
||
1153 | 602 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 603 |
{ |
604 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
605 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
606 |
pageLayout->setColumnStretch(0, 1); |
|
607 |
pageLayout->setColumnStretch(1, 1); |
|
608 |
pageLayout->setColumnStretch(2, 1); |
|
609 |
||
1153 | 610 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 611 |
|
612 |
about = new About(this); |
|
613 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
614 |
} |
|
306 | 615 |
|
1150 | 616 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 617 |
{ |
618 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
1443 | 619 |
QVBoxLayout * vLayout = new QVBoxLayout(this); |
620 |
QHBoxLayout * topLine = new QHBoxLayout(); |
|
621 |
QHBoxLayout * middleLine = new QHBoxLayout(); |
|
622 |
QHBoxLayout * bottomLine = new QHBoxLayout(); |
|
1444 | 623 |
vLayout->addStretch(); |
1443 | 624 |
vLayout->addLayout(topLine); |
1457 | 625 |
vLayout->addSpacing(30); |
1443 | 626 |
vLayout->addLayout(middleLine); |
1444 | 627 |
vLayout->addStretch(); |
1443 | 628 |
vLayout->addLayout(bottomLine); |
586 | 629 |
|
1457 | 630 |
topLine->addStretch(); |
1443 | 631 |
BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); |
1450 | 632 |
BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); |
1457 | 633 |
topLine->addSpacing(60); |
1443 | 634 |
BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); |
1450 | 635 |
BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); |
1457 | 636 |
topLine->addStretch(); |
637 |
||
638 |
||
1443 | 639 |
BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true); |
1450 | 640 |
BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT")); |
1443 | 641 |
|
642 |
BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true); |
|
1444 | 643 |
bottomLine->addStretch(); |
644 |
||
1447 | 645 |
BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); |
1450 | 646 |
BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); |
1443 | 647 |
BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true); |
648 |
BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
|
1450 | 649 |
BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); |
586 | 650 |
} |
651 |
||
1153 | 652 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 653 |
{ |
654 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
655 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
656 |
pageLayout->setColumnStretch(0, 1); |
|
657 |
pageLayout->setColumnStretch(1, 2); |
|
658 |
pageLayout->setColumnStretch(2, 1); |
|
659 |
||
660 |
BtnStartTrain = new QPushButton(this); |
|
661 |
BtnStartTrain->setFont(*font14); |
|
662 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
663 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
664 |
||
1153 | 665 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 666 |
} |
667 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
668 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 669 |
AbstractPage(parent) |
600 | 670 |
{ |
671 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
672 |
|
1576
a02353129a41
Check for deprecated ammo schemes at startup and delete them
unc0rr
parents:
1522
diff
changeset
|
673 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size(), this); |
718 | 674 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 675 |
|
1168 | 676 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 677 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
678 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 679 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
1443 | 680 |
BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
600 | 681 |
} |
682 |
||
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
|
683 |
PageInGame::PageInGame(QWidget* parent) : |
686 | 684 |
AbstractPage(parent) |
685 |
{ |
|
686 |
QLabel * label = new QLabel(this); |
|
687 |
label->setText("In game..."); |
|
688 |
} |
|
1311 | 689 |
|
690 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
|
691 |
AbstractPage(parent) |
|
692 |
{ |
|
1312 | 693 |
QGridLayout * pageLayout = new QGridLayout(this); |
1314 | 694 |
|
695 |
roomName = new QLineEdit(this); |
|
1334
b58afaadf7ae
Send team removal message to others in room when client disconnects
unc0rr
parents:
1315
diff
changeset
|
696 |
roomName->setMaxLength(60); |
1314 | 697 |
pageLayout->addWidget(roomName, 0, 0); |
1399 | 698 |
|
699 |
roomsList = new QTableWidget(this); |
|
700 |
roomsList->setColumnCount(3); |
|
701 |
roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
|
702 |
roomsList->verticalHeader()->setVisible(false); |
|
703 |
roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
|
704 |
roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
|
1522 | 705 |
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
|
706 |
pageLayout->setRowStretch(2, 100); |
1399 | 707 |
|
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
|
708 |
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
|
709 |
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
|
710 |
pageLayout->setRowStretch(4, 350); |
1522 | 711 |
|
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
|
712 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
1312 | 713 |
BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
714 |
BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
|
1522 | 715 |
BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1); |
1314 | 716 |
|
717 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
|
718 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
|
1315 | 719 |
connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
1314 | 720 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
1311 | 721 |
} |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
722 |
|
1377 | 723 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
724 |
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
|
725 |
{ |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
726 |
roomsList->clear(); |
1399 | 727 |
roomsList->setHorizontalHeaderLabels( |
728 |
QStringList() << |
|
729 |
QTableWidget::tr("Room name") << |
|
730 |
QTableWidget::tr("Players number") << |
|
731 |
QTableWidget::tr("Round in progress") |
|
732 |
); |
|
733 |
||
734 |
if (list.size() % 3) |
|
735 |
return; |
|
736 |
||
737 |
roomsList->setRowCount(list.size() / 3); |
|
738 |
for(int i = 0; i < list.size(); i += 3) |
|
739 |
for(int t = 0; t < 3; t++) |
|
740 |
{ |
|
741 |
QTableWidgetItem * item = new QTableWidgetItem(list[i + t]); |
|
742 |
item->setFlags(Qt::ItemIsSelectable); |
|
1400 | 743 |
roomsList->setItem(i / 3, t, item); |
1399 | 744 |
} |
745 |
//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
|
746 |
} |
1314 | 747 |
|
748 |
void PageRoomsList::onCreateClick() |
|
749 |
{ |
|
750 |
if (roomName->text().size()) |
|
751 |
emit askForCreateRoom(roomName->text()); |
|
752 |
else |
|
753 |
QMessageBox::critical(this, |
|
754 |
tr("Error"), |
|
1315 | 755 |
tr("Please, enter room name"), |
1314 | 756 |
tr("OK")); |
757 |
} |
|
758 |
||
759 |
void PageRoomsList::onJoinClick() |
|
760 |
{ |
|
1399 | 761 |
QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
1314 | 762 |
if (!curritem) |
763 |
{ |
|
764 |
QMessageBox::critical(this, |
|
765 |
tr("Error"), |
|
766 |
tr("Please, select room from the list"), |
|
767 |
tr("OK")); |
|
768 |
return ; |
|
769 |
} |
|
770 |
emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
771 |
} |
|
772 |
||
1315 | 773 |
void PageRoomsList::onRefreshClick() |
774 |
{ |
|
775 |
emit askForRoomList(); |
|
776 |
} |
|
777 |