mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 18:25:42 +08:00
Ref T292, Ref T285 model loader and cache improvements
* multi caches also emit when values are set and synchronized * model loader detects cache changed * added CCentralMultiSimulatorModelCachesAware
This commit is contained in:
@@ -53,6 +53,7 @@ namespace BlackGui
|
|||||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CDbOwnModelsComponent::onSimulatorSelectorChanged);
|
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CDbOwnModelsComponent::onSimulatorSelectorChanged);
|
||||||
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::loadingFinished, this, &CDbOwnModelsComponent::onOwnModelsLoadingFinished, Qt::QueuedConnection);
|
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::loadingFinished, this, &CDbOwnModelsComponent::onOwnModelsLoadingFinished, Qt::QueuedConnection);
|
||||||
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::diskLoadingStarted, this, &CDbOwnModelsComponent::onOwnModelsDiskLoadingStarted, Qt::QueuedConnection);
|
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::diskLoadingStarted, this, &CDbOwnModelsComponent::onOwnModelsDiskLoadingStarted, Qt::QueuedConnection);
|
||||||
|
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::cacheChanged, this, &CDbOwnModelsComponent::onCacheChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
// Last selection isPinned -> no sync needed
|
// Last selection isPinned -> no sync needed
|
||||||
ui->comp_SimulatorSelector->setRememberSelectionAndSetToLastSelection();
|
ui->comp_SimulatorSelector->setRememberSelectionAndSetToLastSelection();
|
||||||
@@ -546,9 +547,14 @@ namespace BlackGui
|
|||||||
// cache loads may occur in background, do not adjust UI settings
|
// cache loads may occur in background, do not adjust UI settings
|
||||||
if (info == IAircraftModelLoader::CacheLoaded) { return; }
|
if (info == IAircraftModelLoader::CacheLoaded) { return; }
|
||||||
|
|
||||||
// parsed loads normally explicit
|
// parsed loads normally explicit displaying this simulator
|
||||||
ui->le_Simulator->setText(simulator.toQString());
|
this->setSimulator(simulator);
|
||||||
ui->comp_SimulatorSelector->setValue(simulator);
|
}
|
||||||
|
|
||||||
|
void CDbOwnModelsComponent::onCacheChanged(const CSimulatorInfo &simulator)
|
||||||
|
{
|
||||||
|
const CAircraftModelList models(m_modelLoader->getCachedModels(simulator));
|
||||||
|
ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(models);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbOwnModelsComponent::requestSimulatorModels(const CSimulatorInfo &simulator, IAircraftModelLoader::LoadMode mode, const QStringList &modelDirectories)
|
void CDbOwnModelsComponent::requestSimulatorModels(const CSimulatorInfo &simulator, IAircraftModelLoader::LoadMode mode, const QStringList &modelDirectories)
|
||||||
|
|||||||
@@ -142,6 +142,9 @@ namespace BlackGui
|
|||||||
//! Model loading finished
|
//! Model loading finished
|
||||||
void onOwnModelsLoadingFinished(const BlackMisc::CStatusMessageList &statusMessages, const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadFinishedInfo info);
|
void onOwnModelsLoadingFinished(const BlackMisc::CStatusMessageList &statusMessages, const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadFinishedInfo info);
|
||||||
|
|
||||||
|
//! Cache has been changed
|
||||||
|
void onCacheChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
//! Request simulator models
|
//! Request simulator models
|
||||||
void requestSimulatorModels(const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadMode mode, const QStringList &modelDirectories = {});
|
void requestSimulatorModels(const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadMode mode, const QStringList &modelDirectories = {});
|
||||||
|
|
||||||
|
|||||||
@@ -95,11 +95,15 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
|
|
||||||
IAircraftModelLoader::IAircraftModelLoader(const CSimulatorInfo &simulator, QObject *parent) :
|
IAircraftModelLoader::IAircraftModelLoader(const CSimulatorInfo &simulator, QObject *parent) :
|
||||||
CCentralMultiSimulatorModelCachesProvider(parent),
|
QObject(parent),
|
||||||
m_simulator(simulator)
|
m_simulator(simulator)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Only one simulator per loader");
|
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Only one simulator per loader");
|
||||||
connect(this, &IAircraftModelLoader::loadingFinished, this, &IAircraftModelLoader::onLoadingFinished, Qt::QueuedConnection);
|
connect(this, &IAircraftModelLoader::loadingFinished, this, &IAircraftModelLoader::onLoadingFinished, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
CCentralMultiSimulatorModelCachesProvider *centralCaches = &CCentralMultiSimulatorModelCachesProvider::modelCachesInstance();
|
||||||
|
connect(centralCaches, &CCentralMultiSimulatorModelCachesProvider::cacheChanged, this, &IAircraftModelLoader::onCacheChanged, Qt::QueuedConnection);
|
||||||
|
this->setObjectInfo(simulator);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAircraftModelLoader::~IAircraftModelLoader() { }
|
IAircraftModelLoader::~IAircraftModelLoader() { }
|
||||||
@@ -190,7 +194,6 @@ namespace BlackMisc
|
|||||||
|
|
||||||
void IAircraftModelLoader::onLoadingFinished(const CStatusMessageList &statusMsgs, const CSimulatorInfo &simulator, IAircraftModelLoader::LoadFinishedInfo info)
|
void IAircraftModelLoader::onLoadingFinished(const CStatusMessageList &statusMsgs, const CSimulatorInfo &simulator, IAircraftModelLoader::LoadFinishedInfo info)
|
||||||
{
|
{
|
||||||
Q_UNUSED(info);
|
|
||||||
if (!this->supportsSimulator(simulator)) { return; } // none of my business
|
if (!this->supportsSimulator(simulator)) { return; } // none of my business
|
||||||
this->setObjectInfo(simulator);
|
this->setObjectInfo(simulator);
|
||||||
|
|
||||||
@@ -209,10 +212,17 @@ namespace BlackMisc
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CLogMessage(this).info("Loading finished, success for '%1'") << simulator.toQString();
|
CLogMessage(this).info("Loading '%1' finished, success for '%2'") << IAircraftModelLoader::enumToString(info) << simulator.toQString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IAircraftModelLoader::onCacheChanged(const CSimulatorInfo &simulator)
|
||||||
|
{
|
||||||
|
if (m_loadingInProgress) { return; } // this change signal is redundant as it will be handled by onLoadingFinished
|
||||||
|
if (!this->supportsSimulator(simulator)) { return; } // none of my business
|
||||||
|
emit this->cacheChanged(simulator);
|
||||||
|
}
|
||||||
|
|
||||||
IAircraftModelLoader *CMultiAircraftModelLoaderProvider::loaderInstance(const CSimulatorInfo &simulator)
|
IAircraftModelLoader *CMultiAircraftModelLoaderProvider::loaderInstance(const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||||
@@ -256,6 +266,7 @@ namespace BlackMisc
|
|||||||
IAircraftModelLoader *loader = IAircraftModelLoader::createModelLoader(simulator, this);
|
IAircraftModelLoader *loader = IAircraftModelLoader::createModelLoader(simulator, this);
|
||||||
connect(loader, &IAircraftModelLoader::loadingFinished, this, &CMultiAircraftModelLoaderProvider::loadingFinished);
|
connect(loader, &IAircraftModelLoader::loadingFinished, this, &CMultiAircraftModelLoaderProvider::loadingFinished);
|
||||||
connect(loader, &IAircraftModelLoader::diskLoadingStarted, this, &CMultiAircraftModelLoaderProvider::diskLoadingStarted);
|
connect(loader, &IAircraftModelLoader::diskLoadingStarted, this, &CMultiAircraftModelLoaderProvider::diskLoadingStarted);
|
||||||
|
connect(loader, &IAircraftModelLoader::cacheChanged, this, &CMultiAircraftModelLoaderProvider::cacheChanged);
|
||||||
return loader;
|
return loader;
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ namespace BlackMisc
|
|||||||
* \remark all model loaders share the same model caches of Data::CCentralMultiSimulatorModelCachesProvider
|
* \remark all model loaders share the same model caches of Data::CCentralMultiSimulatorModelCachesProvider
|
||||||
*/
|
*/
|
||||||
class BLACKMISC_EXPORT IAircraftModelLoader :
|
class BLACKMISC_EXPORT IAircraftModelLoader :
|
||||||
public Data::CCentralMultiSimulatorModelCachesProvider,
|
public QObject,
|
||||||
|
public Data::CCentralMultiSimulatorModelCachesAware,
|
||||||
public IModelsSetable,
|
public IModelsSetable,
|
||||||
public IModelsUpdatable
|
public IModelsUpdatable
|
||||||
{
|
{
|
||||||
@@ -137,6 +138,10 @@ namespace BlackMisc
|
|||||||
//! \remark does to fire if the cache has been changed elsewhere and it has just been reloaded here!
|
//! \remark does to fire if the cache has been changed elsewhere and it has just been reloaded here!
|
||||||
void loadingFinished(const CStatusMessageList &status, const CSimulatorInfo &simulator, LoadFinishedInfo info);
|
void loadingFinished(const CStatusMessageList &status, const CSimulatorInfo &simulator, LoadFinishedInfo info);
|
||||||
|
|
||||||
|
//! Relayed from centralized caches
|
||||||
|
//! \remark this can result from loading, the cache changed elsewhere or clearing data
|
||||||
|
void cacheChanged(const CSimulatorInfo &simulator);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
IAircraftModelLoader(const CSimulatorInfo &simulator, QObject *parent = nullptr);
|
IAircraftModelLoader(const CSimulatorInfo &simulator, QObject *parent = nullptr);
|
||||||
@@ -163,6 +168,9 @@ namespace BlackMisc
|
|||||||
|
|
||||||
//! Loading completed
|
//! Loading completed
|
||||||
void onLoadingFinished(const CStatusMessageList &statusMsgs, const CSimulatorInfo &simulator, LoadFinishedInfo info);
|
void onLoadingFinished(const CStatusMessageList &statusMsgs, const CSimulatorInfo &simulator, LoadFinishedInfo info);
|
||||||
|
|
||||||
|
//! Cache has been changed
|
||||||
|
void onCacheChanged(const CSimulatorInfo &simulator);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -193,6 +201,9 @@ namespace BlackMisc
|
|||||||
//! \copydoc IAircraftModelLoader::diskLoadingStarted
|
//! \copydoc IAircraftModelLoader::diskLoadingStarted
|
||||||
void diskLoadingStarted(const CSimulatorInfo &simulator, IAircraftModelLoader::LoadMode mode);
|
void diskLoadingStarted(const CSimulatorInfo &simulator, IAircraftModelLoader::LoadMode mode);
|
||||||
|
|
||||||
|
//! \copydoc IAircraftModelLoader::cacheChanged
|
||||||
|
void cacheChanged(const CSimulatorInfo &simulator);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IAircraftModelLoader *m_loaderFsx = nullptr;
|
IAircraftModelLoader *m_loaderFsx = nullptr;
|
||||||
IAircraftModelLoader *m_loaderP3D = nullptr;
|
IAircraftModelLoader *m_loaderP3D = nullptr;
|
||||||
|
|||||||
@@ -184,18 +184,19 @@ namespace BlackMisc
|
|||||||
CStatusMessage CModelCaches::setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
CStatusMessage CModelCaches::setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||||
|
CStatusMessage msg;
|
||||||
switch (simulator.getSimulator())
|
switch (simulator.getSimulator())
|
||||||
{
|
{
|
||||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.set(models);
|
case CSimulatorInfo::FS9: msg = m_modelCacheFs9.set(models); break;
|
||||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.set(models);
|
case CSimulatorInfo::FSX: msg = m_modelCacheFsx.set(models); break;
|
||||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.set(models);
|
case CSimulatorInfo::P3D: msg = m_modelCacheP3D.set(models); break;
|
||||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.set(models);
|
case CSimulatorInfo::XPLANE: msg = m_modelCacheXP.set(models); break;
|
||||||
default:
|
default:
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||||
return CStatusMessage();
|
return CStatusMessage();
|
||||||
}
|
}
|
||||||
|
this->emitCacheChanged(simulator); // set
|
||||||
this->emitCacheChanged(simulator);
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessage IMultiSimulatorModelCaches::clearCachedModels(const CSimulatorInfo &simulator)
|
CStatusMessage IMultiSimulatorModelCaches::clearCachedModels(const CSimulatorInfo &simulator)
|
||||||
@@ -307,6 +308,7 @@ namespace BlackMisc
|
|||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
this->emitCacheChanged(simulator); // sync
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelCaches::admitCacheImpl(const CSimulatorInfo &simulator)
|
void CModelCaches::admitCacheImpl(const CSimulatorInfo &simulator)
|
||||||
@@ -375,18 +377,19 @@ namespace BlackMisc
|
|||||||
orderedModels.sortAscendingByOrder();
|
orderedModels.sortAscendingByOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CStatusMessage msg;
|
||||||
switch (simulator.getSimulator())
|
switch (simulator.getSimulator())
|
||||||
{
|
{
|
||||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.set(orderedModels);
|
case CSimulatorInfo::FS9: msg = m_modelCacheFs9.set(orderedModels); break;
|
||||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.set(orderedModels);
|
case CSimulatorInfo::FSX: msg = m_modelCacheFsx.set(orderedModels); break;
|
||||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.set(orderedModels);
|
case CSimulatorInfo::P3D: msg = m_modelCacheP3D.set(orderedModels); break;
|
||||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.set(orderedModels);
|
case CSimulatorInfo::XPLANE: msg = m_modelCacheXP.set(orderedModels); break;
|
||||||
default:
|
default:
|
||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||||
return CStatusMessage();
|
return CStatusMessage();
|
||||||
}
|
}
|
||||||
|
this->emitCacheChanged(simulator); // set
|
||||||
this->emitCacheChanged(simulator);
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime CModelSetCaches::getCacheTimestamp(const CSimulatorInfo &simulator) const
|
QDateTime CModelSetCaches::getCacheTimestamp(const CSimulatorInfo &simulator) const
|
||||||
@@ -476,6 +479,7 @@ namespace BlackMisc
|
|||||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
this->emitCacheChanged(simulator); // sync
|
||||||
}
|
}
|
||||||
|
|
||||||
void CModelSetCaches::admitCacheImpl(const CSimulatorInfo &simulator)
|
void CModelSetCaches::admitCacheImpl(const CSimulatorInfo &simulator)
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Cache has been changed
|
//! Cache has been changed
|
||||||
|
//! \note this detects caches changed elsewhere or set here (the normal caches detect only "elsewhere"
|
||||||
void cacheChanged(const CSimulatorInfo &simulator);
|
void cacheChanged(const CSimulatorInfo &simulator);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -367,7 +368,11 @@ namespace BlackMisc
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Ctor
|
//! Ctor
|
||||||
CCentralMultiSimulatorModelCachesProviderBase(QObject *parent = nullptr) : IMultiSimulatorModelCaches(parent) { }
|
CCentralMultiSimulatorModelCachesProviderBase(const QString &name, QObject *parent = nullptr) : IMultiSimulatorModelCaches(parent)
|
||||||
|
{
|
||||||
|
this->setObjectName(name);
|
||||||
|
connect(&m_caches, &IMultiSimulatorModelCaches::cacheChanged, this, &CCentralMultiSimulatorModelCachesProviderBase::cacheChanged);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TCaches m_caches { false, this }; //!< used caches
|
TCaches m_caches { false, this }; //!< used caches
|
||||||
@@ -379,6 +384,7 @@ namespace BlackMisc
|
|||||||
const TCaches &instanceCaches() const { return this->isInstance() ? m_caches : Derived::modelCachesInstance().m_caches; }
|
const TCaches &instanceCaches() const { return this->isInstance() ? m_caches : Derived::modelCachesInstance().m_caches; }
|
||||||
|
|
||||||
//! Is this object the central instance?
|
//! Is this object the central instance?
|
||||||
|
//! \remark would also allow do direct inherit this class
|
||||||
bool isInstance() const { return this == &Derived::modelCachesInstance(); }
|
bool isInstance() const { return this == &Derived::modelCachesInstance(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -393,13 +399,44 @@ namespace BlackMisc
|
|||||||
//! Central instance
|
//! Central instance
|
||||||
static CCentralMultiSimulatorModelCachesProvider &modelCachesInstance()
|
static CCentralMultiSimulatorModelCachesProvider &modelCachesInstance()
|
||||||
{
|
{
|
||||||
static CCentralMultiSimulatorModelCachesProvider c;
|
static CCentralMultiSimulatorModelCachesProvider c("Central model caches provider");
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Ctor
|
//! Ctor
|
||||||
CCentralMultiSimulatorModelCachesProvider(QObject *parent = nullptr) : CCentralMultiSimulatorModelCachesProviderBase(parent) {}
|
CCentralMultiSimulatorModelCachesProvider(const QString &name, QObject *parent = nullptr) : CCentralMultiSimulatorModelCachesProviderBase(name, parent) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Basically a QObject free (delegate based) version of CCentralMultiSimulatorModelCachesProvider
|
||||||
|
class BLACKMISC_EXPORT CCentralMultiSimulatorModelCachesAware:
|
||||||
|
public IModelsForSimulatorSetable,
|
||||||
|
public IModelsForSimulatorUpdatable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! \name Look like IMultiSimulatorModelCaches interface
|
||||||
|
//! @{
|
||||||
|
CAircraftModelList getCachedModels(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getCachedModels(simulator); }
|
||||||
|
int getCachedModelsCount(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getCachedModelsCount(simulator); }
|
||||||
|
QString getCacheCountAndTimestamp(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getCacheCountAndTimestamp(simulator); }
|
||||||
|
CStatusMessage setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().setCachedModels(models, simulator); }
|
||||||
|
CStatusMessage clearCachedModels(const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().clearCachedModels(simulator); }
|
||||||
|
QDateTime getCacheTimestamp(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getCacheTimestamp(simulator); }
|
||||||
|
CStatusMessage setCacheTimestamp(const QDateTime &ts, const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().setCacheTimestamp(ts, simulator); }
|
||||||
|
void synchronizeCache(const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().synchronizeCache(simulator); }
|
||||||
|
void admitCache(const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().admitCache(simulator); }
|
||||||
|
QString getFilename(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getFilename(simulator); }
|
||||||
|
bool isSaved(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().isSaved(simulator); }
|
||||||
|
QString getDescription() const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getDescription(); }
|
||||||
|
QString getInfoString() const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getInfoString(); }
|
||||||
|
QString getInfoStringFsFamily() const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getInfoStringFsFamily(); }
|
||||||
|
//! @}
|
||||||
|
|
||||||
|
//! \copydoc IModelsForSimulatorSetable::setModelsForSimulator
|
||||||
|
virtual void setModelsForSimulator(const CAircraftModelList &models, const CSimulatorInfo &simulator) override { CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().setModelsForSimulator(models, simulator); }
|
||||||
|
|
||||||
|
//! \copydoc IModelsForSimulatorUpdatable::updateModelsForSimulator
|
||||||
|
virtual int updateModelsForSimulator(const CAircraftModelList &models, const CSimulatorInfo &simulator) override { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().updateModelsForSimulator(models, simulator); }
|
||||||
};
|
};
|
||||||
|
|
||||||
//! One central instance of the model set caches
|
//! One central instance of the model set caches
|
||||||
@@ -413,13 +450,13 @@ namespace BlackMisc
|
|||||||
//! Central instance
|
//! Central instance
|
||||||
static CCentralMultiSimulatorModelSetCachesProvider &modelCachesInstance()
|
static CCentralMultiSimulatorModelSetCachesProvider &modelCachesInstance()
|
||||||
{
|
{
|
||||||
static CCentralMultiSimulatorModelSetCachesProvider c;
|
static CCentralMultiSimulatorModelSetCachesProvider c("Central model sets provider");
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Ctor
|
//! Ctor
|
||||||
CCentralMultiSimulatorModelSetCachesProvider(QObject *parent = nullptr) : CCentralMultiSimulatorModelCachesProviderBase(parent) {}
|
CCentralMultiSimulatorModelSetCachesProvider(const QString &name, QObject *parent = nullptr) : CCentralMultiSimulatorModelCachesProviderBase(name, parent) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Basically a QObject free (delegate based) version of CCentralMultiSimulatorModelSetCachesProvider
|
//! Basically a QObject free (delegate based) version of CCentralMultiSimulatorModelSetCachesProvider
|
||||||
@@ -432,7 +469,9 @@ namespace BlackMisc
|
|||||||
//! @{
|
//! @{
|
||||||
CAircraftModelList getCachedModels(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModels(simulator); }
|
CAircraftModelList getCachedModels(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModels(simulator); }
|
||||||
int getCachedModelsCount(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModelsCount(simulator); }
|
int getCachedModelsCount(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCachedModelsCount(simulator); }
|
||||||
|
QString getCacheCountAndTimestamp(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getCacheCountAndTimestamp(simulator); }
|
||||||
CStatusMessage setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().setCachedModels(models, simulator); }
|
CStatusMessage setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().setCachedModels(models, simulator); }
|
||||||
|
CStatusMessage clearCachedModels(const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().clearCachedModels(simulator); }
|
||||||
QDateTime getCacheTimestamp(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCacheTimestamp(simulator); }
|
QDateTime getCacheTimestamp(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getCacheTimestamp(simulator); }
|
||||||
CStatusMessage setCacheTimestamp(const QDateTime &ts, const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().setCacheTimestamp(ts, simulator); }
|
CStatusMessage setCacheTimestamp(const QDateTime &ts, const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().setCacheTimestamp(ts, simulator); }
|
||||||
void synchronizeCache(const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator); }
|
void synchronizeCache(const CSimulatorInfo &simulator) { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().synchronizeCache(simulator); }
|
||||||
@@ -440,6 +479,8 @@ namespace BlackMisc
|
|||||||
QString getFilename(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getFilename(simulator); }
|
QString getFilename(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getFilename(simulator); }
|
||||||
bool isSaved(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().isSaved(simulator); }
|
bool isSaved(const CSimulatorInfo &simulator) const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().isSaved(simulator); }
|
||||||
QString getDescription() const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getDescription(); }
|
QString getDescription() const { return CCentralMultiSimulatorModelSetCachesProvider::modelCachesInstance().getDescription(); }
|
||||||
|
QString getInfoString() const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getInfoString(); }
|
||||||
|
QString getInfoStringFsFamily() const { return CCentralMultiSimulatorModelCachesProvider::modelCachesInstance().getInfoStringFsFamily(); }
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! \copydoc IModelsForSimulatorSetable::setModelsForSimulator
|
//! \copydoc IModelsForSimulatorSetable::setModelsForSimulator
|
||||||
|
|||||||
Reference in New Issue
Block a user