Own model set component

* Removed changeSimulator function in model set component (merged with setSimulator)
* menu to clear caches
* remember simulator "in selector", not in own value
This commit is contained in:
Klaus Basan
2018-07-20 18:16:27 +02:00
parent d632d1ad4f
commit 93d33e3130
5 changed files with 92 additions and 34 deletions

View File

@@ -81,7 +81,7 @@ namespace BlackGui
connect(ui->pb_CopyFromAnotherSwift, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
connect(ui->pb_FirstSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CDbOwnModelSetComponent::setSimulator, Qt::QueuedConnection);
connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CDbOwnModelSetComponent::changeSimulator, Qt::QueuedConnection);
connect(&m_modelSetLoader, &CAircraftModelSetLoader::simulatorChanged, this, &CDbOwnModelSetComponent::setSimulator, Qt::QueuedConnection);
connect(ui->tvp_OwnModelSet, &CAircraftModelView::modelDataChanged, this, &CDbOwnModelSetComponent::onRowCountChanged);
connect(ui->tvp_OwnModelSet, &CAircraftModelView::modelChanged, this, &CDbOwnModelSetComponent::viewModelChanged);
connect(ui->tvp_OwnModelSet, &CAircraftModelView::jsonModelsForSimulatorLoaded, this, &CDbOwnModelSetComponent::onJsonDataLoaded);
@@ -362,9 +362,12 @@ namespace BlackGui
m_copyFromAnotherSwift->show();
}
void CDbOwnModelSetComponent::changeSimulator(const CSimulatorInfo &simulator)
void CDbOwnModelSetComponent::setSimulator(const CSimulatorInfo &simulator)
{
if (m_simulator == simulator) { return; } // avoid unnecessary signals
if (simulator.isNoSimulator()) { return; }
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
m_simulator = simulator;
m_modelSetLoader.setSimulator(simulator);
ui->tvp_OwnModelSet->setSimulatorForLoading(simulator);
@@ -381,12 +384,6 @@ namespace BlackGui
QDesktopServices::openUrl(QUrl::fromLocalFile(file));
}
void CDbOwnModelSetComponent::setSimulator(const CSimulatorInfo &simulator)
{
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
this->changeSimulator(simulator);
}
void CDbOwnModelSetComponent::updateDistributorOrder(const CSimulatorInfo &simulator)
{
CAircraftModelList modelSet = m_modelSetLoader.getAircraftModels(simulator);