equal
deleted
inserted
replaced
72 void TeamSelWidget::setInteractivity(bool interactive) |
72 void TeamSelWidget::setInteractivity(bool interactive) |
73 { |
73 { |
74 framePlaying->setInteractivity(interactive); |
74 framePlaying->setInteractivity(interactive); |
75 } |
75 } |
76 |
76 |
|
77 void TeamSelWidget::setUser(const QString& nickname) |
|
78 { |
|
79 m_curUser = nickname; |
|
80 } |
|
81 |
77 void TeamSelWidget::hhNumChanged(const HWTeam& team) |
82 void TeamSelWidget::hhNumChanged(const HWTeam& team) |
78 { |
83 { |
79 QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
84 QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team); |
80 if(itPlay==curPlayingTeams.end()) |
85 if(itPlay==curPlayingTeams.end()) |
81 { |
86 { |
146 } |
151 } |
147 } |
152 } |
148 else |
153 else |
149 { |
154 { |
150 qWarning() << QString("removeNetTeam: team '%1' was actually a local team!").arg(team.name()); |
155 qWarning() << QString("removeNetTeam: team '%1' was actually a local team!").arg(team.name()); |
|
156 } |
|
157 emit setEnabledGameStart(curPlayingTeams.size()>1); |
|
158 } |
|
159 |
|
160 // Removes teams classified as net teams but which are owned by the local user. |
|
161 // Those teams don't make sense and might be leftovers from a finished game |
|
162 // after rejoining. See also: Bugzilla bug 597. |
|
163 void TeamSelWidget::cleanupFakeNetTeams() |
|
164 { |
|
165 // m_curUser is not set for offline games. No cleanup is needed when offline. |
|
166 if(m_curUser.isNull()) |
|
167 return; |
|
168 |
|
169 QList<HWTeam>::iterator itPlay = curPlayingTeams.begin(); |
|
170 while(itPlay != curPlayingTeams.end()) |
|
171 { |
|
172 if(itPlay->isNetTeam() && itPlay->owner() == m_curUser) |
|
173 { |
|
174 qDebug() << QString("cleanupFakeNetTeams: team '%1' removed").arg(itPlay->name()); |
|
175 QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam))); |
|
176 framePlaying->removeTeam(*itPlay); |
|
177 itPlay = curPlayingTeams.erase(itPlay); |
|
178 } |
|
179 else |
|
180 itPlay++; |
|
181 } |
|
182 |
|
183 // Show team notice if less than two teams. |
|
184 if (curPlayingTeams.size() < 2) |
|
185 { |
|
186 numTeamNotice->show(); |
151 } |
187 } |
152 emit setEnabledGameStart(curPlayingTeams.size()>1); |
188 emit setEnabledGameStart(curPlayingTeams.size()>1); |
153 } |
189 } |
154 |
190 |
155 void TeamSelWidget::changeTeamStatus(HWTeam team) |
191 void TeamSelWidget::changeTeamStatus(HWTeam team) |