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