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