QTfrontend/hwform.cpp
changeset 2012 76fff564246b
parent 2010 bac82fb13a42
child 2026 21c986c528ba
equal deleted inserted replaced
2011:40a168fb6f1b 2012:76fff564246b
    51 #include "netudpserver.h"
    51 #include "netudpserver.h"
    52 #include "chatwidget.h"
    52 #include "chatwidget.h"
    53 #include "playrecordpage.h"
    53 #include "playrecordpage.h"
    54 #include "input_ip.h"
    54 #include "input_ip.h"
    55 #include "ammoSchemeModel.h"
    55 #include "ammoSchemeModel.h"
       
    56 #include "bgwidget.h"
    56 
    57 
    57 HWForm::HWForm(QWidget *parent)
    58 HWForm::HWForm(QWidget *parent)
    58   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    59   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    59 {
    60 {
    60 	ui.setupUi(this);
    61 	ui.setupUi(this);
   163 
   164 
   164 
   165 
   165 	ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini");
   166 	ammoSchemeModel = new AmmoSchemeModel(this, cfgdir->absolutePath() + "/schemes.ini");
   166 	ui.pageScheme->setModel(ammoSchemeModel);
   167 	ui.pageScheme->setModel(ammoSchemeModel);
   167 	ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
   168 	ui.pageMultiplayer->gameCFG->GameSchemes->setModel(ammoSchemeModel);
       
   169 
       
   170 	wBackground = new BGWidget(this);
       
   171 	wBackground->setFixedSize(this->width(), this->height());
       
   172 	wBackground->lower();
       
   173 	wBackground->init();
       
   174 	wBackground->startAnimation();
   168 
   175 
   169 	PagesStack.push(ID_PAGE_MAIN);
   176 	PagesStack.push(ID_PAGE_MAIN);
   170 	GoBack();
   177 	GoBack();
   171 }
   178 }
   172 
   179 
   729 void HWForm::GameStateChanged(GameState gameState)
   736 void HWForm::GameStateChanged(GameState gameState)
   730 {
   737 {
   731 	switch(gameState) {
   738 	switch(gameState) {
   732 		case gsStarted: {
   739 		case gsStarted: {
   733 			Music(false);
   740 			Music(false);
       
   741 			if (wBackground) wBackground->stopAnimation();	
   734 			GoToPage(ID_PAGE_INGAME);
   742 			GoToPage(ID_PAGE_INGAME);
   735 			ui.pageGameStats->clear();
   743 			ui.pageGameStats->clear();
   736 			if (pRegisterServer)
   744 			if (pRegisterServer)
   737 			{
   745 			{
   738 				pRegisterServer->unregister();
   746 				pRegisterServer->unregister();
   741 			break;
   749 			break;
   742 		}
   750 		}
   743 		case gsFinished: {
   751 		case gsFinished: {
   744 			GoBack();
   752 			GoBack();
   745 			Music(ui.pageOptions->CBEnableMusic->isChecked());
   753 			Music(ui.pageOptions->CBEnableMusic->isChecked());
       
   754 			if (wBackground) wBackground->startAnimation();	
   746 			GoToPage(ID_PAGE_GAMESTATS);
   755 			GoToPage(ID_PAGE_GAMESTATS);
   747 			if (hwnet) hwnet->gameFinished();
   756 			if (hwnet) hwnet->gameFinished();
   748 			break;
   757 			break;
   749 		}
   758 		}
   750 		default: {
   759 		default: {
   751 			quint8 id = ui.Pages->currentIndex();
   760 			quint8 id = ui.Pages->currentIndex();
   752 			if (id == ID_PAGE_INGAME) {
   761 			if (id == ID_PAGE_INGAME) {
   753 				GoBack();
   762 				GoBack();
   754 				Music(ui.pageOptions->CBEnableMusic->isChecked());
   763 				Music(ui.pageOptions->CBEnableMusic->isChecked());
       
   764 				if (wBackground) wBackground->startAnimation();	
   755 				if (hwnet) hwnet->gameFinished();
   765 				if (hwnet) hwnet->gameFinished();
   756 			}
   766 			}
   757 		};
   767 		};
   758 	}
   768 	}
   759 }
   769 }
   890 	if (ui.Pages->currentIndex() == ID_PAGE_NETGAME)
   900 	if (ui.Pages->currentIndex() == ID_PAGE_NETGAME)
   891 		GoBack();
   901 		GoBack();
   892 	else
   902 	else
   893 		qWarning("Left room while not in room");
   903 		qWarning("Left room while not in room");
   894 }
   904 }
       
   905 
       
   906 void HWForm::resizeEvent(QResizeEvent * event)
       
   907 {
       
   908 	int w = event->size().width();
       
   909 	int h = event->size().height();
       
   910 	wBackground->setFixedSize(w, h);
       
   911 	wBackground->move(0, 0);
       
   912 }