52 config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); |
52 config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); |
53 |
53 |
54 UpdateTeamsLists(); |
54 UpdateTeamsLists(); |
55 UpdateWeapons(); |
55 UpdateWeapons(); |
56 |
56 |
|
57 StartMusic(); |
|
58 |
57 connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool))); |
59 connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool))); |
58 onFrontendFullscreen(config->isFrontendFullscreen()); |
60 onFrontendFullscreen(config->isFrontendFullscreen()); |
59 |
61 |
60 connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); |
62 connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); |
61 connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); |
63 connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); |
542 |
544 |
543 void HWForm::GameStateChanged(GameState gameState) |
545 void HWForm::GameStateChanged(GameState gameState) |
544 { |
546 { |
545 switch(gameState) { |
547 switch(gameState) { |
546 case gsStarted: { |
548 case gsStarted: { |
|
549 StopMusic(); |
|
550 GoToPage(ID_PAGE_INGAME); |
547 ui.pageGameStats->labelGameStats->setText(""); |
551 ui.pageGameStats->labelGameStats->setText(""); |
548 if (pRegisterServer) |
552 if (pRegisterServer) |
549 { |
553 { |
550 pRegisterServer->unregister(); |
554 pRegisterServer->unregister(); |
551 pRegisterServer = 0; |
555 pRegisterServer = 0; |
552 } |
556 } |
553 break; |
557 break; |
554 } |
558 } |
555 case gsFinished: { |
559 case gsFinished: { |
556 GoBack(); |
560 GoBack(); |
|
561 StartMusic(); |
557 GoToPage(ID_PAGE_GAMESTATS); |
562 GoToPage(ID_PAGE_GAMESTATS); |
558 break; |
563 break; |
559 } |
564 } |
560 default: { |
565 default: { |
561 quint8 id = ui.Pages->currentIndex(); |
566 quint8 id = ui.Pages->currentIndex(); |
610 game = new HWGame(config, gamecfg, ammo, pTeamSelWidget); |
615 game = new HWGame(config, gamecfg, ammo, pTeamSelWidget); |
611 connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState))); |
616 connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState))); |
612 connect(game, SIGNAL(GameStats(char, const QString &)), this, SLOT(GameStats(char, const QString &))); |
617 connect(game, SIGNAL(GameStats(char, const QString &)), this, SLOT(GameStats(char, const QString &))); |
613 connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection); |
618 connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection); |
614 connect(game, SIGNAL(HaveRecord(bool, const QByteArray &)), this, SLOT(GetRecord(bool, const QByteArray &))); |
619 connect(game, SIGNAL(HaveRecord(bool, const QByteArray &)), this, SLOT(GetRecord(bool, const QByteArray &))); |
615 |
|
616 GoToPage(ID_PAGE_INGAME); |
|
617 } |
620 } |
618 |
621 |
619 void HWForm::ShowErrorMessage(const QString & msg) |
622 void HWForm::ShowErrorMessage(const QString & msg) |
620 { |
623 { |
621 QMessageBox::warning(this, |
624 QMessageBox::warning(this, |