author | unc0rr |
Wed, 22 Oct 2008 15:31:35 +0000 | |
changeset 1396 | abb28dcb6d0d |
parent 1395 | 46fd70de89e2 |
child 1399 | ada2411c1d60 |
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> |
184 | 37 |
|
38 |
#include "pages.h" |
|
39 |
#include "sdlkeys.h" |
|
40 |
#include "hwconsts.h" |
|
41 |
#include "gamecfgwidget.h" |
|
42 |
#include "teamselect.h" |
|
43 |
#include "gamecfgwidget.h" |
|
44 |
#include "SquareLabel.h" |
|
45 |
#include "mapContainer.h" |
|
187 | 46 |
#include "about.h" |
297 | 47 |
#include "fpsedit.h" |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
48 |
#include "netserverslist.h" |
412 | 49 |
#include "netudpwidget.h" |
461 | 50 |
#include "chatwidget.h" |
579 | 51 |
#include "playrecordpage.h" |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
603
diff
changeset
|
52 |
#include "selectWeapon.h" |
1192 | 53 |
#include "igbox.h" |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
54 |
#include "hats.h" |
184 | 55 |
|
684 | 56 |
PageMain::PageMain(QWidget* parent) : |
57 |
AbstractPage(parent) |
|
184 | 58 |
{ |
59 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1148 | 60 |
//pageLayout->setColumnStretch(0, 1); |
61 |
//pageLayout->setColumnStretch(1, 2); |
|
62 |
//pageLayout->setColumnStretch(2, 1); |
|
184 | 63 |
|
1199 | 64 |
//QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
65 |
//pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); |
|
1148 | 66 |
pageLayout->setRowStretch(0, 1); |
1150 | 67 |
pageLayout->setRowStretch(1, 1); |
68 |
pageLayout->setRowStretch(2, 0); |
|
69 |
pageLayout->setRowStretch(3, 1); |
|
1199 | 70 |
pageLayout->setRowStretch(4, 1); |
184 | 71 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
72 |
BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
1150 | 73 |
pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
184 | 74 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
75 |
BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
1150 | 76 |
pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
579 | 77 |
|
1199 | 78 |
BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true); |
184 | 79 |
|
1199 | 80 |
//BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
81 |
BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
1212 | 82 |
BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
1150 | 83 |
pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
1199 | 84 |
//pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
184 | 85 |
|
1199 | 86 |
BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
184 | 87 |
} |
88 |
||
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
730
diff
changeset
|
89 |
PageEditTeam::PageEditTeam(QWidget* parent) : |
692 | 90 |
AbstractPage(parent) |
184 | 91 |
{ |
92 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1252 | 93 |
QTabWidget * tbw = new QTabWidget(this); |
1389 | 94 |
QWidget * page1 = new QWidget(this); |
95 |
QWidget * page2 = new QWidget(this); |
|
1252 | 96 |
tbw->addTab(page1, tr("General")); |
97 |
tbw->addTab(page2, tr("Advanced")); |
|
98 |
pageLayout->addWidget(tbw, 0, 0, 1, 3); |
|
99 |
BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
|
100 |
BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);; |
|
184 | 101 |
|
1252 | 102 |
QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
103 |
page1Layout->setAlignment(Qt::AlignTop); |
|
104 |
QGridLayout * page2Layout = new QGridLayout(page2); |
|
105 |
||
106 |
// ====== Page 1 ====== |
|
107 |
QVBoxLayout * vbox1 = new QVBoxLayout(); |
|
108 |
QVBoxLayout * vbox2 = new QVBoxLayout(); |
|
109 |
QVBoxLayout * vbox3 = new QVBoxLayout(); |
|
110 |
page1Layout->addLayout(vbox1); |
|
111 |
page1Layout->addLayout(vbox2); |
|
112 |
page1Layout->addLayout(vbox3); |
|
113 |
||
588 | 114 |
GBoxHedgehogs = new QGroupBox(this); |
184 | 115 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
116 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
117 |
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
|
118 |
|
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
119 |
HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
184 | 120 |
for(int i = 0; i < 8; i++) |
121 |
{ |
|
122 |
HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
|
1216
df1b19976e28
Allow team and hh name length be up to 64 letters length
unc0rr
parents:
1212
diff
changeset
|
123 |
HHNameEdit[i]->setMaxLength(64); |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
124 |
HHNameEdit[i]->setMinimumWidth(120); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
125 |
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
|
126 |
|
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
127 |
HHHats[i] = new QComboBox(GBoxHedgehogs); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
128 |
HHHats[i]->setModel(hatsModel); |
1282 | 129 |
HHHats[i]->setIconSize(QSize(32, 37)); |
130 |
//HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
|
1239 | 131 |
//HHHats[i]->setModelColumn(1); |
1240 | 132 |
//HHHats[i]->setMinimumWidth(132); |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
133 |
GBHLayout->addWidget(HHHats[i], i, 1); |
184 | 134 |
} |
1252 | 135 |
vbox1->addWidget(GBoxHedgehogs); |
136 |
||
137 |
||
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
138 |
GBoxTeam = new QGroupBox(this); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
139 |
GBoxTeam->setTitle(QGroupBox::tr("Team")); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
140 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
141 |
QVBoxLayout * GBTLayout = new QVBoxLayout(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
142 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
143 |
TeamNameEdit->setMaxLength(64); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
144 |
GBTLayout->addWidget(TeamNameEdit); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
145 |
vbox2->addWidget(GBoxTeam); |
1252 | 146 |
|
1290 | 147 |
CBTeamLvl = new QComboBox(GBoxTeam); |
1287 | 148 |
CBTeamLvl->setIconSize(QSize(32, 32)); |
149 |
CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
|
150 |
for(int i = 5; i > 0; i--) |
|
151 |
CBTeamLvl->addItem( |
|
152 |
QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
|
153 |
QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
|
154 |
); |
|
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
155 |
GBTLayout->addWidget(CBTeamLvl); |
1287 | 156 |
|
1290 | 157 |
CBGrave = new QComboBox(GBoxTeam); |
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
158 |
CBGrave->setMaxCount(65535); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
159 |
CBGrave->setIconSize(QSize(32, 32)); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
160 |
GBTLayout->addWidget(CBGrave); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
161 |
|
1252 | 162 |
GBoxFort = new QGroupBox(this); |
163 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
|
164 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
|
165 |
CBFort = new QComboBox(GBoxFort); |
|
166 |
CBFort->setMaxCount(65535); |
|
167 |
GBFLayout->addWidget(CBFort, 0, 0); |
|
168 |
FortPreview = new SquareLabel(GBoxFort); |
|
169 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
170 |
FortPreview->setPixmap(QPixmap()); |
|
171 |
GBFLayout->addWidget(FortPreview, 1, 0); |
|
172 |
vbox3->addWidget(GBoxFort); |
|
173 |
||
174 |
QDir tmpdir; |
|
175 |
tmpdir.cd(datadir->absolutePath()); |
|
176 |
tmpdir.cd("Forts"); |
|
177 |
tmpdir.setFilter(QDir::Files); |
|
178 |
||
1287 | 179 |
connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
1252 | 180 |
CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
1287 | 181 |
|
1252 | 182 |
tmpdir.cd("../Graphics/Graves"); |
183 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
184 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
185 |
{ |
|
1287 | 186 |
QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); |
187 |
QIcon icon(pix.copy(0, 0, 32, 32)); |
|
188 |
CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
|
1252 | 189 |
} |
190 |
||
191 |
vbox1->addStretch(); |
|
192 |
vbox2->addStretch(); |
|
193 |
// vbox3->addStretch(); |
|
194 |
||
195 |
// ====== Page 2 ====== |
|
588 | 196 |
GBoxBinds = new QGroupBox(this); |
184 | 197 |
GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
198 |
QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
|
199 |
BindsBox = new QToolBox(GBoxBinds); |
|
200 |
BindsBox->setLineWidth(0); |
|
201 |
GBBLayout->addWidget(BindsBox); |
|
1389 | 202 |
page_A = new QWidget(this); |
184 | 203 |
BindsBox->addItem(page_A, QToolBox::tr("Actions")); |
1389 | 204 |
page_W = new QWidget(this); |
184 | 205 |
BindsBox->addItem(page_W, QToolBox::tr("Weapons")); |
1389 | 206 |
page_WP = new QWidget(this); |
184 | 207 |
BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); |
1389 | 208 |
page_O = new QWidget(this); |
184 | 209 |
BindsBox->addItem(page_O, QToolBox::tr("Other")); |
1252 | 210 |
page2Layout->addWidget(GBoxBinds, 0, 0); |
184 | 211 |
|
212 |
QStringList binds; |
|
213 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
214 |
{ |
|
215 |
binds << sdlkeys[i][1]; |
|
216 |
} |
|
217 |
||
218 |
quint16 widind = 0, i = 0; |
|
219 |
while (i < BINDS_NUMBER) { |
|
220 |
quint16 num = 0; |
|
1389 | 221 |
QWidget * curW = BindsBox->widget(widind); |
222 |
QGridLayout * pagelayout = new QGridLayout(curW); |
|
184 | 223 |
do { |
1389 | 224 |
LBind[i] = new QLabel(curW); |
184 | 225 |
LBind[i]->setText(QApplication::translate("binds", cbinds[i].name)); |
226 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
227 |
pagelayout->addWidget(LBind[i], num, 0); |
|
1389 | 228 |
CBBind[i] = new QComboBox(curW); |
184 | 229 |
CBBind[i]->addItems(binds); |
230 |
pagelayout->addWidget(CBBind[i], num, 1); |
|
231 |
num++; |
|
232 |
} while (!cbinds[i++].chwidget); |
|
1389 | 233 |
pagelayout->addWidget(new QWidget(curW), num, 0, 1, 2); |
184 | 234 |
widind++; |
235 |
} |
|
236 |
} |
|
237 |
||
238 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
|
239 |
{ |
|
240 |
QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
|
241 |
FortPreview->setPixmap(pix); |
|
242 |
} |
|
243 |
||
1287 | 244 |
PageMultiplayer::PageMultiplayer(QWidget* parent) : |
692 | 245 |
AbstractPage(parent) |
184 | 246 |
{ |
247 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
248 |
||
1218 | 249 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
187 | 250 |
|
184 | 251 |
gameCFG = new GameCFGWidget(this); |
252 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
696 | 253 |
|
1218 | 254 |
pageLayout->setRowStretch(1, 1); |
255 |
||
184 | 256 |
teamsSelect = new TeamSelWidget(this); |
1218 | 257 |
pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
184 | 258 |
|
1218 | 259 |
BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
184 | 260 |
} |
261 |
||
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
|
262 |
PageOptions::PageOptions(QWidget* parent) : |
692 | 263 |
AbstractPage(parent) |
184 | 264 |
{ |
265 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
427 | 266 |
pageLayout->setColumnStretch(0, 100); |
267 |
pageLayout->setColumnStretch(1, 100); |
|
268 |
pageLayout->setColumnStretch(2, 100); |
|
269 |
pageLayout->setRowStretch(0, 0); |
|
270 |
pageLayout->setRowStretch(1, 0); |
|
719 | 271 |
pageLayout->setRowStretch(2, 0); |
272 |
pageLayout->setRowStretch(3, 100); |
|
273 |
pageLayout->setRowStretch(4, 0); |
|
427 | 274 |
|
1198 | 275 |
|
276 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
277 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
278 |
QHBoxLayout * gbTBLayout = new QHBoxLayout(gbTwoBoxes); |
|
279 |
{ |
|
280 |
teamsBox = new IconedGroupBox(this); |
|
281 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
|
282 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
283 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
284 |
||
285 |
QGridLayout * GBTlayout = new QGridLayout(teamsBox); |
|
286 |
||
287 |
BtnNewTeam = addButton(tr("New team"), GBTlayout, 1, 0); |
|
288 |
||
289 |
CBTeamName = new QComboBox(teamsBox); |
|
290 |
GBTlayout->addWidget(CBTeamName, 0, 0, 1, 2); |
|
184 | 291 |
|
1198 | 292 |
BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 1, 1); |
1199 | 293 |
|
294 |
labelNN = new QLabel(teamsBox); |
|
295 |
labelNN->setText(QLabel::tr("Net nick")); |
|
296 |
GBTlayout->addWidget(labelNN, 2, 0, 1, 2); |
|
297 |
||
298 |
editNetNick = new QLineEdit(teamsBox); |
|
299 |
editNetNick->setMaxLength(20); |
|
300 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
301 |
GBTlayout->addWidget(editNetNick, 3, 0, 1, 2); |
|
302 |
||
1198 | 303 |
gbTBLayout->addWidget(teamsBox); |
304 |
} |
|
184 | 305 |
|
1198 | 306 |
{ |
307 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1199 | 308 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 309 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 310 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 311 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
312 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 313 |
|
1198 | 314 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
315 |
WeaponsName = new QComboBox(this); |
|
316 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
317 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
318 |
gbTBLayout->addWidget(groupWeapons); |
|
319 |
} |
|
184 | 320 |
|
1193 | 321 |
AGGroupBox = new IconedGroupBox(this); |
322 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
184 | 323 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
324 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
693 | 325 |
pageLayout->addWidget(AGGroupBox, 2, 1); |
184 | 326 |
|
427 | 327 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
436 | 328 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
427 | 329 |
QLabel * resolution = new QLabel(AGGroupBox); |
330 |
resolution->setText(QLabel::tr("Resolution")); |
|
331 |
GBAreslayout->addWidget(resolution); |
|
332 |
||
184 | 333 |
CBResolution = new QComboBox(AGGroupBox); |
427 | 334 |
GBAreslayout->addWidget(CBResolution); |
335 |
GBAlayout->addLayout(GBAreslayout); |
|
336 |
||
436 | 337 |
QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); |
427 | 338 |
QLabel * maxfps = new QLabel(AGGroupBox); |
339 |
maxfps->setText(QLabel::tr("FPS limit")); |
|
340 |
GBAfpslayout->addWidget(maxfps); |
|
341 |
GBAlayout->addLayout(GBAfpslayout); |
|
184 | 342 |
|
343 |
CBFullscreen = new QCheckBox(AGGroupBox); |
|
344 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
427 | 345 |
GBAlayout->addWidget(CBFullscreen); |
184 | 346 |
|
1162 | 347 |
CBFrontendFullscreen = new QCheckBox(AGGroupBox); |
348 |
CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); |
|
349 |
GBAlayout->addWidget(CBFrontendFullscreen); |
|
350 |
||
1157 | 351 |
CBEnableSound = new QCheckBox(AGGroupBox); |
184 | 352 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
427 | 353 |
GBAlayout->addWidget(CBEnableSound); |
184 | 354 |
|
1157 | 355 |
CBEnableMusic = new QCheckBox(AGGroupBox); |
1129 | 356 |
CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
357 |
GBAlayout->addWidget(CBEnableMusic); |
|
358 |
||
297 | 359 |
CBShowFPS = new QCheckBox(AGGroupBox); |
360 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
427 | 361 |
GBAlayout->addWidget(CBShowFPS); |
297 | 362 |
|
529 | 363 |
CBAltDamage = new QCheckBox(AGGroupBox); |
364 |
CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); |
|
365 |
GBAlayout->addWidget(CBAltDamage); |
|
366 |
||
297 | 367 |
fpsedit = new FPSEdit(AGGroupBox); |
427 | 368 |
GBAfpslayout->addWidget(fpsedit); |
184 | 369 |
|
1157 | 370 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 4, 2, true); |
184 | 371 |
|
1153 | 372 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
184 | 373 |
} |
374 |
||
1153 | 375 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 376 |
{ |
377 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
378 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
379 |
pageLayout->setColumnStretch(0, 1); |
|
380 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 381 |
pageLayout->setColumnStretch(2, 1); |
421 | 382 |
|
383 |
BtnNetSvrStart = new QPushButton(this); |
|
384 |
BtnNetSvrStart->setFont(*font14); |
|
385 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
1395 | 386 |
pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
387 |
||
388 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
|
184 | 389 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
390 |
ConnGroupBox = new QGroupBox(this); |
421 | 391 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
392 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
393 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 394 |
GBClayout->setColumnStretch(0, 1); |
421 | 395 |
GBClayout->setColumnStretch(1, 1); |
396 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 397 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
398 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 399 |
BtnNetConnect->setFont(*font14); |
400 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 401 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 402 |
|
665 | 403 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
404 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 405 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 406 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
407 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
408 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
409 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 410 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 411 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
412 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
413 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
414 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
415 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
416 |
|
1395 | 417 |
BtnOfficialServer = new QPushButton(ConnGroupBox); |
418 |
BtnOfficialServer->setFont(*font14); |
|
419 |
BtnOfficialServer->setText(QPushButton::tr("Join official server")); |
|
420 |
GBClayout->addWidget(BtnOfficialServer, 3, 0, 1, 3); |
|
636 | 421 |
|
668 | 422 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 423 |
} |
424 |
||
646 | 425 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
426 |
{ |
1310 | 427 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
659 | 428 |
|
673 | 429 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
430 |
||
665 | 431 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
432 |
|
665 | 433 |
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
|
434 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 435 |
} |
436 |
||
437 |
void PageNet::slotConnect() |
|
438 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
439 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
440 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
441 |
if(!mi.isValid()) |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
442 |
{ |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
443 |
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
|
444 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
445 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
446 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
447 |
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
|
448 |
|
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
|
449 |
emit connectClicked(host, port); |
646 | 450 |
} |
451 |
||
1153 | 452 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 453 |
{ |
454 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
455 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
456 |
pageLayout->setColumnStretch(0, 1); |
|
457 |
pageLayout->setColumnStretch(1, 1); |
|
458 |
pageLayout->setColumnStretch(2, 1); |
|
459 |
||
675 | 460 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
461 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
462 |
|
1153 | 463 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 464 |
|
465 |
BtnStart = new QPushButton(this); |
|
466 |
BtnStart->setFont(*font14); |
|
467 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 468 |
pageLayout->addWidget(BtnStart, 1, 2); |
469 |
||
470 |
QWidget * wg = new QWidget(this); |
|
471 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
472 |
|
675 | 473 |
QGridLayout * wgLayout = new QGridLayout(wg); |
474 |
wgLayout->setColumnStretch(0, 1); |
|
475 |
wgLayout->setColumnStretch(1, 3); |
|
476 |
wgLayout->setColumnStretch(2, 1); |
|
477 |
||
478 |
wgLayout->setRowStretch(0, 0); |
|
479 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
480 |
|
675 | 481 |
QGroupBox * gb = new QGroupBox(wg); |
482 |
wgLayout->addWidget(gb, 0, 1); |
|
483 |
||
484 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
485 |
||
486 |
labelSD = new QLabel(gb); |
|
487 |
labelSD->setText(QLabel::tr("Server name:")); |
|
488 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
489 |
|
675 | 490 |
leServerDescr = new QLineEdit(gb); |
491 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
492 |
||
493 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
494 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 495 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
496 |
|
675 | 497 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
498 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
499 |
sbPort->setMaximum(65535); |
675 | 500 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
501 |
|
675 | 502 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
503 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 504 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
505 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
506 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
507 |
} |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
508 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
509 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
510 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
511 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
512 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
513 |
|
1153 | 514 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 515 |
{ |
516 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
517 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 518 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 519 |
//pageLayout->setSpacing(1); |
463 | 520 |
pageLayout->setColumnStretch(0, 50); |
521 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 522 |
|
461 | 523 |
// chatwidget |
524 |
pChatWidget = new HWChatWidget(this); |
|
525 |
pageLayout->addWidget(pChatWidget, 1, 0); |
|
464 | 526 |
pageLayout->setRowStretch(1, 100); |
453 | 527 |
|
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
528 |
pGameCFG = new GameCFGWidget(this); |
322 | 529 |
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
|
530 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
531 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 532 |
pNetTeamsWidget->setAcceptOuter(true); |
461 | 533 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); |
184 | 534 |
|
1153 | 535 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
184 | 536 |
|
646 | 537 |
BtnGo = new QPushButton(this); |
184 | 538 |
BtnGo->setFont(*font14); |
539 |
BtnGo->setText(QPushButton::tr("Go!")); |
|
492 | 540 |
BtnGo->setEnabled(false); |
461 | 541 |
pageLayout->addWidget(BtnGo, 2, 1); |
184 | 542 |
} |
187 | 543 |
|
1153 | 544 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 545 |
{ |
546 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
547 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
548 |
pageLayout->setColumnStretch(0, 1); |
|
549 |
pageLayout->setColumnStretch(1, 1); |
|
550 |
pageLayout->setColumnStretch(2, 1); |
|
551 |
||
1153 | 552 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 553 |
|
554 |
about = new About(this); |
|
555 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
556 |
} |
|
306 | 557 |
|
1153 | 558 |
PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) |
306 | 559 |
{ |
560 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
561 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
562 |
pageLayout->setColumnStretch(0, 1); |
|
563 |
pageLayout->setColumnStretch(1, 1); |
|
564 |
pageLayout->setColumnStretch(2, 1); |
|
565 |
||
1153 | 566 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
306 | 567 |
|
307 | 568 |
labelGameStats = new QLabel(this); |
569 |
labelGameStats->setTextFormat(Qt::RichText); |
|
570 |
pageLayout->addWidget(labelGameStats, 0, 0, 1, 3); |
|
306 | 571 |
} |
586 | 572 |
|
1150 | 573 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 574 |
{ |
575 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
576 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1252 | 577 |
// pageLayout->setColumnStretch(0, 1); |
578 |
// pageLayout->setColumnStretch(1, 2); |
|
579 |
// pageLayout->setColumnStretch(2, 1); |
|
588 | 580 |
pageLayout->setRowStretch(0, 1); |
1150 | 581 |
pageLayout->setRowStretch(6, 1); |
586 | 582 |
|
1150 | 583 |
BtnSimpleGamePage = addButton(tr("Simple Game"), pageLayout, 1, 1); |
584 |
BtnTrainPage = addButton(tr("Training"), pageLayout, 2, 1); |
|
585 |
BtnMultiplayer = addButton(tr("Multiplayer"), pageLayout, 3, 1); |
|
586 |
BtnLoad = addButton(tr("Saved games"), pageLayout, 4, 1); |
|
587 |
BtnDemos = addButton(tr("Demos"), pageLayout, 5, 1); |
|
586 | 588 |
|
1153 | 589 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 7, 0, true); |
586 | 590 |
} |
591 |
||
1153 | 592 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 593 |
{ |
594 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
595 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
596 |
pageLayout->setColumnStretch(0, 1); |
|
597 |
pageLayout->setColumnStretch(1, 2); |
|
598 |
pageLayout->setColumnStretch(2, 1); |
|
599 |
||
600 |
BtnStartTrain = new QPushButton(this); |
|
601 |
BtnStartTrain->setFont(*font14); |
|
602 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
603 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
604 |
||
1153 | 605 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 606 |
} |
607 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
608 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 609 |
AbstractPage(parent) |
600 | 610 |
{ |
611 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
612 |
|
1168 | 613 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size() - 10, this); |
718 | 614 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 615 |
|
1168 | 616 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 617 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
618 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 619 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
600 | 620 |
} |
621 |
||
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
|
622 |
PageInGame::PageInGame(QWidget* parent) : |
686 | 623 |
AbstractPage(parent) |
624 |
{ |
|
625 |
QLabel * label = new QLabel(this); |
|
626 |
label->setText("In game..."); |
|
627 |
} |
|
1311 | 628 |
|
629 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
|
630 |
AbstractPage(parent) |
|
631 |
{ |
|
1312 | 632 |
QGridLayout * pageLayout = new QGridLayout(this); |
1314 | 633 |
|
634 |
roomName = new QLineEdit(this); |
|
1334
b58afaadf7ae
Send team removal message to others in room when client disconnects
unc0rr
parents:
1315
diff
changeset
|
635 |
roomName->setMaxLength(60); |
1314 | 636 |
pageLayout->addWidget(roomName, 0, 0); |
1312 | 637 |
roomsList = new QListWidget(this); |
1314 | 638 |
pageLayout->addWidget(roomsList, 1, 0, 3, 1); |
1377 | 639 |
serverMessage = new QTextBrowser(this); |
640 |
serverMessage->setOpenExternalLinks(true); |
|
641 |
pageLayout->addWidget(serverMessage, 4, 0, 1, 2); |
|
1312 | 642 |
|
1377 | 643 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
1312 | 644 |
BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
645 |
BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
|
646 |
BtnRefresh = addButton(tr("Refresh"), pageLayout, 2, 1); |
|
1314 | 647 |
|
648 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
|
649 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
|
1315 | 650 |
connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
1314 | 651 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
1311 | 652 |
} |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
653 |
|
1377 | 654 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
655 |
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
|
656 |
{ |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
657 |
roomsList->clear(); |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
658 |
roomsList->addItems(list); |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
659 |
roomsList->sortItems(); |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
660 |
} |
1314 | 661 |
|
662 |
void PageRoomsList::onCreateClick() |
|
663 |
{ |
|
664 |
if (roomName->text().size()) |
|
665 |
emit askForCreateRoom(roomName->text()); |
|
666 |
else |
|
667 |
QMessageBox::critical(this, |
|
668 |
tr("Error"), |
|
1315 | 669 |
tr("Please, enter room name"), |
1314 | 670 |
tr("OK")); |
671 |
} |
|
672 |
||
673 |
void PageRoomsList::onJoinClick() |
|
674 |
{ |
|
675 |
QListWidgetItem * curritem = roomsList->currentItem(); |
|
676 |
if (!curritem) |
|
677 |
{ |
|
678 |
QMessageBox::critical(this, |
|
679 |
tr("Error"), |
|
680 |
tr("Please, select room from the list"), |
|
681 |
tr("OK")); |
|
682 |
return ; |
|
683 |
} |
|
684 |
emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
685 |
} |
|
686 |
||
1315 | 687 |
void PageRoomsList::onRefreshClick() |
688 |
{ |
|
689 |
emit askForRoomList(); |
|
690 |
} |
|
691 |