mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 16:55:36 +08:00
Fixed by ignoring all other property indexes
This commit is contained in:
@@ -172,20 +172,14 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CMappingComponent::ps_onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index)
|
void CMappingComponent::ps_onChangedSimulatedAircraftInView(const CVariant &object, const CPropertyIndex &index)
|
||||||
{
|
{
|
||||||
|
if (!sGui || !index.contains(CSimulatedAircraft::IndexEnabled)) { return; } // we only deal with enabled/disabled here
|
||||||
const CSimulatedAircraft sa = object.to<CSimulatedAircraft>(); // changed in GUI
|
const CSimulatedAircraft sa = object.to<CSimulatedAircraft>(); // changed in GUI
|
||||||
const CSimulatedAircraft saFromBackend = sGui->getIContextNetwork()->getAircraftInRangeForCallsign(sa.getCallsign());
|
const CSimulatedAircraft saFromBackend = sGui->getIContextNetwork()->getAircraftInRangeForCallsign(sa.getCallsign());
|
||||||
if (!saFromBackend.hasValidCallsign()) { return; } // obviously deleted
|
if (!saFromBackend.hasValidCallsign()) { return; } // obviously deleted
|
||||||
if (index.contains(CSimulatedAircraft::IndexEnabled))
|
const bool nowEnabled = sa.isEnabled();
|
||||||
{
|
if (saFromBackend.isEnabled() == nowEnabled) { return; } // already same value
|
||||||
const bool enabled = sa.propertyByIndex(index).toBool();
|
CLogMessage(this).info("Request to %1 aircraft %2") << (nowEnabled ? "enable" : "disable") << saFromBackend.getCallsign().toQString();
|
||||||
if (saFromBackend.isEnabled() == enabled) { return; }
|
sGui->getIContextNetwork()->updateAircraftEnabled(saFromBackend.getCallsign(), nowEnabled);
|
||||||
CLogMessage(this).info("Request to %1 aircraft %2") << (enabled ? "enable" : "disable") << saFromBackend.getCallsign().toQString();
|
|
||||||
sGui->getIContextNetwork()->updateAircraftEnabled(saFromBackend.getCallsign(), enabled);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Q_ASSERT_X(false, "ps_onChangedSimulatedAircraftInView", "Index not supported");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::ps_onAircraftSelectedInView(const QModelIndex &index)
|
void CMappingComponent::ps_onAircraftSelectedInView(const QModelIndex &index)
|
||||||
|
|||||||
Reference in New Issue
Block a user