author | nemo |
Fri, 22 May 2009 02:01:45 +0000 | |
changeset 2087 | 79472a9be025 |
parent 2076 | aa3263e57b8f |
child 2093 | 485e084cedc4 |
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> |
1885 | 41 |
#include <QDataWidgetMapper> |
42 |
||
184 | 43 |
|
44 |
#include "pages.h" |
|
45 |
#include "sdlkeys.h" |
|
46 |
#include "hwconsts.h" |
|
47 |
#include "gamecfgwidget.h" |
|
48 |
#include "teamselect.h" |
|
49 |
#include "gamecfgwidget.h" |
|
50 |
#include "SquareLabel.h" |
|
51 |
#include "mapContainer.h" |
|
187 | 52 |
#include "about.h" |
297 | 53 |
#include "fpsedit.h" |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
54 |
#include "netserverslist.h" |
412 | 55 |
#include "netudpwidget.h" |
461 | 56 |
#include "chatwidget.h" |
579 | 57 |
#include "playrecordpage.h" |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
603
diff
changeset
|
58 |
#include "selectWeapon.h" |
1192 | 59 |
#include "igbox.h" |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
60 |
#include "hats.h" |
1885 | 61 |
#include "misc.h" |
1932 | 62 |
#include "togglebutton.h" |
184 | 63 |
|
684 | 64 |
PageMain::PageMain(QWidget* parent) : |
65 |
AbstractPage(parent) |
|
184 | 66 |
{ |
2071
0faa147c47df
Still trying to improve perf of stars - this seems to help a little bit
nemo
parents:
2036
diff
changeset
|
67 |
setAttribute(Qt::WA_NoSystemBackground, true); |
184 | 68 |
QGridLayout * pageLayout = new QGridLayout(this); |
1148 | 69 |
//pageLayout->setColumnStretch(0, 1); |
70 |
//pageLayout->setColumnStretch(1, 2); |
|
71 |
//pageLayout->setColumnStretch(2, 1); |
|
184 | 72 |
|
1199 | 73 |
//QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
74 |
//pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); |
|
1148 | 75 |
pageLayout->setRowStretch(0, 1); |
1150 | 76 |
pageLayout->setRowStretch(1, 1); |
77 |
pageLayout->setRowStretch(2, 0); |
|
78 |
pageLayout->setRowStretch(3, 1); |
|
1199 | 79 |
pageLayout->setRowStretch(4, 1); |
184 | 80 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
81 |
BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
1450 | 82 |
BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); |
1150 | 83 |
pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
184 | 84 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
85 |
BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
1450 | 86 |
BtnNet->setToolTip(tr("Network Game (Play a game across a network)")); |
1150 | 87 |
pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
579 | 88 |
|
1199 | 89 |
BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true); |
184 | 90 |
|
1199 | 91 |
//BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
92 |
BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
1212 | 93 |
BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
1150 | 94 |
pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
1199 | 95 |
//pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
184 | 96 |
|
1199 | 97 |
BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
184 | 98 |
} |
99 |
||
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
730
diff
changeset
|
100 |
PageEditTeam::PageEditTeam(QWidget* parent) : |
692 | 101 |
AbstractPage(parent) |
184 | 102 |
{ |
103 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1252 | 104 |
QTabWidget * tbw = new QTabWidget(this); |
1389 | 105 |
QWidget * page1 = new QWidget(this); |
106 |
QWidget * page2 = new QWidget(this); |
|
1252 | 107 |
tbw->addTab(page1, tr("General")); |
108 |
tbw->addTab(page2, tr("Advanced")); |
|
109 |
pageLayout->addWidget(tbw, 0, 0, 1, 3); |
|
110 |
BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
|
111 |
BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);; |
|
1443 | 112 |
BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
113 |
||
1252 | 114 |
QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
115 |
page1Layout->setAlignment(Qt::AlignTop); |
|
116 |
QGridLayout * page2Layout = new QGridLayout(page2); |
|
117 |
||
118 |
// ====== Page 1 ====== |
|
119 |
QVBoxLayout * vbox1 = new QVBoxLayout(); |
|
120 |
QVBoxLayout * vbox2 = new QVBoxLayout(); |
|
121 |
QVBoxLayout * vbox3 = new QVBoxLayout(); |
|
122 |
page1Layout->addLayout(vbox1); |
|
123 |
page1Layout->addLayout(vbox2); |
|
124 |
page1Layout->addLayout(vbox3); |
|
125 |
||
588 | 126 |
GBoxHedgehogs = new QGroupBox(this); |
184 | 127 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
128 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
129 |
QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
|
1840 | 130 |
|
131 |
signalMapper = new QSignalMapper(this); |
|
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
132 |
|
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
133 |
HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
184 | 134 |
for(int i = 0; i < 8; i++) |
135 |
{ |
|
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
136 |
HHHats[i] = new QComboBox(GBoxHedgehogs); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
137 |
HHHats[i]->setModel(hatsModel); |
1282 | 138 |
HHHats[i]->setIconSize(QSize(32, 37)); |
139 |
//HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
|
1239 | 140 |
//HHHats[i]->setModelColumn(1); |
1240 | 141 |
//HHHats[i]->setMinimumWidth(132); |
1840 | 142 |
GBHLayout->addWidget(HHHats[i], i, 0); |
143 |
||
144 |
HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
|
145 |
HHNameEdit[i]->setMaxLength(64); |
|
146 |
HHNameEdit[i]->setMinimumWidth(120); |
|
147 |
GBHLayout->addWidget(HHNameEdit[i], i, 1); |
|
148 |
||
149 |
randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true); |
|
150 |
||
151 |
connect(randButton[i], SIGNAL(clicked()), signalMapper, SLOT(map())); |
|
152 |
signalMapper->setMapping(randButton[i], i); |
|
153 |
||
184 | 154 |
} |
1840 | 155 |
|
156 |
randTeamButton = addButton("Random Team", GBHLayout, 9, false); |
|
157 |
||
1252 | 158 |
vbox1->addWidget(GBoxHedgehogs); |
159 |
||
160 |
||
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
161 |
GBoxTeam = new QGroupBox(this); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
162 |
GBoxTeam->setTitle(QGroupBox::tr("Team")); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
163 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
164 |
QVBoxLayout * GBTLayout = new QVBoxLayout(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
165 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
166 |
TeamNameEdit->setMaxLength(64); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
167 |
GBTLayout->addWidget(TeamNameEdit); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
168 |
vbox2->addWidget(GBoxTeam); |
1252 | 169 |
|
1290 | 170 |
CBTeamLvl = new QComboBox(GBoxTeam); |
1440 | 171 |
CBTeamLvl->setIconSize(QSize(48, 48)); |
1287 | 172 |
CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
173 |
for(int i = 5; i > 0; i--) |
|
174 |
CBTeamLvl->addItem( |
|
175 |
QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
|
176 |
QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
|
177 |
); |
|
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
178 |
GBTLayout->addWidget(CBTeamLvl); |
1287 | 179 |
|
1290 | 180 |
CBGrave = new QComboBox(GBoxTeam); |
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
181 |
CBGrave->setMaxCount(65535); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
182 |
CBGrave->setIconSize(QSize(32, 32)); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
183 |
GBTLayout->addWidget(CBGrave); |
1684 | 184 |
|
1659 | 185 |
{ |
1684 | 186 |
QHBoxLayout * hbox = new QHBoxLayout(); |
187 |
CBVoicepack = new QComboBox(GBoxTeam); |
|
188 |
{ |
|
189 |
QDir tmpdir; |
|
190 |
tmpdir.cd(datadir->absolutePath()); |
|
191 |
tmpdir.cd("Sounds/voices"); |
|
192 |
QStringList list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); |
|
193 |
CBVoicepack->addItems(list); |
|
194 |
} |
|
195 |
hbox->addWidget(CBVoicepack, 100); |
|
1718 | 196 |
BtnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true); |
1684 | 197 |
hbox->setStretchFactor(BtnTestSound, 1); |
198 |
connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); |
|
199 |
GBTLayout->addLayout(hbox); |
|
1659 | 200 |
} |
201 |
||
1252 | 202 |
GBoxFort = new QGroupBox(this); |
203 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
|
204 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
|
205 |
CBFort = new QComboBox(GBoxFort); |
|
206 |
CBFort->setMaxCount(65535); |
|
207 |
GBFLayout->addWidget(CBFort, 0, 0); |
|
208 |
FortPreview = new SquareLabel(GBoxFort); |
|
209 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
210 |
FortPreview->setPixmap(QPixmap()); |
|
2072
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2071
diff
changeset
|
211 |
// perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars |
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2071
diff
changeset
|
212 |
//FortPreview->setAttribute(Qt::WA_PaintOnScreen, true); |
1252 | 213 |
GBFLayout->addWidget(FortPreview, 1, 0); |
214 |
vbox3->addWidget(GBoxFort); |
|
215 |
||
216 |
QDir tmpdir; |
|
217 |
tmpdir.cd(datadir->absolutePath()); |
|
218 |
tmpdir.cd("Forts"); |
|
219 |
tmpdir.setFilter(QDir::Files); |
|
220 |
||
1287 | 221 |
connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
1252 | 222 |
CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
1287 | 223 |
|
1252 | 224 |
tmpdir.cd("../Graphics/Graves"); |
225 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
226 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
227 |
{ |
|
1287 | 228 |
QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); |
229 |
QIcon icon(pix.copy(0, 0, 32, 32)); |
|
230 |
CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
|
1252 | 231 |
} |
232 |
||
233 |
vbox1->addStretch(); |
|
234 |
vbox2->addStretch(); |
|
235 |
// vbox3->addStretch(); |
|
236 |
||
237 |
// ====== Page 2 ====== |
|
588 | 238 |
GBoxBinds = new QGroupBox(this); |
184 | 239 |
GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
240 |
QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
|
241 |
BindsBox = new QToolBox(GBoxBinds); |
|
242 |
BindsBox->setLineWidth(0); |
|
243 |
GBBLayout->addWidget(BindsBox); |
|
1389 | 244 |
page_A = new QWidget(this); |
184 | 245 |
BindsBox->addItem(page_A, QToolBox::tr("Actions")); |
1389 | 246 |
page_W = new QWidget(this); |
184 | 247 |
BindsBox->addItem(page_W, QToolBox::tr("Weapons")); |
1389 | 248 |
page_WP = new QWidget(this); |
184 | 249 |
BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); |
1389 | 250 |
page_O = new QWidget(this); |
184 | 251 |
BindsBox->addItem(page_O, QToolBox::tr("Other")); |
1252 | 252 |
page2Layout->addWidget(GBoxBinds, 0, 0); |
184 | 253 |
|
254 |
QStringList binds; |
|
255 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
256 |
{ |
|
257 |
binds << sdlkeys[i][1]; |
|
258 |
} |
|
259 |
||
260 |
quint16 widind = 0, i = 0; |
|
261 |
while (i < BINDS_NUMBER) { |
|
262 |
quint16 num = 0; |
|
1389 | 263 |
QWidget * curW = BindsBox->widget(widind); |
264 |
QGridLayout * pagelayout = new QGridLayout(curW); |
|
184 | 265 |
do { |
1389 | 266 |
LBind[i] = new QLabel(curW); |
184 | 267 |
LBind[i]->setText(QApplication::translate("binds", cbinds[i].name)); |
268 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
269 |
pagelayout->addWidget(LBind[i], num, 0); |
|
1389 | 270 |
CBBind[i] = new QComboBox(curW); |
184 | 271 |
CBBind[i]->addItems(binds); |
272 |
pagelayout->addWidget(CBBind[i], num, 1); |
|
273 |
num++; |
|
274 |
} while (!cbinds[i++].chwidget); |
|
1389 | 275 |
pagelayout->addWidget(new QWidget(curW), num, 0, 1, 2); |
184 | 276 |
widind++; |
277 |
} |
|
278 |
} |
|
279 |
||
280 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
|
281 |
{ |
|
282 |
QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
|
283 |
FortPreview->setPixmap(pix); |
|
284 |
} |
|
285 |
||
1684 | 286 |
void PageEditTeam::testSound() |
287 |
{ |
|
288 |
QDir tmpdir; |
|
289 |
tmpdir.cd(datadir->absolutePath()); |
|
290 |
tmpdir.cd("Sounds/voices"); |
|
291 |
tmpdir.cd(CBVoicepack->currentText()); |
|
1701
ad7a7fd14d36
Now voicepack checking button should work (but it doesn't for me)
unc0rr
parents:
1684
diff
changeset
|
292 |
QStringList list = tmpdir.entryList(QStringList() << "*.wav", QDir::Files); |
1684 | 293 |
if (list.size()) |
1701
ad7a7fd14d36
Now voicepack checking button should work (but it doesn't for me)
unc0rr
parents:
1684
diff
changeset
|
294 |
QSound::play(tmpdir.absolutePath() + "/" + list[rand() % list.size()]); |
1684 | 295 |
} |
296 |
||
1287 | 297 |
PageMultiplayer::PageMultiplayer(QWidget* parent) : |
692 | 298 |
AbstractPage(parent) |
184 | 299 |
{ |
300 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
301 |
||
1218 | 302 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
187 | 303 |
|
184 | 304 |
gameCFG = new GameCFGWidget(this); |
305 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
696 | 306 |
|
1218 | 307 |
pageLayout->setRowStretch(1, 1); |
308 |
||
184 | 309 |
teamsSelect = new TeamSelWidget(this); |
1218 | 310 |
pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
184 | 311 |
|
1218 | 312 |
BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
184 | 313 |
} |
314 |
||
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
|
315 |
PageOptions::PageOptions(QWidget* parent) : |
692 | 316 |
AbstractPage(parent) |
184 | 317 |
{ |
318 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
427 | 319 |
pageLayout->setColumnStretch(0, 100); |
320 |
pageLayout->setColumnStretch(1, 100); |
|
321 |
pageLayout->setColumnStretch(2, 100); |
|
322 |
pageLayout->setRowStretch(0, 0); |
|
1644 | 323 |
pageLayout->setRowStretch(1, 100); |
719 | 324 |
pageLayout->setRowStretch(2, 0); |
1644 | 325 |
pageLayout->setContentsMargins(7, 7, 7, 0); |
326 |
pageLayout->setSpacing(0); |
|
427 | 327 |
|
1198 | 328 |
|
329 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
330 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
1644 | 331 |
QGridLayout * gbTBLayout = new QGridLayout(gbTwoBoxes); |
332 |
gbTBLayout->setMargin(0); |
|
333 |
gbTBLayout->setSpacing(0); |
|
1198 | 334 |
{ |
335 |
teamsBox = new IconedGroupBox(this); |
|
2072
6e0fcbcc3f60
Custom controls implementing paintEvent play poorly with stars, especially SquareLabel
nemo
parents:
2071
diff
changeset
|
336 |
//teamsBox->setAttribute(Qt::WA_PaintOnScreen, true); |
1198 | 337 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
338 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
339 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
340 |
||
1644 | 341 |
QVBoxLayout * GBTlayout = new QVBoxLayout(teamsBox); |
1198 | 342 |
|
343 |
CBTeamName = new QComboBox(teamsBox); |
|
1644 | 344 |
GBTlayout->addWidget(CBTeamName); |
184 | 345 |
|
1644 | 346 |
QHBoxLayout * layout1 = new QHBoxLayout; |
347 |
GBTlayout->addLayout(layout1); |
|
348 |
BtnNewTeam = addButton(tr("New team"), layout1, 0); |
|
349 |
BtnEditTeam = addButton(tr("Edit team"), layout1, 1); |
|
350 |
layout1->setStretchFactor(BtnNewTeam, 100); |
|
351 |
layout1->setStretchFactor(BtnEditTeam, 100); |
|
352 |
||
353 |
QHBoxLayout * layout2 = new QHBoxLayout; |
|
354 |
GBTlayout->addLayout(layout2); |
|
1199 | 355 |
|
356 |
labelNN = new QLabel(teamsBox); |
|
357 |
labelNN->setText(QLabel::tr("Net nick")); |
|
1644 | 358 |
layout2->addWidget(labelNN); |
1199 | 359 |
|
360 |
editNetNick = new QLineEdit(teamsBox); |
|
361 |
editNetNick->setMaxLength(20); |
|
362 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
1644 | 363 |
layout2->addWidget(editNetNick); |
1199 | 364 |
|
1644 | 365 |
gbTBLayout->addWidget(teamsBox, 0, 0); |
1198 | 366 |
} |
184 | 367 |
|
1198 | 368 |
{ |
369 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1810 | 370 |
groupWeapons->setContentTopPadding(0); |
1199 | 371 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 372 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 373 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 374 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
375 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 376 |
|
1198 | 377 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
378 |
WeaponsName = new QComboBox(this); |
|
379 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
380 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
1644 | 381 |
gbTBLayout->addWidget(groupWeapons, 1, 0); |
1198 | 382 |
} |
184 | 383 |
|
1644 | 384 |
{ |
385 |
AGGroupBox = new IconedGroupBox(this); |
|
386 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
387 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
388 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
184 | 389 |
|
1644 | 390 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
391 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
|
392 |
QLabel * resolution = new QLabel(AGGroupBox); |
|
393 |
resolution->setText(QLabel::tr("Resolution")); |
|
394 |
GBAreslayout->addWidget(resolution); |
|
427 | 395 |
|
1644 | 396 |
CBResolution = new QComboBox(AGGroupBox); |
397 |
GBAreslayout->addWidget(CBResolution); |
|
398 |
GBAlayout->addLayout(GBAreslayout); |
|
427 | 399 |
|
1644 | 400 |
QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); |
401 |
QLabel * maxfps = new QLabel(AGGroupBox); |
|
402 |
maxfps->setText(QLabel::tr("FPS limit")); |
|
403 |
GBAfpslayout->addWidget(maxfps); |
|
404 |
GBAlayout->addLayout(GBAfpslayout); |
|
184 | 405 |
|
1812 | 406 |
CBReduceQuality = new QCheckBox(AGGroupBox); |
407 |
CBReduceQuality->setText(QCheckBox::tr("Reduce Quality")); |
|
408 |
GBAlayout->addWidget(CBReduceQuality); |
|
409 |
||
1644 | 410 |
CBFullscreen = new QCheckBox(AGGroupBox); |
411 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
412 |
GBAlayout->addWidget(CBFullscreen); |
|
184 | 413 |
|
1644 | 414 |
CBFrontendFullscreen = new QCheckBox(AGGroupBox); |
415 |
CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); |
|
416 |
GBAlayout->addWidget(CBFrontendFullscreen); |
|
1162 | 417 |
|
1644 | 418 |
CBEnableSound = new QCheckBox(AGGroupBox); |
419 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
|
420 |
GBAlayout->addWidget(CBEnableSound); |
|
184 | 421 |
|
1644 | 422 |
CBEnableMusic = new QCheckBox(AGGroupBox); |
423 |
CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
|
424 |
GBAlayout->addWidget(CBEnableMusic); |
|
1129 | 425 |
|
1777 | 426 |
QHBoxLayout * GBAvollayout = new QHBoxLayout(0); |
427 |
QLabel * vol = new QLabel(AGGroupBox); |
|
428 |
vol->setText(QLabel::tr("Initial sound volume")); |
|
429 |
GBAvollayout->addWidget(vol); |
|
430 |
GBAlayout->addLayout(GBAvollayout); |
|
431 |
volumeBox = new QSpinBox(AGGroupBox); |
|
432 |
volumeBox->setRange(0, 100); |
|
433 |
volumeBox->setSingleStep(5); |
|
434 |
GBAvollayout->addWidget(volumeBox); |
|
435 |
||
436 |
||
1644 | 437 |
CBShowFPS = new QCheckBox(AGGroupBox); |
438 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
439 |
GBAlayout->addWidget(CBShowFPS); |
|
297 | 440 |
|
1644 | 441 |
CBAltDamage = new QCheckBox(AGGroupBox); |
442 |
CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); |
|
443 |
GBAlayout->addWidget(CBAltDamage); |
|
529 | 444 |
|
1644 | 445 |
CBNameWithDate = new QCheckBox(AGGroupBox); |
446 |
CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name")); |
|
447 |
GBAlayout->addWidget(CBNameWithDate); |
|
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1457
diff
changeset
|
448 |
|
1644 | 449 |
fpsedit = new FPSEdit(AGGroupBox); |
450 |
GBAfpslayout->addWidget(fpsedit); |
|
451 |
gbTBLayout->addWidget(AGGroupBox, 0, 1, 2, 1); |
|
452 |
} |
|
184 | 453 |
|
1644 | 454 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 2, 2, true); |
1443 | 455 |
BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
184 | 456 |
|
1644 | 457 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
184 | 458 |
} |
459 |
||
1153 | 460 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 461 |
{ |
462 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
463 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
464 |
pageLayout->setColumnStretch(0, 1); |
|
465 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 466 |
pageLayout->setColumnStretch(2, 1); |
421 | 467 |
|
468 |
BtnNetSvrStart = new QPushButton(this); |
|
469 |
BtnNetSvrStart->setFont(*font14); |
|
470 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
1415
6fbfee0e113a
Allow build without net game server: introduce -DWITH_SERVER configuration parameter
unc0rr
parents:
1409
diff
changeset
|
471 |
BtnNetSvrStart->setVisible(haveServer); |
1395 | 472 |
pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
473 |
||
474 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
|
1932 | 475 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
476 |
ConnGroupBox = new QGroupBox(this); |
421 | 477 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
478 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
479 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 480 |
GBClayout->setColumnStretch(0, 1); |
421 | 481 |
GBClayout->setColumnStretch(1, 1); |
482 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 483 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
484 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 485 |
BtnNetConnect->setFont(*font14); |
486 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 487 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 488 |
|
665 | 489 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
490 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 491 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 492 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
493 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
494 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
495 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 496 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 497 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
498 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
499 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
500 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
501 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
502 |
|
668 | 503 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 504 |
} |
505 |
||
646 | 506 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
507 |
{ |
1310 | 508 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
659 | 509 |
|
673 | 510 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
511 |
||
665 | 512 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
513 |
|
665 | 514 |
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
|
515 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 516 |
} |
517 |
||
518 |
void PageNet::slotConnect() |
|
519 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
520 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
521 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
522 |
if(!mi.isValid()) |
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 |
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
|
525 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
526 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
527 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
528 |
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
|
529 |
|
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
|
530 |
emit connectClicked(host, port); |
646 | 531 |
} |
532 |
||
1153 | 533 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 534 |
{ |
535 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
536 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
537 |
pageLayout->setColumnStretch(0, 1); |
|
538 |
pageLayout->setColumnStretch(1, 1); |
|
539 |
pageLayout->setColumnStretch(2, 1); |
|
540 |
||
675 | 541 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
542 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
543 |
|
1153 | 544 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 545 |
|
546 |
BtnStart = new QPushButton(this); |
|
547 |
BtnStart->setFont(*font14); |
|
548 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 549 |
pageLayout->addWidget(BtnStart, 1, 2); |
550 |
||
551 |
QWidget * wg = new QWidget(this); |
|
552 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
553 |
|
675 | 554 |
QGridLayout * wgLayout = new QGridLayout(wg); |
555 |
wgLayout->setColumnStretch(0, 1); |
|
556 |
wgLayout->setColumnStretch(1, 3); |
|
557 |
wgLayout->setColumnStretch(2, 1); |
|
558 |
||
559 |
wgLayout->setRowStretch(0, 0); |
|
560 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
561 |
|
675 | 562 |
QGroupBox * gb = new QGroupBox(wg); |
563 |
wgLayout->addWidget(gb, 0, 1); |
|
564 |
||
565 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
566 |
||
567 |
labelSD = new QLabel(gb); |
|
568 |
labelSD->setText(QLabel::tr("Server name:")); |
|
569 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
570 |
|
675 | 571 |
leServerDescr = new QLineEdit(gb); |
572 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
573 |
||
574 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
575 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 576 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
577 |
|
675 | 578 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
579 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
580 |
sbPort->setMaximum(65535); |
675 | 581 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
582 |
|
675 | 583 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
584 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 585 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
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 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(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 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
590 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
591 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
592 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
593 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
594 |
|
1153 | 595 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 596 |
{ |
597 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 598 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 599 |
//pageLayout->setSpacing(1); |
463 | 600 |
pageLayout->setColumnStretch(0, 50); |
601 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 602 |
|
461 | 603 |
// chatwidget |
604 |
pChatWidget = new HWChatWidget(this); |
|
1647 | 605 |
pageLayout->addWidget(pChatWidget, 1, 0, 1, 2); |
464 | 606 |
pageLayout->setRowStretch(1, 100); |
453 | 607 |
|
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 |
pGameCFG = new GameCFGWidget(this); |
322 | 609 |
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
|
610 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
611 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 612 |
pNetTeamsWidget->setAcceptOuter(true); |
1647 | 613 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1); |
184 | 614 |
|
1649 | 615 |
|
616 |
QHBoxLayout * bottomLayout = new QHBoxLayout; |
|
617 |
pageLayout->addLayout(bottomLayout, 3, 0, 1, 2); |
|
618 |
||
619 |
BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true); |
|
620 |
||
646 | 621 |
BtnGo = new QPushButton(this); |
1677 | 622 |
BtnGo->setToolTip(QPushButton::tr("Ready")); |
1648 | 623 |
BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
624 |
BtnGo->setIconSize(QSize(25, 34)); |
|
1649 | 625 |
BtnGo->setMinimumWidth(50); |
626 |
BtnGo->setMinimumHeight(50); |
|
1951 | 627 |
bottomLayout->addWidget(BtnGo, 4); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
628 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
629 |
|
1951 | 630 |
BtnMaster = addButton(tr("Control"), bottomLayout, 2); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
631 |
QMenu * menu = new QMenu(BtnMaster); |
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); |
1951 | 636 |
//menu->addAction(startGame); |
1409
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 |
|
1951 | 642 |
BtnStart = addButton(QAction::tr("Start"), bottomLayout, 3); |
643 |
||
1649 | 644 |
bottomLayout->insertStretch(1, 100); |
184 | 645 |
} |
187 | 646 |
|
1648 | 647 |
void PageNetGame::setReadyStatus(bool isReady) |
648 |
{ |
|
649 |
if(isReady) |
|
650 |
BtnGo->setIcon(QIcon(":/res/lightbulb_on.png")); |
|
651 |
else |
|
652 |
BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
|
653 |
} |
|
654 |
||
1649 | 655 |
void PageNetGame::setMasterMode(bool isMaster) |
656 |
{ |
|
657 |
BtnMaster->setVisible(isMaster); |
|
1951 | 658 |
BtnStart->setVisible(isMaster); |
1649 | 659 |
} |
660 |
||
1153 | 661 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 662 |
{ |
663 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
664 |
pageLayout->setColumnStretch(0, 1); |
|
665 |
pageLayout->setColumnStretch(1, 1); |
|
666 |
pageLayout->setColumnStretch(2, 1); |
|
667 |
||
1153 | 668 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 669 |
|
670 |
about = new About(this); |
|
671 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
672 |
} |
|
306 | 673 |
|
1150 | 674 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 675 |
{ |
1443 | 676 |
QVBoxLayout * vLayout = new QVBoxLayout(this); |
677 |
QHBoxLayout * topLine = new QHBoxLayout(); |
|
678 |
QHBoxLayout * middleLine = new QHBoxLayout(); |
|
679 |
QHBoxLayout * bottomLine = new QHBoxLayout(); |
|
1444 | 680 |
vLayout->addStretch(); |
1443 | 681 |
vLayout->addLayout(topLine); |
1457 | 682 |
vLayout->addSpacing(30); |
1443 | 683 |
vLayout->addLayout(middleLine); |
1444 | 684 |
vLayout->addStretch(); |
1443 | 685 |
vLayout->addLayout(bottomLine); |
586 | 686 |
|
1457 | 687 |
topLine->addStretch(); |
1443 | 688 |
BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); |
1450 | 689 |
BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); |
1457 | 690 |
topLine->addSpacing(60); |
1443 | 691 |
BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); |
1450 | 692 |
BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); |
1457 | 693 |
topLine->addStretch(); |
694 |
||
695 |
||
1443 | 696 |
BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true); |
1450 | 697 |
BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT")); |
1443 | 698 |
|
699 |
BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true); |
|
1444 | 700 |
bottomLine->addStretch(); |
701 |
||
1447 | 702 |
BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); |
1450 | 703 |
BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); |
1443 | 704 |
BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true); |
705 |
BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
|
1450 | 706 |
BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); |
586 | 707 |
} |
708 |
||
1153 | 709 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 710 |
{ |
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); |
|
1894 | 760 |
roomsList->setAlternatingRowColors(true); |
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 |
|
1312 | 768 |
BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
769 |
BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
|
1522 | 770 |
BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1); |
1856
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
771 |
|
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
772 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
773 |
BtnAdmin = addButton(tr("Admin features"), pageLayout, 5, 1); |
1314 | 774 |
|
775 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
|
776 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
|
1315 | 777 |
connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
1314 | 778 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
1311 | 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 |
|
1856
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
781 |
void PageRoomsList::setAdmin(bool flag) |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
782 |
{ |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
783 |
BtnAdmin->setVisible(flag); |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
784 |
} |
1377 | 785 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
786 |
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
|
787 |
{ |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
788 |
roomsList->clear(); |
1399 | 789 |
roomsList->setHorizontalHeaderLabels( |
790 |
QStringList() << |
|
791 |
QTableWidget::tr("Room name") << |
|
792 |
QTableWidget::tr("Players number") << |
|
793 |
QTableWidget::tr("Round in progress") |
|
794 |
); |
|
1893 | 795 |
|
796 |
roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
|
797 |
roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); |
|
798 |
roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); |
|
799 |
||
1399 | 800 |
|
801 |
if (list.size() % 3) |
|
802 |
return; |
|
803 |
||
804 |
roomsList->setRowCount(list.size() / 3); |
|
805 |
for(int i = 0; i < list.size(); i += 3) |
|
806 |
for(int t = 0; t < 3; t++) |
|
807 |
{ |
|
808 |
QTableWidgetItem * item = new QTableWidgetItem(list[i + t]); |
|
1891 | 809 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1400 | 810 |
roomsList->setItem(i / 3, t, item); |
1399 | 811 |
} |
812 |
//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
|
813 |
} |
1314 | 814 |
|
815 |
void PageRoomsList::onCreateClick() |
|
816 |
{ |
|
817 |
if (roomName->text().size()) |
|
818 |
emit askForCreateRoom(roomName->text()); |
|
819 |
else |
|
820 |
QMessageBox::critical(this, |
|
821 |
tr("Error"), |
|
1315 | 822 |
tr("Please, enter room name"), |
1314 | 823 |
tr("OK")); |
824 |
} |
|
825 |
||
826 |
void PageRoomsList::onJoinClick() |
|
827 |
{ |
|
1399 | 828 |
QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
1314 | 829 |
if (!curritem) |
830 |
{ |
|
831 |
QMessageBox::critical(this, |
|
832 |
tr("Error"), |
|
833 |
tr("Please, select room from the list"), |
|
834 |
tr("OK")); |
|
835 |
return ; |
|
836 |
} |
|
837 |
emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
838 |
} |
|
839 |
||
1315 | 840 |
void PageRoomsList::onRefreshClick() |
841 |
{ |
|
842 |
emit askForRoomList(); |
|
843 |
} |
|
844 |
||
1800 | 845 |
|
846 |
PageConnecting::PageConnecting(QWidget* parent) : |
|
847 |
AbstractPage(parent) |
|
848 |
{ |
|
849 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1904 | 850 |
|
851 |
QLabel * lblConnecting = new QLabel(this); |
|
852 |
lblConnecting->setText(tr("Connecting...")); |
|
853 |
pageLayout->addWidget(lblConnecting); |
|
1800 | 854 |
} |
1884 | 855 |
|
856 |
PageScheme::PageScheme(QWidget* parent) : |
|
857 |
AbstractPage(parent) |
|
858 |
{ |
|
859 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1943 | 860 |
QGroupBox * gb = new QGroupBox(this); |
1932 | 861 |
|
862 |
QGridLayout * gl = new QGridLayout(); |
|
863 |
gb->setLayout(gl); |
|
1943 | 864 |
QSizePolicy sp; |
865 |
sp.setVerticalPolicy(QSizePolicy::MinimumExpanding); |
|
866 |
sp.setHorizontalPolicy(QSizePolicy::Expanding); |
|
1885 | 867 |
|
1932 | 868 |
pageLayout->addWidget(gb, 1,0,13,4); |
869 |
||
1984 | 870 |
gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb); |
871 |
gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb); |
|
1943 | 872 |
|
873 |
gbGameModes->setStyleSheet(".QGroupBox {" |
|
874 |
"background-color: #130f2c; background-image:url();" |
|
875 |
"}"); |
|
876 |
gbBasicSettings->setStyleSheet(".QGroupBox {" |
|
877 |
"background-color: #130f2c; background-image:url();" |
|
878 |
"}"); |
|
879 |
||
880 |
gbGameModes->setSizePolicy(sp); |
|
881 |
gbBasicSettings->setSizePolicy(sp); |
|
882 |
gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop); |
|
883 |
gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop); |
|
1932 | 884 |
|
885 |
QGridLayout * glGMLayout = new QGridLayout(gbGameModes); |
|
886 |
QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings); |
|
887 |
gbGameModes->setLayout(glGMLayout); |
|
888 |
gbBasicSettings->setLayout(glBSLayout); |
|
889 |
// Left |
|
890 |
||
891 |
TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png"); |
|
892 |
TBW_mode_Forts->setText(ToggleButtonWidget::tr("Fort Mode")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
893 |
TBW_mode_Forts->setToolTip(tr("Defend your fort and destroy the opponents, two team colours max!")); |
1932 | 894 |
glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1); |
1885 | 895 |
|
1932 | 896 |
TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/btnTeamsDivide.png"); |
897 |
TBW_teamsDivide->setText(ToggleButtonWidget::tr("Divide Teams")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
898 |
TBW_teamsDivide->setToolTip(tr("Teams will start on opposite sides of the terrain, two team colours max!")); |
1932 | 899 |
glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1); |
1885 | 900 |
|
1932 | 901 |
TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid.png"); |
902 |
TBW_solid->setText(ToggleButtonWidget::tr("Solid Land")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
903 |
TBW_solid->setToolTip(tr("Land can not be destroyed!")); |
1932 | 904 |
glGMLayout->addWidget(TBW_solid,0,2,1,1); |
1885 | 905 |
|
1932 | 906 |
TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder.png"); |
907 |
TBW_border->setText(ToggleButtonWidget::tr("Add Border")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
908 |
TBW_border->setToolTip(tr("Add an indestructable border around the terrain")); |
1932 | 909 |
glGMLayout->addWidget(TBW_border,0,3,1,1); |
1895 | 910 |
|
1932 | 911 |
TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png"); |
912 |
TBW_lowGravity->setText(ToggleButtonWidget::tr("Low Gravity")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
913 |
TBW_lowGravity->setToolTip(tr("Lower gravity")); |
1932 | 914 |
glGMLayout->addWidget(TBW_lowGravity,1,0,1,1); |
915 |
||
916 |
TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png"); |
|
917 |
TBW_laserSight->setText(ToggleButtonWidget::tr("Laser Sight")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
918 |
TBW_laserSight->setToolTip(tr("Assisted aiming with laser sight")); |
1932 | 919 |
glGMLayout->addWidget(TBW_laserSight,1,1,1,1); |
1895 | 920 |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
921 |
TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png"); |
1932 | 922 |
TBW_invulnerable->setText(ToggleButtonWidget::tr("Invulnerable")); |
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
923 |
TBW_invulnerable->setToolTip(tr("All hogs have a personal forcefield")); |
1932 | 924 |
glGMLayout->addWidget(TBW_invulnerable,1,2,1,1); |
925 |
||
926 |
TBW_mines = new ToggleButtonWidget(gbGameModes, ":/res/btnMines.png"); |
|
927 |
TBW_mines->setText(ToggleButtonWidget::tr("Add Mines")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
928 |
TBW_mines->setToolTip(tr("Enable random mines")); |
1932 | 929 |
glGMLayout->addWidget(TBW_mines,1,3,1,1); |
1895 | 930 |
|
2017 | 931 |
TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png"); |
932 |
TBW_vampiric->setText(ToggleButtonWidget::tr("Vampirism")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
933 |
TBW_vampiric->setToolTip(tr("Gain 80% of the damage you do back in health")); |
2017 | 934 |
glGMLayout->addWidget(TBW_vampiric,2,0,1,1); |
935 |
||
936 |
TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma.png"); |
|
937 |
TBW_karma->setText(ToggleButtonWidget::tr("Karma")); |
|
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
938 |
TBW_karma->setToolTip(tr("Share your opponents pain, share their damage")); |
2017 | 939 |
glGMLayout->addWidget(TBW_karma,2,1,1,1); |
940 |
||
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
941 |
TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png"); |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
942 |
TBW_artillery->setText(ToggleButtonWidget::tr("Artillery")); |
2026
21c986c528ba
Descriptions for the tooltip buttons. Rename btnInvurnable to btnInvulnerable
nemo
parents:
2023
diff
changeset
|
943 |
TBW_artillery->setToolTip(tr("Your hogs are unable to move, put your artillery skills to the test")); |
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
944 |
glGMLayout->addWidget(TBW_artillery,2,2,1,1); |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
945 |
|
1932 | 946 |
// Right |
947 |
QLabel * l; |
|
948 |
||
949 |
l = new QLabel(gbBasicSettings); |
|
950 |
l->setText(QLabel::tr("Damage Modifier")); |
|
1933 | 951 |
l->setWordWrap(true); |
1932 | 952 |
glBSLayout->addWidget(l,0,0,1,1); |
953 |
l = new QLabel(gbBasicSettings); |
|
954 |
l->setFixedSize(32,32); |
|
955 |
l->setPixmap(QPixmap(":/res/iconDamage.png")); |
|
1943 | 956 |
glBSLayout->addWidget(l,0,1,1,1); |
1932 | 957 |
|
958 |
SB_DamageModifier = new QSpinBox(gbBasicSettings); |
|
1895 | 959 |
SB_DamageModifier->setRange(10, 300); |
960 |
SB_DamageModifier->setValue(100); |
|
961 |
SB_DamageModifier->setSingleStep(25); |
|
1943 | 962 |
glBSLayout->addWidget(SB_DamageModifier,0,2,1,1); |
1932 | 963 |
|
964 |
l = new QLabel(gbBasicSettings); |
|
965 |
l->setText(QLabel::tr("Turn Time")); |
|
1933 | 966 |
l->setWordWrap(true); |
1932 | 967 |
glBSLayout->addWidget(l,1,0,1,1); |
968 |
l = new QLabel(gbBasicSettings); |
|
969 |
l->setFixedSize(32,32); |
|
970 |
l->setPixmap(QPixmap(":/res/iconTime.png")); |
|
1943 | 971 |
glBSLayout->addWidget(l,1,1,1,1); |
1895 | 972 |
|
1932 | 973 |
SB_TurnTime = new QSpinBox(gbBasicSettings); |
1885 | 974 |
SB_TurnTime->setRange(1, 99); |
975 |
SB_TurnTime->setValue(45); |
|
976 |
SB_TurnTime->setSingleStep(15); |
|
1943 | 977 |
glBSLayout->addWidget(SB_TurnTime,1,2,1,1); |
1885 | 978 |
|
1932 | 979 |
l = new QLabel(gbBasicSettings); |
980 |
l->setText(QLabel::tr("Initial Health")); |
|
1933 | 981 |
l->setWordWrap(true); |
1932 | 982 |
glBSLayout->addWidget(l,2,0,1,1); |
983 |
l = new QLabel(gbBasicSettings); |
|
984 |
l->setFixedSize(32,32); |
|
985 |
l->setPixmap(QPixmap(":/res/iconHealth.png")); |
|
1943 | 986 |
glBSLayout->addWidget(l,2,1,1,1); |
1932 | 987 |
|
988 |
SB_InitHealth = new QSpinBox(gbBasicSettings); |
|
1885 | 989 |
SB_InitHealth->setRange(50, 200); |
990 |
SB_InitHealth->setValue(100); |
|
991 |
SB_InitHealth->setSingleStep(25); |
|
1943 | 992 |
glBSLayout->addWidget(SB_InitHealth,2,2,1,1); |
1885 | 993 |
|
1932 | 994 |
l = new QLabel(gbBasicSettings); |
995 |
l->setText(QLabel::tr("Sudden Death Timeout")); |
|
1933 | 996 |
l->setWordWrap(true); |
1932 | 997 |
glBSLayout->addWidget(l,3,0,1,1); |
998 |
l = new QLabel(gbBasicSettings); |
|
999 |
l->setFixedSize(32,32); |
|
1000 |
l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); |
|
1943 | 1001 |
glBSLayout->addWidget(l,3,1,1,1); |
1932 | 1002 |
|
1003 |
SB_SuddenDeath = new QSpinBox(gbBasicSettings); |
|
1885 | 1004 |
SB_SuddenDeath->setRange(0, 50); |
1005 |
SB_SuddenDeath->setValue(15); |
|
1006 |
SB_SuddenDeath->setSingleStep(3); |
|
1943 | 1007 |
glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1); |
1885 | 1008 |
|
1932 | 1009 |
l = new QLabel(gbBasicSettings); |
1943 | 1010 |
l->setText(QLabel::tr("Crate Drops")); |
1933 | 1011 |
l->setWordWrap(true); |
1932 | 1012 |
glBSLayout->addWidget(l,4,0,1,1); |
1013 |
l = new QLabel(gbBasicSettings); |
|
1014 |
l->setFixedSize(32,32); |
|
1015 |
l->setPixmap(QPixmap(":/res/iconBox.png")); |
|
1943 | 1016 |
glBSLayout->addWidget(l,4,1,1,1); |
1932 | 1017 |
|
1018 |
SB_CaseProb = new FreqSpinBox(gbBasicSettings); |
|
1885 | 1019 |
SB_CaseProb->setRange(0, 9); |
1020 |
SB_CaseProb->setValue(5); |
|
1943 | 1021 |
glBSLayout->addWidget(SB_CaseProb,4,2,1,1); |
1932 | 1022 |
|
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1023 |
l = new QLabel(gbBasicSettings); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1024 |
l->setText(QLabel::tr("Mines Time")); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1025 |
l->setWordWrap(true); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1026 |
glBSLayout->addWidget(l,5,0,1,1); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1027 |
l = new QLabel(gbBasicSettings); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1028 |
l->setFixedSize(32,32); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1029 |
l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1030 |
glBSLayout->addWidget(l,5,1,1,1); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1031 |
SB_MinesTime = new QSpinBox(gbBasicSettings); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1032 |
SB_MinesTime->setRange(-1, 3); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1033 |
SB_MinesTime->setValue(3); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1034 |
SB_MinesTime->setSingleStep(1); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1035 |
SB_MinesTime->setSpecialValueText(tr("Random")); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1036 |
SB_MinesTime->setSuffix(" "+ tr("Seconds")); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1037 |
glBSLayout->addWidget(SB_MinesTime,5,2,1,1); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1038 |
|
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1039 |
l = new QLabel(gbBasicSettings); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1040 |
l->setText(QLabel::tr("Mines")); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1041 |
l->setWordWrap(true); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1042 |
glBSLayout->addWidget(l,6,0,1,1); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1043 |
l = new QLabel(gbBasicSettings); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1044 |
l->setFixedSize(32,32); |
2036 | 1045 |
l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1046 |
glBSLayout->addWidget(l,6,1,1,1); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1047 |
SB_Mines = new QSpinBox(gbBasicSettings); |
2076
aa3263e57b8f
increase # of mines to 50, limit max depth of drowning damage tag
nemo
parents:
2072
diff
changeset
|
1048 |
SB_Mines->setRange(1, 50); |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1049 |
SB_Mines->setValue(1); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1050 |
SB_Mines->setSingleStep(5); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1051 |
glBSLayout->addWidget(SB_Mines,6,2,1,1); |
1932 | 1052 |
|
1053 |
l = new QLabel(gbBasicSettings); |
|
1054 |
l->setText(QLabel::tr("Scheme Name:")); |
|
1885 | 1055 |
|
1056 |
LE_name = new QLineEdit(this); |
|
1932 | 1057 |
|
1943 | 1058 |
gl->addWidget(LE_name,14,1,1,5); |
1932 | 1059 |
gl->addWidget(l,14,0,1,1); |
1885 | 1060 |
|
1061 |
mapper = new QDataWidgetMapper(this); |
|
1887 | 1062 |
|
1895 | 1063 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 15, 0, true); |
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1064 |
BtnNew = addButton(tr("New"), pageLayout, 15, 2); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1065 |
BtnDelete = addButton(tr("Delete"), pageLayout, 15, 3); |
1887 | 1066 |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1067 |
selectScheme = new QComboBox(this); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1068 |
pageLayout->addWidget(selectScheme, 15, 1); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1069 |
|
1889 | 1070 |
connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow())); |
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1071 |
connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow())); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1072 |
connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int))); |
1984 | 1073 |
connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int))); |
1887 | 1074 |
} |
1075 |
||
1076 |
void PageScheme::setModel(QAbstractItemModel * model) |
|
1077 |
{ |
|
1078 |
mapper->setModel(model); |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1079 |
selectScheme->setModel(model); |
1887 | 1080 |
|
1885 | 1081 |
mapper->addMapping(LE_name, 0); |
1932 | 1082 |
mapper->addMapping(TBW_mode_Forts->button(), 1); |
1083 |
mapper->addMapping(TBW_teamsDivide->button(), 2); |
|
1084 |
mapper->addMapping(TBW_solid->button(), 3); |
|
1085 |
mapper->addMapping(TBW_border->button(), 4); |
|
1086 |
mapper->addMapping(TBW_lowGravity->button(), 5); |
|
1087 |
mapper->addMapping(TBW_laserSight->button(), 6); |
|
1088 |
mapper->addMapping(TBW_invulnerable->button(), 7); |
|
1089 |
mapper->addMapping(TBW_mines->button(), 8); |
|
2017 | 1090 |
mapper->addMapping(TBW_vampiric->button(), 9); |
1091 |
mapper->addMapping(TBW_karma->button(), 10); |
|
2023
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1092 |
mapper->addMapping(TBW_artillery->button(), 11); |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1093 |
mapper->addMapping(SB_DamageModifier, 12); |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1094 |
mapper->addMapping(SB_TurnTime, 13); |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1095 |
mapper->addMapping(SB_InitHealth, 14); |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1096 |
mapper->addMapping(SB_SuddenDeath, 15); |
41d3afaa20c7
Artillery mode, sniper rifle, speech bubble tweaks, fix of rope bug introduced by enabling hats in jump
nemo
parents:
2017
diff
changeset
|
1097 |
mapper->addMapping(SB_CaseProb, 16); |
2031
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1098 |
mapper->addMapping(SB_MinesTime, 17); |
b6f3e56fb100
david_ac's game scheme options for mine delay/quantity, tweaks to sniper rifle
nemo
parents:
2026
diff
changeset
|
1099 |
mapper->addMapping(SB_Mines, 18); |
1887 | 1100 |
|
1101 |
mapper->toFirst(); |
|
1884 | 1102 |
} |
1889 | 1103 |
|
1104 |
void PageScheme::newRow() |
|
1105 |
{ |
|
1106 |
QAbstractItemModel * model = mapper->model(); |
|
1107 |
model->insertRow(model->rowCount()); |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1108 |
selectScheme->setCurrentIndex(model->rowCount() - 1); |
1889 | 1109 |
} |
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1110 |
|
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1111 |
void PageScheme::deleteRow() |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1112 |
{ |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1113 |
QAbstractItemModel * model = mapper->model(); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1114 |
model->removeRow(selectScheme->currentIndex()); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
1115 |
} |
1905 | 1116 |
|
1984 | 1117 |
void PageScheme::schemeSelected(int n) |
1118 |
{ |
|
1119 |
gbGameModes->setEnabled(n >= 4); // FIXME: derive number from model |
|
1120 |
gbBasicSettings->setEnabled(n >= 4); |
|
1121 |
LE_name->setEnabled(n >= 4); |
|
1122 |
} |
|
1123 |
||
1905 | 1124 |
///////////////////////////////////////////////// |
1125 |
||
1126 |
PageAdmin::PageAdmin(QWidget* parent) : |
|
1127 |
AbstractPage(parent) |
|
1128 |
{ |
|
1129 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1130 |
||
1924 | 1131 |
QLabel * lblSM = new QLabel(this); |
1132 |
lblSM->setText(tr("Server message:")); |
|
1133 |
pageLayout->addWidget(lblSM, 0, 0); |
|
1134 |
||
1135 |
leServerMessage = new QLineEdit(this); |
|
1136 |
pageLayout->addWidget(leServerMessage, 0, 1); |
|
1137 |
||
1138 |
pbSetSM = addButton(tr("Set message"), pageLayout, 0, 2); |
|
1905 | 1139 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
1924 | 1140 |
|
1141 |
connect(pbSetSM, SIGNAL(clicked()), this, SLOT(smChanged())); |
|
1905 | 1142 |
} |
1924 | 1143 |
|
1144 |
void PageAdmin::smChanged() |
|
1145 |
{ |
|
1146 |
emit setServerMessage(leServerMessage->text()); |
|
1147 |
} |
|
1148 |
||
1149 |
void PageAdmin::serverMessage(const QString & str) |
|
1150 |
{ |
|
1151 |
leServerMessage->setText(str); |
|
1152 |
} |
|
1950 | 1153 |
|
1154 |
///////////////////////////////////////////////// |
|
1155 |
||
1156 |
PageNetType::PageNetType(QWidget* parent) : AbstractPage(parent) |
|
1157 |
{ |
|
1158 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1159 |
pageLayout->setRowStretch(0, 10); |
|
1977 | 1160 |
pageLayout->setRowStretch(3, 10); |
1161 |
||
1162 |
pageLayout->setColumnStretch(1, 10); |
|
1163 |
pageLayout->setColumnStretch(2, 20); |
|
1164 |
pageLayout->setColumnStretch(3, 10); |
|
1950 | 1165 |
|
1977 | 1166 |
BtnLAN = addButton(tr("LAN game"), pageLayout, 1, 2); |
1167 |
BtnOfficialServer = addButton(tr("Official server"), pageLayout, 2, 2); |
|
1950 | 1168 |
|
1977 | 1169 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
1950 | 1170 |
} |