author | nemo |
Sun, 03 May 2009 21:28:15 +0000 | |
changeset 2025 | 692308790912 |
parent 2012 | 76fff564246b |
child 2026 | 21c986c528ba |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
1569 | 3 |
* Copyright (c) 2005-2009 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 <QFile> |
|
20 |
#include <QTextStream> |
|
407 | 21 |
#include <QMessageBox> |
502
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
22 |
#include <QPushButton> |
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
23 |
#include <QListWidget> |
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
24 |
#include <QStackedLayout> |
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
25 |
#include <QLineEdit> |
bc178daca088
Fix build with CMake & gcc 4.1.2 on my system (treating #include <QtGui> as including directory)
unc0rr
parents:
496
diff
changeset
|
26 |
#include <QLabel> |
636 | 27 |
#include <QRadioButton> |
654 | 28 |
#include <QSpinBox> |
674 | 29 |
#include <QCloseEvent> |
1235 | 30 |
#include <QCheckBox> |
1377 | 31 |
#include <QTextBrowser> |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
32 |
#include <QAction> |
1418 | 33 |
#include <QTimer> |
1419 | 34 |
#include <QScrollBar> |
1885 | 35 |
#include <QDataWidgetMapper> |
1887 | 36 |
#include <QTableView> |
184 | 37 |
|
38 |
#include "hwform.h" |
|
39 |
#include "game.h" |
|
40 |
#include "team.h" |
|
1907 | 41 |
#include "namegen.h" |
184 | 42 |
#include "teamselect.h" |
681 | 43 |
#include "selectWeapon.h" |
184 | 44 |
#include "gameuiconfig.h" |
45 |
#include "pages.h" |
|
1621 | 46 |
#include "statsPage.h" |
184 | 47 |
#include "hwconsts.h" |
314 | 48 |
#include "newnetclient.h" |
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
328
diff
changeset
|
49 |
#include "gamecfgwidget.h" |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
625
diff
changeset
|
50 |
#include "netserverslist.h" |
634 | 51 |
#include "netudpserver.h" |
461 | 52 |
#include "chatwidget.h" |
579 | 53 |
#include "playrecordpage.h" |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
54 |
#include "input_ip.h" |
1885 | 55 |
#include "ammoSchemeModel.h" |
2012 | 56 |
#include "bgwidget.h" |
184 | 57 |
|
58 |
HWForm::HWForm(QWidget *parent) |
|
637
8fa7ed5e13bd
Fix bad behavior when quickly click Connect button more than once
unc0rr
parents:
636
diff
changeset
|
59 |
: QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0) |
184 | 60 |
{ |
61 |
ui.setupUi(this); |
|
1225
f882a92ef872
Play music in menu also, with fading effects when run game
unc0rr
parents:
1223
diff
changeset
|
62 |
|
1419 | 63 |
CustomizePalettes(); |
64 |
||
1225
f882a92ef872
Play music in menu also, with fading effects when run game
unc0rr
parents:
1223
diff
changeset
|
65 |
ui.pageOptions->CBResolution->addItems(sdli.getResolutions()); |
f882a92ef872
Play music in menu also, with fading effects when run game
unc0rr
parents:
1223
diff
changeset
|
66 |
|
301 | 67 |
config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); |
1907 | 68 |
|
69 |
namegen = new HWNamegen(); |
|
184 | 70 |
|
245 | 71 |
UpdateTeamsLists(); |
695 | 72 |
UpdateWeapons(); |
184 | 73 |
|
1162 | 74 |
connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool))); |
75 |
onFrontendFullscreen(config->isFrontendFullscreen()); |
|
76 |
||
1885 | 77 |
connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); |
78 |
connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); |
|
1950 | 79 |
connect(ui.pageMain->BtnNet, SIGNAL(clicked()), this, SLOT(GoToNetType())); |
1885 | 80 |
connect(ui.pageMain->BtnInfo, SIGNAL(clicked()), this, SLOT(GoToInfo())); |
530 | 81 |
connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed())); |
82 |
connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked())); |
|
184 | 83 |
|
1885 | 84 |
connect(ui.pageEditTeam->BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave())); |
85 |
connect(ui.pageEditTeam->BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard())); |
|
184 | 86 |
|
1840 | 87 |
connect(ui.pageEditTeam->signalMapper, SIGNAL(mapped(const int &)), this, SLOT(RandomName(const int &))); |
88 |
connect(ui.pageEditTeam->randTeamButton, SIGNAL(clicked()), this, SLOT(RandomNames())); |
|
89 |
||
1885 | 90 |
connect(ui.pageMultiplayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
91 |
connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame())); |
|
493 | 92 |
connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)), |
492 | 93 |
ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool))); |
586 | 94 |
connect(ui.pageMultiplayer->teamsSelect, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup())); |
1885 | 95 |
connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes())); |
2009 | 96 |
connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &))); |
184 | 97 |
|
1950 | 98 |
connect(ui.pagePlayDemo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
99 |
connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo())); |
|
1951 | 100 |
connect(ui.pagePlayDemo->DemosList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(PlayDemo())); |
184 | 101 |
|
1950 | 102 |
connect(ui.pageOptions->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
103 |
connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); |
|
104 |
connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); |
|
105 |
connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions())); |
|
106 |
connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack())); |
|
695 | 107 |
|
1509 | 108 |
connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon())); |
109 |
connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon())); |
|
110 |
connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons())); |
|
184 | 111 |
|
1395 | 112 |
connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
113 |
connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect())); |
|
114 |
connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer())); |
|
115 |
connect(ui.pageNet, SIGNAL(connectClicked(const QString &, quint16)), this, SLOT(NetConnectServer(const QString &, quint16))); |
|
646 | 116 |
|
1950 | 117 |
connect(ui.pageNetServer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
118 |
connect(ui.pageNetServer->BtnStart, SIGNAL(clicked()), this, SLOT(NetStartServer())); |
|
184 | 119 |
|
1950 | 120 |
connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
493 | 121 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)), |
492 | 122 |
ui.pageNetGame->BtnGo, SLOT(setEnabled(bool))); |
1951 | 123 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)), |
124 |
ui.pageNetGame->BtnStart, SLOT(setEnabled(bool))); |
|
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
125 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup())); |
1885 | 126 |
connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes())); |
2009 | 127 |
connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &))); |
184 | 128 |
|
1312 | 129 |
connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
1905 | 130 |
connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), this, SLOT(GoToAdmin())); |
187 | 131 |
|
1312 | 132 |
connect(ui.pageInfo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
133 |
||
134 |
connect(ui.pageGameStats->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
|
306 | 135 |
|
1887 | 136 |
connect(ui.pageSinglePlayer->BtnSimpleGamePage, SIGNAL(clicked()), this, SLOT(SimpleGame())); |
137 |
connect(ui.pageSinglePlayer->BtnTrainPage, SIGNAL(clicked()), this, SLOT(GoToTraining())); |
|
138 |
connect(ui.pageSinglePlayer->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer())); |
|
139 |
connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves())); |
|
140 |
connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos())); |
|
141 |
connect(ui.pageSinglePlayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
|
311 | 142 |
|
1887 | 143 |
connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining())); |
144 |
connect(ui.pageTraining->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
|
587 | 145 |
|
1887 | 146 |
connect(ui.pageSelectWeapon->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
147 |
connect(ui.pageSelectWeapon->BtnDefault, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(setDefault())); |
|
148 |
connect(ui.pageSelectWeapon->BtnSave, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(save())); |
|
600 | 149 |
|
1887 | 150 |
connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()), |
718 | 151 |
ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first |
1887 | 152 |
connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()), |
718 | 153 |
this, SLOT(UpdateWeapons())); // executed second |
1887 | 154 |
connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()), |
718 | 155 |
this, SLOT(GoBack())); // executed third |
156 |
||
1887 | 157 |
connect(ui.pageScheme->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
158 |
||
1905 | 159 |
connect(ui.pageAdmin->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
160 |
||
1950 | 161 |
connect(ui.pageNetType->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
162 |
connect(ui.pageNetType->BtnLAN, SIGNAL(clicked()), this, SLOT(GoToNet())); |
|
163 |
connect(ui.pageNetType->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer())); |
|
164 |
||
1885 | 165 |
|
1897 | 166 |
ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini"); |
1887 | 167 |
ui.pageScheme->setModel(ammoSchemeModel); |
1890 | 168 |
ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel); |
1885 | 169 |
|
2012 | 170 |
wBackground = new BGWidget(this); |
171 |
wBackground->setFixedSize(this->width(), this->height()); |
|
172 |
wBackground->lower(); |
|
173 |
wBackground->init(); |
|
174 |
wBackground->startAnimation(); |
|
175 |
||
1845 | 176 |
PagesStack.push(ID_PAGE_MAIN); |
177 |
GoBack(); |
|
184 | 178 |
} |
179 |
||
1162 | 180 |
void HWForm::onFrontendFullscreen(bool value) |
181 |
{ |
|
1163 | 182 |
if (value) |
183 |
setWindowState(windowState() | Qt::WindowFullScreen); |
|
184 |
else { |
|
185 |
setWindowState(windowState() & !Qt::WindowFullScreen); |
|
186 |
} |
|
1162 | 187 |
} |
188 |
||
1419 | 189 |
void HWForm::CustomizePalettes() |
190 |
{ |
|
191 |
QList<QScrollBar *> allSBars = findChildren<QScrollBar *>(); |
|
192 |
QPalette pal = palette(); |
|
193 |
pal.setColor(QPalette::WindowText, QColor(0xff, 0xcc, 0x00)); |
|
194 |
pal.setColor(QPalette::Button, QColor(0x00, 0x35, 0x1d)); |
|
195 |
pal.setColor(QPalette::Base, QColor(0x00, 0x35, 0x1d)); |
|
196 |
pal.setColor(QPalette::Window, QColor(0x00, 0x00, 0x00)); |
|
197 |
||
198 |
for (int i = 0; i < allSBars.size(); ++i) |
|
199 |
allSBars.at(i)->setPalette(pal); |
|
200 |
} |
|
201 |
||
695 | 202 |
void HWForm::UpdateWeapons() |
203 |
{ |
|
1419 | 204 |
QVector<QComboBox*> combos; |
205 |
combos.push_back(ui.pageOptions->WeaponsName); |
|
206 |
combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName); |
|
207 |
combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName); |
|
696 | 208 |
|
1517 | 209 |
QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames(); |
210 |
||
211 |
for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it) { |
|
1419 | 212 |
(*it)->clear(); |
1517 | 213 |
|
214 |
for(int i = 0; i < names.size(); ++i) |
|
215 |
(*it)->addItem(names[i], ui.pageSelectWeapon->pWeapons->getWeaponsString(names[i])); |
|
216 |
||
1509 | 217 |
int pos = (*it)->findText("Default"); |
218 |
if (pos != -1) { |
|
1419 | 219 |
(*it)->setCurrentIndex(pos); |
220 |
} |
|
221 |
} |
|
695 | 222 |
} |
223 |
||
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
224 |
void HWForm::UpdateTeamsLists(const QStringList* editable_teams) |
245 | 225 |
{ |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
226 |
QStringList teamslist; |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
227 |
if(editable_teams) { |
1509 | 228 |
teamslist =* editable_teams; |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
229 |
} else { |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
230 |
teamslist = config->GetTeamsList(); |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
231 |
} |
245 | 232 |
|
233 |
if(teamslist.empty()) { |
|
234 |
HWTeam defaultTeam("DefaultTeam"); |
|
235 |
defaultTeam.SaveToFile(); |
|
236 |
teamslist.push_back("DefaultTeam"); |
|
237 |
} |
|
238 |
||
239 |
ui.pageOptions->CBTeamName->clear(); |
|
240 |
ui.pageOptions->CBTeamName->addItems(teamslist); |
|
241 |
} |
|
242 |
||
184 | 243 |
void HWForm::GoToMain() |
244 |
{ |
|
289 | 245 |
GoToPage(ID_PAGE_MAIN); |
184 | 246 |
} |
247 |
||
248 |
void HWForm::GoToSinglePlayer() |
|
249 |
{ |
|
289 | 250 |
GoToPage(ID_PAGE_SINGLEPLAYER); |
184 | 251 |
} |
252 |
||
587 | 253 |
void HWForm::GoToTraining() |
254 |
{ |
|
255 |
GoToPage(ID_PAGE_TRAINING); |
|
256 |
} |
|
257 |
||
184 | 258 |
void HWForm::GoToSetup() |
259 |
{ |
|
289 | 260 |
GoToPage(ID_PAGE_SETUP); |
184 | 261 |
} |
262 |
||
694 | 263 |
void HWForm::GoToSelectNewWeapon() |
264 |
{ |
|
1509 | 265 |
ui.pageSelectWeapon->pWeapons->setWeaponsName(tr("new")); |
694 | 266 |
GoToPage(ID_PAGE_SELECTWEAPON); |
267 |
} |
|
268 |
||
600 | 269 |
void HWForm::GoToSelectWeapon() |
270 |
{ |
|
1509 | 271 |
ui.pageSelectWeapon->pWeapons->setWeaponsName(ui.pageOptions->WeaponsName->currentText()); |
600 | 272 |
GoToPage(ID_PAGE_SELECTWEAPON); |
273 |
} |
|
274 |
||
2009 | 275 |
void HWForm::GoToSelectWeaponSet(const QString & name) |
276 |
{ |
|
277 |
ui.pageSelectWeapon->pWeapons->setWeaponsName(name); |
|
278 |
GoToPage(ID_PAGE_SELECTWEAPON); |
|
279 |
} |
|
280 |
||
187 | 281 |
void HWForm::GoToInfo() |
282 |
{ |
|
289 | 283 |
GoToPage(ID_PAGE_INFO); |
187 | 284 |
} |
285 |
||
184 | 286 |
void HWForm::GoToMultiplayer() |
287 |
{ |
|
290 | 288 |
GoToPage(ID_PAGE_MULTIPLAYER); |
184 | 289 |
} |
290 |
||
579 | 291 |
void HWForm::GoToSaves() |
292 |
{ |
|
581 | 293 |
ui.pagePlayDemo->FillFromDir(PagePlayDemo::RT_Save); |
579 | 294 |
|
295 |
GoToPage(ID_PAGE_DEMOS); |
|
296 |
} |
|
297 |
||
184 | 298 |
void HWForm::GoToDemos() |
299 |
{ |
|
581 | 300 |
ui.pagePlayDemo->FillFromDir(PagePlayDemo::RT_Demo); |
579 | 301 |
|
290 | 302 |
GoToPage(ID_PAGE_DEMOS); |
184 | 303 |
} |
304 |
||
305 |
void HWForm::GoToNet() |
|
306 |
{ |
|
646 | 307 |
ui.pageNet->updateServersList(); |
632
5e09ae25729f
Half implement possibility for different backends of servers list
unc0rr
parents:
625
diff
changeset
|
308 |
|
289 | 309 |
GoToPage(ID_PAGE_NET); |
184 | 310 |
} |
311 |
||
1950 | 312 |
void HWForm::GoToNetType() |
313 |
{ |
|
314 |
GoToPage(ID_PAGE_NETTYPE); |
|
315 |
} |
|
316 |
||
646 | 317 |
void HWForm::GoToNetServer() |
318 |
{ |
|
319 |
GoToPage(ID_PAGE_NETSERVER); |
|
320 |
} |
|
321 |
||
1885 | 322 |
void HWForm::GoToSchemes() |
323 |
{ |
|
324 |
GoToPage(ID_PAGE_SCHEME); |
|
325 |
} |
|
326 |
||
1905 | 327 |
void HWForm::GoToAdmin() |
328 |
{ |
|
329 |
GoToPage(ID_PAGE_ADMIN); |
|
330 |
} |
|
331 |
||
496 | 332 |
void HWForm::OnPageShown(quint8 id, quint8 lastid) |
311 | 333 |
{ |
1354
a8dcdeb88a43
Various small insignificant improvements everywhere
unc0rr
parents:
1347
diff
changeset
|
334 |
if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) { |
1343 | 335 |
QStringList tmNames = config->GetTeamsList(); |
322 | 336 |
TeamSelWidget* curTeamSelWidget; |
1343 | 337 |
|
496 | 338 |
if(id == ID_PAGE_MULTIPLAYER) { |
1343 | 339 |
curTeamSelWidget = ui.pageMultiplayer->teamsSelect; |
496 | 340 |
} else { |
1343 | 341 |
curTeamSelWidget = ui.pageNetGame->pNetTeamsWidget; |
496 | 342 |
} |
1343 | 343 |
|
311 | 344 |
QList<HWTeam> teamsList; |
1343 | 345 |
for(QStringList::iterator it = tmNames.begin(); it != tmNames.end(); it++) { |
311 | 346 |
HWTeam team(*it); |
347 |
team.LoadFromFile(); |
|
348 |
teamsList.push_back(team); |
|
349 |
} |
|
1343 | 350 |
|
351 |
if(lastid == ID_PAGE_SETUP) { // _TEAM |
|
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
352 |
if (editedTeam) { |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
353 |
curTeamSelWidget->addTeam(*editedTeam); |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
354 |
} |
2010 | 355 |
} else if(lastid != ID_PAGE_GAMESTATS |
356 |
&& lastid != ID_PAGE_INGAME |
|
357 |
&& lastid != ID_PAGE_SCHEME |
|
358 |
&& lastid != ID_PAGE_SELECTWEAPON) { |
|
1627 | 359 |
curTeamSelWidget->resetPlayingTeams(teamsList); |
496 | 360 |
} |
1625 | 361 |
} else |
362 |
if (id == ID_PAGE_GAMESTATS) |
|
363 |
{ |
|
364 |
ui.pageGameStats->renderStats(); |
|
311 | 365 |
} |
366 |
} |
|
367 |
||
289 | 368 |
void HWForm::GoToPage(quint8 id) |
369 |
{ |
|
1347 | 370 |
quint8 lastid = ui.Pages->currentIndex(); |
289 | 371 |
PagesStack.push(ui.Pages->currentIndex()); |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
372 |
OnPageShown(id, lastid); |
289 | 373 |
ui.Pages->setCurrentIndex(id); |
374 |
} |
|
375 |
||
376 |
void HWForm::GoBack() |
|
377 |
{ |
|
378 |
quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop(); |
|
1347 | 379 |
quint8 curid = ui.Pages->currentIndex(); |
289 | 380 |
ui.Pages->setCurrentIndex(id); |
1347 | 381 |
OnPageShown(id, curid); |
1354
a8dcdeb88a43
Various small insignificant improvements everywhere
unc0rr
parents:
1347
diff
changeset
|
382 |
|
1845 | 383 |
if (id == ID_PAGE_CONNECTING) |
384 |
GoBack(); |
|
1672
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
385 |
if (id == ID_PAGE_NETSERVER) |
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
386 |
GoBack(); |
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
387 |
if ((!hwnet) && (id == ID_PAGE_ROOMSLIST)) |
1359 | 388 |
GoBack(); |
1672
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
389 |
|
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
390 |
if ((!hwnet) || (!hwnet->isInRoom())) |
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
391 |
if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME) |
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
392 |
GoBack(); |
6a451649558c
Properly handle room deletion in respect of pages switching
unc0rr
parents:
1671
diff
changeset
|
393 |
|
1998 | 394 |
if (curid == ID_PAGE_ROOMSLIST) NetDisconnect(); |
1902
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
395 |
|
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
396 |
if (curid == ID_PAGE_SCHEME) |
aeadb10c2d77
Add delete button and scheme selection combobox to scheme edit page
unc0rr
parents:
1899
diff
changeset
|
397 |
ammoSchemeModel->Save(); |
184 | 398 |
} |
399 |
||
530 | 400 |
void HWForm::btnExitPressed() |
401 |
{ |
|
402 |
eggTimer.start(); |
|
403 |
} |
|
404 |
||
405 |
void HWForm::btnExitClicked() |
|
406 |
{ |
|
407 |
if (eggTimer.elapsed() < 3000) |
|
408 |
close(); |
|
409 |
else |
|
410 |
{ |
|
411 |
QPushButton * btn = findChild<QPushButton *>("imageButt"); |
|
412 |
if (btn) |
|
413 |
{ |
|
414 |
btn->setIcon(QIcon(":/res/bonus.png")); |
|
415 |
} |
|
416 |
} |
|
417 |
} |
|
418 |
||
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
419 |
void HWForm::IntermediateSetup() |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
420 |
{ |
1509 | 421 |
quint8 id=ui.Pages->currentIndex(); |
422 |
TeamSelWidget* curTeamSelWidget; |
|
423 |
||
424 |
if(id == ID_PAGE_MULTIPLAYER) { |
|
425 |
curTeamSelWidget = ui.pageMultiplayer->teamsSelect; |
|
426 |
} else { |
|
427 |
curTeamSelWidget = ui.pageNetGame->pNetTeamsWidget; |
|
428 |
} |
|
429 |
||
430 |
QList<HWTeam> teams = curTeamSelWidget->getDontPlayingTeams(); |
|
431 |
QStringList tmnames; |
|
432 |
for(QList<HWTeam>::iterator it = teams.begin(); it != teams.end(); ++it) { |
|
433 |
tmnames += it->TeamName; |
|
434 |
} |
|
435 |
UpdateTeamsLists(&tmnames); // FIXME: still need more work if teamname is updated while configuring |
|
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
436 |
|
1509 | 437 |
GoToPage(ID_PAGE_SETUP); |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
438 |
} |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
439 |
|
184 | 440 |
void HWForm::NewTeam() |
441 |
{ |
|
245 | 442 |
editedTeam = new HWTeam("unnamed"); |
443 |
editedTeam->SetToPage(this); |
|
290 | 444 |
GoToPage(ID_PAGE_SETUP_TEAM); |
184 | 445 |
} |
446 |
||
447 |
void HWForm::EditTeam() |
|
448 |
{ |
|
245 | 449 |
editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText()); |
450 |
editedTeam->LoadFromFile(); |
|
451 |
editedTeam->SetToPage(this); |
|
290 | 452 |
GoToPage(ID_PAGE_SETUP_TEAM); |
184 | 453 |
} |
454 |
||
1840 | 455 |
void HWForm::RandomNames() |
456 |
{ |
|
457 |
editedTeam->GetFromPage(this); |
|
1907 | 458 |
namegen->TeamRandomNames(editedTeam,FALSE); |
1840 | 459 |
editedTeam->SetToPage(this); |
460 |
} |
|
461 |
||
462 |
void HWForm::RandomName(const int &i) |
|
463 |
{ |
|
464 |
editedTeam->GetFromPage(this); |
|
1907 | 465 |
namegen->TeamRandomName(editedTeam,i); |
1840 | 466 |
editedTeam->SetToPage(this); |
467 |
} |
|
468 |
||
184 | 469 |
void HWForm::TeamSave() |
470 |
{ |
|
245 | 471 |
editedTeam->GetFromPage(this); |
472 |
editedTeam->SaveToFile(); |
|
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
473 |
delete editedTeam; |
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
474 |
editedTeam=0; |
245 | 475 |
UpdateTeamsLists(); |
290 | 476 |
GoBack(); |
184 | 477 |
} |
478 |
||
479 |
void HWForm::TeamDiscard() |
|
480 |
{ |
|
245 | 481 |
delete editedTeam; |
496 | 482 |
editedTeam=0; |
290 | 483 |
GoBack(); |
184 | 484 |
} |
485 |
||
486 |
void HWForm::SimpleGame() |
|
487 |
{ |
|
1576
a02353129a41
Check for deprecated ammo schemes at startup and delete them
unc0rr
parents:
1569
diff
changeset
|
488 |
CreateGame(0, 0, *cDefaultAmmoStore); |
184 | 489 |
game->StartQuick(); |
490 |
} |
|
491 |
||
492 |
void HWForm::PlayDemo() |
|
493 |
{ |
|
494 |
QListWidgetItem * curritem = ui.pagePlayDemo->DemosList->currentItem(); |
|
495 |
if (!curritem) |
|
496 |
{ |
|
497 |
QMessageBox::critical(this, |
|
498 |
tr("Error"), |
|
581 | 499 |
tr("Please, select record from the list above"), |
184 | 500 |
tr("OK")); |
501 |
return ; |
|
502 |
} |
|
696 | 503 |
CreateGame(0, 0, 0); |
580 | 504 |
game->PlayDemo(curritem->data(Qt::UserRole).toString()); |
184 | 505 |
} |
506 |
||
666 | 507 |
void HWForm::NetConnectServer(const QString & host, quint16 port) |
416 | 508 |
{ |
1395 | 509 |
_NetConnect(host, port, ui.pageOptions->editNetNick->text()); |
510 |
} |
|
511 |
||
512 |
void HWForm::NetConnectOfficialServer() |
|
513 |
{ |
|
514 |
NetConnectServer("netserver.hedgewars.org", 46631); |
|
416 | 515 |
} |
516 |
||
314 | 517 |
void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick) |
184 | 518 |
{ |
637
8fa7ed5e13bd
Fix bad behavior when quickly click Connect button more than once
unc0rr
parents:
636
diff
changeset
|
519 |
if(hwnet) { |
8fa7ed5e13bd
Fix bad behavior when quickly click Connect button more than once
unc0rr
parents:
636
diff
changeset
|
520 |
hwnet->Disconnect(); |
8fa7ed5e13bd
Fix bad behavior when quickly click Connect button more than once
unc0rr
parents:
636
diff
changeset
|
521 |
delete hwnet; |
8fa7ed5e13bd
Fix bad behavior when quickly click Connect button more than once
unc0rr
parents:
636
diff
changeset
|
522 |
hwnet=0; |
8fa7ed5e13bd
Fix bad behavior when quickly click Connect button more than once
unc0rr
parents:
636
diff
changeset
|
523 |
} |
1311 | 524 |
|
1566
6b63c75fdc68
Start work on lobby: add/remove nick from the list on join/quit
unc0rr
parents:
1531
diff
changeset
|
525 |
ui.pageRoomsList->chatWidget->clear(); |
1311 | 526 |
|
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
338
diff
changeset
|
527 |
hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget); |
637
8fa7ed5e13bd
Fix bad behavior when quickly click Connect button more than once
unc0rr
parents:
636
diff
changeset
|
528 |
|
1845 | 529 |
GoToPage(ID_PAGE_CONNECTING); |
1800 | 530 |
|
1512
43742041c211
- Don't send 'Bad param' msg, as the only reason of it is just some lag
unc0rr
parents:
1509
diff
changeset
|
531 |
connect(hwnet, SIGNAL(showMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection); |
43742041c211
- Don't send 'Bad param' msg, as the only reason of it is just some lag
unc0rr
parents:
1509
diff
changeset
|
532 |
|
660 | 533 |
connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame())); |
1311 | 534 |
connect(hwnet, SIGNAL(Connected()), this, SLOT(NetConnected())); |
184 | 535 |
connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter())); |
1600 | 536 |
connect(hwnet, SIGNAL(LeftRoom()), this, SLOT(NetLeftRoom())); |
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
338
diff
changeset
|
537 |
connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&))); |
1592
5ee77ee470a6
Start converting network protocol to no-disconnecting religion
unc0rr
parents:
1587
diff
changeset
|
538 |
connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom())); |
329
4c3aad46baa5
Send game parameters by net... Currently it leads to infinite loop, flooding traffic with messages about changes
unc0rr
parents:
328
diff
changeset
|
539 |
|
1874 | 540 |
// rooms list page stuff |
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
541 |
connect(hwnet, SIGNAL(roomsList(const QStringList&)), |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
542 |
ui.pageRoomsList, SLOT(setRoomsList(const QStringList&))); |
1856
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1846
diff
changeset
|
543 |
connect(hwnet, SIGNAL(adminAccess(bool)), |
e71dbf958c87
Enable admin button when have privilege. Button does nothing yet.
unc0rr
parents:
1846
diff
changeset
|
544 |
ui.pageRoomsList, SLOT(setAdmin(bool))); |
1860 | 545 |
connect(hwnet, SIGNAL(adminAccess(bool)), |
546 |
ui.pageRoomsList->chatWidget, SLOT(adminAccess(bool))); |
|
1584
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1577
diff
changeset
|
547 |
|
1377 | 548 |
connect(hwnet, SIGNAL(serverMessage(const QString&)), |
1587 | 549 |
ui.pageRoomsList->chatWidget, SLOT(onServerMessage(const QString&))); |
1584
90f6a5abad17
Save much space for chat widget on lobby page by removing server message widget (now this messages goes to chat)
unc0rr
parents:
1577
diff
changeset
|
550 |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
551 |
connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)), |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
552 |
hwnet, SLOT(CreateRoom(const QString&))); |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
553 |
connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)), |
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
554 |
hwnet, SLOT(JoinRoom(const QString&))); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
555 |
connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)), |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
556 |
this, SLOT(NetGameMaster())); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
557 |
connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)), |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
558 |
this, SLOT(NetGameSlave())); |
1315 | 559 |
connect(ui.pageRoomsList, SIGNAL(askForRoomList()), |
560 |
hwnet, SLOT(askRoomsList())); |
|
1313
f4c54e9e1b8c
- Introduce a bit of state miachine in client code (should be more robust and verbosive now)
unc0rr
parents:
1312
diff
changeset
|
561 |
|
1874 | 562 |
// net page stuff |
1357 | 563 |
connect(hwnet, SIGNAL(chatStringFromNet(const QString&)), |
1360 | 564 |
ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&))); |
1405 | 565 |
connect(hwnet, SIGNAL(setReadyStatus(const QString &, bool)), |
566 |
ui.pageNetGame->pChatWidget, SLOT(setReadyStatus(const QString &, bool))); |
|
1364 | 567 |
connect(hwnet, SIGNAL(chatStringFromMe(const QString&)), |
1360 | 568 |
ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&))); |
1860 | 569 |
connect(hwnet, SIGNAL(roomMaster(bool)), |
570 |
ui.pageNetGame->pChatWidget, SLOT(adminAccess(bool))); |
|
461 | 571 |
connect(ui.pageNetGame->pChatWidget, SIGNAL(chatLine(const QString&)), |
572 |
hwnet, SLOT(chatLineToNet(const QString&))); |
|
1577 | 573 |
connect(ui.pageNetGame->BtnGo, SIGNAL(clicked()), hwnet, SLOT(ToggleReady())); |
1648 | 574 |
connect(hwnet, SIGNAL(setMyReadyStatus(bool)), |
575 |
ui.pageNetGame, SLOT(setReadyStatus(bool))); |
|
1577 | 576 |
|
1874 | 577 |
// chat widget actions |
1391 | 578 |
connect(ui.pageNetGame->pChatWidget, SIGNAL(kick(const QString&)), |
579 |
hwnet, SLOT(kickPlayer(const QString&))); |
|
1860 | 580 |
connect(ui.pageNetGame->pChatWidget, SIGNAL(ban(const QString&)), |
581 |
hwnet, SLOT(banPlayer(const QString&))); |
|
1577 | 582 |
connect(ui.pageNetGame->pChatWidget, SIGNAL(info(const QString&)), |
583 |
hwnet, SLOT(infoPlayer(const QString&))); |
|
1860 | 584 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(kick(const QString&)), |
585 |
hwnet, SLOT(kickPlayer(const QString&))); |
|
586 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(ban(const QString&)), |
|
587 |
hwnet, SLOT(banPlayer(const QString&))); |
|
1577 | 588 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(info(const QString&)), |
589 |
hwnet, SLOT(infoPlayer(const QString&))); |
|
1566
6b63c75fdc68
Start work on lobby: add/remove nick from the list on join/quit
unc0rr
parents:
1531
diff
changeset
|
590 |
|
1874 | 591 |
// chatting |
1568 | 592 |
connect(ui.pageRoomsList->chatWidget, SIGNAL(chatLine(const QString&)), |
593 |
hwnet, SLOT(chatLineToLobby(const QString&))); |
|
594 |
connect(hwnet, SIGNAL(chatStringLobby(const QString&)), |
|
595 |
ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&))); |
|
596 |
connect(hwnet, SIGNAL(chatStringFromMeLobby(const QString&)), |
|
597 |
ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&))); |
|
598 |
||
1874 | 599 |
// nick list stuff |
471 | 600 |
connect(hwnet, SIGNAL(nickAdded(const QString&)), |
465 | 601 |
ui.pageNetGame->pChatWidget, SLOT(nickAdded(const QString&))); |
471 | 602 |
connect(hwnet, SIGNAL(nickRemoved(const QString&)), |
465 | 603 |
ui.pageNetGame->pChatWidget, SLOT(nickRemoved(const QString&))); |
1566
6b63c75fdc68
Start work on lobby: add/remove nick from the list on join/quit
unc0rr
parents:
1531
diff
changeset
|
604 |
connect(hwnet, SIGNAL(nickAddedLobby(const QString&)), |
6b63c75fdc68
Start work on lobby: add/remove nick from the list on join/quit
unc0rr
parents:
1531
diff
changeset
|
605 |
ui.pageRoomsList->chatWidget, SLOT(nickAdded(const QString&))); |
6b63c75fdc68
Start work on lobby: add/remove nick from the list on join/quit
unc0rr
parents:
1531
diff
changeset
|
606 |
connect(hwnet, SIGNAL(nickRemovedLobby(const QString&)), |
6b63c75fdc68
Start work on lobby: add/remove nick from the list on join/quit
unc0rr
parents:
1531
diff
changeset
|
607 |
ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&))); |
461 | 608 |
|
1874 | 609 |
// teams selecting stuff |
352 | 610 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(hhogsNumChanged(const HWTeam&)), |
611 |
hwnet, SLOT(onHedgehogsNumChanged(const HWTeam&))); |
|
372 | 612 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamColorChanged(const HWTeam&)), |
613 |
hwnet, SLOT(onTeamColorChanged(const HWTeam&))); |
|
327 | 614 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamWillPlay(HWTeam)), hwnet, SLOT(AddTeam(HWTeam))); |
373 | 615 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(acceptRequested(HWTeam)), hwnet, SLOT(AddTeam(HWTeam))); |
347 | 616 |
connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamNotPlaying(const HWTeam&)), hwnet, SLOT(RemoveTeam(const HWTeam&))); |
425 | 617 |
connect(hwnet, SIGNAL(hhnumChanged(const HWTeam&)), |
352 | 618 |
ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&))); |
425 | 619 |
connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)), |
372 | 620 |
ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&))); |
1874 | 621 |
|
1924 | 622 |
// admin stuff |
623 |
connect(hwnet, SIGNAL(serverMessage(const QString&)), ui.pageAdmin, SLOT(serverMessage(const QString &))); |
|
1925 | 624 |
connect(ui.pageAdmin, SIGNAL(setServerMessage(const QString&)), hwnet, SLOT(newServerMessage(const QString &))); |
1924 | 625 |
|
1898
f0ab0c77946d
Send scheme data over net (but recieving part isn't implemented yet)
unc0rr
parents:
1897
diff
changeset
|
626 |
// disconnect |
1873
815a3ff1fe4b
Start refactoring some things. Frontend becomes temporarily unusable for network game
unc0rr
parents:
1872
diff
changeset
|
627 |
connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()), Qt::QueuedConnection); |
1874 | 628 |
|
629 |
hwnet->Connect(hostName, port, nick); |
|
184 | 630 |
} |
631 |
||
314 | 632 |
void HWForm::NetConnect() |
633 |
{ |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
634 |
HWHostPortDialog * hpd = new HWHostPortDialog(this); |
654 | 635 |
hpd->leHost->setText(*netHost); |
636 |
hpd->sbPort->setValue(netPort); |
|
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
647
diff
changeset
|
637 |
|
654 | 638 |
if (hpd->exec() == QDialog::Accepted) |
639 |
{ |
|
640 |
config->SaveOptions(); |
|
641 |
delete netHost; |
|
642 |
netHost = new QString(hpd->leHost->text()); |
|
643 |
netPort = hpd->sbPort->value(); |
|
1418 | 644 |
NetConnectServer(*netHost, netPort); |
654 | 645 |
} |
314 | 646 |
} |
647 |
||
648 |
void HWForm::NetStartServer() |
|
649 |
{ |
|
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:
668
diff
changeset
|
650 |
config->SaveOptions(); |
636 | 651 |
|
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:
668
diff
changeset
|
652 |
pnetserver = new HWNetServer; |
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:
668
diff
changeset
|
653 |
if(!pnetserver->StartServer(ui.pageNetServer->sbPort->value())) |
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:
668
diff
changeset
|
654 |
{ |
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:
668
diff
changeset
|
655 |
QMessageBox::critical(0, tr("Error"), |
1509 | 656 |
tr("Unable to start the server")); |
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:
668
diff
changeset
|
657 |
delete pnetserver; |
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:
668
diff
changeset
|
658 |
pnetserver = 0; |
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:
668
diff
changeset
|
659 |
return; |
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:
668
diff
changeset
|
660 |
} |
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:
668
diff
changeset
|
661 |
|
1418 | 662 |
QTimer::singleShot(250, this, SLOT(AsyncNetServerStart())); |
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:
668
diff
changeset
|
663 |
|
1418 | 664 |
pRegisterServer = new HWNetUdpServer(0, |
665 |
ui.pageNetServer->leServerDescr->text(), |
|
666 |
ui.pageNetServer->sbPort->value()); |
|
667 |
} |
|
668 |
||
669 |
void HWForm::AsyncNetServerStart() |
|
670 |
{ |
|
671 |
NetConnectServer("localhost", pnetserver->getRunningPort()); |
|
314 | 672 |
} |
673 |
||
184 | 674 |
void HWForm::NetDisconnect() |
675 |
{ |
|
1800 | 676 |
qDebug("NetDisconnect"); |
1509 | 677 |
if(hwnet) { |
678 |
hwnet->Disconnect(); |
|
679 |
delete hwnet; |
|
680 |
hwnet = 0; |
|
681 |
} |
|
682 |
if(pnetserver) { |
|
683 |
if (pRegisterServer) |
|
684 |
{ |
|
685 |
pRegisterServer->unregister(); |
|
686 |
pRegisterServer = 0; |
|
687 |
} |
|
659 | 688 |
|
1509 | 689 |
pnetserver->StopServer(); |
690 |
delete pnetserver; |
|
691 |
pnetserver = 0; |
|
692 |
} |
|
184 | 693 |
} |
694 |
||
383 | 695 |
void HWForm::ForcedDisconnect() |
696 |
{ |
|
1418 | 697 |
if(pnetserver) return; // we have server - let it care of all things |
698 |
if (hwnet) { |
|
699 |
hwnet->deleteLater(); |
|
700 |
hwnet = 0; |
|
701 |
QMessageBox::warning(this, QMessageBox::tr("Network"), |
|
702 |
QMessageBox::tr("Connection to server is lost")); |
|
1800 | 703 |
|
1418 | 704 |
} |
1800 | 705 |
if (ui.Pages->currentIndex() != ID_PAGE_NET) GoBack(); |
383 | 706 |
} |
707 |
||
1311 | 708 |
void HWForm::NetConnected() |
709 |
{ |
|
710 |
GoToPage(ID_PAGE_ROOMSLIST); |
|
711 |
} |
|
712 |
||
184 | 713 |
void HWForm::NetGameEnter() |
714 |
{ |
|
1593 | 715 |
ui.pageNetGame->pChatWidget->clear(); |
1354
a8dcdeb88a43
Various small insignificant improvements everywhere
unc0rr
parents:
1347
diff
changeset
|
716 |
GoToPage(ID_PAGE_NETGAME); |
184 | 717 |
} |
718 |
||
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
338
diff
changeset
|
719 |
void HWForm::AddNetTeam(const HWTeam& team) |
184 | 720 |
{ |
1418 | 721 |
ui.pageNetGame->pNetTeamsWidget->addTeam(team); |
184 | 722 |
} |
723 |
||
724 |
void HWForm::StartMPGame() |
|
725 |
{ |
|
1531 | 726 |
QString ammo; |
727 |
ammo = ui.pageMultiplayer->gameCFG->WeaponsName->itemData( |
|
728 |
ui.pageMultiplayer->gameCFG->WeaponsName->currentIndex() |
|
729 |
).toString(); |
|
696 | 730 |
|
731 |
CreateGame(ui.pageMultiplayer->gameCFG, ui.pageMultiplayer->teamsSelect, ammo); |
|
306 | 732 |
|
184 | 733 |
game->StartLocal(); |
734 |
} |
|
306 | 735 |
|
736 |
void HWForm::GameStateChanged(GameState gameState) |
|
737 |
{ |
|
324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
323
diff
changeset
|
738 |
switch(gameState) { |
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
323
diff
changeset
|
739 |
case gsStarted: { |
1268
34c3795ecb63
Fix music starting to play after the round even if it was turned off
unc0rr
parents:
1235
diff
changeset
|
740 |
Music(false); |
2012 | 741 |
if (wBackground) wBackground->stopAnimation(); |
1223
41d7283934c1
Hackish way to play music in frontend... to be fixed
unc0rr
parents:
1165
diff
changeset
|
742 |
GoToPage(ID_PAGE_INGAME); |
1622 | 743 |
ui.pageGameStats->clear(); |
661
0523b15353a2
Unregister server in servers list when the game is started
unc0rr
parents:
660
diff
changeset
|
744 |
if (pRegisterServer) |
0523b15353a2
Unregister server in servers list when the game is started
unc0rr
parents:
660
diff
changeset
|
745 |
{ |
0523b15353a2
Unregister server in servers list when the game is started
unc0rr
parents:
660
diff
changeset
|
746 |
pRegisterServer->unregister(); |
0523b15353a2
Unregister server in servers list when the game is started
unc0rr
parents:
660
diff
changeset
|
747 |
pRegisterServer = 0; |
0523b15353a2
Unregister server in servers list when the game is started
unc0rr
parents:
660
diff
changeset
|
748 |
} |
324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
323
diff
changeset
|
749 |
break; |
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
323
diff
changeset
|
750 |
} |
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
323
diff
changeset
|
751 |
case gsFinished: { |
686 | 752 |
GoBack(); |
1268
34c3795ecb63
Fix music starting to play after the round even if it was turned off
unc0rr
parents:
1235
diff
changeset
|
753 |
Music(ui.pageOptions->CBEnableMusic->isChecked()); |
2012 | 754 |
if (wBackground) wBackground->startAnimation(); |
324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
323
diff
changeset
|
755 |
GoToPage(ID_PAGE_GAMESTATS); |
1344
4004e597f1bf
Clients send roundfinished message to server when the round is over
unc0rr
parents:
1343
diff
changeset
|
756 |
if (hwnet) hwnet->gameFinished(); |
324
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
323
diff
changeset
|
757 |
break; |
f4c109c82a0c
Don't show game stats in case of interrupted by command '/quit' game
unc0rr
parents:
323
diff
changeset
|
758 |
} |
686 | 759 |
default: { |
760 |
quint8 id = ui.Pages->currentIndex(); |
|
1225
f882a92ef872
Play music in menu also, with fading effects when run game
unc0rr
parents:
1223
diff
changeset
|
761 |
if (id == ID_PAGE_INGAME) { |
f882a92ef872
Play music in menu also, with fading effects when run game
unc0rr
parents:
1223
diff
changeset
|
762 |
GoBack(); |
1268
34c3795ecb63
Fix music starting to play after the round even if it was turned off
unc0rr
parents:
1235
diff
changeset
|
763 |
Music(ui.pageOptions->CBEnableMusic->isChecked()); |
2012 | 764 |
if (wBackground) wBackground->startAnimation(); |
1344
4004e597f1bf
Clients send roundfinished message to server when the round is over
unc0rr
parents:
1343
diff
changeset
|
765 |
if (hwnet) hwnet->gameFinished(); |
1225
f882a92ef872
Play music in menu also, with fading effects when run game
unc0rr
parents:
1223
diff
changeset
|
766 |
} |
686 | 767 |
}; |
307 | 768 |
} |
769 |
} |
|
770 |
||
696 | 771 |
void HWForm::CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo) |
306 | 772 |
{ |
696 | 773 |
game = new HWGame(config, gamecfg, ammo, pTeamSelWidget); |
306 | 774 |
connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState))); |
1622 | 775 |
connect(game, SIGNAL(GameStats(char, const QString &)), ui.pageGameStats, SLOT(GameStats(char, const QString &))); |
425 | 776 |
connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection); |
533 | 777 |
connect(game, SIGNAL(HaveRecord(bool, const QByteArray &)), this, SLOT(GetRecord(bool, const QByteArray &))); |
306 | 778 |
} |
425 | 779 |
|
780 |
void HWForm::ShowErrorMessage(const QString & msg) |
|
781 |
{ |
|
782 |
QMessageBox::warning(this, |
|
783 |
"Hedgewars", |
|
784 |
msg); |
|
785 |
} |
|
533 | 786 |
|
787 |
void HWForm::GetRecord(bool isDemo, const QByteArray & record) |
|
788 |
{ |
|
789 |
QString filename; |
|
790 |
QByteArray demo = record; |
|
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1427
diff
changeset
|
791 |
QString recordFileName = |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1427
diff
changeset
|
792 |
config->appendDateTimeToRecordName() ? |
1664 | 793 |
QDateTime::currentDateTime().toString("yyyy-MM-dd_hh-mm") : |
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1427
diff
changeset
|
794 |
"LastRound"; |
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1427
diff
changeset
|
795 |
|
533 | 796 |
if (isDemo) |
797 |
{ |
|
798 |
demo.replace(QByteArray("\x02TL"), QByteArray("\x02TD")); |
|
799 |
demo.replace(QByteArray("\x02TN"), QByteArray("\x02TD")); |
|
989 | 800 |
demo.replace(QByteArray("\x02TS"), QByteArray("\x02TD")); |
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1427
diff
changeset
|
801 |
filename = cfgdir->absolutePath() + "/Demos/" + recordFileName + ".hwd_" + *cProtoVer; |
533 | 802 |
} else |
803 |
{ |
|
804 |
demo.replace(QByteArray("\x02TL"), QByteArray("\x02TS")); |
|
805 |
demo.replace(QByteArray("\x02TN"), QByteArray("\x02TS")); |
|
1487
b4cc59a6d50a
Add an option to name records with current date and time
unc0rr
parents:
1427
diff
changeset
|
806 |
filename = cfgdir->absolutePath() + "/Saves/" + recordFileName + ".hws_" + *cProtoVer; |
533 | 807 |
} |
808 |
||
809 |
||
810 |
QFile demofile(filename); |
|
811 |
if (!demofile.open(QIODevice::WriteOnly)) |
|
812 |
{ |
|
813 |
ShowErrorMessage(tr("Cannot save record to file %1").arg(filename)); |
|
814 |
return ; |
|
815 |
} |
|
816 |
demofile.write(demo.constData(), demo.size()); |
|
817 |
demofile.close(); |
|
818 |
} |
|
587 | 819 |
|
820 |
void HWForm::StartTraining() |
|
821 |
{ |
|
696 | 822 |
CreateGame(0, 0, 0); |
587 | 823 |
|
824 |
game->StartTraining(); |
|
825 |
} |
|
660 | 826 |
|
827 |
void HWForm::CreateNetGame() |
|
828 |
{ |
|
697 | 829 |
QString ammo; |
1517 | 830 |
ammo = ui.pageNetGame->pGameCFG->WeaponsName->itemData( |
831 |
ui.pageNetGame->pGameCFG->WeaponsName->currentIndex() |
|
832 |
).toString(); |
|
833 |
||
696 | 834 |
CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo); |
660 | 835 |
|
836 |
connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &))); |
|
1356 | 837 |
connect(game, SIGNAL(SendChat(const QString &)), hwnet, SLOT(chatLineToNet(const QString &))); |
660 | 838 |
connect(hwnet, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &))); |
1356 | 839 |
connect(hwnet, SIGNAL(chatStringFromNet(const QString &)), game, SLOT(FromNetChat(const QString &))); |
660 | 840 |
|
841 |
game->StartNet(); |
|
842 |
} |
|
674 | 843 |
|
844 |
void HWForm::closeEvent(QCloseEvent *event) |
|
845 |
{ |
|
846 |
config->SaveOptions(); |
|
847 |
event->accept(); |
|
848 |
} |
|
1235 | 849 |
|
850 |
void HWForm::Music(bool checked) |
|
851 |
{ |
|
852 |
if (checked) |
|
853 |
sdli.StartMusic(); |
|
854 |
else |
|
855 |
sdli.StopMusic(); |
|
856 |
} |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
857 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
858 |
void HWForm::NetGameMaster() |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
859 |
{ |
1649 | 860 |
ui.pageNetGame->setMasterMode(true); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
861 |
ui.pageNetGame->restrictJoins->setChecked(false); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
862 |
ui.pageNetGame->restrictTeamAdds->setChecked(false); |
1898
f0ab0c77946d
Send scheme data over net (but recieving part isn't implemented yet)
unc0rr
parents:
1897
diff
changeset
|
863 |
ui.pageNetGame->pGameCFG->GameSchemes->setModel(ammoSchemeModel); |
1410
eece43296890
Send appropriate messages to server on control menu actions
unc0rr
parents:
1409
diff
changeset
|
864 |
|
eece43296890
Send appropriate messages to server on control menu actions
unc0rr
parents:
1409
diff
changeset
|
865 |
if (hwnet) |
eece43296890
Send appropriate messages to server on control menu actions
unc0rr
parents:
1409
diff
changeset
|
866 |
{ |
1828
ba91a89f449a
Fix bug with not working toggles 'rectrict joins' and 'restrict team adding'
unc0rr
parents:
1802
diff
changeset
|
867 |
// disconnect connections first to ensure their inexistance and not to connect twice |
1951 | 868 |
ui.pageNetGame->BtnStart->disconnect(hwnet); |
1828
ba91a89f449a
Fix bug with not working toggles 'rectrict joins' and 'restrict team adding'
unc0rr
parents:
1802
diff
changeset
|
869 |
ui.pageNetGame->restrictJoins->disconnect(hwnet); |
ba91a89f449a
Fix bug with not working toggles 'rectrict joins' and 'restrict team adding'
unc0rr
parents:
1802
diff
changeset
|
870 |
ui.pageNetGame->restrictTeamAdds->disconnect(hwnet); |
1951 | 871 |
connect(ui.pageNetGame->BtnStart, SIGNAL(clicked()), hwnet, SLOT(startGame())); |
1413 | 872 |
connect(ui.pageNetGame->restrictJoins, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictJoins())); |
873 |
connect(ui.pageNetGame->restrictTeamAdds, SIGNAL(triggered()), hwnet, SLOT(toggleRestrictTeamAdds())); |
|
1410
eece43296890
Send appropriate messages to server on control menu actions
unc0rr
parents:
1409
diff
changeset
|
874 |
} |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
875 |
} |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
876 |
|
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
877 |
void HWForm::NetGameSlave() |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
878 |
{ |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
879 |
if (hwnet) |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
880 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
881 |
NetAmmoSchemeModel * netAmmo = new NetAmmoSchemeModel(hwnet); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
882 |
connect(hwnet, SIGNAL(netSchemeConfig(QStringList &)), netAmmo, SLOT(setNetSchemeConfig(QStringList &))); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
883 |
ui.pageNetGame->pGameCFG->GameSchemes->setModel(netAmmo); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
884 |
|
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
885 |
ui.pageNetGame->pGameCFG->GameSchemes->view()->disconnect(hwnet); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
886 |
connect(hwnet, SIGNAL(netSchemeConfig(QStringList &)), |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
887 |
this, SLOT(selectFirstNetScheme())); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
888 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
889 |
|
1649 | 890 |
ui.pageNetGame->setMasterMode(false); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1405
diff
changeset
|
891 |
} |
1600 | 892 |
|
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
893 |
void HWForm::selectFirstNetScheme() |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
894 |
{ |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
895 |
ui.pageNetGame->pGameCFG->GameSchemes->setCurrentIndex(0); |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
896 |
} |
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1898
diff
changeset
|
897 |
|
1600 | 898 |
void HWForm::NetLeftRoom() |
899 |
{ |
|
900 |
if (ui.Pages->currentIndex() == ID_PAGE_NETGAME) |
|
901 |
GoBack(); |
|
902 |
else |
|
903 |
qWarning("Left room while not in room"); |
|
904 |
} |
|
2012 | 905 |
|
906 |
void HWForm::resizeEvent(QResizeEvent * event) |
|
907 |
{ |
|
908 |
int w = event->size().width(); |
|
909 |
int h = event->size().height(); |
|
910 |
wBackground->setFixedSize(w, h); |
|
911 |
wBackground->move(0, 0); |
|
912 |
} |