mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
refs #720, remove highlight DB data menu (we use the DB icon instead)
* removed menu item * fixed menu action, so parents submenus are searched upwards
This commit is contained in:
committed by
Mathew Sutcliffe
parent
009bfc3ed1
commit
a8834d0511
@@ -67,7 +67,7 @@ namespace BlackGui
|
||||
switch (mode)
|
||||
{
|
||||
case CAircraftModelListModel::StashModel:
|
||||
this->m_menus = MenuDefaultNoClear | MenuHighlightDbData;
|
||||
this->m_menus = MenuDefaultNoClear;
|
||||
break;
|
||||
case CAircraftModelListModel::Database:
|
||||
this->m_menus = MenuDefaultDbViews;
|
||||
@@ -76,11 +76,11 @@ namespace BlackGui
|
||||
this->m_menus = MenuDefaultNoClear | MenuStashing;
|
||||
break;
|
||||
case CAircraftModelListModel::OwnSimulatorModelMapping:
|
||||
this->m_menus = MenuDefaultNoClear | MenuStashing | MenuHighlightDbData | MenuLoadAndSave;
|
||||
this->m_menus = MenuDefaultNoClear | MenuStashing | MenuLoadAndSave;
|
||||
break;
|
||||
case CAircraftModelListModel::OwnSimulatorModel:
|
||||
default:
|
||||
this->m_menus = MenuDefaultNoClear | MenuBackend | MenuHighlightDbData;
|
||||
this->m_menus = MenuDefaultNoClear | MenuBackend;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -630,7 +630,6 @@ namespace BlackGui
|
||||
this->m_displayAutomatically = a->isChecked();
|
||||
}
|
||||
|
||||
|
||||
void CViewBaseNonTemplate::ps_setSingleSelection()
|
||||
{
|
||||
if (this->m_originalSelectionMode == ExtendedSelection || this->m_originalSelectionMode == MultiSelection)
|
||||
|
||||
@@ -119,9 +119,8 @@ namespace BlackGui
|
||||
MenuDefaultDbViews = MenuToggleSelectionMode | MenuBackend,
|
||||
// special menus, should be in derived classes, but enums cannot be inherited
|
||||
// maybe shifted in the future to elsewhere
|
||||
MenuHighlightDbData = 1 << 10, //!< highlight DB data
|
||||
MenuHighlightStashed = 1 << 11, //!< highlight stashed models
|
||||
MenuCanStashModels = 1 << 12, //!< stash models
|
||||
MenuHighlightStashed = 1 << 10, //!< highlight stashed models
|
||||
MenuCanStashModels = 1 << 11, //!< stash models
|
||||
MenuStashing = MenuHighlightStashed | MenuCanStashModels,
|
||||
};
|
||||
Q_DECLARE_FLAGS(Menu, MenuFlag)
|
||||
|
||||
@@ -92,28 +92,9 @@ namespace BlackGui
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
void CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::customMenu(Menus::CMenuActions &menuActions)
|
||||
{
|
||||
if (this->m_menus.testFlag(CViewBaseNonTemplate::MenuHighlightDbData))
|
||||
{
|
||||
if (!this->m_menuFlagActions.contains(CViewBaseNonTemplate::MenuHighlightDbData))
|
||||
{
|
||||
CMenuActions ma;
|
||||
QAction *added = ma.addAction(CIcons::database16(), "Highlight DB data", CMenuAction::pathViewDatabase(), { this, &CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::ps_toggleHighlightDbData });
|
||||
added->setCheckable(true);
|
||||
this->m_menuFlagActions.insert(CViewBaseNonTemplate::MenuHighlightDbData, ma);
|
||||
}
|
||||
QAction *a = menuActions.addActions(this->initMenuActions(CViewBaseNonTemplate::MenuHighlightDbData)).first();
|
||||
a->setChecked(this->derivedModel()->highlightDbData());
|
||||
}
|
||||
CViewBase<ModelClass, ContainerType, ObjectType>::customMenu(menuActions);
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
void CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::ps_toggleHighlightDbData()
|
||||
{
|
||||
bool h = this->derivedModel()->highlightDbData();
|
||||
this->derivedModel()->setHighlightDbData(!h);
|
||||
}
|
||||
|
||||
template <class ModelClass, class ContainerType, class ObjectType, class KeyType>
|
||||
COrderableViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::COrderableViewWithDbObjects(QWidget *parent) :
|
||||
CViewWithDbObjects<ModelClass, ContainerType, ObjectType, KeyType>::CViewWithDbObjects(parent)
|
||||
|
||||
@@ -69,10 +69,6 @@ namespace BlackGui
|
||||
|
||||
//! \copydoc BlackGui::Views::CViewBaseNonTemplate::customMenu
|
||||
virtual void customMenu(BlackGui::Menus::CMenuActions &menuActions) override;
|
||||
|
||||
protected slots:
|
||||
//! \copydoc BlackGui::Views::CViewBase::ps_toggleHighlightDbData
|
||||
virtual void ps_toggleHighlightDbData() override;
|
||||
};
|
||||
|
||||
//! Base class for views with DB objects also orderable (based on BlackMisc::IOrderableList )
|
||||
|
||||
Reference in New Issue
Block a user