QTfrontend/hwform.cpp
changeset 1622 8e0d62727f01
parent 1621 d1ded2532d3f
child 1625 37aae47943ce
equal deleted inserted replaced
1621:d1ded2532d3f 1622:8e0d62727f01
   641 {
   641 {
   642 	switch(gameState) {
   642 	switch(gameState) {
   643 		case gsStarted: {
   643 		case gsStarted: {
   644 			Music(false);
   644 			Music(false);
   645 			GoToPage(ID_PAGE_INGAME);
   645 			GoToPage(ID_PAGE_INGAME);
   646 			ui.pageGameStats->labelGameStats->setText("");
   646 			ui.pageGameStats->clear();
   647 			if (pRegisterServer)
   647 			if (pRegisterServer)
   648 			{
   648 			{
   649 				pRegisterServer->unregister();
   649 				pRegisterServer->unregister();
   650 				pRegisterServer = 0;
   650 				pRegisterServer = 0;
   651 			}
   651 			}
   667 			}
   667 			}
   668 		};
   668 		};
   669 	}
   669 	}
   670 }
   670 }
   671 
   671 
   672 void HWForm::AddStatText(const QString & msg)
       
   673 {
       
   674 	ui.pageGameStats->labelGameStats->setText(
       
   675 		ui.pageGameStats->labelGameStats->text() + msg);
       
   676 }
       
   677 
       
   678 void HWForm::GameStats(char type, const QString & info)
       
   679 {
       
   680 	switch(type) {
       
   681 		case 'r' : {
       
   682 			AddStatText(QString("<h1 align=\"center\">%1</h1>").arg(info));
       
   683 			break;
       
   684 		}
       
   685 		case 'D' : {
       
   686 			int i = info.indexOf(' ');
       
   687 			QString message = QLabel::tr("<p>The best shot award was won by <b>%1</b> with <b>%2</b> pts.</p>")
       
   688 					.arg(info.mid(i + 1), info.left(i));
       
   689 			AddStatText(message);
       
   690 			break;
       
   691 		}
       
   692 		case 'k' : {
       
   693 			int i = info.indexOf(' ');
       
   694 			QString message = QLabel::tr("<p>The best shot award was won by <b>%1</b> with <b>%2</b> kills.</p>")
       
   695 					.arg(info.mid(i + 1), info.left(i));
       
   696 			AddStatText(message);
       
   697 			break;
       
   698 		}
       
   699 		case 'K' : {
       
   700 			QString message = QLabel::tr("<p>A total of <b>%1</b> Hedgehog(s) were killed during this round.</p>").arg(info);
       
   701 			AddStatText(message);
       
   702 			break;
       
   703 		}
       
   704 	}
       
   705 }
       
   706 
       
   707 void HWForm::CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo)
   672 void HWForm::CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo)
   708 {
   673 {
   709 	game = new HWGame(config, gamecfg, ammo, pTeamSelWidget);
   674 	game = new HWGame(config, gamecfg, ammo, pTeamSelWidget);
   710 	connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
   675 	connect(game, SIGNAL(GameStateChanged(GameState)), this, SLOT(GameStateChanged(GameState)));
   711 	connect(game, SIGNAL(GameStats(char, const QString &)), this, SLOT(GameStats(char, const QString &)));
   676 	connect(game, SIGNAL(GameStats(char, const QString &)), ui.pageGameStats, SLOT(GameStats(char, const QString &)));
   712 	connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection);
   677 	connect(game, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection);
   713 	connect(game, SIGNAL(HaveRecord(bool, const QByteArray &)), this, SLOT(GetRecord(bool, const QByteArray &)));
   678 	connect(game, SIGNAL(HaveRecord(bool, const QByteArray &)), this, SLOT(GetRecord(bool, const QByteArray &)));
   714 }
   679 }
   715 
   680 
   716 void HWForm::ShowErrorMessage(const QString & msg)
   681 void HWForm::ShowErrorMessage(const QString & msg)