mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
Fixed some formatting for T152 (before changing the classes)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
2d8c2ea930
commit
725341cdbe
@@ -210,7 +210,8 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool c = connect(this->m_modelLoader.get(), &IAircraftModelLoader::loadingFinished, this, &CDbOwnModelsComponent::ps_onOwnModelsLoadingFinished);
|
const bool c = connect(this->m_modelLoader.get(), &IAircraftModelLoader::loadingFinished,
|
||||||
|
this, &CDbOwnModelsComponent::ps_onOwnModelsLoadingFinished, Qt::QueuedConnection);
|
||||||
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect for model loader");
|
Q_ASSERT_X(c, Q_FUNC_INFO, "Failed connect for model loader");
|
||||||
Q_UNUSED(c);
|
Q_UNUSED(c);
|
||||||
this->setSaveFileName(simulator);
|
this->setSaveFileName(simulator);
|
||||||
@@ -440,7 +441,7 @@ namespace BlackGui
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLogMessage(this).info("Starting loading for %1") << simulator.toQString();
|
CLogMessage(this).info("Starting loading for '%1'") << simulator.toQString();
|
||||||
ui->tvp_OwnAircraftModels->showLoadIndicator();
|
ui->tvp_OwnAircraftModels->showLoadIndicator();
|
||||||
Q_ASSERT_X(sGui && sGui->getWebDataServices(), Q_FUNC_INFO, "missing web data services");
|
Q_ASSERT_X(sGui && sGui->getWebDataServices(), Q_FUNC_INFO, "missing web data services");
|
||||||
this->m_modelLoader->startLoading(mode, static_cast<int (*)(CAircraftModelList &, bool)>(&CDatabaseUtils::consolidateModelsWithDbData), directory);
|
this->m_modelLoader->startLoading(mode, static_cast<int (*)(CAircraftModelList &, bool)>(&CDatabaseUtils::consolidateModelsWithDbData), directory);
|
||||||
|
|||||||
@@ -138,13 +138,13 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbOwnModelsComponent> ui;
|
QScopedPointer<Ui::CDbOwnModelsComponent> ui;
|
||||||
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models
|
std::unique_ptr<BlackMisc::Simulation::IAircraftModelLoader> m_modelLoader; //!< read own aircraft models, aka models on disk
|
||||||
BlackMisc::CDataReadOnly<BlackMisc::Simulation::Data::TModelCacheLastSelection> m_simulatorSelection { this }; //!< last selection
|
BlackMisc::CDataReadOnly<BlackMisc::Simulation::Data::TModelCacheLastSelection> m_simulatorSelection { this }; //!< last selection
|
||||||
|
|
||||||
//! Init or change model loader
|
//! Init or change model loader
|
||||||
bool initModelLoader(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
bool initModelLoader(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
//! File name for savinf
|
//! File name for saving as file
|
||||||
void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
void setSaveFileName(const BlackMisc::Simulation::CSimulatorInfo &sim);
|
||||||
|
|
||||||
//! Directory selector for given simulator
|
//! Directory selector for given simulator
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ namespace BlackMisc
|
|||||||
IAircraftModelLoader::IAircraftModelLoader(const CSimulatorInfo &simulator)
|
IAircraftModelLoader::IAircraftModelLoader(const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Only one simulator per loader");
|
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Only one simulator per loader");
|
||||||
this->m_caches.setCurrentSimulator(simulator);
|
m_caches.setCurrentSimulator(simulator);
|
||||||
|
|
||||||
// first connect is an internal connection to log info about load status
|
// first connect is an internal connection to log info about load status
|
||||||
connect(this, &IAircraftModelLoader::loadingFinished, this, &IAircraftModelLoader::ps_loadFinished);
|
connect(this, &IAircraftModelLoader::loadingFinished, this, &IAircraftModelLoader::ps_loadFinished);
|
||||||
connect(&this->m_caches, &IMultiSimulatorModelCaches::cacheChanged, this, &IAircraftModelLoader::ps_cacheChanged);
|
connect(&m_caches, &IMultiSimulatorModelCaches::cacheChanged, this, &IAircraftModelLoader::ps_cacheChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
IAircraftModelLoader::~IAircraftModelLoader()
|
IAircraftModelLoader::~IAircraftModelLoader()
|
||||||
@@ -50,14 +50,14 @@ namespace BlackMisc
|
|||||||
CStatusMessage IAircraftModelLoader::setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
CStatusMessage IAircraftModelLoader::setCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->getSimulator(); // support default value
|
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->getSimulator(); // support default value
|
||||||
return this->m_caches.setCachedModels(models, sim);
|
return m_caches.setCachedModels(models, sim);
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessage IAircraftModelLoader::replaceOrAddCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
CStatusMessage IAircraftModelLoader::replaceOrAddCachedModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
|
||||||
{
|
{
|
||||||
if (models.isEmpty()) { return CStatusMessage(this, CStatusMessage::SeverityInfo, "No data"); }
|
if (models.isEmpty()) { return CStatusMessage(this, CStatusMessage::SeverityInfo, "No data"); }
|
||||||
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->getSimulator(); // support default values
|
const CSimulatorInfo sim = simulator.isSingleSimulator() ? simulator : this->getSimulator(); // support default values
|
||||||
CAircraftModelList allModels(this->m_caches.getSynchronizedCachedModels(sim));
|
CAircraftModelList allModels(m_caches.getSynchronizedCachedModels(sim));
|
||||||
const int c = allModels.replaceOrAddModelsWithString(models, Qt::CaseInsensitive);
|
const int c = allModels.replaceOrAddModelsWithString(models, Qt::CaseInsensitive);
|
||||||
if (c > 0)
|
if (c > 0)
|
||||||
{
|
{
|
||||||
@@ -75,11 +75,11 @@ namespace BlackMisc
|
|||||||
|
|
||||||
// remark: in the past status used to be bool, now it is CStatusMessage
|
// remark: in the past status used to be bool, now it is CStatusMessage
|
||||||
// so there is some redundancy here between status and m_loadingMessages
|
// so there is some redundancy here between status and m_loadingMessages
|
||||||
this->m_loadingInProgress = false;
|
m_loadingInProgress = false;
|
||||||
|
|
||||||
if (this->m_loadingMessages.hasWarningOrErrorMessages())
|
if (m_loadingMessages.hasWarningOrErrorMessages())
|
||||||
{
|
{
|
||||||
CLogMessage::preformatted(this->m_loadingMessages);
|
CLogMessage::preformatted(m_loadingMessages);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -95,39 +95,39 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QStringList IAircraftModelLoader::getModelDirectoriesOrDefault() const
|
QStringList IAircraftModelLoader::getModelDirectoriesOrDefault() const
|
||||||
{
|
{
|
||||||
const QStringList mdirs = this->m_settings.getModelDirectoriesOrDefault(this->getSimulator());
|
const QStringList mdirs = m_settings.getModelDirectoriesOrDefault(this->getSimulator());
|
||||||
return mdirs;
|
return mdirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IAircraftModelLoader::getFirstModelDirectoryOrDefault() const
|
QString IAircraftModelLoader::getFirstModelDirectoryOrDefault() const
|
||||||
{
|
{
|
||||||
const QString md = this->m_settings.getFirstModelDirectoryOrDefault(this->getSimulator());
|
const QString md = m_settings.getFirstModelDirectoryOrDefault(this->getSimulator());
|
||||||
return md;
|
return md;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList IAircraftModelLoader::getModelExcludeDirectoryPatterns() const
|
QStringList IAircraftModelLoader::getModelExcludeDirectoryPatterns() const
|
||||||
{
|
{
|
||||||
return this->m_settings.getModelExcludeDirectoryPatternsOrDefault(this->getSimulator());
|
return m_settings.getModelExcludeDirectoryPatternsOrDefault(this->getSimulator());
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftModelList IAircraftModelLoader::getAircraftModels() const
|
CAircraftModelList IAircraftModelLoader::getAircraftModels() const
|
||||||
{
|
{
|
||||||
return this->m_caches.getCurrentCachedModels();
|
return m_caches.getCurrentCachedModels();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAircraftModelList IAircraftModelLoader::getCachedAircraftModels(const CSimulatorInfo &simulator) const
|
CAircraftModelList IAircraftModelLoader::getCachedAircraftModels(const CSimulatorInfo &simulator) const
|
||||||
{
|
{
|
||||||
return this->m_caches.getCachedModels(simulator);
|
return m_caches.getCachedModels(simulator);
|
||||||
}
|
}
|
||||||
|
|
||||||
QDateTime IAircraftModelLoader::getCacheTimestamp() const
|
QDateTime IAircraftModelLoader::getCacheTimestamp() const
|
||||||
{
|
{
|
||||||
return this->m_caches.getCurrentCacheTimestamp();
|
return m_caches.getCurrentCacheTimestamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IAircraftModelLoader::hasCachedData() const
|
bool IAircraftModelLoader::hasCachedData() const
|
||||||
{
|
{
|
||||||
return !this->m_caches.getCurrentCachedModels().isEmpty();
|
return !m_caches.getCurrentCachedModels().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
CStatusMessage IAircraftModelLoader::clearCache()
|
CStatusMessage IAircraftModelLoader::clearCache()
|
||||||
@@ -137,12 +137,12 @@ namespace BlackMisc
|
|||||||
|
|
||||||
void IAircraftModelLoader::startLoading(LoadMode mode, const ModelConsolidation &modelConsolidation, const QString &directory)
|
void IAircraftModelLoader::startLoading(LoadMode mode, const ModelConsolidation &modelConsolidation, const QString &directory)
|
||||||
{
|
{
|
||||||
if (this->m_loadingInProgress) { return; }
|
if (m_loadingInProgress) { return; }
|
||||||
this->m_loadingInProgress = true;
|
m_loadingInProgress = true;
|
||||||
const bool useCachedData = !mode.testFlag(CacheSkipped) && this->hasCachedData();
|
const bool useCachedData = !mode.testFlag(CacheSkipped) && this->hasCachedData();
|
||||||
if (useCachedData && (mode.testFlag(CacheFirst) || mode.testFlag(CacheOnly)))
|
if (useCachedData && (mode.testFlag(CacheFirst) || mode.testFlag(CacheOnly)))
|
||||||
{
|
{
|
||||||
// we just jus cache data
|
// we just just cache data
|
||||||
static const CStatusMessage status(this, CStatusMessage::SeverityInfo, "Using cached data");
|
static const CStatusMessage status(this, CStatusMessage::SeverityInfo, "Using cached data");
|
||||||
emit loadingFinished(status, this->getSimulator(), CacheLoaded);
|
emit loadingFinished(status, this->getSimulator(), CacheLoaded);
|
||||||
return;
|
return;
|
||||||
@@ -152,7 +152,7 @@ namespace BlackMisc
|
|||||||
// only cache, but we did not find any data yet (still in progress?)
|
// only cache, but we did not find any data yet (still in progress?)
|
||||||
// here we rely on the cache load slot, no need to emit here, will
|
// here we rely on the cache load slot, no need to emit here, will
|
||||||
// be done later in ps_cacheChanged. An alternative was to sync cache here
|
// be done later in ps_cacheChanged. An alternative was to sync cache here
|
||||||
this->m_loadingInProgress = false;
|
m_loadingInProgress = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
const CSimulatorInfo IAircraftModelLoader::getSimulator() const
|
const CSimulatorInfo IAircraftModelLoader::getSimulator() const
|
||||||
{
|
{
|
||||||
return this->m_caches.getCurrentSimulator();
|
return m_caches.getCurrentSimulator();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IAircraftModelLoader::getSimulatorAsString() const
|
QString IAircraftModelLoader::getSimulatorAsString() const
|
||||||
@@ -177,8 +177,8 @@ namespace BlackMisc
|
|||||||
|
|
||||||
void IAircraftModelLoader::cancelLoading()
|
void IAircraftModelLoader::cancelLoading()
|
||||||
{
|
{
|
||||||
this->m_cancelLoading = true;
|
m_cancelLoading = true;
|
||||||
this->m_loadingInProgress = true;
|
m_loadingInProgress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IAircraftModelLoader::gracefulShutdown()
|
void IAircraftModelLoader::gracefulShutdown()
|
||||||
@@ -188,12 +188,12 @@ namespace BlackMisc
|
|||||||
|
|
||||||
QString IAircraftModelLoader::getInfoString() const
|
QString IAircraftModelLoader::getInfoString() const
|
||||||
{
|
{
|
||||||
return this->m_caches.getInfoString();
|
return m_caches.getInfoString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IAircraftModelLoader::getInfoStringFsFamily() const
|
QString IAircraftModelLoader::getInfoStringFsFamily() const
|
||||||
{
|
{
|
||||||
return this->m_caches.getInfoStringFsFamily();
|
return m_caches.getInfoStringFsFamily();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<IAircraftModelLoader> IAircraftModelLoader::createModelLoader(const CSimulatorInfo &simulator)
|
std::unique_ptr<IAircraftModelLoader> IAircraftModelLoader::createModelLoader(const CSimulatorInfo &simulator)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
CSimulatorInfo IMultiSimulatorModelCaches::getSimulatorForFilename(const QString &filename) const
|
CSimulatorInfo IMultiSimulatorModelCaches::getSimulatorForFilename(const QString &filename) const
|
||||||
{
|
{
|
||||||
if (filename.isEmpty()) return CSimulatorInfo();
|
if (filename.isEmpty()) { return CSimulatorInfo(); }
|
||||||
CSimulatorInfo sims;
|
CSimulatorInfo sims;
|
||||||
const QString compareFileName(QFileInfo(filename).fileName());
|
const QString compareFileName(QFileInfo(filename).fileName());
|
||||||
for (const CSimulatorInfo &singleSim : CSimulatorInfo::allSimulatorsSet())
|
for (const CSimulatorInfo &singleSim : CSimulatorInfo::allSimulatorsSet())
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ namespace BlackMisc
|
|||||||
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetCacheXP> m_modelCacheXP {this, &CModelSetCaches::changedXP }; //!< XP cache
|
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetCacheXP> m_modelCacheXP {this, &CModelSetCaches::changedXP }; //!< XP cache
|
||||||
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetLastSelection> m_currentSimulator { this }; //!< current simulator
|
BlackMisc::CData<BlackMisc::Simulation::Data::TModelSetLastSelection> m_currentSimulator { this }; //!< current simulator
|
||||||
|
|
||||||
//! Non virtaul version (can be used in ctor)
|
//! Non virtual version (can be used in ctor)
|
||||||
void synchronizeCacheImpl(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
void synchronizeCacheImpl(const BlackMisc::Simulation::CSimulatorInfo &simulator);
|
||||||
|
|
||||||
//! Non virtual version (can be used in ctor)
|
//! Non virtual version (can be used in ctor)
|
||||||
|
|||||||
Reference in New Issue
Block a user