reset playing teams
authordisplacer
Mon, 18 Sep 2006 17:37:22 +0000
changeset 151 9eb5a4cee35e
parent 150 d9e8a336195c
child 152 c558957ef644
reset playing teams
QTfrontend/hwform.cpp
QTfrontend/teamselect.cpp
QTfrontend/teamselect.h
--- a/QTfrontend/hwform.cpp	Sat Sep 16 17:24:41 2006 +0000
+++ b/QTfrontend/hwform.cpp	Mon Sep 18 17:37:22 2006 +0000
@@ -126,6 +126,7 @@
 
 void HWForm::GoToMultiplayer()
 {
+	ui.pageMultiplayer->teamsSelect->resetPlayingTeams(config->GetTeamsList());
 	ui.Pages->setCurrentIndex(ID_PAGE_MULTIPLAYER);
 }
 
--- a/QTfrontend/teamselect.cpp	Sat Sep 16 17:24:41 2006 +0000
+++ b/QTfrontend/teamselect.cpp	Mon Sep 18 17:37:22 2006 +0000
@@ -80,8 +80,21 @@
   addScrArea(frameDontPlaying, QColor("LightGoldenrodYellow"));
 }
 
-void TeamSelWidget::resetPlayingTeams()
+void TeamSelWidget::resetPlayingTeams(const QStringList& teamslist)
 {
+  list<HWTeam>::iterator it;
+  for(it=curPlayingTeams.begin(); it!=curPlayingTeams.end(); it++) {
+    framePlaying->removeTeam(*it);
+  }
+  curPlayingTeams.clear();
+  for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) {
+    frameDontPlaying->removeTeam(*it);
+  }
+  curDontPlayingTeams.clear();
+
+  for (QStringList::ConstIterator it = teamslist.begin(); it != teamslist.end(); ++it ) {
+    addTeam(*it);
+  }
 }
 
 bool TeamSelWidget::isPlaying(HWTeam team)
--- a/QTfrontend/teamselect.h	Sat Sep 16 17:24:41 2006 +0000
+++ b/QTfrontend/teamselect.h	Mon Sep 18 17:37:22 2006 +0000
@@ -23,7 +23,7 @@
   TeamSelWidget(QWidget* parent=0);
   void addTeam(HWTeam team);
   //void removeTeam(HWTeam team);
-  void resetPlayingTeams();
+  void resetPlayingTeams(const QStringList& teamslist);
   bool isPlaying(HWTeam team);
   unsigned char numHedgedogs(HWTeam team);