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