diff options
author | hjk <hjk@theqtcompany.com> | 2015-02-26 13:58:00 +0100 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2015-02-26 14:09:03 +0000 |
commit | a66fe4b29eb17f5bcf5e499ad93a6eedf222bdbe (patch) | |
tree | 1518149885b36791c19800ffcbfacd8abb106197 /src | |
parent | 8b9456e41c9fd756c3a02c096a68ee127e33652e (diff) | |
download | qt-creator-a66fe4b29eb17f5bcf5e499ad93a6eedf222bdbe.tar.gz |
Core: Add an ActionContainer::addSeparator(Id) overload
This basically makes the Context parameter optional and default
to C_GLOBAL. Less noise on the user side.
Change-Id: Idaf1b83eabaf912450ab20bd5a8b613844bf69a2
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/analyzerbase/analyzermanager.cpp | 7 | ||||
-rw-r--r-- | src/plugins/coreplugin/actionmanager/actioncontainer.cpp | 7 | ||||
-rw-r--r-- | src/plugins/coreplugin/actionmanager/actioncontainer.h | 3 | ||||
-rw-r--r-- | src/plugins/coreplugin/find/findplugin.cpp | 5 | ||||
-rw-r--r-- | src/plugins/coreplugin/mainwindow.cpp | 30 | ||||
-rw-r--r-- | src/plugins/coreplugin/outputpanemanager.cpp | 2 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 7 | ||||
-rw-r--r-- | src/plugins/projectexplorer/projectexplorer.cpp | 23 |
8 files changed, 42 insertions, 42 deletions
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 93a2f1d834..4db3caedee 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -244,10 +244,9 @@ void AnalyzerManagerPrivate::setupActions() command = ActionManager::registerAction(m_stopAction, "Analyzer.Stop"); m_menu->addAction(command, G_ANALYZER_CONTROL); - const Context globalcontext(C_GLOBAL); - m_menu->addSeparator(globalcontext, G_ANALYZER_TOOLS); - m_menu->addSeparator(globalcontext, G_ANALYZER_REMOTE_TOOLS); - m_menu->addSeparator(globalcontext, G_ANALYZER_OPTIONS); + m_menu->addSeparator(G_ANALYZER_TOOLS); + m_menu->addSeparator(G_ANALYZER_REMOTE_TOOLS); + m_menu->addSeparator(G_ANALYZER_OPTIONS); } void AnalyzerManagerPrivate::delayedInit() diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp index 99c738064e..ef618123d6 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp +++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp @@ -568,4 +568,11 @@ bool MenuBarActionContainer::canBeAddedToMenu() const } } // namespace Internal + +Command *ActionContainer::addSeparator(Id group) +{ + static const Context context(Constants::C_GLOBAL); + return addSeparator(context, group); +} + } // namespace Core diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.h b/src/plugins/coreplugin/actionmanager/actioncontainer.h index e81cb5c748..b5b1a0e270 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer.h +++ b/src/plugins/coreplugin/actionmanager/actioncontainer.h @@ -71,7 +71,8 @@ public: virtual void addAction(Command *action, Id group = Id()) = 0; virtual void addMenu(ActionContainer *menu, Id group = Id()) = 0; virtual void addMenu(ActionContainer *before, ActionContainer *menu, Id group = Id()) = 0; - virtual Command *addSeparator(const Context &context = Context(), Id group = Id(), QAction **outSeparator = 0) = 0; + Command *addSeparator(Id group = Id()); + virtual Command *addSeparator(const Context &context, Id group = Id(), QAction **outSeparator = 0) = 0; // This clears this menu and submenus from all actions and submenus. // It does not destroy the submenus and commands, just removes them from their parents. diff --git a/src/plugins/coreplugin/find/findplugin.cpp b/src/plugins/coreplugin/find/findplugin.cpp index ad601c7710..36b7dc99f1 100644 --- a/src/plugins/coreplugin/find/findplugin.cpp +++ b/src/plugins/coreplugin/find/findplugin.cpp @@ -203,10 +203,9 @@ void FindPlugin::setupMenu() mfind->appendGroup(Constants::G_FIND_FILTERS); mfind->appendGroup(Constants::G_FIND_FLAGS); mfind->appendGroup(Constants::G_FIND_ACTIONS); - Context globalcontext(Constants::C_GLOBAL); Command *cmd; - mfind->addSeparator(globalcontext, Constants::G_FIND_FLAGS); - mfind->addSeparator(globalcontext, Constants::G_FIND_ACTIONS); + mfind->addSeparator(Constants::G_FIND_FLAGS); + mfind->addSeparator(Constants::G_FIND_ACTIONS); ActionContainer *mfindadvanced = ActionManager::createMenu(Constants::M_FIND_ADVANCED); mfindadvanced->menu()->setTitle(tr("Advanced Find")); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index f8449998ed..c8e61cb901 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -468,18 +468,16 @@ void MainWindow::registerDefaultActions() ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); ActionContainer *mhelp = ActionManager::actionContainer(Constants::M_HELP); - Context globalContext(Constants::C_GLOBAL); - // File menu separators - mfile->addSeparator(globalContext, Constants::G_FILE_SAVE); - mfile->addSeparator(globalContext, Constants::G_FILE_PRINT); - mfile->addSeparator(globalContext, Constants::G_FILE_CLOSE); - mfile->addSeparator(globalContext, Constants::G_FILE_OTHER); + mfile->addSeparator(Constants::G_FILE_SAVE); + mfile->addSeparator(Constants::G_FILE_PRINT); + mfile->addSeparator(Constants::G_FILE_CLOSE); + mfile->addSeparator(Constants::G_FILE_OTHER); // Edit menu separators - medit->addSeparator(globalContext, Constants::G_EDIT_COPYPASTE); - medit->addSeparator(globalContext, Constants::G_EDIT_SELECTALL); - medit->addSeparator(globalContext, Constants::G_EDIT_FIND); - medit->addSeparator(globalContext, Constants::G_EDIT_ADVANCED); + medit->addSeparator(Constants::G_EDIT_COPYPASTE); + medit->addSeparator(Constants::G_EDIT_SELECTALL); + medit->addSeparator(Constants::G_EDIT_FIND); + medit->addSeparator(Constants::G_EDIT_ADVANCED); // Return to editor shortcut: Note this requires Qt to fix up // handling of shortcut overrides in menus, item views, combos.... @@ -622,7 +620,7 @@ void MainWindow::registerDefaultActions() // Options Action mtools->appendGroup(Constants::G_TOOLS_OPTIONS); - mtools->addSeparator(globalContext, Constants::G_TOOLS_OPTIONS); + mtools->addSeparator(Constants::G_TOOLS_OPTIONS); m_optionsAction = new QAction(tr("&Options..."), this); m_optionsAction->setMenuRole(QAction::PreferencesRole); @@ -631,7 +629,7 @@ void MainWindow::registerDefaultActions() mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS); connect(m_optionsAction, SIGNAL(triggered()), this, SLOT(showOptionsDialog())); - mwindow->addSeparator(globalContext, Constants::G_WINDOW_LIST); + mwindow->addSeparator(Constants::G_WINDOW_LIST); if (UseMacShortcuts) { // Minimize Action @@ -659,7 +657,7 @@ void MainWindow::registerDefaultActions() mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); if (UseMacShortcuts) { - mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE); + mwindow->addSeparator(Constants::G_WINDOW_SIZE); QAction *closeAction = new QAction(tr("Close Window"), this); closeAction->setEnabled(false); @@ -667,7 +665,7 @@ void MainWindow::registerDefaultActions() cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Meta+W"))); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); - mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE); + mwindow->addSeparator(Constants::G_WINDOW_SIZE); } // Show Sidebar Action @@ -695,9 +693,9 @@ void MainWindow::registerDefaultActions() mviews->menu()->setTitle(tr("&Views")); // "Help" separators - mhelp->addSeparator(globalContext, Constants::G_HELP_SUPPORT); + mhelp->addSeparator(Constants::G_HELP_SUPPORT); if (!HostOsInfo::isMacHost()) - mhelp->addSeparator(globalContext, Constants::G_HELP_ABOUT); + mhelp->addSeparator(Constants::G_HELP_ABOUT); // About IDE Action icon = QIcon::fromTheme(QLatin1String("help-about")); diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index 1a7a7dc580..14865ff866 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -235,7 +235,7 @@ void OutputPaneManager::init() connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax())); m_minMaxButton->setDefaultAction(cmd->action()); - mpanes->addSeparator(Context(Constants::C_GLOBAL), "Coreplugin.OutputPane.ActionsGroup"); + mpanes->addSeparator("Coreplugin.OutputPane.ActionsGroup"); QFontMetrics titleFm = m_titleLabel->fontMetrics(); int minTitleWidth = 0; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index de5dc649db..432324a1b6 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -3267,17 +3267,14 @@ DebuggerPlugin::~DebuggerPlugin() bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage) { // Menu groups - const Context globalcontext(CC::C_GLOBAL); - ActionContainer *mstart = ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); - mstart->appendGroup(Constants::G_GENERAL); mstart->appendGroup(Constants::G_SPECIAL); mstart->appendGroup(Constants::G_START_QML); // Separators - mstart->addSeparator(globalcontext, Constants::G_GENERAL); - mstart->addSeparator(globalcontext, Constants::G_SPECIAL); + mstart->addSeparator(Constants::G_GENERAL); + mstart->addSeparator(Constants::G_SPECIAL); addAutoReleasedObject(new DebuggerItemManager); DebuggerItemManager::restoreDebuggers(); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 68bb5d0ebe..faef1ed2cf 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -541,7 +541,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er dd->m_proWindow = new ProjectWindow; addAutoReleasedObject(dd->m_proWindow); - Context globalcontext(Core::Constants::C_GLOBAL); Context projecTreeContext(Constants::C_PROJECT_TREE); dd->m_projectsMode = new ProjectsMode(dd->m_proWindow); @@ -735,12 +734,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er msessionContextMenu->addSeparator(projecTreeContext, Constants::G_SESSION_FILES); mprojectContextMenu->addSeparator(projecTreeContext, Constants::G_PROJECT_FILES); msubProjectContextMenu->addSeparator(projecTreeContext, Constants::G_PROJECT_FILES); - mfile->addSeparator(globalcontext, Core::Constants::G_FILE_PROJECT); - mbuild->addSeparator(globalcontext, Constants::G_BUILD_REBUILD); - msessionContextMenu->addSeparator(globalcontext, Constants::G_SESSION_OTHER); - mbuild->addSeparator(globalcontext, Constants::G_BUILD_CANCEL); - mbuild->addSeparator(globalcontext, Constants::G_BUILD_RUN); - mprojectContextMenu->addSeparator(globalcontext, Constants::G_PROJECT_REBUILD); + mfile->addSeparator(Core::Constants::G_FILE_PROJECT); + mbuild->addSeparator(Constants::G_BUILD_REBUILD); + msessionContextMenu->addSeparator(Constants::G_SESSION_OTHER); + mbuild->addSeparator(Constants::G_BUILD_CANCEL); + mbuild->addSeparator(Constants::G_BUILD_RUN); + mprojectContextMenu->addSeparator(Constants::G_PROJECT_REBUILD); // // Actions @@ -1055,15 +1054,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er cmd = ActionManager::registerAction(dd->m_projectTreeCollapseAllAction, Constants::PROJECTTREE_COLLAPSE_ALL, projecTreeContext); const Id treeGroup = Constants::G_PROJECT_TREE; - mfileContextMenu->addSeparator(globalcontext, treeGroup); + mfileContextMenu->addSeparator(treeGroup); mfileContextMenu->addAction(cmd, treeGroup); - msubProjectContextMenu->addSeparator(globalcontext, treeGroup); + msubProjectContextMenu->addSeparator(treeGroup); msubProjectContextMenu->addAction(cmd, treeGroup); - mfolderContextMenu->addSeparator(globalcontext, treeGroup); + mfolderContextMenu->addSeparator(treeGroup); mfolderContextMenu->addAction(cmd, treeGroup); - mprojectContextMenu->addSeparator(globalcontext, treeGroup); + mprojectContextMenu->addSeparator(treeGroup); mprojectContextMenu->addAction(cmd, treeGroup); - msessionContextMenu->addSeparator(globalcontext, treeGroup); + msessionContextMenu->addSeparator(treeGroup); msessionContextMenu->addAction(cmd, treeGroup); // target selector |