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