refs #834, improved default value for last set/models simulator

Remark: The bug itself was slightly related to the default value, as only the default loader suffered from a not reset flag
This commit is contained in:
Klaus Basan
2016-12-15 02:48:30 +01:00
parent 5107d55115
commit 73ba4e5ff2
6 changed files with 33 additions and 28 deletions

View File

@@ -50,11 +50,11 @@ namespace BlackGui
connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::requestUpdate, this, &CDbOwnModelsComponent::ps_requestOwnModelsUpdate);
// should be single simulator or no simulator (default)
this->m_simulatorSelection.synchronize();
// Last selection isPinned -> no sync needed
const CSimulatorInfo simulator(this->m_simulatorSelection.get());
const bool succes = this->initModelLoader(!simulator.isSingleSimulator() ? CSimulatorInfo(CSimulatorInfo::FSX) : simulator);
if (succes)
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
const bool success = this->initModelLoader(simulator);
if (success)
{
this->m_modelLoader->startLoading(IAircraftModelLoader::CacheOnly);
}
@@ -427,7 +427,7 @@ namespace BlackGui
return;
}
if (!this->m_modelLoader->isLoadingFinished())
if (this->m_modelLoader->isLoadingInProgress())
{
CLogMessage(this).info("Loading for %1 already in progress") << simulator.toQString();
return;

View File

@@ -62,7 +62,7 @@ namespace BlackGui
explicit CDbOwnModelsComponent(QWidget *parent = nullptr);
//! Destructor
~CDbOwnModelsComponent();
virtual ~CDbOwnModelsComponent();
//! Own (installed) model for given model string
BlackMisc::Simulation::CAircraftModel getOwnModelForModelString(const QString &modelString) const;
@@ -132,8 +132,8 @@ namespace BlackGui
private:
QScopedPointer<Ui::CDbOwnModelsComponent> ui;
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models
BlackMisc::CData<BlackMisc::Simulation::Data::TModelCacheLastSelection> m_simulatorSelection {this }; //!< last selection
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models
BlackMisc::CDataReadOnly<BlackMisc::Simulation::Data::TModelCacheLastSelection> m_simulatorSelection {this }; //!< last selection
//! Init or change model loader
bool initModelLoader(const BlackMisc::Simulation::CSimulatorInfo &simulator);