{Fancy,Debugger}MainWindow: Consolidate dock actions menu population

There are several places where the list of dock actions are shown,
and at least two where it was created.

Change-Id: Ib2c18e602b5d6f57c1b7471bd75f3b989d536600
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
hjk
2014-07-15 12:47:15 +02:00
parent 7eeaa6851f
commit 3ed30f09cf
4 changed files with 9 additions and 28 deletions

View File

@@ -128,7 +128,6 @@ public:
DebuggerLanguages m_engineDebugLanguages;
ActionContainer *m_viewsMenu;
QList<Command *> m_menuCommandsToAdd;
Project *m_previousProject;
Target *m_previousTarget;
@@ -319,10 +318,6 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
"Debugger.Views.Separator", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->resetLayoutAction(),
"Debugger.Views.ResetSimple", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
}
void DebuggerMainWindowPrivate::addLanguage(DebuggerLanguage languageId,
@@ -410,7 +405,6 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua
Command *cmd = Core::ActionManager::registerAction(toggleViewAction,
Core::Id("Debugger.").withSuffix(widget->objectName()), globalContext);
cmd->setAttribute(Command::CA_Hide);
d->m_menuCommandsToAdd.append(cmd);
dockWidget->installEventFilter(&d->m_resizeEventFilter);
@@ -426,12 +420,7 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua
void DebuggerMainWindow::addStagedMenuEntries()
{
Utils::sort(d->m_menuCommandsToAdd, [](Command *cmd1, Command *cmd2) {
return cmd1->action()->text() < cmd2->action()->text();
});
foreach (Command *cmd, d->m_menuCommandsToAdd)
d->m_viewsMenu->addAction(cmd);
d->m_menuCommandsToAdd.clear();
addDockActionsToMenu(d->m_viewsMenu->menu());
}
QWidget *DebuggerMainWindow::createContents(IMode *mode)
@@ -543,9 +532,9 @@ void DebuggerMainWindow::writeSettings() const
void DebuggerMainWindow::showViewsMenu()
{
QMenu *menu = createPopupMenu();
menu->exec(d->m_viewButton->mapToGlobal(QPoint()));
delete menu;
QMenu menu;
addDockActionsToMenu(&menu);
menu.exec(d->m_viewButton->mapToGlobal(QPoint()));
}
void DebuggerMainWindow::readSettings()
@@ -613,11 +602,6 @@ bool DebuggerMainWindowPrivate::isQmlActive() const
return (m_activeDebugLanguages & QmlLanguage);
}
QMenu *DebuggerMainWindow::createPopupMenu()
{
return FancyMainWindow::createPopupMenu();
}
void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
{
using namespace Constants;