merged new team from branch
authordisplacer
Thu, 15 Mar 2007 02:20:31 +0000
changeset 496 00465a8ef129
parent 495 62c1c2b4414c
child 497 adf1aee202c6
merged new team from branch
QTfrontend/hwform.cpp
QTfrontend/hwform.h
--- a/QTfrontend/hwform.cpp	Sun Mar 11 17:19:28 2007 +0000
+++ b/QTfrontend/hwform.cpp	Thu Mar 15 02:20:31 2007 +0000
@@ -156,20 +156,27 @@
 	GoToPage(ID_PAGE_NET);
 }
 
-void HWForm::OnPageShown(quint8 id)
+void HWForm::OnPageShown(quint8 id, quint8 lastid)
 {
 	if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETCFG) {
 		QStringList tmNames=config->GetTeamsList();
 		TeamSelWidget* curTeamSelWidget;
-		id == ID_PAGE_MULTIPLAYER ? curTeamSelWidget=ui.pageMultiplayer->teamsSelect :
+		if(id == ID_PAGE_MULTIPLAYER) {
+		  curTeamSelWidget=ui.pageMultiplayer->teamsSelect;
+		} else {
 		  curTeamSelWidget=ui.pageNetGame->pNetTeamsWidget;
+		}
 		QList<HWTeam> teamsList;
 		for(QStringList::iterator it=tmNames.begin(); it!=tmNames.end(); it++) {
 		  HWTeam team(*it);
 		  team.LoadFromFile();
 		  teamsList.push_back(team);
 		}
-		curTeamSelWidget->resetPlayingTeams(teamsList);
+		if(lastid==ID_PAGE_SETUP_TEAM) {
+		  if (editedTeam) curTeamSelWidget->addTeam(*editedTeam);
+		} else {
+		  curTeamSelWidget->resetPlayingTeams(teamsList);
+		}
 	}
 }
 
@@ -186,7 +193,7 @@
 	  if(hwnet || pnetserver) NetDisconnect();
 	}
 	quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
-	OnPageShown(id);
+	OnPageShown(id, ui.Pages->currentIndex());
 	ui.Pages->setCurrentIndex(id);
 }
 
@@ -209,14 +216,16 @@
 {
 	editedTeam->GetFromPage(this);
 	editedTeam->SaveToFile();
-	delete editedTeam;
 	UpdateTeamsLists();
 	GoBack();
+	delete editedTeam;
+	editedTeam=0;
 }
 
 void HWForm::TeamDiscard()
 {
 	delete editedTeam;
+	editedTeam=0;
 	GoBack();
 }
 
--- a/QTfrontend/hwform.h	Sun Mar 11 17:19:28 2007 +0000
+++ b/QTfrontend/hwform.h	Thu Mar 15 02:20:31 2007 +0000
@@ -94,7 +94,7 @@
 	HWNetServer* pnetserver;
 	HWNetUdpServer* pUdpServer;
 	void AddStatText(const QString & msg);
-	void OnPageShown(quint8 id);
+	void OnPageShown(quint8 id, quint8 lastid=0);
 };
 
 #endif