mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
refs #787, caches/model set loader
* Caches initialized * simulators with model set
This commit is contained in:
@@ -88,6 +88,21 @@ namespace BlackMisc
|
||||
return true;
|
||||
}
|
||||
|
||||
CSimulatorInfo IMultiSimulatorModelCaches::simulatorsWithInitializedCache() const
|
||||
{
|
||||
static const QDateTime outdated = QDateTime::currentDateTimeUtc().addDays(-365 * 5);
|
||||
CSimulatorInfo withInitializedCache;
|
||||
for (const CSimulatorInfo &simInfo : CSimulatorInfo::allSimulators().asSingleSimulatorSet())
|
||||
{
|
||||
const QDateTime ts = this->getCacheTimestamp(simInfo);
|
||||
if (ts.isValid() && ts > outdated)
|
||||
{
|
||||
withInitializedCache.add(simInfo);
|
||||
}
|
||||
}
|
||||
return withInitializedCache;
|
||||
}
|
||||
|
||||
CModelCaches::CModelCaches(bool synchronizeCache, QObject *parent) : IMultiSimulatorModelCaches(parent)
|
||||
{
|
||||
this->m_currentSimulator.synchronize();
|
||||
|
||||
@@ -166,6 +166,10 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
virtual QDateTime getCacheTimestamp(const BlackMisc::Simulation::CSimulatorInfo &simulator) const = 0;
|
||||
|
||||
//! Initilaized caches for which simulator
|
||||
//! \threadsafe
|
||||
BlackMisc::Simulation::CSimulatorInfo simulatorsWithInitializedCache() const;
|
||||
|
||||
//! Timestamp
|
||||
QDateTime getSynchronizedTimestamp(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
@@ -194,7 +198,7 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
virtual BlackMisc::Simulation::CSimulatorInfo getCurrentSimulator() const = 0;
|
||||
|
||||
//!Selected simulator
|
||||
//! Selected simulator
|
||||
virtual BlackMisc::CStatusMessage setCurrentSimulator(const BlackMisc::Simulation::CSimulatorInfo &simulator) = 0;
|
||||
|
||||
//! \copydoc IModelsPerSimulatorSetable::setModels
|
||||
|
||||
Reference in New Issue
Block a user