author | unc0rr |
Sun, 22 Mar 2009 17:44:00 +0000 | |
changeset 1910 | ae0addb05791 |
parent 1905 | b1ec8db513f2 |
child 1924 | 8f8fe856ce9d |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
1236 | 3 |
* Copyright (c) 2006-2008 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#include <QGridLayout> |
|
20 |
#include <QPushButton> |
|
21 |
#include <QGroupBox> |
|
22 |
#include <QComboBox> |
|
311 | 23 |
#include <QCheckBox> |
184 | 24 |
#include <QLabel> |
25 |
#include <QToolBox> |
|
26 |
#include <QLineEdit> |
|
27 |
#include <QListWidget> |
|
28 |
#include <QApplication> |
|
231 | 29 |
#include <QSpinBox> |
452 | 30 |
#include <QTextEdit> |
636 | 31 |
#include <QRadioButton> |
665 | 32 |
#include <QTableView> |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
33 |
#include <QMessageBox> |
673 | 34 |
#include <QHeaderView> |
1252 | 35 |
#include <QTabWidget> |
1377 | 36 |
#include <QTextBrowser> |
1399 | 37 |
#include <QTableWidget> |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
38 |
#include <QAction> |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
39 |
#include <QMenu> |
1701
ad7a7fd14d36
Now voicepack checking button should work (but it doesn't for me)
unc0rr
parents:
1684
diff
changeset
|
40 |
#include <QSound> |
1885 | 41 |
#include <QDataWidgetMapper> |
42 |
||
184 | 43 |
|
44 |
#include "pages.h" |
|
45 |
#include "sdlkeys.h" |
|
46 |
#include "hwconsts.h" |
|
47 |
#include "gamecfgwidget.h" |
|
48 |
#include "teamselect.h" |
|
49 |
#include "gamecfgwidget.h" |
|
50 |
#include "SquareLabel.h" |
|
51 |
#include "mapContainer.h" |
|
187 | 52 |
#include "about.h" |
297 | 53 |
#include "fpsedit.h" |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
54 |
#include "netserverslist.h" |
412 | 55 |
#include "netudpwidget.h" |
461 | 56 |
#include "chatwidget.h" |
579 | 57 |
#include "playrecordpage.h" |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
603
diff
changeset
|
58 |
#include "selectWeapon.h" |
1192 | 59 |
#include "igbox.h" |
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
60 |
#include "hats.h" |
1885 | 61 |
#include "misc.h" |
184 | 62 |
|
684 | 63 |
PageMain::PageMain(QWidget* parent) : |
64 |
AbstractPage(parent) |
|
184 | 65 |
{ |
66 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1148 | 67 |
//pageLayout->setColumnStretch(0, 1); |
68 |
//pageLayout->setColumnStretch(1, 2); |
|
69 |
//pageLayout->setColumnStretch(2, 1); |
|
184 | 70 |
|
1199 | 71 |
//QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
72 |
//pageLayout->setAlignment(btnLogo, Qt::AlignHCenter); |
|
1148 | 73 |
pageLayout->setRowStretch(0, 1); |
1150 | 74 |
pageLayout->setRowStretch(1, 1); |
75 |
pageLayout->setRowStretch(2, 0); |
|
76 |
pageLayout->setRowStretch(3, 1); |
|
1199 | 77 |
pageLayout->setRowStretch(4, 1); |
184 | 78 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
79 |
BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, true); |
1450 | 80 |
BtnSinglePlayer->setToolTip(tr("Local Game (Play a game on a single computer)")); |
1150 | 81 |
pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter); |
184 | 82 |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1151
diff
changeset
|
83 |
BtnNet = addButton(":/res/NetworkPlay.png", pageLayout, 2, 2, 1, 2, true); |
1450 | 84 |
BtnNet->setToolTip(tr("Network Game (Play a game across a network)")); |
1150 | 85 |
pageLayout->setAlignment(BtnNet, Qt::AlignHCenter); |
579 | 86 |
|
1199 | 87 |
BtnSetup = addButton(":/res/Settings.png", pageLayout, 4, 3, true); |
184 | 88 |
|
1199 | 89 |
//BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, true); |
90 |
BtnInfo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, true); |
|
1212 | 91 |
BtnInfo->setStyleSheet("border: transparent;background: transparent;"); |
1150 | 92 |
pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
1199 | 93 |
//pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter); |
184 | 94 |
|
1199 | 95 |
BtnExit = addButton(":/res/Exit.png", pageLayout, 4, 0, 1, 1, true); |
184 | 96 |
} |
97 |
||
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
730
diff
changeset
|
98 |
PageEditTeam::PageEditTeam(QWidget* parent) : |
692 | 99 |
AbstractPage(parent) |
184 | 100 |
{ |
101 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1252 | 102 |
QTabWidget * tbw = new QTabWidget(this); |
1389 | 103 |
QWidget * page1 = new QWidget(this); |
104 |
QWidget * page2 = new QWidget(this); |
|
1252 | 105 |
tbw->addTab(page1, tr("General")); |
106 |
tbw->addTab(page2, tr("Advanced")); |
|
107 |
pageLayout->addWidget(tbw, 0, 0, 1, 3); |
|
108 |
BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
|
109 |
BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);; |
|
1443 | 110 |
BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
111 |
||
1252 | 112 |
QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
113 |
page1Layout->setAlignment(Qt::AlignTop); |
|
114 |
QGridLayout * page2Layout = new QGridLayout(page2); |
|
115 |
||
116 |
// ====== Page 1 ====== |
|
117 |
QVBoxLayout * vbox1 = new QVBoxLayout(); |
|
118 |
QVBoxLayout * vbox2 = new QVBoxLayout(); |
|
119 |
QVBoxLayout * vbox3 = new QVBoxLayout(); |
|
120 |
page1Layout->addLayout(vbox1); |
|
121 |
page1Layout->addLayout(vbox2); |
|
122 |
page1Layout->addLayout(vbox3); |
|
123 |
||
588 | 124 |
GBoxHedgehogs = new QGroupBox(this); |
184 | 125 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
126 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
127 |
QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
|
1840 | 128 |
|
129 |
signalMapper = new QSignalMapper(this); |
|
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
130 |
|
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
131 |
HatsModel * hatsModel = new HatsModel(GBoxHedgehogs); |
184 | 132 |
for(int i = 0; i < 8; i++) |
133 |
{ |
|
1238
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
134 |
HHHats[i] = new QComboBox(GBoxHedgehogs); |
914bd2a9a249
Add hat selection control to team editing page (it's empty combobox yet)
unc0rr
parents:
1236
diff
changeset
|
135 |
HHHats[i]->setModel(hatsModel); |
1282 | 136 |
HHHats[i]->setIconSize(QSize(32, 37)); |
137 |
//HHHats[i]->setSizeAdjustPolicy(QComboBox::AdjustToContents); |
|
1239 | 138 |
//HHHats[i]->setModelColumn(1); |
1240 | 139 |
//HHHats[i]->setMinimumWidth(132); |
1840 | 140 |
GBHLayout->addWidget(HHHats[i], i, 0); |
141 |
||
142 |
HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
|
143 |
HHNameEdit[i]->setMaxLength(64); |
|
144 |
HHNameEdit[i]->setMinimumWidth(120); |
|
145 |
GBHLayout->addWidget(HHNameEdit[i], i, 1); |
|
146 |
||
147 |
randButton[i] = addButton(":/res/dice.png", GBHLayout, i, 3, true); |
|
148 |
||
149 |
connect(randButton[i], SIGNAL(clicked()), signalMapper, SLOT(map())); |
|
150 |
signalMapper->setMapping(randButton[i], i); |
|
151 |
||
184 | 152 |
} |
1840 | 153 |
|
154 |
randTeamButton = addButton("Random Team", GBHLayout, 9, false); |
|
155 |
||
1252 | 156 |
vbox1->addWidget(GBoxHedgehogs); |
157 |
||
158 |
||
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
159 |
GBoxTeam = new QGroupBox(this); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
160 |
GBoxTeam->setTitle(QGroupBox::tr("Team")); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
161 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
162 |
QVBoxLayout * GBTLayout = new QVBoxLayout(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
163 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
164 |
TeamNameEdit->setMaxLength(64); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
165 |
GBTLayout->addWidget(TeamNameEdit); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
166 |
vbox2->addWidget(GBoxTeam); |
1252 | 167 |
|
1290 | 168 |
CBTeamLvl = new QComboBox(GBoxTeam); |
1440 | 169 |
CBTeamLvl->setIconSize(QSize(48, 48)); |
1287 | 170 |
CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
171 |
for(int i = 5; i > 0; i--) |
|
172 |
CBTeamLvl->addItem( |
|
173 |
QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
|
174 |
QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
|
175 |
); |
|
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
176 |
GBTLayout->addWidget(CBTeamLvl); |
1287 | 177 |
|
1290 | 178 |
CBGrave = new QComboBox(GBoxTeam); |
1288
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
179 |
CBGrave->setMaxCount(65535); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
180 |
CBGrave->setIconSize(QSize(32, 32)); |
cea4a8f52f5a
Reorganize team edit page a little (save a lot of space)
unc0rr
parents:
1287
diff
changeset
|
181 |
GBTLayout->addWidget(CBGrave); |
1684 | 182 |
|
1659 | 183 |
{ |
1684 | 184 |
QHBoxLayout * hbox = new QHBoxLayout(); |
185 |
CBVoicepack = new QComboBox(GBoxTeam); |
|
186 |
{ |
|
187 |
QDir tmpdir; |
|
188 |
tmpdir.cd(datadir->absolutePath()); |
|
189 |
tmpdir.cd("Sounds/voices"); |
|
190 |
QStringList list = tmpdir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot, QDir::Name); |
|
191 |
CBVoicepack->addItems(list); |
|
192 |
} |
|
193 |
hbox->addWidget(CBVoicepack, 100); |
|
1718 | 194 |
BtnTestSound = addButton(":/res/PlaySound.png", hbox, 1, true); |
1684 | 195 |
hbox->setStretchFactor(BtnTestSound, 1); |
196 |
connect(BtnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); |
|
197 |
GBTLayout->addLayout(hbox); |
|
1659 | 198 |
} |
199 |
||
1252 | 200 |
GBoxFort = new QGroupBox(this); |
201 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
|
202 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
|
203 |
CBFort = new QComboBox(GBoxFort); |
|
204 |
CBFort->setMaxCount(65535); |
|
205 |
GBFLayout->addWidget(CBFort, 0, 0); |
|
206 |
FortPreview = new SquareLabel(GBoxFort); |
|
207 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
208 |
FortPreview->setPixmap(QPixmap()); |
|
209 |
GBFLayout->addWidget(FortPreview, 1, 0); |
|
210 |
vbox3->addWidget(GBoxFort); |
|
211 |
||
212 |
QDir tmpdir; |
|
213 |
tmpdir.cd(datadir->absolutePath()); |
|
214 |
tmpdir.cd("Forts"); |
|
215 |
tmpdir.setFilter(QDir::Files); |
|
216 |
||
1287 | 217 |
connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
1252 | 218 |
CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
1287 | 219 |
|
1252 | 220 |
tmpdir.cd("../Graphics/Graves"); |
221 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
222 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
223 |
{ |
|
1287 | 224 |
QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); |
225 |
QIcon icon(pix.copy(0, 0, 32, 32)); |
|
226 |
CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
|
1252 | 227 |
} |
228 |
||
229 |
vbox1->addStretch(); |
|
230 |
vbox2->addStretch(); |
|
231 |
// vbox3->addStretch(); |
|
232 |
||
233 |
// ====== Page 2 ====== |
|
588 | 234 |
GBoxBinds = new QGroupBox(this); |
184 | 235 |
GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
236 |
QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
|
237 |
BindsBox = new QToolBox(GBoxBinds); |
|
238 |
BindsBox->setLineWidth(0); |
|
239 |
GBBLayout->addWidget(BindsBox); |
|
1389 | 240 |
page_A = new QWidget(this); |
184 | 241 |
BindsBox->addItem(page_A, QToolBox::tr("Actions")); |
1389 | 242 |
page_W = new QWidget(this); |
184 | 243 |
BindsBox->addItem(page_W, QToolBox::tr("Weapons")); |
1389 | 244 |
page_WP = new QWidget(this); |
184 | 245 |
BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); |
1389 | 246 |
page_O = new QWidget(this); |
184 | 247 |
BindsBox->addItem(page_O, QToolBox::tr("Other")); |
1252 | 248 |
page2Layout->addWidget(GBoxBinds, 0, 0); |
184 | 249 |
|
250 |
QStringList binds; |
|
251 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
252 |
{ |
|
253 |
binds << sdlkeys[i][1]; |
|
254 |
} |
|
255 |
||
256 |
quint16 widind = 0, i = 0; |
|
257 |
while (i < BINDS_NUMBER) { |
|
258 |
quint16 num = 0; |
|
1389 | 259 |
QWidget * curW = BindsBox->widget(widind); |
260 |
QGridLayout * pagelayout = new QGridLayout(curW); |
|
184 | 261 |
do { |
1389 | 262 |
LBind[i] = new QLabel(curW); |
184 | 263 |
LBind[i]->setText(QApplication::translate("binds", cbinds[i].name)); |
264 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
265 |
pagelayout->addWidget(LBind[i], num, 0); |
|
1389 | 266 |
CBBind[i] = new QComboBox(curW); |
184 | 267 |
CBBind[i]->addItems(binds); |
268 |
pagelayout->addWidget(CBBind[i], num, 1); |
|
269 |
num++; |
|
270 |
} while (!cbinds[i++].chwidget); |
|
1389 | 271 |
pagelayout->addWidget(new QWidget(curW), num, 0, 1, 2); |
184 | 272 |
widind++; |
273 |
} |
|
274 |
} |
|
275 |
||
276 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
|
277 |
{ |
|
278 |
QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
|
279 |
FortPreview->setPixmap(pix); |
|
280 |
} |
|
281 |
||
1684 | 282 |
void PageEditTeam::testSound() |
283 |
{ |
|
284 |
QDir tmpdir; |
|
285 |
tmpdir.cd(datadir->absolutePath()); |
|
286 |
tmpdir.cd("Sounds/voices"); |
|
287 |
tmpdir.cd(CBVoicepack->currentText()); |
|
1701
ad7a7fd14d36
Now voicepack checking button should work (but it doesn't for me)
unc0rr
parents:
1684
diff
changeset
|
288 |
QStringList list = tmpdir.entryList(QStringList() << "*.wav", QDir::Files); |
1684 | 289 |
if (list.size()) |
1701
ad7a7fd14d36
Now voicepack checking button should work (but it doesn't for me)
unc0rr
parents:
1684
diff
changeset
|
290 |
QSound::play(tmpdir.absolutePath() + "/" + list[rand() % list.size()]); |
1684 | 291 |
} |
292 |
||
1287 | 293 |
PageMultiplayer::PageMultiplayer(QWidget* parent) : |
692 | 294 |
AbstractPage(parent) |
184 | 295 |
{ |
296 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
297 |
||
1218 | 298 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
187 | 299 |
|
184 | 300 |
gameCFG = new GameCFGWidget(this); |
301 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
696 | 302 |
|
1218 | 303 |
pageLayout->setRowStretch(1, 1); |
304 |
||
184 | 305 |
teamsSelect = new TeamSelWidget(this); |
1218 | 306 |
pageLayout->addWidget(teamsSelect, 0, 2, 2, 2); |
184 | 307 |
|
1218 | 308 |
BtnStartMPGame = addButton(tr("Start"), pageLayout, 2, 3); |
184 | 309 |
} |
310 |
||
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
|
311 |
PageOptions::PageOptions(QWidget* parent) : |
692 | 312 |
AbstractPage(parent) |
184 | 313 |
{ |
314 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
427 | 315 |
pageLayout->setColumnStretch(0, 100); |
316 |
pageLayout->setColumnStretch(1, 100); |
|
317 |
pageLayout->setColumnStretch(2, 100); |
|
318 |
pageLayout->setRowStretch(0, 0); |
|
1644 | 319 |
pageLayout->setRowStretch(1, 100); |
719 | 320 |
pageLayout->setRowStretch(2, 0); |
1644 | 321 |
pageLayout->setContentsMargins(7, 7, 7, 0); |
322 |
pageLayout->setSpacing(0); |
|
427 | 323 |
|
1198 | 324 |
|
325 |
QGroupBox * gbTwoBoxes = new QGroupBox(this); |
|
326 |
pageLayout->addWidget(gbTwoBoxes, 0, 0, 1, 3); |
|
1644 | 327 |
QGridLayout * gbTBLayout = new QGridLayout(gbTwoBoxes); |
328 |
gbTBLayout->setMargin(0); |
|
329 |
gbTBLayout->setSpacing(0); |
|
1198 | 330 |
{ |
331 |
teamsBox = new IconedGroupBox(this); |
|
332 |
teamsBox->setIcon(QIcon(":/res/teamicon.png")); |
|
333 |
teamsBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
334 |
teamsBox->setTitle(QGroupBox::tr("Teams")); |
|
335 |
||
1644 | 336 |
QVBoxLayout * GBTlayout = new QVBoxLayout(teamsBox); |
1198 | 337 |
|
338 |
CBTeamName = new QComboBox(teamsBox); |
|
1644 | 339 |
GBTlayout->addWidget(CBTeamName); |
184 | 340 |
|
1644 | 341 |
QHBoxLayout * layout1 = new QHBoxLayout; |
342 |
GBTlayout->addLayout(layout1); |
|
343 |
BtnNewTeam = addButton(tr("New team"), layout1, 0); |
|
344 |
BtnEditTeam = addButton(tr("Edit team"), layout1, 1); |
|
345 |
layout1->setStretchFactor(BtnNewTeam, 100); |
|
346 |
layout1->setStretchFactor(BtnEditTeam, 100); |
|
347 |
||
348 |
QHBoxLayout * layout2 = new QHBoxLayout; |
|
349 |
GBTlayout->addLayout(layout2); |
|
1199 | 350 |
|
351 |
labelNN = new QLabel(teamsBox); |
|
352 |
labelNN->setText(QLabel::tr("Net nick")); |
|
1644 | 353 |
layout2->addWidget(labelNN); |
1199 | 354 |
|
355 |
editNetNick = new QLineEdit(teamsBox); |
|
356 |
editNetNick->setMaxLength(20); |
|
357 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
1644 | 358 |
layout2->addWidget(editNetNick); |
1199 | 359 |
|
1644 | 360 |
gbTBLayout->addWidget(teamsBox, 0, 0); |
1198 | 361 |
} |
184 | 362 |
|
1198 | 363 |
{ |
364 |
IconedGroupBox* groupWeapons = new IconedGroupBox(this); |
|
1810 | 365 |
groupWeapons->setContentTopPadding(0); |
1199 | 366 |
groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
1198 | 367 |
groupWeapons->setIcon(QIcon(":/res/weaponsicon.png")); |
1199 | 368 |
//groupWeapons->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
1198 | 369 |
groupWeapons->setTitle(QGroupBox::tr("Weapons")); |
370 |
QGridLayout * WeaponsLayout = new QGridLayout(groupWeapons); |
|
184 | 371 |
|
1198 | 372 |
WeaponsButt = addButton(tr("Weapons set"), WeaponsLayout, 1, 0); |
373 |
WeaponsName = new QComboBox(this); |
|
374 |
WeaponsLayout->addWidget(WeaponsName, 0, 0, 1, 2); |
|
375 |
WeaponEdit = addButton(tr("Edit"), WeaponsLayout, 1, 1); |
|
1644 | 376 |
gbTBLayout->addWidget(groupWeapons, 1, 0); |
1198 | 377 |
} |
184 | 378 |
|
1644 | 379 |
{ |
380 |
AGGroupBox = new IconedGroupBox(this); |
|
381 |
AGGroupBox->setIcon(QIcon(":/res/graphicsicon.png")); |
|
382 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
383 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
184 | 384 |
|
1644 | 385 |
QVBoxLayout * GBAlayout = new QVBoxLayout(AGGroupBox); |
386 |
QHBoxLayout * GBAreslayout = new QHBoxLayout(0); |
|
387 |
QLabel * resolution = new QLabel(AGGroupBox); |
|
388 |
resolution->setText(QLabel::tr("Resolution")); |
|
389 |
GBAreslayout->addWidget(resolution); |
|
427 | 390 |
|
1644 | 391 |
CBResolution = new QComboBox(AGGroupBox); |
392 |
GBAreslayout->addWidget(CBResolution); |
|
393 |
GBAlayout->addLayout(GBAreslayout); |
|
427 | 394 |
|
1644 | 395 |
QHBoxLayout * GBAfpslayout = new QHBoxLayout(0); |
396 |
QLabel * maxfps = new QLabel(AGGroupBox); |
|
397 |
maxfps->setText(QLabel::tr("FPS limit")); |
|
398 |
GBAfpslayout->addWidget(maxfps); |
|
399 |
GBAlayout->addLayout(GBAfpslayout); |
|
184 | 400 |
|
1812 | 401 |
CBReduceQuality = new QCheckBox(AGGroupBox); |
402 |
CBReduceQuality->setText(QCheckBox::tr("Reduce Quality")); |
|
403 |
GBAlayout->addWidget(CBReduceQuality); |
|
404 |
||
1644 | 405 |
CBFullscreen = new QCheckBox(AGGroupBox); |
406 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
407 |
GBAlayout->addWidget(CBFullscreen); |
|
184 | 408 |
|
1644 | 409 |
CBFrontendFullscreen = new QCheckBox(AGGroupBox); |
410 |
CBFrontendFullscreen->setText(QCheckBox::tr("Frontend fullscreen")); |
|
411 |
GBAlayout->addWidget(CBFrontendFullscreen); |
|
1162 | 412 |
|
1644 | 413 |
CBEnableSound = new QCheckBox(AGGroupBox); |
414 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
|
415 |
GBAlayout->addWidget(CBEnableSound); |
|
184 | 416 |
|
1644 | 417 |
CBEnableMusic = new QCheckBox(AGGroupBox); |
418 |
CBEnableMusic->setText(QCheckBox::tr("Enable music")); |
|
419 |
GBAlayout->addWidget(CBEnableMusic); |
|
1129 | 420 |
|
1777 | 421 |
QHBoxLayout * GBAvollayout = new QHBoxLayout(0); |
422 |
QLabel * vol = new QLabel(AGGroupBox); |
|
423 |
vol->setText(QLabel::tr("Initial sound volume")); |
|
424 |
GBAvollayout->addWidget(vol); |
|
425 |
GBAlayout->addLayout(GBAvollayout); |
|
426 |
volumeBox = new QSpinBox(AGGroupBox); |
|
427 |
volumeBox->setRange(0, 100); |
|
428 |
volumeBox->setSingleStep(5); |
|
429 |
GBAvollayout->addWidget(volumeBox); |
|
430 |
||
431 |
||
1644 | 432 |
CBShowFPS = new QCheckBox(AGGroupBox); |
433 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
434 |
GBAlayout->addWidget(CBShowFPS); |
|
297 | 435 |
|
1644 | 436 |
CBAltDamage = new QCheckBox(AGGroupBox); |
437 |
CBAltDamage->setText(QCheckBox::tr("Alternative damage show")); |
|
438 |
GBAlayout->addWidget(CBAltDamage); |
|
529 | 439 |
|
1644 | 440 |
CBNameWithDate = new QCheckBox(AGGroupBox); |
441 |
CBNameWithDate->setText(QCheckBox::tr("Append date and time to record file name")); |
|
442 |
GBAlayout->addWidget(CBNameWithDate); |
|
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1457
diff
changeset
|
443 |
|
1644 | 444 |
fpsedit = new FPSEdit(AGGroupBox); |
445 |
GBAfpslayout->addWidget(fpsedit); |
|
446 |
gbTBLayout->addWidget(AGGroupBox, 0, 1, 2, 1); |
|
447 |
} |
|
184 | 448 |
|
1644 | 449 |
BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 2, 2, true); |
1443 | 450 |
BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
184 | 451 |
|
1644 | 452 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
184 | 453 |
} |
454 |
||
1153 | 455 |
PageNet::PageNet(QWidget* parent) : AbstractPage(parent) |
184 | 456 |
{ |
457 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
458 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
459 |
pageLayout->setColumnStretch(0, 1); |
|
460 |
pageLayout->setColumnStretch(1, 1); |
|
617 | 461 |
pageLayout->setColumnStretch(2, 1); |
421 | 462 |
|
463 |
BtnNetSvrStart = new QPushButton(this); |
|
464 |
BtnNetSvrStart->setFont(*font14); |
|
465 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
1415
6fbfee0e113a
Allow build without net game server: introduce -DWITH_SERVER configuration parameter
unc0rr
parents:
1409
diff
changeset
|
466 |
BtnNetSvrStart->setVisible(haveServer); |
1395 | 467 |
pageLayout->addWidget(BtnNetSvrStart, 4, 2); |
468 |
||
469 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true); |
|
184 | 470 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
471 |
ConnGroupBox = new QGroupBox(this); |
421 | 472 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
473 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
474 |
GBClayout = new QGridLayout(ConnGroupBox); |
646 | 475 |
GBClayout->setColumnStretch(0, 1); |
421 | 476 |
GBClayout->setColumnStretch(1, 1); |
477 |
GBClayout->setColumnStretch(2, 1); |
|
184 | 478 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
479 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 480 |
BtnNetConnect->setFont(*font14); |
481 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
646 | 482 |
GBClayout->addWidget(BtnNetConnect, 2, 2); |
416 | 483 |
|
665 | 484 |
tvServersList = new QTableView(ConnGroupBox); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
485 |
tvServersList->setSelectionBehavior(QAbstractItemView::SelectRows); |
665 | 486 |
GBClayout->addWidget(tvServersList, 1, 0, 1, 3); |
421 | 487 |
|
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
488 |
BtnUpdateSList = new QPushButton(ConnGroupBox); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
489 |
BtnUpdateSList->setFont(*font14); |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
490 |
BtnUpdateSList->setText(QPushButton::tr("Update")); |
646 | 491 |
GBClayout->addWidget(BtnUpdateSList, 2, 0); |
314 | 492 |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
493 |
BtnSpecifyServer = new QPushButton(ConnGroupBox); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
494 |
BtnSpecifyServer->setFont(*font14); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
495 |
BtnSpecifyServer->setText(QPushButton::tr("Specify")); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
496 |
GBClayout->addWidget(BtnSpecifyServer, 2, 1); |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
497 |
|
1395 | 498 |
BtnOfficialServer = new QPushButton(ConnGroupBox); |
499 |
BtnOfficialServer->setFont(*font14); |
|
500 |
BtnOfficialServer->setText(QPushButton::tr("Join official server")); |
|
501 |
GBClayout->addWidget(BtnOfficialServer, 3, 0, 1, 3); |
|
636 | 502 |
|
668 | 503 |
connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect())); |
184 | 504 |
} |
505 |
||
646 | 506 |
void PageNet::updateServersList() |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
507 |
{ |
1310 | 508 |
tvServersList->setModel(new HWNetUdpModel(tvServersList)); |
659 | 509 |
|
673 | 510 |
tvServersList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
511 |
||
665 | 512 |
static_cast<HWNetServersModel *>(tvServersList->model())->updateList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
513 |
|
665 | 514 |
connect(BtnUpdateSList, SIGNAL(clicked()), static_cast<HWNetServersModel *>(tvServersList->model()), SLOT(updateList())); |
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
515 |
connect(tvServersList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotConnect())); |
646 | 516 |
} |
517 |
||
518 |
void PageNet::slotConnect() |
|
519 |
{ |
|
671
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
520 |
HWNetServersModel * model = static_cast<HWNetServersModel *>(tvServersList->model()); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
521 |
QModelIndex mi = tvServersList->currentIndex(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
522 |
if(!mi.isValid()) |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
523 |
{ |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
524 |
QMessageBox::information(this, tr("Error"), tr("Please, select server from the list above")); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
525 |
return; |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
526 |
} |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
527 |
QString host = model->index(mi.row(), 1).data().toString(); |
a8970859f50e
Actually pass host and port values to NetConnect method
unc0rr
parents:
668
diff
changeset
|
528 |
quint16 port = model->index(mi.row(), 2).data().toUInt(); |
672
08ed55ea1e2a
- Fix a bug when server fails to start, and then connecting to another server on the same host (strange, the fix won't work on my machine)
unc0rr
parents:
671
diff
changeset
|
529 |
|
08ed55ea1e2a
- Fix a bug when server fails to start, and then connecting to another server on the same host (strange, the fix won't work on my machine)
unc0rr
parents:
671
diff
changeset
|
530 |
emit connectClicked(host, port); |
646 | 531 |
} |
532 |
||
1153 | 533 |
PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent) |
646 | 534 |
{ |
535 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
536 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
537 |
pageLayout->setColumnStretch(0, 1); |
|
538 |
pageLayout->setColumnStretch(1, 1); |
|
539 |
pageLayout->setColumnStretch(2, 1); |
|
540 |
||
675 | 541 |
pageLayout->setRowStretch(0, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
542 |
pageLayout->setRowStretch(1, 0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
543 |
|
1153 | 544 |
BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
646 | 545 |
|
546 |
BtnStart = new QPushButton(this); |
|
547 |
BtnStart->setFont(*font14); |
|
548 |
BtnStart->setText(QPushButton::tr("Start")); |
|
675 | 549 |
pageLayout->addWidget(BtnStart, 1, 2); |
550 |
||
551 |
QWidget * wg = new QWidget(this); |
|
552 |
pageLayout->addWidget(wg, 0, 0, 1, 3); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
553 |
|
675 | 554 |
QGridLayout * wgLayout = new QGridLayout(wg); |
555 |
wgLayout->setColumnStretch(0, 1); |
|
556 |
wgLayout->setColumnStretch(1, 3); |
|
557 |
wgLayout->setColumnStretch(2, 1); |
|
558 |
||
559 |
wgLayout->setRowStretch(0, 0); |
|
560 |
wgLayout->setRowStretch(1, 1); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
561 |
|
675 | 562 |
QGroupBox * gb = new QGroupBox(wg); |
563 |
wgLayout->addWidget(gb, 0, 1); |
|
564 |
||
565 |
QGridLayout * gbLayout = new QGridLayout(gb); |
|
566 |
||
567 |
labelSD = new QLabel(gb); |
|
568 |
labelSD->setText(QLabel::tr("Server name:")); |
|
569 |
gbLayout->addWidget(labelSD, 0, 0); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
570 |
|
675 | 571 |
leServerDescr = new QLineEdit(gb); |
572 |
gbLayout->addWidget(leServerDescr, 0, 1); |
|
573 |
||
574 |
labelPort = new QLabel(gb); |
|
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
575 |
labelPort->setText(QLabel::tr("Server port:")); |
675 | 576 |
gbLayout->addWidget(labelPort, 1, 0); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
577 |
|
675 | 578 |
sbPort = new QSpinBox(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
579 |
sbPort->setMinimum(0); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
580 |
sbPort->setMaximum(65535); |
675 | 581 |
gbLayout->addWidget(sbPort, 1, 1); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
582 |
|
675 | 583 |
BtnDefault = new QPushButton(gb); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
584 |
BtnDefault->setText(QPushButton::tr("default")); |
675 | 585 |
gbLayout->addWidget(BtnDefault, 1, 2); |
657
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
586 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
587 |
connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
588 |
} |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
589 |
|
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
590 |
void PageNetServer::setDefaultPort() |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
591 |
{ |
b34fc518a48a
Basic concept for net server options page (subject to change)
unc0rr
parents:
653
diff
changeset
|
592 |
sbPort->setValue(46631); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
593 |
} |
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
617
diff
changeset
|
594 |
|
1153 | 595 |
PageNetGame::PageNetGame(QWidget* parent) : AbstractPage(parent) |
184 | 596 |
{ |
597 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
598 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
452 | 599 |
pageLayout->setSizeConstraint(QLayout::SetMinimumSize); |
461 | 600 |
//pageLayout->setSpacing(1); |
463 | 601 |
pageLayout->setColumnStretch(0, 50); |
602 |
pageLayout->setColumnStretch(1, 50); |
|
322 | 603 |
|
461 | 604 |
// chatwidget |
605 |
pChatWidget = new HWChatWidget(this); |
|
1647 | 606 |
pageLayout->addWidget(pChatWidget, 1, 0, 1, 2); |
464 | 607 |
pageLayout->setRowStretch(1, 100); |
453 | 608 |
|
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
609 |
pGameCFG = new GameCFGWidget(this); |
322 | 610 |
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
|
611 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
612 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 613 |
pNetTeamsWidget->setAcceptOuter(true); |
1647 | 614 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1); |
184 | 615 |
|
1649 | 616 |
|
617 |
QHBoxLayout * bottomLayout = new QHBoxLayout; |
|
618 |
pageLayout->addLayout(bottomLayout, 3, 0, 1, 2); |
|
619 |
||
620 |
BtnBack = addButton(":/res/Exit.png", bottomLayout, 0, true); |
|
621 |
||
646 | 622 |
BtnGo = new QPushButton(this); |
184 | 623 |
BtnGo->setFont(*font14); |
1677 | 624 |
BtnGo->setToolTip(QPushButton::tr("Ready")); |
1648 | 625 |
BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
626 |
BtnGo->setIconSize(QSize(25, 34)); |
|
1649 | 627 |
BtnGo->setMinimumWidth(50); |
628 |
BtnGo->setMinimumHeight(50); |
|
629 |
bottomLayout->addWidget(BtnGo, 2); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
630 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
631 |
|
1649 | 632 |
BtnMaster = addButton(tr("Control"), bottomLayout, 3); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
633 |
QMenu * menu = new QMenu(BtnMaster); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
634 |
startGame = new QAction(QAction::tr("Start"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
635 |
restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
636 |
restrictJoins->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
637 |
restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
638 |
restrictTeamAdds->setCheckable(true); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
639 |
menu->addAction(startGame); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
640 |
menu->addAction(restrictJoins); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
641 |
menu->addAction(restrictTeamAdds); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
642 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
643 |
BtnMaster->setMenu(menu); |
1649 | 644 |
|
645 |
bottomLayout->insertStretch(1, 100); |
|
184 | 646 |
} |
187 | 647 |
|
1648 | 648 |
void PageNetGame::setReadyStatus(bool isReady) |
649 |
{ |
|
650 |
if(isReady) |
|
651 |
BtnGo->setIcon(QIcon(":/res/lightbulb_on.png")); |
|
652 |
else |
|
653 |
BtnGo->setIcon(QIcon(":/res/lightbulb_off.png")); |
|
654 |
} |
|
655 |
||
1649 | 656 |
void PageNetGame::setMasterMode(bool isMaster) |
657 |
{ |
|
658 |
BtnMaster->setVisible(isMaster); |
|
659 |
} |
|
660 |
||
1153 | 661 |
PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent) |
187 | 662 |
{ |
663 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
664 |
pageLayout->setColumnStretch(0, 1); |
|
665 |
pageLayout->setColumnStretch(1, 1); |
|
666 |
pageLayout->setColumnStretch(2, 1); |
|
667 |
||
1153 | 668 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
187 | 669 |
|
670 |
about = new About(this); |
|
671 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
672 |
} |
|
306 | 673 |
|
1150 | 674 |
PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent) |
586 | 675 |
{ |
1443 | 676 |
QVBoxLayout * vLayout = new QVBoxLayout(this); |
677 |
QHBoxLayout * topLine = new QHBoxLayout(); |
|
678 |
QHBoxLayout * middleLine = new QHBoxLayout(); |
|
679 |
QHBoxLayout * bottomLine = new QHBoxLayout(); |
|
1444 | 680 |
vLayout->addStretch(); |
1443 | 681 |
vLayout->addLayout(topLine); |
1457 | 682 |
vLayout->addSpacing(30); |
1443 | 683 |
vLayout->addLayout(middleLine); |
1444 | 684 |
vLayout->addStretch(); |
1443 | 685 |
vLayout->addLayout(bottomLine); |
586 | 686 |
|
1457 | 687 |
topLine->addStretch(); |
1443 | 688 |
BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true); |
1450 | 689 |
BtnSimpleGamePage->setToolTip(tr("Simple Game (a quick game against the computer, settings are chosen for you)")); |
1457 | 690 |
topLine->addSpacing(60); |
1443 | 691 |
BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true); |
1450 | 692 |
BtnMultiplayer->setToolTip(tr("Multiplayer (play a hotseat game against your friends, or AI teams)")); |
1457 | 693 |
topLine->addStretch(); |
694 |
||
695 |
||
1443 | 696 |
BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true); |
1450 | 697 |
BtnTrainPage->setToolTip(tr("Training Mode (Practice your skills in a range of training missions). IN DEVELOPMENT")); |
1443 | 698 |
|
699 |
BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true); |
|
1444 | 700 |
bottomLine->addStretch(); |
701 |
||
1447 | 702 |
BtnDemos = addButton(":/res/Record.png", bottomLine, 1, true); |
1450 | 703 |
BtnDemos->setToolTip(tr("Demos (Watch recorded demos)")); |
1443 | 704 |
BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true); |
705 |
BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
|
1450 | 706 |
BtnLoad->setToolTip(tr("Load (Load a previously saved game)")); |
586 | 707 |
} |
708 |
||
1153 | 709 |
PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent) |
587 | 710 |
{ |
711 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
712 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
713 |
pageLayout->setColumnStretch(0, 1); |
|
714 |
pageLayout->setColumnStretch(1, 2); |
|
715 |
pageLayout->setColumnStretch(2, 1); |
|
716 |
||
717 |
BtnStartTrain = new QPushButton(this); |
|
718 |
BtnStartTrain->setFont(*font14); |
|
719 |
BtnStartTrain->setText(QPushButton::tr("Go!")); |
|
720 |
pageLayout->addWidget(BtnStartTrain, 1, 2); |
|
721 |
||
1153 | 722 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
587 | 723 |
} |
724 |
||
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
725 |
PageSelectWeapon::PageSelectWeapon(QWidget* parent) : |
684 | 726 |
AbstractPage(parent) |
600 | 727 |
{ |
728 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
923
b3d097097b54
Use default ammostore string size for weapons number instead of predefined const
unc0rr
parents:
788
diff
changeset
|
729 |
|
1576
a02353129a41
Check for deprecated ammo schemes at startup and delete them
unc0rr
parents:
1522
diff
changeset
|
730 |
pWeapons = new SelWeaponWidget(cDefaultAmmoStore->size(), this); |
718 | 731 |
pageLayout->addWidget(pWeapons, 0, 0, 1, 4); |
600 | 732 |
|
1168 | 733 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
730 | 734 |
BtnDefault = addButton(tr("Default"), pageLayout, 1, 1); |
735 |
BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2); |
|
1168 | 736 |
BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true); |
1443 | 737 |
BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}"); |
600 | 738 |
} |
739 |
||
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
|
740 |
PageInGame::PageInGame(QWidget* parent) : |
686 | 741 |
AbstractPage(parent) |
742 |
{ |
|
743 |
QLabel * label = new QLabel(this); |
|
744 |
label->setText("In game..."); |
|
745 |
} |
|
1311 | 746 |
|
747 |
PageRoomsList::PageRoomsList(QWidget* parent) : |
|
748 |
AbstractPage(parent) |
|
749 |
{ |
|
1312 | 750 |
QGridLayout * pageLayout = new QGridLayout(this); |
1314 | 751 |
|
752 |
roomName = new QLineEdit(this); |
|
1334
b58afaadf7ae
Send team removal message to others in room when client disconnects
unc0rr
parents:
1315
diff
changeset
|
753 |
roomName->setMaxLength(60); |
1314 | 754 |
pageLayout->addWidget(roomName, 0, 0); |
1399 | 755 |
|
756 |
roomsList = new QTableWidget(this); |
|
757 |
roomsList->setColumnCount(3); |
|
758 |
roomsList->setSelectionBehavior(QAbstractItemView::SelectRows); |
|
759 |
roomsList->verticalHeader()->setVisible(false); |
|
760 |
roomsList->horizontalHeader()->setResizeMode(QHeaderView::Interactive); |
|
1894 | 761 |
roomsList->setAlternatingRowColors(true); |
1522 | 762 |
pageLayout->addWidget(roomsList, 1, 0, 3, 1); |
1584
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
763 |
pageLayout->setRowStretch(2, 100); |
1399 | 764 |
|
1584
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
765 |
chatWidget = new HWChatWidget(this); |
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
766 |
pageLayout->addWidget(chatWidget, 4, 0, 1, 2); |
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1576
diff
changeset
|
767 |
pageLayout->setRowStretch(4, 350); |
1522 | 768 |
|
1312 | 769 |
BtnCreate = addButton(tr("Create"), pageLayout, 0, 1); |
770 |
BtnJoin = addButton(tr("Join"), pageLayout, 1, 1); |
|
1522 | 771 |
BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1); |
1856
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
772 |
|
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
773 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true); |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
774 |
BtnAdmin = addButton(tr("Admin features"), pageLayout, 5, 1); |
1314 | 775 |
|
776 |
connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); |
|
777 |
connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); |
|
1315 | 778 |
connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); |
1314 | 779 |
connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); |
1311 | 780 |
} |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
781 |
|
1856
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
782 |
void PageRoomsList::setAdmin(bool flag) |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
783 |
{ |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
784 |
BtnAdmin->setVisible(flag); |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1840
diff
changeset
|
785 |
} |
1377 | 786 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
787 |
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
|
788 |
{ |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
789 |
roomsList->clear(); |
1399 | 790 |
roomsList->setHorizontalHeaderLabels( |
791 |
QStringList() << |
|
792 |
QTableWidget::tr("Room name") << |
|
793 |
QTableWidget::tr("Players number") << |
|
794 |
QTableWidget::tr("Round in progress") |
|
795 |
); |
|
1893 | 796 |
|
797 |
roomsList->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); |
|
798 |
roomsList->horizontalHeader()->setResizeMode(1, QHeaderView::ResizeToContents); |
|
799 |
roomsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents); |
|
800 |
||
1399 | 801 |
|
802 |
if (list.size() % 3) |
|
803 |
return; |
|
804 |
||
805 |
roomsList->setRowCount(list.size() / 3); |
|
806 |
for(int i = 0; i < list.size(); i += 3) |
|
807 |
for(int t = 0; t < 3; t++) |
|
808 |
{ |
|
809 |
QTableWidgetItem * item = new QTableWidgetItem(list[i + t]); |
|
1891 | 810 |
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); |
1400 | 811 |
roomsList->setItem(i / 3, t, item); |
1399 | 812 |
} |
813 |
//roomsList->resizeColumnsToContents(); |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
814 |
} |
1314 | 815 |
|
816 |
void PageRoomsList::onCreateClick() |
|
817 |
{ |
|
818 |
if (roomName->text().size()) |
|
819 |
emit askForCreateRoom(roomName->text()); |
|
820 |
else |
|
821 |
QMessageBox::critical(this, |
|
822 |
tr("Error"), |
|
1315 | 823 |
tr("Please, enter room name"), |
1314 | 824 |
tr("OK")); |
825 |
} |
|
826 |
||
827 |
void PageRoomsList::onJoinClick() |
|
828 |
{ |
|
1399 | 829 |
QTableWidgetItem * curritem = roomsList->item(roomsList->currentRow(), 0); |
1314 | 830 |
if (!curritem) |
831 |
{ |
|
832 |
QMessageBox::critical(this, |
|
833 |
tr("Error"), |
|
834 |
tr("Please, select room from the list"), |
|
835 |
tr("OK")); |
|
836 |
return ; |
|
837 |
} |
|
838 |
emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); |
|
839 |
} |
|
840 |
||
1315 | 841 |
void PageRoomsList::onRefreshClick() |
842 |
{ |
|
843 |
emit askForRoomList(); |
|
844 |
} |
|
845 |
||
1800 | 846 |
|
847 |
PageConnecting::PageConnecting(QWidget* parent) : |
|
848 |
AbstractPage(parent) |
|
849 |
{ |
|
850 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1904 | 851 |
|
852 |
QLabel * lblConnecting = new QLabel(this); |
|
853 |
lblConnecting->setText(tr("Connecting...")); |
|
854 |
pageLayout->addWidget(lblConnecting); |
|
1800 | 855 |
} |
1884 | 856 |
|
857 |
PageScheme::PageScheme(QWidget* parent) : |
|
858 |
AbstractPage(parent) |
|
859 |
{ |
|
860 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
1885 | 861 |
|
862 |
CB_mode_Forts = new QCheckBox(this); |
|
863 |
CB_mode_Forts->setText(QCheckBox::tr("Forts mode")); |
|
864 |
pageLayout->addWidget(CB_mode_Forts, 0, 0, 1, 2); |
|
865 |
||
866 |
CB_teamsDivide = new QCheckBox(this); |
|
867 |
CB_teamsDivide->setText(QCheckBox::tr("Divide teams")); |
|
868 |
pageLayout->addWidget(CB_teamsDivide, 1, 0, 1, 2); |
|
869 |
||
870 |
CB_solid = new QCheckBox(this); |
|
871 |
CB_solid->setText(QCheckBox::tr("Solid land")); |
|
872 |
pageLayout->addWidget(CB_solid, 2, 0, 1, 2); |
|
873 |
||
874 |
CB_border = new QCheckBox(this); |
|
875 |
CB_border->setText(QCheckBox::tr("Add Border")); |
|
876 |
pageLayout->addWidget(CB_border, 3, 0, 1, 2); |
|
877 |
||
1895 | 878 |
CB_lowGravity = new QCheckBox(this); |
879 |
CB_lowGravity->setText(QCheckBox::tr("Low Gravity")); |
|
880 |
pageLayout->addWidget(CB_lowGravity, 4, 0, 1, 2); |
|
881 |
||
882 |
CB_laserSight = new QCheckBox(this); |
|
883 |
CB_laserSight->setText(QCheckBox::tr("Laser Sight")); |
|
884 |
pageLayout->addWidget(CB_laserSight, 5, 0, 1, 2); |
|
885 |
||
886 |
CB_invulnerable = new QCheckBox(this); |
|
887 |
CB_invulnerable->setText(QCheckBox::tr("Invulnerable")); |
|
888 |
pageLayout->addWidget(CB_invulnerable, 6, 0, 1, 2); |
|
889 |
||
890 |
CB_mines = new QCheckBox(this); |
|
891 |
CB_mines->setText(QCheckBox::tr("Add Mines")); |
|
892 |
pageLayout->addWidget(CB_mines, 7, 0, 1, 2); |
|
893 |
||
894 |
SB_DamageModifier = new QSpinBox(this); |
|
895 |
SB_DamageModifier->setRange(10, 300); |
|
896 |
SB_DamageModifier->setValue(100); |
|
897 |
SB_DamageModifier->setSingleStep(25); |
|
898 |
||
1885 | 899 |
SB_TurnTime = new QSpinBox(this); |
900 |
SB_TurnTime->setRange(1, 99); |
|
901 |
SB_TurnTime->setValue(45); |
|
902 |
SB_TurnTime->setSingleStep(15); |
|
903 |
||
904 |
SB_InitHealth = new QSpinBox(this); |
|
905 |
SB_InitHealth->setRange(50, 200); |
|
906 |
SB_InitHealth->setValue(100); |
|
907 |
SB_InitHealth->setSingleStep(25); |
|
908 |
||
909 |
SB_SuddenDeath = new QSpinBox(this); |
|
910 |
SB_SuddenDeath->setRange(0, 50); |
|
911 |
SB_SuddenDeath->setValue(15); |
|
912 |
SB_SuddenDeath->setSingleStep(3); |
|
913 |
||
914 |
SB_CaseProb = new FreqSpinBox(this); |
|
915 |
SB_CaseProb->setRange(0, 9); |
|
916 |
SB_CaseProb->setValue(5); |
|
917 |
||
918 |
LE_name = new QLineEdit(this); |
|
919 |
||
1895 | 920 |
pageLayout->addWidget(SB_DamageModifier, 8, 1); |
921 |
pageLayout->addWidget(SB_TurnTime, 9, 1); |
|
922 |
pageLayout->addWidget(SB_InitHealth, 10, 1); |
|
923 |
pageLayout->addWidget(SB_SuddenDeath, 11, 1); |
|
924 |
pageLayout->addWidget(SB_CaseProb, 12, 1); |
|
925 |
pageLayout->addWidget(LE_name, 13, 1); |
|
1885 | 926 |
|
927 |
mapper = new QDataWidgetMapper(this); |
|
1887 | 928 |
|
1895 | 929 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 15, 0, true); |
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
930 |
BtnNew = addButton(tr("New"), pageLayout, 15, 2); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
931 |
BtnDelete = addButton(tr("Delete"), pageLayout, 15, 3); |
1887 | 932 |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
933 |
selectScheme = new QComboBox(this); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
934 |
pageLayout->addWidget(selectScheme, 15, 1); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
935 |
|
1889 | 936 |
connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow())); |
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
937 |
connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow())); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
938 |
connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int))); |
1887 | 939 |
} |
940 |
||
941 |
void PageScheme::setModel(QAbstractItemModel * model) |
|
942 |
{ |
|
943 |
mapper->setModel(model); |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
944 |
selectScheme->setModel(model); |
1887 | 945 |
|
1885 | 946 |
mapper->addMapping(LE_name, 0); |
947 |
mapper->addMapping(CB_mode_Forts, 1); |
|
948 |
mapper->addMapping(CB_teamsDivide, 2); |
|
949 |
mapper->addMapping(CB_solid, 3); |
|
950 |
mapper->addMapping(CB_border, 4); |
|
1895 | 951 |
mapper->addMapping(CB_lowGravity, 5); |
952 |
mapper->addMapping(CB_laserSight, 6); |
|
953 |
mapper->addMapping(CB_invulnerable, 7); |
|
954 |
mapper->addMapping(CB_mines, 8); |
|
955 |
mapper->addMapping(SB_DamageModifier, 9); |
|
956 |
mapper->addMapping(SB_TurnTime, 10); |
|
957 |
mapper->addMapping(SB_InitHealth, 11); |
|
958 |
mapper->addMapping(SB_SuddenDeath, 12); |
|
959 |
mapper->addMapping(SB_CaseProb, 13); |
|
1887 | 960 |
|
961 |
mapper->toFirst(); |
|
1884 | 962 |
} |
1889 | 963 |
|
964 |
void PageScheme::newRow() |
|
965 |
{ |
|
966 |
QAbstractItemModel * model = mapper->model(); |
|
967 |
model->insertRow(model->rowCount()); |
|
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
968 |
selectScheme->setCurrentIndex(model->rowCount() - 1); |
1889 | 969 |
} |
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
970 |
|
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
971 |
void PageScheme::deleteRow() |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
972 |
{ |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
973 |
QAbstractItemModel * model = mapper->model(); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
974 |
model->removeRow(selectScheme->currentIndex()); |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1895
diff
changeset
|
975 |
} |
1905 | 976 |
|
977 |
///////////////////////////////////////////////// |
|
978 |
||
979 |
PageAdmin::PageAdmin(QWidget* parent) : |
|
980 |
AbstractPage(parent) |
|
981 |
{ |
|
982 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
983 |
||
984 |
BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true); |
|
985 |
} |