QTfrontend/teamselect.cpp
changeset 373 df912aab6b7e
parent 372 4bac77f8cd38
child 382 e7220e48ead1
--- a/QTfrontend/teamselect.cpp	Sat Jan 27 17:41:08 2007 +0000
+++ b/QTfrontend/teamselect.cpp	Sat Jan 27 18:33:14 2007 +0000
@@ -40,8 +40,13 @@
   } else {
     frameDontPlaying->addTeam(team, false);
     curDontPlayingTeams.push_back(team);
-    QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
-		     this, SLOT(changeTeamStatus(HWTeam)));
+    if(m_acceptOuter) {
+      connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
+	      this, SLOT(pre_changeTeamStatus(HWTeam)));
+    } else {
+      connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
+	      this, SLOT(changeTeamStatus(HWTeam)));
+    }
   }
 }
 
@@ -124,7 +129,7 @@
     if(framePlaying->isFullTeams()) return;
     // dont playing team => playing
     curPlayingTeams.push_back(*itDontPlay);
-    emit teamWillPlay(*itDontPlay);
+    if(!m_acceptOuter) emit teamWillPlay(*itDontPlay);
     curDontPlayingTeams.erase(itDontPlay);
   }
 
@@ -168,7 +173,7 @@
 }
 
 TeamSelWidget::TeamSelWidget(QWidget* parent) :
-  QGroupBox(parent), mainLayout(this)
+  QGroupBox(parent), mainLayout(this), m_acceptOuter(false)
 {
   setTitle(QGroupBox::tr("Playing teams"));
   framePlaying=new FrameTeams();
@@ -184,6 +189,11 @@
   mainLayout.addWidget(newTeam);
 }
 
+void TeamSelWidget::setAcceptOuter(bool acceptOuter)
+{
+  m_acceptOuter=acceptOuter;
+}
+
 void TeamSelWidget::resetPlayingTeams(const QList<HWTeam>& teamslist)
 {
   QList<HWTeam>::iterator it;
@@ -212,6 +222,11 @@
   return curPlayingTeams;
 }
 
+void TeamSelWidget::pre_changeTeamStatus(HWTeam team)
+{
+  emit acceptRequested(team);
+}
+
 void TeamSelWidget::newTeamClicked()
 {
 	emit NewTeam();