398 if(hwnet) { |
398 if(hwnet) { |
399 hwnet->Disconnect(); |
399 hwnet->Disconnect(); |
400 delete hwnet; |
400 delete hwnet; |
401 hwnet=0; |
401 hwnet=0; |
402 } |
402 } |
|
403 |
403 ui.pageNetGame->pChatWidget->clear(); |
404 ui.pageNetGame->pChatWidget->clear(); |
|
405 |
404 hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget); |
406 hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget); |
405 |
407 |
406 connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame())); |
408 connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame())); |
|
409 connect(hwnet, SIGNAL(Connected()), this, SLOT(NetConnected())); |
407 connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter())); |
410 connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter())); |
408 connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&))); |
411 connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&))); |
409 |
412 |
410 connect(hwnet, SIGNAL(chatStringFromNet(const QStringList&)), |
413 connect(hwnet, SIGNAL(chatStringFromNet(const QStringList&)), |
411 ui.pageNetGame->pChatWidget, SLOT(onChatStringFromNet(const QStringList&))); |
414 ui.pageNetGame->pChatWidget, SLOT(onChatStringFromNet(const QStringList&))); |
512 QMessageBox::tr("Connection to server is lost")); |
515 QMessageBox::tr("Connection to server is lost")); |
513 } |
516 } |
514 GoBack(); |
517 GoBack(); |
515 } |
518 } |
516 |
519 |
|
520 void HWForm::NetConnected() |
|
521 { |
|
522 GoToPage(ID_PAGE_ROOMSLIST); |
|
523 } |
|
524 |
517 void HWForm::NetGameEnter() |
525 void HWForm::NetGameEnter() |
518 { |
526 { |
519 GoToPage(ID_PAGE_NETCFG); |
527 GoToPage(ID_PAGE_NETCFG); |
520 } |
528 } |
521 |
529 |
522 void HWForm::NetStartGame() |
530 void HWForm::NetStartGame() |
523 { |
531 { |
524 ui.pageNetGame->BtnGo->setText(QPushButton::tr("Waiting")); |
532 ui.pageNetGame->BtnGo->setText(QPushButton::tr("Waiting")); |
525 ui.pageNetGame->BtnGo->setEnabled(false); |
533 ui.pageNetGame->BtnGo->setEnabled(false); |
526 hwnet->StartGame(); |
534 hwnet->Ready(); |
527 } |
535 } |
528 |
536 |
529 void HWForm::AddNetTeam(const HWTeam& team) |
537 void HWForm::AddNetTeam(const HWTeam& team) |
530 { |
538 { |
531 ui.pageNetGame->pNetTeamsWidget->addTeam(team); |
539 ui.pageNetGame->pNetTeamsWidget->addTeam(team); |