mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
refs #743, utility functions and formatting / typos
* simulator info for FS family / as set * fixed synchronized typo * info string for caches * getter for cached models from the loaders * get all FS family models (FSX/P3D/FS9) from list
This commit is contained in:
committed by
Mathew Sutcliffe
parent
7446ffcb80
commit
11e32a065e
@@ -26,15 +26,32 @@ namespace BlackMisc
|
||||
this->setCachedModels(models, simulator);
|
||||
}
|
||||
|
||||
void IMultiSimulatorModelCaches::emitCacheChanged(const CSimulatorInfo &simulator)
|
||||
QString IMultiSimulatorModelCaches::getInfoString() const
|
||||
{
|
||||
emit cacheChanged(simulator);
|
||||
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));
|
||||
}
|
||||
|
||||
CAircraftModelList IMultiSimulatorModelCaches::getSyncronizedCachedModels(const CSimulatorInfo &simulator)
|
||||
QString IMultiSimulatorModelCaches::getInfoStringFsFamily() const
|
||||
{
|
||||
static const QString is("FSX: %1 P3D: %2 FS9: %3");
|
||||
return is.arg(this->getCachedModelsCount(CSimulatorInfo::FSX)).arg(this->getCachedModelsCount(CSimulatorInfo::P3D)).arg(this->getCachedModelsCount(CSimulatorInfo::FS9));
|
||||
}
|
||||
|
||||
void IMultiSimulatorModelCaches::emitCacheChanged(const CSimulatorInfo &simulator)
|
||||
{
|
||||
emit this->cacheChanged(simulator);
|
||||
}
|
||||
|
||||
int IMultiSimulatorModelCaches::getCachedModelsCount(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
return this->getCachedModels(simulator).size();
|
||||
}
|
||||
|
||||
CAircraftModelList IMultiSimulatorModelCaches::getSynchronizedCachedModels(const CSimulatorInfo &simulator)
|
||||
{
|
||||
BLACK_VERIFY_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "need single simulator");
|
||||
this->syncronizeCache(simulator);
|
||||
this->synchronizeCache(simulator);
|
||||
return this->getCachedModels(simulator);
|
||||
}
|
||||
|
||||
@@ -46,19 +63,19 @@ namespace BlackMisc
|
||||
return this->getCachedModels(sim);
|
||||
}
|
||||
|
||||
QDateTime IMultiSimulatorModelCaches::getSyncronizedTimestamp(const CSimulatorInfo &simulator)
|
||||
QDateTime IMultiSimulatorModelCaches::getSynchronizedTimestamp(const CSimulatorInfo &simulator)
|
||||
{
|
||||
BLACK_VERIFY_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "need single simulator");
|
||||
this->syncronizeCache(simulator);
|
||||
this->synchronizeCache(simulator);
|
||||
return this->getCacheTimestamp(simulator);
|
||||
}
|
||||
|
||||
bool IMultiSimulatorModelCaches::syncronizeCurrentCache()
|
||||
bool IMultiSimulatorModelCaches::synchronizeCurrentCache()
|
||||
{
|
||||
const CSimulatorInfo sim(this->getCurrentSimulator());
|
||||
BLACK_VERIFY_X(sim.isSingleSimulator(), Q_FUNC_INFO, "need single simulator");
|
||||
if (!sim.isSingleSimulator()) { return false; }
|
||||
this->syncronizeCache(sim);
|
||||
this->synchronizeCache(sim);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -72,7 +89,7 @@ namespace BlackMisc
|
||||
this->m_currentSimulator.set(sim);
|
||||
CLogMessage(this).warning("Invalid simulator, reseting");
|
||||
}
|
||||
this->syncronizeCacheImpl(sim);
|
||||
this->synchronizeCacheImpl(sim);
|
||||
const QString simStr(sim.toQString(true));
|
||||
CLogMessage(this).info("Initialized model caches to %1") << simStr;
|
||||
}
|
||||
@@ -130,9 +147,9 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CModelCaches::syncronizeCache(const CSimulatorInfo &simulator)
|
||||
void CModelCaches::synchronizeCache(const CSimulatorInfo &simulator)
|
||||
{
|
||||
this->syncronizeCacheImpl(simulator);
|
||||
this->synchronizeCacheImpl(simulator);
|
||||
}
|
||||
|
||||
CStatusMessage CModelCaches::setCurrentSimulator(const CSimulatorInfo &simulator)
|
||||
@@ -141,11 +158,11 @@ namespace BlackMisc
|
||||
const CSimulatorInfo s = this->m_currentSimulator.get();
|
||||
if (s == simulator) { return sameSimMsg; }
|
||||
const BlackMisc::CStatusMessage m = this->m_currentSimulator.set(simulator);
|
||||
this->syncronizeCache(simulator);
|
||||
this->synchronizeCache(simulator);
|
||||
return m;
|
||||
}
|
||||
|
||||
void CModelCaches::syncronizeCacheImpl(const CSimulatorInfo &simulator)
|
||||
void CModelCaches::synchronizeCacheImpl(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
@@ -170,7 +187,7 @@ namespace BlackMisc
|
||||
this->m_currentSimulator.set(sim);
|
||||
CLogMessage(this).warning("Invalid simulator, reseting");
|
||||
}
|
||||
this->syncronizeCacheImpl(sim);
|
||||
this->synchronizeCacheImpl(sim);
|
||||
const QString simStr(sim.toQString(true));
|
||||
CLogMessage(this).info("Initialized model caches to %1") << simStr;
|
||||
}
|
||||
@@ -230,9 +247,9 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
void CModelSetCaches::syncronizeCache(const CSimulatorInfo &simulator)
|
||||
void CModelSetCaches::synchronizeCache(const CSimulatorInfo &simulator)
|
||||
{
|
||||
this->syncronizeCacheImpl(simulator);
|
||||
this->synchronizeCacheImpl(simulator);
|
||||
}
|
||||
|
||||
CStatusMessage CModelSetCaches::setCurrentSimulator(const CSimulatorInfo &simulator)
|
||||
@@ -241,11 +258,11 @@ namespace BlackMisc
|
||||
const CSimulatorInfo s = this->m_currentSimulator.get();
|
||||
if (s == simulator) { return sameSimMsg; }
|
||||
const BlackMisc::CStatusMessage m = this->m_currentSimulator.set(simulator);
|
||||
this->syncronizeCache(simulator);
|
||||
this->synchronizeCache(simulator);
|
||||
return m;
|
||||
}
|
||||
|
||||
void CModelSetCaches::syncronizeCacheImpl(const CSimulatorInfo &simulator)
|
||||
void CModelSetCaches::synchronizeCacheImpl(const CSimulatorInfo &simulator)
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
switch (simulator.getSimulator())
|
||||
|
||||
Reference in New Issue
Block a user