mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +08:00
First model set wizard improvements
* overlay messages * hide load indicator in case of a failure
This commit is contained in:
committed by
Mat Sutcliffe
parent
837fc86b7e
commit
048c20a2a3
@@ -627,6 +627,8 @@ namespace BlackGui
|
|||||||
void CDbOwnModelsComponent::onModelLoaderLoadingFinished(const CStatusMessageList &statusMessages, const CSimulatorInfo &simulator, IAircraftModelLoader::LoadFinishedInfo info)
|
void CDbOwnModelsComponent::onModelLoaderLoadingFinished(const CStatusMessageList &statusMessages, const CSimulatorInfo &simulator, IAircraftModelLoader::LoadFinishedInfo info)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Expect single simulator");
|
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Expect single simulator");
|
||||||
|
|
||||||
|
bool hideIndicator = false; // hide in case loading failed
|
||||||
if (IAircraftModelLoader::isLoadedInfo(info) && m_modelLoader)
|
if (IAircraftModelLoader::isLoadedInfo(info) && m_modelLoader)
|
||||||
{
|
{
|
||||||
const CAircraftModelList models(m_modelLoader->getCachedModels(simulator));
|
const CAircraftModelList models(m_modelLoader->getCachedModels(simulator));
|
||||||
@@ -637,6 +639,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
// loading ok, but no data
|
// loading ok, but no data
|
||||||
m = CLogMessage(this).warning(u"Loading completed for simulator '%1', but no models") << simulator;
|
m = CLogMessage(this).warning(u"Loading completed for simulator '%1', but no models") << simulator;
|
||||||
|
hideIndicator = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -655,10 +658,12 @@ namespace BlackGui
|
|||||||
else if (info == IAircraftModelLoader::LoadingSkipped)
|
else if (info == IAircraftModelLoader::LoadingSkipped)
|
||||||
{
|
{
|
||||||
CLogMessage(this).error(u"Loading of models skipped, simulator '%1'") << simulator.toQString();
|
CLogMessage(this).error(u"Loading of models skipped, simulator '%1'") << simulator.toQString();
|
||||||
|
hideIndicator = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ui->tvp_OwnAircraftModels->clear();
|
ui->tvp_OwnAircraftModels->clear();
|
||||||
|
hideIndicator = true;
|
||||||
CLogMessage(this).error(u"Loading of models failed, simulator '%1'") << simulator.toQString();
|
CLogMessage(this).error(u"Loading of models failed, simulator '%1'") << simulator.toQString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,7 +678,9 @@ namespace BlackGui
|
|||||||
// no issues
|
// no issues
|
||||||
timeoutMs = 5000;
|
timeoutMs = 5000;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->showOverlayMessages(statusMessages, false, timeoutMs);
|
this->showOverlayMessages(statusMessages, false, timeoutMs);
|
||||||
|
if (hideIndicator) { ui->tvp_OwnAircraftModels->hideLoadIndicatorForced(); }
|
||||||
|
|
||||||
// cache loads may occur in background, do not adjust UI settings
|
// cache loads may occur in background, do not adjust UI settings
|
||||||
if (info == IAircraftModelLoader::CacheLoaded) { return; }
|
if (info == IAircraftModelLoader::CacheLoaded) { return; }
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ namespace BlackGui
|
|||||||
const CSimulatorInfo simulator = ui->comp_SimulatorSelector->getValue();
|
const CSimulatorInfo simulator = ui->comp_SimulatorSelector->getValue();
|
||||||
ui->le_Simulator->setText(simulator.toQString(true));
|
ui->le_Simulator->setText(simulator.toQString(true));
|
||||||
|
|
||||||
//! \fixme maybe it would be better to set those in stylesheet file
|
//! \fixme hardcoded style sheet
|
||||||
ui->pb_SaveAsSetForSimulator->setStyleSheet("padding-left: 3px; padding-right: 3px;");
|
ui->pb_SaveAsSetForSimulator->setStyleSheet("padding-left: 3px; padding-right: 3px;");
|
||||||
|
|
||||||
connect(ui->pb_CreateNewSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
|
connect(ui->pb_CreateNewSet, &QPushButton::clicked, this, &CDbOwnModelSetComponent::buttonClicked);
|
||||||
@@ -233,8 +233,17 @@ namespace BlackGui
|
|||||||
const CAircraftModelList ownModelSet(ui->tvp_OwnModelSet->container());
|
const CAircraftModelList ownModelSet(ui->tvp_OwnModelSet->container());
|
||||||
if (!ownModelSet.isEmpty())
|
if (!ownModelSet.isEmpty())
|
||||||
{
|
{
|
||||||
const CStatusMessage m = this->setCachedModels(ownModelSet, this->getSelectedSimulator());
|
const CSimulatorInfo sim = this->getSelectedSimulator();
|
||||||
|
const CStatusMessage m = this->setCachedModels(ownModelSet, sim);
|
||||||
CLogMessage::preformatted(m);
|
CLogMessage::preformatted(m);
|
||||||
|
if (m.isSuccess())
|
||||||
|
{
|
||||||
|
this->showMappingComponentOverlayHtmlMessage(QStringLiteral("Save model set for '%1'").arg(sim.toQString(true)), 5000);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->showMappingComponentOverlayMessage(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -268,7 +277,7 @@ namespace BlackGui
|
|||||||
if (canSave)
|
if (canSave)
|
||||||
{
|
{
|
||||||
this->setSaveFileName(this->getModelSetSimulator());
|
this->setSaveFileName(this->getModelSetSimulator());
|
||||||
ui->pb_SaveAsSetForSimulator->setText(QStringLiteral("save %1").arg(this->getModelSetSimulator().toQString(true)));
|
ui->pb_SaveAsSetForSimulator->setText(QStringLiteral("save '%1'").arg(this->getModelSetSimulator().toQString(true)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,10 +63,10 @@ namespace BlackGui
|
|||||||
Q_ASSERT_X(s, Q_FUNC_INFO, "Cannot connect models signal");
|
Q_ASSERT_X(s, Q_FUNC_INFO, "Cannot connect models signal");
|
||||||
|
|
||||||
connect(ui->pb_ModelSet, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelSetDialog);
|
connect(ui->pb_ModelSet, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelSetDialog);
|
||||||
connect(ui->pb_Models, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
|
connect(ui->pb_Models, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
|
||||||
connect(ui->pb_ModelsTriggerReload, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
|
connect(ui->pb_ModelsTriggerReload, &QPushButton::clicked, this, &CFirstModelSetComponent::openOwnModelsDialog);
|
||||||
connect(ui->pb_ChangeModelDir, &QPushButton::clicked, this, &CFirstModelSetComponent::changeModelDirectory);
|
connect(ui->pb_ChangeModelDir, &QPushButton::clicked, this, &CFirstModelSetComponent::changeModelDirectory);
|
||||||
connect(ui->pb_ClearModelDir, &QPushButton::clicked, this, &CFirstModelSetComponent::changeModelDirectory);
|
connect(ui->pb_ClearModelDir, &QPushButton::clicked, this, &CFirstModelSetComponent::changeModelDirectory);
|
||||||
connect(ui->pb_CreateModelSet, &QPushButton::clicked, this, &CFirstModelSetComponent::createModelSet);
|
connect(ui->pb_CreateModelSet, &QPushButton::clicked, this, &CFirstModelSetComponent::createModelSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (!simulator.isSingleSimulator())
|
if (!simulator.isSingleSimulator())
|
||||||
{
|
{
|
||||||
//! \fixme KB 2019-01 reported by RR/crash dump sometimes happening and leading to ASSERT/CTD avoiding the "crash" to better undes
|
//! \fixme KB 2019-01 reported by RR/crash dump sometimes happening and leading to ASSERT/CTD avoiding the "crash" for better infos
|
||||||
if (CBuildConfig::isLocalDeveloperDebugBuild()) { BLACK_VERIFY_X(false, Q_FUNC_INFO, "Need single simulator"); }
|
if (CBuildConfig::isLocalDeveloperDebugBuild()) { BLACK_VERIFY_X(false, Q_FUNC_INFO, "Need single simulator"); }
|
||||||
CLogMessage(this).error(u"Changing to non-single simulator %1 ignored") << simulator.toQString();
|
CLogMessage(this).error(u"Changing to non-single simulator %1 ignored") << simulator.toQString();
|
||||||
return;
|
return;
|
||||||
@@ -168,8 +168,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CFirstModelSetComponent::openOwnModelsDialog()
|
void CFirstModelSetComponent::openOwnModelsDialog()
|
||||||
{
|
{
|
||||||
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
|
||||||
if (!m_modelsDialog) { return; }
|
if (!m_modelsDialog) { return; }
|
||||||
|
if (!sGui || sGui->isShuttingDown() || !sGui->getWebDataServices()) { return; }
|
||||||
const bool reload = (QObject::sender() == ui->pb_ModelsTriggerReload);
|
const bool reload = (QObject::sender() == ui->pb_ModelsTriggerReload);
|
||||||
|
|
||||||
const CSimulatorInfo simulator = ui->comp_SimulatorSelector->getValue();
|
const CSimulatorInfo simulator = ui->comp_SimulatorSelector->getValue();
|
||||||
|
|||||||
Reference in New Issue
Block a user