refs #661, improved own model set handling

* fixed simulator selector
* added simulator selector to own model set component
* pinned last selections
* fixed model cache to use "getCopy"
This commit is contained in:
Klaus Basan
2016-05-24 18:24:23 +02:00
parent 0ff7791532
commit c0fda8687d
7 changed files with 62 additions and 21 deletions

View File

@@ -50,10 +50,10 @@ namespace BlackMisc
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
switch (simulator.getSimulator())
{
case CSimulatorInfo::FS9: return this->m_modelCacheFs9.get();
case CSimulatorInfo::FSX: return this->m_modelCacheFsx.get();
case CSimulatorInfo::P3D: return this->m_modelCacheP3D.get();
case CSimulatorInfo::XPLANE: return this->m_modelCacheXP.get();
case CSimulatorInfo::FS9: return this->m_modelCacheFs9.getCopy();
case CSimulatorInfo::FSX: return this->m_modelCacheFsx.getCopy();
case CSimulatorInfo::P3D: return this->m_modelCacheP3D.getCopy();
case CSimulatorInfo::XPLANE: return this->m_modelCacheXP.getCopy();
default:
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "No single simulator");
return CAircraftModelList();

View File

@@ -72,6 +72,9 @@ namespace BlackMisc
//! Last selection
struct ModelCacheLastSelection : public BlackMisc::CDataTrait<BlackMisc::Simulation::CSimulatorInfo>
{
//! First load is synchronous
static constexpr bool isPinned() { return true; }
//! Key
static const char *key() { return "modelcachelastselection"; }
};
@@ -111,6 +114,9 @@ namespace BlackMisc
//! Last selection
struct ModelSetLastSelection : public BlackMisc::CDataTrait<BlackMisc::Simulation::CSimulatorInfo>
{
//! First load is synchronous
static constexpr bool isPinned() { return true; }
//! Key
static const char *key() { return "modelsetlastselection"; }
};
@@ -231,7 +237,6 @@ namespace BlackMisc
//! @}
private:
//! \todo Why can`t I keep the changed functions in IMultiSimulatorModelCaches -> C2039 not a member
BlackMisc::CData<BlackMisc::Simulation::Data::ModelSetCacheFsx> m_modelCacheFsx {this, &CModelSetCaches::changedFsx }; //!< FSX cache
BlackMisc::CData<BlackMisc::Simulation::Data::ModelSetCacheFs9> m_modelCacheFs9 {this, &CModelSetCaches::changedFs9}; //!< FS9 cache
BlackMisc::CData<BlackMisc::Simulation::Data::ModelSetCacheP3D> m_modelCacheP3D {this, &CModelSetCaches::changedP3D }; //!< P3D cache