From d12f164d26216b60505dca2ce57b59f48f5c64d5 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 26 Jan 2019 17:51:14 +0100 Subject: [PATCH] Ref T515, consolidated removed and disabled models, only use "disaabled" --- src/blackcore/aircraftmatcher.cpp | 18 ++++++++---------- src/blackcore/aircraftmatcher.h | 5 ++--- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/blackcore/aircraftmatcher.cpp b/src/blackcore/aircraftmatcher.cpp index d37eb49a9..6faf5024a 100644 --- a/src/blackcore/aircraftmatcher.cpp +++ b/src/blackcore/aircraftmatcher.cpp @@ -49,7 +49,7 @@ namespace BlackCore CAircraftMatcher::~CAircraftMatcher() { - this->saveRemovedModels(); + this->saveDisabledForMatchingModels(); } bool CAircraftMatcher::setSetup(const CAircraftMatcherSetup &setup) @@ -826,21 +826,19 @@ namespace BlackCore if (remoteAircraft.hasCallsign() && remoteAircraft.hasModelString()) { const QString modelString = remoteAircraft.getModelString(); - const bool r = m_modelSet.removeModelWithString(modelString, Qt::CaseInsensitive); - if (r) - { - CLogMessage(this).warning(u"Removed model '%1' from matching model set") << modelString; - m_removedModels.replaceOrAddModelWithString(remoteAircraft.getModel(), Qt::CaseInsensitive); - } + const CAircraftModelList disabledModels({ remoteAircraft.getModel() }); + this->disableModelsForMatching(disabledModels, true); + CLogMessage(this).warning(u"Disabled model '%1' for matching") << modelString; } } - bool CAircraftMatcher::saveRemovedModels() + bool CAircraftMatcher::saveDisabledForMatchingModels() { - if (m_removedModels.isEmpty()) { return false; } + if (m_disabledModels.isEmpty()) { return false; } + // log the models const QString ts = QDateTime::currentDateTimeUtc().toString("yyyyMMddHHmmss"); - const QString json = m_removedModels.toJsonString(); + const QString json = m_disabledModels.toJsonString(); return CFileUtils::writeStringToFile(json, CFileUtils::appendFilePathsAndFixUnc(CDirectoryUtils::logDirectory(), QStringLiteral("removed models %1.json").arg(ts))); } diff --git a/src/blackcore/aircraftmatcher.h b/src/blackcore/aircraftmatcher.h index 8e4d701d2..4755b4a48 100644 --- a/src/blackcore/aircraftmatcher.h +++ b/src/blackcore/aircraftmatcher.h @@ -222,8 +222,8 @@ namespace BlackCore void setupChanged(); private: - //! Save the removed models if any - bool saveRemovedModels(); + //! Save the disabled models if any + bool saveDisabledForMatchingModels(); //! The search based implementation static BlackMisc::Simulation::CAircraftModelList getClosestMatchStepwiseReduceImplementation(const BlackMisc::Simulation::CAircraftModelList &modelSet, const BlackMisc::Simulation::CAircraftMatcherSetup &setup, const BlackMisc::Simulation::CSimulatedAircraft &remoteAircraft, BlackMisc::CStatusMessageList *log = nullptr); @@ -303,7 +303,6 @@ namespace BlackCore BlackMisc::Simulation::CAircraftMatcherSetup m_setup; //!< setup BlackMisc::Simulation::CAircraftModel m_defaultModel; //!< model to be used as default model BlackMisc::Simulation::CAircraftModelList m_modelSet; //!< models used for model matching - BlackMisc::Simulation::CAircraftModelList m_removedModels; //!< removed models BlackMisc::Simulation::CAircraftModelList m_disabledModels; //!< disabled models for matching BlackMisc::Simulation::CSimulatorInfo m_simulator; //!< simulator (optional) BlackMisc::Simulation::CMatchingStatistics m_statistics; //!< matching statistics