QTfrontend/teamselect.cpp
changeset 347 6521e1b2cd40
parent 341 184230eb4151
child 348 c91b983de18f
equal deleted inserted replaced
346:fc1e0a4f152c 347:6521e1b2cd40
    29 void TeamSelWidget::addTeam(HWTeam team)
    29 void TeamSelWidget::addTeam(HWTeam team)
    30 {
    30 {
    31   if(team.netTeam) {
    31   if(team.netTeam) {
    32     framePlaying->addTeam(team, true);
    32     framePlaying->addTeam(team, true);
    33     curPlayingTeams.push_back(team);
    33     curPlayingTeams.push_back(team);
       
    34     QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
       
    35 		     this, SLOT(netTeamStatusChanged(const HWTeam&)));
    34   } else {
    36   } else {
    35     frameDontPlaying->addTeam(team, false);
    37     frameDontPlaying->addTeam(team, false);
    36     curDontPlayingTeams.push_back(team);
    38     curDontPlayingTeams.push_back(team);
    37     QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
    39     QObject::connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)),
    38 		     this, SLOT(changeTeamStatus(HWTeam)));
    40 		     this, SLOT(changeTeamStatus(HWTeam)));
    39   }
    41   }
       
    42 }
       
    43 
       
    44 void TeamSelWidget::removeNetTeam(const HWTeam& team)
       
    45 {
       
    46   list<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
       
    47   framePlaying->removeTeam(team);
       
    48   curPlayingTeams.erase(itPlay);
       
    49 }
       
    50 
       
    51 void TeamSelWidget::netTeamStatusChanged(const HWTeam& team)
       
    52 {
       
    53   list<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
       
    54   
    40 }
    55 }
    41 
    56 
    42 //void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team)
    57 //void TeamSelWidget::removeTeam(__attribute__ ((unused)) HWTeam team)
    43 //{
    58 //{
    44   //curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team));
    59   //curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team));
    52   bool willBePlaying=itDontPlay!=curDontPlayingTeams.end();
    67   bool willBePlaying=itDontPlay!=curDontPlayingTeams.end();
    53 
    68 
    54   if(!willBePlaying) {
    69   if(!willBePlaying) {
    55     // playing team => dont playing
    70     // playing team => dont playing
    56     curDontPlayingTeams.push_back(*itPlay);
    71     curDontPlayingTeams.push_back(*itPlay);
       
    72     emit teamNotPlaying(*itPlay);
    57     curPlayingTeams.erase(itPlay);
    73     curPlayingTeams.erase(itPlay);
    58   } else {
    74   } else {
    59     // return if max playing teams reached
    75     // return if max playing teams reached
    60     if(framePlaying->isFullTeams()) return;
    76     if(framePlaying->isFullTeams()) return;
    61     // dont playing team => playing
    77     // dont playing team => playing