42 dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team))->hhNumChanged(); |
42 dynamic_cast<TeamShowWidget*>(framePlaying->getTeamWidget(team))->hhNumChanged(); |
43 connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), |
43 connect(framePlaying->getTeamWidget(team), SIGNAL(teamColorChanged(const HWTeam&)), |
44 this, SLOT(proxyTeamColorChanged(const HWTeam&))); |
44 this, SLOT(proxyTeamColorChanged(const HWTeam&))); |
45 } else { |
45 } else { |
46 frameDontPlaying->addTeam(team, false); |
46 frameDontPlaying->addTeam(team, false); |
47 curDontPlayingTeams.push_back(team); |
47 m_curNotPlayingTeams.push_back(team); |
48 if(m_acceptOuter) { |
48 if(m_acceptOuter) { |
49 connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
49 connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
50 this, SLOT(pre_changeTeamStatus(HWTeam))); |
50 this, SLOT(pre_changeTeamStatus(HWTeam))); |
51 } else { |
51 } else { |
52 connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
52 connect(frameDontPlaying->getTeamWidget(team), SIGNAL(teamStatusChanged(HWTeam)), |
142 //curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team)); |
142 //curDontPlayingTeams.erase(std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team)); |
143 //} |
143 //} |
144 |
144 |
145 void TeamSelWidget::changeTeamStatus(HWTeam team) |
145 void TeamSelWidget::changeTeamStatus(HWTeam team) |
146 { |
146 { |
147 QList<HWTeam>::iterator itDontPlay=std::find(curDontPlayingTeams.begin(), curDontPlayingTeams.end(), team); |
147 QList<HWTeam>::iterator itDontPlay=std::find(m_curNotPlayingTeams.begin(), m_curNotPlayingTeams.end(), team); |
148 QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
148 QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
149 |
149 |
150 bool willBePlaying=itDontPlay!=curDontPlayingTeams.end(); |
150 bool willBePlaying=itDontPlay!=m_curNotPlayingTeams.end(); |
151 |
151 |
152 if(!willBePlaying) { |
152 if(!willBePlaying) { |
153 // playing team => dont playing |
153 // playing team => dont playing |
154 curDontPlayingTeams.push_back(*itPlay); |
154 m_curNotPlayingTeams.push_back(*itPlay); |
155 emit teamNotPlaying(*itPlay); |
155 emit teamNotPlaying(*itPlay); |
156 curPlayingTeams.erase(itPlay); |
156 curPlayingTeams.erase(itPlay); |
157 } else { |
157 } else { |
158 // return if max playing teams reached |
158 // return if max playing teams reached |
159 if(framePlaying->isFullTeams()) return; |
159 if(framePlaying->isFullTeams()) return; |
160 // dont playing team => playing |
160 // dont playing team => playing |
161 team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network) |
161 team=*itDontPlay; // for net team info saving in framePlaying (we have only name with netID from network) |
162 itDontPlay->teamColor=framePlaying->getNextColor(); |
162 itDontPlay->teamColor=framePlaying->getNextColor(); |
163 curPlayingTeams.push_back(*itDontPlay); |
163 curPlayingTeams.push_back(*itDontPlay); |
164 if(!m_acceptOuter) emit teamWillPlay(*itDontPlay); |
164 if(!m_acceptOuter) emit teamWillPlay(*itDontPlay); |
165 curDontPlayingTeams.erase(itDontPlay); |
165 m_curNotPlayingTeams.erase(itDontPlay); |
166 } |
166 } |
167 |
167 |
168 FrameTeams* pRemoveTeams; |
168 FrameTeams* pRemoveTeams; |
169 FrameTeams* pAddTeams; |
169 FrameTeams* pAddTeams; |
170 if(!willBePlaying) { |
170 if(!willBePlaying) { |
251 curPlayingTeams.clear(); |
251 curPlayingTeams.clear(); |
252 //for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) { |
252 //for(it=curDontPlayingTeams.begin(); it!=curDontPlayingTeams.end(); it++) { |
253 //frameDontPlaying->removeTeam(*it); |
253 //frameDontPlaying->removeTeam(*it); |
254 //} |
254 //} |
255 frameDontPlaying->resetTeams(); |
255 frameDontPlaying->resetTeams(); |
256 curDontPlayingTeams.clear(); |
256 m_curNotPlayingTeams.clear(); |
257 |
257 |
258 foreach(HWTeam team, teamslist) |
258 foreach(HWTeam team, teamslist) |
259 addTeam(team); |
259 addTeam(team); |
260 } |
260 } |
261 |
261 |
267 QList<HWTeam> TeamSelWidget::getPlayingTeams() const |
267 QList<HWTeam> TeamSelWidget::getPlayingTeams() const |
268 { |
268 { |
269 return curPlayingTeams; |
269 return curPlayingTeams; |
270 } |
270 } |
271 |
271 |
272 QList<HWTeam> TeamSelWidget::getDontPlayingTeams() const |
272 QList<HWTeam> TeamSelWidget::getNotPlayingTeams() const |
273 { |
273 { |
274 return curDontPlayingTeams; |
274 return m_curNotPlayingTeams; |
275 } |
275 } |
276 |
276 |
277 void TeamSelWidget::pre_changeTeamStatus(HWTeam team) |
277 void TeamSelWidget::pre_changeTeamStatus(HWTeam team) |
278 { |
278 { |
279 team.teamColor=framePlaying->getNextColor(); |
279 team.teamColor=framePlaying->getNextColor(); |