QTfrontend/hwform.cpp
changeset 311 b8905423f19f
parent 307 96b428ac11f2
child 312 c36d0b34ac3d
--- a/QTfrontend/hwform.cpp	Sun Jan 07 22:54:08 2007 +0000
+++ b/QTfrontend/hwform.cpp	Mon Jan 08 18:21:40 2007 +0000
@@ -85,6 +85,8 @@
 
 	connect(ui.pageGameStats->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
 
+	connect(ui.pageMultiplayer->teamsSelect, SIGNAL(NewTeam()), this, SLOT(NewTeam()));
+
 	GoToPage(ID_PAGE_MAIN);
 }
 
@@ -124,14 +126,6 @@
 
 void HWForm::GoToMultiplayer()
 {
-	QStringList tmNames=config->GetTeamsList();
-	QList<HWTeam> teamsList;
-	for(QStringList::iterator it=tmNames.begin(); it!=tmNames.end(); it++) {
-	  HWTeam team(*it);
-	  team.LoadFromFile();
-	  teamsList.push_back(team);
-	}
-	ui.pageMultiplayer->teamsSelect->resetPlayingTeams(teamsList);
 	GoToPage(ID_PAGE_MULTIPLAYER);
 }
 
@@ -157,15 +151,31 @@
 	GoToPage(ID_PAGE_NETCHAT);
 }
 
+void HWForm::OnPageShown(quint8 id)
+{
+	if (id == ID_PAGE_MULTIPLAYER) {
+		QStringList tmNames=config->GetTeamsList();
+		QList<HWTeam> teamsList;
+		for(QStringList::iterator it=tmNames.begin(); it!=tmNames.end(); it++) {
+		  HWTeam team(*it);
+		  team.LoadFromFile();
+		  teamsList.push_back(team);
+		}
+		ui.pageMultiplayer->teamsSelect->resetPlayingTeams(teamsList);
+	}
+}
+
 void HWForm::GoToPage(quint8 id)
 {
 	PagesStack.push(ui.Pages->currentIndex());
+	OnPageShown(id);
 	ui.Pages->setCurrentIndex(id);
 }
 
 void HWForm::GoBack()
 {
 	quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
+	OnPageShown(id);
 	ui.Pages->setCurrentIndex(id);
 }