QTfrontend/hwform.cpp
changeset 306 7b61834edcf6
parent 301 29bf9c1a3ad3
child 307 96b428ac11f2
equal deleted inserted replaced
305:1c1cd66ffcdc 306:7b61834edcf6
    81 	connect(ui.pageNetChat->BtnJoin,	SIGNAL(clicked()),	this, SLOT(NetJoin()));
    81 	connect(ui.pageNetChat->BtnJoin,	SIGNAL(clicked()),	this, SLOT(NetJoin()));
    82 	connect(ui.pageNetChat->BtnCreate,	SIGNAL(clicked()),	this, SLOT(NetCreate()));
    82 	connect(ui.pageNetChat->BtnCreate,	SIGNAL(clicked()),	this, SLOT(NetCreate()));
    83 
    83 
    84 	connect(ui.pageInfo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    84 	connect(ui.pageInfo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    85 
    85 
       
    86 	connect(ui.pageGameStats->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
       
    87 
    86 	GoToPage(ID_PAGE_MAIN);
    88 	GoToPage(ID_PAGE_MAIN);
    87 }
    89 }
    88 
    90 
    89 void HWForm::UpdateTeamsLists()
    91 void HWForm::UpdateTeamsLists()
    90 {
    92 {
   197 	GoBack();
   199 	GoBack();
   198 }
   200 }
   199 
   201 
   200 void HWForm::SimpleGame()
   202 void HWForm::SimpleGame()
   201 {
   203 {
   202 	game = new HWGame(config, ui.pageLocalGame->gameCFG);
   204 	CreateGame(ui.pageLocalGame->gameCFG);
   203 	game->StartQuick();
   205 	game->StartQuick();
   204 }
   206 }
   205 
   207 
   206 void HWForm::PlayDemo()
   208 void HWForm::PlayDemo()
   207 {
   209 {
   212 				tr("Error"),
   214 				tr("Error"),
   213 				tr("Please, select demo from the list above"),
   215 				tr("Please, select demo from the list above"),
   214 				tr("OK"));
   216 				tr("OK"));
   215 		return ;
   217 		return ;
   216 	}
   218 	}
   217 	game = new HWGame(config, 0);
   219 	CreateGame(0);
   218 	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_" + cProtoVer);
   220 	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_" + cProtoVer);
   219 }
   221 }
   220 
   222 
   221 void HWForm::NetConnect()
   223 void HWForm::NetConnect()
   222 {
   224 {
   273 	ui.pageNetGame->listNetTeams->addItems(teams);
   275 	ui.pageNetGame->listNetTeams->addItems(teams);
   274 }
   276 }
   275 
   277 
   276 void HWForm::StartMPGame()
   278 void HWForm::StartMPGame()
   277 {
   279 {
   278 	game = new HWGame(config, ui.pageMultiplayer->gameCFG);
   280 	CreateGame(ui.pageMultiplayer->gameCFG);
       
   281 
   279 	list<HWTeam> teamslist=ui.pageMultiplayer->teamsSelect->getPlayingTeams();
   282 	list<HWTeam> teamslist=ui.pageMultiplayer->teamsSelect->getPlayingTeams();
   280 	for (list<HWTeam>::const_iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
   283 	for (list<HWTeam>::const_iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
   281 	  HWTeamTempParams params=ui.pageMultiplayer->teamsSelect->getTeamParams(it->TeamName);
   284 	  HWTeamTempParams params=ui.pageMultiplayer->teamsSelect->getTeamParams(it->TeamName);
   282 	  game->AddTeam(it->TeamName, params);
   285 	  game->AddTeam(it->TeamName, params);
   283 	}
   286 	}
   284 	game->StartLocal();
   287 	game->StartLocal();
   285 }
   288 }
       
   289 
       
   290 void HWForm::GameStateChanged(GameState gameState)
       
   291 {
       
   292 	if (gameState == gsStarted)
       
   293 		GoToPage(ID_PAGE_GAMESTATS);
       
   294 }
       
   295 
       
   296 void HWForm::GameStats(char type, const QString & info)
       
   297 {
       
   298 	switch(type) {
       
   299 		case 'r' : { ui.pageGameStats->labelGameResult->setText(info); break; }
       
   300 	}
       
   301 }
       
   302 
       
   303 void HWForm::CreateGame(GameCFGWidget * gamecfg)
       
   304 {
       
   305 	game = new HWGame(config, gamecfg);
       
   306 	connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
       
   307 	connect(game, SIGNAL(GameStats(char, const QString &)), this, SLOT(GameStats(char, const QString &)));
       
   308 }