refs #253, faster updates of ATC stations by changedAtcStationConnectionStatus(const

This commit is contained in:
Klaus Basan
2014-05-28 13:14:56 +02:00
parent 421cd61195
commit f1ac4deda6
6 changed files with 55 additions and 4 deletions

View File

@@ -68,4 +68,26 @@ namespace BlackGui
break;
}
}
void CAtcStationListModel::changedAtcStationConnectionStatus(const CAtcStation &station, bool added)
{
if (station.getCallsign().isEmpty()) return;
if (added)
{
if (this->m_container.contains(&CAtcStation::getCallsign, station.getCallsign()))
{
this->m_container.replaceIf(&CAtcStation::getCallsign, station.getCallsign(), station);
}
else
{
this->insert(station);
}
}
else
{
beginRemoveRows(QModelIndex(), 0, 0);
this->m_container.removeIf(&CAtcStation::getCallsign, station.getCallsign());
endRemoveRows();
}
}
}