author | unc0rr |
Sun, 26 Oct 2008 17:18:58 +0000 | |
changeset 1425 | 7ee750565e2d |
parent 1415 | 6fbfee0e113a |
child 1440 | 6439fa9af904 |
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); |
1150 | 76 |
pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
184 | 77 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
78 |
BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
1150 | 79 |
pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
579 | 80 |
|
1199 | 81 |
BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true); |
184 | 82 |
|
1199 | 83 |
//BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
84 |
BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
1212 | 85 |
BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
1150 | 86 |
pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
1199 | 87 |
//pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
184 | 88 |
|
1199 | 89 |
BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
184 | 90 |
} |
91 |
||
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
730
diff
changeset
|
92 |
PageEditTeam::PageEditTeam(QWidget* parent) : |
692 | 93 |
AbstractPage(parent) |
184 | 94 |
{ |
95 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1252 | 96 |
QTabWidget * tbw = new QTabWidget(this); |
1389 | 97 |
QWidget * page1 = new QWidget(this); |
98 |
QWidget * page2 = new QWidget(this); |
|
1252 | 99 |
tbw->addTab(page1, tr("General")); |
100 |
tbw->addTab(page2, tr("Advanced")); |
|
101 |
pageLayout->addWidget(tbw, 0, 0, 1, 3); |
|
102 |
BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
|
103 |
BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);; |
|
184 | 104 |
|
1252 | 105 |
QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
106 |
page1Layout->setAlignment(Qt::AlignTop); |
|
107 |
QGridLayout * page2Layout = new QGridLayout(page2); |
|
108 |
||
109 |
// ====== Page 1 ====== |
|
110 |
QVBoxLayout * vbox1 = new QVBoxLayout(); |
|
111 |
QVBoxLayout * vbox2 = new QVBoxLayout(); |
|
112 |
QVBoxLayout * vbox3 = new QVBoxLayout(); |
|
113 |
page1Layout->addLayout(vbox1); |
|
114 |
page1Layout->addLayout(vbox2); |
|
115 |
page1Layout->addLayout(vbox3); |
|
116 |
||
588 | 117 |
GBoxHedgehogs = new QGroupBox(this); |
184 | 118 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
119 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
120 |
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
|
121 |
|
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
122 |
HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
184 | 123 |
for(int i = 0; i < 8; i++) |
124 |
{ |
|
125 |
HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
|
1216
df1b19976e28
Allow team and hh name length be up to 64 letters length
unc0rr
parents:
1212
diff
changeset
|
126 |
HHNameEdit[i]->setMaxLength(64); |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
127 |
HHNameEdit[i]->setMinimumWidth(120); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
128 |
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
|
129 |
|
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
130 |
HHHats[i] = new QComboBox(GBoxHedgehogs); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
131 |
HHHats[i]->setModel(hatsModel); |
1282 | 132 |
HHHats[i]->setIconSize(QSize(32, 37)); |
133 |
//HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
|
1239 | 134 |
//HHHats[i]->setModelColumn(1); |
1240 | 135 |
//HHHats[i]->setMinimumWidth(132); |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
136 |
GBHLayout->addWidget(HHHats[i], i, 1); |
184 | 137 |
} |
1252 | 138 |
vbox1->addWidget(GBoxHedgehogs); |
139 |
||
140 |
||
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
141 |
GBoxTeam = new QGroupBox(this); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
142 |
GBoxTeam->setTitle(QGroupBox::tr("Team")); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
143 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
144 |
QVBoxLayout * GBTLayout = new QVBoxLayout(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
145 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
146 |
TeamNameEdit->setMaxLength(64); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
147 |
GBTLayout->addWidget(TeamNameEdit); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
148 |
vbox2->addWidget(GBoxTeam); |
1252 | 149 |
|
1290 | 150 |
CBTeamLvl = new QComboBox(GBoxTeam); |
1287 | 151 |
CBTeamLvl->setIconSize(QSize(32, 32)); |
152 |
CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
|
153 |
for(int i = 5; i > 0; i--) |
|
154 |
CBTeamLvl->addItem( |
|
155 |
QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
|
156 |
QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
|
157 |
); |
|
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
158 |
GBTLayout->addWidget(CBTeamLvl); |
1287 | 159 |
|
1290 | 160 |
CBGrave = new QComboBox(GBoxTeam); |
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
161 |
CBGrave->setMaxCount(65535); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
162 |
CBGrave->setIconSize(QSize(32, 32)); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
163 |
GBTLayout->addWidget(CBGrave); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
164 |
|
1252 | 165 |
GBoxFort = new QGroupBox(this); |
166 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
|
167 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
|
168 |
CBFort = new QComboBox(GBoxFort); |
|
169 |
CBFort->setMaxCount(65535); |
|
170 |
GBFLayout->addWidget(CBFort, 0, 0); |
|
171 |
FortPreview = new SquareLabel(GBoxFort); |
|
172 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
173 |
FortPreview->setPixmap(QPixmap()); |
|
174 |
GBFLayout->addWidget(FortPreview, 1, 0); |
|
175 |
vbox3->addWidget(GBoxFort); |
|
176 |
||
177 |
QDir tmpdir; |
|
178 |
tmpdir.cd(datadir->absolutePath()); |
|
179 |
tmpdir.cd("Forts"); |
|
180 |
tmpdir.setFilter(QDir::Files); |
|
181 |
||
1287 | 182 |
connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
1252 | 183 |
CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
1287 | 184 |
|
1252 | 185 |
tmpdir.cd("../Graphics/Graves"); |
186 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
187 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
188 |
{ |
|
1287 | 189 |
QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); |
190 |
QIcon icon(pix.copy(0, 0, 32, 32)); |
|
191 |
CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
|
1252 | 192 |
} |
193 |
||
194 |
vbox1->addStretch(); |
|
195 |
vbox2->addStretch(); |
|
196 |
// vbox3->addStretch(); |
|
197 |
||
198 |
// ====== Page 2 ====== |
|
588 | 199 |
GBoxBinds = new QGroupBox(this); |
184 | 200 |
GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
201 |
QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
|
202 |
BindsBox = new QToolBox(GBoxBinds); |
|
203 |
BindsBox->setLineWidth(0); |
|
204 |
GBBLayout->addWidget(BindsBox); |
|
1389 | 205 |
page_A = new QWidget(this); |
184 | 206 |
BindsBox->addItem(page_A, QToolBox::tr("Actions")); |
1389 | 207 |
page_W = new QWidget(this); |
184 | 208 |
BindsBox->addItem(page_W, QToolBox::tr("Weapons")); |
1389 | 209 |
page_WP = new QWidget(this); |
184 | 210 |
BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); |
1389 | 211 |
page_O = new QWidget(this); |
184 | 212 |
BindsBox->addItem(page_O, QToolBox::tr("Other")); |
1252 | 213 |
page2Layout->addWidget(GBoxBinds, 0, 0); |
184 | 214 |
|
215 |
QStringList binds; |
|
216 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
217 |
{ |
|
218 |
binds << sdlkeys[i][1]; |
|
219 |
} |
|
220 |
||
221 |
quint16 widind = 0, i = 0; |
|
222 |
while (i < BINDS_NUMBER) { |
|
223 |
quint16 num = 0; |
|
1389 | 224 |
QWidget * curW = BindsBox->widget(widind); |
225 |
QGridLayout * pagelayout = new QGridLayout(curW); |
|
184 | 226 |
do { |
1389 | 227 |
LBind[i] = new QLabel(curW); |
184 | 228 |
LBind[i]->setText(QApplication::translate("binds", cbinds[i].name)); |
229 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
230 |
pagelayout->addWidget(LBind[i], num, 0); |
|
1389 | 231 |
CBBind[i] = new QComboBox(curW); |
184 | 232 |
CBBind[i]->addItems(binds); |
233 |
pagelayout->addWidget(CBBind[i], num, 1); |
|
234 |
num++; |
|
235 |
} while (!cbinds[i++].chwidget); |
|
1389 | 236 |
pagelayout->addWidget(new QWidget(curW), num, 0, 1, 2); |
184 | 237 |
widind++; |
238 |
} |
|
239 |
} |
|
240 |
||
241 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
|
242 |
{ |
|
243 |
QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
|
244 |
FortPreview->setPixmap(pix); |
|
245 |
} |
|
246 |
||
1287 | 247 |
PageMultiplayer::PageMultiplayer(QWidget* parent) : |
692 | 248 |
AbstractPage(parent) |
184 | 249 |
{ |
250 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
251 |
||
1218 | 252 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
187 | 253 |
|
184 | 254 |
gameCFG = new GameCFGWidget(this); |
255 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
696 | 256 |
|
1218 | 257 |
pageLayout->setRowStretch(1, 1); |
258 |
||
184 | 259 |
teamsSelect = new TeamSelWidget(this); |
1218 | 260 |
pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
184 | 261 |
|
1218 | 262 |
BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
184 | 263 |
} |
264 |
||
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
|
265 |
PageOptions::PageOptions(QWidget* parent) : |
692 | 266 |
AbstractPage(parent) |
184 | 267 |
{ |
268 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
427 | 269 |
pageLayout->setColumnStretch(0, 100); |
270 |
pageLayout->setColumnStretch(1, 100); |
|
271 |
pageLayout->setColumnStretch(2, 100); |
|
272 |
pageLayout->setRowStretch(0, 0); |
|
273 |
pageLayout->setRowStretch(1, 0); |
|
719 | 274 |
pageLayout->setRowStretch(2, 0); |
275 |
pageLayout->setRowStretch(3, 100); |
|
276 |
pageLayout->setRowStretch(4, 0); |
|
427 | 277 |
|
1198 | 278 |
|
279 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
280 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
281 |
QHBoxLayout * gbTBLayout = new QHBoxLayout(gbTwoBoxes); |
|
282 |
{ |
|
283 |
teamsBox = new IconedGroupBox(this); |
|
284 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
|
285 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
286 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
287 |
||
288 |
QGridLayout * GBTlayout = new QGridLayout(teamsBox); |
|
289 |
||
290 |
BtnNewTeam = addButton(tr("New team"), GBTlayout, 1, 0); |
|
291 |
||
292 |
CBTeamName = new QComboBox(teamsBox); |
|
293 |
GBTlayout->addWidget(CBTeamName, 0, 0, 1, 2); |
|
184 | 294 |
|
1198 | 295 |
BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 1, 1); |
1199 | 296 |
|
297 |
labelNN = new QLabel(teamsBox); |
|
298 |
labelNN->setText(QLabel::tr("Net nick")); |
|
299 |
GBTlayout->addWidget(labelNN, 2, 0, 1, 2); |
|
300 |
||
301 |
editNetNick = new QLineEdit(teamsBox); |
|
302 |
editNetNick->setMaxLength(20); |
|
303 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
304 |
GBTlayout->addWidget(editNetNick, 3, 0, 1, 2); |
|
305 |
||
1198 | 306 |
gbTBLayout->addWidget(teamsBox); |
307 |
} |
|
184 | 308 |
|
1198 | 309 |
{ |
310 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1199 | 311 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 312 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 313 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 314 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
315 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 316 |
|
1198 | 317 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
318 |
WeaponsName = new QComboBox(this); |
|
319 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
320 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
321 |
gbTBLayout->addWidget(groupWeapons); |
|
322 |
} |
|
184 | 323 |
|
1193 | 324 |
AGGroupBox = new IconedGroupBox(this); |
325 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
184 | 326 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
327 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
693 | 328 |
pageLayout->addWidget(AGGroupBox, 2, 1); |
184 | 329 |
|
427 | 330 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
436 | 331 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
427 | 332 |
QLabel * resolution = new QLabel(AGGroupBox); |
333 |
resolution->setText(QLabel::tr("Resolution")); |
|
334 |
GBAreslayout->addWidget(resolution); |
|
335 |
||
184 | 336 |
CBResolution = new QComboBox(AGGroupBox); |
427 | 337 |
GBAreslayout->addWidget(CBResolution); |
338 |
GBAlayout->addLayout(GBAreslayout); |
|
339 |
||
436 | 340 |
QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); |
427 | 341 |
QLabel * maxfps = new QLabel(AGGroupBox); |
342 |
maxfps->setText(QLabel::tr("FPS limit")); |
|
343 |
GBAfpslayout->addWidget(maxfps); |
|
344 |
GBAlayout->addLayout(GBAfpslayout); |
|
184 | 345 |
|
346 |
CBFullscreen = new QCheckBox(AGGroupBox); |
|
347 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
427 | 348 |
GBAlayout->addWidget(CBFullscreen); |
184 | 349 |
|
1162 | 350 |
CBFrontendFullscreen = new QCheckBox(AGGroupBox); |
351 |
CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); |
|
352 |
GBAlayout->addWidget(CBFrontendFullscreen); |
|
353 |
||
1157 | 354 |
CBEnableSound = new QCheckBox(AGGroupBox); |
184 | 355 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
427 | 356 |
GBAlayout->addWidget(CBEnableSound); |
184 | 357 |
|
1157 | 358 |
CBEnableMusic = new QCheckBox(AGGroupBox); |
1129 | 359 |
CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
360 |
GBAlayout->addWidget(CBEnableMusic); |
|
361 |
||
297 | 362 |
CBShowFPS = new QCheckBox(AGGroupBox); |
363 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
427 | 364 |
GBAlayout->addWidget(CBShowFPS); |
297 | 365 |
|
529 | 366 |
CBAltDamage = new QCheckBox(AGGroupBox); |
367 |
CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); |
|
368 |
GBAlayout->addWidget(CBAltDamage); |
|
369 |
||
297 | 370 |
fpsedit = new FPSEdit(AGGroupBox); |
427 | 371 |
GBAfpslayout->addWidget(fpsedit); |
184 | 372 |
|
1157 | 373 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 4, 2, true); |
184 | 374 |
|
1153 | 375 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
184 | 376 |
} |
377 |
||
1153 | 378 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 379 |
{ |
380 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
381 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
382 |
pageLayout->setColumnStretch(0, 1); |
|
383 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 384 |
pageLayout->setColumnStretch(2, 1); |
421 | 385 |
|
386 |
BtnNetSvrStart = new QPushButton(this); |
|
387 |
BtnNetSvrStart->setFont(*font14); |
|
388 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
1415
6fbfee0e113a
Allow build without net game server: introduce -DWITH_SERVER configuration parameter
unc0rr
parents:
1409
diff
changeset
|
389 |
BtnNetSvrStart->setVisible(haveServer); |
1395 | 390 |
pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
391 |
||
392 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
|
184 | 393 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
394 |
ConnGroupBox = new QGroupBox(this); |
421 | 395 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
396 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
397 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 398 |
GBClayout->setColumnStretch(0, 1); |
421 | 399 |
GBClayout->setColumnStretch(1, 1); |
400 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 401 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
402 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 403 |
BtnNetConnect->setFont(*font14); |
404 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 405 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 406 |
|
665 | 407 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
408 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 409 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 410 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
411 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
412 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
413 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 414 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 415 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
416 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
417 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
418 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
419 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
420 |
|
1395 | 421 |
BtnOfficialServer = new QPushButton(ConnGroupBox); |
422 |
BtnOfficialServer->setFont(*font14); |
|
423 |
BtnOfficialServer->setText(QPushButton::tr("Join official server")); |
|
424 |
GBClayout->addWidget(BtnOfficialServer, 3, 0, 1, 3); |
|
636 | 425 |
|
668 | 426 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 427 |
} |
428 |
||
646 | 429 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
430 |
{ |
1310 | 431 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
659 | 432 |
|
673 | 433 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
434 |
||
665 | 435 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
436 |
|
665 | 437 |
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
|
438 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 439 |
} |
440 |
||
441 |
void PageNet::slotConnect() |
|
442 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
443 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
444 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
445 |
if(!mi.isValid()) |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
446 |
{ |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
447 |
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
|
448 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
449 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
450 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
451 |
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
|
452 |
|
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
|
453 |
emit connectClicked(host, port); |
646 | 454 |
} |
455 |
||
1153 | 456 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 457 |
{ |
458 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
459 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
460 |
pageLayout->setColumnStretch(0, 1); |
|
461 |
pageLayout->setColumnStretch(1, 1); |
|
462 |
pageLayout->setColumnStretch(2, 1); |
|
463 |
||
675 | 464 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
465 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
466 |
|
1153 | 467 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 468 |
|
469 |
BtnStart = new QPushButton(this); |
|
470 |
BtnStart->setFont(*font14); |
|
471 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 472 |
pageLayout->addWidget(BtnStart, 1, 2); |
473 |
||
474 |
QWidget * wg = new QWidget(this); |
|
475 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
476 |
|
675 | 477 |
QGridLayout * wgLayout = new QGridLayout(wg); |
478 |
wgLayout->setColumnStretch(0, 1); |
|
479 |
wgLayout->setColumnStretch(1, 3); |
|
480 |
wgLayout->setColumnStretch(2, 1); |
|
481 |
||
482 |
wgLayout->setRowStretch(0, 0); |
|
483 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
484 |
|
675 | 485 |
QGroupBox * gb = new QGroupBox(wg); |
486 |
wgLayout->addWidget(gb, 0, 1); |
|
487 |
||
488 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
489 |
||
490 |
labelSD = new QLabel(gb); |
|
491 |
labelSD->setText(QLabel::tr("Server name:")); |
|
492 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
493 |
|
675 | 494 |
leServerDescr = new QLineEdit(gb); |
495 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
496 |
||
497 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
498 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 499 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
500 |
|
675 | 501 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
502 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
503 |
sbPort->setMaximum(65535); |
675 | 504 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
505 |
|
675 | 506 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
507 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 508 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
509 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
510 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
511 |
} |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
512 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
513 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
514 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
515 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
516 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
517 |
|
1153 | 518 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 519 |
{ |
520 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
521 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 522 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 523 |
//pageLayout->setSpacing(1); |
463 | 524 |
pageLayout->setColumnStretch(0, 50); |
525 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 526 |
|
461 | 527 |
// chatwidget |
528 |
pChatWidget = new HWChatWidget(this); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
529 |
pageLayout->addWidget(pChatWidget, 1, 0, 2, 1); |
464 | 530 |
pageLayout->setRowStretch(1, 100); |
453 | 531 |
|
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
532 |
pGameCFG = new GameCFGWidget(this); |
322 | 533 |
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
|
534 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
535 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 536 |
pNetTeamsWidget->setAcceptOuter(true); |
461 | 537 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); |
184 | 538 |
|
646 | 539 |
BtnGo = new QPushButton(this); |
184 | 540 |
BtnGo->setFont(*font14); |
1404 | 541 |
BtnGo->setText(QPushButton::tr("Ready")); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
542 |
pageLayout->addWidget(BtnGo, 3, 1); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
543 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
544 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
545 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
546 |
BtnMaster = addButton(tr("Control"), pageLayout, 2, 1); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
547 |
QMenu * menu = new QMenu(BtnMaster); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
548 |
startGame = new QAction(QAction::tr("Start"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
549 |
restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
550 |
restrictJoins->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
551 |
restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
552 |
restrictTeamAdds->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
553 |
menu->addAction(startGame); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
554 |
menu->addAction(restrictJoins); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
555 |
menu->addAction(restrictTeamAdds); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
556 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
557 |
BtnMaster->setMenu(menu); |
184 | 558 |
} |
187 | 559 |
|
1153 | 560 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 561 |
{ |
562 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
563 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
564 |
pageLayout->setColumnStretch(0, 1); |
|
565 |
pageLayout->setColumnStretch(1, 1); |
|
566 |
pageLayout->setColumnStretch(2, 1); |
|
567 |
||
1153 | 568 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 569 |
|
570 |
about = new About(this); |
|
571 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
572 |
} |
|
306 | 573 |
|
1153 | 574 |
PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) |
306 | 575 |
{ |
576 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
577 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
578 |
pageLayout->setColumnStretch(0, 1); |
|
579 |
pageLayout->setColumnStretch(1, 1); |
|
580 |
pageLayout->setColumnStretch(2, 1); |
|
581 |
||
1153 | 582 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
306 | 583 |
|
307 | 584 |
labelGameStats = new QLabel(this); |
585 |
labelGameStats->setTextFormat(Qt::RichText); |
|
586 |
pageLayout->addWidget(labelGameStats, 0, 0, 1, 3); |
|
306 | 587 |
} |
586 | 588 |
|
1150 | 589 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 590 |
{ |
591 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
592 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1252 | 593 |
// pageLayout->setColumnStretch(0, 1); |
594 |
// pageLayout->setColumnStretch(1, 2); |
|
595 |
// pageLayout->setColumnStretch(2, 1); |
|
588 | 596 |
pageLayout->setRowStretch(0, 1); |
1150 | 597 |
pageLayout->setRowStretch(6, 1); |
586 | 598 |
|
1150 | 599 |
BtnSimpleGamePage = addButton(tr("Simple Game"), pageLayout, 1, 1); |
600 |
BtnTrainPage = addButton(tr("Training"), pageLayout, 2, 1); |
|
601 |
BtnMultiplayer = addButton(tr("Multiplayer"), pageLayout, 3, 1); |
|
602 |
BtnLoad = addButton(tr("Saved games"), pageLayout, 4, 1); |
|
603 |
BtnDemos = addButton(tr("Demos"), pageLayout, 5, 1); |
|
586 | 604 |
|
1153 | 605 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 7, 0, true); |
586 | 606 |
} |
607 |
||
1153 | 608 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 609 |
{ |
610 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
611 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
612 |
pageLayout->setColumnStretch(0, 1); |
|
613 |
pageLayout->setColumnStretch(1, 2); |
|
614 |
pageLayout->setColumnStretch(2, 1); |
|
615 |
||
616 |
BtnStartTrain = new QPushButton(this); |
|
617 |
BtnStartTrain->setFont(*font14); |
|
618 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
619 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
620 |
||
1153 | 621 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 622 |
} |
623 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
624 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 625 |
AbstractPage(parent) |
600 | 626 |
{ |
627 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
628 |
|
1168 | 629 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size() - 10, this); |
718 | 630 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 631 |
|
1168 | 632 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 633 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
634 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 635 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
600 | 636 |
} |
637 |
||
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
|
638 |
PageInGame::PageInGame(QWidget* parent) : |
686 | 639 |
AbstractPage(parent) |
640 |
{ |
|
641 |
QLabel * label = new QLabel(this); |
|
642 |
label->setText("In game..."); |
|
643 |
} |
|
1311 | 644 |
|
645 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
|
646 |
AbstractPage(parent) |
|
647 |
{ |
|
1312 | 648 |
QGridLayout * pageLayout = new QGridLayout(this); |
1314 | 649 |
|
650 |
roomName = new QLineEdit(this); |
|
1334
b58afaadf7ae
Send team removal message to others in room when client disconnects
unc0rr
parents:
1315
diff
changeset
|
651 |
roomName->setMaxLength(60); |
1314 | 652 |
pageLayout->addWidget(roomName, 0, 0); |
1399 | 653 |
|
654 |
roomsList = new QTableWidget(this); |
|
655 |
roomsList->setColumnCount(3); |
|
656 |
roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
|
657 |
roomsList->verticalHeader()->setVisible(false); |
|
658 |
roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
|
659 |
roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
|
660 |
||
1314 | 661 |
pageLayout->addWidget(roomsList, 1, 0, 3, 1); |
1377 | 662 |
serverMessage = new QTextBrowser(this); |
663 |
serverMessage->setOpenExternalLinks(true); |
|
664 |
pageLayout->addWidget(serverMessage, 4, 0, 1, 2); |
|
1312 | 665 |
|
1377 | 666 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
1312 | 667 |
BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
668 |
BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
|
669 |
BtnRefresh = addButton(tr("Refresh"), pageLayout, 2, 1); |
|
1314 | 670 |
|
671 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
|
672 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
|
1315 | 673 |
connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
1314 | 674 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
1311 | 675 |
} |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
676 |
|
1377 | 677 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
678 |
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
|
679 |
{ |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
680 |
roomsList->clear(); |
1399 | 681 |
roomsList->setHorizontalHeaderLabels( |
682 |
QStringList() << |
|
683 |
QTableWidget::tr("Room name") << |
|
684 |
QTableWidget::tr("Players number") << |
|
685 |
QTableWidget::tr("Round in progress") |
|
686 |
); |
|
687 |
||
688 |
if (list.size() % 3) |
|
689 |
return; |
|
690 |
||
691 |
roomsList->setRowCount(list.size() / 3); |
|
692 |
for(int i = 0; i < list.size(); i += 3) |
|
693 |
for(int t = 0; t < 3; t++) |
|
694 |
{ |
|
695 |
QTableWidgetItem * item = new QTableWidgetItem(list[i + t]); |
|
696 |
item->setFlags(Qt::ItemIsSelectable); |
|
1400 | 697 |
roomsList->setItem(i / 3, t, item); |
1399 | 698 |
} |
699 |
//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
|
700 |
} |
1314 | 701 |
|
702 |
void PageRoomsList::onCreateClick() |
|
703 |
{ |
|
704 |
if (roomName->text().size()) |
|
705 |
emit askForCreateRoom(roomName->text()); |
|
706 |
else |
|
707 |
QMessageBox::critical(this, |
|
708 |
tr("Error"), |
|
1315 | 709 |
tr("Please, enter room name"), |
1314 | 710 |
tr("OK")); |
711 |
} |
|
712 |
||
713 |
void PageRoomsList::onJoinClick() |
|
714 |
{ |
|
1399 | 715 |
QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
1314 | 716 |
if (!curritem) |
717 |
{ |
|
718 |
QMessageBox::critical(this, |
|
719 |
tr("Error"), |
|
720 |
tr("Please, select room from the list"), |
|
721 |
tr("OK")); |
|
722 |
return ; |
|
723 |
} |
|
724 |
emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
725 |
} |
|
726 |
||
1315 | 727 |
void PageRoomsList::onRefreshClick() |
728 |
{ |
|
729 |
emit askForRoomList(); |
|
730 |
} |
|
731 |