QTfrontend/hwform.cpp
changeset 1223 41d7283934c1
parent 1165 40eeae82e70b
child 1225 f882a92ef872
equal deleted inserted replaced
1222:bc94a25d867a 1223:41d7283934c1
    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,
   677 void HWForm::closeEvent(QCloseEvent *event)
   680 void HWForm::closeEvent(QCloseEvent *event)
   678 {
   681 {
   679 	config->SaveOptions();
   682 	config->SaveOptions();
   680 	event->accept();
   683 	event->accept();
   681 }
   684 }
       
   685 
       
   686 void HWForm::StartMusic()
       
   687 {
       
   688 
       
   689 }
       
   690 
       
   691 void HWForm::StopMusic()
       
   692 {
       
   693 
       
   694 }