equal
deleted
inserted
replaced
28 #include <QSpinBox> |
28 #include <QSpinBox> |
29 #include <QCloseEvent> |
29 #include <QCloseEvent> |
30 #include <QCheckBox> |
30 #include <QCheckBox> |
31 #include <QTextBrowser> |
31 #include <QTextBrowser> |
32 #include <QAction> |
32 #include <QAction> |
|
33 #include <QTimer> |
33 |
34 |
34 #include "hwform.h" |
35 #include "hwform.h" |
35 #include "game.h" |
36 #include "game.h" |
36 #include "team.h" |
37 #include "team.h" |
37 #include "teamselect.h" |
38 #include "teamselect.h" |
500 { |
501 { |
501 config->SaveOptions(); |
502 config->SaveOptions(); |
502 delete netHost; |
503 delete netHost; |
503 netHost = new QString(hpd->leHost->text()); |
504 netHost = new QString(hpd->leHost->text()); |
504 netPort = hpd->sbPort->value(); |
505 netPort = hpd->sbPort->value(); |
505 _NetConnect(*netHost, netPort, ui.pageOptions->editNetNick->text()); |
506 NetConnectServer(*netHost, netPort); |
506 } |
507 } |
507 } |
508 } |
508 |
509 |
509 void HWForm::NetStartServer() |
510 void HWForm::NetStartServer() |
510 { |
511 { |
518 delete pnetserver; |
519 delete pnetserver; |
519 pnetserver = 0; |
520 pnetserver = 0; |
520 return; |
521 return; |
521 } |
522 } |
522 |
523 |
523 _NetConnect("localhost", pnetserver->getRunningPort(), ui.pageOptions->editNetNick->text()); |
524 QTimer::singleShot(250, this, SLOT(AsyncNetServerStart())); |
524 |
525 |
525 pRegisterServer = new HWNetUdpServer(0, ui.pageNetServer->leServerDescr->text(), ui.pageNetServer->sbPort->value()); |
526 pRegisterServer = new HWNetUdpServer(0, |
|
527 ui.pageNetServer->leServerDescr->text(), |
|
528 ui.pageNetServer->sbPort->value()); |
|
529 } |
|
530 |
|
531 void HWForm::AsyncNetServerStart() |
|
532 { |
|
533 NetConnectServer("localhost", pnetserver->getRunningPort()); |
526 } |
534 } |
527 |
535 |
528 void HWForm::NetDisconnect() |
536 void HWForm::NetDisconnect() |
529 { |
537 { |
530 if(hwnet) { |
538 if(hwnet) { |
545 } |
553 } |
546 } |
554 } |
547 |
555 |
548 void HWForm::ForcedDisconnect() |
556 void HWForm::ForcedDisconnect() |
549 { |
557 { |
550 if(pnetserver) return; // we have server - let it care of all things |
558 if(pnetserver) return; // we have server - let it care of all things |
551 if (hwnet) { |
559 if (hwnet) { |
552 hwnet->deleteLater(); |
560 hwnet->deleteLater(); |
553 hwnet=0; |
561 hwnet = 0; |
554 QMessageBox::warning(this, QMessageBox::tr("Network"), |
562 QMessageBox::warning(this, QMessageBox::tr("Network"), |
555 QMessageBox::tr("Connection to server is lost")); |
563 QMessageBox::tr("Connection to server is lost")); |
556 } |
564 } |
557 GoBack(); |
565 GoBack(); |
558 } |
566 } |
559 |
567 |
560 void HWForm::NetConnected() |
568 void HWForm::NetConnected() |
561 { |
569 { |
562 GoToPage(ID_PAGE_ROOMSLIST); |
570 GoToPage(ID_PAGE_ROOMSLIST); |
567 GoToPage(ID_PAGE_NETGAME); |
575 GoToPage(ID_PAGE_NETGAME); |
568 } |
576 } |
569 |
577 |
570 void HWForm::AddNetTeam(const HWTeam& team) |
578 void HWForm::AddNetTeam(const HWTeam& team) |
571 { |
579 { |
572 ui.pageNetGame->pNetTeamsWidget->addTeam(team); |
580 ui.pageNetGame->pNetTeamsWidget->addTeam(team); |
573 } |
581 } |
574 |
582 |
575 void HWForm::StartMPGame() |
583 void HWForm::StartMPGame() |
576 { |
584 { |
577 QString ammo = ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageMultiplayer->gameCFG->WeaponsName->currentText()); |
585 QString ammo = ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageMultiplayer->gameCFG->WeaponsName->currentText()); |