Formatting

This commit is contained in:
Klaus Basan
2017-08-26 15:04:17 +02:00
committed by Mathew Sutcliffe
parent 9ba61cacf6
commit 2dfc56dc39
2 changed files with 47 additions and 47 deletions

View File

@@ -147,12 +147,12 @@ namespace BlackGui
void CDbMappingComponent::initVPilotLoading() void CDbMappingComponent::initVPilotLoading()
{ {
this->m_vPilotEnabled = this->vPilotSupport && this->m_swiftDbUser.get().hasAdminRole(); m_vPilotEnabled = this->vPilotSupport && m_swiftDbUser.get().hasAdminRole();
static const QString tabName(ui->tw_ModelsToBeMapped->tabText(TabVPilot)); static const QString tabName(ui->tw_ModelsToBeMapped->tabText(TabVPilot));
if (this->m_vPilot1stInit && vPilotSupport) if (m_vPilot1stInit && vPilotSupport)
{ {
this->m_vPilot1stInit = false; m_vPilot1stInit = false;
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected); connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::doubleClicked, this, &CDbMappingComponent::ps_onModelRowSelected);
connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::ps_onVPilotDataChanged); connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::modelDataChanged, this, &CDbMappingComponent::ps_onVPilotDataChanged);
connect(&m_vPilotReader, &CVPilotRulesReader::readFinished, this, &CDbMappingComponent::ps_onLoadVPilotDataFinished); connect(&m_vPilotReader, &CVPilotRulesReader::readFinished, this, &CDbMappingComponent::ps_onLoadVPilotDataFinished);
@@ -170,9 +170,9 @@ namespace BlackGui
const int noModels = vPilotModels.size(); const int noModels = vPilotModels.size();
CLogMessage(this).info("%1 cached vPilot models loaded") << noModels; CLogMessage(this).info("%1 cached vPilot models loaded") << noModels;
} }
ui->tab_VPilot->setEnabled(this->m_vPilotEnabled); ui->tab_VPilot->setEnabled(m_vPilotEnabled);
ui->tab_VPilot->setVisible(this->m_vPilotEnabled); ui->tab_VPilot->setVisible(m_vPilotEnabled);
if (this->m_vPilotEnabled) if (m_vPilotEnabled)
{ {
// create / restore tab // create / restore tab
ui->tw_ModelsToBeMapped->addTab(ui->tab_VPilot, tabName); ui->tw_ModelsToBeMapped->addTab(ui->tab_VPilot, tabName);
@@ -181,15 +181,15 @@ namespace BlackGui
} }
else else
{ {
this->m_vPilotFormatted = false; m_vPilotFormatted = false;
ui->tw_ModelsToBeMapped->removeTab(TabVPilot); ui->tw_ModelsToBeMapped->removeTab(TabVPilot);
} }
} }
void CDbMappingComponent::formatVPilotView() void CDbMappingComponent::formatVPilotView()
{ {
if (!this->m_vPilotEnabled || this->m_vPilotFormatted) { return; } if (!m_vPilotEnabled || m_vPilotFormatted) { return; }
this->m_vPilotFormatted = true; m_vPilotFormatted = true;
ui->tvp_AircraftModelsForVPilot->presizeOrFullResizeToContents(); ui->tvp_AircraftModelsForVPilot->presizeOrFullResizeToContents();
} }
@@ -225,7 +225,7 @@ namespace BlackGui
void CDbMappingComponent::gracefulShutdown() void CDbMappingComponent::gracefulShutdown()
{ {
this->disconnect(); this->disconnect();
this->m_vPilotReader.gracefulShutdown(); m_vPilotReader.gracefulShutdown();
ui->comp_OwnAircraftModels->gracefulShutdown(); ui->comp_OwnAircraftModels->gracefulShutdown();
} }
@@ -402,12 +402,12 @@ namespace BlackGui
void CDbMappingComponent::ps_displayAutoStashingDialog() void CDbMappingComponent::ps_displayAutoStashingDialog()
{ {
this->m_autoStashDialog->exec(); m_autoStashDialog->exec();
} }
void CDbMappingComponent::ps_displayAutoSimulatorStashingDialog() void CDbMappingComponent::ps_displayAutoSimulatorStashingDialog()
{ {
this->m_autoSimulatorDialog->exec(); m_autoSimulatorDialog->exec();
} }
void CDbMappingComponent::ps_removeDbModelsFromView() void CDbMappingComponent::ps_removeDbModelsFromView()
@@ -436,7 +436,7 @@ namespace BlackGui
void CDbMappingComponent::ps_toggleAutoFiltering() void CDbMappingComponent::ps_toggleAutoFiltering()
{ {
this->m_autoFilterInDbViews = !this->m_autoFilterInDbViews; m_autoFilterInDbViews = !m_autoFilterInDbViews;
} }
void CDbMappingComponent::ps_applyFormLiveryData() void CDbMappingComponent::ps_applyFormLiveryData()
@@ -486,12 +486,12 @@ namespace BlackGui
// only one model selected, use as default // only one model selected, use as default
if (ui->comp_StashAircraft->view()->hasSingleSelectedRow()) if (ui->comp_StashAircraft->view()->hasSingleSelectedRow())
{ {
this->m_modelModifyDialog->setValue(ui->comp_StashAircraft->view()->selectedObject()); m_modelModifyDialog->setValue(ui->comp_StashAircraft->view()->selectedObject());
} }
const QDialog::DialogCode s = static_cast<QDialog::DialogCode>(this->m_modelModifyDialog->exec()); const QDialog::DialogCode s = static_cast<QDialog::DialogCode>(m_modelModifyDialog->exec());
if (s == QDialog::Rejected) { return; } if (s == QDialog::Rejected) { return; }
const CPropertyIndexVariantMap vm = this->m_modelModifyDialog->getValues(); const CPropertyIndexVariantMap vm = m_modelModifyDialog->getValues();
ui->comp_StashAircraft->applyToSelected(vm); ui->comp_StashAircraft->applyToSelected(vm);
} }
@@ -534,7 +534,7 @@ namespace BlackGui
void CDbMappingComponent::ps_loadVPilotData() void CDbMappingComponent::ps_loadVPilotData()
{ {
if (this->m_vPilotReader.readInBackground(true)) if (m_vPilotReader.readInBackground(true))
{ {
CLogMessage(this).info("Start loading vPilot rulesets"); CLogMessage(this).info("Start loading vPilot rulesets");
ui->tvp_AircraftModelsForVPilot->showLoadIndicator(); ui->tvp_AircraftModelsForVPilot->showLoadIndicator();
@@ -551,7 +551,7 @@ namespace BlackGui
if (success) if (success)
{ {
CLogMessage(this).info("Loading vPilot ruleset completed"); CLogMessage(this).info("Loading vPilot ruleset completed");
const CAircraftModelList models(this->m_vPilotReader.getAsModels()); const CAircraftModelList models(m_vPilotReader.getAsModels());
if (ui->tvp_AircraftModelsForVPilot->displayAutomatically()) if (ui->tvp_AircraftModelsForVPilot->displayAutomatically())
{ {
ui->tvp_AircraftModelsForVPilot->updateContainerMaybeAsync(models); ui->tvp_AircraftModelsForVPilot->updateContainerMaybeAsync(models);
@@ -568,7 +568,7 @@ namespace BlackGui
{ {
if (ui->tvp_AircraftModelsForVPilot->displayAutomatically()) if (ui->tvp_AircraftModelsForVPilot->displayAutomatically())
{ {
ui->tvp_AircraftModelsForVPilot->updateContainerMaybeAsync(this->m_vPilotReader.getAsModelsFromCache()); ui->tvp_AircraftModelsForVPilot->updateContainerMaybeAsync(m_vPilotReader.getAsModelsFromCache());
} }
else else
{ {
@@ -685,30 +685,30 @@ namespace BlackGui
void CDbMappingComponent::ps_mergeWithVPilotModels() void CDbMappingComponent::ps_mergeWithVPilotModels()
{ {
if (!ui->comp_OwnAircraftModels->modelLoader()) { return; } if (!ui->comp_OwnAircraftModels->modelLoader()) { return; }
if (this->m_vPilotReader.getModelsCount() < 1) { return; } if (m_vPilotReader.getModelsCount() < 1) { return; }
const CSimulatorInfo sim(ui->comp_OwnAircraftModels->getOwnModelsSimulator()); const CSimulatorInfo sim(ui->comp_OwnAircraftModels->getOwnModelsSimulator());
if (!sim.isSingleSimulator() || !sim.isMicrosoftOrPrepare3DSimulator()) { return; } if (!sim.isSingleSimulator() || !sim.isMicrosoftOrPrepare3DSimulator()) { return; }
CAircraftModelList ownModels(getOwnModels()); CAircraftModelList ownModels(getOwnModels());
if (ownModels.isEmpty()) { return; } if (ownModels.isEmpty()) { return; }
ui->comp_OwnAircraftModels->view()->showLoadIndicator(); ui->comp_OwnAircraftModels->view()->showLoadIndicator();
CAircraftModelUtilities::mergeWithVPilotData(ownModels, this->m_vPilotReader.getAsModelsFromCache(), true); CAircraftModelUtilities::mergeWithVPilotData(ownModels, m_vPilotReader.getAsModelsFromCache(), true);
ui->comp_OwnAircraftModels->updateViewAndCache(ownModels); ui->comp_OwnAircraftModels->updateViewAndCache(ownModels);
} }
void CDbMappingComponent::ps_mergeSelectedWithVPilotModels() void CDbMappingComponent::ps_mergeSelectedWithVPilotModels()
{ {
if (!ui->comp_OwnAircraftModels->modelLoader()) { return; } if (!ui->comp_OwnAircraftModels->modelLoader()) { return; }
if (this->m_vPilotReader.getModelsCount() < 1) { return; } if (m_vPilotReader.getModelsCount() < 1) { return; }
if (!ui->comp_OwnAircraftModels->view()->hasSelection()) { return; } if (!ui->comp_OwnAircraftModels->view()->hasSelection()) { return; }
const CSimulatorInfo sim(ui->comp_OwnAircraftModels->getOwnModelsSimulator()); const CSimulatorInfo sim(ui->comp_OwnAircraftModels->getOwnModelsSimulator());
if (!sim.isSingleSimulator() || !sim.isMicrosoftOrPrepare3DSimulator()) { return; } if (!sim.isSingleSimulator() || !sim.isMicrosoftOrPrepare3DSimulator()) { return; }
CAircraftModelList ownModels(this->getOwnSelectedModels()); // subset CAircraftModelList ownModels(this->getOwnSelectedModels()); // subset
if (ownModels.isEmpty()) { return; } if (ownModels.isEmpty()) { return; }
ui->comp_OwnAircraftModels->view()->showLoadIndicator(); ui->comp_OwnAircraftModels->view()->showLoadIndicator();
CAircraftModelUtilities::mergeWithVPilotData(ownModels, this->m_vPilotReader.getAsModelsFromCache(), true); CAircraftModelUtilities::mergeWithVPilotData(ownModels, m_vPilotReader.getAsModelsFromCache(), true);
// full models // full models
CAircraftModelList allModels = this->m_vPilotReader.getAsModelsFromCache(); CAircraftModelList allModels = m_vPilotReader.getAsModelsFromCache();
allModels.replaceOrAddModelsWithString(ownModels, Qt::CaseInsensitive); allModels.replaceOrAddModelsWithString(ownModels, Qt::CaseInsensitive);
ui->comp_OwnAircraftModels->updateViewAndCache(allModels); ui->comp_OwnAircraftModels->updateViewAndCache(allModels);
} }
@@ -808,7 +808,7 @@ namespace BlackGui
} }
// request filtering // request filtering
if (this->m_autoFilterInDbViews) if (m_autoFilterInDbViews)
{ {
emit filterByLivery(model.getLivery()); emit filterByLivery(model.getLivery());
emit filterByAircraftIcao(model.getAircraftIcaoCode()); emit filterByAircraftIcao(model.getAircraftIcaoCode());
@@ -914,7 +914,7 @@ namespace BlackGui
const bool canUseVPilot = mappingComponent()->withVPilot(); const bool canUseVPilot = mappingComponent()->withVPilot();
if (canUseVPilot) if (canUseVPilot)
{ {
this->m_menuAction = menuActions.addAction(this->m_menuAction, CIcons::appMappings16(), "Load vPilot Rules", CMenuAction::pathVPilot(), this, { mapComp, &CDbMappingComponent::ps_loadVPilotData }); m_menuAction = menuActions.addAction(m_menuAction, CIcons::appMappings16(), "Load vPilot Rules", CMenuAction::pathVPilot(), this, { mapComp, &CDbMappingComponent::ps_loadVPilotData });
} }
this->nestedCustomMenu(menuActions); this->nestedCustomMenu(menuActions);
} }
@@ -937,12 +937,12 @@ namespace BlackGui
menuActions.addMenuStash(); menuActions.addMenuStash();
// auto filter in DB views // auto filter in DB views
this->m_stashFiltering = menuActions.addAction(this->m_stashFiltering, CIcons::filter16(), "Auto filtering in DB views (on/off)", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_toggleAutoFiltering }); m_stashFiltering = menuActions.addAction(m_stashFiltering, CIcons::filter16(), "Auto filtering in DB views (on/off)", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_toggleAutoFiltering });
this->m_stashFiltering->setCheckable(true); m_stashFiltering->setCheckable(true);
this->m_stashFiltering->setChecked(mapComp->m_autoFilterInDbViews); m_stashFiltering->setChecked(mapComp->m_autoFilterInDbViews);
this->m_autoStashing = menuActions.addAction(this->m_autoStashing, CIcons::appDbStash16(), "Auto stashing", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_displayAutoStashingDialog }); m_autoStashing = menuActions.addAction(m_autoStashing, CIcons::appDbStash16(), "Auto stashing", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_displayAutoStashingDialog });
this->m_autoSimulatorStashing = menuActions.addAction(this->m_autoSimulatorStashing, CIcons::appDbStash16(), "Cross simulator updating (FSX-P3D-FS9)", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_displayAutoSimulatorStashingDialog }); m_autoSimulatorStashing = menuActions.addAction(m_autoSimulatorStashing, CIcons::appDbStash16(), "Cross simulator updating (FSX-P3D-FS9)", CMenuAction::pathStash(), this, { mapComp, &CDbMappingComponent::ps_displayAutoSimulatorStashingDialog });
if (mapComp->m_autoStashDialog && mapComp->m_autoStashDialog->isCompleted()) if (mapComp->m_autoStashDialog && mapComp->m_autoStashDialog->isCompleted())
{ {
menuActions.addAction(CIcons::appDbStash16(), "Last auto stash run", CMenuAction::pathStash(), nullptr, { mapComp->m_autoStashDialog.data(), &CDbAutoStashingComponent::showLastResults }); menuActions.addAction(CIcons::appDbStash16(), "Last auto stash run", CMenuAction::pathStash(), nullptr, { mapComp->m_autoStashDialog.data(), &CDbAutoStashingComponent::showLastResults });
@@ -986,7 +986,7 @@ namespace BlackGui
if (mapComp->canAddToModelSetTab()) if (mapComp->canAddToModelSetTab())
{ {
menuActions.addMenuModelSet(); menuActions.addMenuModelSet();
this->m_menuAction = menuActions.addAction(this->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 });
} }
this->nestedCustomMenu(menuActions); this->nestedCustomMenu(menuActions);
} }
@@ -1003,15 +1003,15 @@ namespace BlackGui
if (mapComp->currentTabIndex() == CDbMappingComponent::TabStash && mapComp->currentModelView()->hasSelection()) if (mapComp->currentTabIndex() == CDbMappingComponent::TabStash && mapComp->currentModelView()->hasSelection())
{ {
if (this->m_menuActions.isEmpty()) { this->m_menuActions = QList<QAction *>({ nullptr, nullptr, nullptr, nullptr }); } if (m_menuActions.isEmpty()) { m_menuActions = QList<QAction *>({ nullptr, nullptr, nullptr, nullptr }); }
// stash view and selection // stash view and selection
menuActions.addMenuStashEditor(); menuActions.addMenuStashEditor();
this->m_menuActions[0] = menuActions.addAction(this->m_menuActions[0], CIcons::appAircraftIcao16(), "Current aircraft ICAO", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormAircraftIcaoData }); m_menuActions[0] = menuActions.addAction(m_menuActions[0], CIcons::appAircraftIcao16(), "Current aircraft ICAO", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormAircraftIcaoData });
this->m_menuActions[1] = menuActions.addAction(this->m_menuActions[1], CIcons::appDistributors16(), "Current distributor", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormDistributorData }); m_menuActions[1] = menuActions.addAction(m_menuActions[1], CIcons::appDistributors16(), "Current distributor", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormDistributorData });
this->m_menuActions[2] = menuActions.addAction(this->m_menuActions[2], CIcons::appLiveries16(), "Current livery", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormLiveryData }); m_menuActions[2] = menuActions.addAction(m_menuActions[2], CIcons::appLiveries16(), "Current livery", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::ps_applyFormLiveryData });
this->m_menuActions[3] = menuActions.addAction(this->m_menuActions[3], CIcons::databaseTable16(), "Modify DB model data", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::modifyModelDialog }); m_menuActions[3] = menuActions.addAction(m_menuActions[3], CIcons::databaseTable16(), "Modify DB model data", CMenuAction::pathStashEditor(), this, { mapComp, &CDbMappingComponent::modifyModelDialog });
} }
this->nestedCustomMenu(menuActions); this->nestedCustomMenu(menuActions);
} }
@@ -1037,12 +1037,12 @@ namespace BlackGui
return; return;
} }
if (this->m_menuActions.isEmpty()) { this->m_menuActions = QList<QAction *>({ nullptr, nullptr }); } if (m_menuActions.isEmpty()) { m_menuActions = QList<QAction *>({ nullptr, nullptr }); }
menuActions.addMenu("Merge with vPilot data", CMenuAction::pathVPilot()); menuActions.addMenu("Merge with vPilot data", CMenuAction::pathVPilot());
this->m_menuActions[0] = menuActions.addAction(this->m_menuActions[0], "All", CMenuAction::pathVPilot(), this, { mappingComponent(), &CDbMappingComponent::ps_mergeWithVPilotModels }); m_menuActions[0] = menuActions.addAction(m_menuActions[0], "All", CMenuAction::pathVPilot(), this, { mappingComponent(), &CDbMappingComponent::ps_mergeWithVPilotModels });
if (mv->hasSelection()) if (mv->hasSelection())
{ {
this->m_menuActions[1] = menuActions.addAction(this->m_menuActions[1], "Selected only", CMenuAction::pathVPilot(), this, { mappingComponent(), &CDbMappingComponent::ps_mergeSelectedWithVPilotModels }); m_menuActions[1] = menuActions.addAction(m_menuActions[1], "Selected only", CMenuAction::pathVPilot(), this, { mappingComponent(), &CDbMappingComponent::ps_mergeSelectedWithVPilotModels });
} }
this->nestedCustomMenu(menuActions); this->nestedCustomMenu(menuActions);
} }

View File

@@ -71,7 +71,7 @@ namespace BlackGui
Q_OBJECT Q_OBJECT
public: public:
//! Tab index //! Tab index.
//! Must match real tab index //! Must match real tab index
enum TabIndex enum TabIndex
{ {
@@ -310,12 +310,12 @@ namespace BlackGui
void ps_onCustomContextMenu(const QPoint &point); void ps_onCustomContextMenu(const QPoint &point);
private: private:
QScopedPointer<Ui::CDbMappingComponent> ui; QScopedPointer<Ui::CDbMappingComponent> ui;
QScopedPointer<CDbAutoStashingComponent> m_autoStashDialog; //!< dialog auto stashing QScopedPointer<CDbAutoStashingComponent> m_autoStashDialog; //!< dialog auto stashing
QScopedPointer<CDbAutoSimulatorStashingComponent> m_autoSimulatorDialog; //!< dialog auto simulator update QScopedPointer<CDbAutoSimulatorStashingComponent> m_autoSimulatorDialog; //!< dialog auto simulator update
QScopedPointer<CDbModelMappingModifyComponent> m_modelModifyDialog; //!< dialog when modifying models QScopedPointer<CDbModelMappingModifyComponent> m_modelModifyDialog; //!< dialog when modifying models
BlackMisc::Simulation::FsCommon::CVPilotRulesReader m_vPilotReader; //!< read vPilot rules BlackMisc::Simulation::FsCommon::CVPilotRulesReader m_vPilotReader; //!< read vPilot rules
BlackMisc::CDigestSignal m_dsStashedModelsChanged { this, &CDbMappingComponent::ps_digestStashedModelsChanged, &CDbMappingComponent::ps_onStashedModelsChangedDigest, 750, 25 }; BlackMisc::CDigestSignal m_dsStashedModelsChanged { this, &CDbMappingComponent::ps_digestStashedModelsChanged, &CDbMappingComponent::ps_onStashedModelsChangedDigest, 750, 25 };
BlackMisc::CData<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser { this }; BlackMisc::CData<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser { this };
const bool vPilotSupport = true; //!< vPilot support (will be removed in future) const bool vPilotSupport = true; //!< vPilot support (will be removed in future)
bool m_vPilot1stInit = true; //!< vPilot extensions initalized? bool m_vPilot1stInit = true; //!< vPilot extensions initalized?