diff --git a/src/blackgui/components/dbmappingcomponent.cpp b/src/blackgui/components/dbmappingcomponent.cpp index fd34e74d1..1f56fb185 100644 --- a/src/blackgui/components/dbmappingcomponent.cpp +++ b/src/blackgui/components/dbmappingcomponent.cpp @@ -83,18 +83,18 @@ namespace BlackGui ui->tvp_AircraftModelsForVPilot->addFilterDialog(); // model menus - ui->comp_OwnAircraftModels->view()->setCustomMenu(new CShowSimulatorFileMenu(ui->comp_OwnAircraftModels->view(), this, true)); + ui->comp_OwnAircraftModels->view()->setCustomMenu(new CShowSimulatorFileMenu(ui->comp_OwnAircraftModels->view(), this)); ui->comp_OwnAircraftModels->view()->setCustomMenu(new CMergeWithVPilotMenu(this)); - ui->comp_OwnAircraftModels->view()->setCustomMenu(new COwnModelSetMenu(this, true)); - ui->comp_OwnAircraftModels->view()->setCustomMenu(new CStashToolsMenu(this, false)); + ui->comp_OwnAircraftModels->view()->setCustomMenu(new COwnModelSetMenu(this)); + ui->comp_OwnAircraftModels->view()->setCustomMenu(new CStashToolsMenu(this)); - ui->comp_OwnModelSet->view()->setCustomMenu(new CShowSimulatorFileMenu(ui->comp_OwnModelSet->view(), this, true)); - ui->comp_OwnModelSet->view()->setCustomMenu(new CStashToolsMenu(this, true)); + ui->comp_OwnModelSet->view()->setCustomMenu(new CShowSimulatorFileMenu(ui->comp_OwnModelSet->view(), this)); + ui->comp_OwnModelSet->view()->setCustomMenu(new CStashToolsMenu(this)); - ui->comp_StashAircraft->view()->setCustomMenu(new CShowSimulatorFileMenu(ui->comp_StashAircraft->view(), this, true)); - ui->comp_StashAircraft->view()->setCustomMenu(new CApplyDbDataMenu(this, true)); - ui->comp_StashAircraft->view()->setCustomMenu(new COwnModelSetMenu(this, true)); - ui->comp_StashAircraft->view()->setCustomMenu(new CStashToolsMenu(this, false)); + ui->comp_StashAircraft->view()->setCustomMenu(new CShowSimulatorFileMenu(ui->comp_StashAircraft->view(), this)); + ui->comp_StashAircraft->view()->setCustomMenu(new CApplyDbDataMenu(this)); + ui->comp_StashAircraft->view()->setCustomMenu(new COwnModelSetMenu(this)); + ui->comp_StashAircraft->view()->setCustomMenu(new CStashToolsMenu(this)); // connects connect(ui->editor_ModelMapping, &CModelMappingForm::requestStash, this, &CDbMappingComponent::stashCurrentModel); @@ -159,8 +159,8 @@ namespace BlackGui connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::toggledHighlightStashedModels, this, &CDbMappingComponent::onStashedModelsChangedTriggerDigest); connect(ui->tvp_AircraftModelsForVPilot, &CAircraftModelView::requestUpdate, this, &CDbMappingComponent::requestVPilotDataUpdate); - ui->tvp_AircraftModelsForVPilot->setCustomMenu(new CMappingVPilotMenu(this, true)); - ui->tvp_AircraftModelsForVPilot->setCustomMenu(new CStashToolsMenu(this, false)); + ui->tvp_AircraftModelsForVPilot->setCustomMenu(new CMappingVPilotMenu(this)); + ui->tvp_AircraftModelsForVPilot->setCustomMenu(new CStashToolsMenu(this)); ui->tvp_AircraftModelsForVPilot->setDisplayAutomatically(true); ui->tvp_AircraftModelsForVPilot->addFilterDialog(); @@ -909,8 +909,8 @@ namespace BlackGui return qobject_cast(this->parent()); } - CDbMappingComponent::CStashToolsMenu::CStashToolsMenu(CDbMappingComponent *mappingComponent, bool separator) : - BlackGui::Menus::IMenuDelegate(mappingComponent, separator) + CDbMappingComponent::CStashToolsMenu::CStashToolsMenu(CDbMappingComponent *mappingComponent) : + Menus::IMenuDelegate(mappingComponent) {} void CDbMappingComponent::CStashToolsMenu::customMenu(CMenuActions &menuActions) @@ -1009,8 +1009,8 @@ namespace BlackGui return qobject_cast(this->parent()); } - CDbMappingComponent::CMergeWithVPilotMenu::CMergeWithVPilotMenu(CDbMappingComponent *mappingComponent, bool separator) : - IMenuDelegate(mappingComponent, separator) + CDbMappingComponent::CMergeWithVPilotMenu::CMergeWithVPilotMenu(CDbMappingComponent *mappingComponent) : + IMenuDelegate(mappingComponent) { Q_ASSERT_X(mappingComponent, Q_FUNC_INFO, "Missing vPilot reader"); } diff --git a/src/blackgui/components/dbmappingcomponent.h b/src/blackgui/components/dbmappingcomponent.h index 6ad69fe3b..4a0331e91 100644 --- a/src/blackgui/components/dbmappingcomponent.h +++ b/src/blackgui/components/dbmappingcomponent.h @@ -111,7 +111,7 @@ namespace BlackGui bool canAddToModelSetTab() const; //! Current model view - BlackGui::Views::CAircraftModelView *currentModelView() const; + Views::CAircraftModelView *currentModelView() const; //! Unvalidated consolidated aircraft model from the editor subparts (icao, distributor) //! \note not guaranteed to be valid, just a snapshot of its current editor state @@ -346,8 +346,8 @@ namespace BlackGui { public: //! Constructor - CMappingVPilotMenu(CDbMappingComponent *mappingComponent, bool separator = true) : - BlackGui::Menus::IMenuDelegate(mappingComponent, separator) + CMappingVPilotMenu(CDbMappingComponent *mappingComponent) : + BlackGui::Menus::IMenuDelegate(mappingComponent) {} //! \copydoc IMenuDelegate::customMenu @@ -366,14 +366,14 @@ namespace BlackGui //! -# toggle stash auto filtering //! -# show changed attributes //! \note This is a specific menu for the CDbMappingComponent component - class CStashToolsMenu : public BlackGui::Menus::IMenuDelegate + class CStashToolsMenu : public Menus::IMenuDelegate { public: //! Constructor - CStashToolsMenu(CDbMappingComponent *mappingComponent, bool separator = true); + CStashToolsMenu(CDbMappingComponent *mappingComponent); //! \copydoc IMenuDelegate::customMenu - virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override; + virtual void customMenu(Menus::CMenuActions &menuActions) override; private: //! Mapping component @@ -388,12 +388,12 @@ namespace BlackGui }; //! Menu for own model sets - class COwnModelSetMenu : public BlackGui::Menus::IMenuDelegate + class COwnModelSetMenu : public Menus::IMenuDelegate { public: //! Constructor - COwnModelSetMenu(CDbMappingComponent *mappingComponent, bool separator = true) : - BlackGui::Menus::IMenuDelegate(mappingComponent, separator) + COwnModelSetMenu(CDbMappingComponent *mappingComponent) : + Menus::IMenuDelegate(mappingComponent) {} //! \copydoc IMenuDelegate::customMenu @@ -407,16 +407,16 @@ namespace BlackGui }; //! Apply DB data to selected models - class CApplyDbDataMenu : public BlackGui::Menus::IMenuDelegate + class CApplyDbDataMenu : public Menus::IMenuDelegate { public: //! Constructor - CApplyDbDataMenu(CDbMappingComponent *mappingComponent, bool separator = true) : - BlackGui::Menus::IMenuDelegate(mappingComponent, separator) + CApplyDbDataMenu(CDbMappingComponent *mappingComponent) : + Menus::IMenuDelegate(mappingComponent) {} //! \copydoc IMenuDelegate::customMenu - virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override; + virtual void customMenu(Menus::CMenuActions &menuActions) override; private: //! Mapping component @@ -427,14 +427,14 @@ namespace BlackGui //! Merge with vPilot data //! \deprecated vPilot menus will be removed in the future - class CMergeWithVPilotMenu : public BlackGui::Menus::IMenuDelegate + class CMergeWithVPilotMenu : public Menus::IMenuDelegate { public: //! Constructor - CMergeWithVPilotMenu(CDbMappingComponent *mappingComponent, bool separator = true); + CMergeWithVPilotMenu(CDbMappingComponent *mappingComponent); //! \copydoc IMenuDelegate::customMenu - virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override; + virtual void customMenu(Menus::CMenuActions &menuActions) override; //! Mapping component CDbMappingComponent *mappingComponent() const; diff --git a/src/blackgui/components/dbownmodelscomponent.cpp b/src/blackgui/components/dbownmodelscomponent.cpp index d20aebe99..77b989d51 100644 --- a/src/blackgui/components/dbownmodelscomponent.cpp +++ b/src/blackgui/components/dbownmodelscomponent.cpp @@ -49,7 +49,7 @@ namespace BlackGui ui->tvp_OwnAircraftModels->setAircraftModelMode(CAircraftModelListModel::OwnAircraftModelMappingTool); ui->tvp_OwnAircraftModels->addFilterDialog(); ui->tvp_OwnAircraftModels->setDisplayAutomatically(true); - ui->tvp_OwnAircraftModels->setCustomMenu(new CLoadModelsMenu(this, true)); + ui->tvp_OwnAircraftModels->setCustomMenu(new CLoadModelsMenu(this)); ui->tvp_OwnAircraftModels->setSimulatorForLoading(ui->comp_SimulatorSelector->getValue()); connect(ui->tvp_OwnAircraftModels, &CAircraftModelView::requestUpdate, this, &CDbOwnModelsComponent::requestOwnModelsUpdate); @@ -73,7 +73,7 @@ namespace BlackGui } // menu - ui->tvp_OwnAircraftModels->setCustomMenu(new CConsolidateWithDbDataMenu(ui->tvp_OwnAircraftModels, this, false)); + ui->tvp_OwnAircraftModels->setCustomMenu(new CConsolidateWithDbDataMenu(ui->tvp_OwnAircraftModels, this)); } CDbOwnModelsComponent::~CDbOwnModelsComponent() diff --git a/src/blackgui/components/dbownmodelscomponent.h b/src/blackgui/components/dbownmodelscomponent.h index 9332e1387..ea4c0f844 100644 --- a/src/blackgui/components/dbownmodelscomponent.h +++ b/src/blackgui/components/dbownmodelscomponent.h @@ -172,16 +172,16 @@ namespace BlackGui //! The menu for loading and handling own models for mapping tasks //! \note This is specific for that very component - class CLoadModelsMenu : public BlackGui::Menus::IMenuDelegate + class CLoadModelsMenu : public Menus::IMenuDelegate { public: //! Constructor - CLoadModelsMenu(CDbOwnModelsComponent *ownModelsComponent, bool separator = true) : - BlackGui::Menus::IMenuDelegate(ownModelsComponent, separator) + CLoadModelsMenu(CDbOwnModelsComponent *ownModelsComponent) : + BlackGui::Menus::IMenuDelegate(ownModelsComponent) {} //! \copydoc IMenuDelegate::customMenu - virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override; + virtual void customMenu(Menus::CMenuActions &menuActions) override; private: QList m_loadActions; //!< load actions diff --git a/src/blackgui/components/dbownmodelsetcomponent.cpp b/src/blackgui/components/dbownmodelsetcomponent.cpp index 4637d2154..0303d3ac9 100644 --- a/src/blackgui/components/dbownmodelsetcomponent.cpp +++ b/src/blackgui/components/dbownmodelsetcomponent.cpp @@ -64,8 +64,8 @@ namespace BlackGui ui->tvp_OwnModelSet->menuAddItems(CAircraftModelView::MenuRemoveSelectedRows | CAircraftModelView::MenuMaterializeFilter); ui->tvp_OwnModelSet->addFilterDialog(); ui->tvp_OwnModelSet->setCustomMenu(new CLoadModelSetMenu(this)); - ui->tvp_OwnModelSet->setCustomMenu(new CConsolidateWithDbDataMenu(ui->tvp_OwnModelSet, this, true)); - ui->tvp_OwnModelSet->setCustomMenu(new CConsolidateWithSimulatorModels(ui->tvp_OwnModelSet, this, false)); + ui->tvp_OwnModelSet->setCustomMenu(new CConsolidateWithDbDataMenu(ui->tvp_OwnModelSet, this)); + ui->tvp_OwnModelSet->setCustomMenu(new CConsolidateWithSimulatorModels(ui->tvp_OwnModelSet, this)); ui->tvp_OwnModelSet->menuAddItems(CAircraftModelView::MenuLoadAndSave); ui->tvp_OwnModelSet->setSorting(CAircraftModel::IndexOrderString); ui->tvp_OwnModelSet->initAsOrderable(); diff --git a/src/blackgui/components/dbownmodelsetcomponent.h b/src/blackgui/components/dbownmodelsetcomponent.h index 92e884d20..df3f1a5b9 100644 --- a/src/blackgui/components/dbownmodelsetcomponent.h +++ b/src/blackgui/components/dbownmodelsetcomponent.h @@ -177,8 +177,8 @@ namespace BlackGui { public: //! Constructor - CLoadModelSetMenu(CDbOwnModelSetComponent *ownModelSetComponent, bool separator = true) : - Menus::IMenuDelegate(ownModelSetComponent, separator) + CLoadModelSetMenu(CDbOwnModelSetComponent *ownModelSetComponent) : + Menus::IMenuDelegate(ownModelSetComponent) {} //! \copydoc IMenuDelegate::customMenu diff --git a/src/blackgui/dockwidget.cpp b/src/blackgui/dockwidget.cpp index e010b988b..7da249629 100644 --- a/src/blackgui/dockwidget.cpp +++ b/src/blackgui/dockwidget.cpp @@ -56,7 +56,7 @@ namespace BlackGui m_input->setMaximumWidth(150); m_marginMenuAction = new QWidgetAction(this); m_marginMenuAction->setDefaultWidget(m_input); - m_fontMenu = new CFontMenu(this, true, Qt::WidgetWithChildrenShortcut); + m_fontMenu = new CFontMenu(this, Qt::WidgetWithChildrenShortcut); this->setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &CDockWidget::customContextMenuRequested, this, &CDockWidget::showContextMenu); diff --git a/src/blackgui/menus/aircraftmodelmenus.cpp b/src/blackgui/menus/aircraftmodelmenus.cpp index 718b1d947..35df78350 100644 --- a/src/blackgui/menus/aircraftmodelmenus.cpp +++ b/src/blackgui/menus/aircraftmodelmenus.cpp @@ -71,8 +71,8 @@ namespace BlackGui return mv->selectedObjects(); } - CShowSimulatorFileMenu::CShowSimulatorFileMenu(CAircraftModelView *modelView, COverlayMessagesFrame *messageFrame, bool separator) : - IAircraftModelViewMenu(modelView, separator), m_messageFrame(messageFrame) + CShowSimulatorFileMenu::CShowSimulatorFileMenu(CAircraftModelView *modelView, COverlayMessagesFrame *messageFrame) : + IAircraftModelViewMenu(modelView), m_messageFrame(messageFrame) { } const CLogCategoryList &CShowSimulatorFileMenu::getLogCategories() @@ -158,8 +158,8 @@ namespace BlackGui // --------------------------------- with DB data --------------------------------- - CConsolidateWithDbDataMenu::CConsolidateWithDbDataMenu(CAircraftModelView *modelView, QObject *modelsTarget, bool separator) : - IAircraftModelViewMenu(modelView, separator), m_modelsTarget(modelsTarget) + CConsolidateWithDbDataMenu::CConsolidateWithDbDataMenu(CAircraftModelView *modelView, QObject *modelsTarget) : + IAircraftModelViewMenu(modelView), m_modelsTarget(modelsTarget) { // it can be the target is not yet known if (modelsTarget) @@ -265,8 +265,8 @@ namespace BlackGui // --------------------------------- with simulator models --------------------------------- - CConsolidateWithSimulatorModels::CConsolidateWithSimulatorModels(CAircraftModelView *modelView, QObject *modelsTarget, bool separator) : - IAircraftModelViewMenu(modelView, separator), m_modelsTarget(modelsTarget) + CConsolidateWithSimulatorModels::CConsolidateWithSimulatorModels(CAircraftModelView *modelView, QObject *modelsTarget) : + IAircraftModelViewMenu(modelView), m_modelsTarget(modelsTarget) { // it can be the target is not yet known if (modelsTarget) diff --git a/src/blackgui/menus/aircraftmodelmenus.h b/src/blackgui/menus/aircraftmodelmenus.h index 99667d6eb..68e44289f 100644 --- a/src/blackgui/menus/aircraftmodelmenus.h +++ b/src/blackgui/menus/aircraftmodelmenus.h @@ -32,8 +32,8 @@ namespace BlackGui public: //! Constructor - IAircraftModelViewMenu(BlackGui::Views::CAircraftModelView *modelView, bool separator = true) : - IMenuDelegate(modelView, separator) + IAircraftModelViewMenu(BlackGui::Views::CAircraftModelView *modelView) : + IMenuDelegate(modelView) {} //! Log.categories @@ -60,7 +60,7 @@ namespace BlackGui public: //! Constructor - CShowSimulatorFileMenu(BlackGui::Views::CAircraftModelView *modelView, BlackGui::COverlayMessagesFrame *messageFrame, bool separator = true); + CShowSimulatorFileMenu(Views::CAircraftModelView *modelView, COverlayMessagesFrame *messageFrame); //! Log.categories static const BlackMisc::CLogCategoryList &getLogCategories(); @@ -89,7 +89,7 @@ namespace BlackGui using IAircraftModelViewMenu::IAircraftModelViewMenu; //! Constructor - CConsolidateWithDbDataMenu(BlackGui::Views::CAircraftModelView *modelView, QObject *modelsTarget, bool separator = true); + CConsolidateWithDbDataMenu(BlackGui::Views::CAircraftModelView *modelView, QObject *modelsTarget); //! Log.categories static const BlackMisc::CLogCategoryList &getLogCategories(); @@ -121,7 +121,7 @@ namespace BlackGui using IAircraftModelViewMenu::IAircraftModelViewMenu; //! Constructor - CConsolidateWithSimulatorModels(BlackGui::Views::CAircraftModelView *modelView, QObject *modelsTarget, bool separator = true); + CConsolidateWithSimulatorModels(Views::CAircraftModelView *modelView, QObject *modelsTarget); //! Log.categories static const BlackMisc::CLogCategoryList &getLogCategories(); diff --git a/src/blackgui/menus/fontmenus.cpp b/src/blackgui/menus/fontmenus.cpp index 1067378fe..5f46bdca4 100644 --- a/src/blackgui/menus/fontmenus.cpp +++ b/src/blackgui/menus/fontmenus.cpp @@ -26,8 +26,8 @@ namespace BlackGui return cats; } - CFontMenu::CFontMenu(QWidget *widget, bool separator, Qt::ShortcutContext shortcutContext) : - IMenuDelegate(widget, separator), m_widget(widget) + CFontMenu::CFontMenu(QWidget *widget, Qt::ShortcutContext shortcutContext) : + IMenuDelegate(widget), m_widget(widget) { this->m_fontDialogAction.reset(new QAction(CIcons::font16(), "Font", this)); QObject::connect(this->m_fontDialogAction.data(), &QAction::triggered, this, &CFontMenu::changeFontDialog); diff --git a/src/blackgui/menus/fontmenus.h b/src/blackgui/menus/fontmenus.h index 3854686e3..c571d92d2 100644 --- a/src/blackgui/menus/fontmenus.h +++ b/src/blackgui/menus/fontmenus.h @@ -33,7 +33,7 @@ namespace BlackGui public: //! Constructor - CFontMenu(QWidget *widget, bool separator = true, Qt::ShortcutContext shortcutContext = Qt::WidgetShortcut); + CFontMenu(QWidget *widget, Qt::ShortcutContext shortcutContext = Qt::WidgetShortcut); //! Log.categories static const BlackMisc::CLogCategoryList &getLogCategories(); diff --git a/src/blackgui/menus/menuaction.h b/src/blackgui/menus/menuaction.h index 6bf9b97ee..b05bbb5dd 100644 --- a/src/blackgui/menus/menuaction.h +++ b/src/blackgui/menus/menuaction.h @@ -81,7 +81,7 @@ namespace BlackGui //! Is menu? bool isSubMenu() const { return m_isMenu; } - //! Is separator + //! Is separator? bool isSeparator() const { return m_title == "_SEP_"; } //! Is menu? @@ -118,20 +118,24 @@ namespace BlackGui //! Path converter into separator static const QString &pathSeparator() { static const QString p("_SEPARATOR"); return p; } - //! Model set - static const QString &pathModelSet() { static const QString p("Custom.10.Model/Model set"); return p; } - - //! Model set, new set - static const QString &pathModelSetNew() { static const QString p("Custom.10.Model/Model set/New set"); return p; } //! Simulator sub menu - static const QString &pathSimulator() { static const QString p("Custom.11.Simulator/Simulator"); return p; } + static const QString &pathSimulator() { static const QString p("Custom.10.Simulator/Simulator"); return p; } //! Simulator sub menu reload models - static const QString &pathSimulatorModelsReload() { static const QString p("Custom.11.Simulator/Simulator/Reload models"); return p; } + static const QString &pathSimulatorModelsReload() { static const QString p("Custom.10.Simulator/Simulator/Reload models"); return p; } //! Simulator sub menu reload models - static const QString &pathSimulatorModelsClearCache() { static const QString p("Custom.11.Simulator/Simulator/Clear model caches"); return p; } + static const QString &pathSimulatorModelsClearCache() { static const QString p("Custom.10.Simulator/Simulator/Clear model caches"); return p; } + + //! Model + static const QString &pathModel() { static const QString p("Custom.11.Model"); return p; } + + //! Model set + static const QString &pathModelSet() { static const QString p("Custom.11.Model/Model set"); return p; } + + //! Model set, new set + static const QString &pathModelSetNew() { static const QString p("Custom.11.Model/Model set/New set"); return p; } //! Stash sub menu static const QString &pathStash() { static const QString p("Custom.12.Stash/Stash"); return p; } diff --git a/src/blackgui/menus/menudelegate.h b/src/blackgui/menus/menudelegate.h index 75129e1f1..8f84c70c9 100644 --- a/src/blackgui/menus/menudelegate.h +++ b/src/blackgui/menus/menudelegate.h @@ -51,8 +51,7 @@ namespace BlackGui protected: //! Constructor - IMenuDelegate(QWidget *parent = nullptr, bool separator = false) : - QObject(parent), m_separator(separator) {} + IMenuDelegate(QWidget *parent = nullptr) : QObject(parent) {} //! Delegate down one level void nestedCustomMenu(CMenuActions &menuActions) const @@ -70,7 +69,6 @@ namespace BlackGui } IMenuDelegate *m_nestedDelegate = nullptr; //!< nested delegate if any - bool m_separator = false; //!< at end, terminate with separator }; } // ns } // ns