mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Ref T430, FG support for model loader (dummy loader) and model caches
This commit is contained in:
@@ -172,6 +172,12 @@ namespace BlackMisc
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Single simulator");
|
||||
if (simulator.isXPlane()) { return new CAircraftModelLoaderXPlane(parent); }
|
||||
if (simulator.isFG())
|
||||
{
|
||||
//! \todo FG add real loader
|
||||
IAircraftModelLoader *dummy = new CDummyModelLoader(simulator, parent);
|
||||
return dummy;
|
||||
}
|
||||
return CAircraftCfgParser::createModelLoader(simulator, parent);
|
||||
}
|
||||
|
||||
@@ -248,6 +254,11 @@ namespace BlackMisc
|
||||
if (!m_loaderFS9) { m_loaderFS9 = this->initLoader(CSimulatorInfo::fs9()); }
|
||||
return m_loaderFS9;
|
||||
}
|
||||
case CSimulatorInfo::FG:
|
||||
{
|
||||
if (!m_loaderFG) { m_loaderFG = this->initLoader(CSimulatorInfo::fg()); }
|
||||
return m_loaderFG;
|
||||
}
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||
break;
|
||||
@@ -269,5 +280,26 @@ namespace BlackMisc
|
||||
connect(loader, &IAircraftModelLoader::cacheChanged, this, &CMultiAircraftModelLoaderProvider::cacheChanged);
|
||||
return loader;
|
||||
}
|
||||
|
||||
CDummyModelLoader::CDummyModelLoader(const CSimulatorInfo &simulator, QObject *parent) : IAircraftModelLoader(simulator, parent)
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
bool CDummyModelLoader::isLoadingFinished() const
|
||||
{
|
||||
// fake loading
|
||||
const qint64 now = QDateTime::currentMSecsSinceEpoch();
|
||||
return m_loadingStartedTs > 0 && now > (m_loadingStartedTs + 5000);
|
||||
}
|
||||
|
||||
void CDummyModelLoader::startLoadingFromDisk(LoadMode mode, const IAircraftModelLoader::ModelConsolidationCallback &modelConsolidation, const QStringList &modelDirectories)
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
Q_UNUSED(modelConsolidation);
|
||||
Q_UNUSED(modelDirectories);
|
||||
m_loadingStartedTs = QDateTime::currentMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -173,6 +173,26 @@ namespace BlackMisc
|
||||
void onCacheChanged(const CSimulatorInfo &simulator);
|
||||
};
|
||||
|
||||
/*!
|
||||
* Dummy loader for testing
|
||||
*/
|
||||
class BLACKMISC_EXPORT CDummyModelLoader : public IAircraftModelLoader
|
||||
{
|
||||
public:
|
||||
//! Dummy loader
|
||||
CDummyModelLoader(const CSimulatorInfo &simulator, QObject *parent);
|
||||
|
||||
//! IAircraftModelLoader::isLoadingFinished
|
||||
virtual bool isLoadingFinished() const override;
|
||||
|
||||
protected:
|
||||
//! IAircraftModelLoader::startLoadingFromDisk
|
||||
virtual void startLoadingFromDisk(LoadMode mode, const ModelConsolidationCallback &modelConsolidation, const QStringList &modelDirectories) override;
|
||||
|
||||
private:
|
||||
qint64 m_loadingStartedTs = -1;
|
||||
};
|
||||
|
||||
/*!
|
||||
* Single instances of all model loaders (lazy init)
|
||||
*/
|
||||
@@ -192,6 +212,7 @@ namespace BlackMisc
|
||||
IAircraftModelLoader *modelLoaderP3D() const { return m_loaderP3D; }
|
||||
IAircraftModelLoader *modelLoaderXP() const { return m_loaderXP; }
|
||||
IAircraftModelLoader *modelLoaderFS9() const { return m_loaderFS9; }
|
||||
IAircraftModelLoader *modelLoaderFG() const { return m_loaderFG; }
|
||||
//! @}
|
||||
|
||||
signals:
|
||||
@@ -209,6 +230,7 @@ namespace BlackMisc
|
||||
IAircraftModelLoader *m_loaderP3D = nullptr;
|
||||
IAircraftModelLoader *m_loaderXP = nullptr;
|
||||
IAircraftModelLoader *m_loaderFS9 = nullptr;
|
||||
IAircraftModelLoader *m_loaderFG = nullptr;
|
||||
|
||||
//! Init the loader
|
||||
IAircraftModelLoader *initLoader(const CSimulatorInfo &simulator);
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace BlackMisc
|
||||
|
||||
QString IMultiSimulatorModelCaches::getInfoString() const
|
||||
{
|
||||
static const QString is("FSX: %1 P3D: %2 FS9: %3 XP: %4");
|
||||
return is.arg(this->getCachedModelsCount(CSimulatorInfo::FSX)).arg(this->getCachedModelsCount(CSimulatorInfo::P3D)).arg(this->getCachedModelsCount(CSimulatorInfo::FS9)).arg(this->getCachedModelsCount(CSimulatorInfo::XPLANE));
|
||||
static const QString is("FSX: %1 P3D: %2 FS9: %3 XP: %4 FG: %5");
|
||||
return is.arg(this->getCachedModelsCount(CSimulatorInfo::FSX)).arg(this->getCachedModelsCount(CSimulatorInfo::P3D)).arg(this->getCachedModelsCount(CSimulatorInfo::FS9)).arg(this->getCachedModelsCount(CSimulatorInfo::XPLANE)).arg(this->getCachedModelsCount(CSimulatorInfo::FG));
|
||||
}
|
||||
|
||||
QString IMultiSimulatorModelCaches::getInfoStringFsFamily() const
|
||||
@@ -64,10 +64,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: m_syncFS9 = synchronized; break;
|
||||
case CSimulatorInfo::FSX: m_syncFsx = synchronized; break;;
|
||||
case CSimulatorInfo::P3D: m_syncP3D = synchronized; break;;
|
||||
case CSimulatorInfo::XPLANE: m_syncXPlane = synchronized; break;;
|
||||
case CSimulatorInfo::FS9: m_syncFS9 = synchronized; break;
|
||||
case CSimulatorInfo::FSX: m_syncFsx = synchronized; break;
|
||||
case CSimulatorInfo::P3D: m_syncP3D = synchronized; break;
|
||||
case CSimulatorInfo::XPLANE: m_syncXPlane = synchronized; break;
|
||||
case CSimulatorInfo::FG: m_syncFG = synchronized; break;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
break;
|
||||
@@ -96,6 +97,7 @@ namespace BlackMisc
|
||||
if (this->hasOtherVersionFile(info, CSimulatorInfo::fsx())) { sim.addSimulator(CSimulatorInfo::fsx()); }
|
||||
if (this->hasOtherVersionFile(info, CSimulatorInfo::p3d())) { sim.addSimulator(CSimulatorInfo::p3d()); }
|
||||
if (this->hasOtherVersionFile(info, CSimulatorInfo::fs9())) { sim.addSimulator(CSimulatorInfo::fs9()); }
|
||||
if (this->hasOtherVersionFile(info, CSimulatorInfo::fg())) { sim.addSimulator(CSimulatorInfo::fg()); }
|
||||
if (this->hasOtherVersionFile(info, CSimulatorInfo::xplane())) { sim.addSimulator(CSimulatorInfo::xplane()); }
|
||||
return sim;
|
||||
}
|
||||
@@ -107,7 +109,8 @@ namespace BlackMisc
|
||||
this->getFilename(CSimulatorInfo::FS9),
|
||||
this->getFilename(CSimulatorInfo::FSX),
|
||||
this->getFilename(CSimulatorInfo::P3D),
|
||||
this->getFilename(CSimulatorInfo::XPLANE)
|
||||
this->getFilename(CSimulatorInfo::XPLANE),
|
||||
this->getFilename(CSimulatorInfo::FG),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -186,10 +189,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.get();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.get();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.get();
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.get();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.get();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.get();
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.get();
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.get();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return CAircraftModelList();
|
||||
@@ -205,10 +209,11 @@ namespace BlackMisc
|
||||
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: msg = m_modelCacheFs9.set(setModels); break;
|
||||
case CSimulatorInfo::FSX: msg = m_modelCacheFsx.set(setModels); break;
|
||||
case CSimulatorInfo::P3D: msg = m_modelCacheP3D.set(setModels); break;
|
||||
case CSimulatorInfo::FS9: msg = m_modelCacheFs9.set(setModels); break;
|
||||
case CSimulatorInfo::FSX: msg = m_modelCacheFsx.set(setModels); break;
|
||||
case CSimulatorInfo::P3D: msg = m_modelCacheP3D.set(setModels); break;
|
||||
case CSimulatorInfo::XPLANE: msg = m_modelCacheXP.set(setModels); break;
|
||||
case CSimulatorInfo::FG: msg = m_modelCacheFG.set(setModels); break;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return CStatusMessage();
|
||||
@@ -228,10 +233,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_syncFS9;
|
||||
case CSimulatorInfo::FSX: return m_syncFsx;
|
||||
case CSimulatorInfo::P3D: return m_syncP3D;
|
||||
case CSimulatorInfo::FS9: return m_syncFS9;
|
||||
case CSimulatorInfo::FSX: return m_syncFsx;
|
||||
case CSimulatorInfo::P3D: return m_syncP3D;
|
||||
case CSimulatorInfo::XPLANE: return m_syncXPlane;
|
||||
case CSimulatorInfo::FG: return m_syncFG;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
break;
|
||||
@@ -260,10 +266,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.getAvailableTimestamp();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.getAvailableTimestamp();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.getAvailableTimestamp();
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.getAvailableTimestamp();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.getAvailableTimestamp();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.getAvailableTimestamp();
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.getAvailableTimestamp();
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.getAvailableTimestamp();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return QDateTime();
|
||||
@@ -276,10 +283,11 @@ namespace BlackMisc
|
||||
if (!ts.isValid()) { return CStatusMessage(this).error("Invalid timestamp for '%1'") << simulator.toQString() ; }
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.set(m_modelCacheFs9.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.set(m_modelCacheFsx.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.set(m_modelCacheP3D.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.set(m_modelCacheFs9.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.set(m_modelCacheFsx.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.set(m_modelCacheP3D.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.set(m_modelCacheXP.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.set(m_modelCacheFG.get(), ts.toMSecsSinceEpoch());
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||
break;
|
||||
@@ -302,10 +310,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.getFilename();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.getFilename();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.getFilename();
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.getFilename();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.getFilename();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.getFilename();
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.getFilename();
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.getFilename();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
break;
|
||||
@@ -318,10 +327,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.isSaved();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.isSaved();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.isSaved();
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.isSaved();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.isSaved();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.isSaved();
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.isSaved();
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.isSaved();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
break;
|
||||
@@ -336,10 +346,11 @@ namespace BlackMisc
|
||||
if (this->isCacheAlreadySynchronized(simulator)) { return; }
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: m_modelCacheFs9.synchronize(); break;
|
||||
case CSimulatorInfo::FSX: m_modelCacheFsx.synchronize(); break;
|
||||
case CSimulatorInfo::P3D: m_modelCacheP3D.synchronize(); break;
|
||||
case CSimulatorInfo::XPLANE: m_modelCacheXP.synchronize(); break;
|
||||
case CSimulatorInfo::FS9: m_modelCacheFs9.synchronize(); break;
|
||||
case CSimulatorInfo::FSX: m_modelCacheFsx.synchronize(); break;
|
||||
case CSimulatorInfo::P3D: m_modelCacheP3D.synchronize(); break;
|
||||
case CSimulatorInfo::XPLANE: m_modelCacheXP.synchronize(); break;
|
||||
case CSimulatorInfo::FG: m_modelCacheFG.synchronize(); break;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
break;
|
||||
@@ -355,10 +366,11 @@ namespace BlackMisc
|
||||
if (this->isCacheAlreadySynchronized(simulator)) { return; }
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: m_modelCacheFs9.admit(); break;
|
||||
case CSimulatorInfo::FSX: m_modelCacheFsx.admit(); break;
|
||||
case CSimulatorInfo::P3D: m_modelCacheP3D.admit(); break;
|
||||
case CSimulatorInfo::XPLANE: m_modelCacheXP.admit(); break;
|
||||
case CSimulatorInfo::FS9: m_modelCacheFs9.admit(); break;
|
||||
case CSimulatorInfo::FSX: m_modelCacheFsx.admit(); break;
|
||||
case CSimulatorInfo::P3D: m_modelCacheP3D.admit(); break;
|
||||
case CSimulatorInfo::XPLANE: m_modelCacheXP.admit(); break;
|
||||
case CSimulatorInfo::FG: m_modelCacheFG.admit(); break;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
break;
|
||||
@@ -393,10 +405,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.get();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.get();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.get();
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.get();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.get();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.get();
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.get();
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.get();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return CAircraftModelList();
|
||||
@@ -420,10 +433,11 @@ namespace BlackMisc
|
||||
CStatusMessage msg;
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: msg = m_modelCacheFs9.set(orderedModels); break;
|
||||
case CSimulatorInfo::FSX: msg = m_modelCacheFsx.set(orderedModels); break;
|
||||
case CSimulatorInfo::P3D: msg = m_modelCacheP3D.set(orderedModels); break;
|
||||
case CSimulatorInfo::XPLANE: msg = m_modelCacheXP.set(orderedModels); break;
|
||||
case CSimulatorInfo::FS9: msg = m_modelCacheFs9.set(orderedModels); break;
|
||||
case CSimulatorInfo::FSX: msg = m_modelCacheFsx.set(orderedModels); break;
|
||||
case CSimulatorInfo::P3D: msg = m_modelCacheP3D.set(orderedModels); break;
|
||||
case CSimulatorInfo::XPLANE: msg = m_modelCacheXP.set(orderedModels); break;
|
||||
case CSimulatorInfo::FG: msg = m_modelCacheFG.set(orderedModels); break;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return CStatusMessage();
|
||||
@@ -437,10 +451,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.getAvailableTimestamp();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.getAvailableTimestamp();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.getAvailableTimestamp();
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.getAvailableTimestamp();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.getAvailableTimestamp();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.getAvailableTimestamp();
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.getAvailableTimestamp();
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.getAvailableTimestamp();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||
return QDateTime();
|
||||
@@ -453,10 +468,11 @@ namespace BlackMisc
|
||||
if (!ts.isValid()) { return CStatusMessage(this).error("Invalid timestamp for '%1'") << simulator.toQString() ; }
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.set(m_modelCacheFs9.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.set(m_modelCacheFsx.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.set(m_modelCacheP3D.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.set(m_modelCacheFs9.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.set(m_modelCacheFsx.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.set(m_modelCacheP3D.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.set(m_modelCacheXP.get(), ts.toMSecsSinceEpoch());
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.set(m_modelCacheFG.get(), ts.toMSecsSinceEpoch());
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||
break;
|
||||
@@ -479,10 +495,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.getFilename();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.getFilename();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.getFilename();
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.getFilename();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.getFilename();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.getFilename();
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.getFilename();
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.getFilename();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||
break;
|
||||
@@ -495,10 +512,11 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.isSaved();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.isSaved();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.isSaved();
|
||||
case CSimulatorInfo::FS9: return m_modelCacheFs9.isSaved();
|
||||
case CSimulatorInfo::FSX: return m_modelCacheFsx.isSaved();
|
||||
case CSimulatorInfo::P3D: return m_modelCacheP3D.isSaved();
|
||||
case CSimulatorInfo::XPLANE: return m_modelCacheXP.isSaved();
|
||||
case CSimulatorInfo::FG: return m_modelCacheFG.isSaved();
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||
break;
|
||||
@@ -513,10 +531,11 @@ namespace BlackMisc
|
||||
if (this->isCacheAlreadySynchronized(simulator)) { return; }
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: m_modelCacheFs9.synchronize(); break;
|
||||
case CSimulatorInfo::FSX: m_modelCacheFsx.synchronize(); break;
|
||||
case CSimulatorInfo::P3D: m_modelCacheP3D.synchronize(); break;
|
||||
case CSimulatorInfo::XPLANE: m_modelCacheXP.synchronize(); break;
|
||||
case CSimulatorInfo::FS9: m_modelCacheFs9.synchronize(); break;
|
||||
case CSimulatorInfo::FSX: m_modelCacheFsx.synchronize(); break;
|
||||
case CSimulatorInfo::P3D: m_modelCacheP3D.synchronize(); break;
|
||||
case CSimulatorInfo::XPLANE: m_modelCacheXP.synchronize(); break;
|
||||
case CSimulatorInfo::FG: m_modelCacheFG.synchronize(); break;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||
break;
|
||||
@@ -532,10 +551,11 @@ namespace BlackMisc
|
||||
if (this->isCacheAlreadySynchronized(simulator)) { return; }
|
||||
switch (simulator.getSimulator())
|
||||
{
|
||||
case CSimulatorInfo::FS9: m_modelCacheFs9.admit(); break;
|
||||
case CSimulatorInfo::FSX: m_modelCacheFsx.admit(); break;
|
||||
case CSimulatorInfo::P3D: m_modelCacheP3D.admit(); break;
|
||||
case CSimulatorInfo::XPLANE: m_modelCacheXP.admit(); break;
|
||||
case CSimulatorInfo::FS9: m_modelCacheFs9.admit(); break;
|
||||
case CSimulatorInfo::FSX: m_modelCacheFsx.admit(); break;
|
||||
case CSimulatorInfo::P3D: m_modelCacheP3D.admit(); break;
|
||||
case CSimulatorInfo::XPLANE: m_modelCacheXP.admit(); break;
|
||||
case CSimulatorInfo::FG: m_modelCacheFG.admit(); break;
|
||||
default:
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "Wrong simulator");
|
||||
break;
|
||||
|
||||
@@ -69,6 +69,13 @@ namespace BlackMisc
|
||||
static const char *key() { return "modelcachep3d"; }
|
||||
};
|
||||
|
||||
//! FG
|
||||
struct TModelCacheFG : public TModelCache
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "modelcachefg"; }
|
||||
};
|
||||
|
||||
//! Last selection
|
||||
struct TModelCacheLastSelection : public TDataTrait<CSimulatorInfo>
|
||||
{
|
||||
@@ -114,6 +121,13 @@ namespace BlackMisc
|
||||
static const char *key() { return "modelsetp3d"; }
|
||||
};
|
||||
|
||||
//! FG
|
||||
struct TModelSetCacheFG : public TModelCache
|
||||
{
|
||||
//! Key in data cache
|
||||
static const char *key() { return "modelsetfg"; }
|
||||
};
|
||||
|
||||
//! Last selection
|
||||
struct TSimulatorLastSelection : public TDataTrait<CSimulatorInfo>
|
||||
{
|
||||
@@ -271,6 +285,7 @@ namespace BlackMisc
|
||||
void changedFs9() { this->emitCacheChanged(CSimulatorInfo::fs9()); }
|
||||
void changedP3D() { this->emitCacheChanged(CSimulatorInfo::p3d()); }
|
||||
void changedXP() { this->emitCacheChanged(CSimulatorInfo::xplane()); }
|
||||
void changedFG() { this->emitCacheChanged(CSimulatorInfo::fg()); }
|
||||
//! @}
|
||||
|
||||
//! Is the cache already synchronized?
|
||||
@@ -284,6 +299,7 @@ namespace BlackMisc
|
||||
std::atomic_bool m_syncFsx { false };
|
||||
std::atomic_bool m_syncP3D { false };
|
||||
std::atomic_bool m_syncFS9 { false };
|
||||
std::atomic_bool m_syncFG { false };
|
||||
std::atomic_bool m_syncXPlane { false };
|
||||
//! @}
|
||||
};
|
||||
@@ -319,6 +335,7 @@ namespace BlackMisc
|
||||
CData<Data::TModelCacheFs9> m_modelCacheFs9 { this, &CModelCaches::changedFs9 }; //!< FS9 cache
|
||||
CData<Data::TModelCacheP3D> m_modelCacheP3D { this, &CModelCaches::changedP3D }; //!< P3D cache
|
||||
CData<Data::TModelCacheXP> m_modelCacheXP { this, &CModelCaches::changedXP }; //!< XP cache
|
||||
CData<Data::TModelCacheFG> m_modelCacheFG { this, &CModelCaches::changedFG }; //!< XP cache
|
||||
|
||||
//! Non virtual version (can be used in ctor)
|
||||
void synchronizeCacheImpl(const CSimulatorInfo &simulator);
|
||||
@@ -359,6 +376,7 @@ namespace BlackMisc
|
||||
CData<Data::TModelSetCacheFs9> m_modelCacheFs9 { this, &CModelSetCaches::changedFs9}; //!< FS9 cache
|
||||
CData<Data::TModelSetCacheP3D> m_modelCacheP3D { this, &CModelSetCaches::changedP3D }; //!< P3D cache
|
||||
CData<Data::TModelSetCacheXP> m_modelCacheXP { this, &CModelSetCaches::changedXP }; //!< XP cache
|
||||
CData<Data::TModelSetCacheFG> m_modelCacheFG { this, &CModelSetCaches::changedFG }; //!< FG cache
|
||||
|
||||
//! Non virtual version (can be used in ctor)
|
||||
void synchronizeCacheImpl(const CSimulatorInfo &simulator);
|
||||
|
||||
Reference in New Issue
Block a user