equal
deleted
inserted
replaced
255 GoToPage(ID_PAGE_NETSERVER); |
255 GoToPage(ID_PAGE_NETSERVER); |
256 } |
256 } |
257 |
257 |
258 void HWForm::OnPageShown(quint8 id, quint8 lastid) |
258 void HWForm::OnPageShown(quint8 id, quint8 lastid) |
259 { |
259 { |
260 if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETCFG) { |
260 if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) { |
261 QStringList tmNames = config->GetTeamsList(); |
261 QStringList tmNames = config->GetTeamsList(); |
262 TeamSelWidget* curTeamSelWidget; |
262 TeamSelWidget* curTeamSelWidget; |
263 |
263 |
264 if(id == ID_PAGE_MULTIPLAYER) { |
264 if(id == ID_PAGE_MULTIPLAYER) { |
265 curTeamSelWidget = ui.pageMultiplayer->teamsSelect; |
265 curTeamSelWidget = ui.pageMultiplayer->teamsSelect; |
280 } |
280 } |
281 } else { |
281 } else { |
282 curTeamSelWidget->resetPlayingTeams(teamsList); |
282 curTeamSelWidget->resetPlayingTeams(teamsList); |
283 } |
283 } |
284 } |
284 } |
285 |
|
286 if (id == ID_PAGE_ROOMSLIST && lastid == ID_PAGE_NETCFG) |
|
287 GoBack(); |
|
288 } |
285 } |
289 |
286 |
290 void HWForm::GoToPage(quint8 id) |
287 void HWForm::GoToPage(quint8 id) |
291 { |
288 { |
292 quint8 lastid = ui.Pages->currentIndex(); |
289 quint8 lastid = ui.Pages->currentIndex(); |
295 ui.Pages->setCurrentIndex(id); |
292 ui.Pages->setCurrentIndex(id); |
296 } |
293 } |
297 |
294 |
298 void HWForm::GoBack() |
295 void HWForm::GoBack() |
299 { |
296 { |
300 if (!PagesStack.isEmpty() && PagesStack.top() == ID_PAGE_NET) { |
|
301 if(hwnet || pnetserver) NetDisconnect(); |
|
302 } |
|
303 quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop(); |
297 quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop(); |
304 quint8 curid = ui.Pages->currentIndex(); |
298 quint8 curid = ui.Pages->currentIndex(); |
305 ui.Pages->setCurrentIndex(id); |
299 ui.Pages->setCurrentIndex(id); |
306 OnPageShown(id, curid); |
300 OnPageShown(id, curid); |
|
301 |
|
302 if (id == ID_PAGE_ROOMSLIST) { |
|
303 if(hwnet || pnetserver) NetDisconnect(); |
|
304 GoBack(); |
|
305 } |
307 } |
306 } |
308 |
307 |
309 void HWForm::btnExitPressed() |
308 void HWForm::btnExitPressed() |
310 { |
309 { |
311 eggTimer.start(); |
310 eggTimer.start(); |
507 void HWForm::NetDisconnect() |
506 void HWForm::NetDisconnect() |
508 { |
507 { |
509 if(hwnet) { |
508 if(hwnet) { |
510 hwnet->Disconnect(); |
509 hwnet->Disconnect(); |
511 delete hwnet; |
510 delete hwnet; |
512 hwnet=0; |
511 hwnet = 0; |
513 } |
512 } |
514 if(pnetserver) { |
513 if(pnetserver) { |
515 if (pRegisterServer) |
514 if (pRegisterServer) |
516 { |
515 { |
517 pRegisterServer->unregister(); |
516 pRegisterServer->unregister(); |
541 GoToPage(ID_PAGE_ROOMSLIST); |
540 GoToPage(ID_PAGE_ROOMSLIST); |
542 } |
541 } |
543 |
542 |
544 void HWForm::NetGameEnter() |
543 void HWForm::NetGameEnter() |
545 { |
544 { |
546 GoToPage(ID_PAGE_NETCFG); |
545 GoToPage(ID_PAGE_NETGAME); |
547 } |
546 } |
548 |
547 |
549 void HWForm::NetStartGame() |
548 void HWForm::NetStartGame() |
550 { |
549 { |
551 ui.pageNetGame->BtnGo->setText(QPushButton::tr("Waiting")); |
550 ui.pageNetGame->BtnGo->setText(QPushButton::tr("Waiting")); |