QTfrontend/teamselect.cpp
changeset 132 2d0f404cdf05
parent 131 482f78c595ec
child 140 50ccde437ea1
equal deleted inserted replaced
131:482f78c595ec 132:2d0f404cdf05
     9 #include "teamselhelper.h"
     9 #include "teamselhelper.h"
    10 #include "frameTeam.h"
    10 #include "frameTeam.h"
    11 
    11 
    12 void TeamSelWidget::addTeam(HWTeam team)
    12 void TeamSelWidget::addTeam(HWTeam team)
    13 {
    13 {
    14   frameDontPlaying->addTeam(team);
    14   frameDontPlaying->addTeam(team, false);
    15   curDontPlayingTeams.push_back(team);
    15   curDontPlayingTeams.push_back(team);
    16   QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
    16   QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
    17 		   this, SLOT(changeTeamStatus(HWTeam)));
    17 		   this, SLOT(changeTeamStatus(HWTeam)));
    18 }
    18 }
    19 
    19 
    25 void TeamSelWidget::changeTeamStatus(HWTeam team)
    25 void TeamSelWidget::changeTeamStatus(HWTeam team)
    26 {
    26 {
    27   list<HWTeam>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team);
    27   list<HWTeam>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team);
    28   list<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
    28   list<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
    29 
    29 
    30   if(itDontPlay==curDontPlayingTeams.end()) {
    30   bool willBePlaying=itDontPlay!=curDontPlayingTeams.end();
       
    31 
       
    32   if(!willBePlaying) {
    31     // playing team => dont playing
    33     // playing team => dont playing
    32     curDontPlayingTeams.push_back(*itPlay);
    34     curDontPlayingTeams.push_back(*itPlay);
    33     curPlayingTeams.erase(itPlay);
    35     curPlayingTeams.erase(itPlay);
    34   } else {
    36   } else {
    35     // dont playing team => playing
    37     // dont playing team => playing
    37     curDontPlayingTeams.erase(itDontPlay);
    39     curDontPlayingTeams.erase(itDontPlay);
    38   }
    40   }
    39 
    41 
    40   FrameTeams* pRemoveTeams;
    42   FrameTeams* pRemoveTeams;
    41   FrameTeams* pAddTeams;
    43   FrameTeams* pAddTeams;
    42   if(itDontPlay==curDontPlayingTeams.end()) {
    44   if(!willBePlaying) {
    43     pRemoveTeams=framePlaying;
    45     pRemoveTeams=framePlaying;
    44     pAddTeams=frameDontPlaying;
    46     pAddTeams=frameDontPlaying;
    45   } else {
    47   } else {
    46     pRemoveTeams=frameDontPlaying;
    48     pRemoveTeams=frameDontPlaying;
    47     pAddTeams=framePlaying;
    49     pAddTeams=framePlaying;
    48   }
    50   }
    49 
    51 
    50   pAddTeams->addTeam(team);
    52   pAddTeams->addTeam(team, willBePlaying);
    51   pRemoveTeams->removeTeam(team);
    53   pRemoveTeams->removeTeam(team);
    52   QObject::connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
    54   QObject::connect(pAddTeams->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
    53 		   this, SLOT(changeTeamStatus(HWTeam)));
    55 		   this, SLOT(changeTeamStatus(HWTeam)));
    54 
    56 
    55   QSize szh=pAddTeams->sizeHint();
    57   QSize szh=pAddTeams->sizeHint();