Ref T298, matching messages can be deleted

This commit is contained in:
Klaus Basan
2018-08-15 01:09:53 +02:00
parent ef32ec266e
commit baea17c0f1
2 changed files with 19 additions and 5 deletions

View File

@@ -526,6 +526,7 @@ namespace BlackCore
const CLength cg = m_simulatorPlugin.second->getCGPerModelString(aircraftModel.getModelString());
if (!cg.isNull()) { aircraftModel.setCG(cg); }
this->updateAircraftModel(callsign, aircraftModel, this->identifier());
const CSimulatedAircraft aircraftAfterModelApplied = this->getAircraftInRangeForCallsign(remoteAircraft.getCallsign());
if (!aircraftAfterModelApplied.hasModelString())
{
@@ -539,12 +540,16 @@ namespace BlackCore
brokenAircraft.setEnabled(false);
brokenAircraft.setRendered(false);
emit this->aircraftRenderingChanged(brokenAircraft);
CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Cannot add remote aircraft, no model string: %1").arg(brokenAircraft.toQString()));
CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Cannot add remote aircraft, no model string: '%1'").arg(brokenAircraft.toQString()));
return;
}
m_simulatorPlugin.second->logicallyAddRemoteAircraft(aircraftAfterModelApplied);
CMatchingUtils::addLogDetailsToList(pMatchingMessages, callsign, QString("Logically added remote aircraft: %1").arg(aircraftAfterModelApplied.toQString()));
this->clearMatchingMessages(callsign);
this->addMatchingMessages(callsign, matchingMessages);
// done
emit this->modelMatchingCompleted(aircraftAfterModelApplied);
}
@@ -915,6 +920,12 @@ namespace BlackCore
}
}
void CContextSimulator::clearMatchingMessages(const CCallsign &callsign)
{
if (callsign.isEmpty()) { return; }
m_matchingMessages.remove(callsign);
}
void CContextSimulator::initByLastUsedModelSet()
{
// no models in matcher, but in cache, we can set them as default

View File

@@ -229,14 +229,17 @@ namespace BlackCore
//! Add to message list for matching
void addMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::CStatusMessageList &messages);
//! Clear matching messages
void clearMatchingMessages(const BlackMisc::Aviation::CCallsign &callsign);
//! Load the last know model set
void initByLastUsedModelSet();
QPair<BlackMisc::Simulation::CSimulatorPluginInfo, QPointer<ISimulator>> m_simulatorPlugin; //!< Currently loaded simulator plugin
CPluginManagerSimulator *m_plugins = nullptr; //!< plugin manager
BlackMisc::CRegularThread m_listenersThread; //!< waiting for plugin
CWeatherManager m_weatherManager { this }; //!< weather management
CAircraftMatcher m_aircraftMatcher { this }; //!< model matcher
CPluginManagerSimulator *m_plugins = nullptr; //!< plugin manager
BlackMisc::CRegularThread m_listenersThread; //!< waiting for plugin
CWeatherManager m_weatherManager { this }; //!< weather management
CAircraftMatcher m_aircraftMatcher { this }; //!< model matcher
QMap<BlackMisc::Aviation::CCallsign, BlackMisc::CStatusMessageList> m_matchingMessages; //!< all matching log messages per callsign
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TModelMatching> m_matchingSettings { this }; //!< settings