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