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