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