mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Functions to remove models from model set
This commit is contained in:
committed by
Mat Sutcliffe
parent
79c947f8fa
commit
2e96caef5c
@@ -210,6 +210,9 @@ namespace BlackCore
|
||||
//! Model set completer string
|
||||
virtual QStringList getModelSetCompleterStrings(bool sorted) const = 0;
|
||||
|
||||
//! Remove models from set
|
||||
virtual int removeModelsFromSet(const BlackMisc::Simulation::CAircraftModelList &removeModels) = 0;
|
||||
|
||||
//! \copydoc CAircraftMatcher::disableModelsForMatching
|
||||
virtual void disableModelsForMatching(const BlackMisc::Simulation::CAircraftModelList &removedModels, bool incremental) = 0;
|
||||
|
||||
|
||||
@@ -147,6 +147,14 @@ namespace BlackCore
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
//! \copydoc IContextSimulator::removeModelsFromSet
|
||||
virtual int removeModelsFromSet(const BlackMisc::Simulation::CAircraftModelList &removeModels) override
|
||||
{
|
||||
Q_UNUSED(removeModels);
|
||||
logEmptyContextWarning(Q_FUNC_INFO);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! \copydoc CAircraftMatcher::disableModelsForMatching
|
||||
virtual void disableModelsForMatching(const BlackMisc::Simulation::CAircraftModelList &removedModels, bool incremental) override
|
||||
{
|
||||
|
||||
@@ -279,6 +279,23 @@ namespace BlackCore
|
||||
return known;
|
||||
}
|
||||
|
||||
int CContextSimulator::removeModelsFromSet(const CAircraftModelList &removeModels)
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO; }
|
||||
if (removeModels.isEmpty()) { return 0; }
|
||||
const CSimulatorInfo simulator = m_modelSetSimulator.get();
|
||||
if (!simulator.isSingleSimulator()) { return 0; }
|
||||
|
||||
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator);
|
||||
CAircraftModelList models = CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModels(simulator);
|
||||
const int removed = models.removeModelsWithString(removeModels, Qt::CaseInsensitive);
|
||||
if (removed > 0)
|
||||
{
|
||||
CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().setCachedModels(models, simulator);
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
QStringList CContextSimulator::getModelSetCompleterStrings(bool sorted) const
|
||||
{
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << sorted; }
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace BlackCore
|
||||
virtual QStringList getModelSetStrings() const override;
|
||||
virtual QStringList getModelSetCompleterStrings(bool sorted) const override;
|
||||
virtual bool isKnownModelInSet(const QString &modelString) const override;
|
||||
virtual int removeModelsFromSet(const BlackMisc::Simulation::CAircraftModelList &removeModels) override;
|
||||
virtual void disableModelsForMatching(const BlackMisc::Simulation::CAircraftModelList &removedModels, bool incremental) override;
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getDisabledModelsForMatching() const override;
|
||||
virtual void restoreDisabledModels() override;
|
||||
|
||||
@@ -165,6 +165,11 @@ namespace BlackCore
|
||||
return m_dBusInterface->callDBusRet<QStringList>(QLatin1String("getModelSetCompleterStrings"), sorted);
|
||||
}
|
||||
|
||||
int CContextSimulatorProxy::removeModelsFromSet(const CAircraftModelList &removeModels)
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<int>(QLatin1String("removeModelsFromSet"), removeModels);
|
||||
}
|
||||
|
||||
bool CContextSimulatorProxy::isKnownModelInSet(const QString &modelString) const
|
||||
{
|
||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("isKnownModelInSet"), modelString);
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace BlackCore
|
||||
virtual void setModelSetLoaderSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) override;
|
||||
virtual QStringList getModelSetStrings() const override;
|
||||
virtual QStringList getModelSetCompleterStrings(bool sorted) const override;
|
||||
virtual int removeModelsFromSet(const BlackMisc::Simulation::CAircraftModelList &removeModels) override;
|
||||
virtual bool isKnownModelInSet(const QString &modelString) const override;
|
||||
virtual BlackMisc::Simulation::CAircraftModelList getModelSetModelsStartingWith(const QString &modelString) const override;
|
||||
virtual int getModelSetCount() const override;
|
||||
|
||||
Reference in New Issue
Block a user