mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #619, removed redundant set method for cache in loader
This commit is contained in:
@@ -107,7 +107,7 @@ namespace BlackGui
|
||||
mv->updateContainerMaybeAsync(models);
|
||||
if (this->m_loader)
|
||||
{
|
||||
this->m_loader->replaceCacheWithModelData(models);
|
||||
this->m_loader->setModelsInCache(models);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace BlackGui
|
||||
mv->replaceOrAddModelsWithString(models);
|
||||
if (this->m_loader)
|
||||
{
|
||||
this->m_loader->replaceCacheWithModelData(models);
|
||||
this->m_loader->setModelsInCache(models);
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -56,14 +56,14 @@ namespace BlackMisc
|
||||
return true;
|
||||
}
|
||||
|
||||
CStatusMessage IAircraftModelLoader::replaceCacheWithModelData(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
||||
CStatusMessage IAircraftModelLoader::setModelsInCache(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
||||
{
|
||||
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->m_simulatorInfo;
|
||||
if (!sim.isSingleSimulator()) { return CStatusMessage(this, CStatusMessage::SeverityError, "Invalid simuataor"); }
|
||||
const CStatusMessage m(this->m_caches.setModels(models, sim));
|
||||
if (m.isSeverityInfoOrLess())
|
||||
{
|
||||
// set is asny
|
||||
// set is asynchronous
|
||||
// emit loadingFinished(true, sim);
|
||||
}
|
||||
return m;
|
||||
@@ -78,7 +78,7 @@ namespace BlackMisc
|
||||
int c = allModels.replaceOrAddModelsWithString(models, Qt::CaseInsensitive);
|
||||
if (c > 0)
|
||||
{
|
||||
return this->replaceCacheWithModelData(models, sim);
|
||||
return this->setModelsInCache(models, sim);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -121,11 +121,6 @@ namespace BlackMisc
|
||||
return !this->m_caches.getModels(this->m_simulatorInfo).isEmpty();
|
||||
}
|
||||
|
||||
CStatusMessage IAircraftModelLoader::setModelsInCache(const CAircraftModelList &models)
|
||||
{
|
||||
return this->m_caches.setModels(models, this->m_simulatorInfo);
|
||||
}
|
||||
|
||||
CStatusMessage IAircraftModelLoader::clearCache()
|
||||
{
|
||||
return this->setModelsInCache(CAircraftModelList());
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace BlackMisc
|
||||
virtual bool isLoadingFinished() const = 0;
|
||||
|
||||
//! The loaded models
|
||||
//! \threadsafe
|
||||
BlackMisc::Simulation::CAircraftModelList getAircraftModels() const;
|
||||
|
||||
//! Count of loaded models
|
||||
@@ -99,11 +100,11 @@ namespace BlackMisc
|
||||
|
||||
public slots:
|
||||
//! Set cache from outside, this should only be used in special cases.
|
||||
//! But it allows to modify data elsewhere nd update the cache with manipulated data.
|
||||
BlackMisc::CStatusMessage replaceCacheWithModelData(const CAircraftModelList &models, const CSimulatorInfo &simulator = CSimulatorInfo());
|
||||
//! But it allows to modify data elsewhere and update the cache with manipulated data.
|
||||
BlackMisc::CStatusMessage setModelsInCache(const CAircraftModelList &models, const CSimulatorInfo &simulator = CSimulatorInfo());
|
||||
|
||||
//! Set cache from outside, this should only be used in special cases.
|
||||
//! But it allows to modify data elsewhere nd update the cache with manipulated data.
|
||||
//! But it allows to modify data elsewhere and update the cache with manipulated data.
|
||||
BlackMisc::CStatusMessage replaceOrAddModelsInCache(const CAircraftModelList &models, const CSimulatorInfo &simulator = CSimulatorInfo());
|
||||
|
||||
signals:
|
||||
@@ -123,9 +124,6 @@ namespace BlackMisc
|
||||
//! Any cached data?
|
||||
bool hasCachedData() const;
|
||||
|
||||
//! Set models in cache
|
||||
BlackMisc::CStatusMessage setModelsInCache(const BlackMisc::Simulation::CAircraftModelList &models);
|
||||
|
||||
//! Clear cache
|
||||
BlackMisc::CStatusMessage clearCache();
|
||||
|
||||
@@ -135,12 +133,12 @@ namespace BlackMisc
|
||||
//! Start the loading process from disk
|
||||
virtual void startLoadingFromDisk(LoadMode mode, const BlackMisc::Simulation::CAircraftModelList &dbModels) = 0;
|
||||
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulatorInfo; //!< Corresponding simulator
|
||||
std::atomic<bool> m_cancelLoading { false }; //!< flag
|
||||
std::atomic<bool> m_loadingInProgress { false }; //!< Loading in progress
|
||||
QString m_rootDirectory; //!< root directory parsing aircraft.cfg files
|
||||
QStringList m_excludedDirectories; //!< directories not to be parsed
|
||||
BlackMisc::Simulation::Data::CModelCaches m_caches { this }; //!< caches
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulatorInfo; //!< Corresponding simulator
|
||||
std::atomic<bool> m_cancelLoading { false }; //!< flag
|
||||
std::atomic<bool> m_loadingInProgress { false }; //!< Loading in progress
|
||||
QString m_rootDirectory; //!< root directory parsing aircraft.cfg files
|
||||
QStringList m_excludedDirectories; //!< directories not to be parsed
|
||||
BlackMisc::Simulation::Data::CModelCaches m_caches { this }; //!< caches
|
||||
|
||||
protected slots:
|
||||
//! Loading finished
|
||||
|
||||
Reference in New Issue
Block a user