mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 14:45:33 +08:00
Ref T430, FG support for model loader (dummy loader) and model caches
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user