mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-23 05:45:35 +08:00
Ref T514, signal/slot for model loading progress displayed in UI
This commit is contained in:
committed by
Mat Sutcliffe
parent
f8ee2acf5d
commit
474b1aad6c
@@ -57,9 +57,10 @@ namespace BlackGui
|
|||||||
connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::requestUpdate, this, &CDbOwnModelsComponent::requestOwnModelsUpdate);
|
connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::requestUpdate, this, &CDbOwnModelsComponent::requestOwnModelsUpdate);
|
||||||
connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::jsonLoadCompleted, this, &CDbOwnModelsComponent::onViewDiskLoadingFinished, Qt::QueuedConnection);
|
connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::jsonLoadCompleted, this, &CDbOwnModelsComponent::onViewDiskLoadingFinished, Qt::QueuedConnection);
|
||||||
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CDbOwnModelsComponent::onSimulatorSelectorChanged);
|
connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed, this, &CDbOwnModelsComponent::onSimulatorSelectorChanged);
|
||||||
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::loadingFinished, this, &CDbOwnModelsComponent::onModelLoaderLoadingFinished, Qt::QueuedConnection);
|
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::loadingFinished, this, &CDbOwnModelsComponent::onModelLoaderLoadingFinished, Qt::QueuedConnection);
|
||||||
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::diskLoadingStarted, this, &CDbOwnModelsComponent::onModelLoaderDiskLoadingStarted, Qt::QueuedConnection);
|
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::diskLoadingStarted, this, &CDbOwnModelsComponent::onModelLoaderDiskLoadingStarted, Qt::QueuedConnection);
|
||||||
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::cacheChanged, this, &CDbOwnModelsComponent::onCacheChanged, Qt::QueuedConnection);
|
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::loadingProgress, this, &CDbOwnModelsComponent::onModelLoadingProgress, Qt::QueuedConnection);
|
||||||
|
connect(&CMultiAircraftModelLoaderProvider::multiModelLoaderInstance(), &CMultiAircraftModelLoaderProvider::cacheChanged, this, &CDbOwnModelsComponent::onCacheChanged, Qt::QueuedConnection);
|
||||||
|
|
||||||
// Last selection isPinned -> no sync needed
|
// Last selection isPinned -> no sync needed
|
||||||
ui->comp_SimulatorSelector->setRememberSelectionAndSetToLastSelection();
|
ui->comp_SimulatorSelector->setRememberSelectionAndSetToLastSelection();
|
||||||
@@ -605,7 +606,14 @@ namespace BlackGui
|
|||||||
void CDbOwnModelsComponent::onModelLoaderDiskLoadingStarted(const CSimulatorInfo &simulator, IAircraftModelLoader::LoadMode mode)
|
void CDbOwnModelsComponent::onModelLoaderDiskLoadingStarted(const CSimulatorInfo &simulator, IAircraftModelLoader::LoadMode mode)
|
||||||
{
|
{
|
||||||
const CStatusMessage msg = CLogMessage(this).info(u"Started disk loading for '%1' in mode '%2'") << simulator.toQString(true) << IAircraftModelLoader::enumToString(mode);
|
const CStatusMessage msg = CLogMessage(this).info(u"Started disk loading for '%1' in mode '%2'") << simulator.toQString(true) << IAircraftModelLoader::enumToString(mode);
|
||||||
this->showOverlayMessage(msg, 5000);
|
this->showOverlayHTMLMessage(msg, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDbOwnModelsComponent::onModelLoadingProgress(const CSimulatorInfo &simulator, const QString &message, int progress)
|
||||||
|
{
|
||||||
|
CStatusMessage loadingMsg = CStatusMessage(this).info(u"%1 loading: %2") << simulator.toQString(true) << message;
|
||||||
|
this->showOverlayHTMLMessage(loadingMsg, 5000);
|
||||||
|
Q_UNUSED(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDbOwnModelsComponent::onModelLoaderLoadingFinished(const CStatusMessageList &statusMessages, const CSimulatorInfo &simulator, IAircraftModelLoader::LoadFinishedInfo info)
|
void CDbOwnModelsComponent::onModelLoaderLoadingFinished(const CStatusMessageList &statusMessages, const CSimulatorInfo &simulator, IAircraftModelLoader::LoadFinishedInfo info)
|
||||||
@@ -628,7 +636,10 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
|
|
||||||
// overlay
|
// overlay
|
||||||
if (!m.isEmpty() && info == IAircraftModelLoader::ParsedData) { this->showOverlayMessage(m, 5000); }
|
if (!m.isEmpty() && info == IAircraftModelLoader::ParsedData)
|
||||||
|
{
|
||||||
|
this->showOverlayHTMLMessage(m, 5000);
|
||||||
|
}
|
||||||
|
|
||||||
// signal
|
// signal
|
||||||
emit this->successfullyLoadedModels(simulator, modelsLoaded);
|
emit this->successfullyLoadedModels(simulator, modelsLoaded);
|
||||||
|
|||||||
@@ -143,6 +143,9 @@ namespace BlackGui
|
|||||||
//! On disk loading started
|
//! On disk loading started
|
||||||
void onModelLoaderDiskLoadingStarted(const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadMode mode);
|
void onModelLoaderDiskLoadingStarted(const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadMode mode);
|
||||||
|
|
||||||
|
//! Loading in progress
|
||||||
|
void onModelLoadingProgress(const BlackMisc::Simulation::CSimulatorInfo &simulator, const QString &message, int progress);
|
||||||
|
|
||||||
//! Model loading finished
|
//! Model loading finished
|
||||||
void onModelLoaderLoadingFinished(const BlackMisc::CStatusMessageList &statusMessages, const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadFinishedInfo info);
|
void onModelLoaderLoadingFinished(const BlackMisc::CStatusMessageList &statusMessages, const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadFinishedInfo info);
|
||||||
|
|
||||||
|
|||||||
@@ -275,9 +275,10 @@ namespace BlackMisc
|
|||||||
IAircraftModelLoader *CMultiAircraftModelLoaderProvider::initLoader(const CSimulatorInfo &simulator)
|
IAircraftModelLoader *CMultiAircraftModelLoaderProvider::initLoader(const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
IAircraftModelLoader *loader = IAircraftModelLoader::createModelLoader(simulator, this);
|
IAircraftModelLoader *loader = IAircraftModelLoader::createModelLoader(simulator, this);
|
||||||
connect(loader, &IAircraftModelLoader::loadingFinished, this, &CMultiAircraftModelLoaderProvider::loadingFinished);
|
connect(loader, &IAircraftModelLoader::loadingFinished, this, &CMultiAircraftModelLoaderProvider::loadingFinished);
|
||||||
connect(loader, &IAircraftModelLoader::diskLoadingStarted, this, &CMultiAircraftModelLoaderProvider::diskLoadingStarted);
|
connect(loader, &IAircraftModelLoader::diskLoadingStarted, this, &CMultiAircraftModelLoaderProvider::diskLoadingStarted);
|
||||||
connect(loader, &IAircraftModelLoader::cacheChanged, this, &CMultiAircraftModelLoaderProvider::cacheChanged);
|
connect(loader, &IAircraftModelLoader::cacheChanged, this, &CMultiAircraftModelLoaderProvider::cacheChanged);
|
||||||
|
connect(loader, &IAircraftModelLoader::loadingProgress, this, &CMultiAircraftModelLoaderProvider::loadingProgress);
|
||||||
return loader;
|
return loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,12 @@ namespace BlackMisc
|
|||||||
//! \remark does to fire if the cache has been changed elsewhere and it has just been reloaded here!
|
//! \remark does to fire if the cache has been changed elsewhere and it has just been reloaded here!
|
||||||
void loadingFinished(const BlackMisc::CStatusMessageList &status, const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadFinishedInfo info);
|
void loadingFinished(const BlackMisc::CStatusMessageList &status, const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadFinishedInfo info);
|
||||||
|
|
||||||
|
//! Loading progress, normally from disk
|
||||||
|
//! \param simulator corresponding simulator
|
||||||
|
//! \param message a progress message which can be sent by each individual loader implementation as needed
|
||||||
|
//! \param progressPercentage 0-100 or -1 if not available
|
||||||
|
void loadingProgress(const BlackMisc::Simulation::CSimulatorInfo &simulator, const QString &message, int progressPercentage);
|
||||||
|
|
||||||
//! Relayed from centralized caches
|
//! Relayed from centralized caches
|
||||||
//! \remark this can result from loading, the cache changed elsewhere or clearing data
|
//! \remark this can result from loading, the cache changed elsewhere or clearing data
|
||||||
void cacheChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void cacheChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
@@ -224,6 +230,9 @@ namespace BlackMisc
|
|||||||
//! \copydoc IAircraftModelLoader::diskLoadingStarted
|
//! \copydoc IAircraftModelLoader::diskLoadingStarted
|
||||||
void diskLoadingStarted(const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadMode mode);
|
void diskLoadingStarted(const BlackMisc::Simulation::CSimulatorInfo &simulator, BlackMisc::Simulation::IAircraftModelLoader::LoadMode mode);
|
||||||
|
|
||||||
|
//! \copydoc IAircraftModelLoader::loadingProgress
|
||||||
|
void loadingProgress(const BlackMisc::Simulation::CSimulatorInfo &simulator, const QString &message, int progressPercentage);
|
||||||
|
|
||||||
//! \copydoc IAircraftModelLoader::cacheChanged
|
//! \copydoc IAircraftModelLoader::cacheChanged
|
||||||
void cacheChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void cacheChanged(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user