mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 10:45:37 +08:00
refs #283 CAirspaceMonitor: added signals to notify when an aircraft is added or removed
This commit is contained in:
@@ -484,6 +484,8 @@ namespace BlackCore
|
|||||||
this->m_network->sendServerQuery(callsign);
|
this->m_network->sendServerQuery(callsign);
|
||||||
this->sendFsipirCustomPacket(callsign); // own aircraft model
|
this->sendFsipirCustomPacket(callsign); // own aircraft model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit this->addedAircraft(callsign, situation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -495,18 +497,26 @@ namespace BlackCore
|
|||||||
vm.addValue(CAircraft::IndexSituation, situation);
|
vm.addValue(CAircraft::IndexSituation, situation);
|
||||||
vm.addValue(CAircraft::IndexDistance, distance);
|
vm.addValue(CAircraft::IndexDistance, distance);
|
||||||
this->m_aircraftsInRange.applyIf(BlackMisc::Predicates::MemberEqual(&CAircraft::getCallsign, callsign), vm);
|
this->m_aircraftsInRange.applyIf(BlackMisc::Predicates::MemberEqual(&CAircraft::getCallsign, callsign), vm);
|
||||||
|
|
||||||
|
emit this->changedAircraftSituation(callsign, situation);
|
||||||
}
|
}
|
||||||
|
|
||||||
emit this->changedAircraftsInRange();
|
emit this->changedAircraftsInRange();
|
||||||
emit changedAircraftSituation(callsign, situation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAirspaceMonitor::ps_pilotDisconnected(const CCallsign &callsign)
|
void CAirspaceMonitor::ps_pilotDisconnected(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this));
|
Q_ASSERT(BlackCore::isCurrentThreadCreatingThread(this));
|
||||||
|
|
||||||
|
bool contains = this->m_aircraftsInRange.contains(&CAircraft::getCallsign, callsign);
|
||||||
|
|
||||||
this->m_aircraftsInRange.removeIf(&CAircraft::getCallsign, callsign);
|
this->m_aircraftsInRange.removeIf(&CAircraft::getCallsign, callsign);
|
||||||
this->m_otherClients.removeIf(&CClient::getCallsign, callsign);
|
this->m_otherClients.removeIf(&CClient::getCallsign, callsign);
|
||||||
|
|
||||||
|
if (contains)
|
||||||
|
{
|
||||||
|
emit this->removedAircraft(callsign);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAirspaceMonitor::ps_frequencyReceived(const CCallsign &callsign, const CFrequency &frequency)
|
void CAirspaceMonitor::ps_frequencyReceived(const CCallsign &callsign, const CFrequency &frequency)
|
||||||
|
|||||||
@@ -85,8 +85,14 @@ namespace BlackCore
|
|||||||
//! Aircrafts were changed
|
//! Aircrafts were changed
|
||||||
void changedAircraftsInRange();
|
void changedAircraftsInRange();
|
||||||
|
|
||||||
|
//! A new aircraft appeared
|
||||||
|
void addedAircraft(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &initialSituation);
|
||||||
|
|
||||||
//! An aircraft's situation was changed
|
//! An aircraft's situation was changed
|
||||||
void changedAircraftSituation(const BlackMisc::Aviation::CCallsign, const BlackMisc::Aviation::CAircraftSituation &situation);
|
void changedAircraftSituation(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation);
|
||||||
|
|
||||||
|
//! An aircraft disappeared
|
||||||
|
void removedAircraft(const BlackMisc::Aviation::CCallsign &callsign);
|
||||||
|
|
||||||
//! Sent a status message
|
//! Sent a status message
|
||||||
void statusMessage(const BlackMisc::CStatusMessage &msg);
|
void statusMessage(const BlackMisc::CStatusMessage &msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user