Formatting, "this->m_" to "m_", comments

This commit is contained in:
Klaus Basan
2017-09-19 02:40:45 +02:00
committed by Mathew Sutcliffe
parent 2f577b7209
commit 65bc1c00fb
4 changed files with 121 additions and 131 deletions

View File

@@ -231,14 +231,10 @@ namespace BlackGui
const TabIndex tab = currentTabIndex(); const TabIndex tab = currentTabIndex();
switch (tab) switch (tab)
{ {
case TabOwnModels: case TabOwnModels: return ui->comp_OwnAircraftModels->view()->hasSelectedModelsToStash();
return ui->comp_OwnAircraftModels->view()->hasSelectedModelsToStash(); case TabOwnModelSet: return ui->comp_OwnModelSet->view()->hasSelectedModelsToStash();
case TabOwnModelSet: case TabVPilot: return ui->tvp_AircraftModelsForVPilot->hasSelectedModelsToStash();
return ui->comp_OwnModelSet->view()->hasSelectedModelsToStash(); default: break;
case TabVPilot:
return ui->tvp_AircraftModelsForVPilot->hasSelectedModelsToStash();
default:
break;
} }
return false; return false;
} }
@@ -248,16 +244,11 @@ namespace BlackGui
const TabIndex tab = currentTabIndex(); const TabIndex tab = currentTabIndex();
switch (tab) switch (tab)
{ {
case TabOwnModels: case TabOwnModels: return ui->comp_OwnAircraftModels->view();
return ui->comp_OwnAircraftModels->view(); case TabVPilot: return ui->tvp_AircraftModelsForVPilot;
case TabVPilot: case TabStash: return ui->comp_StashAircraft->view();
return ui->tvp_AircraftModelsForVPilot; case TabOwnModelSet: return ui->comp_OwnModelSet->view();
case TabStash: default: return nullptr;
return ui->comp_StashAircraft->view();
case TabOwnModelSet:
return ui->comp_OwnModelSet->view();
default:
return nullptr;
} }
} }
@@ -308,14 +299,10 @@ namespace BlackGui
const TabIndex tab = currentTabIndex(); const TabIndex tab = currentTabIndex();
switch (tab) switch (tab)
{ {
case TabOwnModels: case TabOwnModels: return ui->comp_OwnAircraftModels->view()->selectedObjects();
return ui->comp_OwnAircraftModels->view()->selectedObjects(); case TabOwnModelSet: return ui->comp_OwnModelSet->view()->selectedObjects();
case TabOwnModelSet: case TabVPilot: return ui->tvp_AircraftModelsForVPilot->selectedObjects();
return ui->comp_OwnModelSet->view()->selectedObjects(); default: break;
case TabVPilot:
return ui->tvp_AircraftModelsForVPilot->selectedObjects();
default:
break;
} }
return CAircraftModelList(); return CAircraftModelList();
} }
@@ -983,7 +970,10 @@ namespace BlackGui
if (mapComp->canAddToModelSetTab()) if (mapComp->canAddToModelSetTab())
{ {
menuActions.addMenuModelSet(); menuActions.addMenuModelSet();
m_menuAction = menuActions.addAction(m_menuAction, CIcons::appModels16(), "Add to own model set", CMenuAction::pathModelSet(), this, { mapComp, &CDbMappingComponent::ps_addToOwnModelSet }); m_menuAction = menuActions.addAction(m_menuAction, CIcons::appModels16(),
"Add to own model set", CMenuAction::pathModelSet(),
this, { mapComp, &CDbMappingComponent::ps_addToOwnModelSet },
CShortcut::keyAddToModelSet());
} }
this->nestedCustomMenu(menuActions); this->nestedCustomMenu(menuActions);
} }

View File

@@ -52,12 +52,12 @@ namespace BlackGui
connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::requestUpdate, this, &CDbOwnModelsComponent::ps_requestOwnModelsUpdate); connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::requestUpdate, this, &CDbOwnModelsComponent::ps_requestOwnModelsUpdate);
// Last selection isPinned -> no sync needed // Last selection isPinned -> no sync needed
const CSimulatorInfo simulator(this->m_simulatorSelection.get()); const CSimulatorInfo simulator(m_simulatorSelection.get());
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator"); Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
const bool success = this->initModelLoader(simulator); const bool success = this->initModelLoader(simulator);
if (success) if (success)
{ {
this->m_modelLoader->startLoading(IAircraftModelLoader::CacheOnly); m_modelLoader->startLoading(IAircraftModelLoader::CacheOnly);
} }
else else
{ {
@@ -95,27 +95,27 @@ namespace BlackGui
IAircraftModelLoader *CDbOwnModelsComponent::modelLoader() const IAircraftModelLoader *CDbOwnModelsComponent::modelLoader() const
{ {
return this->m_modelLoader.get(); return m_modelLoader.get();
} }
CAircraftModel CDbOwnModelsComponent::getOwnModelForModelString(const QString &modelString) const CAircraftModel CDbOwnModelsComponent::getOwnModelForModelString(const QString &modelString) const
{ {
if (!this->m_modelLoader) { return CAircraftModel(); } if (!m_modelLoader) { return CAircraftModel(); }
return this->m_modelLoader->getAircraftModels().findFirstByModelStringOrDefault(modelString); return m_modelLoader->getAircraftModels().findFirstByModelStringOrDefault(modelString);
} }
CAircraftModelList CDbOwnModelsComponent::getOwnModels() const CAircraftModelList CDbOwnModelsComponent::getOwnModels() const
{ {
static const CAircraftModelList empty; static const CAircraftModelList empty;
if (!this->m_modelLoader) { return empty; } if (!m_modelLoader) { return empty; }
return this->m_modelLoader->getAircraftModels(); return m_modelLoader->getAircraftModels();
} }
CAircraftModelList CDbOwnModelsComponent::getOwnCachedModels(const CSimulatorInfo &simulator) const CAircraftModelList CDbOwnModelsComponent::getOwnCachedModels(const CSimulatorInfo &simulator) const
{ {
static const CAircraftModelList empty; static const CAircraftModelList empty;
if (!this->m_modelLoader) { return empty; } if (!m_modelLoader) { return empty; }
return this->m_modelLoader->getCachedAircraftModels(simulator); return m_modelLoader->getCachedAircraftModels(simulator);
} }
CAircraftModelList CDbOwnModelsComponent::getOwnSelectedModels() const CAircraftModelList CDbOwnModelsComponent::getOwnSelectedModels() const
@@ -126,8 +126,8 @@ namespace BlackGui
const CSimulatorInfo CDbOwnModelsComponent::getOwnModelsSimulator() const const CSimulatorInfo CDbOwnModelsComponent::getOwnModelsSimulator() const
{ {
static const CSimulatorInfo noSim; static const CSimulatorInfo noSim;
if (!this->m_modelLoader) { return noSim; } if (!m_modelLoader) { return noSim; }
return this->m_modelLoader->getSimulator(); return m_modelLoader->getSimulator();
} }
void CDbOwnModelsComponent::setSimulator(const CSimulatorInfo &simulator) void CDbOwnModelsComponent::setSimulator(const CSimulatorInfo &simulator)
@@ -138,25 +138,25 @@ namespace BlackGui
int CDbOwnModelsComponent::getOwnModelsCount() const int CDbOwnModelsComponent::getOwnModelsCount() const
{ {
if (!this->m_modelLoader) { return 0; } if (!m_modelLoader) { return 0; }
return this->m_modelLoader->getAircraftModelsCount(); return m_modelLoader->getAircraftModelsCount();
} }
QString CDbOwnModelsComponent::getInfoString() const QString CDbOwnModelsComponent::getInfoString() const
{ {
if (!this->m_modelLoader) { return ""; } if (!m_modelLoader) { return ""; }
return this->m_modelLoader->getInfoString(); return m_modelLoader->getInfoString();
} }
QString CDbOwnModelsComponent::getInfoStringFsFamily() const QString CDbOwnModelsComponent::getInfoStringFsFamily() const
{ {
if (!this->m_modelLoader) { return ""; } if (!m_modelLoader) { return ""; }
return this->m_modelLoader->getInfoStringFsFamily(); return m_modelLoader->getInfoStringFsFamily();
} }
CStatusMessage CDbOwnModelsComponent::updateViewAndCache(const CAircraftModelList &models) CStatusMessage CDbOwnModelsComponent::updateViewAndCache(const CAircraftModelList &models)
{ {
const CStatusMessage m = this->m_modelLoader->setCachedModels(models, this->getOwnModelsSimulator()); const CStatusMessage m = m_modelLoader->setCachedModels(models, this->getOwnModelsSimulator());
if (m.isSuccess()) if (m.isSuccess())
{ {
ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(models); ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(models);
@@ -166,7 +166,7 @@ namespace BlackGui
void CDbOwnModelsComponent::gracefulShutdown() void CDbOwnModelsComponent::gracefulShutdown()
{ {
if (this->m_modelLoader) { this->m_modelLoader->gracefulShutdown(); } if (m_modelLoader) { m_modelLoader->gracefulShutdown(); }
} }
void CDbOwnModelsComponent::setModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) void CDbOwnModelsComponent::setModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
@@ -178,7 +178,7 @@ namespace BlackGui
void CDbOwnModelsComponent::updateModels(const CAircraftModelList &models, const CSimulatorInfo &simulator) void CDbOwnModelsComponent::updateModels(const CAircraftModelList &models, const CSimulatorInfo &simulator)
{ {
this->modelLoader()->replaceOrAddCachedModels(models, simulator); this->modelLoader()->replaceOrAddCachedModels(models, simulator);
const CAircraftModelList allModels(this->m_modelLoader->getAircraftModels()); const CAircraftModelList allModels(m_modelLoader->getAircraftModels());
ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(allModels); ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(allModels);
} }
@@ -188,29 +188,29 @@ namespace BlackGui
Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator"); Q_ASSERT_X(simulator.isSingleSimulator(), Q_FUNC_INFO, "Need single simulator");
// already loaded // already loaded
if (this->m_modelLoader && this->m_modelLoader->supportsSimulator(simulator)) if (m_modelLoader && m_modelLoader->supportsSimulator(simulator))
{ {
this->setSaveFileName(simulator); this->setSaveFileName(simulator);
return true; return true;
} }
// mismatching loader // mismatching loader
if (this->m_modelLoader) if (m_modelLoader)
{ {
this->m_modelLoader->gracefulShutdown(); m_modelLoader->gracefulShutdown();
} }
// create loader, also synchronizes the caches // create loader, also synchronizes the caches
this->m_modelLoader = IAircraftModelLoader::createModelLoader(simulator); // last selected simulator or explicit given m_modelLoader = IAircraftModelLoader::createModelLoader(simulator); // last selected simulator or explicit given
if (!this->m_modelLoader || !this->m_modelLoader->supportsSimulator(simulator)) if (!m_modelLoader || !m_modelLoader->supportsSimulator(simulator))
{ {
CLogMessage(this).error("Failed to init model loader %1") << simulator.toQString(); CLogMessage(this).error("Failed to init model loader %1") << simulator.toQString();
this->m_modelLoader.reset(); m_modelLoader.reset();
return false; return false;
} }
else else
{ {
const bool c = connect(this->m_modelLoader.get(), &IAircraftModelLoader::loadingFinished, const bool c = connect(m_modelLoader.get(), &IAircraftModelLoader::loadingFinished,
this, &CDbOwnModelsComponent::ps_onOwnModelsLoadingFinished, Qt::QueuedConnection); 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);
@@ -244,80 +244,80 @@ namespace BlackGui
CDbOwnModelsComponent *ownModelsComp = qobject_cast<CDbOwnModelsComponent *>(this->parent()); CDbOwnModelsComponent *ownModelsComp = qobject_cast<CDbOwnModelsComponent *>(this->parent());
Q_ASSERT_X(ownModelsComp, Q_FUNC_INFO, "Cannot access parent"); Q_ASSERT_X(ownModelsComp, Q_FUNC_INFO, "Cannot access parent");
if (this->m_loadActions.isEmpty()) { this->m_loadActions = QList<QAction *>({nullptr, nullptr, nullptr, nullptr}); } if (m_loadActions.isEmpty()) { m_loadActions = QList<QAction *>({nullptr, nullptr, nullptr, nullptr}); }
menuActions.addMenuSimulator(); menuActions.addMenuSimulator();
if (sims.fsx()) if (sims.fsx())
{ {
if (!this->m_loadActions[0]) if (!m_loadActions[0])
{ {
this->m_loadActions[0] = new QAction(CIcons::appModels16(), "FSX models", this); m_loadActions[0] = new QAction(CIcons::appModels16(), "FSX models", this);
connect(this->m_loadActions[0], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_loadActions[0], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
ownModelsComp->ps_requestSimulatorModelsWithCacheInBackground(CSimulatorInfo(CSimulatorInfo::FSX)); ownModelsComp->ps_requestSimulatorModelsWithCacheInBackground(CSimulatorInfo(CSimulatorInfo::FSX));
}); });
} }
menuActions.addAction(this->m_loadActions[0], CMenuAction::pathSimulator()); menuActions.addAction(m_loadActions[0], CMenuAction::pathSimulator());
} }
if (sims.p3d()) if (sims.p3d())
{ {
if (!this->m_loadActions[1]) if (!m_loadActions[1])
{ {
this->m_loadActions[1] = new QAction(CIcons::appModels16(), "P3D models", this); m_loadActions[1] = new QAction(CIcons::appModels16(), "P3D models", this);
connect(this->m_loadActions[1], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_loadActions[1], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
ownModelsComp->ps_requestSimulatorModelsWithCacheInBackground(CSimulatorInfo(CSimulatorInfo::P3D)); ownModelsComp->ps_requestSimulatorModelsWithCacheInBackground(CSimulatorInfo(CSimulatorInfo::P3D));
}); });
} }
menuActions.addAction(this->m_loadActions[1], CMenuAction::pathSimulator()); menuActions.addAction(m_loadActions[1], CMenuAction::pathSimulator());
} }
if (sims.fs9()) if (sims.fs9())
{ {
if (!this->m_loadActions[2]) if (!m_loadActions[2])
{ {
this->m_loadActions[2] = new QAction(CIcons::appModels16(), "FS9 models", this); m_loadActions[2] = new QAction(CIcons::appModels16(), "FS9 models", this);
connect(this->m_loadActions[2], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_loadActions[2], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
ownModelsComp->ps_requestSimulatorModelsWithCacheInBackground(CSimulatorInfo(CSimulatorInfo::FS9)); ownModelsComp->ps_requestSimulatorModelsWithCacheInBackground(CSimulatorInfo(CSimulatorInfo::FS9));
}); });
} }
menuActions.addAction(this->m_loadActions[2], CMenuAction::pathSimulator()); menuActions.addAction(m_loadActions[2], CMenuAction::pathSimulator());
} }
if (sims.xplane()) if (sims.xplane())
{ {
if (!this->m_loadActions[3]) if (!m_loadActions[3])
{ {
this->m_loadActions[3] = new QAction(CIcons::appModels16(), "XPlane models", this); m_loadActions[3] = new QAction(CIcons::appModels16(), "XPlane models", this);
connect(this->m_loadActions[3], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_loadActions[3], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
ownModelsComp->ps_requestSimulatorModelsWithCacheInBackground(CSimulatorInfo(CSimulatorInfo::XPLANE)); ownModelsComp->ps_requestSimulatorModelsWithCacheInBackground(CSimulatorInfo(CSimulatorInfo::XPLANE));
}); });
} }
menuActions.addAction(this->m_loadActions[3], CMenuAction::pathSimulator()); menuActions.addAction(m_loadActions[3], CMenuAction::pathSimulator());
} }
// with models loaded I allow a refresh reload // with models loaded I allow a refresh reload
// I need those models because I want to merge with DM data in the loader // I need those models because I want to merge with DM data in the loader
if (sGui->getWebDataServices() && sGui->getWebDataServices()->getModelsCount() > 0) if (sGui->getWebDataServices() && sGui->getWebDataServices()->getModelsCount() > 0)
{ {
if (this->m_reloadActions.isEmpty()) { this->m_reloadActions = QList<QAction *>({nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}); } if (m_reloadActions.isEmpty()) { m_reloadActions = QList<QAction *>({nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}); }
menuActions.addMenu(CIcons::refresh16(), "Force model reload", CMenuAction::pathSimulatorModelsReload()); menuActions.addMenu(CIcons::refresh16(), "Force model reload", CMenuAction::pathSimulatorModelsReload());
if (sims.fsx()) if (sims.fsx())
{ {
if (!this->m_reloadActions[0]) if (!m_reloadActions[0])
{ {
this->m_reloadActions[0] = new QAction(CIcons::appModels16(), "FSX models", this); m_reloadActions[0] = new QAction(CIcons::appModels16(), "FSX models", this);
connect(this->m_reloadActions[0], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_reloadActions[0], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
ownModelsComp->ps_requestSimulatorModels(CSimulatorInfo(CSimulatorInfo::FSX), IAircraftModelLoader::InBackgroundNoCache); ownModelsComp->ps_requestSimulatorModels(CSimulatorInfo(CSimulatorInfo::FSX), IAircraftModelLoader::InBackgroundNoCache);
}); });
this->m_reloadActions[1] = new QAction(CIcons::appModels16(), "FSX models from directory", this); m_reloadActions[1] = new QAction(CIcons::appModels16(), "FSX models from directory", this);
connect(this->m_reloadActions[1], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_reloadActions[1], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
const CSimulatorInfo sim(CSimulatorInfo::FSX); const CSimulatorInfo sim(CSimulatorInfo::FSX);
@@ -328,22 +328,22 @@ namespace BlackGui
} }
}); });
} }
menuActions.addAction(this->m_reloadActions[0], CMenuAction::pathSimulatorModelsReload()); menuActions.addAction(m_reloadActions[0], CMenuAction::pathSimulatorModelsReload());
menuActions.addAction(this->m_reloadActions[1], CMenuAction::pathSimulatorModelsReload()); menuActions.addAction(m_reloadActions[1], CMenuAction::pathSimulatorModelsReload());
} }
if (sims.p3d()) if (sims.p3d())
{ {
if (!this->m_reloadActions[2]) if (!m_reloadActions[2])
{ {
this->m_reloadActions[2] = new QAction(CIcons::appModels16(), "P3D models", this); m_reloadActions[2] = new QAction(CIcons::appModels16(), "P3D models", this);
connect(this->m_reloadActions[2], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_reloadActions[2], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
ownModelsComp->ps_requestSimulatorModels(CSimulatorInfo(CSimulatorInfo::P3D), IAircraftModelLoader::InBackgroundNoCache); ownModelsComp->ps_requestSimulatorModels(CSimulatorInfo(CSimulatorInfo::P3D), IAircraftModelLoader::InBackgroundNoCache);
}); });
this->m_reloadActions[3] = new QAction(CIcons::appModels16(), "P3D models from directoy", this); m_reloadActions[3] = new QAction(CIcons::appModels16(), "P3D models from directoy", this);
connect(this->m_reloadActions[3], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_reloadActions[3], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
const CSimulatorInfo sim(CSimulatorInfo::P3D); const CSimulatorInfo sim(CSimulatorInfo::P3D);
@@ -354,22 +354,22 @@ namespace BlackGui
} }
}); });
} }
menuActions.addAction(this->m_reloadActions[2], CMenuAction::pathSimulatorModelsReload()); menuActions.addAction(m_reloadActions[2], CMenuAction::pathSimulatorModelsReload());
menuActions.addAction(this->m_reloadActions[3], CMenuAction::pathSimulatorModelsReload()); menuActions.addAction(m_reloadActions[3], CMenuAction::pathSimulatorModelsReload());
} }
if (sims.fs9()) if (sims.fs9())
{ {
if (!this->m_reloadActions[4]) if (!m_reloadActions[4])
{ {
this->m_reloadActions[4] = new QAction(CIcons::appModels16(), "FS9 models", this); m_reloadActions[4] = new QAction(CIcons::appModels16(), "FS9 models", this);
connect(this->m_reloadActions[4], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_reloadActions[4], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
ownModelsComp->ps_requestSimulatorModels(CSimulatorInfo(CSimulatorInfo::FS9), IAircraftModelLoader::InBackgroundNoCache); ownModelsComp->ps_requestSimulatorModels(CSimulatorInfo(CSimulatorInfo::FS9), IAircraftModelLoader::InBackgroundNoCache);
}); });
this->m_reloadActions[5] = new QAction(CIcons::appModels16(), "FS9 models from directoy", this); m_reloadActions[5] = new QAction(CIcons::appModels16(), "FS9 models from directoy", this);
connect(this->m_reloadActions[5], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_reloadActions[5], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
const CSimulatorInfo sim(CSimulatorInfo::FS9); const CSimulatorInfo sim(CSimulatorInfo::FS9);
@@ -380,21 +380,21 @@ namespace BlackGui
} }
}); });
} }
menuActions.addAction(this->m_reloadActions[4], CMenuAction::pathSimulatorModelsReload()); menuActions.addAction(m_reloadActions[4], CMenuAction::pathSimulatorModelsReload());
menuActions.addAction(this->m_reloadActions[5], CMenuAction::pathSimulatorModelsReload()); menuActions.addAction(m_reloadActions[5], CMenuAction::pathSimulatorModelsReload());
} }
if (sims.xplane()) if (sims.xplane())
{ {
if (!this->m_reloadActions[6]) if (!m_reloadActions[6])
{ {
this->m_reloadActions[6] = new QAction(CIcons::appModels16(), "XPlane models", this); m_reloadActions[6] = new QAction(CIcons::appModels16(), "XPlane models", this);
connect(this->m_reloadActions[6], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_reloadActions[6], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
ownModelsComp->ps_requestSimulatorModels(CSimulatorInfo(CSimulatorInfo::XPLANE), IAircraftModelLoader::InBackgroundNoCache); ownModelsComp->ps_requestSimulatorModels(CSimulatorInfo(CSimulatorInfo::XPLANE), IAircraftModelLoader::InBackgroundNoCache);
}); });
this->m_reloadActions[7] = new QAction(CIcons::appModels16(), "XPlane models from directoy", this); m_reloadActions[7] = new QAction(CIcons::appModels16(), "XPlane models from directoy", this);
connect(this->m_reloadActions[7], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked) connect(m_reloadActions[7], &QAction::triggered, ownModelsComp, [ownModelsComp](bool checked)
{ {
Q_UNUSED(checked); Q_UNUSED(checked);
const CSimulatorInfo sim(CSimulatorInfo::XPLANE); const CSimulatorInfo sim(CSimulatorInfo::XPLANE);
@@ -405,8 +405,8 @@ namespace BlackGui
} }
}); });
} }
menuActions.addAction(this->m_reloadActions[6], CMenuAction::pathSimulatorModelsReload()); menuActions.addAction(m_reloadActions[6], CMenuAction::pathSimulatorModelsReload());
menuActions.addAction(this->m_reloadActions[7], CMenuAction::pathSimulatorModelsReload()); menuActions.addAction(m_reloadActions[7], CMenuAction::pathSimulatorModelsReload());
} }
} }
else else
@@ -421,9 +421,9 @@ namespace BlackGui
void CDbOwnModelsComponent::ps_requestOwnModelsUpdate() void CDbOwnModelsComponent::ps_requestOwnModelsUpdate()
{ {
if (!this->m_modelLoader) { return; } if (!m_modelLoader) { return; }
ui->tvp_OwnAircraftModels->updateContainerMaybeAsync( ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(
this->m_modelLoader->getAircraftModels() m_modelLoader->getAircraftModels()
); );
} }
@@ -435,7 +435,7 @@ namespace BlackGui
return; return;
} }
if (this->m_modelLoader->isLoadingInProgress()) if (m_modelLoader->isLoadingInProgress())
{ {
CLogMessage(this).info("Loading for '%1' already in progress") << simulator.toQString(); CLogMessage(this).info("Loading for '%1' already in progress") << simulator.toQString();
return; return;
@@ -444,15 +444,15 @@ namespace BlackGui
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); m_modelLoader->startLoading(mode, static_cast<int (*)(CAircraftModelList &, bool)>(&CDatabaseUtils::consolidateModelsWithDbData), directory);
} }
void CDbOwnModelsComponent::ps_onOwnModelsLoadingFinished(const CStatusMessage &status, const CSimulatorInfo &simulator, IAircraftModelLoader::LoadFinishedInfo info) void CDbOwnModelsComponent::ps_onOwnModelsLoadingFinished(const CStatusMessage &status, 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");
if (status.isSuccess() && this->m_modelLoader) if (status.isSuccess() && m_modelLoader)
{ {
const CAircraftModelList models(this->m_modelLoader->getAircraftModels()); const CAircraftModelList models(m_modelLoader->getAircraftModels());
const int modelsLoaded = models.size(); const int modelsLoaded = models.size();
ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(models); ui->tvp_OwnAircraftModels->updateContainerMaybeAsync(models);
if (modelsLoaded < 1) if (modelsLoaded < 1)
@@ -487,9 +487,9 @@ namespace BlackGui
void CDbOwnModelsComponent::ps_onSimulatorChanged() void CDbOwnModelsComponent::ps_onSimulatorChanged()
{ {
const CSimulatorInfo sim(ui->comp_SimulatorSelector->getValue()); const CSimulatorInfo simulator(ui->comp_SimulatorSelector->getValue());
ui->tvp_OwnAircraftModels->setSimulatorForLoading(sim); ui->tvp_OwnAircraftModels->setSimulatorForLoading(simulator);
this->ps_requestSimulatorModelsWithCacheInBackground(sim); this->ps_requestSimulatorModelsWithCacheInBackground(simulator);
} }
} // ns } // ns
} // ns } // ns

View File

@@ -67,20 +67,20 @@ namespace BlackGui
switch (mode) switch (mode)
{ {
case CAircraftModelListModel::StashModel: case CAircraftModelListModel::StashModel:
this->m_menus = MenuDefaultNoClear; m_menus = MenuDefaultNoClear;
break; break;
case CAircraftModelListModel::Database: case CAircraftModelListModel::Database:
this->m_menus = MenuDefaultDbViews; m_menus = MenuDefaultDbViews;
break; break;
case CAircraftModelListModel::VPilotRuleModel: case CAircraftModelListModel::VPilotRuleModel:
this->m_menus = MenuDefaultNoClear | MenuStashing; m_menus = MenuDefaultNoClear | MenuStashing;
break; break;
case CAircraftModelListModel::OwnAircraftModelMappingTool: case CAircraftModelListModel::OwnAircraftModelMappingTool:
this->m_menus = MenuDefaultNoClear | MenuStashing | MenuLoadAndSave; m_menus = MenuDefaultNoClear | MenuStashing | MenuLoadAndSave;
break; break;
case CAircraftModelListModel::OwnAircraftModelClient: case CAircraftModelListModel::OwnAircraftModelClient:
default: default:
this->m_menus = MenuDefaultNoClear | MenuBackend; m_menus = MenuDefaultNoClear | MenuBackend;
break; break;
} }
} }
@@ -120,8 +120,8 @@ namespace BlackGui
void CAircraftModelView::setAcceptedMetaTypeIds() void CAircraftModelView::setAcceptedMetaTypeIds()
{ {
Q_ASSERT(this->m_model); Q_ASSERT(m_model);
this->m_model->setAcceptedMetaTypeIds( m_model->setAcceptedMetaTypeIds(
{ {
qMetaTypeId<CAirlineIcaoCode>(), qMetaTypeId<CAirlineIcaoCodeList>(), qMetaTypeId<CAirlineIcaoCode>(), qMetaTypeId<CAirlineIcaoCodeList>(),
qMetaTypeId<CAircraftIcaoCode>(), qMetaTypeId<CAircraftIcaoCodeList>(), qMetaTypeId<CAircraftIcaoCode>(), qMetaTypeId<CAircraftIcaoCodeList>(),
@@ -289,15 +289,15 @@ namespace BlackGui
void CAircraftModelView::customMenu(CMenuActions &menuActions) void CAircraftModelView::customMenu(CMenuActions &menuActions)
{ {
bool used = false; bool used = false;
if (this->m_menus.testFlag(MenuCanStashModels)) if (m_menus.testFlag(MenuCanStashModels))
{ {
if (!this->m_menuFlagActions.contains(MenuCanStashModels)) if (!m_menuFlagActions.contains(MenuCanStashModels))
{ {
CMenuActions ma; CMenuActions ma;
ma.addAction(CIcons::appDbStash16(), "Stash selected", CMenuAction::pathStash(), { this, &CAircraftModelView::ps_requestStash }); ma.addAction(CIcons::appDbStash16(), "Stash selected", CMenuAction::pathStash(), { this, &CAircraftModelView::ps_requestStash });
QAction *added = ma.addAction(CIcons::appDbStash16(), "Stashing clears selection (on/off)", CMenuAction::pathStash(), { this, &CAircraftModelView::ps_stashingClearsSelection }); QAction *added = ma.addAction(CIcons::appDbStash16(), "Stashing clears selection (on/off)", CMenuAction::pathStash(), { this, &CAircraftModelView::ps_stashingClearsSelection });
added->setCheckable(true); added->setCheckable(true);
this->m_menuFlagActions.insert(MenuCanStashModels, ma); m_menuFlagActions.insert(MenuCanStashModels, ma);
} }
// modify menu items // modify menu items
@@ -310,15 +310,15 @@ namespace BlackGui
a->setChecked(m_stashingClearsSelection); a->setChecked(m_stashingClearsSelection);
used = true; used = true;
} }
if (this->m_menus.testFlag(MenuHighlightStashed)) if (m_menus.testFlag(MenuHighlightStashed))
{ {
// this function requires that someone provides the model strings to be highlighted // this function requires that someone provides the model strings to be highlighted
if (!this->m_menuFlagActions.contains(MenuHighlightStashed)) if (!m_menuFlagActions.contains(MenuHighlightStashed))
{ {
CMenuActions ma; CMenuActions ma;
QAction *added = ma.addAction(CIcons::appDbStash16(), "Highlight stashed (on/off)", CMenuAction::pathStash(), { this, &CAircraftModelView::ps_toggleHighlightStashedModels }); QAction *added = ma.addAction(CIcons::appDbStash16(), "Highlight stashed (on/off)", CMenuAction::pathStash(), { this, &CAircraftModelView::ps_toggleHighlightStashedModels });
added->setCheckable(true); added->setCheckable(true);
this->m_menuFlagActions.insert(MenuHighlightStashed, ma); m_menuFlagActions.insert(MenuHighlightStashed, ma);
} }
QAction *a = menuActions.addActions(initMenuActions(CViewBaseNonTemplate::MenuHighlightStashed)).first(); QAction *a = menuActions.addActions(initMenuActions(CViewBaseNonTemplate::MenuHighlightStashed)).first();
a->setChecked(this->derivedModel()->highlightModelStrings()); a->setChecked(this->derivedModel()->highlightModelStrings());
@@ -330,22 +330,22 @@ namespace BlackGui
CStatusMessage CAircraftModelView::modifyLoadedJsonData(CAircraftModelList &models) const CStatusMessage CAircraftModelView::modifyLoadedJsonData(CAircraftModelList &models) const
{ {
if (this->m_loadingRequiresSimulator.isNoSimulator()) { return {}; } if (m_loadingRequiresSimulator.isNoSimulator()) { return {}; }
if (models.isEmpty()) { return CStatusMessage(this, CStatusMessage::SeverityDebug, "Empty models", true); } if (models.isEmpty()) { return CStatusMessage(this, CStatusMessage::SeverityDebug, "Empty models", true); }
// multiple sims with same count // multiple sims with same count
const int removed = models.removeIfNotMatchingSimulator(this->m_loadingRequiresSimulator); const int removed = models.removeIfNotMatchingSimulator(m_loadingRequiresSimulator);
if (removed < 1) { return {}; } if (removed < 1) { return {}; }
return CStatusMessage(this, CStatusMessage::SeverityWarning, "Reduced by %1 model(s) to only use %2 models", true) << removed << this->m_loadingRequiresSimulator.toQString(true); return CStatusMessage(this, CStatusMessage::SeverityWarning, "Reduced by %1 model(s) to only use %2 models", true) << removed << m_loadingRequiresSimulator.toQString(true);
} }
CStatusMessage CAircraftModelView::validateLoadedJsonData(const CAircraftModelList &models) const CStatusMessage CAircraftModelView::validateLoadedJsonData(const CAircraftModelList &models) const
{ {
if (models.isEmpty()) { return COrderableViewWithDbObjects::validateLoadedJsonData(models); } if (models.isEmpty()) { return COrderableViewWithDbObjects::validateLoadedJsonData(models); }
if (this->m_loadingRequiresSimulator.isNoSimulator()) { return COrderableViewWithDbObjects::validateLoadedJsonData(models); } if (m_loadingRequiresSimulator.isNoSimulator()) { return COrderableViewWithDbObjects::validateLoadedJsonData(models); }
if (models.containsNotMatchingSimulator(this->m_loadingRequiresSimulator)) if (models.containsNotMatchingSimulator(m_loadingRequiresSimulator))
{ {
return CStatusMessage(this, CStatusMessage::SeverityError, "Found entry not matching %1 in model data", true) << this->m_loadingRequiresSimulator.toQString(); return CStatusMessage(this, CStatusMessage::SeverityError, "Found entry not matching %1 in model data", true) << m_loadingRequiresSimulator.toQString();
} }
return COrderableViewWithDbObjects::validateLoadedJsonData(models); return COrderableViewWithDbObjects::validateLoadedJsonData(models);
} }
@@ -377,7 +377,7 @@ namespace BlackGui
void CAircraftModelView::ps_stashingClearsSelection() void CAircraftModelView::ps_stashingClearsSelection()
{ {
this->m_stashingClearsSelection = !this->m_stashingClearsSelection; m_stashingClearsSelection = !m_stashingClearsSelection;
} }
void CAircraftModelView::ps_requestStash() void CAircraftModelView::ps_requestStash()
@@ -386,7 +386,7 @@ namespace BlackGui
if (!this->hasSelection()) { return; } if (!this->hasSelection()) { return; }
const CAircraftModelList models(this->selectedObjects()); const CAircraftModelList models(this->selectedObjects());
emit requestStash(models); emit requestStash(models);
if (this->m_stashingClearsSelection) if (m_stashingClearsSelection)
{ {
this->clearSelection(); this->clearSelection();
} }

View File

@@ -124,7 +124,7 @@ namespace BlackMisc
void CAircraftModelLoaderXPlane::startLoadingFromDisk(LoadMode mode, const ModelConsolidation &modelConsolidation, const QString &directory) void CAircraftModelLoaderXPlane::startLoadingFromDisk(LoadMode mode, const ModelConsolidation &modelConsolidation, const QString &directory)
{ {
//! \todo according to meeting XP needs to support multiple directories //! \todo KB/MS 2017-09 not high prio, but still needed: according to meeting XP needs to support multiple directories
const CSimulatorInfo simulator = this->getSimulator(); const CSimulatorInfo simulator = this->getSimulator();
const QString modelDirectory(!directory.isEmpty() ? directory : this->getFirstModelDirectoryOrDefault()); // directory const QString modelDirectory(!directory.isEmpty() ? directory : this->getFirstModelDirectoryOrDefault()); // directory
const QStringList excludedDirectoryPatterns(this->m_settings.getModelExcludeDirectoryPatternsOrDefault(simulator)); // copy const QStringList excludedDirectoryPatterns(this->m_settings.getModelExcludeDirectoryPatternsOrDefault(simulator)); // copy