mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Fixes in model loader and caches
* loader/multi cache can clear caches if that is ever needed * check if cache needs to be synchronized when loaded and if, do it * emit changed signal if caches are set
This commit is contained in:
@@ -218,6 +218,8 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return CStatusMessage();
|
||||
}
|
||||
|
||||
this->emitCacheChanged(simulator);
|
||||
}
|
||||
|
||||
QDateTime IMultiSimulatorModelCaches::getCurrentCacheTimestamp() const
|
||||
@@ -228,6 +230,28 @@ namespace BlackMisc
|
||||
return this->getCacheTimestamp(sim);
|
||||
}
|
||||
|
||||
CStatusMessage IMultiSimulatorModelCaches::clearCachedModels(const CSimulatorInfo &simulator)
|
||||
{
|
||||
static const CAircraftModelList models;
|
||||
return this->setCachedModels(models, simulator);
|
||||
}
|
||||
|
||||
void IMultiSimulatorModelCaches::synchronizeMultiCaches(const CSimulatorInfo &simulator)
|
||||
{
|
||||
for (const CSimulatorInfo &singleSimulator : simulator.asSingleSimulatorSet())
|
||||
{
|
||||
this->synchronizeCache(singleSimulator);
|
||||
}
|
||||
}
|
||||
|
||||
void IMultiSimulatorModelCaches::admitMultiCaches(const CSimulatorInfo &simulator)
|
||||
{
|
||||
for (const CSimulatorInfo &singleSimulator : simulator.asSingleSimulatorSet())
|
||||
{
|
||||
this->admitMultiCaches(singleSimulator);
|
||||
}
|
||||
}
|
||||
|
||||
QDateTime CModelCaches::getCacheTimestamp(const CSimulatorInfo &simulator) const
|
||||
{
|
||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
|
||||
@@ -410,6 +434,8 @@ namespace BlackMisc
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "wrong simulator");
|
||||
return CStatusMessage();
|
||||
}
|
||||
|
||||
this->emitCacheChanged(simulator);
|
||||
}
|
||||
|
||||
QDateTime CModelSetCaches::getCacheTimestamp(const CSimulatorInfo &simulator) const
|
||||
|
||||
@@ -205,9 +205,14 @@ namespace BlackMisc
|
||||
//! \threadsafe
|
||||
QDateTime getCurrentCacheTimestamp() const;
|
||||
|
||||
//! Set cache
|
||||
//! Set cached models
|
||||
//! \threadsafe
|
||||
virtual BlackMisc::CStatusMessage setCachedModels(const BlackMisc::Simulation::CAircraftModelList &models, const BlackMisc::Simulation::CSimulatorInfo &simulator) = 0;
|
||||
|
||||
//! Clear cached models
|
||||
//! \threadsafe
|
||||
virtual BlackMisc::CStatusMessage clearCachedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
|
||||
//! Synchronize for given simulator
|
||||
virtual void synchronizeCache(const BlackMisc::Simulation::CSimulatorInfo &simulator) = 0;
|
||||
|
||||
@@ -264,7 +269,6 @@ namespace BlackMisc
|
||||
//! Void version of synchronizeCurrentCache
|
||||
void onLastSelectionChanged();
|
||||
|
||||
private:
|
||||
//! Emit cacheChanged() utility function (allows breakpoint)
|
||||
void emitCacheChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user