Improved manual changing of aircraft and reset

* deferred adding and reset
* HTML overlay messages
* debug code for DBus messages
This commit is contained in:
Klaus Basan
2019-09-05 22:03:36 +02:00
committed by Mat Sutcliffe
parent 1d75b5fac7
commit 902d18339a
4 changed files with 28 additions and 8 deletions

View File

@@ -1044,10 +1044,16 @@ namespace BlackCore
{ {
CSimulatedAircraft aircraft = this->getAircraftInRangeForCallsign(callsign); CSimulatedAircraft aircraft = this->getAircraftInRangeForCallsign(callsign);
if (aircraft.getCallsign() != callsign) { return false; } // not found if (aircraft.getCallsign() != callsign) { return false; } // not found
this->setAircraftEnabledFlag(callsign, true); // plain vanilla flag if (!this->isSimulatorAvailable()) { return false; }
this->updateAircraftRendered(callsign, false); // this is flag only anyway
m_simulatorPlugin.second->logicallyRemoveRemoteAircraft(callsign);
aircraft.setModel(aircraft.getNetworkModel()); // like originally from network aircraft.setModel(aircraft.getNetworkModel()); // like originally from network
this->xCtxAddedRemoteAircraftReadyForModelMatching(aircraft); QPointer<CContextSimulator> myself(this);
QTimer::singleShot(1000, this, [ = ]
{
if (!sApp || sApp->isShuttingDown() || !myself) { return; }
this->xCtxAddedRemoteAircraftReadyForModelMatching(aircraft);
});
return true; return true;
} }

View File

@@ -1082,7 +1082,18 @@ namespace BlackCore
const CCallsign callsign = aircraft.getCallsign(); const CCallsign callsign = aircraft.getCallsign();
if (!this->isPhysicallyRenderedAircraft(callsign)) { return false; } if (!this->isPhysicallyRenderedAircraft(callsign)) { return false; }
this->physicallyRemoveRemoteAircraft(callsign); this->physicallyRemoveRemoteAircraft(callsign);
return this->changeRemoteAircraftEnabled(aircraft); // return this->changeRemoteAircraftEnabled(aircraft);
const QPointer<ISimulator> myself(this);
QTimer::singleShot(1000, this, [ = ]
{
if (!myself) { return; }
if (this->isAircraftInRange(callsign))
{
this->changeRemoteAircraftEnabled(aircraft);
}
});
return true;
} }
CStatusMessageList ISimulator::debugVerifyStateAfterAllAircraftRemoved() const CStatusMessageList ISimulator::debugVerifyStateAfterAllAircraftRemoved() const

View File

@@ -331,7 +331,7 @@ namespace BlackGui
const QString modelString = ui->completer_ModelStrings->getModelString(); const QString modelString = ui->completer_ModelStrings->getModelString();
if (modelString.isEmpty()) if (modelString.isEmpty())
{ {
this->showOverlayMessage(CStatusMessage(this).validationError(u"Missing model for mapping"), OverlayMessageMs); this->showOverlayHTMLMessage(CStatusMessage(this).validationError(u"Missing model for mapping"), OverlayMessageMs);
return; return;
} }
@@ -394,7 +394,7 @@ namespace BlackGui
if (!changed) if (!changed)
{ {
this->showOverlayMessage(CLogMessage(this).info(u"Model mapping, nothing to change"), OverlayMessageMs); this->showOverlayHTMLMessage(CLogMessage(this).info(u"Model mapping, nothing to change"), OverlayMessageMs);
} }
} }
@@ -405,9 +405,9 @@ namespace BlackGui
if (callsign.isEmpty()) { return; } if (callsign.isEmpty()) { return; }
const bool reset = sGui->getIContextSimulator()->resetToModelMatchingAircraft(callsign); const bool reset = sGui->getIContextSimulator()->resetToModelMatchingAircraft(callsign);
const CStatusMessage msg = reset ? const CStatusMessage msg = reset ?
CStatusMessage(this).info(u"Model reset for '%1'") << callsign.toQString() : CStatusMessage(this).info(u"Model reset for '%1'") << callsign.toQString() :
CStatusMessage(this).info(u"Reset failed for '%1'") << callsign.toQString(); CStatusMessage(this).info(u"Reset failed for '%1'") << callsign.toQString();
this->showOverlayMessage(msg, 3000); this->showOverlayHTMLMessage(msg, 3000);
} }
void CMappingComponent::onModelPreviewChanged(int state) void CMappingComponent::onModelPreviewChanged(int state)

View File

@@ -550,6 +550,9 @@ namespace XSwiftBus
const dbus_uint32_t serial = message.getSerial(); const dbus_uint32_t serial = message.getSerial();
const bool wantsReply = message.wantsReply(); const bool wantsReply = message.wantsReply();
// Debug message if needed
// { const std::string d = "dbusMessageHandler: " + message.getMethodName(); INFO_LOG(d.c_str()); }
if (message.getInterfaceName() == DBUS_INTERFACE_INTROSPECTABLE) if (message.getInterfaceName() == DBUS_INTERFACE_INTROSPECTABLE)
{ {
if (message.getMethodName() == "Introspect") if (message.getMethodName() == "Introspect")