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