QTfrontend/hwform.cpp
changeset 306 7b61834edcf6
parent 301 29bf9c1a3ad3
child 307 96b428ac11f2
--- a/QTfrontend/hwform.cpp	Tue Dec 19 17:20:14 2006 +0000
+++ b/QTfrontend/hwform.cpp	Thu Jan 04 16:27:45 2007 +0000
@@ -83,6 +83,8 @@
 
 	connect(ui.pageInfo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
 
+	connect(ui.pageGameStats->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
+
 	GoToPage(ID_PAGE_MAIN);
 }
 
@@ -199,7 +201,7 @@
 
 void HWForm::SimpleGame()
 {
-	game = new HWGame(config, ui.pageLocalGame->gameCFG);
+	CreateGame(ui.pageLocalGame->gameCFG);
 	game->StartQuick();
 }
 
@@ -214,7 +216,7 @@
 				tr("OK"));
 		return ;
 	}
-	game = new HWGame(config, 0);
+	CreateGame(0);
 	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_" + cProtoVer);
 }
 
@@ -275,7 +277,8 @@
 
 void HWForm::StartMPGame()
 {
-	game = new HWGame(config, ui.pageMultiplayer->gameCFG);
+	CreateGame(ui.pageMultiplayer->gameCFG);
+
 	list<HWTeam> teamslist=ui.pageMultiplayer->teamsSelect->getPlayingTeams();
 	for (list<HWTeam>::const_iterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
 	  HWTeamTempParams params=ui.pageMultiplayer->teamsSelect->getTeamParams(it->TeamName);
@@ -283,3 +286,23 @@
 	}
 	game->StartLocal();
 }
+
+void HWForm::GameStateChanged(GameState gameState)
+{
+	if (gameState == gsStarted)
+		GoToPage(ID_PAGE_GAMESTATS);
+}
+
+void HWForm::GameStats(char type, const QString & info)
+{
+	switch(type) {
+		case 'r' : { ui.pageGameStats->labelGameResult->setText(info); break; }
+	}
+}
+
+void HWForm::CreateGame(GameCFGWidget * gamecfg)
+{
+	game = new HWGame(config, gamecfg);
+	connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
+	connect(game, SIGNAL(GameStats(char, const QString &)), this, SLOT(GameStats(char, const QString &)));
+}