Adjusted signal (added count) and overlay message if model loading succeeded

This commit is contained in:
Klaus Basan
2018-09-18 03:09:05 +02:00
parent 5f5113ed47
commit 33a93bf0f4
5 changed files with 16 additions and 6 deletions

View File

@@ -555,13 +555,22 @@ namespace BlackGui
const CAircraftModelList models(m_modelLoader->getCachedModels(simulator)); const CAircraftModelList models(m_modelLoader->getCachedModels(simulator));
const int modelsLoaded = models.size(); const int modelsLoaded = models.size();
ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(models); ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(models);
CStatusMessage m;
if (modelsLoaded < 1) if (modelsLoaded < 1)
{ {
// loading ok, but no data // loading ok, but no data
CLogMessage(this).warning("Loading completed for simulator '%1', but no models") << simulator; m = CLogMessage(this).warning("Loading completed for simulator '%1', but no models") << simulator;
}
else
{
m = CLogMessage(this).info("Loading completed for simulator '%1' with %2 models") << simulator << modelsLoaded;
} }
emit this->successfullyLoadedModels(simulator); // overlay
if (!m.isEmpty() && info == IAircraftModelLoader::ParsedData) { this->showOverlayMessage(m, 5000); }
// signal
emit this->successfullyLoadedModels(simulator, modelsLoaded);
} }
else else
{ {

View File

@@ -123,7 +123,7 @@ namespace BlackGui
signals: signals:
//! Models have been successfully loaded //! Models have been successfully loaded
void successfullyLoadedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator); void successfullyLoadedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator, int count);
private: private:
QScopedPointer<Ui::CDbOwnModelsComponent> ui; QScopedPointer<Ui::CDbOwnModelsComponent> ui;

View File

@@ -51,7 +51,7 @@ namespace BlackGui
signals: signals:
//! \copydoc CDbOwnModelsComponent::successfullyLoadedModels //! \copydoc CDbOwnModelsComponent::successfullyLoadedModels
void successfullyLoadedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator); void successfullyLoadedModels(const BlackMisc::Simulation::CSimulatorInfo &simulator, int count);
private: private:
QScopedPointer<Ui::CDbOwnModelsDialog> ui; QScopedPointer<Ui::CDbOwnModelsDialog> ui;

View File

@@ -104,8 +104,9 @@ namespace BlackGui
this->onSimulatorChanged(simulator); this->onSimulatorChanged(simulator);
} }
void CFirstModelSetComponent::onModelsLoaded(const CSimulatorInfo &simulator) void CFirstModelSetComponent::onModelsLoaded(const CSimulatorInfo &simulator, int count)
{ {
Q_UNUSED(count);
const CSimulatorInfo currentSimulator = ui->comp_SimulatorSelector->getValue(); const CSimulatorInfo currentSimulator = ui->comp_SimulatorSelector->getValue();
if (simulator != currentSimulator) { return; } // ignore changes not for my selected simulator if (simulator != currentSimulator) { return; } // ignore changes not for my selected simulator
this->onSimulatorChanged(simulator); this->onSimulatorChanged(simulator);

View File

@@ -60,7 +60,7 @@ namespace BlackGui
void onSettingsChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator); void onSettingsChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
//! Models have been loaded //! Models have been loaded
void onModelsLoaded(const BlackMisc::Simulation::CSimulatorInfo &simulator); void onModelsLoaded(const BlackMisc::Simulation::CSimulatorInfo &simulator, int count);
//! Asynchronously call onSettingsChanged //! Asynchronously call onSettingsChanged
void triggerSettingsChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator); void triggerSettingsChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);