author | unc0rr |
Sat, 18 Oct 2008 13:53:58 +0000 | |
changeset 1377 | a9e768739345 |
parent 1334 | b58afaadf7ae |
child 1389 | 6e411559cc7b |
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); |
94 |
QWidget * page1 = new QWidget(); |
|
95 |
QWidget * page2 = new QWidget(); |
|
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); |
|
202 |
page_A = new QWidget(); |
|
203 |
BindsBox->addItem(page_A, QToolBox::tr("Actions")); |
|
204 |
page_W = new QWidget(); |
|
205 |
BindsBox->addItem(page_W, QToolBox::tr("Weapons")); |
|
206 |
page_WP = new QWidget(); |
|
207 |
BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); |
|
208 |
page_O = new QWidget(); |
|
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; |
|
221 |
QGridLayout * pagelayout = new QGridLayout(BindsBox->widget(widind)); |
|
222 |
do { |
|
223 |
LBind[i] = new QLabel(BindsBox->widget(widind)); |
|
224 |
LBind[i]->setText(QApplication::translate("binds", cbinds[i].name)); |
|
225 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
226 |
pagelayout->addWidget(LBind[i], num, 0); |
|
227 |
CBBind[i] = new QComboBox(BindsBox->widget(widind)); |
|
228 |
CBBind[i]->addItems(binds); |
|
229 |
pagelayout->addWidget(CBBind[i], num, 1); |
|
230 |
num++; |
|
231 |
} while (!cbinds[i++].chwidget); |
|
232 |
pagelayout->addWidget(new QWidget(BindsBox->widget(widind)), num, 0, 1, 2); |
|
233 |
widind++; |
|
234 |
} |
|
235 |
} |
|
236 |
||
237 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
|
238 |
{ |
|
239 |
QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
|
240 |
FortPreview->setPixmap(pix); |
|
241 |
} |
|
242 |
||
1287 | 243 |
PageMultiplayer::PageMultiplayer(QWidget* parent) : |
692 | 244 |
AbstractPage(parent) |
184 | 245 |
{ |
246 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
247 |
||
1218 | 248 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
187 | 249 |
|
184 | 250 |
gameCFG = new GameCFGWidget(this); |
251 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
696 | 252 |
|
1218 | 253 |
pageLayout->setRowStretch(1, 1); |
254 |
||
184 | 255 |
teamsSelect = new TeamSelWidget(this); |
1218 | 256 |
pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
184 | 257 |
|
1218 | 258 |
BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
184 | 259 |
} |
260 |
||
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
|
261 |
PageOptions::PageOptions(QWidget* parent) : |
692 | 262 |
AbstractPage(parent) |
184 | 263 |
{ |
264 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
427 | 265 |
pageLayout->setColumnStretch(0, 100); |
266 |
pageLayout->setColumnStretch(1, 100); |
|
267 |
pageLayout->setColumnStretch(2, 100); |
|
268 |
pageLayout->setRowStretch(0, 0); |
|
269 |
pageLayout->setRowStretch(1, 0); |
|
719 | 270 |
pageLayout->setRowStretch(2, 0); |
271 |
pageLayout->setRowStretch(3, 100); |
|
272 |
pageLayout->setRowStretch(4, 0); |
|
427 | 273 |
|
1198 | 274 |
|
275 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
276 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
277 |
QHBoxLayout * gbTBLayout = new QHBoxLayout(gbTwoBoxes); |
|
278 |
{ |
|
279 |
teamsBox = new IconedGroupBox(this); |
|
280 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
|
281 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
282 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
283 |
||
284 |
QGridLayout * GBTlayout = new QGridLayout(teamsBox); |
|
285 |
||
286 |
BtnNewTeam = addButton(tr("New team"), GBTlayout, 1, 0); |
|
287 |
||
288 |
CBTeamName = new QComboBox(teamsBox); |
|
289 |
GBTlayout->addWidget(CBTeamName, 0, 0, 1, 2); |
|
184 | 290 |
|
1198 | 291 |
BtnEditTeam = addButton(tr("Edit team"), GBTlayout, 1, 1); |
1199 | 292 |
|
293 |
labelNN = new QLabel(teamsBox); |
|
294 |
labelNN->setText(QLabel::tr("Net nick")); |
|
295 |
GBTlayout->addWidget(labelNN, 2, 0, 1, 2); |
|
296 |
||
297 |
editNetNick = new QLineEdit(teamsBox); |
|
298 |
editNetNick->setMaxLength(20); |
|
299 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
300 |
GBTlayout->addWidget(editNetNick, 3, 0, 1, 2); |
|
301 |
||
1198 | 302 |
gbTBLayout->addWidget(teamsBox); |
303 |
} |
|
184 | 304 |
|
1198 | 305 |
{ |
306 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1199 | 307 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 308 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 309 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 310 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
311 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 312 |
|
1198 | 313 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
314 |
WeaponsName = new QComboBox(this); |
|
315 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
316 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
317 |
gbTBLayout->addWidget(groupWeapons); |
|
318 |
} |
|
184 | 319 |
|
1193 | 320 |
AGGroupBox = new IconedGroupBox(this); |
321 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
184 | 322 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
323 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
693 | 324 |
pageLayout->addWidget(AGGroupBox, 2, 1); |
184 | 325 |
|
427 | 326 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
436 | 327 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
427 | 328 |
QLabel * resolution = new QLabel(AGGroupBox); |
329 |
resolution->setText(QLabel::tr("Resolution")); |
|
330 |
GBAreslayout->addWidget(resolution); |
|
331 |
||
184 | 332 |
CBResolution = new QComboBox(AGGroupBox); |
427 | 333 |
GBAreslayout->addWidget(CBResolution); |
334 |
GBAlayout->addLayout(GBAreslayout); |
|
335 |
||
436 | 336 |
QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); |
427 | 337 |
QLabel * maxfps = new QLabel(AGGroupBox); |
338 |
maxfps->setText(QLabel::tr("FPS limit")); |
|
339 |
GBAfpslayout->addWidget(maxfps); |
|
340 |
GBAlayout->addLayout(GBAfpslayout); |
|
184 | 341 |
|
342 |
CBFullscreen = new QCheckBox(AGGroupBox); |
|
343 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
427 | 344 |
GBAlayout->addWidget(CBFullscreen); |
184 | 345 |
|
1162 | 346 |
CBFrontendFullscreen = new QCheckBox(AGGroupBox); |
347 |
CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); |
|
348 |
GBAlayout->addWidget(CBFrontendFullscreen); |
|
349 |
||
1157 | 350 |
CBEnableSound = new QCheckBox(AGGroupBox); |
184 | 351 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
427 | 352 |
GBAlayout->addWidget(CBEnableSound); |
184 | 353 |
|
1157 | 354 |
CBEnableMusic = new QCheckBox(AGGroupBox); |
1129 | 355 |
CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
356 |
GBAlayout->addWidget(CBEnableMusic); |
|
357 |
||
297 | 358 |
CBShowFPS = new QCheckBox(AGGroupBox); |
359 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
427 | 360 |
GBAlayout->addWidget(CBShowFPS); |
297 | 361 |
|
529 | 362 |
CBAltDamage = new QCheckBox(AGGroupBox); |
363 |
CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); |
|
364 |
GBAlayout->addWidget(CBAltDamage); |
|
365 |
||
297 | 366 |
fpsedit = new FPSEdit(AGGroupBox); |
427 | 367 |
GBAfpslayout->addWidget(fpsedit); |
184 | 368 |
|
1157 | 369 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 4, 2, true); |
184 | 370 |
|
1153 | 371 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
184 | 372 |
} |
373 |
||
1153 | 374 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 375 |
{ |
376 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
377 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
378 |
pageLayout->setColumnStretch(0, 1); |
|
379 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 380 |
pageLayout->setColumnStretch(2, 1); |
421 | 381 |
|
382 |
BtnNetSvrStart = new QPushButton(this); |
|
383 |
BtnNetSvrStart->setFont(*font14); |
|
384 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
617 | 385 |
pageLayout->addWidget(BtnNetSvrStart, 3, 2); |
184 | 386 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
387 |
ConnGroupBox = new QGroupBox(this); |
421 | 388 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
389 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
390 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 391 |
GBClayout->setColumnStretch(0, 1); |
421 | 392 |
GBClayout->setColumnStretch(1, 1); |
393 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 394 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
395 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 396 |
BtnNetConnect->setFont(*font14); |
397 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 398 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 399 |
|
665 | 400 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
401 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 402 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 403 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
404 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
405 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
406 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 407 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 408 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
409 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
410 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
411 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
412 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
413 |
|
1153 | 414 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true); |
636 | 415 |
|
668 | 416 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 417 |
} |
418 |
||
646 | 419 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
420 |
{ |
1310 | 421 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
659 | 422 |
|
673 | 423 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
424 |
||
665 | 425 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
426 |
|
665 | 427 |
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
|
428 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 429 |
} |
430 |
||
431 |
void PageNet::slotConnect() |
|
432 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
433 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
434 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
435 |
if(!mi.isValid()) |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
436 |
{ |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
437 |
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
|
438 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
439 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
440 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
441 |
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
|
442 |
|
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
|
443 |
emit connectClicked(host, port); |
646 | 444 |
} |
445 |
||
1153 | 446 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 447 |
{ |
448 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
449 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
450 |
pageLayout->setColumnStretch(0, 1); |
|
451 |
pageLayout->setColumnStretch(1, 1); |
|
452 |
pageLayout->setColumnStretch(2, 1); |
|
453 |
||
675 | 454 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
455 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
456 |
|
1153 | 457 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 458 |
|
459 |
BtnStart = new QPushButton(this); |
|
460 |
BtnStart->setFont(*font14); |
|
461 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 462 |
pageLayout->addWidget(BtnStart, 1, 2); |
463 |
||
464 |
QWidget * wg = new QWidget(this); |
|
465 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
466 |
|
675 | 467 |
QGridLayout * wgLayout = new QGridLayout(wg); |
468 |
wgLayout->setColumnStretch(0, 1); |
|
469 |
wgLayout->setColumnStretch(1, 3); |
|
470 |
wgLayout->setColumnStretch(2, 1); |
|
471 |
||
472 |
wgLayout->setRowStretch(0, 0); |
|
473 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
474 |
|
675 | 475 |
QGroupBox * gb = new QGroupBox(wg); |
476 |
wgLayout->addWidget(gb, 0, 1); |
|
477 |
||
478 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
479 |
||
480 |
labelSD = new QLabel(gb); |
|
481 |
labelSD->setText(QLabel::tr("Server name:")); |
|
482 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
483 |
|
675 | 484 |
leServerDescr = new QLineEdit(gb); |
485 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
486 |
||
487 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
488 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 489 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
490 |
|
675 | 491 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
492 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
493 |
sbPort->setMaximum(65535); |
675 | 494 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
495 |
|
675 | 496 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
497 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 498 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
499 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
500 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
501 |
} |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
502 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
503 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
504 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
505 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
506 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
507 |
|
1153 | 508 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 509 |
{ |
510 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
511 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 512 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 513 |
//pageLayout->setSpacing(1); |
463 | 514 |
pageLayout->setColumnStretch(0, 50); |
515 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 516 |
|
461 | 517 |
// chatwidget |
518 |
pChatWidget = new HWChatWidget(this); |
|
519 |
pageLayout->addWidget(pChatWidget, 1, 0); |
|
464 | 520 |
pageLayout->setRowStretch(1, 100); |
453 | 521 |
|
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
522 |
pGameCFG = new GameCFGWidget(this); |
322 | 523 |
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
|
524 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
525 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 526 |
pNetTeamsWidget->setAcceptOuter(true); |
461 | 527 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1); |
184 | 528 |
|
1153 | 529 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
184 | 530 |
|
646 | 531 |
BtnGo = new QPushButton(this); |
184 | 532 |
BtnGo->setFont(*font14); |
533 |
BtnGo->setText(QPushButton::tr("Go!")); |
|
492 | 534 |
BtnGo->setEnabled(false); |
461 | 535 |
pageLayout->addWidget(BtnGo, 2, 1); |
184 | 536 |
} |
187 | 537 |
|
1153 | 538 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 539 |
{ |
540 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
541 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
542 |
pageLayout->setColumnStretch(0, 1); |
|
543 |
pageLayout->setColumnStretch(1, 1); |
|
544 |
pageLayout->setColumnStretch(2, 1); |
|
545 |
||
1153 | 546 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 547 |
|
548 |
about = new About(this); |
|
549 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
550 |
} |
|
306 | 551 |
|
1153 | 552 |
PageGameStats::PageGameStats(QWidget* parent) : AbstractPage(parent) |
306 | 553 |
{ |
554 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
555 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
556 |
pageLayout->setColumnStretch(0, 1); |
|
557 |
pageLayout->setColumnStretch(1, 1); |
|
558 |
pageLayout->setColumnStretch(2, 1); |
|
559 |
||
1153 | 560 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
306 | 561 |
|
307 | 562 |
labelGameStats = new QLabel(this); |
563 |
labelGameStats->setTextFormat(Qt::RichText); |
|
564 |
pageLayout->addWidget(labelGameStats, 0, 0, 1, 3); |
|
306 | 565 |
} |
586 | 566 |
|
1150 | 567 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 568 |
{ |
569 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
570 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1252 | 571 |
// pageLayout->setColumnStretch(0, 1); |
572 |
// pageLayout->setColumnStretch(1, 2); |
|
573 |
// pageLayout->setColumnStretch(2, 1); |
|
588 | 574 |
pageLayout->setRowStretch(0, 1); |
1150 | 575 |
pageLayout->setRowStretch(6, 1); |
586 | 576 |
|
1150 | 577 |
BtnSimpleGamePage = addButton(tr("Simple Game"), pageLayout, 1, 1); |
578 |
BtnTrainPage = addButton(tr("Training"), pageLayout, 2, 1); |
|
579 |
BtnMultiplayer = addButton(tr("Multiplayer"), pageLayout, 3, 1); |
|
580 |
BtnLoad = addButton(tr("Saved games"), pageLayout, 4, 1); |
|
581 |
BtnDemos = addButton(tr("Demos"), pageLayout, 5, 1); |
|
586 | 582 |
|
1153 | 583 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 7, 0, true); |
586 | 584 |
} |
585 |
||
1153 | 586 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 587 |
{ |
588 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
589 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
590 |
pageLayout->setColumnStretch(0, 1); |
|
591 |
pageLayout->setColumnStretch(1, 2); |
|
592 |
pageLayout->setColumnStretch(2, 1); |
|
593 |
||
594 |
BtnStartTrain = new QPushButton(this); |
|
595 |
BtnStartTrain->setFont(*font14); |
|
596 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
597 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
598 |
||
1153 | 599 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 600 |
} |
601 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
602 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 603 |
AbstractPage(parent) |
600 | 604 |
{ |
605 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
606 |
|
1168 | 607 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size() - 10, this); |
718 | 608 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 609 |
|
1168 | 610 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 611 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
612 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 613 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
600 | 614 |
} |
615 |
||
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
|
616 |
PageInGame::PageInGame(QWidget* parent) : |
686 | 617 |
AbstractPage(parent) |
618 |
{ |
|
619 |
QLabel * label = new QLabel(this); |
|
620 |
label->setText("In game..."); |
|
621 |
} |
|
1311 | 622 |
|
623 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
|
624 |
AbstractPage(parent) |
|
625 |
{ |
|
1312 | 626 |
QGridLayout * pageLayout = new QGridLayout(this); |
1314 | 627 |
|
628 |
roomName = new QLineEdit(this); |
|
1334
b58afaadf7ae
Send team removal message to others in room when client disconnects
unc0rr
parents:
1315
diff
changeset
|
629 |
roomName->setMaxLength(60); |
1314 | 630 |
pageLayout->addWidget(roomName, 0, 0); |
1312 | 631 |
roomsList = new QListWidget(this); |
1314 | 632 |
pageLayout->addWidget(roomsList, 1, 0, 3, 1); |
1377 | 633 |
serverMessage = new QTextBrowser(this); |
634 |
serverMessage->setOpenExternalLinks(true); |
|
635 |
pageLayout->addWidget(serverMessage, 4, 0, 1, 2); |
|
1312 | 636 |
|
1377 | 637 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
1312 | 638 |
BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
639 |
BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
|
640 |
BtnRefresh = addButton(tr("Refresh"), pageLayout, 2, 1); |
|
1314 | 641 |
|
642 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
|
643 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
|
1315 | 644 |
connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
1314 | 645 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
1311 | 646 |
} |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
647 |
|
1377 | 648 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
649 |
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
|
650 |
{ |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
651 |
roomsList->clear(); |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
652 |
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
|
653 |
roomsList->sortItems(); |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
654 |
} |
1314 | 655 |
|
656 |
void PageRoomsList::onCreateClick() |
|
657 |
{ |
|
658 |
if (roomName->text().size()) |
|
659 |
emit askForCreateRoom(roomName->text()); |
|
660 |
else |
|
661 |
QMessageBox::critical(this, |
|
662 |
tr("Error"), |
|
1315 | 663 |
tr("Please, enter room name"), |
1314 | 664 |
tr("OK")); |
665 |
} |
|
666 |
||
667 |
void PageRoomsList::onJoinClick() |
|
668 |
{ |
|
669 |
QListWidgetItem * curritem = roomsList->currentItem(); |
|
670 |
if (!curritem) |
|
671 |
{ |
|
672 |
QMessageBox::critical(this, |
|
673 |
tr("Error"), |
|
674 |
tr("Please, select room from the list"), |
|
675 |
tr("OK")); |
|
676 |
return ; |
|
677 |
} |
|
678 |
emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
679 |
} |
|
680 |
||
1315 | 681 |
void PageRoomsList::onRefreshClick() |
682 |
{ |
|
683 |
emit askForRoomList(); |
|
684 |
} |
|
685 |