diff --git a/src/blackgui/components/datainfoareacomponent.cpp b/src/blackgui/components/datainfoareacomponent.cpp index f453c29e5..dac65ed0b 100644 --- a/src/blackgui/components/datainfoareacomponent.cpp +++ b/src/blackgui/components/datainfoareacomponent.cpp @@ -31,7 +31,7 @@ namespace BlackGui ui(new Ui::CDataInfoAreaComponent) { ui->setupUi(this); - initInfoArea(); // init base class + this->initInfoArea(); // init base class this->setWindowIcon(CIcons::swiftDatabase24()); this->ps_setTabBarPosition(QTabWidget::North); } diff --git a/src/blackgui/components/dbmappingcomponent.cpp b/src/blackgui/components/dbmappingcomponent.cpp index 0edb3a2de..3c6860194 100644 --- a/src/blackgui/components/dbmappingcomponent.cpp +++ b/src/blackgui/components/dbmappingcomponent.cpp @@ -863,7 +863,7 @@ namespace BlackGui if (mapComp->currentTabIndex() == CDbMappingComponent::TabOwnModels && mapComp->currentModelView()->hasSelection()) { this->addSeparator(menu); - menu.addAction(CIcons::text16(), "Open simulator file", this, SLOT(ps_showSimulatorFile())); + menu.addAction(CIcons::text16(), "Open simulator file", mapComp, SLOT(ps_showSimulatorFile())); } this->nestedCustomMenu(menu); diff --git a/src/blackgui/components/dbmodelcomponent.cpp b/src/blackgui/components/dbmodelcomponent.cpp index 5c921be35..b8e03383b 100644 --- a/src/blackgui/components/dbmodelcomponent.cpp +++ b/src/blackgui/components/dbmodelcomponent.cpp @@ -36,6 +36,8 @@ namespace BlackGui ui->setupUi(this); this->setViewWithIndicator(this->ui->tvp_AircraftModel); this->ui->tvp_AircraftModel->setAircraftModelMode(CAircraftModelListModel::Database); + this->ui->tvp_AircraftModel->menuAddItems(CAircraftModelView::MenuStashing); + this->ui->tvp_AircraftModel->menuRemoveItems(CAircraftModelView::MenuHighlightStashed); // not supported here connect(this->ui->tvp_AircraftModel, &CAircraftModelView::requestNewBackendData, this, &CDbModelComponent::ps_reload); connect(this->ui->tvp_AircraftModel, &CAircraftModelView::requestStash, this, &CDbModelComponent::requestStash); connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CDbModelComponent::ps_onStyleSheetChanged); @@ -101,22 +103,5 @@ namespace BlackGui emit requestStash(models); } } - - void CDbModelComponent::CStashMenu::customMenu(QMenu &menu) const - { - CDbModelComponent *modelComponent = qobject_cast(this->parent()); - Q_ASSERT_X(modelComponent, Q_FUNC_INFO, "Cannot access model component"); - if (modelComponent->hasModels()) - { - menu.addAction(CIcons::appMappings16(), "Stash", modelComponent, SLOT(ps_stashSelectedModels()), CShortcut::keyStash()); - } - this->nestedCustomMenu(menu); - } - - CDbModelComponent *CDbModelComponent::CStashMenu::modelComponent() const - { - return qobject_cast(this->parent()); - } - } // ns } // ns diff --git a/src/blackgui/components/dbmodelcomponent.h b/src/blackgui/components/dbmodelcomponent.h index 9258394a9..f754b585c 100644 --- a/src/blackgui/components/dbmodelcomponent.h +++ b/src/blackgui/components/dbmodelcomponent.h @@ -74,24 +74,6 @@ namespace BlackGui private: QScopedPointer ui; - - //! The menu for stashing models - //! \note This is a specific menu for that very component - class CStashMenu : public BlackGui::IMenuDelegate - { - public: - //! Constructor - CStashMenu(CDbModelComponent *modelComponent, bool separatorAtEnd) : - BlackGui::IMenuDelegate(modelComponent, separatorAtEnd) - {} - - //! \copydoc IMenuDelegate::customMenu - virtual void customMenu(QMenu &menu) const override; - - private: - //! Mapping component - CDbModelComponent *modelComponent() const; - }; }; } // ns } // ns diff --git a/src/blackgui/components/dbstashcomponent.cpp b/src/blackgui/components/dbstashcomponent.cpp index 1c7262433..090cb5be4 100644 --- a/src/blackgui/components/dbstashcomponent.cpp +++ b/src/blackgui/components/dbstashcomponent.cpp @@ -103,7 +103,7 @@ namespace BlackGui CStatusMessageList msgs; for (const CAircraftModel &model : models) { - CStatusMessage m(stashModel(model)); + const CStatusMessage m(stashModel(model)); if (m.isWarningOrAbove()) { msgs.push_back(m); } } return msgs; diff --git a/src/blackgui/views/viewbase.h b/src/blackgui/views/viewbase.h index d7176e053..3f873ffd9 100644 --- a/src/blackgui/views/viewbase.h +++ b/src/blackgui/views/viewbase.h @@ -183,7 +183,7 @@ namespace BlackGui void menuRemoveItems(Menu menusToRemove); //! Add given menu items - void menuAddItems(Menu menusToRemove); + void menuAddItems(Menu menusToAdd); //! Set menu items void setMenu(Menu menuItems) { this->m_menus = menuItems; }