QTfrontend/hwform.cpp
changeset 1225 f882a92ef872
parent 1223 41d7283934c1
child 1235 070629f3902d
equal deleted inserted replaced
1224:0b9fbee5ceda 1225:f882a92ef872
    47 
    47 
    48 HWForm::HWForm(QWidget *parent)
    48 HWForm::HWForm(QWidget *parent)
    49   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    49   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    50 {
    50 {
    51 	ui.setupUi(this);
    51 	ui.setupUi(this);
       
    52 
       
    53 	ui.pageOptions->CBResolution->addItems(sdli.getResolutions());
       
    54 
    52 	config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
    55 	config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
    53 
    56 
    54 	UpdateTeamsLists();
    57 	UpdateTeamsLists();
    55 	UpdateWeapons();
    58 	UpdateWeapons();
    56 
       
    57 	StartMusic();
       
    58 
    59 
    59 	connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool)));
    60 	connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool)));
    60 	onFrontendFullscreen(config->isFrontendFullscreen());
    61 	onFrontendFullscreen(config->isFrontendFullscreen());
    61 
    62 
    62 	connect(ui.pageMain->BtnSinglePlayer,	SIGNAL(clicked()),	this, SLOT(GoToSinglePlayer()));
    63 	connect(ui.pageMain->BtnSinglePlayer,	SIGNAL(clicked()),	this, SLOT(GoToSinglePlayer()));
   128 		this, SLOT(UpdateWeapons())); // executed second
   129 		this, SLOT(UpdateWeapons())); // executed second
   129 	connect(ui.pageSelectWeapon->pWeapons,	SIGNAL(weaponsDeleted()),
   130 	connect(ui.pageSelectWeapon->pWeapons,	SIGNAL(weaponsDeleted()),
   130 		this, SLOT(GoBack())); // executed third
   131 		this, SLOT(GoBack())); // executed third
   131 
   132 
   132 	GoToPage(ID_PAGE_MAIN);
   133 	GoToPage(ID_PAGE_MAIN);
       
   134 
       
   135 	sdli.StartMusic();
   133 }
   136 }
   134 
   137 
   135 void HWForm::onFrontendFullscreen(bool value)
   138 void HWForm::onFrontendFullscreen(bool value)
   136 {
   139 {
   137   if (value)
   140   if (value)
   544 
   547 
   545 void HWForm::GameStateChanged(GameState gameState)
   548 void HWForm::GameStateChanged(GameState gameState)
   546 {
   549 {
   547 	switch(gameState) {
   550 	switch(gameState) {
   548 		case gsStarted: {
   551 		case gsStarted: {
   549 			StopMusic();
   552 			sdli.StopMusic();
   550 			GoToPage(ID_PAGE_INGAME);
   553 			GoToPage(ID_PAGE_INGAME);
   551 			ui.pageGameStats->labelGameStats->setText("");
   554 			ui.pageGameStats->labelGameStats->setText("");
   552 			if (pRegisterServer)
   555 			if (pRegisterServer)
   553 			{
   556 			{
   554 				pRegisterServer->unregister();
   557 				pRegisterServer->unregister();
   556 			}
   559 			}
   557 			break;
   560 			break;
   558 		}
   561 		}
   559 		case gsFinished: {
   562 		case gsFinished: {
   560 			GoBack();
   563 			GoBack();
   561 			StartMusic();
   564 			sdli.StartMusic();
   562 			GoToPage(ID_PAGE_GAMESTATS);
   565 			GoToPage(ID_PAGE_GAMESTATS);
   563 			break;
   566 			break;
   564 		}
   567 		}
   565 		default: {
   568 		default: {
   566 			quint8 id = ui.Pages->currentIndex();
   569 			quint8 id = ui.Pages->currentIndex();
   567 			if (id == ID_PAGE_INGAME) GoBack();
   570 			if (id == ID_PAGE_INGAME) {
       
   571 				GoBack();
       
   572 				sdli.StartMusic();
       
   573 			}
   568 		};
   574 		};
   569 	}
   575 	}
   570 
   576 
   571 	if (hwnet)
   577 	if (hwnet)
   572 	{
   578 	{
   680 void HWForm::closeEvent(QCloseEvent *event)
   686 void HWForm::closeEvent(QCloseEvent *event)
   681 {
   687 {
   682 	config->SaveOptions();
   688 	config->SaveOptions();
   683 	event->accept();
   689 	event->accept();
   684 }
   690 }
   685 
       
   686 void HWForm::StartMusic()
       
   687 {
       
   688 
       
   689 }
       
   690 
       
   691 void HWForm::StopMusic()
       
   692 {
       
   693 
       
   694 }