author | unc0rr |
Fri, 09 Feb 2007 19:38:52 +0000 | |
changeset 421 | ebd79d171804 |
parent 416 | 595d8663254d |
child 427 | b505012a3f15 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
2 |
* Hedgewars, a worms-like game |
|
3 |
* Copyright (c) 2006 Andrey Korotaev <unC0Rr@gmail.com> |
|
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 <QDir> |
|
21 |
#include <QPushButton> |
|
22 |
#include <QGroupBox> |
|
23 |
#include <QComboBox> |
|
311 | 24 |
#include <QCheckBox> |
184 | 25 |
#include <QLabel> |
26 |
#include <QToolBox> |
|
27 |
#include <QLineEdit> |
|
28 |
#include <QListWidget> |
|
29 |
#include <QApplication> |
|
231 | 30 |
#include <QSpinBox> |
184 | 31 |
|
32 |
#include "pages.h" |
|
33 |
#include "sdlkeys.h" |
|
34 |
#include "hwconsts.h" |
|
35 |
#include "gamecfgwidget.h" |
|
36 |
#include "teamselect.h" |
|
37 |
#include "gamecfgwidget.h" |
|
38 |
#include "SquareLabel.h" |
|
39 |
#include "mapContainer.h" |
|
187 | 40 |
#include "about.h" |
297 | 41 |
#include "fpsedit.h" |
412 | 42 |
#include "netudpwidget.h" |
184 | 43 |
|
44 |
PageMain::PageMain(QWidget* parent) : QWidget(parent) |
|
45 |
{ |
|
46 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
47 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
48 |
pageLayout->setMargin(25); |
|
49 |
pageLayout->setColumnStretch(0, 1); |
|
50 |
pageLayout->setColumnStretch(1, 2); |
|
51 |
pageLayout->setColumnStretch(2, 1); |
|
52 |
||
53 |
BtnSinglePlayer = new QPushButton(this); |
|
54 |
BtnSinglePlayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
55 |
BtnSinglePlayer->setFont(*font14); |
|
56 |
BtnSinglePlayer->setText(QPushButton::tr("Single Player")); |
|
57 |
pageLayout->addWidget(BtnSinglePlayer, 1, 1); |
|
58 |
||
59 |
BtnMultiplayer = new QPushButton(this); |
|
60 |
BtnMultiplayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
61 |
BtnMultiplayer->setFont(*font14); |
|
62 |
BtnMultiplayer->setText(QPushButton::tr("Multiplayer")); |
|
63 |
pageLayout->addWidget(BtnMultiplayer, 2, 1); |
|
64 |
||
65 |
BtnNet = new QPushButton(this); |
|
66 |
BtnNet->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
67 |
BtnNet->setFont(*font14); |
|
68 |
BtnNet->setText(QPushButton::tr("Net game")); |
|
69 |
pageLayout->addWidget(BtnNet, 3, 1); |
|
70 |
||
71 |
BtnDemos = new QPushButton(this); |
|
72 |
BtnDemos->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
73 |
BtnDemos->setFont(*font14); |
|
74 |
BtnDemos->setText(QPushButton::tr("Demos")); |
|
75 |
pageLayout->addWidget(BtnDemos, 4, 1); |
|
76 |
||
77 |
BtnSetup = new QPushButton(this); |
|
78 |
BtnSetup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
79 |
BtnSetup->setFont(*font14); |
|
80 |
BtnSetup->setText(QPushButton::tr("Setup")); |
|
81 |
pageLayout->addWidget(BtnSetup, 5, 1); |
|
82 |
||
187 | 83 |
BtnInfo = new QPushButton(this); |
84 |
BtnInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
85 |
BtnInfo->setFont(*font14); |
|
86 |
BtnInfo->setText(QPushButton::tr("About")); |
|
87 |
pageLayout->addWidget(BtnInfo, 6, 1); |
|
88 |
||
184 | 89 |
BtnExit = new QPushButton(parent); |
90 |
BtnExit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
|
91 |
BtnExit->setFont(*font14); |
|
92 |
BtnExit->setText(QPushButton::tr("Exit")); |
|
187 | 93 |
pageLayout->addWidget(BtnExit, 7, 1); |
184 | 94 |
} |
95 |
||
96 |
PageLocalGame::PageLocalGame(QWidget* parent) : QWidget(parent) |
|
97 |
{ |
|
98 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
99 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
100 |
BtnBack = new QPushButton(this); |
|
101 |
BtnBack->setFont(*font14); |
|
102 |
BtnBack->setText(QPushButton::tr("Back")); |
|
103 |
pageLayout->addWidget(BtnBack, 1, 0); |
|
104 |
BtnSimpleGame = new QPushButton(this); |
|
105 |
BtnSimpleGame->setFont(*font14); |
|
106 |
BtnSimpleGame->setText(QPushButton::tr("Simple Game")); |
|
107 |
pageLayout->addWidget(BtnSimpleGame, 1, 3); |
|
108 |
gameCFG = new GameCFGWidget(this); |
|
109 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
110 |
} |
|
111 |
||
112 |
PageEditTeam::PageEditTeam(QWidget* parent) : QWidget(parent) |
|
113 |
{ |
|
114 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
115 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
310 | 116 |
pageLayout->setColumnStretch(0, 1); |
184 | 117 |
pageLayout->setColumnMinimumWidth(0, 150); |
118 |
pageLayout->setColumnStretch(1, 100); |
|
336 | 119 |
pageLayout->setColumnMinimumWidth(1, 210); |
310 | 120 |
pageLayout->setColumnStretch(2, 150); |
336 | 121 |
pageLayout->setColumnMinimumWidth(2, 110); |
122 |
pageLayout->setColumnStretch(3, 150); |
|
123 |
pageLayout->setColumnMinimumWidth(3, 110); |
|
184 | 124 |
|
125 |
GBoxTeam = new QGroupBox(this); |
|
126 |
GBoxTeam->setTitle(QGroupBox::tr("Team")); |
|
127 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
128 |
QGridLayout * GBTLayout = new QGridLayout(GBoxTeam); |
|
129 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
|
130 |
TeamNameEdit->setMaxLength(15); |
|
231 | 131 |
GBTLayout->addWidget(TeamNameEdit, 0, 0, 1, 0); |
132 |
||
184 | 133 |
pageLayout->addWidget(GBoxTeam, 0, 0); |
134 |
||
135 |
GBoxHedgehogs = new QGroupBox(this); |
|
136 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
|
137 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
138 |
QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
|
139 |
for(int i = 0; i < 8; i++) |
|
140 |
{ |
|
141 |
HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
|
142 |
HHNameEdit[i]->setGeometry(QRect(10, 20 + i * 30, 141, 20)); |
|
143 |
HHNameEdit[i]->setMaxLength(15); |
|
144 |
GBHLayout->addWidget(HHNameEdit[i]); |
|
145 |
} |
|
146 |
pageLayout->addWidget(GBoxHedgehogs, 1, 0, 2, 1); |
|
147 |
||
148 |
BtnTeamDiscard = new QPushButton(this); |
|
149 |
BtnTeamDiscard->setFont(*font14); |
|
150 |
BtnTeamDiscard->setText(QPushButton::tr("Discard")); |
|
151 |
pageLayout->addWidget(BtnTeamDiscard, 4, 0); |
|
152 |
||
153 |
GBoxBinds = new QGroupBox(this); |
|
154 |
GBoxBinds->setTitle(QGroupBox::tr("Key binds")); |
|
155 |
QGridLayout * GBBLayout = new QGridLayout(GBoxBinds); |
|
156 |
BindsBox = new QToolBox(GBoxBinds); |
|
157 |
BindsBox->setLineWidth(0); |
|
158 |
GBBLayout->addWidget(BindsBox); |
|
159 |
page_A = new QWidget(); |
|
160 |
BindsBox->addItem(page_A, QToolBox::tr("Actions")); |
|
161 |
page_W = new QWidget(); |
|
162 |
BindsBox->addItem(page_W, QToolBox::tr("Weapons")); |
|
163 |
page_WP = new QWidget(); |
|
164 |
BindsBox->addItem(page_WP, QToolBox::tr("Weapon properties")); |
|
165 |
page_O = new QWidget(); |
|
166 |
BindsBox->addItem(page_O, QToolBox::tr("Other")); |
|
167 |
pageLayout->addWidget(GBoxBinds, 0, 1, 5, 1); |
|
168 |
||
169 |
QStringList binds; |
|
170 |
for(int i = 0; strlen(sdlkeys[i][1]) > 0; i++) |
|
171 |
{ |
|
172 |
binds << sdlkeys[i][1]; |
|
173 |
} |
|
174 |
||
175 |
quint16 widind = 0, i = 0; |
|
176 |
while (i < BINDS_NUMBER) { |
|
177 |
quint16 num = 0; |
|
178 |
QGridLayout * pagelayout = new QGridLayout(BindsBox->widget(widind)); |
|
179 |
do { |
|
180 |
LBind[i] = new QLabel(BindsBox->widget(widind)); |
|
181 |
LBind[i]->setText(QApplication::translate("binds", cbinds[i].name)); |
|
182 |
LBind[i]->setAlignment(Qt::AlignRight); |
|
183 |
pagelayout->addWidget(LBind[i], num, 0); |
|
184 |
CBBind[i] = new QComboBox(BindsBox->widget(widind)); |
|
185 |
CBBind[i]->addItems(binds); |
|
186 |
pagelayout->addWidget(CBBind[i], num, 1); |
|
187 |
num++; |
|
188 |
} while (!cbinds[i++].chwidget); |
|
189 |
pagelayout->addWidget(new QWidget(BindsBox->widget(widind)), num, 0, 1, 2); |
|
190 |
widind++; |
|
191 |
} |
|
192 |
||
193 |
GBoxGrave = new QGroupBox(this); |
|
194 |
GBoxGrave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
195 |
GBoxGrave->setTitle(QGroupBox::tr("Grave")); |
|
196 |
QGridLayout * GBGLayout = new QGridLayout(GBoxGrave); |
|
197 |
CBGrave = new QComboBox(GBoxGrave); |
|
198 |
CBGrave->setMaxCount(65535); |
|
199 |
GBGLayout->addWidget(CBGrave, 0, 0, 1, 3); |
|
200 |
GravePreview = new QLabel(GBoxGrave); |
|
201 |
GravePreview->setScaledContents(false); |
|
336 | 202 |
pageLayout->addWidget(GBoxGrave, 0, 3, 2, 1); |
184 | 203 |
GBGLayout->addWidget(GravePreview, 1, 1); |
336 | 204 |
|
205 |
GBoxTeamLvl = new QGroupBox(this); |
|
206 |
GBoxTeamLvl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
207 |
GBoxTeamLvl->setTitle(QGroupBox::tr("Team level")); |
|
208 |
QGridLayout * GBTLLayout = new QGridLayout(GBoxTeamLvl); |
|
209 |
CBTeamLvl = new QComboBox(GBoxTeamLvl); |
|
210 |
CBTeamLvl->addItem(QComboBox::tr("Human")); |
|
211 |
CBTeamLvl->addItem(QComboBox::tr("Level 1")); |
|
212 |
CBTeamLvl->addItem(QComboBox::tr("Level 2")); |
|
213 |
CBTeamLvl->addItem(QComboBox::tr("Level 3")); |
|
214 |
CBTeamLvl->addItem(QComboBox::tr("Level 4")); |
|
215 |
CBTeamLvl->addItem(QComboBox::tr("Level 5")); |
|
216 |
CBTeamLvl->setMaxCount(6); |
|
217 |
GBTLLayout->addWidget(CBTeamLvl, 0, 0, 1, 3); |
|
218 |
LevelPict = new QLabel(GBoxTeamLvl); |
|
219 |
LevelPict->setScaledContents(false); |
|
220 |
LevelPict->setFixedSize(32, 32); |
|
221 |
pageLayout->addWidget(GBoxTeamLvl, 0, 2, 2, 1); |
|
222 |
GBTLLayout->addWidget(LevelPict, 1, 1); |
|
184 | 223 |
|
224 |
GBoxFort = new QGroupBox(this); |
|
225 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
|
226 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
|
227 |
CBFort = new QComboBox(GBoxFort); |
|
228 |
CBFort->setMaxCount(65535); |
|
229 |
GBFLayout->addWidget(CBFort, 0, 0); |
|
230 |
FortPreview = new SquareLabel(GBoxFort); |
|
310 | 231 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
184 | 232 |
FortPreview->setPixmap(QPixmap()); |
233 |
GBFLayout->addWidget(FortPreview, 1, 0); |
|
336 | 234 |
pageLayout->addWidget(GBoxFort, 2, 2, 1, 2); |
184 | 235 |
|
236 |
BtnTeamSave = new QPushButton(this); |
|
237 |
BtnTeamSave->setFont(*font14); |
|
238 |
BtnTeamSave->setText(QPushButton::tr("Save")); |
|
336 | 239 |
pageLayout->addWidget(BtnTeamSave, 4, 2, 1, 2); |
184 | 240 |
|
241 |
QDir tmpdir; |
|
242 |
tmpdir.cd(datadir->absolutePath()); |
|
243 |
tmpdir.cd("Forts"); |
|
244 |
tmpdir.setFilter(QDir::Files); |
|
245 |
||
246 |
CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L.png"), "\\1")); |
|
247 |
tmpdir.cd("../Graphics/Graves"); |
|
248 |
QStringList list = tmpdir.entryList(QStringList("*.png")); |
|
249 |
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
250 |
{ |
|
251 |
CBGrave->addItem((*it).replace(QRegExp("^(.*).png"), "\\1")); |
|
252 |
} |
|
253 |
||
254 |
connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &))); |
|
336 | 255 |
connect(CBTeamLvl, SIGNAL(activated(int)), this, SLOT(CBTeamLvl_activated(int))); |
184 | 256 |
connect(CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
257 |
} |
|
258 |
||
259 |
void PageEditTeam::CBGrave_activated(const QString & gravename) |
|
260 |
{ |
|
261 |
QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + gravename + ".png"); |
|
262 |
GravePreview->setPixmap(pix.copy(0, 0, 32, 32)); |
|
263 |
} |
|
264 |
||
265 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
|
266 |
{ |
|
267 |
QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
|
268 |
FortPreview->setPixmap(pix); |
|
269 |
} |
|
270 |
||
336 | 271 |
void PageEditTeam::CBTeamLvl_activated(int id) |
272 |
{ |
|
273 |
QPixmap pix(QString(":/res/botlevels/%1.png").arg(id)); |
|
274 |
LevelPict->setPixmap(pix); |
|
275 |
} |
|
276 |
||
184 | 277 |
PageMultiplayer::PageMultiplayer(QWidget* parent) : QWidget(parent) |
278 |
{ |
|
279 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
280 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
281 |
||
282 |
BtnBack = new QPushButton(this); |
|
283 |
BtnBack->setFont(*font14); |
|
284 |
BtnBack->setText(QPushButton::tr("Back")); |
|
285 |
pageLayout->addWidget(BtnBack, 1, 0); |
|
187 | 286 |
|
184 | 287 |
//HWMapContainer* pMapContainer=new HWMapContainer(this); |
288 |
//pageLayout->addWidget(pMapContainer, 1, 1); |
|
289 |
||
290 |
gameCFG = new GameCFGWidget(this); |
|
291 |
pageLayout->addWidget(gameCFG, 0, 0, 1, 2); |
|
292 |
teamsSelect = new TeamSelWidget(this); |
|
293 |
pageLayout->addWidget(teamsSelect, 0, 2, 1, 2); |
|
294 |
||
295 |
BtnStartMPGame = new QPushButton(this); |
|
296 |
BtnStartMPGame->setFont(*font14); |
|
297 |
BtnStartMPGame->setText(QPushButton::tr("Start")); |
|
298 |
pageLayout->addWidget(BtnStartMPGame, 1, 3); |
|
299 |
} |
|
300 |
||
301 |
PagePlayDemo::PagePlayDemo(QWidget* parent) : QWidget(parent) |
|
302 |
{ |
|
303 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
304 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
305 |
pageLayout->setColumnStretch(0, 1); |
|
306 |
pageLayout->setColumnStretch(1, 2); |
|
307 |
pageLayout->setColumnStretch(2, 1); |
|
308 |
||
309 |
BtnBack = new QPushButton(this); |
|
310 |
BtnBack->setFont(*font14); |
|
311 |
BtnBack->setText(QPushButton::tr("Back")); |
|
312 |
pageLayout->addWidget(BtnBack, 1, 0); |
|
313 |
||
314 |
BtnPlayDemo = new QPushButton(this); |
|
315 |
BtnPlayDemo->setGeometry(QRect(240, 330, 161, 41)); |
|
316 |
BtnPlayDemo->setFont(*font14); |
|
317 |
BtnPlayDemo->setText(QPushButton::tr("Play demo")); |
|
318 |
pageLayout->addWidget(BtnPlayDemo, 1, 2); |
|
319 |
||
320 |
DemosList = new QListWidget(this); |
|
321 |
DemosList->setGeometry(QRect(170, 10, 311, 311)); |
|
322 |
pageLayout->addWidget(DemosList, 0, 1); |
|
323 |
} |
|
324 |
||
325 |
PageOptions::PageOptions(QWidget* parent) : QWidget(parent) |
|
326 |
{ |
|
327 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
328 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
329 |
groupBox = new QGroupBox(this); |
|
330 |
groupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
331 |
groupBox->setTitle(QGroupBox::tr("Teams")); |
|
332 |
pageLayout->addWidget(groupBox, 0, 0, 1, 3); |
|
333 |
||
334 |
QGridLayout * GBTlayout = new QGridLayout(groupBox); |
|
335 |
BtnNewTeam = new QPushButton(groupBox); |
|
336 |
BtnNewTeam->setFont(*font14); |
|
337 |
BtnNewTeam->setText(QPushButton::tr("New team")); |
|
338 |
GBTlayout->addWidget(BtnNewTeam, 0, 0); |
|
339 |
||
340 |
CBTeamName = new QComboBox(groupBox); |
|
341 |
GBTlayout->addWidget(CBTeamName, 0, 1); |
|
342 |
||
343 |
BtnEditTeam = new QPushButton(groupBox); |
|
344 |
BtnEditTeam->setFont(*font14); |
|
345 |
BtnEditTeam->setText(QPushButton::tr("Edit team")); |
|
346 |
GBTlayout->addWidget(BtnEditTeam, 0, 2); |
|
347 |
||
348 |
AGGroupBox = new QGroupBox(this); |
|
349 |
AGGroupBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
|
350 |
AGGroupBox->setTitle(QGroupBox::tr("Audio/Graphic options")); |
|
351 |
pageLayout->addWidget(AGGroupBox, 1, 0, 1, 3); |
|
352 |
||
353 |
QGridLayout * GBAlayout = new QGridLayout(AGGroupBox); |
|
354 |
CBResolution = new QComboBox(AGGroupBox); |
|
355 |
CBResolution->addItem("640x480"); |
|
356 |
CBResolution->addItem("800x600"); |
|
357 |
CBResolution->addItem("1024x768"); |
|
358 |
CBResolution->addItem("1280x1024"); |
|
359 |
GBAlayout->addWidget(CBResolution, 0, 0); |
|
360 |
||
361 |
CBFullscreen = new QCheckBox(AGGroupBox); |
|
362 |
CBFullscreen->setText(QCheckBox::tr("Fullscreen")); |
|
363 |
GBAlayout->addWidget(CBFullscreen, 0, 1); |
|
364 |
||
365 |
CBEnableSound = new QCheckBox(AGGroupBox); |
|
366 |
CBEnableSound->setText(QCheckBox::tr("Enable sound")); |
|
367 |
GBAlayout->addWidget(CBEnableSound, 0, 2); |
|
368 |
||
297 | 369 |
CBShowFPS = new QCheckBox(AGGroupBox); |
370 |
CBShowFPS->setText(QCheckBox::tr("Show FPS")); |
|
371 |
GBAlayout->addWidget(CBShowFPS, 0, 3); |
|
372 |
||
373 |
fpsedit = new FPSEdit(AGGroupBox); |
|
374 |
GBAlayout->addWidget(fpsedit, 0, 4); |
|
375 |
||
184 | 376 |
pageLayout->addWidget(new QWidget(), 3, 0, 1, 3); |
377 |
||
378 |
BtnSaveOptions = new QPushButton(this); |
|
379 |
BtnSaveOptions->setFont(*font14); |
|
380 |
BtnSaveOptions->setText(QPushButton::tr("Save")); |
|
381 |
pageLayout->addWidget(BtnSaveOptions, 4, 2); |
|
382 |
||
383 |
BtnBack = new QPushButton(this); |
|
384 |
BtnBack->setFont(*font14); |
|
385 |
BtnBack->setText(QPushButton::tr("Back")); |
|
386 |
pageLayout->addWidget(BtnBack, 4, 0); |
|
387 |
} |
|
388 |
||
389 |
PageNet::PageNet(QWidget* parent) : QWidget(parent) |
|
390 |
{ |
|
391 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
392 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
393 |
pageLayout->setColumnStretch(0, 1); |
|
394 |
pageLayout->setColumnStretch(1, 1); |
|
421 | 395 |
|
396 |
BtnNetSvrStart = new QPushButton(this); |
|
397 |
BtnNetSvrStart->setFont(*font14); |
|
398 |
BtnNetSvrStart->setText(QPushButton::tr("Start server")); |
|
399 |
pageLayout->addWidget(BtnNetSvrStart, 0, 1); |
|
184 | 400 |
|
401 |
NNGroupBox = new QGroupBox(this); |
|
314 | 402 |
NNGroupBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); |
184 | 403 |
NNGroupBox->setTitle(QGroupBox::tr("Net options")); |
421 | 404 |
pageLayout->addWidget(NNGroupBox, 0, 0); |
184 | 405 |
|
406 |
QGridLayout * GBNlayout = new QGridLayout(NNGroupBox); |
|
407 |
labelNN = new QLabel(NNGroupBox); |
|
408 |
labelNN->setText(QLabel::tr("Net nick")); |
|
409 |
GBNlayout->addWidget(labelNN, 0, 0); |
|
410 |
||
411 |
editNetNick = new QLineEdit(NNGroupBox); |
|
412 |
editNetNick->setMaxLength(20); |
|
413 |
editNetNick->setText(QLineEdit::tr("unnamed")); |
|
414 |
GBNlayout->addWidget(editNetNick, 0, 1); |
|
415 |
||
421 | 416 |
QGroupBox * ConnGroupBox = new QGroupBox(this); |
417 |
ConnGroupBox->setTitle(QGroupBox::tr("Net game")); |
|
418 |
pageLayout->addWidget(ConnGroupBox, 2, 0, 1, 3); |
|
419 |
QGridLayout * GBClayout = new QGridLayout(ConnGroupBox); |
|
420 |
GBClayout->setColumnStretch(0, 0); |
|
421 |
GBClayout->setColumnStretch(1, 1); |
|
422 |
GBClayout->setColumnStretch(2, 1); |
|
423 |
GBClayout->setRowStretch(0, 0); |
|
424 |
GBClayout->setRowStretch(1, 0); |
|
425 |
GBClayout->setRowStretch(2, 1); |
|
426 |
||
427 |
labelIP = new QLabel(ConnGroupBox); |
|
184 | 428 |
labelIP->setText(QLabel::tr("Server address")); |
421 | 429 |
GBClayout->addWidget(labelIP, 0, 0); |
184 | 430 |
|
421 | 431 |
editIP = new QLineEdit(ConnGroupBox); |
184 | 432 |
editIP->setMaxLength(50); |
421 | 433 |
GBClayout->addWidget(editIP, 0, 1); |
184 | 434 |
|
421 | 435 |
BtnNetConnect = new QPushButton(ConnGroupBox); |
184 | 436 |
BtnNetConnect->setFont(*font14); |
437 |
BtnNetConnect->setText(QPushButton::tr("Connect")); |
|
421 | 438 |
GBClayout->addWidget(BtnNetConnect, 0, 2); |
416 | 439 |
|
421 | 440 |
pUdpClient=new HWNetUdpWidget(ConnGroupBox); |
441 |
GBClayout->addWidget(pUdpClient, 1, 0, 2, 2); |
|
442 |
||
443 |
pUpdateUdpButt = new QPushButton(ConnGroupBox); |
|
416 | 444 |
pUpdateUdpButt->setFont(*font14); |
445 |
pUpdateUdpButt->setText(QPushButton::tr("Update")); |
|
421 | 446 |
GBClayout->addWidget(pUpdateUdpButt, 1, 2); |
314 | 447 |
|
184 | 448 |
BtnBack = new QPushButton(this); |
449 |
BtnBack->setFont(*font14); |
|
450 |
BtnBack->setText(QPushButton::tr("Back")); |
|
412 | 451 |
pageLayout->addWidget(BtnBack, 3, 0); |
184 | 452 |
} |
453 |
||
454 |
PageNetChat::PageNetChat(QWidget* parent) : QWidget(parent) |
|
455 |
{ |
|
456 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
457 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
458 |
pageLayout->setColumnStretch(0, 1); |
|
459 |
pageLayout->setColumnStretch(1, 1); |
|
460 |
pageLayout->setColumnStretch(2, 1); |
|
461 |
||
462 |
BtnDisconnect = new QPushButton(this); |
|
463 |
BtnDisconnect->setFont(*font14); |
|
464 |
BtnDisconnect->setText(QPushButton::tr("Disconnect")); |
|
465 |
pageLayout->addWidget(BtnDisconnect, 2, 0); |
|
466 |
||
467 |
ChannelsList = new QListWidget(this); |
|
468 |
pageLayout->addWidget(ChannelsList, 0, 1); |
|
469 |
||
470 |
BtnJoin = new QPushButton(this); |
|
471 |
BtnJoin->setFont(*font14); |
|
472 |
BtnJoin->setText(QPushButton::tr("Join")); |
|
473 |
pageLayout->addWidget(BtnJoin, 2, 2); |
|
474 |
||
475 |
BtnCreate = new QPushButton(this); |
|
476 |
BtnCreate->setFont(*font14); |
|
477 |
BtnCreate->setText(QPushButton::tr("Create")); |
|
478 |
pageLayout->addWidget(BtnCreate, 1, 2); |
|
479 |
} |
|
480 |
||
481 |
PageNetGame::PageNetGame(QWidget* parent) : QWidget(parent) |
|
482 |
{ |
|
483 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
484 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
322 | 485 |
|
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
486 |
pGameCFG = new GameCFGWidget(this); |
322 | 487 |
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
|
488 |
|
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
323
diff
changeset
|
489 |
pNetTeamsWidget = new TeamSelWidget(this); |
373 | 490 |
pNetTeamsWidget->setAcceptOuter(true); |
322 | 491 |
pageLayout->addWidget(pNetTeamsWidget, 0, 1); |
184 | 492 |
|
493 |
BtnBack = new QPushButton(this); |
|
494 |
BtnBack->setFont(*font14); |
|
495 |
BtnBack->setText(QPushButton::tr("Back")); |
|
322 | 496 |
pageLayout->addWidget(BtnBack, 1, 0); |
184 | 497 |
|
498 |
BtnGo = new QPushButton(this); |
|
499 |
BtnGo->setFont(*font14); |
|
500 |
BtnGo->setText(QPushButton::tr("Go!")); |
|
322 | 501 |
pageLayout->addWidget(BtnGo, 1, 1); |
184 | 502 |
} |
187 | 503 |
|
504 |
PageInfo::PageInfo(QWidget* parent) : QWidget(parent) |
|
505 |
{ |
|
506 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
507 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
508 |
pageLayout->setColumnStretch(0, 1); |
|
509 |
pageLayout->setColumnStretch(1, 1); |
|
510 |
pageLayout->setColumnStretch(2, 1); |
|
511 |
||
512 |
BtnBack = new QPushButton(this); |
|
513 |
BtnBack->setFont(*font14); |
|
514 |
BtnBack->setText(QPushButton::tr("Back")); |
|
515 |
pageLayout->addWidget(BtnBack, 1, 0); |
|
516 |
||
517 |
about = new About(this); |
|
518 |
pageLayout->addWidget(about, 0, 0, 1, 3); |
|
519 |
} |
|
306 | 520 |
|
521 |
PageGameStats::PageGameStats(QWidget* parent) : QWidget(parent) |
|
522 |
{ |
|
523 |
QFont * font14 = new QFont("MS Shell Dlg", 14); |
|
524 |
QGridLayout * pageLayout = new QGridLayout(this); |
|
525 |
pageLayout->setColumnStretch(0, 1); |
|
526 |
pageLayout->setColumnStretch(1, 1); |
|
527 |
pageLayout->setColumnStretch(2, 1); |
|
528 |
||
529 |
BtnBack = new QPushButton(this); |
|
530 |
BtnBack->setFont(*font14); |
|
531 |
BtnBack->setText(QPushButton::tr("Back")); |
|
532 |
pageLayout->addWidget(BtnBack, 1, 0); |
|
533 |
||
307 | 534 |
labelGameStats = new QLabel(this); |
535 |
labelGameStats->setTextFormat(Qt::RichText); |
|
536 |
pageLayout->addWidget(labelGameStats, 0, 0, 1, 3); |
|
306 | 537 |
} |