forked from qt-creator/qt-creator
Fixes: - Remove unused tool bar container, and unnecessary enum
Details: - I'm still not too happy with the whole construction but anyway. The ToolBarActionContainer was never really used anymore (e.g. you couldn't create one)
This commit is contained in:
@@ -53,12 +53,11 @@ using namespace Core::Internal;
|
|||||||
/*!
|
/*!
|
||||||
\class IActionContainer
|
\class IActionContainer
|
||||||
\mainclass
|
\mainclass
|
||||||
\ingroup qwb
|
|
||||||
\inheaderfile iactioncontainer.h
|
\inheaderfile iactioncontainer.h
|
||||||
|
|
||||||
\brief The class...
|
\brief The IActionContainer class represents a menu or menu bar in Qt Creator.
|
||||||
|
|
||||||
|
|
||||||
The Action Container interface...
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -120,63 +119,36 @@ using namespace Core::Internal;
|
|||||||
// ---------- ActionContainer ------------
|
// ---------- ActionContainer ------------
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class ActionContainer
|
\class Core::Internal::ActionContainer
|
||||||
\ingroup qwb
|
\internal
|
||||||
\inheaderfile actioncontainer.h
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
ActionContainer::ActionContainer(int id)
|
||||||
\enum ActionContainer::ContainerState
|
: m_data(CS_None), m_id(id)
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn ActionContainer::ActionContainer(ContainerType type, int id)
|
|
||||||
*/
|
|
||||||
ActionContainer::ActionContainer(ContainerType type, int id)
|
|
||||||
: m_data(CS_None), m_type(type), m_id(id)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn virtual ActionContainer::~ActionContainer()
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ActionContainer::setEmptyAction(EmptyAction ea)
|
void ActionContainer::setEmptyAction(EmptyAction ea)
|
||||||
{
|
{
|
||||||
m_data = ((m_data & ~EA_Mask) | ea);
|
m_data = ((m_data & ~EA_Mask) | ea);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
bool ActionContainer::hasEmptyAction(EmptyAction ea) const
|
bool ActionContainer::hasEmptyAction(EmptyAction ea) const
|
||||||
{
|
{
|
||||||
return (m_data & EA_Mask) == ea;
|
return (m_data & EA_Mask) == ea;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ActionContainer::setState(ContainerState state)
|
void ActionContainer::setState(ContainerState state)
|
||||||
{
|
{
|
||||||
m_data |= state;
|
m_data |= state;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
bool ActionContainer::hasState(ContainerState state) const
|
bool ActionContainer::hasState(ContainerState state) const
|
||||||
{
|
{
|
||||||
return (m_data & state);
|
return (m_data & state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ActionContainer::appendGroup(const QString &group)
|
void ActionContainer::appendGroup(const QString &group)
|
||||||
{
|
{
|
||||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||||
@@ -184,9 +156,6 @@ void ActionContainer::appendGroup(const QString &group)
|
|||||||
m_groups << gid;
|
m_groups << gid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
QAction *ActionContainer::insertLocation(const QString &group) const
|
QAction *ActionContainer::insertLocation(const QString &group) const
|
||||||
{
|
{
|
||||||
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager();
|
||||||
@@ -196,25 +165,6 @@ QAction *ActionContainer::insertLocation(const QString &group) const
|
|||||||
return beforeAction(pos, &prevKey);
|
return beforeAction(pos, &prevKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn virtual void ActionContainer::insertAction(QAction *before, QAction *action) = 0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn virtual void ActionContainer::insertMenu(QAction *before, QMenu *menu) = 0
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QList<ICommand *> ActionContainer::commands() const
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QList<IActionContainer *> ActionContainer::subContainers() const
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ActionContainer::addAction(ICommand *action, const QString &group)
|
void ActionContainer::addAction(ICommand *action, const QString &group)
|
||||||
{
|
{
|
||||||
if (!canAddAction(action))
|
if (!canAddAction(action))
|
||||||
@@ -243,12 +193,10 @@ void ActionContainer::addAction(ICommand *action, const QString &group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ActionContainer::addMenu(IActionContainer *menu, const QString &group)
|
void ActionContainer::addMenu(IActionContainer *menu, const QString &group)
|
||||||
{
|
{
|
||||||
if (!canAddMenu(menu))
|
ActionContainer *container = static_cast<ActionContainer *>(menu);
|
||||||
|
if (!container->canBeAddedToMenu())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ActionManagerPrivate *am = ActionManagerPrivate::instance();
|
ActionManagerPrivate *am = ActionManagerPrivate::instance();
|
||||||
@@ -272,49 +220,21 @@ void ActionContainer::addMenu(IActionContainer *menu, const QString &group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
int ActionContainer::id() const
|
int ActionContainer::id() const
|
||||||
{
|
{
|
||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
IActionContainer::ContainerType ActionContainer::type() const
|
|
||||||
{
|
|
||||||
return m_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
QMenu *ActionContainer::menu() const
|
QMenu *ActionContainer::menu() const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
QToolBar *ActionContainer::toolBar() const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
QMenuBar *ActionContainer::menuBar() const
|
QMenuBar *ActionContainer::menuBar() const
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
bool ActionContainer::canAddAction(ICommand *action) const
|
bool ActionContainer::canAddAction(ICommand *action) const
|
||||||
{
|
{
|
||||||
if (action->type() != ICommand::CT_OverridableAction)
|
if (action->type() != ICommand::CT_OverridableAction)
|
||||||
@@ -327,24 +247,6 @@ bool ActionContainer::canAddAction(ICommand *action) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
bool ActionContainer::canAddMenu(IActionContainer *menu) const
|
|
||||||
{
|
|
||||||
if (menu->type() != IActionContainer::CT_Menu)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ActionContainer *container = static_cast<ActionContainer *>(menu);
|
|
||||||
if (container->hasState(ActionContainer::CS_Initialized))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ActionContainer::addAction(ICommand *action, int pos, bool setpos)
|
void ActionContainer::addAction(ICommand *action, int pos, bool setpos)
|
||||||
{
|
{
|
||||||
Action *a = static_cast<Action *>(action);
|
Action *a = static_cast<Action *>(action);
|
||||||
@@ -367,9 +269,6 @@ void ActionContainer::addAction(ICommand *action, int pos, bool setpos)
|
|||||||
insertAction(ba, a->action());
|
insertAction(ba, a->action());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ActionContainer::addMenu(IActionContainer *menu, int pos, bool setpos)
|
void ActionContainer::addMenu(IActionContainer *menu, int pos, bool setpos)
|
||||||
{
|
{
|
||||||
MenuActionContainer *mc = static_cast<MenuActionContainer *>(menu);
|
MenuActionContainer *mc = static_cast<MenuActionContainer *>(menu);
|
||||||
@@ -390,10 +289,6 @@ void ActionContainer::addMenu(IActionContainer *menu, int pos, bool setpos)
|
|||||||
insertMenu(ba, mc->menu());
|
insertMenu(ba, mc->menu());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
QAction *ActionContainer::beforeAction(int pos, int *prevKey) const
|
QAction *ActionContainer::beforeAction(int pos, int *prevKey) const
|
||||||
{
|
{
|
||||||
ActionManagerPrivate *am = ActionManagerPrivate::instance();
|
ActionManagerPrivate *am = ActionManagerPrivate::instance();
|
||||||
@@ -424,10 +319,6 @@ QAction *ActionContainer::beforeAction(int pos, int *prevKey) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
int ActionContainer::calcPosition(int pos, int prevKey) const
|
int ActionContainer::calcPosition(int pos, int prevKey) const
|
||||||
{
|
{
|
||||||
int grp = (pos & 0xFFFF0000);
|
int grp = (pos & 0xFFFF0000);
|
||||||
@@ -445,23 +336,16 @@ int ActionContainer::calcPosition(int pos, int prevKey) const
|
|||||||
// ---------- MenuActionContainer ------------
|
// ---------- MenuActionContainer ------------
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class MenuActionContainer
|
\class Core::Internal::MenuActionContainer
|
||||||
\ingroup qwb
|
\internal
|
||||||
\inheaderfile actioncontainer.h
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
MenuActionContainer::MenuActionContainer(int id)
|
MenuActionContainer::MenuActionContainer(int id)
|
||||||
: ActionContainer(CT_Menu, id), m_menu(0)
|
: ActionContainer(id), m_menu(0)
|
||||||
{
|
{
|
||||||
setEmptyAction(EA_Disable);
|
setEmptyAction(EA_Disable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void MenuActionContainer::setMenu(QMenu *menu)
|
void MenuActionContainer::setMenu(QMenu *menu)
|
||||||
{
|
{
|
||||||
m_menu = menu;
|
m_menu = menu;
|
||||||
@@ -472,49 +356,31 @@ void MenuActionContainer::setMenu(QMenu *menu)
|
|||||||
m_menu->menuAction()->setData(v);
|
m_menu->menuAction()->setData(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
QMenu *MenuActionContainer::menu() const
|
QMenu *MenuActionContainer::menu() const
|
||||||
{
|
{
|
||||||
return m_menu;
|
return m_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void MenuActionContainer::insertAction(QAction *before, QAction *action)
|
void MenuActionContainer::insertAction(QAction *before, QAction *action)
|
||||||
{
|
{
|
||||||
m_menu->insertAction(before, action);
|
m_menu->insertAction(before, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void MenuActionContainer::insertMenu(QAction *before, QMenu *menu)
|
void MenuActionContainer::insertMenu(QAction *before, QMenu *menu)
|
||||||
{
|
{
|
||||||
m_menu->insertMenu(before, menu);
|
m_menu->insertMenu(before, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void MenuActionContainer::setLocation(const CommandLocation &location)
|
void MenuActionContainer::setLocation(const CommandLocation &location)
|
||||||
{
|
{
|
||||||
m_location = location;
|
m_location = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
CommandLocation MenuActionContainer::location() const
|
CommandLocation MenuActionContainer::location() const
|
||||||
{
|
{
|
||||||
return m_location;
|
return m_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
bool MenuActionContainer::update()
|
bool MenuActionContainer::update()
|
||||||
{
|
{
|
||||||
if (hasEmptyAction(EA_None))
|
if (hasEmptyAction(EA_None))
|
||||||
@@ -549,131 +415,48 @@ bool MenuActionContainer::update()
|
|||||||
return hasitems;
|
return hasitems;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- ToolBarActionContainer ------------
|
bool MenuActionContainer::canBeAddedToMenu() const
|
||||||
|
|
||||||
/*!
|
|
||||||
\class ToolBarActionContainer
|
|
||||||
\ingroup qwb
|
|
||||||
\inheaderfile actioncontainer.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
ToolBarActionContainer::ToolBarActionContainer(int id)
|
|
||||||
: ActionContainer(CT_ToolBar, id), m_toolBar(0)
|
|
||||||
{
|
{
|
||||||
setEmptyAction(EA_None);
|
if (hasState(ActionContainer::CS_Initialized))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ToolBarActionContainer::setToolBar(QToolBar *toolBar)
|
|
||||||
{
|
|
||||||
m_toolBar = toolBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
QToolBar *ToolBarActionContainer::toolBar() const
|
|
||||||
{
|
|
||||||
return m_toolBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ToolBarActionContainer::insertAction(QAction *before, QAction *action)
|
|
||||||
{
|
|
||||||
m_toolBar->insertAction(before, action);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void ToolBarActionContainer::insertMenu(QAction *, QMenu *)
|
|
||||||
{
|
|
||||||
// not implemented
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
bool ToolBarActionContainer::update()
|
|
||||||
{
|
|
||||||
if (hasEmptyAction(EA_None))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
bool hasitems = false;
|
|
||||||
foreach (ICommand *command, commands()) {
|
|
||||||
if (command->isActive()) {
|
|
||||||
hasitems = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasEmptyAction(EA_Hide))
|
|
||||||
m_toolBar->setVisible(hasitems);
|
|
||||||
else if (hasEmptyAction(EA_Disable))
|
|
||||||
m_toolBar->setEnabled(hasitems);
|
|
||||||
|
|
||||||
return hasitems;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- MenuBarActionContainer ------------
|
// ---------- MenuBarActionContainer ------------
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class MenuBarActionContainer
|
\class Core::Internal::MenuBarActionContainer
|
||||||
\ingroup qwb
|
\internal
|
||||||
\inheaderfile actioncontainer.h
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
MenuBarActionContainer::MenuBarActionContainer(int id)
|
MenuBarActionContainer::MenuBarActionContainer(int id)
|
||||||
: ActionContainer(CT_ToolBar, id), m_menuBar(0)
|
: ActionContainer(id), m_menuBar(0)
|
||||||
{
|
{
|
||||||
setEmptyAction(EA_None);
|
setEmptyAction(EA_None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void MenuBarActionContainer::setMenuBar(QMenuBar *menuBar)
|
void MenuBarActionContainer::setMenuBar(QMenuBar *menuBar)
|
||||||
{
|
{
|
||||||
m_menuBar = menuBar;
|
m_menuBar = menuBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
QMenuBar *MenuBarActionContainer::menuBar() const
|
QMenuBar *MenuBarActionContainer::menuBar() const
|
||||||
{
|
{
|
||||||
return m_menuBar;
|
return m_menuBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void MenuBarActionContainer::insertAction(QAction *before, QAction *action)
|
void MenuBarActionContainer::insertAction(QAction *before, QAction *action)
|
||||||
{
|
{
|
||||||
m_menuBar->insertAction(before, action);
|
m_menuBar->insertAction(before, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
void MenuBarActionContainer::insertMenu(QAction *before, QMenu *menu)
|
void MenuBarActionContainer::insertMenu(QAction *before, QMenu *menu)
|
||||||
{
|
{
|
||||||
m_menuBar->insertMenu(before, menu);
|
m_menuBar->insertMenu(before, menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
bool MenuBarActionContainer::update()
|
bool MenuBarActionContainer::update()
|
||||||
{
|
{
|
||||||
if (hasEmptyAction(EA_None))
|
if (hasEmptyAction(EA_None))
|
||||||
@@ -695,3 +478,9 @@ bool MenuBarActionContainer::update()
|
|||||||
|
|
||||||
return hasitems;
|
return hasitems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MenuBarActionContainer::canBeAddedToMenu() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
CS_UserDefined = 0x040000
|
CS_UserDefined = 0x040000
|
||||||
};
|
};
|
||||||
|
|
||||||
ActionContainer(ContainerType type, int id);
|
ActionContainer(int id);
|
||||||
virtual ~ActionContainer() {}
|
virtual ~ActionContainer() {}
|
||||||
|
|
||||||
void setEmptyAction(EmptyAction ea);
|
void setEmptyAction(EmptyAction ea);
|
||||||
@@ -67,10 +67,8 @@ public:
|
|||||||
void addMenu(IActionContainer *menu, const QString &group = QString());
|
void addMenu(IActionContainer *menu, const QString &group = QString());
|
||||||
|
|
||||||
int id() const;
|
int id() const;
|
||||||
ContainerType type() const;
|
|
||||||
|
|
||||||
QMenu *menu() const;
|
QMenu *menu() const;
|
||||||
QToolBar *toolBar() const;
|
|
||||||
QMenuBar *menuBar() const;
|
QMenuBar *menuBar() const;
|
||||||
|
|
||||||
virtual void insertAction(QAction *before, QAction *action) = 0;
|
virtual void insertAction(QAction *before, QAction *action) = 0;
|
||||||
@@ -81,6 +79,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
bool canAddAction(ICommand *action) const;
|
bool canAddAction(ICommand *action) const;
|
||||||
bool canAddMenu(IActionContainer *menu) const;
|
bool canAddMenu(IActionContainer *menu) const;
|
||||||
|
virtual bool canBeAddedToMenu() const = 0;
|
||||||
|
|
||||||
void addAction(ICommand *action, int pos, bool setpos);
|
void addAction(ICommand *action, int pos, bool setpos);
|
||||||
void addMenu(IActionContainer *menu, int pos, bool setpos);
|
void addMenu(IActionContainer *menu, int pos, bool setpos);
|
||||||
@@ -91,7 +90,6 @@ private:
|
|||||||
|
|
||||||
QList<int> m_groups;
|
QList<int> m_groups;
|
||||||
int m_data;
|
int m_data;
|
||||||
ContainerType m_type;
|
|
||||||
int m_id;
|
int m_id;
|
||||||
QMap<int, int> m_posmap;
|
QMap<int, int> m_posmap;
|
||||||
QList<IActionContainer *> m_subContainers;
|
QList<IActionContainer *> m_subContainers;
|
||||||
@@ -113,27 +111,13 @@ public:
|
|||||||
void insertMenu(QAction *before, QMenu *menu);
|
void insertMenu(QAction *before, QMenu *menu);
|
||||||
bool update();
|
bool update();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool canBeAddedToMenu() const;
|
||||||
private:
|
private:
|
||||||
QMenu *m_menu;
|
QMenu *m_menu;
|
||||||
CommandLocation m_location;
|
CommandLocation m_location;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ToolBarActionContainer : public ActionContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ToolBarActionContainer(int id);
|
|
||||||
|
|
||||||
void setToolBar(QToolBar *toolBar);
|
|
||||||
QToolBar *toolBar() const;
|
|
||||||
|
|
||||||
void insertAction(QAction *before, QAction *action);
|
|
||||||
void insertMenu(QAction *before, QMenu *menu);
|
|
||||||
bool update();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QToolBar *m_toolBar;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MenuBarActionContainer : public ActionContainer
|
class MenuBarActionContainer : public ActionContainer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -146,6 +130,8 @@ public:
|
|||||||
void insertMenu(QAction *before, QMenu *menu);
|
void insertMenu(QAction *before, QMenu *menu);
|
||||||
bool update();
|
bool update();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool canBeAddedToMenu() const;
|
||||||
private:
|
private:
|
||||||
QMenuBar *m_menuBar;
|
QMenuBar *m_menuBar;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QShortcut>
|
#include <QtGui/QShortcut>
|
||||||
#include <QtGui/QToolBar>
|
|
||||||
#include <QtGui/QMenuBar>
|
#include <QtGui/QMenuBar>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|||||||
@@ -47,12 +47,6 @@ class ICommand;
|
|||||||
class IActionContainer : public QObject
|
class IActionContainer : public QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum ContainerType {
|
|
||||||
CT_Mask = 0xFF,
|
|
||||||
CT_Menu = 0x01,
|
|
||||||
CT_ToolBar = 0x02
|
|
||||||
};
|
|
||||||
|
|
||||||
enum EmptyAction {
|
enum EmptyAction {
|
||||||
EA_Mask = 0xFF00,
|
EA_Mask = 0xFF00,
|
||||||
EA_None = 0x0100,
|
EA_None = 0x0100,
|
||||||
@@ -63,10 +57,8 @@ public:
|
|||||||
virtual void setEmptyAction(EmptyAction ea) = 0;
|
virtual void setEmptyAction(EmptyAction ea) = 0;
|
||||||
|
|
||||||
virtual int id() const = 0;
|
virtual int id() const = 0;
|
||||||
virtual ContainerType type() const = 0;
|
|
||||||
|
|
||||||
virtual QMenu *menu() const = 0;
|
virtual QMenu *menu() const = 0;
|
||||||
virtual QToolBar *toolBar() const = 0;
|
|
||||||
virtual QMenuBar *menuBar() const = 0;
|
virtual QMenuBar *menuBar() const = 0;
|
||||||
|
|
||||||
virtual QAction *insertLocation(const QString &group) const = 0;
|
virtual QAction *insertLocation(const QString &group) const = 0;
|
||||||
|
|||||||
@@ -962,17 +962,6 @@ void MainWindow::resetContext()
|
|||||||
updateContextObject(0);
|
updateContextObject(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu *MainWindow::createPopupMenu()
|
|
||||||
{
|
|
||||||
QMenu *menu = new QMenu(this);
|
|
||||||
QList<ActionContainer *> containers = m_actionManager->containers();
|
|
||||||
foreach (ActionContainer *c, containers) {
|
|
||||||
if (c->toolBar())
|
|
||||||
menu->addAction(c->toolBar()->toggleViewAction());
|
|
||||||
}
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *settingsGroup = "MainWindow";
|
static const char *settingsGroup = "MainWindow";
|
||||||
static const char *geometryKey = "Geometry";
|
static const char *geometryKey = "Geometry";
|
||||||
static const char *colorKey = "Color";
|
static const char *colorKey = "Color";
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ public:
|
|||||||
|
|
||||||
void updateContext();
|
void updateContext();
|
||||||
|
|
||||||
QMenu *createPopupMenu();
|
|
||||||
|
|
||||||
void setSuppressNavigationWidget(bool suppress);
|
void setSuppressNavigationWidget(bool suppress);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
Reference in New Issue
Block a user