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