diff options
author | Eike Ziller <eike.ziller@nokia.com> | 2012-05-24 13:49:06 +0200 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-05-25 10:08:24 +0200 |
commit | 3934347fe9ed7e1567c3ff377f857928e8b03304 (patch) | |
tree | 09f1ccaf1af2d8032bb12ea0a5a05b4b4185d431 /src | |
parent | 7c7ccdc764629042729ceede4ca3e47b464aee42 (diff) | |
download | qt-creator-3934347fe9ed7e1567c3ff377f857928e8b03304.tar.gz |
ActionManager API cleanup.
d-pointer instead of inheritance
static methods
Change-Id: I7b2f0c8b05ad3951e1ff26a7d4e08e195d2dd258
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src')
76 files changed, 1191 insertions, 1330 deletions
diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index 3b5f2f17e0..cc8a1d15b7 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -258,12 +258,11 @@ AnalyzerManagerPrivate::~AnalyzerManagerPrivate() void AnalyzerManagerPrivate::setupActions() { - ActionManager *am = ICore::actionManager(); const Context globalcontext(C_GLOBAL); Command *command = 0; // Menus - m_menu = am->createMenu(M_DEBUG_ANALYZER); + m_menu = Core::ActionManager::createMenu(M_DEBUG_ANALYZER); m_menu->menu()->setTitle(tr("&Analyze")); m_menu->menu()->setEnabled(true); @@ -272,36 +271,36 @@ void AnalyzerManagerPrivate::setupActions() m_menu->appendGroup(G_ANALYZER_REMOTE_TOOLS); m_menu->appendGroup(G_ANALYZER_OPTIONS); - ActionContainer *menubar = am->actionContainer(MENU_BAR); - ActionContainer *mtools = am->actionContainer(M_TOOLS); + ActionContainer *menubar = Core::ActionManager::actionContainer(MENU_BAR); + ActionContainer *mtools = Core::ActionManager::actionContainer(M_TOOLS); menubar->addMenu(mtools, m_menu); m_startAction = new QAction(tr("Start"), m_menu); m_startAction->setIcon(QIcon(QLatin1String(ANALYZER_CONTROL_START_ICON))); - command = am->registerAction(m_startAction, "Analyzer.Start", globalcontext); + command = Core::ActionManager::registerAction(m_startAction, "Analyzer.Start", globalcontext); connect(m_startAction, SIGNAL(triggered()), this, SLOT(startTool())); m_stopAction = new QAction(tr("Stop"), m_menu); m_stopAction->setEnabled(false); m_stopAction->setIcon(QIcon(QLatin1String(ANALYZER_CONTROL_STOP_ICON))); - command = am->registerAction(m_stopAction, "Analyzer.Stop", globalcontext); + command = Core::ActionManager::registerAction(m_stopAction, "Analyzer.Stop", globalcontext); m_menu->addAction(command, G_ANALYZER_CONTROL); QAction *separatorAction1 = new QAction(m_menu); separatorAction1->setSeparator(true); - command = am->registerAction(separatorAction1, + command = Core::ActionManager::registerAction(separatorAction1, "Menu.Action.Analyzer.Tools.Separator1", globalcontext); m_menu->addAction(command, G_ANALYZER_TOOLS); QAction *separatorAction2 = new QAction(m_menu); separatorAction2->setSeparator(true); - command = am->registerAction(separatorAction2, + command = Core::ActionManager::registerAction(separatorAction2, "Menu.Action.Analyzer.Tools.Separator2", globalcontext); m_menu->addAction(command, G_ANALYZER_REMOTE_TOOLS); QAction *separatorAction3 = new QAction(m_menu); separatorAction3->setSeparator(true); - command = am->registerAction(separatorAction3, + command = Core::ActionManager::registerAction(separatorAction3, "Menu.Action.Analyzer.Tools.Separator3", globalcontext); m_menu->addAction(command, G_ANALYZER_OPTIONS); } @@ -334,21 +333,20 @@ void AnalyzerManagerPrivate::delayedInit() // Populate Windows->Views menu with standard actions. Context analyzerContext(C_ANALYZEMODE); - ActionManager *am = ICore::actionManager(); - ActionContainer *viewsMenu = am->actionContainer(Id(M_WINDOW_VIEWS)); - Command *cmd = am->registerAction(m_mainWindow->menuSeparator1(), + ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Id(M_WINDOW_VIEWS)); + Command *cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator1(), Id("Analyzer.Views.Separator1"), analyzerContext); cmd->setAttribute(Command::CA_Hide); viewsMenu->addAction(cmd, G_DEFAULT_THREE); - cmd = am->registerAction(m_mainWindow->toggleLockedAction(), + cmd = Core::ActionManager::registerAction(m_mainWindow->toggleLockedAction(), Id("Analyzer.Views.ToggleLocked"), analyzerContext); cmd->setAttribute(Command::CA_Hide); viewsMenu->addAction(cmd, G_DEFAULT_THREE); - cmd = am->registerAction(m_mainWindow->menuSeparator2(), + cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator2(), Id("Analyzer.Views.Separator2"), analyzerContext); cmd->setAttribute(Command::CA_Hide); viewsMenu->addAction(cmd, G_DEFAULT_THREE); - cmd = am->registerAction(m_mainWindow->resetLayoutAction(), + cmd = Core::ActionManager::registerAction(m_mainWindow->resetLayoutAction(), Id("Analyzer.Views.ResetSimple"), analyzerContext); cmd->setAttribute(Command::CA_Hide); viewsMenu->addAction(cmd, G_DEFAULT_THREE); @@ -428,22 +426,20 @@ void AnalyzerManagerPrivate::activateDock(Qt::DockWidgetArea area, QDockWidget * Context globalContext(C_GLOBAL); - ActionManager *am = ICore::actionManager(); QAction *toggleViewAction = dockWidget->toggleViewAction(); toggleViewAction->setText(dockWidget->windowTitle()); - Command *cmd = am->registerAction(toggleViewAction, + Command *cmd = Core::ActionManager::registerAction(toggleViewAction, Id(QLatin1String("Analyzer.") + dockWidget->objectName()), globalContext); cmd->setAttribute(Command::CA_Hide); - ActionContainer *viewsMenu = am->actionContainer(Id(M_WINDOW_VIEWS)); + ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Id(M_WINDOW_VIEWS)); viewsMenu->addAction(cmd); } void AnalyzerManagerPrivate::deactivateDock(QDockWidget *dockWidget) { - ActionManager *am = ICore::actionManager(); QAction *toggleViewAction = dockWidget->toggleViewAction(); - am->unregisterAction(toggleViewAction, Id(QLatin1String("Analyzer.") + dockWidget->objectName())); + Core::ActionManager::unregisterAction(toggleViewAction, Id(QLatin1String("Analyzer.") + dockWidget->objectName())); m_mainWindow->removeDockWidget(dockWidget); dockWidget->hide(); // Prevent saveState storing the data of the wrong children. @@ -682,13 +678,12 @@ void AnalyzerManagerPrivate::addTool(IAnalyzerTool *tool, const StartModes &mode delayedInit(); // Make sure that there is a valid IMode instance. const bool blocked = m_toolBox->blockSignals(true); // Do not make current. - ActionManager *am = ICore::actionManager(); foreach (StartMode mode, modes) { QString actionName = tool->actionName(mode); Id menuGroup = tool->menuGroup(mode); Id actionId = tool->actionId(mode); QAction *action = new QAction(actionName, 0); - Command *command = am->registerAction(action, actionId, Context(C_GLOBAL)); + Command *command = Core::ActionManager::registerAction(action, actionId, Context(C_GLOBAL)); m_menu->addAction(command, menuGroup); command->action()->setData(int(StartLocal)); // Assuming this happens before project loading. diff --git a/src/plugins/bazaar/bazaarplugin.cpp b/src/plugins/bazaar/bazaarplugin.cpp index a377b74fe9..79f3fcbede 100644 --- a/src/plugins/bazaar/bazaarplugin.cpp +++ b/src/plugins/bazaar/bazaarplugin.cpp @@ -155,8 +155,6 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag m_client = new BazaarClient(&m_bazaarSettings); initializeVcs(new BazaarControl(m_client)); - m_actionManager = Core::ICore::actionManager(); - m_optionsPage = new OptionsPage(); addAutoReleasedObject(m_optionsPage); m_bazaarSettings.readSettings(Core::ICore::settings()); @@ -214,7 +212,7 @@ void BazaarPlugin::createMenu() Core::Context context(Core::Constants::C_GLOBAL); // Create menu item for Bazaar - m_bazaarContainer = m_actionManager->createMenu(Core::Id("Bazaar.BazaarMenu")); + m_bazaarContainer = Core::ActionManager::createMenu(Core::Id("Bazaar.BazaarMenu")); QMenu *menu = m_bazaarContainer->menu(); menu->setTitle(tr("Bazaar")); @@ -226,7 +224,7 @@ void BazaarPlugin::createMenu() createSeparator(context, Core::Id("Bazaar.Repository Management")); // Request the Tools menu and add the Bazaar menu to it - Core::ActionContainer *toolsMenu = m_actionManager->actionContainer(Core::Id(Core::Constants::M_TOOLS)); + Core::ActionContainer *toolsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_TOOLS)); toolsMenu->addMenu(m_bazaarContainer); m_menuAction = m_bazaarContainer->menu()->menuAction(); } @@ -236,14 +234,14 @@ void BazaarPlugin::createFileActions(const Core::Context &context) Core::Command *command; m_annotateFile = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = m_actionManager->registerAction(m_annotateFile, Core::Id(Constants::ANNOTATE), context); + command = Core::ActionManager::registerAction(m_annotateFile, Core::Id(Constants::ANNOTATE), context); command->setAttribute(Core::Command::CA_UpdateText); connect(m_annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); m_diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = m_actionManager->registerAction(m_diffFile, Core::Id(Constants::DIFF), context); + command = Core::ActionManager::registerAction(m_diffFile, Core::Id(Constants::DIFF), context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+D") : tr("ALT+Z,Alt+D"))); connect(m_diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); @@ -251,7 +249,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context) m_commandLocator->appendCommand(command); m_logFile = new Utils::ParameterAction(tr("Log Current File"), tr("Log \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = m_actionManager->registerAction(m_logFile, Core::Id(Constants::LOG), context); + command = Core::ActionManager::registerAction(m_logFile, Core::Id(Constants::LOG), context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+L") : tr("ALT+Z,Alt+L"))); connect(m_logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile())); @@ -259,7 +257,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context) m_commandLocator->appendCommand(command); m_statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = m_actionManager->registerAction(m_statusFile, Core::Id(Constants::STATUS), context); + command = Core::ActionManager::registerAction(m_statusFile, Core::Id(Constants::STATUS), context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+S") : tr("ALT+Z,Alt+S"))); connect(m_statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile())); @@ -269,21 +267,21 @@ void BazaarPlugin::createFileActions(const Core::Context &context) createSeparator(context, Core::Id("Bazaar.FileDirSeperator1")); m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = m_actionManager->registerAction(m_addAction, Core::Id(Constants::ADD), context); + command = Core::ActionManager::registerAction(m_addAction, Core::Id(Constants::ADD), context); command->setAttribute(Core::Command::CA_UpdateText); connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); - command = m_actionManager->registerAction(m_deleteAction, Core::Id(Constants::DELETE), context); + command = Core::ActionManager::registerAction(m_deleteAction, Core::Id(Constants::DELETE), context); command->setAttribute(Core::Command::CA_UpdateText); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); m_revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); - command = m_actionManager->registerAction(m_revertFile, Core::Id(Constants::REVERT), context); + command = Core::ActionManager::registerAction(m_revertFile, Core::Id(Constants::REVERT), context); command->setAttribute(Core::Command::CA_UpdateText); connect(m_revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); m_bazaarContainer->addAction(command); @@ -348,28 +346,28 @@ void BazaarPlugin::createDirectoryActions(const Core::Context &context) action = new QAction(tr("Diff"), this); m_repositoryActionList.append(action); - command = m_actionManager->registerAction(action, Core::Id(Constants::DIFFMULTI), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::DIFFMULTI), context); connect(action, SIGNAL(triggered()), this, SLOT(diffRepository())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Log"), this); m_repositoryActionList.append(action); - command = m_actionManager->registerAction(action, Core::Id(Constants::LOGMULTI), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::LOGMULTI), context); connect(action, SIGNAL(triggered()), this, SLOT(logRepository())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Revert..."), this); m_repositoryActionList.append(action); - command = m_actionManager->registerAction(action, Core::Id(Constants::REVERTMULTI), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::REVERTMULTI), context); connect(action, SIGNAL(triggered()), this, SLOT(revertAll())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Status"), this); m_repositoryActionList.append(action); - command = m_actionManager->registerAction(action, Core::Id(Constants::STATUSMULTI), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::STATUSMULTI), context); connect(action, SIGNAL(triggered()), this, SLOT(statusMulti())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -419,35 +417,35 @@ void BazaarPlugin::createRepositoryActions(const Core::Context &context) action = new QAction(tr("Pull..."), this); m_repositoryActionList.append(action); - command = m_actionManager->registerAction(action, Core::Id(Constants::PULL), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::PULL), context); connect(action, SIGNAL(triggered()), this, SLOT(pull())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Push..."), this); m_repositoryActionList.append(action); - command = m_actionManager->registerAction(action, Core::Id(Constants::PUSH), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::PUSH), context); connect(action, SIGNAL(triggered()), this, SLOT(push())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Update..."), this); m_repositoryActionList.append(action); - command = m_actionManager->registerAction(action, Core::Id(Constants::UPDATE), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::UPDATE), context); connect(action, SIGNAL(triggered()), this, SLOT(update())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Commit..."), this); m_repositoryActionList.append(action); - command = m_actionManager->registerAction(action, Core::Id(Constants::COMMIT), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::COMMIT), context); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+C") : tr("ALT+Z,Alt+C"))); connect(action, SIGNAL(triggered()), this, SLOT(commit())); m_bazaarContainer->addAction(command); m_commandLocator->appendCommand(command); QAction *createRepositoryAction = new QAction(tr("Create Repository..."), this); - command = m_actionManager->registerAction(createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context); + command = Core::ActionManager::registerAction(createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context); connect(createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository())); m_bazaarContainer->addAction(command); } @@ -514,18 +512,18 @@ void BazaarPlugin::createSubmitEditorActions() Core::Command *command; m_editorCommit = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); - command = m_actionManager->registerAction(m_editorCommit, Core::Id(Constants::COMMIT), context); + command = Core::ActionManager::registerAction(m_editorCommit, Core::Id(Constants::COMMIT), context); command->setAttribute(Core::Command::CA_UpdateText); connect(m_editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor())); m_editorDiff = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); - command = m_actionManager->registerAction(m_editorDiff, Core::Id(Constants::DIFFEDITOR), context); + command = Core::ActionManager::registerAction(m_editorDiff, Core::Id(Constants::DIFFEDITOR), context); m_editorUndo = new QAction(tr("&Undo"), this); - command = m_actionManager->registerAction(m_editorUndo, Core::Id(Core::Constants::UNDO), context); + command = Core::ActionManager::registerAction(m_editorUndo, Core::Id(Core::Constants::UNDO), context); m_editorRedo = new QAction(tr("&Redo"), this); - command = m_actionManager->registerAction(m_editorRedo, Core::Id(Core::Constants::REDO), context); + command = Core::ActionManager::registerAction(m_editorRedo, Core::Id(Core::Constants::REDO), context); } void BazaarPlugin::commit() @@ -682,7 +680,7 @@ void BazaarPlugin::createSeparator(const Core::Context &context, const Core::Id { QAction *action = new QAction(this); action->setSeparator(true); - m_bazaarContainer->addAction(m_actionManager->registerAction(action, id, context)); + m_bazaarContainer->addAction(Core::ActionManager::registerAction(action, id, context)); } void BazaarPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as) diff --git a/src/plugins/bazaar/bazaarplugin.h b/src/plugins/bazaar/bazaarplugin.h index f64372c814..9d62b6b746 100644 --- a/src/plugins/bazaar/bazaarplugin.h +++ b/src/plugins/bazaar/bazaarplugin.h @@ -139,7 +139,6 @@ private: BazaarClient *m_client; Locator::CommandLocator *m_commandLocator; - Core::ActionManager *m_actionManager; Core::ActionContainer *m_bazaarContainer; QList<QAction *> m_repositoryActionList; diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 02bad814e7..5d5d2a805b 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -464,7 +464,7 @@ BinEditorPlugin::~BinEditorPlugin() QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title) { QAction *result = new QAction(title, this); - Core::ICore::actionManager()->registerAction(result, Core::Id(id), m_context); + Core::ActionManager::registerAction(result, Core::Id(id), m_context); return result; } diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index a0562e8354..7fbcb454f0 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -70,52 +70,51 @@ void BookmarksPlugin::extensionsInitialized() bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) { - Core::ActionManager *am = Core::ICore::actionManager(); Core::Context textcontext(TextEditor::Constants::C_TEXTEDITOR); Core::Context globalcontext(Core::Constants::C_GLOBAL); - Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); - Core::ActionContainer *mbm = am->createMenu(Core::Id(BOOKMARKS_MENU)); + Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); + Core::ActionContainer *mbm = Core::ActionManager::createMenu(Core::Id(BOOKMARKS_MENU)); mbm->menu()->setTitle(tr("&Bookmarks")); mtools->addMenu(mbm); //Toggle m_toggleAction = new QAction(tr("Toggle Bookmark"), this); Core::Command *cmd = - am->registerAction(m_toggleAction, BOOKMARKS_TOGGLE_ACTION, textcontext); + Core::ActionManager::registerAction(m_toggleAction, BOOKMARKS_TOGGLE_ACTION, textcontext); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+M") : tr("Ctrl+M"))); mbm->addAction(cmd); QAction *sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("Bookmarks.Sep.Toggle"), textcontext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("Bookmarks.Sep.Toggle"), textcontext); mbm->addAction(cmd); //Previous m_prevAction = new QAction(tr("Previous Bookmark"), this); - cmd = am->registerAction(m_prevAction, BOOKMARKS_PREV_ACTION, globalcontext); + cmd = Core::ActionManager::registerAction(m_prevAction, BOOKMARKS_PREV_ACTION, globalcontext); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+,") : tr("Ctrl+,"))); mbm->addAction(cmd); //Next m_nextAction = new QAction(tr("Next Bookmark"), this); - cmd = am->registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION, globalcontext); + cmd = Core::ActionManager::registerAction(m_nextAction, BOOKMARKS_NEXT_ACTION, globalcontext); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+.") : tr("Ctrl+."))); mbm->addAction(cmd); sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("Bookmarks.Sep.DirNavigation"), globalcontext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("Bookmarks.Sep.DirNavigation"), globalcontext); mbm->addAction(cmd); //Previous Doc m_docPrevAction = new QAction(tr("Previous Bookmark in Document"), this); - cmd = am->registerAction(m_docPrevAction, BOOKMARKS_PREVDOC_ACTION, globalcontext); + cmd = Core::ActionManager::registerAction(m_docPrevAction, BOOKMARKS_PREVDOC_ACTION, globalcontext); mbm->addAction(cmd); //Next Doc m_docNextAction = new QAction(tr("Next Bookmark in Document"), this); - cmd = am->registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, globalcontext); + cmd = Core::ActionManager::registerAction(m_docNextAction, BOOKMARKS_NEXTDOC_ACTION, globalcontext); mbm->addAction(cmd); m_bookmarkManager = new BookmarkManager; diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index a38671bd74..c5f4e857fc 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -146,8 +146,7 @@ void CMakeEditorWidget::contextMenuEvent(QContextMenuEvent *e) { QMenu *menu = new QMenu(); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); - Core::ActionContainer *mcontext = am->actionContainer(Constants::M_CONTEXT); + Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(Constants::M_CONTEXT); QMenu *contextMenu = mcontext->menu(); foreach (QAction *action, contextMenu->actions()) diff --git a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp index c48d41c0d0..5427598a18 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditorfactory.cpp @@ -57,20 +57,19 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager) TextEditorActionHandler::UnCommentSelection | TextEditorActionHandler::JumpToFileUnderCursor); - ActionManager *am = ICore::actionManager(); - ActionContainer *contextMenu = am->createMenu(Constants::M_CONTEXT); + ActionContainer *contextMenu = Core::ActionManager::createMenu(Constants::M_CONTEXT); Command *cmd; Context cmakeEditorContext = Context(Constants::C_CMAKEEDITOR); - cmd = am->command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR); + cmd = Core::ActionManager::command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR); contextMenu->addAction(cmd); QAction *separator = new QAction(this); separator->setSeparator(true); - contextMenu->addAction(am->registerAction(separator, + contextMenu->addAction(Core::ActionManager::registerAction(separator, Id(Constants::SEPARATOR), cmakeEditorContext)); - cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); + cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); } diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index cc8fc85958..e6b81c209b 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -67,25 +67,25 @@ CMakeManager::CMakeManager(CMakeSettingsPage *cmakeSettingsPage) connect(projectExplorer, SIGNAL(aboutToShowContextMenu(ProjectExplorer::Project*,ProjectExplorer::Node*)), this, SLOT(updateContextMenu(ProjectExplorer::Project*,ProjectExplorer::Node*))); - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *mbuild = - am->actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); Core::ActionContainer *mproject = - am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); Core::ActionContainer *msubproject = - am->actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT); const Core::Context projectContext(CMakeProjectManager::Constants::PROJECTCONTEXT); m_runCMakeAction = new QAction(QIcon(), tr("Run CMake"), this); - Core::Command *command = am->registerAction(m_runCMakeAction, Constants::RUNCMAKE, projectContext); + Core::Command *command = Core::ActionManager::registerAction(m_runCMakeAction, + Constants::RUNCMAKE, projectContext); command->setAttribute(Core::Command::CA_Hide); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_DEPLOY); connect(m_runCMakeAction, SIGNAL(triggered()), this, SLOT(runCMake())); m_runCMakeActionContextMenu = new QAction(QIcon(), tr("Run CMake"), this); - command = am->registerAction(m_runCMakeActionContextMenu, Constants::RUNCMAKECONTEXTMENU, projectContext); + command = Core::ActionManager::registerAction(m_runCMakeActionContextMenu, + Constants::RUNCMAKECONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index fc80dde8b7..e1c46089c9 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -30,6 +30,7 @@ ** **************************************************************************/ +#include "actionmanager.h" #include "actionmanager_p.h" #include "mainwindow.h" #include "actioncontainer_p.h" @@ -53,6 +54,9 @@ namespace { enum { warnAboutFindFailures = 0 }; } +using namespace Core; +using namespace Core::Internal; + /*! \class Core::ActionManager \mainclass @@ -61,11 +65,8 @@ namespace { menu items and keyboard shortcuts. The ActionManager is the central bookkeeper of actions and their shortcuts and layout. - You get the only implementation of this class from the core interface - ICore::actionManager() method, e.g. - \code - Core::ICore::actionManager() - \endcode + It is a singleton containing mostly static methods. If you need access to the instance, + e.g. for connecting to signals, is its ActionManager::instance() method. The main reasons for the need of this class is to provide a central place where the user can specify all his keyboard shortcuts, and to provide a solution for actions that should @@ -73,7 +74,7 @@ namespace { \section1 Contexts - All actions that are registered with the same string ID (but different context lists) + All actions that are registered with the same Id (but different context lists) are considered to be overloads of the same command, represented by an instance of the Command class. Exactly only one of the registered actions with the same ID is active at any time. @@ -99,9 +100,8 @@ namespace { To register a globally active action "My Action" put the following in your plugin's IPlugin::initialize method: \code - Core::ActionManager *am = Core::ICore::actionManager(); QAction *myAction = new QAction(tr("My Action"), this); - Core::Command *cmd = am->registerAction(myAction, + Core::Command *cmd = Core::ActionManager::registerAction(myAction, "myplugin.myaction", Core::Context(C_GLOBAL)); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+u"))); @@ -125,7 +125,7 @@ namespace { Following the example adding "My Action" to the "Tools" menu would be done by \code - am->actionContainer(Core::M_TOOLS)->addAction(cmd); + Core::ActionManager::actionContainer(Core::M_TOOLS)->addAction(cmd); \endcode \section1 Important Guidelines: @@ -146,9 +146,36 @@ namespace { \sa Core::IContext */ +static ActionManager *m_instance = 0; + /*! - \fn ActionContainer *ActionManager::createMenu(const Id &id) - \brief Creates a new menu with the given string \a id. + \internal +*/ +ActionManager::ActionManager(QObject *parent) + : QObject(parent), + d(new ActionManagerPrivate()) +{ + m_instance = this; +} + +/*! + \internal +*/ +ActionManager::~ActionManager() +{ + delete d; +} + +/*! + * \return Singleton action manager instance + */ +ActionManager *ActionManager::instance() +{ + return m_instance; +} + +/*! + \brief Creates a new menu with the given \a id. Returns a new ActionContainer that you can use to get the QMenu instance or to add menu items to the menu. The ActionManager owns @@ -156,19 +183,51 @@ namespace { Add your menu to some other menu or a menu bar via the ActionManager::actionContainer and ActionContainer::addMenu methods. */ +ActionContainer *ActionManager::createMenu(const Id &id) +{ + const ActionManagerPrivate::IdContainerMap::const_iterator it = m_instance->d->m_idContainerMap.constFind(id); + if (it != m_instance->d->m_idContainerMap.constEnd()) + return it.value(); + + QMenu *m = new QMenu(ICore::mainWindow()); + m->setObjectName(QLatin1String(id.name())); + + MenuActionContainer *mc = new MenuActionContainer(id); + mc->setMenu(m); + + m_instance->d->m_idContainerMap.insert(id, mc); + connect(mc, SIGNAL(destroyed()), m_instance->d, SLOT(containerDestroyed())); + + return mc; +} /*! - \fn ActionContainer *ActionManager::createMenuBar(const Id &id) - \brief Creates a new menu bar with the given string \a id. + \brief Creates a new menu bar with the given \a id. Returns a new ActionContainer that you can use to get the QMenuBar instance or to add menus to the menu bar. The ActionManager owns the returned ActionContainer. */ +ActionContainer *ActionManager::createMenuBar(const Id &id) +{ + const ActionManagerPrivate::IdContainerMap::const_iterator it = m_instance->d->m_idContainerMap.constFind(id); + if (it != m_instance->d->m_idContainerMap.constEnd()) + return it.value(); + + QMenuBar *mb = new QMenuBar; // No parent (System menu bar on Mac OS X) + mb->setObjectName(id.toString()); + + MenuBarActionContainer *mbc = new MenuBarActionContainer(id); + mbc->setMenuBar(mb); + + m_instance->d->m_idContainerMap.insert(id, mbc); + connect(mbc, SIGNAL(destroyed()), m_instance->d, SLOT(containerDestroyed())); + + return mbc; +} /*! - \fn Command *ActionManager::registerAction(QAction *action, const Id &id, const Context &context, bool scriptable) - \brief Makes an \a action known to the system under the specified string \a id. + \brief Makes an \a action known to the system under the specified \a id. Returns a command object that represents the action in the application and is owned by the ActionManager. You can register several actions with the @@ -178,10 +237,19 @@ namespace { A scriptable action can be called from a script without the need for the user to interact with it. */ +Command *ActionManager::registerAction(QAction *action, const Id &id, const Context &context, bool scriptable) +{ + Action *a = m_instance->d->overridableAction(id); + if (a) { + a->addOverrideAction(action, context, scriptable); + emit m_instance->commandListChanged(); + emit m_instance->commandAdded(id.toString()); + } + return a; +} /*! - \fn Command *ActionManager::registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable) - \brief Makes a \a shortcut known to the system under the specified string \a id. + \brief Makes a \a shortcut known to the system under the specified \a id. Returns a command object that represents the shortcut in the application and is owned by the ActionManager. You can registered several shortcuts with the @@ -191,47 +259,199 @@ namespace { A scriptable shortcut can be called from a script without the need for the user to interact with it. */ +Command *ActionManager::registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable) +{ + Shortcut *sc = 0; + if (CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0)) { + sc = qobject_cast<Shortcut *>(c); + if (!sc) { + qWarning() << "registerShortcut: id" << id.name() + << "is registered with a different command type."; + return c; + } + } else { + sc = new Shortcut(id); + m_instance->d->m_idCmdMap.insert(id, sc); + } + + if (sc->shortcut()) { + qWarning() << "registerShortcut: action already registered, id" << id.name() << "."; + return sc; + } + + if (!m_instance->d->hasContext(context)) + shortcut->setEnabled(false); + shortcut->setObjectName(id.toString()); + shortcut->setParent(ICore::mainWindow()); + sc->setShortcut(shortcut); + sc->setScriptable(scriptable); + + if (context.isEmpty()) + sc->setContext(Context(0)); + else + sc->setContext(context); + + emit m_instance->commandListChanged(); + emit m_instance->commandAdded(id.toString()); + + if (isPresentationModeEnabled()) + connect(sc->shortcut(), SIGNAL(activated()), m_instance->d, SLOT(shortcutTriggered())); + return sc; +} /*! - \fn Command *ActionManager::command(const Id &id) const \brief Returns the Command object that is known to the system - under the given string \a id. + under the given \a id. \sa ActionManager::registerAction() */ +Command *ActionManager::command(const Id &id) +{ + const ActionManagerPrivate::IdCmdMap::const_iterator it = m_instance->d->m_idCmdMap.constFind(id); + if (it == m_instance->d->m_idCmdMap.constEnd()) { + if (warnAboutFindFailures) + qWarning() << "ActionManagerPrivate::command(): failed to find :" + << id.name(); + return 0; + } + return it.value(); +} /*! - \fn ActionContainer *ActionManager::actionContainer(const Id &id) const \brief Returns the IActionContainter object that is know to the system - under the given string \a id. + under the given \a id. \sa ActionManager::createMenu() \sa ActionManager::createMenuBar() */ +ActionContainer *ActionManager::actionContainer(const Id &id) +{ + const ActionManagerPrivate::IdContainerMap::const_iterator it = m_instance->d->m_idContainerMap.constFind(id); + if (it == m_instance->d->m_idContainerMap.constEnd()) { + if (warnAboutFindFailures) + qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :" + << id.name(); + return 0; + } + return it.value(); +} /*! - \fn Command *ActionManager::unregisterAction(QAction *action, const Id &id) - \brief Removes the knowledge about an \a action under the specified string \a id. + * \brief Returns all commands that have been registered. + */ +QList<Command *> ActionManager::commands() +{ + // transform list of CommandPrivate into list of Command + QList<Command *> result; + foreach (Command *cmd, m_instance->d->m_idCmdMap.values()) + result << cmd; + return result; +} + +/*! + \brief Removes the knowledge about an \a action under the specified \a id. Usually you do not need to unregister actions. The only valid use case for unregistering actions, is for actions that represent user definable actions, like for the custom Locator filters. If the user removes such an action, it also has to be unregistered from the action manager, to make it disappear from shortcut settings etc. */ +void ActionManager::unregisterAction(QAction *action, const Id &id) +{ + Action *a = 0; + CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0); + QTC_ASSERT(c, return); + a = qobject_cast<Action *>(c); + if (!a) { + qWarning() << "unregisterAction: id" << id.name() + << "is registered with a different command type."; + return; + } + a->removeOverrideAction(action); + if (a->isEmpty()) { + // clean up + // ActionContainers listen to the commands' destroyed signals + ICore::mainWindow()->removeAction(a->action()); + delete a->action(); + m_instance->d->m_idCmdMap.remove(id); + delete a; + } + emit m_instance->commandListChanged(); +} /*! - \fn ActionManager::ActionManager(QObject *parent) - \internal -*/ -/*! - \fn ActionManager::~ActionManager() - \internal + \brief Removes the knowledge about a shortcut under the specified \a id. + + Usually you do not need to unregister shortcuts. The only valid use case for unregistering + shortcuts, is for shortcuts that represent user definable actions. If the user removes such an action, + a corresponding shortcut also has to be unregistered from the action manager, + to make it disappear from shortcut settings etc. */ +void ActionManager::unregisterShortcut(const Core::Id &id) +{ + Shortcut *sc = 0; + CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0); + QTC_ASSERT(c, return); + sc = qobject_cast<Shortcut *>(c); + if (!sc) { + qWarning() << "unregisterShortcut: id" << id.name() + << "is registered with a different command type."; + return; + } + delete sc->shortcut(); + m_instance->d->m_idCmdMap.remove(id); + delete sc; + emit m_instance->commandListChanged(); +} -using namespace Core; -using namespace Core::Internal; -ActionManagerPrivate* ActionManagerPrivate::m_instance = 0; +void ActionManager::setPresentationModeEnabled(bool enabled) +{ + if (enabled == isPresentationModeEnabled()) + return; + + // Signal/slots to commands: + foreach (Command *c, commands()) { + if (c->action()) { + if (enabled) + connect(c->action(), SIGNAL(triggered()), m_instance->d, SLOT(actionTriggered())); + else + disconnect(c->action(), SIGNAL(triggered()), m_instance->d, SLOT(actionTriggered())); + } + if (c->shortcut()) { + if (enabled) + connect(c->shortcut(), SIGNAL(activated()), m_instance->d, SLOT(shortcutTriggered())); + else + disconnect(c->shortcut(), SIGNAL(activated()), m_instance->d, SLOT(shortcutTriggered())); + } + } + + // The label for the shortcuts: + if (!m_instance->d->m_presentationLabel) { + m_instance->d->m_presentationLabel = new QLabel(0, Qt::ToolTip | Qt::WindowStaysOnTopHint); + QFont font = m_instance->d->m_presentationLabel->font(); + font.setPixelSize(45); + m_instance->d->m_presentationLabel->setFont(font); + m_instance->d->m_presentationLabel->setAlignment(Qt::AlignCenter); + m_instance->d->m_presentationLabel->setMargin(5); + + connect(&m_instance->d->m_presentationLabelTimer, SIGNAL(timeout()), m_instance->d->m_presentationLabel, SLOT(hide())); + } else { + m_instance->d->m_presentationLabelTimer.stop(); + delete m_instance->d->m_presentationLabel; + m_instance->d->m_presentationLabel = 0; + } +} + +bool ActionManager::isPresentationModeEnabled() +{ + return m_instance->d->m_presentationLabel; +} + +bool ActionManager::hasContext(int context) +{ + return m_instance->d->m_context.contains(context); +} /*! \class ActionManagerPrivate @@ -239,13 +459,10 @@ ActionManagerPrivate* ActionManagerPrivate::m_instance = 0; \internal */ -ActionManagerPrivate::ActionManagerPrivate(MainWindow *mainWnd) - : ActionManager(mainWnd), - m_mainWnd(mainWnd), - m_presentationLabel(0) +ActionManagerPrivate::ActionManagerPrivate() + : m_presentationLabel(0) { m_presentationLabelTimer.setInterval(1000); - m_instance = this; } ActionManagerPrivate::~ActionManagerPrivate() @@ -257,25 +474,6 @@ ActionManagerPrivate::~ActionManagerPrivate() qDeleteAll(m_idCmdMap.values()); } -ActionManagerPrivate *ActionManagerPrivate::instance() -{ - return m_instance; -} - -QList<Command *> ActionManagerPrivate::commands() const -{ - // transform list of CommandPrivate into list of Command - QList<Command *> result; - foreach (Command *cmd, m_idCmdMap.values()) - result << cmd; - return result; -} - -bool ActionManagerPrivate::hasContext(int context) const -{ - return m_context.contains(context); -} - QDebug operator<<(QDebug in, const Context &context) { in << "CONTEXT: "; @@ -304,42 +502,6 @@ bool ActionManagerPrivate::hasContext(const Context &context) const return false; } -ActionContainer *ActionManagerPrivate::createMenu(const Id &id) -{ - const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id); - if (it != m_idContainerMap.constEnd()) - return it.value(); - - QMenu *m = new QMenu(m_mainWnd); - m->setObjectName(QLatin1String(id.name())); - - MenuActionContainer *mc = new MenuActionContainer(id); - mc->setMenu(m); - - m_idContainerMap.insert(id, mc); - connect(mc, SIGNAL(destroyed()), this, SLOT(containerDestroyed())); - - return mc; -} - -ActionContainer *ActionManagerPrivate::createMenuBar(const Id &id) -{ - const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id); - if (it != m_idContainerMap.constEnd()) - return it.value(); - - QMenuBar *mb = new QMenuBar; // No parent (System menu bar on Mac OS X) - mb->setObjectName(id.toString()); - - MenuBarActionContainer *mbc = new MenuBarActionContainer(id); - mbc->setMenuBar(mb); - - m_idContainerMap.insert(id, mbc); - connect(mbc, SIGNAL(destroyed()), this, SLOT(containerDestroyed())); - - return mbc; -} - void ActionManagerPrivate::containerDestroyed() { ActionContainerPrivate *container = static_cast<ActionContainerPrivate *>(sender()); @@ -362,13 +524,13 @@ void ActionManagerPrivate::shortcutTriggered() void ActionManagerPrivate::showShortcutPopup(const QString &shortcut) { - if (shortcut.isEmpty() || !isPresentationModeEnabled()) + if (shortcut.isEmpty() || !ActionManager::isPresentationModeEnabled()) return; m_presentationLabel->setText(shortcut); m_presentationLabel->adjustSize(); - QPoint p = m_mainWnd->mapToGlobal(m_mainWnd->rect().center() - m_presentationLabel->rect().center()); + QPoint p = ICore::mainWindow()->mapToGlobal(ICore::mainWindow()->rect().center() - m_presentationLabel->rect().center()); m_presentationLabel->move(p); m_presentationLabel->show(); @@ -376,17 +538,6 @@ void ActionManagerPrivate::showShortcutPopup(const QString &shortcut) m_presentationLabelTimer.start(); } -Command *ActionManagerPrivate::registerAction(QAction *action, const Id &id, const Context &context, bool scriptable) -{ - Action *a = overridableAction(id); - if (a) { - a->addOverrideAction(action, context, scriptable); - emit commandListChanged(); - emit commandAdded(id.toString()); - } - return a; -} - Action *ActionManagerPrivate::overridableAction(const Id &id) { Action *a = 0; @@ -400,105 +551,18 @@ Action *ActionManagerPrivate::overridableAction(const Id &id) } else { a = new Action(id); m_idCmdMap.insert(id, a); - m_mainWnd->addAction(a->action()); + ICore::mainWindow()->addAction(a->action()); a->action()->setObjectName(id.toString()); a->action()->setShortcutContext(Qt::ApplicationShortcut); a->setCurrentContext(m_context); - if (isPresentationModeEnabled()) + if (ActionManager::isPresentationModeEnabled()) connect(a->action(), SIGNAL(triggered()), this, SLOT(actionTriggered())); } return a; } -void ActionManagerPrivate::unregisterAction(QAction *action, const Id &id) -{ - Action *a = 0; - CommandPrivate *c = m_idCmdMap.value(id, 0); - QTC_ASSERT(c, return); - a = qobject_cast<Action *>(c); - if (!a) { - qWarning() << "unregisterAction: id" << id.name() - << "is registered with a different command type."; - return; - } - a->removeOverrideAction(action); - if (a->isEmpty()) { - // clean up - // ActionContainers listen to the commands' destroyed signals - m_mainWnd->removeAction(a->action()); - delete a->action(); - m_idCmdMap.remove(id); - delete a; - } - emit commandListChanged(); -} - -Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable) -{ - Shortcut *sc = 0; - if (CommandPrivate *c = m_idCmdMap.value(id, 0)) { - sc = qobject_cast<Shortcut *>(c); - if (!sc) { - qWarning() << "registerShortcut: id" << id.name() - << "is registered with a different command type."; - return c; - } - } else { - sc = new Shortcut(id); - m_idCmdMap.insert(id, sc); - } - - if (sc->shortcut()) { - qWarning() << "registerShortcut: action already registered, id" << id.name() << "."; - return sc; - } - - if (!hasContext(context)) - shortcut->setEnabled(false); - shortcut->setObjectName(id.toString()); - shortcut->setParent(m_mainWnd); - sc->setShortcut(shortcut); - sc->setScriptable(scriptable); - - if (context.isEmpty()) - sc->setContext(Context(0)); - else - sc->setContext(context); - - emit commandListChanged(); - emit commandAdded(id.toString()); - - if (isPresentationModeEnabled()) - connect(sc->shortcut(), SIGNAL(activated()), this, SLOT(shortcutTriggered())); - return sc; -} - -Command *ActionManagerPrivate::command(const Id &id) const -{ - const IdCmdMap::const_iterator it = m_idCmdMap.constFind(id); - if (it == m_idCmdMap.constEnd()) { - if (warnAboutFindFailures) - qWarning() << "ActionManagerPrivate::command(): failed to find :" - << id.name(); - return 0; - } - return it.value(); -} - -ActionContainer *ActionManagerPrivate::actionContainer(const Id &id) const -{ - const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id); - if (it == m_idContainerMap.constEnd()) { - if (warnAboutFindFailures) - qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :" - << id.name(); - return 0; - } - return it.value(); -} - static const char settingsGroup[] = "KeyBindings"; static const char idKey[] = "ID"; static const char sequenceKey[] = "Keysequence"; @@ -512,7 +576,7 @@ void ActionManagerPrivate::initialize() const QKeySequence key(settings->value(QLatin1String(sequenceKey)).toString()); const Id id = Id(settings->value(QLatin1String(idKey)).toString()); - Command *cmd = command(id); + Command *cmd = ActionManager::command(id); if (cmd) cmd->setKeySequence(key); } @@ -539,63 +603,3 @@ void ActionManagerPrivate::saveSettings(QSettings *settings) settings->endArray(); } - -void ActionManagerPrivate::unregisterShortcut(const Core::Id &id) -{ - Shortcut *sc = 0; - CommandPrivate *c = m_idCmdMap.value(id, 0); - QTC_ASSERT(c, return); - sc = qobject_cast<Shortcut *>(c); - if (!sc) { - qWarning() << "unregisterShortcut: id" << id.name() - << "is registered with a different command type."; - return; - } - delete sc->shortcut(); - m_idCmdMap.remove(id); - delete sc; - emit commandListChanged(); -} - -void ActionManagerPrivate::setPresentationModeEnabled(bool enabled) -{ - if (enabled == isPresentationModeEnabled()) - return; - - // Signal/slots to commands: - foreach (Command *c, commands()) { - if (c->action()) { - if (enabled) - connect(c->action(), SIGNAL(triggered()), this, SLOT(actionTriggered())); - else - disconnect(c->action(), SIGNAL(triggered()), this, SLOT(actionTriggered())); - } - if (c->shortcut()) { - if (enabled) - connect(c->shortcut(), SIGNAL(activated()), this, SLOT(shortcutTriggered())); - else - disconnect(c->shortcut(), SIGNAL(activated()), this, SLOT(shortcutTriggered())); - } - } - - // The label for the shortcuts: - if (!m_presentationLabel) { - m_presentationLabel = new QLabel(0, Qt::ToolTip | Qt::WindowStaysOnTopHint); - QFont font = m_presentationLabel->font(); - font.setPixelSize(45); - m_presentationLabel->setFont(font); - m_presentationLabel->setAlignment(Qt::AlignCenter); - m_presentationLabel->setMargin(5); - - connect(&m_presentationLabelTimer, SIGNAL(timeout()), m_presentationLabel, SLOT(hide())); - } else { - m_presentationLabelTimer.stop(); - delete m_presentationLabel; - m_presentationLabel = 0; - } -} - -bool ActionManagerPrivate::isPresentationModeEnabled() -{ - return m_presentationLabel; -} diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.h b/src/plugins/coreplugin/actionmanager/actionmanager.h index 61dc0f47a8..1ad141b6ce 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager.h @@ -51,30 +51,46 @@ namespace Core { class ActionContainer; +namespace Internal { +class ActionManagerPrivate; +class MainWindow; +} + class CORE_EXPORT ActionManager : public QObject { Q_OBJECT public: - ActionManager(QObject *parent = 0) : QObject(parent) {} - virtual ~ActionManager() {} + static ActionManager *instance(); + + static ActionContainer *createMenu(const Id &id); + static ActionContainer *createMenuBar(const Id &id); + + static Command *registerAction(QAction *action, const Id &id, const Context &context, bool scriptable = false); + static Command *registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable = false); - virtual ActionContainer *createMenu(const Id &id) = 0; - virtual ActionContainer *createMenuBar(const Id &id) = 0; + static Command *command(const Id &id); + static ActionContainer *actionContainer(const Id &id); - virtual Command *registerAction(QAction *action, const Id &id, const Context &context, bool scriptable = false) = 0; - virtual Command *registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable = false) = 0; + static QList<Command *> commands(); - virtual Command *command(const Id &id) const = 0; - virtual ActionContainer *actionContainer(const Id &id) const = 0; + static void unregisterAction(QAction *action, const Id &id); + static void unregisterShortcut(const Id &id); - virtual QList<Command *> commands() const = 0; + static void setPresentationModeEnabled(bool enabled); + static bool isPresentationModeEnabled(); - virtual void unregisterAction(QAction *action, const Id &id) = 0; - virtual void unregisterShortcut(const Id &id) = 0; + static bool hasContext(int context); signals: void commandListChanged(); void commandAdded(const QString &id); + +private: + ActionManager(QObject *parent = 0); + ~ActionManager(); + Internal::ActionManagerPrivate *d; + + friend class Core::Internal::MainWindow; }; } // namespace Core diff --git a/src/plugins/coreplugin/actionmanager/actionmanager_p.h b/src/plugins/coreplugin/actionmanager/actionmanager_p.h index 12191ebbcd..c6651d9bda 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager_p.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager_p.h @@ -33,8 +33,8 @@ #ifndef ACTIONMANAGERPRIVATE_H #define ACTIONMANAGERPRIVATE_H -#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/command_p.h> +#include <coreplugin/actionmanager/actioncontainer_p.h> #include <coreplugin/icontext.h> #include <QMap> @@ -48,21 +48,23 @@ class QSettings; QT_END_NAMESPACE namespace Core { + namespace Internal { class ActionContainerPrivate; class MainWindow; class CommandPrivate; -class ActionManagerPrivate : public Core::ActionManager +class ActionManagerPrivate : public QObject { Q_OBJECT public: - explicit ActionManagerPrivate(MainWindow *mainWnd); - ~ActionManagerPrivate(); + typedef QHash<Core::Id, CommandPrivate *> IdCmdMap; + typedef QHash<Core::Id, ActionContainerPrivate *> IdContainerMap; - static ActionManagerPrivate *instance(); + explicit ActionManagerPrivate(); + ~ActionManagerPrivate(); void initialize(); @@ -71,49 +73,23 @@ public: void saveSettings(QSettings *settings); - QList<Command *> commands() const; - - Command *command(const Id &id) const; - ActionContainer *actionContainer(const Id &id) const; - ActionContainer *createMenu(const Id &id); - ActionContainer *createMenuBar(const Id &id); - - Command *registerAction(QAction *action, const Id &id, - const Context &context, bool scriptable = false); - Command *registerShortcut(QShortcut *shortcut, const Id &id, - const Context &context, bool scriptable = false); - - void unregisterAction(QAction *action, const Id &id); - void unregisterShortcut(const Id &id); - - void setPresentationModeEnabled(bool enabled); - bool isPresentationModeEnabled(); + void showShortcutPopup(const QString &shortcut); + bool hasContext(const Context &context) const; + Action *overridableAction(const Id &id); -private slots: +public slots: void containerDestroyed(); void actionTriggered(); void shortcutTriggered(); -private: - void showShortcutPopup(const QString &shortcut); - bool hasContext(const Context &context) const; - Action *overridableAction(const Id &id); - static ActionManagerPrivate *m_instance; - - typedef QHash<Core::Id, CommandPrivate *> IdCmdMap; +public: IdCmdMap m_idCmdMap; - typedef QHash<Core::Id, ActionContainerPrivate *> IdContainerMap; IdContainerMap m_idContainerMap; -// typedef QMap<int, int> GlobalGroupMap; -// GlobalGroupMap m_globalgroups; -// Context m_context; - MainWindow *m_mainWnd; - QLabel *m_presentationLabel; QTimer m_presentationLabelTimer; }; diff --git a/src/plugins/coreplugin/actionmanager/commandmappings.cpp b/src/plugins/coreplugin/actionmanager/commandmappings.cpp index 20068c31ae..4e5dbfc952 100644 --- a/src/plugins/coreplugin/actionmanager/commandmappings.cpp +++ b/src/plugins/coreplugin/actionmanager/commandmappings.cpp @@ -33,9 +33,6 @@ #include "commandmappings.h" #include "shortcutsettings.h" #include "ui_commandmappings.h" -#include "actionmanager_p.h" -#include "actionmanager/command.h" -#include "command_p.h" #include "commandsfile.h" #include "coreconstants.h" #include "documentmanager.h" diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index e2d347a418..840aab3d23 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -31,6 +31,7 @@ **************************************************************************/ #include "coreplugin.h" +#include "actionmanager.h" #include "designmode.h" #include "editmode.h" #include "editormanager.h" @@ -81,7 +82,7 @@ void CorePlugin::parseArguments(const QStringList &arguments) i++; // skip the argument } if (arguments.at(i) == QLatin1String("-presentationMode")) - m_mainWindow->setPresentationModeEnabled(true); + ActionManager::setPresentationModeEnabled(true); } } diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index cd1429ba7d..a702efdc77 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -31,7 +31,7 @@ **************************************************************************/ #include "shortcutsettings.h" -#include "actionmanager_p.h" +#include "actionmanager/actionmanager.h" #include "actionmanager/command.h" #include "command_p.h" #include "commandsfile.h" @@ -61,8 +61,7 @@ using namespace Core::Internal; ShortcutSettings::ShortcutSettings(QObject *parent) : CommandMappings(parent), m_initialized(false) { - Core::Internal::ActionManagerPrivate *am = ActionManagerPrivate::instance(); - connect(am, SIGNAL(commandListChanged()), this, SLOT(initialize())); + connect(ActionManager::instance(), SIGNAL(commandListChanged()), this, SLOT(initialize())); setId(QLatin1String(Core::Constants::SETTINGS_ID_SHORTCUTS)); setDisplayName(tr("Keyboard")); @@ -265,10 +264,9 @@ void ShortcutSettings::initialize() if (!m_initialized) return; clear(); - Core::Internal::ActionManagerPrivate *am = ActionManagerPrivate::instance(); QMap<QString, QTreeWidgetItem *> sections; - foreach (Command *c, am->commands()) { + foreach (Command *c, ActionManager::instance()->commands()) { if (c->hasAttribute(Command::CA_NonConfigurable)) continue; if (c->action() && c->action()->isSeparator()) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 15e7f340f5..ff758ee606 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -274,12 +274,12 @@ static EditorManager *m_instance = 0; EditorManager *EditorManager::instance() { return m_instance; } -static Command *createSeparator(ActionManager *am, QObject *parent, +static Command *createSeparator(QObject *parent, const Id &id, const Context &context) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); - Command *cmd = am->registerAction(tmpaction, id, context); + Command *cmd = ActionManager::registerAction(tmpaction, id, context); return cmd; } @@ -296,12 +296,11 @@ EditorManager::EditorManager(QWidget *parent) : // combined context for edit & design modes const Context editDesignContext(Constants::C_EDITORMANAGER, Constants::C_DESIGN_MODE); - ActionManager *am = ICore::actionManager(); - ActionContainer *mfile = am->actionContainer(Constants::M_FILE); + ActionContainer *mfile = ActionManager::actionContainer(Constants::M_FILE); // Revert to saved d->m_revertToSavedAction->setIcon(QIcon::fromTheme(QLatin1String("document-revert"))); - Command *cmd = am->registerAction(d->m_revertToSavedAction, + Command *cmd = ActionManager::registerAction(d->m_revertToSavedAction, Constants::REVERTTOSAVED, editManagerContext); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Revert File to Saved")); @@ -309,29 +308,29 @@ EditorManager::EditorManager(QWidget *parent) : connect(d->m_revertToSavedAction, SIGNAL(triggered()), this, SLOT(revertToSaved())); // Save Action - am->registerAction(d->m_saveAction, Constants::SAVE, editManagerContext); + ActionManager::registerAction(d->m_saveAction, Constants::SAVE, editManagerContext); connect(d->m_saveAction, SIGNAL(triggered()), this, SLOT(saveDocument())); // Save As Action - am->registerAction(d->m_saveAsAction, Constants::SAVEAS, editManagerContext); + ActionManager::registerAction(d->m_saveAsAction, Constants::SAVEAS, editManagerContext); connect(d->m_saveAsAction, SIGNAL(triggered()), this, SLOT(saveDocumentAs())); // Window Menu - ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); + ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); // Window menu separators QAction *tmpaction = new QAction(this); tmpaction->setSeparator(true); - cmd = am->registerAction(tmpaction, "QtCreator.Window.Sep.Split", editManagerContext); + cmd = ActionManager::registerAction(tmpaction, "QtCreator.Window.Sep.Split", editManagerContext); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); tmpaction = new QAction(this); tmpaction->setSeparator(true); - cmd = am->registerAction(tmpaction, "QtCreator.Window.Sep.Navigate", editManagerContext); + cmd = ActionManager::registerAction(tmpaction, "QtCreator.Window.Sep.Navigate", editManagerContext); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); // Close Action - cmd = am->registerAction(d->m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext, true); + cmd = ActionManager::registerAction(d->m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext, true); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+W"))); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_closeCurrentEditorAction->text()); @@ -341,20 +340,20 @@ EditorManager::EditorManager(QWidget *parent) : #ifdef Q_WS_WIN // workaround for QTCREATORBUG-72 QShortcut *sc = new QShortcut(parent); - cmd = am->registerShortcut(sc, Constants::CLOSE_ALTERNATIVE, editManagerContext); + cmd = ActionManager::registerShortcut(sc, Constants::CLOSE_ALTERNATIVE, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F4"))); cmd->setDescription(EditorManager::tr("Close")); connect(sc, SIGNAL(activated()), this, SLOT(closeEditor())); #endif // Close All Action - cmd = am->registerAction(d->m_closeAllEditorsAction, Constants::CLOSEALL, editManagerContext, true); + cmd = ActionManager::registerAction(d->m_closeAllEditorsAction, Constants::CLOSEALL, editManagerContext, true); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+W"))); mfile->addAction(cmd, Constants::G_FILE_CLOSE); connect(d->m_closeAllEditorsAction, SIGNAL(triggered()), this, SLOT(closeAllEditors())); // Close All Others Action - cmd = am->registerAction(d->m_closeOtherEditorsAction, Constants::CLOSEOTHERS, editManagerContext, true); + cmd = ActionManager::registerAction(d->m_closeOtherEditorsAction, Constants::CLOSEOTHERS, editManagerContext, true); mfile->addAction(cmd, Constants::G_FILE_CLOSE); cmd->setAttribute(Core::Command::CA_UpdateText); connect(d->m_closeOtherEditorsAction, SIGNAL(triggered()), this, SLOT(closeOtherEditors())); @@ -368,61 +367,61 @@ EditorManager::EditorManager(QWidget *parent) : connect(d->m_openTerminalAction, SIGNAL(triggered()), this, SLOT(openTerminal())); // Goto Previous In History Action - cmd = am->registerAction(d->m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext); + cmd = ActionManager::registerAction(d->m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Tab") : tr("Ctrl+Tab"))); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); connect(d->m_gotoPreviousDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoPreviousDocHistory())); // Goto Next In History Action - cmd = am->registerAction(d->m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext); + cmd = ActionManager::registerAction(d->m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Shift+Tab") : tr("Ctrl+Shift+Tab"))); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); connect(d->m_gotoNextDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoNextDocHistory())); // Go back in navigation history - cmd = am->registerAction(d->m_goBackAction, Constants::GO_BACK, editDesignContext); + cmd = ActionManager::registerAction(d->m_goBackAction, Constants::GO_BACK, editDesignContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Left") : tr("Alt+Left"))); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); connect(d->m_goBackAction, SIGNAL(triggered()), this, SLOT(goBackInNavigationHistory())); // Go forward in navigation history - cmd = am->registerAction(d->m_goForwardAction, Constants::GO_FORWARD, editDesignContext); + cmd = ActionManager::registerAction(d->m_goForwardAction, Constants::GO_FORWARD, editDesignContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Right") : tr("Alt+Right"))); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); connect(d->m_goForwardAction, SIGNAL(triggered()), this, SLOT(goForwardInNavigationHistory())); d->m_splitAction = new QAction(tr("Split"), this); - cmd = am->registerAction(d->m_splitAction, Constants::SPLIT, editManagerContext); + cmd = ActionManager::registerAction(d->m_splitAction, Constants::SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); connect(d->m_splitAction, SIGNAL(triggered()), this, SLOT(split())); d->m_splitSideBySideAction = new QAction(tr("Split Side by Side"), this); - cmd = am->registerAction(d->m_splitSideBySideAction, Constants::SPLIT_SIDE_BY_SIDE, editManagerContext); + cmd = ActionManager::registerAction(d->m_splitSideBySideAction, Constants::SPLIT_SIDE_BY_SIDE, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,3") : tr("Ctrl+E,3"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); connect(d->m_splitSideBySideAction, SIGNAL(triggered()), this, SLOT(splitSideBySide())); d->m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this); - cmd = am->registerAction(d->m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext); + cmd = ActionManager::registerAction(d->m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,0") : tr("Ctrl+E,0"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); connect(d->m_removeCurrentSplitAction, SIGNAL(triggered()), this, SLOT(removeCurrentSplit())); d->m_removeAllSplitsAction = new QAction(tr("Remove All Splits"), this); - cmd = am->registerAction(d->m_removeAllSplitsAction, Constants::REMOVE_ALL_SPLITS, editManagerContext); + cmd = ActionManager::registerAction(d->m_removeAllSplitsAction, Constants::REMOVE_ALL_SPLITS, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,1") : tr("Ctrl+E,1"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); connect(d->m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits())); d->m_gotoOtherSplitAction = new QAction(tr("Go to Next Split"), this); - cmd = am->registerAction(d->m_gotoOtherSplitAction, Constants::GOTO_OTHER_SPLIT, editManagerContext); + cmd = ActionManager::registerAction(d->m_gotoOtherSplitAction, Constants::GOTO_OTHER_SPLIT, editManagerContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,o") : tr("Ctrl+E,o"))); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); connect(d->m_gotoOtherSplitAction, SIGNAL(triggered()), this, SLOT(gotoOtherSplit())); - ActionContainer *medit = am->actionContainer(Constants::M_EDIT); - ActionContainer *advancedMenu = am->createMenu(Constants::M_EDIT_ADVANCED); + ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT); + ActionContainer *advancedMenu = ActionManager::createMenu(Constants::M_EDIT_ADVANCED); medit->addMenu(advancedMenu, Constants::G_EDIT_ADVANCED); advancedMenu->menu()->setTitle(tr("Ad&vanced")); advancedMenu->appendGroup(Constants::G_EDIT_FORMAT); @@ -432,13 +431,13 @@ EditorManager::EditorManager(QWidget *parent) : advancedMenu->appendGroup(Constants::G_EDIT_EDITOR); // Advanced menu separators - cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Collapsing"), editManagerContext); + cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Collapsing"), editManagerContext); advancedMenu->addAction(cmd, Constants::G_EDIT_COLLAPSING); - cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Blocks"), editManagerContext); + cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Blocks"), editManagerContext); advancedMenu->addAction(cmd, Constants::G_EDIT_BLOCKS); - cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Font"), editManagerContext); + cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Font"), editManagerContext); advancedMenu->addAction(cmd, Constants::G_EDIT_FONT); - cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Editor"), editManagerContext); + cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Editor"), editManagerContext); advancedMenu->addAction(cmd, Constants::G_EDIT_EDITOR); // other setup diff --git a/src/plugins/coreplugin/editortoolbar.cpp b/src/plugins/coreplugin/editortoolbar.cpp index b7ab352f31..cf7db10f6a 100644 --- a/src/plugins/coreplugin/editortoolbar.cpp +++ b/src/plugins/coreplugin/editortoolbar.cpp @@ -200,12 +200,11 @@ EditorToolBar::EditorToolBar(QWidget *parent) : this, SIGNAL(closeSplitClicked()), Qt::QueuedConnection); - ActionManager *am = ICore::actionManager(); - connect(am->command(Constants::CLOSE), SIGNAL(keySequenceChanged()), + connect(ActionManager::command(Constants::CLOSE), SIGNAL(keySequenceChanged()), this, SLOT(updateActionShortcuts())); - connect(am->command(Constants::GO_BACK), SIGNAL(keySequenceChanged()), + connect(ActionManager::command(Constants::GO_BACK), SIGNAL(keySequenceChanged()), this, SLOT(updateActionShortcuts())); - connect(am->command(Constants::GO_FORWARD), SIGNAL(keySequenceChanged()), + connect(ActionManager::command(Constants::GO_FORWARD), SIGNAL(keySequenceChanged()), this, SLOT(updateActionShortcuts())); updateActionShortcuts(); @@ -362,11 +361,10 @@ void EditorToolBar::setCanGoForward(bool canGoForward) void EditorToolBar::updateActionShortcuts() { - ActionManager *am = ICore::actionManager(); - d->m_closeEditorButton->setToolTip(am->command(Constants::CLOSE)->stringWithAppendedShortcut(EditorManager::tr("Close Document"))); - d->m_goBackAction->setToolTip(am->command(Constants::GO_BACK)->action()->toolTip()); - d->m_goForwardAction->setToolTip(am->command(Constants::GO_FORWARD)->action()->toolTip()); - d->m_closeSplitButton->setToolTip(am->command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(tr("Remove Split"))); + d->m_closeEditorButton->setToolTip(ActionManager::command(Constants::CLOSE)->stringWithAppendedShortcut(EditorManager::tr("Close Document"))); + d->m_goBackAction->setToolTip(ActionManager::command(Constants::GO_BACK)->action()->toolTip()); + d->m_goForwardAction->setToolTip(ActionManager::command(Constants::GO_FORWARD)->action()->toolTip()); + d->m_closeSplitButton->setToolTip(ActionManager::command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(tr("Remove Split"))); } void EditorToolBar::checkEditorStatus() diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index cef137f5d7..c9df7dec35 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -710,10 +710,9 @@ void ExternalToolManager::initialize() connect(m_configureAction, SIGNAL(triggered()), this, SLOT(openPreferences())); // add the external tools menu - ActionManager *am = ICore::actionManager(); - ActionContainer *mexternaltools = am->createMenu(Id(Constants::M_TOOLS_EXTERNAL)); + ActionContainer *mexternaltools = ActionManager::createMenu(Id(Constants::M_TOOLS_EXTERNAL)); mexternaltools->menu()->setTitle(tr("&External")); - ActionContainer *mtools = am->actionContainer(Constants::M_TOOLS); + ActionContainer *mtools = ActionManager::actionContainer(Constants::M_TOOLS); mtools->addMenu(mexternaltools, Constants::G_DEFAULT_THREE); QMap<QString, QMultiMap<int, ExternalTool*> > categoryPriorityMap; @@ -799,8 +798,7 @@ QMap<QString, ExternalTool *> ExternalToolManager::toolsById() const void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal::ExternalTool *> > &tools) { // clear menu - ActionManager *am = ICore::actionManager(); - ActionContainer *mexternaltools = am->actionContainer(Id(Constants::M_TOOLS_EXTERNAL)); + ActionContainer *mexternaltools = ActionManager::actionContainer(Id(Constants::M_TOOLS_EXTERNAL)); mexternaltools->clear(); // delete old tools and create list of new ones @@ -825,7 +823,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal: const QString externalToolsPrefix = QLatin1String("Tools.External."); while (remainingActions.hasNext()) { remainingActions.next(); - am->unregisterAction(remainingActions.value(), Id(externalToolsPrefix + remainingActions.key())); + ActionManager::unregisterAction(remainingActions.value(), Id(externalToolsPrefix + remainingActions.key())); delete remainingActions.value(); } m_actions.clear(); @@ -847,7 +845,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal: if (m_containers.contains(containerName)) { container = m_containers.take(containerName); // remove to avoid deletion below } else { - container = am->createMenu(Id(QLatin1String("Tools.External.Category.") + containerName)); + container = ActionManager::createMenu(Id(QLatin1String("Tools.External.Category.") + containerName)); } newContainers.insert(containerName, container); mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE); @@ -860,13 +858,13 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal: Command *command = 0; if (m_actions.contains(toolId)) { action = m_actions.value(toolId); - command = am->command(Id(externalToolsPrefix + toolId)); + command = ActionManager::command(Id(externalToolsPrefix + toolId)); } else { action = new QAction(tool->displayName(), this); action->setData(toolId); m_actions.insert(toolId, action); connect(action, SIGNAL(triggered()), this, SLOT(menuActivated())); - command = am->registerAction(action, Id(externalToolsPrefix + toolId), Context(Constants::C_GLOBAL)); + command = ActionManager::registerAction(action, Id(externalToolsPrefix + toolId), Context(Constants::C_GLOBAL)); command->setAttribute(Command::CA_UpdateText); } action->setText(tool->displayName()); diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h index 169fd0d4f0..f20418d779 100644 --- a/src/plugins/coreplugin/icore.h +++ b/src/plugins/coreplugin/icore.h @@ -94,7 +94,7 @@ public: const QString &settingsId = QString(), QWidget *parent = 0); - static ActionManager *actionManager(); + static QT_DEPRECATED ActionManager *actionManager(); // Use Actionmanager::... directly. static QT_DEPRECATED DocumentManager *documentManager(); // Use DocumentManager::... directly. static MessageManager *messageManager(); static EditorManager *editorManager(); diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index f300ea9487..b3d0a4b469 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -33,6 +33,7 @@ #include "mainwindow.h" #include "actioncontainer.h" #include "command.h" +#include "actionmanager.h" #include "actionmanager_p.h" #include "icore.h" #include "coreconstants.h" @@ -138,7 +139,7 @@ MainWindow::MainWindow() : QLatin1String("QtCreator"), this)), m_printer(0), - m_actionManager(new ActionManagerPrivate(this)), + m_actionManager(new ActionManager(this)), m_editorManager(0), m_externalToolManager(0), m_progressManager(new ProgressManagerPrivate()), @@ -266,16 +267,6 @@ void MainWindow::setOverrideColor(const QColor &color) m_overrideColor = color; } -bool MainWindow::isPresentationModeEnabled() -{ - return m_actionManager->isPresentationModeEnabled(); -} - -void MainWindow::setPresentationModeEnabled(bool enabled) -{ - m_actionManager->setPresentationModeEnabled(enabled); -} - #ifdef Q_OS_MAC void MainWindow::setIsFullScreen(bool fullScreen) { @@ -384,7 +375,7 @@ void MainWindow::extensionsInitialized() m_navigationWidget->setFactories(ExtensionSystem::PluginManager::instance()->getObjects<INavigationWidgetFactory>()); // reading the shortcut settings must be done after all shortcuts have been registered - m_actionManager->initialize(); + m_actionManager->d->initialize(); readSettings(); updateContext(); @@ -497,9 +488,7 @@ QStatusBar *MainWindow::statusBar() const void MainWindow::registerDefaultContainers() { - ActionManagerPrivate *am = m_actionManager; - - ActionContainer *menubar = am->createMenuBar(Constants::MENU_BAR); + ActionContainer *menubar = ActionManager::createMenuBar(Constants::MENU_BAR); #ifndef Q_OS_MAC // System menu bar on Mac setMenuBar(menubar->menuBar()); @@ -512,7 +501,7 @@ void MainWindow::registerDefaultContainers() menubar->appendGroup(Constants::G_HELP); // File Menu - ActionContainer *filemenu = am->createMenu(Constants::M_FILE); + ActionContainer *filemenu = ActionManager::createMenu(Constants::M_FILE); menubar->addMenu(filemenu, Constants::G_FILE); filemenu->menu()->setTitle(tr("&File")); filemenu->appendGroup(Constants::G_FILE_NEW); @@ -526,7 +515,7 @@ void MainWindow::registerDefaultContainers() // Edit Menu - ActionContainer *medit = am->createMenu(Constants::M_EDIT); + ActionContainer *medit = ActionManager::createMenu(Constants::M_EDIT); menubar->addMenu(medit, Constants::G_EDIT); medit->menu()->setTitle(tr("&Edit")); medit->appendGroup(Constants::G_EDIT_UNDOREDO); @@ -537,12 +526,12 @@ void MainWindow::registerDefaultContainers() medit->appendGroup(Constants::G_EDIT_OTHER); // Tools Menu - ActionContainer *ac = am->createMenu(Constants::M_TOOLS); + ActionContainer *ac = ActionManager::createMenu(Constants::M_TOOLS); menubar->addMenu(ac, Constants::G_TOOLS); ac->menu()->setTitle(tr("&Tools")); // Window Menu - ActionContainer *mwindow = am->createMenu(Constants::M_WINDOW); + ActionContainer *mwindow = ActionManager::createMenu(Constants::M_WINDOW); menubar->addMenu(mwindow, Constants::G_WINDOW); mwindow->menu()->setTitle(tr("&Window")); mwindow->appendGroup(Constants::G_WINDOW_SIZE); @@ -553,71 +542,70 @@ void MainWindow::registerDefaultContainers() mwindow->appendGroup(Constants::G_WINDOW_OTHER); // Help Menu - ac = am->createMenu(Constants::M_HELP); + ac = ActionManager::createMenu(Constants::M_HELP); menubar->addMenu(ac, Constants::G_HELP); ac->menu()->setTitle(tr("&Help")); ac->appendGroup(Constants::G_HELP_HELP); ac->appendGroup(Constants::G_HELP_ABOUT); } -static Command *createSeparator(ActionManager *am, QObject *parent, +static Command *createSeparator(QObject *parent, const Id &id, const Context &context) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); - Command *cmd = am->registerAction(tmpaction, id, context); + Command *cmd = ActionManager::registerAction(tmpaction, id, context); return cmd; } void MainWindow::registerDefaultActions() { - ActionManagerPrivate *am = m_actionManager; - ActionContainer *mfile = am->actionContainer(Constants::M_FILE); - ActionContainer *medit = am->actionContainer(Constants::M_EDIT); - ActionContainer *mtools = am->actionContainer(Constants::M_TOOLS); - ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); - ActionContainer *mhelp = am->actionContainer(Constants::M_HELP); + ActionContainer *mfile = ActionManager::actionContainer(Constants::M_FILE); + ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT); + ActionContainer *mtools = ActionManager::actionContainer(Constants::M_TOOLS); + ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); + ActionContainer *mhelp = ActionManager::actionContainer(Constants::M_HELP); Context globalContext(Constants::C_GLOBAL); // File menu separators - Command *cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Save"), globalContext); + Command *cmd = createSeparator(this, Id("QtCreator.File.Sep.Save"), globalContext); mfile->addAction(cmd, Constants::G_FILE_SAVE); - cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Print"), globalContext); + cmd = createSeparator(this, Id("QtCreator.File.Sep.Print"), globalContext); QIcon icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT))); mfile->addAction(cmd, Constants::G_FILE_PRINT); - cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Close"), globalContext); + cmd = createSeparator(this, Id("QtCreator.File.Sep.Close"), globalContext); mfile->addAction(cmd, Constants::G_FILE_CLOSE); - cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Other"), globalContext); + cmd = createSeparator(this, Id("QtCreator.File.Sep.Other"), globalContext); mfile->addAction(cmd, Constants::G_FILE_OTHER); // Edit menu separators - cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.CopyPaste"), globalContext); + cmd = createSeparator(this, Id("QtCreator.Edit.Sep.CopyPaste"), globalContext); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); - cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.SelectAll"), globalContext); + cmd = createSeparator(this, Id("QtCreator.Edit.Sep.SelectAll"), globalContext); medit->addAction(cmd, Constants::G_EDIT_SELECTALL); - cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Find"), globalContext); + cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Find"), globalContext); medit->addAction(cmd, Constants::G_EDIT_FIND); - cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Advanced"), globalContext); + cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Advanced"), globalContext); medit->addAction(cmd, Constants::G_EDIT_ADVANCED); // Return to editor shortcut: Note this requires Qt to fix up // handling of shortcut overrides in menus, item views, combos.... m_focusToEditor = new QShortcut(this); - cmd = am->registerShortcut(m_focusToEditor, Constants::S_RETURNTOEDITOR, globalContext); + cmd = ActionManager::registerShortcut(m_focusToEditor, Constants::S_RETURNTOEDITOR, globalContext); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_Escape)); connect(m_focusToEditor, SIGNAL(activated()), this, SLOT(setFocusToEditor())); // New File Action icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(Constants::ICON_NEWFILE))); m_newAction = new QAction(icon, tr("&New File or Project..."), this); - cmd = am->registerAction(m_newAction, Constants::NEW, globalContext); + cmd = ActionManager::registerAction(m_newAction, Constants::NEW, globalContext); cmd->setDefaultKeySequence(QKeySequence::New); mfile->addAction(cmd, Constants::G_FILE_NEW); connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile())); @@ -625,19 +613,19 @@ void MainWindow::registerDefaultActions() // Open Action icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(QLatin1String(Constants::ICON_OPENFILE))); m_openAction = new QAction(icon, tr("&Open File or Project..."), this); - cmd = am->registerAction(m_openAction, Constants::OPEN, globalContext); + cmd = ActionManager::registerAction(m_openAction, Constants::OPEN, globalContext); cmd->setDefaultKeySequence(QKeySequence::Open); mfile->addAction(cmd, Constants::G_FILE_OPEN); connect(m_openAction, SIGNAL(triggered()), this, SLOT(openFile())); // Open With Action m_openWithAction = new QAction(tr("Open File &With..."), this); - cmd = am->registerAction(m_openWithAction, Constants::OPEN_WITH, globalContext); + cmd = ActionManager::registerAction(m_openWithAction, Constants::OPEN_WITH, globalContext); mfile->addAction(cmd, Constants::G_FILE_OPEN); connect(m_openWithAction, SIGNAL(triggered()), this, SLOT(openFileWith())); // File->Recent Files Menu - ActionContainer *ac = am->createMenu(Constants::M_FILE_RECENTFILES); + ActionContainer *ac = ActionManager::createMenu(Constants::M_FILE_RECENTFILES); mfile->addMenu(ac, Constants::G_FILE_OPEN); ac->menu()->setTitle(tr("Recent &Files")); ac->setOnAllDisabledBehavior(ActionContainer::Show); @@ -646,7 +634,7 @@ void MainWindow::registerDefaultActions() icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(QLatin1String(Constants::ICON_SAVEFILE))); QAction *tmpaction = new QAction(icon, tr("&Save"), this); tmpaction->setEnabled(false); - cmd = am->registerAction(tmpaction, Constants::SAVE, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::SAVE, globalContext); cmd->setDefaultKeySequence(QKeySequence::Save); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Save")); @@ -656,7 +644,7 @@ void MainWindow::registerDefaultActions() icon = QIcon::fromTheme(QLatin1String("document-save-as")); tmpaction = new QAction(icon, tr("Save &As..."), this); tmpaction->setEnabled(false); - cmd = am->registerAction(tmpaction, Constants::SAVEAS, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::SAVEAS, globalContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+S") : QString())); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Save As...")); @@ -664,7 +652,7 @@ void MainWindow::registerDefaultActions() // SaveAll Action m_saveAllAction = new QAction(tr("Save A&ll"), this); - cmd = am->registerAction(m_saveAllAction, Constants::SAVEALL, globalContext); + cmd = ActionManager::registerAction(m_saveAllAction, Constants::SAVEALL, globalContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("Ctrl+Shift+S"))); mfile->addAction(cmd, Constants::G_FILE_SAVE); connect(m_saveAllAction, SIGNAL(triggered()), this, SLOT(saveAll())); @@ -673,14 +661,14 @@ void MainWindow::registerDefaultActions() icon = QIcon::fromTheme(QLatin1String("document-print")); tmpaction = new QAction(icon, tr("&Print..."), this); tmpaction->setEnabled(false); - cmd = am->registerAction(tmpaction, Constants::PRINT, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::PRINT, globalContext); cmd->setDefaultKeySequence(QKeySequence::Print); mfile->addAction(cmd, Constants::G_FILE_PRINT); // Exit Action icon = QIcon::fromTheme(QLatin1String("application-exit")); m_exitAction = new QAction(icon, tr("E&xit"), this); - cmd = am->registerAction(m_exitAction, Constants::EXIT, globalContext); + cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT, globalContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q"))); mfile->addAction(cmd, Constants::G_FILE_OTHER); connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit())); @@ -688,7 +676,7 @@ void MainWindow::registerDefaultActions() // Undo Action icon = QIcon::fromTheme(QLatin1String("edit-undo"), QIcon(QLatin1String(Constants::ICON_UNDO))); tmpaction = new QAction(icon, tr("&Undo"), this); - cmd = am->registerAction(tmpaction, Constants::UNDO, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::UNDO, globalContext); cmd->setDefaultKeySequence(QKeySequence::Undo); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Undo")); @@ -698,7 +686,7 @@ void MainWindow::registerDefaultActions() // Redo Action icon = QIcon::fromTheme(QLatin1String("edit-redo"), QIcon(QLatin1String(Constants::ICON_REDO))); tmpaction = new QAction(icon, tr("&Redo"), this); - cmd = am->registerAction(tmpaction, Constants::REDO, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::REDO, globalContext); cmd->setDefaultKeySequence(QKeySequence::Redo); cmd->setAttribute(Command::CA_UpdateText); cmd->setDescription(tr("Redo")); @@ -708,7 +696,7 @@ void MainWindow::registerDefaultActions() // Cut Action icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT))); tmpaction = new QAction(icon, tr("Cu&t"), this); - cmd = am->registerAction(tmpaction, Constants::CUT, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::CUT, globalContext); cmd->setDefaultKeySequence(QKeySequence::Cut); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); tmpaction->setEnabled(false); @@ -716,7 +704,7 @@ void MainWindow::registerDefaultActions() // Copy Action icon = QIcon::fromTheme(QLatin1String("edit-copy"), QIcon(QLatin1String(Constants::ICON_COPY))); tmpaction = new QAction(icon, tr("&Copy"), this); - cmd = am->registerAction(tmpaction, Constants::COPY, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::COPY, globalContext); cmd->setDefaultKeySequence(QKeySequence::Copy); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); tmpaction->setEnabled(false); @@ -724,7 +712,7 @@ void MainWindow::registerDefaultActions() // Paste Action icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(QLatin1String(Constants::ICON_PASTE))); tmpaction = new QAction(icon, tr("&Paste"), this); - cmd = am->registerAction(tmpaction, Constants::PASTE, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::PASTE, globalContext); cmd->setDefaultKeySequence(QKeySequence::Paste); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); tmpaction->setEnabled(false); @@ -732,7 +720,7 @@ void MainWindow::registerDefaultActions() // Select All icon = QIcon::fromTheme(QLatin1String("edit-select-all")); tmpaction = new QAction(icon, tr("Select &All"), this); - cmd = am->registerAction(tmpaction, Constants::SELECTALL, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::SELECTALL, globalContext); cmd->setDefaultKeySequence(QKeySequence::SelectAll); medit->addAction(cmd, Constants::G_EDIT_SELECTALL); tmpaction->setEnabled(false); @@ -740,17 +728,17 @@ void MainWindow::registerDefaultActions() // Goto Action icon = QIcon::fromTheme(QLatin1String("go-jump")); tmpaction = new QAction(icon, tr("&Go to Line..."), this); - cmd = am->registerAction(tmpaction, Constants::GOTO, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::GOTO, globalContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L"))); medit->addAction(cmd, Constants::G_EDIT_OTHER); tmpaction->setEnabled(false); // Options Action mtools->appendGroup(Constants::G_TOOLS_OPTIONS); - cmd = createSeparator(am, this, Id("QtCreator.Tools.Sep.Options"), globalContext); + cmd = createSeparator(this, Id("QtCreator.Tools.Sep.Options"), globalContext); mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS); m_optionsAction = new QAction(tr("&Options..."), this); - cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, globalContext); + cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS, globalContext); if (UseMacShortcuts) { cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,"))); cmd->action()->setMenuRole(QAction::PreferencesRole); @@ -761,19 +749,19 @@ void MainWindow::registerDefaultActions() if (UseMacShortcuts) { // Minimize Action m_minimizeAction = new QAction(tr("Minimize"), this); - cmd = am->registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext); + cmd = ActionManager::registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M"))); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized())); // Zoom Action m_zoomAction = new QAction(tr("Zoom"), this); - cmd = am->registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext); + cmd = ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized())); // Window separator - cmd = createSeparator(am, this, Id("QtCreator.Window.Sep.Size"), globalContext); + cmd = createSeparator(this, Id("QtCreator.Window.Sep.Size"), globalContext); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); } @@ -781,7 +769,7 @@ void MainWindow::registerDefaultActions() m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)), tr("Show Sidebar"), this); m_toggleSideBarAction->setCheckable(true); - cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext); + cmd = ActionManager::registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext); cmd->setAttribute(Command::CA_UpdateText); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+0") : tr("Alt+0"))); connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool))); @@ -802,7 +790,7 @@ void MainWindow::registerDefaultActions() // Full Screen Action m_toggleFullScreenAction = new QAction(fullScreenActionText, this); m_toggleFullScreenAction->setCheckable(fullScreenCheckable); - cmd = am->registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext); + cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11"))); cmd->setAttribute(Command::CA_UpdateText); /* for Mac */ mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); @@ -810,7 +798,7 @@ void MainWindow::registerDefaultActions() } // Window->Views - ActionContainer *mviews = am->createMenu(Constants::M_WINDOW_VIEWS); + ActionContainer *mviews = ActionManager::createMenu(Constants::M_WINDOW_VIEWS); mwindow->addMenu(mviews, Constants::G_WINDOW_VIEWS); mviews->menu()->setTitle(tr("&Views")); @@ -821,7 +809,7 @@ void MainWindow::registerDefaultActions() #else tmpaction = new QAction(icon, tr("About &Qt Creator..."), this); #endif - cmd = am->registerAction(tmpaction, Constants::ABOUT_QTCREATOR, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_QTCREATOR, globalContext); mhelp->addAction(cmd, Constants::G_HELP_ABOUT); tmpaction->setEnabled(true); #ifdef Q_OS_MAC @@ -831,7 +819,7 @@ void MainWindow::registerDefaultActions() //About Plugins Action tmpaction = new QAction(tr("About &Plugins..."), this); - cmd = am->registerAction(tmpaction, Constants::ABOUT_PLUGINS, globalContext); + cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_PLUGINS, globalContext); mhelp->addAction(cmd, Constants::G_HELP_ABOUT); tmpaction->setEnabled(true); #ifdef Q_OS_MAC @@ -840,7 +828,7 @@ void MainWindow::registerDefaultActions() connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutPlugins())); // About Qt Action // tmpaction = new QAction(tr("About &Qt..."), this); -// cmd = am->registerAction(tmpaction, Constants:: ABOUT_QT, globalContext); +// cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT, globalContext); // mhelp->addAction(cmd, Constants::G_HELP_ABOUT); // tmpaction->setEnabled(true); // connect(tmpaction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); @@ -848,7 +836,7 @@ void MainWindow::registerDefaultActions() #ifndef Q_OS_MAC // doesn't have the "About" actions in the Help menu tmpaction = new QAction(this); tmpaction->setSeparator(true); - cmd = am->registerAction(tmpaction, "QtCreator.Help.Sep.About", globalContext); + cmd = ActionManager::registerAction(tmpaction, "QtCreator.Help.Sep.About", globalContext); mhelp->addAction(cmd, Constants::G_HELP_ABOUT); #endif } @@ -1256,7 +1244,7 @@ void MainWindow::writeSettings() m_settings->endGroup(); DocumentManager::saveSettings(); - m_actionManager->saveSettings(m_settings); + m_actionManager->d->saveSettings(m_settings); m_editorManager->saveSettings(); m_navigationWidget->saveSettings(m_settings); } @@ -1285,7 +1273,7 @@ void MainWindow::updateAdditionalContexts(const Context &remove, const Context & bool MainWindow::hasContext(int context) const { - return m_actionManager->hasContext(context); + return ActionManager::hasContext(context); } void MainWindow::updateContext() @@ -1304,14 +1292,14 @@ void MainWindow::updateContext() uniquecontexts.add(c); } - m_actionManager->setContext(uniquecontexts); + m_actionManager->d->setContext(uniquecontexts); emit m_coreImpl->contextChanged(m_activeContext, m_additionalContexts); } void MainWindow::aboutToShowRecentFiles() { ActionContainer *aci = - m_actionManager->actionContainer(Constants::M_FILE_RECENTFILES); + ActionManager::actionContainer(Constants::M_FILE_RECENTFILES); aci->menu()->clear(); bool hasRecentFiles = false; diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 60c6486a6b..7e19fc8971 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -124,9 +124,6 @@ public: void setOverrideColor(const QColor &color); - bool isPresentationModeEnabled(); - void setPresentationModeEnabled(bool); - #ifdef Q_OS_MAC void setIsFullScreen(bool fullScreen); #endif @@ -189,7 +186,7 @@ private: QSettings *m_globalSettings; SettingsDatabase *m_settingsDatabase; mutable QPrinter *m_printer; - ActionManagerPrivate *m_actionManager; + ActionManager *m_actionManager; EditorManager *m_editorManager; ExternalToolManager *m_externalToolManager; MessageManager *m_messageManager; diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index c46429de87..32ab4abb13 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -197,11 +197,10 @@ void ModeManager::objectAdded(QObject *obj) d->m_modeStack->setTabEnabled(index, mode->isEnabled()); // Register mode shortcut - ActionManager *am = d->m_mainWindow->actionManager(); const Id shortcutId(QLatin1String("QtCreator.Mode.") + mode->id().toString()); QShortcut *shortcut = new QShortcut(d->m_mainWindow); shortcut->setWhatsThis(tr("Switch to <b>%1</b> mode").arg(mode->displayName())); - Command *cmd = am->registerShortcut(shortcut, shortcutId, Context(Constants::C_GLOBAL)); + Command *cmd = ActionManager::registerShortcut(shortcut, shortcutId, Context(Constants::C_GLOBAL)); d->m_modeShortcuts.insert(index, cmd); connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip())); diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 73ac585d0d..0fe53be0e5 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -187,7 +187,6 @@ NavigationWidget *NavigationWidget::instance() void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> factories) { - ActionManager *am = ICore::actionManager(); Context navicontext(Core::Constants::C_NAVIGATION_PANE); foreach (INavigationWidgetFactory *factory, factories) { @@ -198,7 +197,7 @@ void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> fact connect(shortcut, SIGNAL(activated()), this, SLOT(activateSubWidget())); d->m_shortcutMap.insert(shortcut, id); - Command *cmd = am->registerShortcut(shortcut, + Command *cmd = ActionManager::registerShortcut(shortcut, Id(QLatin1String("QtCreator.Sidebar.") + QLatin1String(id.name())), navicontext); cmd->setDefaultKeySequence(factory->activationSequence()); d->m_commandMap.insert(id, cmd); diff --git a/src/plugins/coreplugin/outputpanemanager.cpp b/src/plugins/coreplugin/outputpanemanager.cpp index e42305eaf4..289dca53fa 100644 --- a/src/plugins/coreplugin/outputpanemanager.cpp +++ b/src/plugins/coreplugin/outputpanemanager.cpp @@ -208,12 +208,11 @@ static inline int paneShortCut(int number) void OutputPaneManager::init() { - ActionManager *am = Core::ICore::actionManager(); - ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); + ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW); const Context globalContext(Constants::C_GLOBAL); // Window->Output Panes - ActionContainer *mpanes = am->createMenu(Constants::M_WINDOW_PANES); + ActionContainer *mpanes = ActionManager::createMenu(Constants::M_WINDOW_PANES); mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES); mpanes->menu()->setTitle(tr("Output &Panes")); mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup"); @@ -221,21 +220,21 @@ void OutputPaneManager::init() Command *cmd; - cmd = am->registerAction(m_clearAction, "Coreplugin.OutputPane.clear", globalContext); + cmd = ActionManager::registerAction(m_clearAction, "Coreplugin.OutputPane.clear", globalContext); m_clearButton->setDefaultAction(cmd->action()); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); - cmd = am->registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalContext); + cmd = ActionManager::registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalContext); cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6"))); m_prevToolButton->setDefaultAction(cmd->action()); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); - cmd = am->registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalContext); + cmd = ActionManager::registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalContext); m_nextToolButton->setDefaultAction(cmd->action()); cmd->setDefaultKeySequence(QKeySequence(tr("F6"))); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); - cmd = am->registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalContext); + cmd = ActionManager::registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalContext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+9") : tr("Alt+9"))); cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateIcon); @@ -245,7 +244,7 @@ void OutputPaneManager::init() QAction *sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, "Coreplugin.OutputPane.Sep", globalContext); + cmd = ActionManager::registerAction(sep, "Coreplugin.OutputPane.Sep", globalContext); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); QFontMetrics titleFm = m_titleLabel->fontMetrics(); @@ -284,7 +283,7 @@ void OutputPaneManager::init() actionId.remove(QLatin1Char(' ')); Id id(actionId); QAction *action = new QAction(outPane->displayName(), this); - Command *cmd = am->registerAction(action, id, globalContext); + Command *cmd = ActionManager::registerAction(action, id, globalContext); mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup"); m_actions.append(cmd->action()); diff --git a/src/plugins/coreplugin/outputwindow.cpp b/src/plugins/coreplugin/outputwindow.cpp index 6990fe72f6..6ec82eb59f 100644 --- a/src/plugins/coreplugin/outputwindow.cpp +++ b/src/plugins/coreplugin/outputwindow.cpp @@ -75,13 +75,12 @@ OutputWindow::OutputWindow(Core::Context context, QWidget *parent) QAction *pasteAction = new QAction(this); QAction *selectAllAction = new QAction(this); - Core::ActionManager *am = ICore::actionManager(); - am->registerAction(undoAction, Core::Constants::UNDO, context); - am->registerAction(redoAction, Core::Constants::REDO, context); - am->registerAction(cutAction, Core::Constants::CUT, context); - am->registerAction(copyAction, Core::Constants::COPY, context); - am->registerAction(pasteAction, Core::Constants::PASTE, context); - am->registerAction(selectAllAction, Core::Constants::SELECTALL, context); + ActionManager::registerAction(undoAction, Core::Constants::UNDO, context); + ActionManager::registerAction(redoAction, Core::Constants::REDO, context); + ActionManager::registerAction(cutAction, Core::Constants::CUT, context); + ActionManager::registerAction(copyAction, Core::Constants::COPY, context); + ActionManager::registerAction(pasteAction, Core::Constants::PASTE, context); + ActionManager::registerAction(selectAllAction, Core::Constants::SELECTALL, context); connect(undoAction, SIGNAL(triggered()), this, SLOT(undo())); connect(redoAction, SIGNAL(triggered()), this, SLOT(redo())); diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index a92de4b33d..1a3c6671f5 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -160,37 +160,36 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe this, SLOT(finishFetch(QString,QString,bool))); //register actions - Core::ActionManager *actionManager = ICore::actionManager(); Core::ActionContainer *toolsContainer = - actionManager->actionContainer(Core::Constants::M_TOOLS); + Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *cpContainer = - actionManager->createMenu(Core::Id("CodePaster")); + Core::ActionManager::createMenu(Core::Id("CodePaster")); cpContainer->menu()->setTitle(tr("&Code Pasting")); toolsContainer->addMenu(cpContainer); Core::Command *command; m_postEditorAction = new QAction(tr("Paste Snippet..."), this); - command = actionManager->registerAction(m_postEditorAction, "CodePaster.Post", globalcontext); + command = Core::ActionManager::registerAction(m_postEditorAction, "CodePaster.Post", globalcontext); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+P") : tr("Alt+C,Alt+P"))); connect(m_postEditorAction, SIGNAL(triggered()), this, SLOT(postEditor())); cpContainer->addAction(command); m_postClipboardAction = new QAction(tr("Paste Clipboard..."), this); - command = actionManager->registerAction(m_postClipboardAction, "CodePaster.PostClipboard", globalcontext); + command = Core::ActionManager::registerAction(m_postClipboardAction, "CodePaster.PostClipboard", globalcontext); connect(m_postClipboardAction, SIGNAL(triggered()), this, SLOT(postClipboard())); cpContainer->addAction(command); m_fetchAction = new QAction(tr("Fetch Snippet..."), this); - command = actionManager->registerAction(m_fetchAction, "CodePaster.Fetch", globalcontext); + command = Core::ActionManager::registerAction(m_fetchAction, "CodePaster.Fetch", globalcontext); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+F") : tr("Alt+C,Alt+F"))); connect(m_fetchAction, SIGNAL(triggered()), this, SLOT(fetch())); cpContainer->addAction(command); m_fetchUrlAction = new QAction(tr("Fetch from URL..."), this); - command = actionManager->registerAction(m_fetchUrlAction, "CodePaster.FetchUrl", globalcontext); + command = Core::ActionManager::registerAction(m_fetchUrlAction, "CodePaster.FetchUrl", globalcontext); connect(m_fetchUrlAction, SIGNAL(triggered()), this, SLOT(fetchUrl())); cpContainer->addAction(command); diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 594e16f9f0..6b625dc2dd 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1562,12 +1562,11 @@ void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e) QMenu *menu = new QMenu; - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *mcontext = am->actionContainer(Constants::M_CONTEXT); + Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(Constants::M_CONTEXT); QMenu *contextMenu = mcontext->menu(); QMenu *quickFixMenu = new QMenu(tr("&Refactor"), menu); - quickFixMenu->addAction(am->command(Constants::RENAME_SYMBOL_UNDER_CURSOR)->action()); + quickFixMenu->addAction(Core::ActionManager::command(Constants::RENAME_SYMBOL_UNDER_CURSOR)->action()); QSignalMapper mapper; connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int))); diff --git a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp index 307a2d5a64..7f183d05c0 100644 --- a/src/plugins/cppeditor/cppfunctiondecldeflink.cpp +++ b/src/plugins/cppeditor/cppfunctiondecldeflink.cpp @@ -370,8 +370,7 @@ void FunctionDeclDefLink::showMarker(CPPEditorWidget *editor) else message = tr("Apply changes to declaration"); - Core::ActionManager *actionManager = Core::ICore::actionManager(); - Core::Command *quickfixCommand = actionManager->command(TextEditor::Constants::QUICKFIX_THIS); + Core::Command *quickfixCommand = Core::ActionManager::command(TextEditor::Constants::QUICKFIX_THIS); if (quickfixCommand) message = Utils::ProxyAction::stringWithAppendedShortcut(message, quickfixCommand->keySequence()); diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 26bcf2ca09..bd1d83e09e 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -124,14 +124,13 @@ QStringList CppEditorFactory::mimeTypes() const ///////////////////////////////// CppPlugin ////////////////////////////////// static inline -Core::Command *createSeparator(Core::ActionManager *am, - QObject *parent, +Core::Command *createSeparator(QObject *parent, Core::Context &context, const char *id) { QAction *separator = new QAction(parent); separator->setSeparator(true); - return am->registerAction(separator, Core::Id(id), context); + return Core::ActionManager::registerAction(separator, Core::Id(id), context); } CppPlugin *CppPlugin::m_instance = 0; @@ -227,21 +226,20 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess Core::Context context(CppEditor::Constants::C_CPPEDITOR); - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT); + Core::ActionContainer *contextMenu= Core::ActionManager::createMenu(CppEditor::Constants::M_CONTEXT); Core::Command *cmd; - Core::ActionContainer *cppToolsMenu = am->actionContainer(Core::Id(CppTools::Constants::M_TOOLS_CPP)); + Core::ActionContainer *cppToolsMenu = Core::ActionManager::actionContainer(Core::Id(CppTools::Constants::M_TOOLS_CPP)); - cmd = am->command(Core::Id(CppTools::Constants::SWITCH_HEADER_SOURCE)); + cmd = Core::ActionManager::command(Core::Id(CppTools::Constants::SWITCH_HEADER_SOURCE)); contextMenu->addAction(cmd); - cmd = am->command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); + cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Method Declaration/Definition"), this); - cmd = am->registerAction(switchDeclarationDefinition, + cmd = Core::ActionManager::registerAction(switchDeclarationDefinition, Constants::SWITCH_DECLARATION_DEFINITION, context, true); cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F2"))); connect(switchDeclarationDefinition, SIGNAL(triggered()), @@ -250,14 +248,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cppToolsMenu->addAction(cmd); m_findUsagesAction = new QAction(tr("Find Usages"), this); - cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); + cmd = Core::ActionManager::registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); cppToolsMenu->addAction(cmd); m_openTypeHierarchyAction = new QAction(tr("Open Type Hierarchy"), this); - cmd = am->registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context); + cmd = Core::ActionManager::registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+T"))); connect(m_openTypeHierarchyAction, SIGNAL(triggered()), this, SLOT(openTypeHierarchy())); contextMenu->addAction(cmd); @@ -265,16 +263,16 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess // Refactoring sub-menu Core::Context globalContext(Core::Constants::C_GLOBAL); - Core::Command *sep = createSeparator(am, this, globalContext, + Core::Command *sep = createSeparator(this, globalContext, Constants::SEPARATOR2); sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)); contextMenu->addAction(sep); - contextMenu->addAction(createSeparator(am, this, globalContext, + contextMenu->addAction(createSeparator(this, globalContext, Constants::SEPARATOR3)); m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol Under Cursor"), this); - cmd = am->registerAction(m_renameSymbolUnderCursorAction, + cmd = Core::ActionManager::registerAction(m_renameSymbolUnderCursorAction, Constants::RENAME_SYMBOL_UNDER_CURSOR, context); cmd->setDefaultKeySequence(QKeySequence(tr("CTRL+SHIFT+R"))); @@ -283,9 +281,9 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess cppToolsMenu->addAction(cmd); // Update context in global context - cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR4)); + cppToolsMenu->addAction(createSeparator(this, globalContext, CppEditor::Constants::SEPARATOR4)); m_updateCodeModelAction = new QAction(tr("Update Code Model"), this); - cmd = am->registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext); + cmd = Core::ActionManager::registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext); CPlusPlus::CppModelManagerInterface *cppModelManager = CPlusPlus::CppModelManagerInterface::instance(); connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); cppToolsMenu->addAction(cmd); @@ -298,12 +296,12 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess m_actionHandler->initializeActions(); - contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR)); + contextMenu->addAction(createSeparator(this, context, CppEditor::Constants::SEPARATOR)); - cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); + cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); - cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); + cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)), diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index f33f40e5bf..377264c52f 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -102,8 +102,6 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) Q_UNUSED(arguments) Q_UNUSED(error) - Core::ActionManager *am = Core::ICore::actionManager(); - m_settings = new CppToolsSettings(this); // force registration of cpp tools settings // Objects @@ -124,8 +122,8 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) addAutoReleasedObject(new CppCodeStyleSettingsPage); // Menus - Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); - Core::ActionContainer *mcpptools = am->createMenu(CppTools::Constants::M_TOOLS_CPP); + Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); + Core::ActionContainer *mcpptools = Core::ActionManager::createMenu(CppTools::Constants::M_TOOLS_CPP); QMenu *menu = mcpptools->menu(); menu->setTitle(tr("&C++")); menu->setEnabled(true); @@ -135,7 +133,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error) Core::Context context(CppEditor::Constants::C_CPPEDITOR); QAction *switchAction = new QAction(tr("Switch Header/Source"), this); - Core::Command *command = am->registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true); + Core::Command *command = Core::ActionManager::registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true); command->setDefaultKeySequence(QKeySequence(Qt::Key_F4)); mcpptools->addAction(command); connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource())); diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 778e9ed420..fb133fd7a8 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -224,13 +224,12 @@ static const VcsBaseSubmitEditorParameters submitParameters = { }; static Command *createSeparator(QObject *parent, - ActionManager *ami, const char *id, const Context &globalcontext) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); - return ami->registerAction(tmpaction, id, globalcontext); + return Core::ActionManager::registerAction(tmpaction, id, globalcontext); } bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) @@ -269,10 +268,9 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(m_commandLocator); // Register actions - ActionManager *ami = ICore::actionManager(); - ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS); + ActionContainer *toolsContainer = Core::ActionManager::actionContainer(M_TOOLS); - ActionContainer *cvsMenu = ami->createMenu(Id(CMD_ID_CVS_MENU)); + ActionContainer *cvsMenu = Core::ActionManager::createMenu(Id(CMD_ID_CVS_MENU)); cvsMenu->menu()->setTitle(tr("&CVS")); toolsContainer->addMenu(cvsMenu); m_menuAction = cvsMenu->menu()->menuAction(); @@ -282,7 +280,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) Command *command; m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_diffCurrentAction, + command = Core::ActionManager::registerAction(m_diffCurrentAction, CMD_ID_DIFF_CURRENT, globalcontext); command->setAttribute(Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+D") : tr("Alt+C,Alt+D"))); @@ -291,7 +289,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_commandLocator->appendCommand(command); m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_filelogCurrentAction, + command = Core::ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_filelogCurrentAction, SIGNAL(triggered()), this, @@ -300,7 +298,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_commandLocator->appendCommand(command); m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_annotateCurrentAction, + command = Core::ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_annotateCurrentAction, SIGNAL(triggered()), this, @@ -308,10 +306,10 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR0, globalcontext)); + cvsMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR0, globalcontext)); m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_addAction, CMD_ID_ADD, + command = Core::ActionManager::registerAction(m_addAction, CMD_ID_ADD, globalcontext); command->setAttribute(Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+A") : tr("Alt+C,Alt+A"))); @@ -320,7 +318,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_commandLocator->appendCommand(command); m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_commitCurrentAction, + command = Core::ActionManager::registerAction(m_commitCurrentAction, CMD_ID_COMMIT_CURRENT, globalcontext); command->setAttribute(Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+C") : tr("Alt+C,Alt+C"))); @@ -329,7 +327,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_commandLocator->appendCommand(command); m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, + command = Core::ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); @@ -337,39 +335,39 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_commandLocator->appendCommand(command); m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_revertAction, CMD_ID_REVERT, + command = Core::ActionManager::registerAction(m_revertAction, CMD_ID_REVERT, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR1, globalcontext)); + cvsMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR1, globalcontext)); m_editCurrentAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, globalcontext); + command = Core::ActionManager::registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_editCurrentAction, SIGNAL(triggered()), this, SLOT(editCurrentFile())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_uneditCurrentAction = new Utils::ParameterAction(tr("Unedit"), tr("Unedit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, globalcontext); + command = Core::ActionManager::registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_uneditCurrentAction, SIGNAL(triggered()), this, SLOT(uneditCurrentFile())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_uneditRepositoryAction = new QAction(tr("Unedit Repository"), this); - command = ami->registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, globalcontext); + command = Core::ActionManager::registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, globalcontext); connect(m_uneditRepositoryAction, SIGNAL(triggered()), this, SLOT(uneditCurrentRepository())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext)); + cvsMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR2, globalcontext)); m_diffProjectAction = new Utils::ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, + command = Core::ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject())); @@ -377,7 +375,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_commandLocator->appendCommand(command); m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_statusProjectAction, CMD_ID_STATUS, + command = Core::ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus())); @@ -385,61 +383,61 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) m_commandLocator->appendCommand(command); m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); + command = Core::ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext); + command = Core::ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_commitProjectAction = new Utils::ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, globalcontext); + command = Core::ActionManager::registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, globalcontext); command->setAttribute(Command::CA_UpdateText); connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(commitProject())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); - cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR3, globalcontext)); + cvsMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR3, globalcontext)); m_diffRepositoryAction = new QAction(tr("Diff Repository"), this); - command = ami->registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext); + command = Core::ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext); connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_statusRepositoryAction = new QAction(tr("Repository Status"), this); - command = ami->registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext); + command = Core::ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext); connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_logRepositoryAction = new QAction(tr("Repository Log"), this); - command = ami->registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); + command = Core::ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_updateRepositoryAction = new QAction(tr("Update Repository"), this); - command = ami->registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext); + command = Core::ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext); connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_commitAllAction = new QAction(tr("Commit All Files"), this); - command = ami->registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL, + command = Core::ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL, globalcontext); connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll())); cvsMenu->addAction(command); m_commandLocator->appendCommand(command); m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this); - command = ami->registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL, + command = Core::ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL, globalcontext); connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll())); cvsMenu->addAction(command); @@ -449,18 +447,18 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) Context cvscommitcontext(Constants::CVSCOMMITEDITOR); m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); - command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, cvscommitcontext); + command = Core::ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, cvscommitcontext); command->setAttribute(Command::CA_UpdateText); connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); - command = ami->registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, cvscommitcontext); + command = Core::ActionManager::registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, cvscommitcontext); m_submitUndoAction = new QAction(tr("&Undo"), this); - command = ami->registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext); + command = Core::ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext); m_submitRedoAction = new QAction(tr("&Redo"), this); - command = ami->registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext); + command = Core::ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext); return true; } diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index a1e68b133e..43e6e9f664 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -324,9 +324,8 @@ void DebuggerMainWindow::onModeChanged(IMode *mode) void DebuggerMainWindowPrivate::createViewsMenuItems() { - ActionManager *am = ICore::actionManager(); Context debugcontext(Constants::C_DEBUGMODE); - m_viewsMenu = am->actionContainer(Id(Core::Constants::M_WINDOW_VIEWS)); + m_viewsMenu = Core::ActionManager::actionContainer(Id(Core::Constants::M_WINDOW_VIEWS)); QTC_ASSERT(m_viewsMenu, return); QAction *openMemoryEditorAction = new QAction(this); @@ -336,25 +335,25 @@ void DebuggerMainWindowPrivate::createViewsMenuItems() // Add menu items Command *cmd = 0; - cmd = am->registerAction(openMemoryEditorAction, + cmd = Core::ActionManager::registerAction(openMemoryEditorAction, Core::Id("Debugger.Views.OpenMemoryEditor"), debugcontext); cmd->setAttribute(Command::CA_Hide); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - cmd = am->registerAction(q->menuSeparator1(), + cmd = Core::ActionManager::registerAction(q->menuSeparator1(), Core::Id("Debugger.Views.Separator1"), debugcontext); cmd->setAttribute(Command::CA_Hide); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - cmd = am->registerAction(q->toggleLockedAction(), + cmd = Core::ActionManager::registerAction(q->toggleLockedAction(), Core::Id("Debugger.Views.ToggleLocked"), debugcontext); cmd->setAttribute(Command::CA_Hide); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - cmd = am->registerAction(q->menuSeparator2(), + cmd = Core::ActionManager::registerAction(q->menuSeparator2(), Core::Id("Debugger.Views.Separator2"), debugcontext); cmd->setAttribute(Command::CA_Hide); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); - cmd = am->registerAction(q->resetLayoutAction(), + cmd = Core::ActionManager::registerAction(q->resetLayoutAction(), Core::Id("Debugger.Views.ResetSimple"), debugcontext); cmd->setAttribute(Command::CA_Hide); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); @@ -452,9 +451,8 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua Context globalContext(Core::Constants::C_GLOBAL); - ActionManager *am = ICore::actionManager(); QAction *toggleViewAction = dockWidget->toggleViewAction(); - Command *cmd = am->registerAction(toggleViewAction, + Command *cmd = Core::ActionManager::registerAction(toggleViewAction, Core::Id(QLatin1String("Debugger.") + widget->objectName()), globalContext); cmd->setAttribute(Command::CA_Hide); d->m_menuCommandsToAdd.append(cmd); @@ -486,12 +484,11 @@ void DebuggerMainWindow::addStagedMenuEntries() QWidget *DebuggerMainWindow::createContents(IMode *mode) { - ActionManager *am = ICore::actionManager(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), d, SLOT(updateUiForProject(ProjectExplorer::Project*))); - d->m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); + d->m_viewsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); QTC_ASSERT(d->m_viewsMenu, return 0); //d->m_mainWindow = new Internal::DebuggerMainWindow(this); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 3efe927e5d..12f8e26a1a 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -453,12 +453,12 @@ static QToolButton *toolButton(QAction *action) static void setProxyAction(Utils::ProxyAction *proxy, const char *id) { - proxy->setAction(Core::ICore::actionManager()->command(id)->action()); + proxy->setAction(Core::ActionManager::command(id)->action()); } static QToolButton *toolButton(const char *id) { - return toolButton(Core::ICore::actionManager()->command(id)->action()); + return toolButton(Core::ActionManager::command(id)->action()); } static Abi anyAbiOfBinary(const QString &fileName) @@ -2855,9 +2855,6 @@ void DebuggerPluginPrivate::extensionsInitialized() connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown())); - ActionManager *am = ICore::actionManager(); - QTC_ASSERT(am, return); - m_plugin->addObject(this); const Context globalcontext(CC::C_GLOBAL); @@ -3000,16 +2997,16 @@ void DebuggerPluginPrivate::extensionsInitialized() qmlSelectDummyAction->setCheckable(true); qmlSelectDummyAction->setIcon(QIcon(_(":/debugger/images/qml/select.png"))); qmlSelectDummyAction->setEnabled(false); - am->registerAction(qmlSelectDummyAction, Constants::QML_SELECTTOOL, globalcontext); + Core::ActionManager::registerAction(qmlSelectDummyAction, Constants::QML_SELECTTOOL, globalcontext); QAction *qmlZoomDummyAction = new QAction(tr("Zoom"), this); qmlZoomDummyAction->setCheckable(true); qmlZoomDummyAction->setIcon(QIcon(_(":/debugger/images/qml/zoom.png"))); qmlZoomDummyAction->setEnabled(false); - am->registerAction(qmlZoomDummyAction, Constants::QML_ZOOMTOOL, globalcontext); + Core::ActionManager::registerAction(qmlZoomDummyAction, Constants::QML_ZOOMTOOL, globalcontext); ActionContainer *debugMenu = - am->actionContainer(ProjectExplorer::Constants::M_DEBUG); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG); // Dock widgets QDockWidget *dock = 0; @@ -3127,9 +3124,9 @@ void DebuggerPluginPrivate::extensionsInitialized() // G_START_QML Command *cmd = 0; - ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING); + ActionContainer *mstart = Core::ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); - cmd = am->registerAction(m_startAction, Constants::DEBUG, globalcontext); + cmd = Core::ActionManager::registerAction(m_startAction, Constants::DEBUG, globalcontext); cmd->setDescription(tr("Start Debugging")); cmd->setDefaultKeySequence(debugKey); cmd->setAttribute(Command::CA_UpdateText); @@ -3142,17 +3139,17 @@ void DebuggerPluginPrivate::extensionsInitialized() ModeManager::addAction(m_visibleStartAction, Constants::P_ACTION_DEBUG); - cmd = am->registerAction(m_debugWithoutDeployAction, + cmd = Core::ActionManager::registerAction(m_debugWithoutDeployAction, "Debugger.DebugWithoutDeploy", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = am->registerAction(m_attachToLocalProcessAction, + cmd = Core::ActionManager::registerAction(m_attachToLocalProcessAction, "Debugger.AttachToLocalProcess", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_START_LOCAL); - cmd = am->registerAction(m_startLocalProcessAction, + cmd = Core::ActionManager::registerAction(m_startLocalProcessAction, "Debugger.StartLocalProcess", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Debugger::Constants::G_START_LOCAL); @@ -3164,40 +3161,40 @@ void DebuggerPluginPrivate::extensionsInitialized() // m_startRemoteProcessAction->setVisible(on); // m_startRemoteServerAction->setVisible(on); - cmd = am->registerAction(m_attachToCoreAction, + cmd = Core::ActionManager::registerAction(m_attachToCoreAction, "Debugger.AttachCore", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_START_LOCAL); - cmd = am->registerAction(m_attachToRemoteServerAction, + cmd = Core::ActionManager::registerAction(m_attachToRemoteServerAction, "Debugger.AttachToRemoteServer", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); - cmd = am->registerAction(m_startRemoteProcessAction, + cmd = Core::ActionManager::registerAction(m_startRemoteProcessAction, "Debugger.StartRemoteProcess", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); - cmd = am->registerAction(m_startRemoteServerAction, + cmd = Core::ActionManager::registerAction(m_startRemoteServerAction, "Debugger.StartRemoteServer", globalcontext); cmd->setDescription(tr("Start Gdbserver")); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); - cmd = am->registerAction(m_attachToRemoteProcessAction, + cmd = Core::ActionManager::registerAction(m_attachToRemoteProcessAction, "Debugger.AttachToRemoteProcess", globalcontext); cmd->setDescription(tr("Attach to Remote Process")); mstart->addAction(cmd, Debugger::Constants::G_AUTOMATIC_REMOTE); #ifdef WITH_LLDB - cmd = am->registerAction(m_startRemoteLldbAction, + cmd = Core::ActionManager::registerAction(m_startRemoteLldbAction, "Debugger.RemoteLldb", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); #endif if (m_startRemoteCdbAction) { - cmd = am->registerAction(m_startRemoteCdbAction, + cmd = Core::ActionManager::registerAction(m_startRemoteCdbAction, "Debugger.AttachRemoteCdb", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); @@ -3205,31 +3202,31 @@ void DebuggerPluginPrivate::extensionsInitialized() QAction *sep = new QAction(mstart); sep->setSeparator(true); - cmd = am->registerAction(sep, + cmd = Core::ActionManager::registerAction(sep, "Debugger.Start.Qml", globalcontext); mstart->addAction(cmd, Constants::G_START_QML); - cmd = am->registerAction(m_attachToQmlPortAction, + cmd = Core::ActionManager::registerAction(m_attachToQmlPortAction, "Debugger.AttachToQmlPort", globalcontext); cmd->setAttribute(Command::CA_Hide); mstart->addAction(cmd, Constants::G_START_QML); - cmd = am->registerAction(m_detachAction, + cmd = Core::ActionManager::registerAction(m_detachAction, "Debugger.Detach", globalcontext); cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = am->registerAction(m_interruptAction, + cmd = Core::ActionManager::registerAction(m_interruptAction, Constants::INTERRUPT, globalcontext); cmd->setDescription(tr("Interrupt Debugger")); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = am->registerAction(m_continueAction, + cmd = Core::ActionManager::registerAction(m_continueAction, Constants::CONTINUE, globalcontext); cmd->setDefaultKeySequence(debugKey); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); - cmd = am->registerAction(m_exitAction, + cmd = Core::ActionManager::registerAction(m_exitAction, Constants::STOP, globalcontext); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); m_hiddenStopAction = new Utils::ProxyAction(this); @@ -3237,47 +3234,47 @@ void DebuggerPluginPrivate::extensionsInitialized() m_hiddenStopAction->setAttribute(Utils::ProxyAction::UpdateText); m_hiddenStopAction->setAttribute(Utils::ProxyAction::UpdateIcon); - cmd = am->registerAction(m_hiddenStopAction, + cmd = Core::ActionManager::registerAction(m_hiddenStopAction, Constants::HIDDEN_STOP, globalcontext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+Ctrl+Y") : tr("Shift+F5"))); - cmd = am->registerAction(m_abortAction, + cmd = Core::ActionManager::registerAction(m_abortAction, Constants::ABORT, globalcontext); cmd->setDescription(tr("Reset Debugger")); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, "Debugger.Sep.Step", globalcontext); + cmd = Core::ActionManager::registerAction(sep, "Debugger.Sep.Step", globalcontext); debugMenu->addAction(cmd); - cmd = am->registerAction(m_nextAction, + cmd = Core::ActionManager::registerAction(m_nextAction, Constants::NEXT, globalcontext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+O") : tr("F10"))); cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_UpdateText); debugMenu->addAction(cmd); - cmd = am->registerAction(m_stepAction, + cmd = Core::ActionManager::registerAction(m_stepAction, Constants::STEP, globalcontext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+I") : tr("F11"))); cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_UpdateText); debugMenu->addAction(cmd); - cmd = am->registerAction(m_stepOutAction, + cmd = Core::ActionManager::registerAction(m_stepOutAction, Constants::STEPOUT, cppDebuggercontext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+T") : tr("Shift+F11"))); cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd); - cmd = am->registerAction(m_runToLineAction, + cmd = Core::ActionManager::registerAction(m_runToLineAction, "Debugger.RunToLine", cppDebuggercontext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+F8") : tr("Ctrl+F10"))); cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd); - cmd = am->registerAction(m_runToSelectedFunctionAction, + cmd = Core::ActionManager::registerAction(m_runToSelectedFunctionAction, "Debugger.RunToSelectedFunction", cppDebuggercontext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+F6") : tr("Ctrl+F6"))); cmd->setAttribute(Command::CA_Hide); @@ -3285,17 +3282,17 @@ void DebuggerPluginPrivate::extensionsInitialized() // and text up-to-date is a lot of hassle. // debugMenu->addAction(cmd); - cmd = am->registerAction(m_jumpToLineAction, + cmd = Core::ActionManager::registerAction(m_jumpToLineAction, "Debugger.JumpToLine", cppDebuggercontext); cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd); - cmd = am->registerAction(m_returnFromFunctionAction, + cmd = Core::ActionManager::registerAction(m_returnFromFunctionAction, "Debugger.ReturnFromFunction", cppDebuggercontext); cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd); - cmd = am->registerAction(m_reverseDirectionAction, + cmd = Core::ActionManager::registerAction(m_reverseDirectionAction, Constants::REVERSE, cppDebuggercontext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("F12"))); cmd->setAttribute(Command::CA_Hide); @@ -3303,26 +3300,26 @@ void DebuggerPluginPrivate::extensionsInitialized() sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, "Debugger.Sep.Break", globalcontext); + cmd = Core::ActionManager::registerAction(sep, "Debugger.Sep.Break", globalcontext); debugMenu->addAction(cmd); - //cmd = am->registerAction(m_snapshotAction, + //cmd = Core::ActionManager::registerAction(m_snapshotAction, // "Debugger.Snapshot", cppDebuggercontext); //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+S"))); //cmd->setAttribute(Command::CA_Hide); //debugMenu->addAction(cmd); - cmd = am->registerAction(m_frameDownAction, + cmd = Core::ActionManager::registerAction(m_frameDownAction, "Debugger.FrameDown", cppDebuggercontext); - cmd = am->registerAction(m_frameUpAction, + cmd = Core::ActionManager::registerAction(m_frameUpAction, "Debugger.FrameUp", cppDebuggercontext); - cmd = am->registerAction(action(OperateByInstruction), + cmd = Core::ActionManager::registerAction(action(OperateByInstruction), Constants::OPERATE_BY_INSTRUCTION, cppDebuggercontext); cmd->setAttribute(Command::CA_Hide); debugMenu->addAction(cmd); - cmd = am->registerAction(m_breakAction, + cmd = Core::ActionManager::registerAction(m_breakAction, "Debugger.ToggleBreak", globalcontext); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("F8") : tr("F9"))); debugMenu->addAction(cmd); @@ -3331,11 +3328,11 @@ void DebuggerPluginPrivate::extensionsInitialized() sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, "Debugger.Sep.Watch", globalcontext); + cmd = Core::ActionManager::registerAction(sep, "Debugger.Sep.Watch", globalcontext); debugMenu->addAction(cmd); // Don't add '1' to the string as it shows up in the shortcut dialog. - cmd = am->registerAction(m_watchAction1, + cmd = Core::ActionManager::registerAction(m_watchAction1, "Debugger.AddToWatch", cppeditorcontext); //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+W"))); debugMenu->addAction(cmd); @@ -3343,13 +3340,13 @@ void DebuggerPluginPrivate::extensionsInitialized() // If the CppEditor plugin is there, we want to add something to // the editor context menu. if (ActionContainer *editorContextMenu = - am->actionContainer(CppEditor::Constants::M_CONTEXT)) { - cmd = am->registerAction(sep, "Debugger.Sep.Views", + Core::ActionManager::actionContainer(CppEditor::Constants::M_CONTEXT)) { + cmd = Core::ActionManager::registerAction(sep, "Debugger.Sep.Views", cppDebuggercontext); editorContextMenu->addAction(cmd); cmd->setAttribute(Command::CA_Hide); - cmd = am->registerAction(m_watchAction2, + cmd = Core::ActionManager::registerAction(m_watchAction2, "Debugger.AddToWatch2", cppDebuggercontext); cmd->action()->setEnabled(true); editorContextMenu->addAction(cmd); @@ -3585,8 +3582,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess // Menu groups const Context globalcontext(CC::C_GLOBAL); - ActionManager *am = ICore::actionManager(); - ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING); + ActionContainer *mstart = Core::ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING); mstart->appendGroup(Constants::G_START_LOCAL); mstart->appendGroup(Constants::G_MANUAL_REMOTE); @@ -3596,17 +3592,17 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess // Separators QAction *sep = new QAction(mstart); sep->setSeparator(true); - Command *cmd = am->registerAction(sep, "Debugger.Local.Cpp", globalcontext); + Command *cmd = Core::ActionManager::registerAction(sep, "Debugger.Local.Cpp", globalcontext); mstart->addAction(cmd, Constants::G_START_LOCAL); sep = new QAction(mstart); sep->setSeparator(true); - cmd = am->registerAction(sep, "Debugger.StartRemote.Cpp", globalcontext); + cmd = Core::ActionManager::registerAction(sep, "Debugger.StartRemote.Cpp", globalcontext); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); sep = new QAction(mstart); sep->setSeparator(true); - cmd = am->registerAction(sep, "Debugger.AttachRemote.Cpp", globalcontext); + cmd = Core::ActionManager::registerAction(sep, "Debugger.AttachRemote.Cpp", globalcontext); mstart->addAction(cmd, Constants::G_AUTOMATIC_REMOTE); return theDebuggerCore->initialize(arguments, errorMessage); diff --git a/src/plugins/debugger/qml/qmlinspectoradapter.cpp b/src/plugins/debugger/qml/qmlinspectoradapter.cpp index ea76e0ff01..d1644befa5 100644 --- a/src/plugins/debugger/qml/qmlinspectoradapter.cpp +++ b/src/plugins/debugger/qml/qmlinspectoradapter.cpp @@ -192,7 +192,6 @@ void QmlInspectorAdapter::clientStatusChanged(QmlDebug::ClientStatus status) void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status) { - Core::ActionManager *am = Core::ICore::actionManager(); BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender()); if (status == QmlDebug::Enabled) { m_toolsClient = client; @@ -212,10 +211,10 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status // register actions here // because there can be multiple QmlEngines // at the same time (but hopefully one one is connected) - am->registerAction(m_selectAction, + Core::ActionManager::registerAction(m_selectAction, Core::Id(Constants::QML_SELECTTOOL), m_inspectorToolsContext); - am->registerAction(m_zoomAction, Core::Id(Constants::QML_ZOOMTOOL), + Core::ActionManager::registerAction(m_zoomAction, Core::Id(Constants::QML_ZOOMTOOL), m_inspectorToolsContext); Core::ICore::updateAdditionalContexts(Core::Context(), @@ -239,9 +238,9 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status disconnect(client, SIGNAL(logActivity(QString,QString)), m_debugAdapter, SLOT(logServiceActivity(QString,QString))); - am->unregisterAction(m_selectAction, + Core::ActionManager::unregisterAction(m_selectAction, Core::Id(Constants::QML_SELECTTOOL)); - am->unregisterAction(m_zoomAction, + Core::ActionManager::unregisterAction(m_zoomAction, Core::Id(Constants::QML_ZOOMTOOL)); m_selectAction->setChecked(false); diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index d1d339ddd1..76052b4bb0 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -127,7 +127,6 @@ static inline QIcon designerIcon(const QString &iconName) // Create a menu separator static QAction *createSeparator(QObject *parent, - Core::ActionManager *am, const Core::Context &context, Core::ActionContainer *container, const Core::Id &id, @@ -135,7 +134,7 @@ static QAction *createSeparator(QObject *parent, { QAction *actSeparator = new QAction(parent); actSeparator->setSeparator(true); - Core::Command *command = am->registerAction(actSeparator, id, context); + Core::Command *command = Core::ActionManager::registerAction(actSeparator, id, context); container->addAction(command, group); return actSeparator; } @@ -227,15 +226,14 @@ FormEditorW::~FormEditorW() } // Add an actioon to toggle the view state of a dock window -void FormEditorW::addDockViewAction(Core::ActionManager *am, - Core::ActionContainer *viewMenu, +void FormEditorW::addDockViewAction(Core::ActionContainer *viewMenu, int index, const Core::Context &context, const QString &title, const Core::Id &id) { if (const QDockWidget *dw = m_editorWidget->designerDockWidgets()[index]) { QAction *action = dw->toggleViewAction(); action->setText(title); - Core::Command *cmd = addToolAction(action, am, context, id, viewMenu, QString()); + Core::Command *cmd = addToolAction(action, context, id, viewMenu, QString()); cmd->setAttribute(Core::Command::CA_Hide); } } @@ -243,35 +241,34 @@ void FormEditorW::addDockViewAction(Core::ActionManager *am, void FormEditorW::setupViewActions() { // Populate "View" menu of form editor menu - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *viewMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); + Core::ActionContainer *viewMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); QTC_ASSERT(viewMenu, return); - addDockViewAction(am, viewMenu, WidgetBoxSubWindow, m_contexts, + addDockViewAction(viewMenu, WidgetBoxSubWindow, m_contexts, tr("Widget box"), Core::Id("FormEditor.WidgetBox")); - addDockViewAction(am, viewMenu, ObjectInspectorSubWindow, m_contexts, + addDockViewAction(viewMenu, ObjectInspectorSubWindow, m_contexts, tr("Object Inspector"), Core::Id("FormEditor.ObjectInspector")); - addDockViewAction(am, viewMenu, PropertyEditorSubWindow, m_contexts, + addDockViewAction(viewMenu, PropertyEditorSubWindow, m_contexts, tr("Property Editor"), Core::Id("FormEditor.PropertyEditor")); - addDockViewAction(am, viewMenu, SignalSlotEditorSubWindow, m_contexts, + addDockViewAction(viewMenu, SignalSlotEditorSubWindow, m_contexts, tr("Signals && Slots Editor"), Core::Id("FormEditor.SignalsAndSlotsEditor")); - addDockViewAction(am, viewMenu, ActionEditorSubWindow, m_contexts, + addDockViewAction(viewMenu, ActionEditorSubWindow, m_contexts, tr("Action Editor"), Core::Id("FormEditor.ActionEditor")); // Lock/Reset - Core::Command *cmd = addToolAction(m_editorWidget->menuSeparator1(), am, m_contexts, Core::Id("FormEditor.SeparatorLock"), viewMenu, QString()); + Core::Command *cmd = addToolAction(m_editorWidget->menuSeparator1(), m_contexts, Core::Id("FormEditor.SeparatorLock"), viewMenu, QString()); cmd->setAttribute(Core::Command::CA_Hide); - cmd = addToolAction(m_editorWidget->toggleLockedAction(), am, m_contexts, Core::Id("FormEditor.Locked"), viewMenu, QString()); + cmd = addToolAction(m_editorWidget->toggleLockedAction(), m_contexts, Core::Id("FormEditor.Locked"), viewMenu, QString()); cmd->setAttribute(Core::Command::CA_Hide); - cmd = addToolAction(m_editorWidget->menuSeparator2(), am, m_contexts, Core::Id("FormEditor.SeparatorReset"), viewMenu, QString()); + cmd = addToolAction(m_editorWidget->menuSeparator2(), m_contexts, Core::Id("FormEditor.SeparatorReset"), viewMenu, QString()); cmd->setAttribute(Core::Command::CA_Hide); - cmd = addToolAction(m_editorWidget->resetLayoutAction(), am, m_contexts, Core::Id("FormEditor.ResetToDefaultLayout"), viewMenu, QString()); + cmd = addToolAction(m_editorWidget->resetLayoutAction(), m_contexts, Core::Id("FormEditor.ResetToDefaultLayout"), viewMenu, QString()); connect(m_editorWidget, SIGNAL(resetLayout()), m_editorWidget, SLOT(resetToDefaultLayout())); cmd->setAttribute(Core::Command::CA_Hide); } @@ -428,36 +425,35 @@ void FormEditorW::deleteInstance() void FormEditorW::setupActions() { - Core::ActionManager *am = Core::ICore::actionManager(); Core::Command *command; //menus Core::ActionContainer *medit = - am->actionContainer(Core::Constants::M_EDIT); + Core::ActionManager::actionContainer(Core::Constants::M_EDIT); Core::ActionContainer *mtools = - am->actionContainer(Core::Constants::M_TOOLS); + Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *mformtools = - am->createMenu(M_FORMEDITOR); + Core::ActionManager::createMenu(M_FORMEDITOR); mformtools->menu()->setTitle(tr("For&m Editor")); mtools->addMenu(mformtools); //overridden actions - bindShortcut(am->registerAction(m_fwm->actionUndo(), Core::Constants::UNDO, m_contexts), m_fwm->actionUndo()); - bindShortcut(am->registerAction(m_fwm->actionRedo(), Core::Constants::REDO, m_contexts), m_fwm->actionRedo()); - bindShortcut(am->registerAction(m_fwm->actionCut(), Core::Constants::CUT, m_contexts), m_fwm->actionCut()); - bindShortcut(am->registerAction(m_fwm->actionCopy(), Core::Constants::COPY, m_contexts), m_fwm->actionCopy()); - bindShortcut(am->registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_contexts), m_fwm->actionPaste()); - bindShortcut(am->registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_contexts), m_fwm->actionSelectAll()); + bindShortcut(Core::ActionManager::registerAction(m_fwm->actionUndo(), Core::Constants::UNDO, m_contexts), m_fwm->actionUndo()); + bindShortcut(Core::ActionManager::registerAction(m_fwm->actionRedo(), Core::Constants::REDO, m_contexts), m_fwm->actionRedo()); + bindShortcut(Core::ActionManager::registerAction(m_fwm->actionCut(), Core::Constants::CUT, m_contexts), m_fwm->actionCut()); + bindShortcut(Core::ActionManager::registerAction(m_fwm->actionCopy(), Core::Constants::COPY, m_contexts), m_fwm->actionCopy()); + bindShortcut(Core::ActionManager::registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_contexts), m_fwm->actionPaste()); + bindShortcut(Core::ActionManager::registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_contexts), m_fwm->actionSelectAll()); m_actionPrint = new QAction(this); - bindShortcut(am->registerAction(m_actionPrint, Core::Constants::PRINT, m_contexts), m_actionPrint); + bindShortcut(Core::ActionManager::registerAction(m_actionPrint, Core::Constants::PRINT, m_contexts), m_actionPrint); connect(m_actionPrint, SIGNAL(triggered()), this, SLOT(print())); //'delete' action. Do not set a shortcut as Designer handles // the 'Delete' key by event filter. Setting a shortcut triggers // buggy behaviour on Mac (Pressing Delete in QLineEdit removing the widget). - command = am->registerAction(m_fwm->actionDelete(), Core::Id("FormEditor.Edit.Delete"), m_contexts); + command = Core::ActionManager::registerAction(m_fwm->actionDelete(), Core::Id("FormEditor.Edit.Delete"), m_contexts); bindShortcut(command, m_fwm->actionDelete()); command->setAttribute(Core::Command::CA_Hide); medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE); @@ -468,80 +464,80 @@ void FormEditorW::setupActions() m_modeActionSeparator = new QAction(this); m_modeActionSeparator->setSeparator(true); - command = am->registerAction(m_modeActionSeparator, Core::Id("FormEditor.Sep.ModeActions"), m_contexts); + command = Core::ActionManager::registerAction(m_modeActionSeparator, Core::Id("FormEditor.Sep.ModeActions"), m_contexts); medit->addAction(command, Core::Constants::G_EDIT_OTHER); m_toolActionIds.push_back(Core::Id("FormEditor.WidgetEditor")); - createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit, + createEditModeAction(m_actionGroupEditMode, m_contexts, medit, tr("Edit Widgets"), m_toolActionIds.back(), EditModeWidgetEditor, QLatin1String("widgettool.png"), tr("F3")); m_toolActionIds.push_back(Core::Id("FormEditor.SignalsSlotsEditor")); - createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit, + createEditModeAction(m_actionGroupEditMode, m_contexts, medit, tr("Edit Signals/Slots"), m_toolActionIds.back(), EditModeSignalsSlotEditor, QLatin1String("signalslottool.png"), tr("F4")); m_toolActionIds.push_back(Core::Id("FormEditor.BuddyEditor")); - createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit, + createEditModeAction(m_actionGroupEditMode, m_contexts, medit, tr("Edit Buddies"), m_toolActionIds.back(), EditModeBuddyEditor, QLatin1String("buddytool.png")); m_toolActionIds.push_back(Core::Id("FormEditor.TabOrderEditor")); - createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit, + createEditModeAction(m_actionGroupEditMode, m_contexts, medit, tr("Edit Tab Order"), m_toolActionIds.back(), EditModeTabOrderEditor, QLatin1String("tabordertool.png")); //tool actions m_toolActionIds.push_back(Core::Id("FormEditor.LayoutHorizontally")); const QString horizLayoutShortcut = Core::UseMacShortcuts ? tr("Meta+Shift+H") : tr("Ctrl+H"); - addToolAction(m_fwm->actionHorizontalLayout(), am, m_contexts, + addToolAction(m_fwm->actionHorizontalLayout(), m_contexts, m_toolActionIds.back(), mformtools, horizLayoutShortcut); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutVertically")); const QString vertLayoutShortcut = Core::UseMacShortcuts ? tr("Meta+L") : tr("Ctrl+L"); - addToolAction(m_fwm->actionVerticalLayout(), am, m_contexts, + addToolAction(m_fwm->actionVerticalLayout(), m_contexts, m_toolActionIds.back(), mformtools, vertLayoutShortcut); m_toolActionIds.push_back(Core::Id("FormEditor.SplitHorizontal")); - addToolAction(m_fwm->actionSplitHorizontal(), am, m_contexts, + addToolAction(m_fwm->actionSplitHorizontal(), m_contexts, m_toolActionIds.back(), mformtools); m_toolActionIds.push_back(Core::Id("FormEditor.SplitVertical")); - addToolAction(m_fwm->actionSplitVertical(), am, m_contexts, + addToolAction(m_fwm->actionSplitVertical(), m_contexts, m_toolActionIds.back(), mformtools); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutForm")); - addToolAction(m_fwm->actionFormLayout(), am, m_contexts, + addToolAction(m_fwm->actionFormLayout(), m_contexts, m_toolActionIds.back(), mformtools); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutGrid")); const QString gridShortcut = Core::UseMacShortcuts ? tr("Meta+Shift+G") : tr("Ctrl+G"); - addToolAction(m_fwm->actionGridLayout(), am, m_contexts, + addToolAction(m_fwm->actionGridLayout(), m_contexts, m_toolActionIds.back(), mformtools, gridShortcut); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutBreak")); - addToolAction(m_fwm->actionBreakLayout(), am, m_contexts, + addToolAction(m_fwm->actionBreakLayout(), m_contexts, m_toolActionIds.back(), mformtools); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutAdjustSize")); const QString adjustShortcut = Core::UseMacShortcuts ? tr("Meta+J") : tr("Ctrl+J"); - addToolAction(m_fwm->actionAdjustSize(), am, m_contexts, + addToolAction(m_fwm->actionAdjustSize(), m_contexts, m_toolActionIds.back(), mformtools, adjustShortcut); m_toolActionIds.push_back(Core::Id("FormEditor.SimplifyLayout")); - addToolAction(m_fwm->actionSimplifyLayout(), am, m_contexts, + addToolAction(m_fwm->actionSimplifyLayout(), m_contexts, m_toolActionIds.back(), mformtools); - createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator1")); + createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator1")); - addToolAction(m_fwm->actionLower(), am, m_contexts, + addToolAction(m_fwm->actionLower(), m_contexts, Core::Id("FormEditor.Lower"), mformtools); - addToolAction(m_fwm->actionRaise(), am, m_contexts, + addToolAction(m_fwm->actionRaise(), m_contexts, Core::Id("FormEditor.Raise"), mformtools); // Commands that do not go into the editor toolbar - createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator2")); + createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator2")); #if QT_VERSION >= 0x050000 m_actionPreview = m_fwm->action(QDesignerFormWindowManagerInterface::DefaultPreviewAction); @@ -549,7 +545,7 @@ void FormEditorW::setupActions() m_actionPreview = m_fwm->actionDefaultPreview(); #endif QTC_ASSERT(m_actionPreview, return); - addToolAction(m_actionPreview, am, m_contexts, + addToolAction(m_actionPreview, m_contexts, Core::Id("FormEditor.Preview"), mformtools, tr("Alt+Shift+R")); // Preview in style... @@ -559,15 +555,15 @@ void FormEditorW::setupActions() m_actionGroupPreviewInStyle = m_fwm->actionGroupPreviewInStyle(); #endif - Core::ActionContainer *previewAC = createPreviewStyleMenu(am, m_actionGroupPreviewInStyle); + Core::ActionContainer *previewAC = createPreviewStyleMenu(m_actionGroupPreviewInStyle); m_previewInStyleMenu = previewAC->menu(); mformtools->addMenu(previewAC); setPreviewMenuEnabled(false); // Form settings - createSeparator(this, am, m_contexts, medit, Core::Id("FormEditor.Edit.Separator2"), Core::Constants::G_EDIT_OTHER); + createSeparator(this, m_contexts, medit, Core::Id("FormEditor.Edit.Separator2"), Core::Constants::G_EDIT_OTHER); - createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator3")); + createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator3")); m_actionSwitchSource = new QAction(tr("Switch Source/Form"), this); connect(m_actionSwitchSource, SIGNAL(triggered()), this, SLOT(switchSourceForm())); @@ -575,20 +571,20 @@ void FormEditorW::setupActions() // Switch form/source in editor/design contexts. Core::Context switchContexts = m_contexts; switchContexts.add(Core::Constants::C_EDITORMANAGER); - addToolAction(m_actionSwitchSource, am, switchContexts, Core::Id("FormEditor.FormSwitchSource"), mformtools, + addToolAction(m_actionSwitchSource, switchContexts, Core::Id("FormEditor.FormSwitchSource"), mformtools, tr("Shift+F4")); - createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator4")); + createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator4")); #if QT_VERSION >= 0x050000 QAction *actionFormSettings = m_fwm->action(QDesignerFormWindowManagerInterface::FormWindowSettingsDialogAction); #else QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog(); #endif - addToolAction(actionFormSettings, am, m_contexts, Core::Id("FormEditor.FormSettings"), mformtools); + addToolAction(actionFormSettings, m_contexts, Core::Id("FormEditor.FormSettings"), mformtools); - createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator5")); + createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator5")); m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this); - addToolAction(m_actionAboutPlugins, am, m_contexts, + addToolAction(m_actionAboutPlugins, m_contexts, Core::Id("FormEditor.AboutPlugins"), mformtools); connect(m_actionAboutPlugins, SIGNAL(triggered()), m_fwm, #if QT_VERSION >= 0x050000 @@ -606,10 +602,9 @@ void FormEditorW::setupActions() QToolBar *FormEditorW::createEditorToolBar() const { QToolBar *editorToolBar = new QToolBar; - Core::ActionManager *am = Core::ICore::actionManager(); const QList<Core::Id>::const_iterator cend = m_toolActionIds.constEnd(); for (QList<Core::Id>::const_iterator it = m_toolActionIds.constBegin(); it != cend; ++it) { - Core::Command *cmd = am->command(*it); + Core::Command *cmd = Core::ActionManager::command(*it); QTC_ASSERT(cmd, continue); QAction *action = cmd->action(); if (!action->icon().isNull()) // Simplify grid has no action yet @@ -621,11 +616,10 @@ QToolBar *FormEditorW::createEditorToolBar() const return editorToolBar; } -Core::ActionContainer *FormEditorW::createPreviewStyleMenu(Core::ActionManager *am, - QActionGroup *actionGroup) +Core::ActionContainer *FormEditorW::createPreviewStyleMenu(QActionGroup *actionGroup) { const QString menuId = QLatin1String(M_FORMEDITOR_PREVIEW); - Core::ActionContainer *menuPreviewStyle = am->createMenu(M_FORMEDITOR_PREVIEW); + Core::ActionContainer *menuPreviewStyle = Core::ActionManager::createMenu(M_FORMEDITOR_PREVIEW); menuPreviewStyle->menu()->setTitle(tr("Preview in")); // The preview menu is a list of invisible actions for the embedded design @@ -647,7 +641,7 @@ Core::ActionContainer *FormEditorW::createPreviewStyleMenu(Core::ActionManager * name += dot; } name += data.toString(); - Core::Command *command = am->registerAction(a, Core::Id(name), m_contexts); + Core::Command *command = Core::ActionManager::registerAction(a, Core::Id(name), m_contexts); bindShortcut(command, a); if (isDeviceProfile) { command->setAttribute(Core::Command::CA_UpdateText); @@ -689,7 +683,6 @@ void FormEditorW::bindShortcut(Core::Command *command, QAction *action) // Create an action to activate a designer tool QAction *FormEditorW::createEditModeAction(QActionGroup *ag, const Core::Context &context, - Core::ActionManager *am, Core::ActionContainer *medit, const QString &actionName, const Core::Id &id, @@ -701,7 +694,7 @@ QAction *FormEditorW::createEditModeAction(QActionGroup *ag, rc->setCheckable(true); if (!iconName.isEmpty()) rc->setIcon(designerIcon(iconName)); - Core::Command *command = am->registerAction(rc, id, context); + Core::Command *command = Core::ActionManager::registerAction(rc, id, context); command->setAttribute(Core::Command::CA_Hide); if (!keySequence.isEmpty()) command->setDefaultKeySequence(QKeySequence(keySequence)); @@ -713,11 +706,11 @@ QAction *FormEditorW::createEditModeAction(QActionGroup *ag, } // Create a tool action -Core::Command *FormEditorW::addToolAction(QAction *a, Core::ActionManager *am, +Core::Command *FormEditorW::addToolAction(QAction *a, const Core::Context &context, const Core::Id &id, Core::ActionContainer *c1, const QString &keySequence) { - Core::Command *command = am->registerAction(a, id, context); + Core::Command *command = Core::ActionManager::registerAction(a, id, context); if (!keySequence.isEmpty()) command->setDefaultKeySequence(QKeySequence(keySequence)); if (!a->isSeparator()) diff --git a/src/plugins/designer/formeditorw.h b/src/plugins/designer/formeditorw.h index 3a239579cb..37f09aadf3 100644 --- a/src/plugins/designer/formeditorw.h +++ b/src/plugins/designer/formeditorw.h @@ -147,27 +147,24 @@ private: void setupActions(); void setupViewActions(); - void addDockViewAction(Core::ActionManager *am, - Core::ActionContainer *viewMenu, + void addDockViewAction(Core::ActionContainer *viewMenu, int index, const Core::Context &context, const QString &title, const Core::Id &id); - Core::ActionContainer *createPreviewStyleMenu(Core::ActionManager *am, - QActionGroup *actionGroup); + Core::ActionContainer *createPreviewStyleMenu(QActionGroup *actionGroup); void critical(const QString &errorMessage); void bindShortcut(Core::Command *command, QAction *action); QAction *createEditModeAction(QActionGroup *ag, const Core::Context &context, - Core::ActionManager *am, Core::ActionContainer *medit, const QString &actionName, const Core::Id &id, int toolNumber, const QString &iconName = QString(), const QString &keySequence = QString()); - Core::Command *addToolAction(QAction *a, Core::ActionManager *am, + Core::Command *addToolAction(QAction *a, const Core::Context &context, const Core::Id &id, Core::ActionContainer *c1, const QString &keySequence = QString()); QToolBar *createEditorToolBar() const; diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 3eaa09d10a..d722c0ed2c 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -376,12 +376,9 @@ QWidget *FakeVimExCommandsPage::createPage(QWidget *parent) void FakeVimExCommandsPage::initialize() { - ActionManager *am = ICore::actionManager(); - QTC_ASSERT(am, return); - QMap<QString, QTreeWidgetItem *> sections; - foreach (Command *c, am->commands()) { + foreach (Command *c, Core::ActionManager::commands()) { if (c->action() && c->action()->isSeparator()) continue; @@ -937,8 +934,6 @@ void FakeVimPluginPrivate::aboutToShutdown() bool FakeVimPluginPrivate::initialize() { EditorManager *editorManager = ICore::editorManager(); - ActionManager *actionManager = ICore::actionManager(); - QTC_ASSERT(actionManager, return false); //m_wordCompletion = new WordCompletion; //q->addAutoReleasedObject(m_wordCompletion); @@ -968,12 +963,12 @@ bool FakeVimPluginPrivate::initialize() readSettings(); Core::Command *cmd = 0; - cmd = actionManager->registerAction(theFakeVimSetting(ConfigUseFakeVim), + cmd = Core::ActionManager::registerAction(theFakeVimSetting(ConfigUseFakeVim), Constants::INSTALL_HANDLER, globalcontext, true); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+V,Meta+V") : tr("Alt+V,Alt+V"))); ActionContainer *advancedMenu = - actionManager->actionContainer(Core::Constants::M_EDIT_ADVANCED); + Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_EDITOR); for (int i = 1; i < 10; ++i) { @@ -981,7 +976,7 @@ bool FakeVimPluginPrivate::initialize() act->setText(tr("Execute User Action #%1").arg(i)); act->setData(i); QString id = QString("FakeVim.UserAction%1").arg(i); - cmd = actionManager->registerAction(act, Core::Id(id), globalcontext); + cmd = Core::ActionManager::registerAction(act, Core::Id(id), globalcontext); cmd->setDefaultKeySequence(QKeySequence((Core::UseMacShortcuts ? tr("Meta+V,%1") : tr("Alt+V,%1")).arg(i))); connect(act, SIGNAL(triggered()), SLOT(userActionTriggered())); } @@ -1134,9 +1129,7 @@ void FakeVimPluginPrivate::showSettingsDialog() void FakeVimPluginPrivate::triggerAction(const Id &id) { - Core::ActionManager *am = ICore::actionManager(); - QTC_ASSERT(am, return); - Core::Command *cmd = am->command(id); + Core::Command *cmd = Core::ActionManager::command(id); QTC_ASSERT(cmd, qDebug() << "UNKNOWN CODE: " << id.name(); return); QAction *action = cmd->action(); QTC_ASSERT(action, return); @@ -1145,9 +1138,7 @@ void FakeVimPluginPrivate::triggerAction(const Id &id) void FakeVimPluginPrivate::setActionChecked(const Id &id, bool check) { - Core::ActionManager *am = ICore::actionManager(); - QTC_ASSERT(am, return); - Core::Command *cmd = am->command(id); + Core::Command *cmd = Core::ActionManager::command(id); QTC_ASSERT(cmd, return); QAction *action = cmd->action(); QTC_ASSERT(action, return); diff --git a/src/plugins/find/findplugin.cpp b/src/plugins/find/findplugin.cpp index 7efa527c42..8bc26ca214 100644 --- a/src/plugins/find/findplugin.cpp +++ b/src/plugins/find/findplugin.cpp @@ -196,9 +196,8 @@ void FindPlugin::openFindDialog(IFindFilter *filter) void FindPlugin::setupMenu() { - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT); - Core::ActionContainer *mfind = am->createMenu(Constants::M_FIND); + Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT); + Core::ActionContainer *mfind = Core::ActionManager::createMenu(Constants::M_FIND); medit->addMenu(mfind, Core::Constants::G_EDIT_FIND); mfind->menu()->setTitle(tr("&Find/Replace")); mfind->appendGroup(Constants::G_FIND_CURRENTDOCUMENT); @@ -210,19 +209,19 @@ void FindPlugin::setupMenu() QAction *separator; separator = new QAction(this); separator->setSeparator(true); - cmd = am->registerAction(separator, "Find.Sep.Flags", globalcontext); + cmd = Core::ActionManager::registerAction(separator, "Find.Sep.Flags", globalcontext); mfind->addAction(cmd, Constants::G_FIND_FLAGS); separator = new QAction(this); separator->setSeparator(true); - cmd = am->registerAction(separator, "Find.Sep.Actions", globalcontext); + cmd = Core::ActionManager::registerAction(separator, "Find.Sep.Actions", globalcontext); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); - Core::ActionContainer *mfindadvanced = am->createMenu(Constants::M_FIND_ADVANCED); + Core::ActionContainer *mfindadvanced = Core::ActionManager::createMenu(Constants::M_FIND_ADVANCED); mfindadvanced->menu()->setTitle(tr("Advanced Find")); mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS); d->m_openFindDialog = new QAction(tr("Open Advanced Find..."), this); d->m_openFindDialog->setIconText(tr("Advanced...")); - cmd = am->registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F"))); mfindadvanced->addAction(cmd); connect(d->m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter())); @@ -230,13 +229,12 @@ void FindPlugin::setupMenu() void FindPlugin::setupFilterMenuItems() { - Core::ActionManager *am = Core::ICore::actionManager(); QList<IFindFilter*> findInterfaces = ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>(); Core::Command *cmd; Core::Context globalcontext(Core::Constants::C_GLOBAL); - Core::ActionContainer *mfindadvanced = am->actionContainer(Constants::M_FIND_ADVANCED); + Core::ActionContainer *mfindadvanced = Core::ActionManager::actionContainer(Constants::M_FIND_ADVANCED); d->m_filterActions.clear(); bool haveEnabledFilters = false; foreach (IFindFilter *filter, findInterfaces) { @@ -246,7 +244,7 @@ void FindPlugin::setupFilterMenuItems() haveEnabledFilters = true; action->setEnabled(isEnabled); action->setData(qVariantFromValue(filter)); - cmd = am->registerAction(action, Core::Id(QLatin1String("FindFilter.")+filter->id()), globalcontext); + cmd = Core::ActionManager::registerAction(action, Core::Id(QLatin1String("FindFilter.")+filter->id()), globalcontext); cmd->setDefaultKeySequence(filter->defaultShortcut()); mfindadvanced->addAction(cmd); d->m_filterActions.insert(filter, action); diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 9b1017f1f3..ec5bd6de08 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -147,22 +147,21 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen // register actions Core::Context globalcontext(Core::Constants::C_GLOBAL); - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND); + Core::ActionContainer *mfind = Core::ActionManager::actionContainer(Constants::M_FIND); Core::Command *cmd; - m_ui.advancedButton->setDefaultAction(am->command(Constants::ADVANCED_FIND)->action()); + m_ui.advancedButton->setDefaultAction(Core::ActionManager::command(Constants::ADVANCED_FIND)->action()); QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace")); m_findInDocumentAction = new QAction(icon, tr("Find/Replace"), this); - cmd = am->registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT, globalcontext); + cmd = Core::ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT, globalcontext); cmd->setDefaultKeySequence(QKeySequence::Find); mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT); connect(m_findInDocumentAction, SIGNAL(triggered()), this, SLOT(openFind())); if (QApplication::clipboard()->supportsFindBuffer()) { m_enterFindStringAction = new QAction(tr("Enter Find String"), this); - cmd = am->registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext); + cmd = Core::ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+E"))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_enterFindStringAction, SIGNAL(triggered()), this, SLOT(putSelectionToFindClipboard())); @@ -170,33 +169,33 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen } m_findNextAction = new QAction(tr("Find Next"), this); - cmd = am->registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext); + cmd = Core::ActionManager::registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext); cmd->setDefaultKeySequence(QKeySequence::FindNext); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(invokeFindNext())); m_ui.findNextButton->setDefaultAction(cmd->action()); m_findPreviousAction = new QAction(tr("Find Previous"), this); - cmd = am->registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext); + cmd = Core::ActionManager::registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext); cmd->setDefaultKeySequence(QKeySequence::FindPrevious); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(invokeFindPrevious())); m_ui.findPreviousButton->setDefaultAction(cmd->action()); m_findNextSelectedAction = new QAction(tr("Find Next (Selected)"), this); - cmd = am->registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext); + cmd = Core::ActionManager::registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F3"))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_findNextSelectedAction, SIGNAL(triggered()), this, SLOT(findNextSelected())); m_findPreviousSelectedAction = new QAction(tr("Find Previous (Selected)"), this); - cmd = am->registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED, globalcontext); + cmd = Core::ActionManager::registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F3"))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_findPreviousSelectedAction, SIGNAL(triggered()), this, SLOT(findPreviousSelected())); m_replaceAction = new QAction(tr("Replace"), this); - cmd = am->registerAction(m_replaceAction, Constants::REPLACE, globalcontext); + cmd = Core::ActionManager::registerAction(m_replaceAction, Constants::REPLACE, globalcontext); cmd->setDefaultKeySequence(QKeySequence()); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_replaceAction, SIGNAL(triggered()), this, SLOT(invokeReplace())); @@ -204,21 +203,21 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_replaceNextAction = new QAction(tr("Replace && Find"), this); m_replaceNextAction->setIconText(tr("Replace && Find")); // work around bug in Qt that kills ampersands in tool button - cmd = am->registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext); + cmd = Core::ActionManager::registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+="))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_replaceNextAction, SIGNAL(triggered()), this, SLOT(invokeReplaceNext())); m_ui.replaceNextButton->setDefaultAction(cmd->action()); m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this); - cmd = am->registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext); + cmd = Core::ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext); // shortcut removed, clashes with Ctrl++ on many keyboard layouts //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+="))); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_replacePreviousAction, SIGNAL(triggered()), this, SLOT(invokeReplacePrevious())); m_replaceAllAction = new QAction(tr("Replace All"), this); - cmd = am->registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext); + cmd = Core::ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext); mfind->addAction(cmd, Constants::G_FIND_ACTIONS); connect(m_replaceAllAction, SIGNAL(triggered()), this, SLOT(invokeReplaceAll())); m_ui.replaceAllButton->setDefaultAction(cmd->action()); @@ -227,7 +226,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_caseSensitiveAction->setIcon(QIcon(QLatin1String(":/find/images/casesensitively.png"))); m_caseSensitiveAction->setCheckable(true); m_caseSensitiveAction->setChecked(false); - cmd = am->registerAction(m_caseSensitiveAction, Constants::CASE_SENSITIVE, globalcontext); + cmd = Core::ActionManager::registerAction(m_caseSensitiveAction, Constants::CASE_SENSITIVE, globalcontext); mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_caseSensitiveAction, SIGNAL(triggered(bool)), this, SLOT(setCaseSensitive(bool))); lineEditMenu->addAction(m_caseSensitiveAction); @@ -236,7 +235,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_wholeWordAction->setIcon(QIcon(QLatin1String(":/find/images/wholewords.png"))); m_wholeWordAction->setCheckable(true); m_wholeWordAction->setChecked(false); - cmd = am->registerAction(m_wholeWordAction, Constants::WHOLE_WORDS, globalcontext); + cmd = Core::ActionManager::registerAction(m_wholeWordAction, Constants::WHOLE_WORDS, globalcontext); mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_wholeWordAction, SIGNAL(triggered(bool)), this, SLOT(setWholeWord(bool))); lineEditMenu->addAction(m_wholeWordAction); @@ -245,7 +244,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_regularExpressionAction->setIcon(QIcon(QLatin1String(":/find/images/regexp.png"))); m_regularExpressionAction->setCheckable(true); m_regularExpressionAction->setChecked(false); - cmd = am->registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext); + cmd = Core::ActionManager::registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext); mfind->addAction(cmd, Constants::G_FIND_FLAGS); connect(m_regularExpressionAction, SIGNAL(triggered(bool)), this, SLOT(setRegularExpressions(bool))); lineEditMenu->addAction(m_regularExpressionAction); diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index 265b405f7d..f867d9782e 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -279,7 +279,7 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel) d->m_expandCollapseAction = new QAction(tr("Expand All"), this); d->m_expandCollapseAction->setCheckable(true); d->m_expandCollapseAction->setIcon(QIcon(QLatin1String(":/find/images/expand.png"))); - Core::Command *cmd = Core::ICore::actionManager()->registerAction( + Core::Command *cmd = Core::ActionManager::registerAction( d->m_expandCollapseAction, "Find.ExpandAll", Core::Context(Core::Constants::C_GLOBAL)); cmd->setAttribute(Core::Command::CA_UpdateText); diff --git a/src/plugins/genericprojectmanager/genericprojectplugin.cpp b/src/plugins/genericprojectmanager/genericprojectplugin.cpp index f9bbbdafe3..da87b4e91f 100644 --- a/src/plugins/genericprojectmanager/genericprojectplugin.cpp +++ b/src/plugins/genericprojectmanager/genericprojectplugin.cpp @@ -95,11 +95,10 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage addAutoReleasedObject(new GenericTargetFactory); const Core::Context projectContext(Constants::PROJECTCONTEXT); - Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mproject = - am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); m_editFilesAction = new QAction(tr("Edit Files..."), this); - Core::Command *command = am->registerAction(m_editFilesAction, Constants::EDITFILESACTION, projectContext); + Core::Command *command = Core::ActionManager::registerAction(m_editFilesAction, Constants::EDITFILESACTION, projectContext); command->setAttribute(Core::Command::CA_Hide); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES); connect(m_editFilesAction, SIGNAL(triggered()), this, SLOT(editFiles())); diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index 3b88a1b6f1..3705bee810 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -346,11 +346,10 @@ bool GerritPlugin::initialize(Core::ActionContainer *ac) { m_parameters->fromSettings(Core::ICore::instance()->settings()); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); QAction *openViewAction = new QAction(tr("Gerrit..."), this); Core::Command *command = - am->registerAction(openViewAction, Constants::GERRIT_OPEN_VIEW, + Core::ActionManager::registerAction(openViewAction, Constants::GERRIT_OPEN_VIEW, Core::Context(Core::Constants::C_GLOBAL)); connect(openViewAction, SIGNAL(triggered()), this, SLOT(openView())); ac->addAction(command); diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 74f409a9a0..f94496ae83 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -182,19 +182,18 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = { Git::Constants::C_GITSUBMITEDITOR }; -static Core::Command *createSeparator(Core::ActionManager *am, - const Core::Context &context, - const Core::Id &id, - QObject *parent) +static Core::Command *createSeparator(const Core::Context &context, + const Core::Id &id, + QObject *parent) { QAction *a = new QAction(parent); a->setSeparator(true); - return am->registerAction(a, id, context); + return Core::ActionManager::registerAction(a, id, context); } // Create a parameter action ParameterActionCommandPair - GitPlugin::createParameterAction(Core::ActionManager *am, Core::ActionContainer *ac, + GitPlugin::createParameterAction(Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, const Core::Id &id, const Core::Context &context, bool addToLocator) @@ -202,7 +201,7 @@ ParameterActionCommandPair Utils::ParameterAction *action = new Utils::ParameterAction(defaultText, parameterText, Utils::ParameterAction::EnabledWithParameter, this); - Core::Command *command = am->registerAction(action, id, context); + Core::Command *command = Core::ActionManager::registerAction(action, id, context); command->setAttribute(Core::Command::CA_UpdateText); ac->addAction(command); if (addToLocator) @@ -212,12 +211,12 @@ ParameterActionCommandPair // Create an action to act on a file with a slot. ParameterActionCommandPair - GitPlugin::createFileAction(Core::ActionManager *am, Core::ActionContainer *ac, + GitPlugin::createFileAction(Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, const Core::Id &id, const Core::Context &context, bool addToLocator, const char *pluginSlot) { - const ParameterActionCommandPair rc = createParameterAction(am, ac, defaultText, parameterText, id, context, addToLocator); + const ParameterActionCommandPair rc = createParameterAction(ac, defaultText, parameterText, id, context, addToLocator); m_fileActions.push_back(rc.first); connect(rc.first, SIGNAL(triggered()), this, pluginSlot); return rc; @@ -225,12 +224,12 @@ ParameterActionCommandPair // Create an action to act on a project with slot. ParameterActionCommandPair - GitPlugin::createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, + GitPlugin::createProjectAction(Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, const Core::Id &id, const Core::Context &context, bool addToLocator, const char *pluginSlot) { - const ParameterActionCommandPair rc = createParameterAction(am, ac, defaultText, parameterText, id, context, addToLocator); + const ParameterActionCommandPair rc = createParameterAction(ac, defaultText, parameterText, id, context, addToLocator); m_projectActions.push_back(rc.first); connect(rc.first, SIGNAL(triggered()), this, pluginSlot); return rc; @@ -238,12 +237,12 @@ ParameterActionCommandPair // Create an action to act on the repository ActionCommandPair - GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, + GitPlugin::createRepositoryAction(Core::ActionContainer *ac, const QString &text, const Core::Id &id, const Core::Context &context, bool addToLocator) { QAction *action = new QAction(text, this); - Core::Command *command = am->registerAction(action, id, context); + Core::Command *command = Core::ActionManager::registerAction(action, id, context); ac->addAction(command); m_repositoryActions.push_back(action); if (addToLocator) @@ -253,12 +252,12 @@ ActionCommandPair // Create an action to act on the repository with slot ActionCommandPair - GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, + GitPlugin::createRepositoryAction(Core::ActionContainer *ac, const QString &text, const Core::Id &id, const Core::Context &context, bool addToLocator, const char *pluginSlot) { - const ActionCommandPair rc = createRepositoryAction(am, ac, text, id, context, addToLocator); + const ActionCommandPair rc = createRepositoryAction(ac, text, id, context, addToLocator); connect(rc.first, SIGNAL(triggered()), this, pluginSlot); return rc; } @@ -266,13 +265,13 @@ ActionCommandPair // Action to act on the repository forwarded to a git client member function // taking the directory. Store the member function as data on the action. ActionCommandPair - GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, + GitPlugin::createRepositoryAction(Core::ActionContainer *ac, const QString &text, const Core::Id &id, const Core::Context &context, bool addToLocator, GitClientMemberFunc func) { // Set the member func as data and connect to generic slot - const ActionCommandPair rc = createRepositoryAction(am, ac, text, id, context, addToLocator); + const ActionCommandPair rc = createRepositoryAction(ac, text, id, context, addToLocator); rc.first->setData(qVariantFromValue(func)); connect(rc.first, SIGNAL(triggered()), this, SLOT(gitClientMemberFuncRepositoryAction())); return rc; @@ -313,68 +312,66 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) addAutoReleasedObject(m_commandLocator); //register actions - Core::ActionManager *actionManager = Core::ICore::actionManager(); - Core::ActionContainer *toolsContainer = - actionManager->actionContainer(Core::Constants::M_TOOLS); + Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); - Core::ActionContainer *gitContainer = actionManager->createMenu("Git"); + Core::ActionContainer *gitContainer = Core::ActionManager::createMenu("Git"); gitContainer->menu()->setTitle(tr("&Git")); toolsContainer->addMenu(gitContainer); m_menuAction = gitContainer->menu()->menuAction(); ParameterActionCommandPair parameterActionCommand - = createFileAction(actionManager, gitContainer, + = createFileAction(gitContainer, tr("Blame Current File"), tr("Blame for \"%1\""), Core::Id("Git.Blame"), globalcontext, true, SLOT(blameFile())); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+B") : tr("Alt+G,Alt+B"))); parameterActionCommand - = createFileAction(actionManager, gitContainer, + = createFileAction(gitContainer, tr("Diff Current File"), tr("Diff of \"%1\""), Core::Id("Git.Diff"), globalcontext, true, SLOT(diffCurrentFile())); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+D") : tr("Alt+G,Alt+D"))); parameterActionCommand - = createFileAction(actionManager, gitContainer, + = createFileAction(gitContainer, tr("Log Current File"), tr("Log of \"%1\""), Core::Id("Git.Log"), globalcontext, true, SLOT(logFile())); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+L") : tr("Alt+G,Alt+L"))); // ------ - gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.File"), this)); + gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.File"), this)); parameterActionCommand - = createFileAction(actionManager, gitContainer, + = createFileAction(gitContainer, tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"), Core::Id("Git.Stage"), globalcontext, true, SLOT(stageFile())); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+A") : tr("Alt+G,Alt+A"))); parameterActionCommand - = createFileAction(actionManager, gitContainer, + = createFileAction(gitContainer, tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"), Core::Id("Git.Unstage"), globalcontext, true, SLOT(unstageFile())); parameterActionCommand - = createFileAction(actionManager, gitContainer, + = createFileAction(gitContainer, tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""), Core::Id("Git.UndoUnstaged"), globalcontext, true, SLOT(undoUnstagedFileChanges())); parameterActionCommand - = createFileAction(actionManager, gitContainer, + = createFileAction(gitContainer, tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""), Core::Id("Git.Undo"), globalcontext, true, SLOT(undoFileChanges())); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+U") : tr("Alt+G,Alt+U"))); // ------------ - gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Project"), this)); + gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Project"), this)); parameterActionCommand - = createProjectAction(actionManager, gitContainer, + = createProjectAction(gitContainer, tr("Diff Current Project"), tr("Diff Project \"%1\""), Core::Id("Git.DiffProject"), globalcontext, true, @@ -382,84 +379,84 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+Shift+D") : tr("Alt+G,Alt+Shift+D"))); parameterActionCommand - = createProjectAction(actionManager, gitContainer, + = createProjectAction(gitContainer, tr("Log Project"), tr("Log Project \"%1\""), Core::Id("Git.LogProject"), globalcontext, true, SLOT(logProject())); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+K") : tr("Alt+G,Alt+K"))); parameterActionCommand - = createProjectAction(actionManager, gitContainer, + = createProjectAction(gitContainer, tr("Clean Project..."), tr("Clean Project \"%1\"..."), Core::Id("Git.CleanProject"), globalcontext, true, SLOT(cleanProject())); // -------------- - gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Repository"), this)); + gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Repository"), this)); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Diff"), Core::Id("Git.DiffRepository"), globalcontext, true, SLOT(diffRepository())); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Log"), Core::Id("Git.LogRepository"), globalcontext, true, &GitClient::graphLog); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Status"), Core::Id("Git.StatusRepository"), globalcontext, true, &GitClient::status); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Undo Uncommitted Changes..."), Core::Id("Git.UndoRepository"), globalcontext, false, SLOT(undoRepositoryChanges())); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Clean..."), Core::Id("Git.CleanRepository"), globalcontext, true, SLOT(cleanRepository())); m_createRepositoryAction = new QAction(tr("Create Repository..."), this); - Core::Command *createRepositoryCommand = actionManager->registerAction(m_createRepositoryAction, "Git.CreateRepository", globalcontext); + Core::Command *createRepositoryCommand = Core::ActionManager::registerAction(m_createRepositoryAction, "Git.CreateRepository", globalcontext); connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository())); gitContainer->addAction(createRepositoryCommand); // -------------- - gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Info"), this)); + gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Info"), this)); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Launch gitk"), Core::Id("Git.LaunchGitK"), globalcontext, true, &GitClient::launchGitK); m_repositoryBrowserAction - = createRepositoryAction(actionManager, gitContainer, + = createRepositoryAction(gitContainer, tr("Launch repository browser"), Core::Id("Git.LaunchRepositoryBrowser"), globalcontext, true, &GitClient::launchRepositoryBrowser).first; - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Branches..."), Core::Id("Git.BranchList"), globalcontext, true, SLOT(branchList())); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Remotes..."), Core::Id("Git.RemoteList"), globalcontext, false, SLOT(remoteList())); m_showAction = new QAction(tr("Show..."), this); - Core::Command *showCommitCommand = actionManager->registerAction(m_showAction, "Git.ShowCommit", globalcontext); + Core::Command *showCommitCommand = Core::ActionManager::registerAction(m_showAction, "Git.ShowCommit", globalcontext); connect(m_showAction, SIGNAL(triggered()), this, SLOT(showCommit())); gitContainer->addAction(showCommitCommand); // -------------- - gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.RarelyUsed"), this)); + gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.RarelyUsed"), this)); - Core::ActionContainer *patchMenu = actionManager->createMenu(Core::Id("Git.PatchMenu")); + Core::ActionContainer *patchMenu = Core::ActionManager::createMenu(Core::Id("Git.PatchMenu")); patchMenu->menu()->setTitle(tr("Patch")); gitContainer->addMenu(patchMenu); // Apply current file as patch is handled specially. parameterActionCommand = - createParameterAction(actionManager, patchMenu, + createParameterAction(patchMenu, tr("Apply from Editor"), tr("Apply \"%1\""), Core::Id("Git.ApplyCurrentFilePatch"), globalcontext, true); @@ -467,84 +464,84 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this, SLOT(applyCurrentFilePatch())); - createRepositoryAction(actionManager, patchMenu, + createRepositoryAction(patchMenu, tr("Apply from File..."), Core::Id("Git.ApplyPatch"), globalcontext, true, SLOT(promptApplyPatch())); - Core::ActionContainer *stashMenu = actionManager->createMenu(Core::Id("Git.StashMenu")); + Core::ActionContainer *stashMenu = Core::ActionManager::createMenu(Core::Id("Git.StashMenu")); stashMenu->menu()->setTitle(tr("Stash")); gitContainer->addMenu(stashMenu); - createRepositoryAction(actionManager, stashMenu, + createRepositoryAction(stashMenu, tr("Stashes..."), Core::Id("Git.StashList"), globalcontext, false, SLOT(stashList())); - stashMenu->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.StashMenuPush"), this)); + stashMenu->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.StashMenuPush"), this)); ActionCommandPair actionCommand = - createRepositoryAction(actionManager, stashMenu, + createRepositoryAction(stashMenu, tr("Stash"), Core::Id("Git.Stash"), globalcontext, true, SLOT(stash())); actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository.")); - actionCommand = createRepositoryAction(actionManager, stashMenu, + actionCommand = createRepositoryAction(stashMenu, tr("Take Snapshot..."), Core::Id("Git.StashSnapshot"), globalcontext, true, SLOT(stashSnapshot())); actionCommand.first->setToolTip(tr("Saves the current state of your work.")); - stashMenu->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.StashMenuPop"), this)); + stashMenu->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.StashMenuPop"), this)); - actionCommand = createRepositoryAction(actionManager, stashMenu, + actionCommand = createRepositoryAction(stashMenu, tr("Stash Pop"), Core::Id("Git.StashPop"), globalcontext, true, &GitClient::stashPop); actionCommand.first->setToolTip(tr("Restores changes saved to the stash list using \"Stash\".")); - Core::ActionContainer *subversionMenu = actionManager->createMenu(Core::Id("Git.Subversion")); + Core::ActionContainer *subversionMenu = Core::ActionManager::createMenu(Core::Id("Git.Subversion")); subversionMenu->menu()->setTitle(tr("Subversion")); gitContainer->addMenu(subversionMenu); - createRepositoryAction(actionManager, subversionMenu, + createRepositoryAction(subversionMenu, tr("Log"), Core::Id("Git.Subversion.Log"), globalcontext, false, &GitClient::subversionLog); - createRepositoryAction(actionManager, subversionMenu, + createRepositoryAction(subversionMenu, tr("Fetch"), Core::Id("Git.Subversion.Fetch"), globalcontext, false, &GitClient::synchronousSubversionFetch); - gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.PushPull"), this)); + gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.PushPull"), this)); - gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Global"), this)); + gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Global"), this)); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Fetch"), Core::Id("Git.Fetch"), globalcontext, true, SLOT(fetch())); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Pull"), Core::Id("Git.Pull"), globalcontext, true, SLOT(pull())); - actionCommand = createRepositoryAction(actionManager, gitContainer, + actionCommand = createRepositoryAction(gitContainer, tr("Push"), Core::Id("Git.Push"), globalcontext, true, SLOT(push())); - actionCommand = createRepositoryAction(actionManager, gitContainer, + actionCommand = createRepositoryAction(gitContainer, tr("Commit..."), Core::Id("Git.Commit"), globalcontext, true, SLOT(startCommit())); actionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+C") : tr("Alt+G,Alt+C"))); - createRepositoryAction(actionManager, gitContainer, + createRepositoryAction(gitContainer, tr("Amend Last Commit..."), Core::Id("Git.AmendCommit"), globalcontext, true, SLOT(startAmendCommit())); // Subversion in a submenu. - gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Subversion"), this)); + gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Subversion"), this)); if (0) { const QList<QAction*> snapShotActions = createSnapShotTestActions(); const int count = snapShotActions.size(); for (int i = 0; i < count; i++) { Core::Command *tCommand - = actionManager->registerAction(snapShotActions.at(i), + = Core::ActionManager::registerAction(snapShotActions.at(i), Core::Id(QLatin1String("Git.Snapshot.") + QString::number(i)), globalcontext); gitContainer->addAction(tCommand); @@ -554,18 +551,18 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) // Submit editor Core::Context submitContext(Constants::C_GITSUBMITEDITOR); m_submitCurrentAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); - Core::Command *command = actionManager->registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext); + Core::Command *command = Core::ActionManager::registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_submitCurrentAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); m_diffSelectedFilesAction = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); - command = actionManager->registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext); + command = Core::ActionManager::registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext); m_undoAction = new QAction(tr("&Undo"), this); - command = actionManager->registerAction(m_undoAction, Core::Constants::UNDO, submitContext); + command = Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, submitContext); m_redoAction = new QAction(tr("&Redo"), this); - command = actionManager->registerAction(m_redoAction, Core::Constants::REDO, submitContext); + command = Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, submitContext); Gerrit::Internal::GerritPlugin *gp = new Gerrit::Internal::GerritPlugin(this); diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 9ad5f2c344..f7d0703609 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -141,36 +141,36 @@ protected: private: inline ParameterActionCommandPair - createParameterAction(Core::ActionManager *am, Core::ActionContainer *ac, + createParameterAction(Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, const Core::Id &id, const Core::Context &context, bool addToLocator); inline ParameterActionCommandPair - createFileAction(Core::ActionManager *am, Core::ActionContainer *ac, + createFileAction(Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, const Core::Id &id, const Core::Context &context, bool addToLocator, const char *pluginSlot); inline ParameterActionCommandPair - createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, + createProjectAction(Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, const Core::Id &id, const Core::Context &context, bool addToLocator); inline ParameterActionCommandPair - createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, + createProjectAction(Core::ActionContainer *ac, const QString &defaultText, const QString ¶meterText, const Core::Id &id, const Core::Context &context, bool addToLocator, const char *pluginSlot); - inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, + inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac, const QString &text, const Core::Id &id, const Core::Context &context, bool addToLocator); - inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, + inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac, const QString &text, const Core::Id &id, const Core::Context &context, bool addToLocator, const char *pluginSlot); - inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, + inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac, const QString &text, const Core::Id &id, const Core::Context &context, bool addToLocator, GitClientMemberFunc); diff --git a/src/plugins/glsleditor/glsleditorplugin.cpp b/src/plugins/glsleditor/glsleditorplugin.cpp index cc1244b39d..856158a82a 100644 --- a/src/plugins/glsleditor/glsleditorplugin.cpp +++ b/src/plugins/glsleditor/glsleditorplugin.cpp @@ -107,14 +107,13 @@ GLSLEditorPlugin::~GLSLEditorPlugin() /*! Copied from cppplugin.cpp */ static inline -Core::Command *createSeparator(Core::ActionManager *am, - QObject *parent, +Core::Command *createSeparator(QObject *parent, Core::Context &context, const char *id) { QAction *separator = new QAction(parent); separator->setSeparator(true); - return am->registerAction(separator, Core::Id(id), context); + return Core::ActionManager::registerAction(separator, Core::Id(id), context); } bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) @@ -140,27 +139,26 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er | TextEditor::TextEditorActionHandler::UnCollapseAll); m_actionHandler->initializeActions(); - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *contextMenu = am->createMenu(GLSLEditor::Constants::M_CONTEXT); - Core::ActionContainer *glslToolsMenu = am->createMenu(Core::Id(Constants::M_TOOLS_GLSL)); + Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(GLSLEditor::Constants::M_CONTEXT); + Core::ActionContainer *glslToolsMenu = Core::ActionManager::createMenu(Core::Id(Constants::M_TOOLS_GLSL)); glslToolsMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide); QMenu *menu = glslToolsMenu->menu(); //: GLSL sub-menu in the Tools menu menu->setTitle(tr("GLSL")); - am->actionContainer(Core::Constants::M_TOOLS)->addMenu(glslToolsMenu); + Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(glslToolsMenu); Core::Command *cmd = 0; // Insert marker for "Refactoring" menu: Core::Context globalContext(Core::Constants::C_GLOBAL); - Core::Command *sep = createSeparator(am, this, globalContext, + Core::Command *sep = createSeparator(this, globalContext, Constants::SEPARATOR1); sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); contextMenu->addAction(sep); - contextMenu->addAction(createSeparator(am, this, globalContext, + contextMenu->addAction(createSeparator(this, globalContext, Constants::SEPARATOR2)); - cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); + cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); errorMessage->clear(); @@ -244,11 +242,11 @@ void GLSLEditorPlugin::initializeEditor(GLSLEditor::GLSLTextEditorWidget *editor TextEditor::TextEditorSettings::instance()->initializeEditor(editor); } -Core::Command *GLSLEditorPlugin::addToolAction(QAction *a, Core::ActionManager *am, +Core::Command *GLSLEditorPlugin::addToolAction(QAction *a, Core::Context &context, const Core::Id &id, Core::ActionContainer *c1, const QString &keySequence) { - Core::Command *command = am->registerAction(a, id, context); + Core::Command *command = Core::ActionManager::registerAction(a, id, context); if (!keySequence.isEmpty()) command->setDefaultKeySequence(QKeySequence(keySequence)); c1->addAction(command); diff --git a/src/plugins/glsleditor/glsleditorplugin.h b/src/plugins/glsleditor/glsleditorplugin.h index 37e892b472..fe549a3214 100644 --- a/src/plugins/glsleditor/glsleditorplugin.h +++ b/src/plugins/glsleditor/glsleditorplugin.h @@ -109,7 +109,7 @@ private: void parseGlslFile(const QString &fileName, InitFile *initFile) const; // FIXME: Unused? - Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const Core::Id &name, + Core::Command *addToolAction(QAction *a, Core::Context &context, const Core::Id &name, Core::ActionContainer *c1, const QString &keySequence); static GLSLEditorPlugin *m_instance; diff --git a/src/plugins/helloworld/helloworldplugin.cpp b/src/plugins/helloworld/helloworldplugin.cpp index 64fb34d1e0..7c3f175137 100644 --- a/src/plugins/helloworld/helloworldplugin.cpp +++ b/src/plugins/helloworld/helloworldplugin.cpp @@ -105,14 +105,13 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld())); // Register the action with the action manager - Core::ActionManager *actionManager = Core::ICore::actionManager(); Core::Command *command = - actionManager->registerAction( + Core::ActionManager::registerAction( helloWorldAction, "HelloWorld.HelloWorldAction", context); // Create our own menu to place in the Tools menu Core::ActionContainer *helloWorldMenu = - actionManager->createMenu("HelloWorld.HelloWorldMenu"); + Core::ActionManager::createMenu("HelloWorld.HelloWorldMenu"); QMenu *menu = helloWorldMenu->menu(); menu->setTitle(tr("&Hello World")); menu->setEnabled(true); @@ -122,7 +121,7 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe // Request the Tools menu and add the Hello World menu to it Core::ActionContainer *toolsMenu = - actionManager->actionContainer(Core::Constants::M_TOOLS); + Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); toolsMenu->addMenu(helloWorldMenu); // Add a mode with a push button based on BaseMode. Like the BaseView, diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 157b85669f..7f7453e9b8 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -207,13 +207,12 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) // Add Home, Previous and Next actions (used in the toolbar) QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")), tr("Home"), this); - Core::ActionManager *am = Core::ICore::actionManager(); - am->registerAction(action, "Help.Home", globalcontext); + Core::ActionManager::registerAction(action, "Help.Home", globalcontext); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(home())); action = new QAction(QIcon(QLatin1String(IMAGEPATH "previous.png")), tr("Previous Page"), this); - Core::Command *cmd = am->registerAction(action, Core::Id("Help.Previous"), modecontext); + Core::Command *cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Previous"), modecontext); cmd->setDefaultKeySequence(QKeySequence::Back); action->setEnabled(m_centralWidget->isBackwardAvailable()); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(backward())); @@ -222,7 +221,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) action = new QAction(QIcon(QLatin1String(IMAGEPATH "next.png")), tr("Next Page"), this); - cmd = am->registerAction(action, Core::Id("Help.Next"), modecontext); + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Next"), modecontext); cmd->setDefaultKeySequence(QKeySequence::Forward); action->setEnabled(m_centralWidget->isForwardAvailable()); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(forward())); @@ -231,7 +230,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) action = new QAction(QIcon(QLatin1String(IMAGEPATH "bookmark.png")), tr("Add Bookmark"), this); - cmd = am->registerAction(action, Core::Id("Help.AddBookmark"), + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.AddBookmark"), modecontext); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_M)); connect(action, SIGNAL(triggered()), this, SLOT(addBookmark())); @@ -239,81 +238,81 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) // Add Contents, Index, and Context menu items and a separator to the Help menu action = new QAction(QIcon::fromTheme(QLatin1String("help-contents")), tr(SB_CONTENTS), this); - cmd = am->registerAction(action, Core::Id("Help.Contents"), globalcontext); - am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Contents"), globalcontext); + Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); connect(action, SIGNAL(triggered()), this, SLOT(activateContents())); action = new QAction(tr(SB_INDEX), this); - cmd = am->registerAction(action, Core::Id("Help.Index"), globalcontext); - am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Index"), globalcontext); + Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); connect(action, SIGNAL(triggered()), this, SLOT(activateIndex())); action = new QAction(tr("Context Help"), this); - cmd = am->registerAction(action, Core::Id("Help.Context"), globalcontext); - am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Context"), globalcontext); + Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1)); connect(action, SIGNAL(triggered()), this, SLOT(activateContext())); #ifndef Q_OS_MAC action = new QAction(this); action->setSeparator(true); - cmd = am->registerAction(action, Core::Id("Help.Separator"), globalcontext); - am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator"), globalcontext); + Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); #endif action = new QAction(tr("Technical Support"), this); - cmd = am->registerAction(action, Core::Id("Help.TechSupport"), globalcontext); - am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.TechSupport"), globalcontext); + Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); connect(action, SIGNAL(triggered()), this, SLOT(slotOpenSupportPage())); action = new QAction(tr("Report Bug..."), this); - cmd = am->registerAction(action, Core::Id("Help.ReportBug"), globalcontext); - am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.ReportBug"), globalcontext); + Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); connect(action, SIGNAL(triggered()), this, SLOT(slotReportBug())); #ifndef Q_OS_MAC action = new QAction(this); action->setSeparator(true); - cmd = am->registerAction(action, Core::Id("Help.Separator2"), globalcontext); - am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); + cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator2"), globalcontext); + Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); #endif action = new QAction(this); - am->registerAction(action, Core::Constants::PRINT, modecontext); + Core::ActionManager::registerAction(action, Core::Constants::PRINT, modecontext); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(print())); action = new QAction(this); - cmd = am->registerAction(action, Core::Constants::COPY, modecontext); + cmd = Core::ActionManager::registerAction(action, Core::Constants::COPY, modecontext); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(copy())); action->setText(cmd->action()->text()); action->setIcon(cmd->action()->icon()); - if (Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED)) { + if (Core::ActionContainer *advancedMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED)) { // reuse TextEditor constants to avoid a second pair of menu actions action = new QAction(tr("Increase Font Size"), this); - cmd = am->registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE, + cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE, modecontext); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomIn())); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); action = new QAction(tr("Decrease Font Size"), this); - cmd = am->registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE, + cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE, modecontext); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomOut())); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); action = new QAction(tr("Reset Font Size"), this); - cmd = am->registerAction(action, TextEditor::Constants::RESET_FONT_SIZE, + cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::RESET_FONT_SIZE, modecontext); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom())); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); } - if (Core::ActionContainer *windowMenu = am->actionContainer(Core::Constants::M_WINDOW)) { + if (Core::ActionContainer *windowMenu = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW)) { // reuse EditorManager constants to avoid a second pair of menu actions action = new QAction(QApplication::translate("EditorManager", "Next Open Document in History"), this); - Core::Command *ctrlTab = am->registerAction(action, Core::Constants::GOTOPREVINHISTORY, + Core::Command *ctrlTab = Core::ActionManager::registerAction(action, Core::Constants::GOTOPREVINHISTORY, modecontext); // Goto Previous In History Action windowMenu->addAction(ctrlTab, Core::Constants::G_WINDOW_NAVIGATE); connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(), @@ -321,7 +320,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error) action = new QAction(QApplication::translate("EditorManager", "Previous Open Document in History"), this); - Core::Command *ctrlShiftTab = am->registerAction(action, Core::Constants::GOTONEXTINHISTORY, + Core::Command *ctrlShiftTab = Core::ActionManager::registerAction(action, Core::Constants::GOTONEXTINHISTORY, modecontext); // Goto Next In History Action windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE); connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(), @@ -429,7 +428,6 @@ ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown() void HelpPlugin::setupUi() { // side bar widgets and shortcuts - Core::ActionManager *am = Core::ICore::actionManager(); Core::Context modecontext(Constants::C_MODE_HELP); IndexWindow *indexWindow = new IndexWindow(); @@ -444,7 +442,7 @@ void HelpPlugin::setupUi() QMap<QString, Core::Command*> shortcutMap; QShortcut *shortcut = new QShortcut(m_splitter); shortcut->setWhatsThis(tr("Activate Index in Help mode")); - Core::Command* cmd = am->registerShortcut(shortcut, + Core::Command* cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.IndexShortcut"), modecontext); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); connect(shortcut, SIGNAL(activated()), this, SLOT(activateIndex())); @@ -458,7 +456,7 @@ void HelpPlugin::setupUi() shortcut = new QShortcut(m_splitter); shortcut->setWhatsThis(tr("Activate Contents in Help mode")); - cmd = am->registerShortcut(shortcut, Core::Id("Help.ContentsShortcut"), + cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.ContentsShortcut"), modecontext); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C)); connect(shortcut, SIGNAL(activated()), this, SLOT(activateContents())); @@ -472,7 +470,7 @@ void HelpPlugin::setupUi() shortcut = new QShortcut(m_splitter); shortcut->setWhatsThis(tr("Activate Search in Help mode")); - cmd = am->registerShortcut(shortcut, Core::Id("Help.SearchShortcut"), + cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.SearchShortcut"), modecontext); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Slash)); connect(shortcut, SIGNAL(activated()), this, SLOT(activateSearch())); @@ -489,7 +487,7 @@ void HelpPlugin::setupUi() shortcut = new QShortcut(m_splitter); shortcut->setWhatsThis(tr("Activate Bookmarks in Help mode")); - cmd = am->registerShortcut(shortcut, Core::Id("Help.BookmarkShortcut"), + cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.BookmarkShortcut"), modecontext); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B)); connect(shortcut, SIGNAL(activated()), this, SLOT(activateBookmarks())); @@ -501,7 +499,7 @@ void HelpPlugin::setupUi() shortcut = new QShortcut(m_splitter); shortcut->setWhatsThis(tr("Activate Open Pages in Help mode")); - cmd = am->registerShortcut(shortcut, Core::Id("Help.PagesShortcut"), + cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.PagesShortcut"), modecontext); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O)); connect(shortcut, SIGNAL(activated()), this, SLOT(activateOpenPages())); @@ -527,7 +525,7 @@ void HelpPlugin::setupUi() tr("Show Sidebar"), this); m_toggleSideBarAction->setCheckable(true); connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(showHideSidebar())); - cmd = am->registerAction(m_toggleSideBarAction, Core::Constants::TOGGLE_SIDEBAR, modecontext); + cmd = Core::ActionManager::registerAction(m_toggleSideBarAction, Core::Constants::TOGGLE_SIDEBAR, modecontext); } void HelpPlugin::resetFilter() @@ -621,7 +619,7 @@ void HelpPlugin::createRightPaneContextViewer() Core::ICore::addContextObject(icontext); QAction *copy = new QAction(this); - Core::Command *cmd = Core::ICore::actionManager()->registerAction(copy, + Core::Command *cmd = Core::ActionManager::registerAction(copy, Core::Constants::COPY, context); copy->setText(cmd->action()->text()); copy->setIcon(cmd->action()->icon()); @@ -637,23 +635,22 @@ void HelpPlugin::createRightPaneContextViewer() connect(m_helpViewerForSideBar, SIGNAL(backwardAvailable(bool)), back, SLOT(setEnabled(bool))); - Core::ActionManager *am = Core::ICore::actionManager(); - if (Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED)) { + if (Core::ActionContainer *advancedMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED)) { // reuse TextEditor constants to avoid a second pair of menu actions QAction *action = new QAction(tr("Increase Font Size"), this); - cmd = am->registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE, + cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE, context); connect(action, SIGNAL(triggered()), this, SLOT(scaleRightPaneUp())); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); action = new QAction(tr("Decrease Font Size"), this); - cmd = am->registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE, + cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE, context); connect(action, SIGNAL(triggered()), this, SLOT(scaleRightPaneDown())); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); action = new QAction(tr("Reset Font Size"), this); - cmd = am->registerAction(action, TextEditor::Constants::RESET_FONT_SIZE, + cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::RESET_FONT_SIZE, context); connect(action, SIGNAL(triggered()), this, SLOT(resetRightPaneScale())); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); @@ -1065,11 +1062,10 @@ Utils::StyledBar *HelpPlugin::createIconToolBar(bool external) tr("Add Bookmark"), toolBar); connect(bookmark, SIGNAL(triggered()), this, SLOT(addBookmark())); } else { - Core::ActionManager *am = Core::ICore::actionManager(); - home = am->command(Core::Id("Help.Home"))->action(); - back = am->command(Core::Id("Help.Previous"))->action(); - next = am->command(Core::Id("Help.Next"))->action(); - bookmark = am->command(Core::Id("Help.AddBookmark"))->action(); + home = Core::ActionManager::command(Core::Id("Help.Home"))->action(); + back = Core::ActionManager::command(Core::Id("Help.Previous"))->action(); + next = Core::ActionManager::command(Core::Id("Help.Next"))->action(); + bookmark = Core::ActionManager::command(Core::Id("Help.AddBookmark"))->action(); } setupNavigationMenus(back, next, toolBar); diff --git a/src/plugins/imageviewer/imagevieweractionhandler.cpp b/src/plugins/imageviewer/imagevieweractionhandler.cpp index 3dc7653ba7..b4489686aa 100644 --- a/src/plugins/imageviewer/imagevieweractionhandler.cpp +++ b/src/plugins/imageviewer/imagevieweractionhandler.cpp @@ -108,11 +108,9 @@ void ImageViewerActionHandler::registerNewAction(int actionId, const Core::Id &i const QString &title, const QKeySequence &key) { Core::Context context(Constants::IMAGEVIEWER_ID); - Core::ActionManager *actionManager = Core::ICore::actionManager(); QAction *action = new QAction(title, this); - Core::Command *command = actionManager->registerAction(action, id, context); - if (command) - command->setDefaultKeySequence(key); + Core::Command *command = Core::ActionManager::registerAction(action, id, context); + command->setDefaultKeySequence(key); connect(action, SIGNAL(triggered()), m_signalMapper, SLOT(map())); m_signalMapper->setMapping(action, actionId); } diff --git a/src/plugins/locator/locatorplugin.cpp b/src/plugins/locator/locatorplugin.cpp index 19e88423d0..e71353575f 100644 --- a/src/plugins/locator/locatorplugin.cpp +++ b/src/plugins/locator/locatorplugin.cpp @@ -117,14 +117,14 @@ bool LocatorPlugin::initialize(const QStringList &, QString *) addAutoReleasedObject(view); QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); - Core::Command *cmd = Core::ICore::actionManager() - ->registerAction(action, "QtCreator.Locate", Core::Context(Core::Constants::C_GLOBAL)); + Core::Command *cmd = Core::ActionManager::registerAction(action, "QtCreator.Locate", + Core::Context(Core::Constants::C_GLOBAL)); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); connect(action, SIGNAL(triggered()), this, SLOT(openLocator())); connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText())); updatePlaceholderText(cmd); - Core::ActionContainer *mtools = Core::ICore::actionManager()->actionContainer(Core::Constants::M_TOOLS); + Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); mtools->addAction(cmd); addObject(new LocatorManager(m_locatorWidget)); diff --git a/src/plugins/locator/locatorwidget.cpp b/src/plugins/locator/locatorwidget.cpp index 87146ed411..5725a13c23 100644 --- a/src/plugins/locator/locatorwidget.cpp +++ b/src/plugins/locator/locatorwidget.cpp @@ -316,7 +316,6 @@ void LocatorWidget::updateFilterList() m_filterMenu->clear(); // update actions and menu - Core::ActionManager *am = Core::ICore::actionManager(); QMap<QString, QAction *> actionCopy = m_filterActionMap; m_filterActionMap.clear(); // register new actions, update existent @@ -329,7 +328,7 @@ void LocatorWidget::updateFilterList() if (!actionCopy.contains(filter->id())) { // register new action action = new QAction(filter->displayName(), this); - cmd = am->registerAction(action, locatorId, + cmd = Core::ActionManager::registerAction(action, locatorId, Core::Context(Core::Constants::C_GLOBAL)); cmd->setAttribute(Core::Command::CA_UpdateText); connect(action, SIGNAL(triggered()), this, SLOT(filterSelected())); @@ -337,7 +336,7 @@ void LocatorWidget::updateFilterList() } else { action = actionCopy.take(filter->id()); action->setText(filter->displayName()); - cmd = am->command(locatorId); + cmd = Core::ActionManager::command(locatorId); } m_filterActionMap.insert(filter->id(), action); m_filterMenu->addAction(cmd->action()); @@ -345,7 +344,7 @@ void LocatorWidget::updateFilterList() // unregister actions that are deleted now foreach (const QString &id, actionCopy.keys()) { - am->unregisterAction(actionCopy.value(id), Core::Id(QLatin1String("Locator.") + id)); + Core::ActionManager::unregisterAction(actionCopy.value(id), Core::Id(QLatin1String("Locator.") + id)); } qDeleteAll(actionCopy); diff --git a/src/plugins/macros/actionmacrohandler.cpp b/src/plugins/macros/actionmacrohandler.cpp index f425b8fb85..765cab12bc 100644 --- a/src/plugins/macros/actionmacrohandler.cpp +++ b/src/plugins/macros/actionmacrohandler.cpp @@ -64,12 +64,11 @@ ActionMacroHandler::ActionMacroHandler(): connect(m_mapper, SIGNAL(mapped(QString)), this, SLOT(addActionEvent(QString))); - const Core::ActionManager *am = Core::ICore::actionManager(); - connect(am, SIGNAL(commandAdded(QString)), + connect(Core::ActionManager::instance(), SIGNAL(commandAdded(QString)), this, SLOT(addCommand(QString))); // Register all existing scriptable actions - QList<Core::Command *> commands = am->commands(); + QList<Core::Command *> commands = Core::ActionManager::commands(); foreach (Core::Command *command, commands) { if (command->isScriptable()) { QString id = command->id().toString(); @@ -85,9 +84,7 @@ bool ActionMacroHandler::canExecuteEvent(const MacroEvent ¯oEvent) bool ActionMacroHandler::executeEvent(const MacroEvent ¯oEvent) { - const Core::ActionManager *am = Core::ICore::actionManager(); - - QAction *action = am->command(Core::Id(macroEvent.value(ACTIONNAME).toString()))->action(); + QAction *action = Core::ActionManager::command(Core::Id(macroEvent.value(ACTIONNAME).toString()))->action(); if (!action) return false; @@ -100,8 +97,7 @@ void ActionMacroHandler::addActionEvent(const QString &id) if (!isRecording()) return; - const Core::ActionManager *am = Core::ICore::actionManager(); - const Core::Command *cmd = am->command(Core::Id(id)); + const Core::Command *cmd = Core::ActionManager::command(Core::Id(id)); if (cmd->isScriptable(cmd->context())) { MacroEvent e; e.setId(EVENTNAME); @@ -114,14 +110,13 @@ void ActionMacroHandler::registerCommand(const QString &id) { if (!m_commandIds.contains(id)) { m_commandIds.insert(id); - const Core::ActionManager *am = Core::ICore::actionManager(); - QAction* action = am->command(Core::Id(id))->action(); + QAction* action = Core::ActionManager::command(Core::Id(id))->action(); if (action) { connect(action, SIGNAL(triggered()), m_mapper, SLOT(map())); m_mapper->setMapping(action, id); return; } - QShortcut* shortcut = am->command(Core::Id(id))->shortcut(); + QShortcut* shortcut = Core::ActionManager::command(Core::Id(id))->shortcut(); if (shortcut) { connect(shortcut, SIGNAL(activated()), m_mapper, SLOT(map())); m_mapper->setMapping(shortcut, id); @@ -131,7 +126,6 @@ void ActionMacroHandler::registerCommand(const QString &id) void ActionMacroHandler::addCommand(const QString &id) { - const Core::ActionManager *am = Core::ICore::actionManager(); - if (am->command(Core::Id(id))->isScriptable()) + if (Core::ActionManager::command(Core::Id(id))->isScriptable()) registerCommand(id); } diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp index 3318277fa4..101305a461 100644 --- a/src/plugins/macros/macromanager.cpp +++ b/src/plugins/macros/macromanager.cpp @@ -163,11 +163,10 @@ void MacroManager::MacroManagerPrivate::addMacro(Macro *macro) { // Add sortcut Core::Context context(TextEditor::Constants::C_TEXTEDITOR); - Core::ActionManager *am = Core::ICore::actionManager(); QShortcut *shortcut = new QShortcut(Core::ICore::mainWindow()); shortcut->setWhatsThis(macro->description()); const Core::Id macroId(QLatin1String(Constants::PREFIX_MACRO) + macro->displayName()); - am->registerShortcut(shortcut, macroId, context); + Core::ActionManager::registerShortcut(shortcut, macroId, context); connect(shortcut, SIGNAL(activated()), mapper, SLOT(map())); mapper->setMapping(shortcut, macro->displayName()); @@ -180,8 +179,7 @@ void MacroManager::MacroManagerPrivate::removeMacro(const QString &name) if (!macros.contains(name)) return; // Remove shortcut - Core::ActionManager *am = Core::ICore::actionManager(); - am->unregisterShortcut(Core::Id(Constants::PREFIX_MACRO+name)); + Core::ActionManager::unregisterShortcut(Core::Id(Constants::PREFIX_MACRO+name)); // Remove macro from the map Macro *macro = macros.take(name); @@ -196,9 +194,7 @@ void MacroManager::MacroManagerPrivate::changeMacroDescription(Macro *macro, con macro->save(macro->fileName(), Core::ICore::mainWindow()); // Change shortcut what's this - Core::ActionManager *am = Core::ICore::actionManager(); - - Core::Command *command = am->command(Core::Id(Constants::PREFIX_MACRO+macro->displayName())); + Core::Command *command = Core::ActionManager::command(Core::Id(Constants::PREFIX_MACRO+macro->displayName())); if (command && command->shortcut()) command->shortcut()->setWhatsThis(description); } @@ -284,16 +280,15 @@ void MacroManager::startMacro() delete d->currentMacro; d->currentMacro = new Macro; - Core::ActionManager *am = Core::ICore::actionManager(); - am->command(Constants::START_MACRO)->action()->setEnabled(false); - am->command(Constants::END_MACRO)->action()->setEnabled(true); - am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); - am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(true); + Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false); foreach (IMacroHandler *handler, d->handlers) handler->startRecording(d->currentMacro); - QString endShortcut = am->command(Constants::END_MACRO)->defaultKeySequence().toString(); - QString executeShortcut = am->command(Constants::EXECUTE_LAST_MACRO)->defaultKeySequence().toString(); + QString endShortcut = Core::ActionManager::command(Constants::END_MACRO)->defaultKeySequence().toString(); + QString executeShortcut = Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->defaultKeySequence().toString(); QString help = tr("Macro mode. Type \"%1\" to stop recording and \"%2\" to play it") .arg(endShortcut).arg(executeShortcut); Core::EditorManager::instance()->showEditorStatusBar( @@ -306,11 +301,10 @@ void MacroManager::endMacro() { Core::EditorManager::instance()->hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER)); - Core::ActionManager *am = Core::ICore::actionManager(); - am->command(Constants::START_MACRO)->action()->setEnabled(true); - am->command(Constants::END_MACRO)->action()->setEnabled(false); - am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true); - am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); + Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(true); + Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true); + Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); foreach (IMacroHandler *handler, d->handlers) handler->endRecordingMacro(d->currentMacro); @@ -323,18 +317,17 @@ void MacroManager::executeLastMacro() return; // make sure the macro doesn't accidentally invoke a macro action - Core::ActionManager *am = Core::ICore::actionManager(); - am->command(Constants::START_MACRO)->action()->setEnabled(false); - am->command(Constants::END_MACRO)->action()->setEnabled(false); - am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); - am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false); d->executeMacro(d->currentMacro); - am->command(Constants::START_MACRO)->action()->setEnabled(true); - am->command(Constants::END_MACRO)->action()->setEnabled(false); - am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true); - am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); + Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(true); + Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false); + Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true); + Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); } bool MacroManager::executeMacro(const QString &name) @@ -352,8 +345,7 @@ bool MacroManager::executeMacro(const QString &name) delete d->currentMacro; d->currentMacro = macro; - Core::ActionManager *am = Core::ICore::actionManager(); - am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); + Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); return true; } diff --git a/src/plugins/macros/macrooptionswidget.cpp b/src/plugins/macros/macrooptionswidget.cpp index 8fb6d3e286..2b6ceb6fbf 100644 --- a/src/plugins/macros/macrooptionswidget.cpp +++ b/src/plugins/macros/macrooptionswidget.cpp @@ -102,8 +102,6 @@ void MacroOptionsWidget::initialize() void MacroOptionsWidget::createTable() { QDir dir(MacroManager::instance()->macrosDirectory()); - Core::ActionManager *am = Core::ICore::actionManager(); - QMapIterator<QString, Macro *> it(MacroManager::instance()->macros()); while (it.hasNext()) { it.next(); @@ -115,7 +113,8 @@ void MacroOptionsWidget::createTable() macroItem->setData(0, NAME_ROLE, it.value()->displayName()); macroItem->setData(0, WRITE_ROLE, it.value()->isWritable()); - Core::Command *command = am->command(Core::Id(Constants::PREFIX_MACRO+it.value()->displayName())); + Core::Command *command = + Core::ActionManager::command(Core::Id(Constants::PREFIX_MACRO+it.value()->displayName())); if (command && command->shortcut()) macroItem->setText(2, command->shortcut()->key().toString()); } diff --git a/src/plugins/macros/macrosplugin.cpp b/src/plugins/macros/macrosplugin.cpp index 85d9ffa9ac..297ddd23ba 100644 --- a/src/plugins/macros/macrosplugin.cpp +++ b/src/plugins/macros/macrosplugin.cpp @@ -72,42 +72,40 @@ bool MacrosPlugin::initialize(const QStringList &arguments, QString *errorMessag addAutoReleasedObject(new MacroOptionsPage); addAutoReleasedObject(new MacroLocatorFilter); - Core::ActionManager *am = Core::ICore::actionManager(); - Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context textContext(TextEditor::Constants::C_TEXTEDITOR); m_macroManager = new MacroManager(this); // Menus - Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); - Core::ActionContainer *mmacrotools = am->createMenu(Constants::M_TOOLS_MACRO); + Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); + Core::ActionContainer *mmacrotools = Core::ActionManager::createMenu(Constants::M_TOOLS_MACRO); QMenu *menu = mmacrotools->menu(); menu->setTitle(tr("&Macros")); menu->setEnabled(true); mtools->addMenu(mmacrotools); QAction *startMacro = new QAction(tr("Record Macro"), this); - Core::Command *command = am->registerAction(startMacro, Constants::START_MACRO, textContext); + Core::Command *command = Core::ActionManager::registerAction(startMacro, Constants::START_MACRO, textContext); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+(") : tr("Alt+("))); mmacrotools->addAction(command); connect(startMacro, SIGNAL(triggered()), m_macroManager, SLOT(startMacro())); QAction *endMacro = new QAction(tr("Stop Recording Macro"), this); endMacro->setEnabled(false); - command = am->registerAction(endMacro, Constants::END_MACRO, globalcontext); + command = Core::ActionManager::registerAction(endMacro, Constants::END_MACRO, globalcontext); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+)") : tr("Alt+)"))); mmacrotools->addAction(command); connect(endMacro, SIGNAL(triggered()), m_macroManager, SLOT(endMacro())); QAction *executeLastMacro = new QAction(tr("Play Last Macro"), this); - command = am->registerAction(executeLastMacro, Constants::EXECUTE_LAST_MACRO, textContext); + command = Core::ActionManager::registerAction(executeLastMacro, Constants::EXECUTE_LAST_MACRO, textContext); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+R") : tr("Alt+R"))); mmacrotools->addAction(command); connect(executeLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(executeLastMacro())); QAction *saveLastMacro = new QAction(tr("Save Last Macro"), this); saveLastMacro->setEnabled(false); - command = am->registerAction(saveLastMacro, Constants::SAVE_LAST_MACRO, textContext); + command = Core::ActionManager::registerAction(saveLastMacro, Constants::SAVE_LAST_MACRO, textContext); mmacrotools->addAction(command); connect(saveLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(saveLastMacro())); diff --git a/src/plugins/macros/texteditormacrohandler.cpp b/src/plugins/macros/texteditormacrohandler.cpp index 74327b090e..a7229e4711 100644 --- a/src/plugins/macros/texteditormacrohandler.cpp +++ b/src/plugins/macros/texteditormacrohandler.cpp @@ -78,8 +78,7 @@ void TextEditorMacroHandler::startRecording(Macros::Macro *macro) m_currentEditor->widget()->installEventFilter(this); // Block completion - Core::ActionManager *am = Core::ICore::actionManager(); - am->command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(true); + Core::ActionManager::command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(true); } void TextEditorMacroHandler::endRecordingMacro(Macros::Macro *macro) @@ -89,8 +88,7 @@ void TextEditorMacroHandler::endRecordingMacro(Macros::Macro *macro) IMacroHandler::endRecordingMacro(macro); // Unblock completion - Core::ActionManager *am = Core::ICore::actionManager(); - am->command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(false); + Core::ActionManager::command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(false); } bool TextEditorMacroHandler::canExecuteEvent(const MacroEvent ¯oEvent) diff --git a/src/plugins/madde/maemoqemumanager.cpp b/src/plugins/madde/maemoqemumanager.cpp index 49d2ee10eb..4911de3c60 100644 --- a/src/plugins/madde/maemoqemumanager.cpp +++ b/src/plugins/madde/maemoqemumanager.cpp @@ -97,8 +97,7 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent) m_qemuAction->setToolTip(tr("Start MeeGo Emulator")); connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime())); - Core::ActionManager *actionManager = Core::ICore::actionManager(); - Core::Command *qemuCommand = actionManager->registerAction(m_qemuAction, + Core::Command *qemuCommand = Core::ActionManager::registerAction(m_qemuAction, "MaemoEmulator", Core::Context(Core::Constants::C_GLOBAL)); qemuCommand->setAttribute(Core::Command::CA_UpdateText); qemuCommand->setAttribute(Core::Command::CA_UpdateIcon); diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp index e93adb099f..2ab480c9cb 100644 --- a/src/plugins/mercurial/mercurialplugin.cpp +++ b/src/plugins/mercurial/mercurialplugin.cpp @@ -153,8 +153,6 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString * m_client = new MercurialClient(&mercurialSettings); initializeVcs(new MercurialControl(m_client)); - actionManager = Core::ICore::actionManager(); - optionsPage = new OptionsPage(); addAutoReleasedObject(optionsPage); mercurialSettings.readSettings(core->settings()); @@ -199,7 +197,7 @@ void MercurialPlugin::createMenu() Core::Context context(Core::Constants::C_GLOBAL); // Create menu item for Mercurial - mercurialContainer = actionManager->createMenu(Core::Id("Mercurial.MercurialMenu")); + mercurialContainer = Core::ActionManager::createMenu(Core::Id("Mercurial.MercurialMenu")); QMenu *menu = mercurialContainer->menu(); menu->setTitle(tr("Mercurial")); @@ -214,7 +212,7 @@ void MercurialPlugin::createMenu() createLessUsedActions(context); // Request the Tools menu and add the Mercurial menu to it - Core::ActionContainer *toolsMenu = actionManager->actionContainer(Core::Id(Core::Constants::M_TOOLS)); + Core::ActionContainer *toolsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_TOOLS)); toolsMenu->addMenu(mercurialContainer); m_menuAction = mercurialContainer->menu()->menuAction(); } @@ -224,14 +222,14 @@ void MercurialPlugin::createFileActions(const Core::Context &context) Core::Command *command; annotateFile = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this); - command = actionManager->registerAction(annotateFile, Core::Id(Constants::ANNOTATE), context); + command = Core::ActionManager::registerAction(annotateFile, Core::Id(Constants::ANNOTATE), context); command->setAttribute(Core::Command::CA_UpdateText); connect(annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); diffFile = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this); - command = actionManager->registerAction(diffFile, Core::Id(Constants::DIFF), context); + command = Core::ActionManager::registerAction(diffFile, Core::Id(Constants::DIFF), context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+D") : tr("Alt+H,Alt+D"))); connect(diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); @@ -239,7 +237,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context) m_commandLocator->appendCommand(command); logFile = new ParameterAction(tr("Log Current File"), tr("Log \"%1\""), ParameterAction::EnabledWithParameter, this); - command = actionManager->registerAction(logFile, Core::Id(Constants::LOG), context); + command = Core::ActionManager::registerAction(logFile, Core::Id(Constants::LOG), context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+L") : tr("Alt+H,Alt+L"))); connect(logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile())); @@ -247,7 +245,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context) m_commandLocator->appendCommand(command); statusFile = new ParameterAction(tr("Status Current File"), tr("Status \"%1\""), ParameterAction::EnabledWithParameter, this); - command = actionManager->registerAction(statusFile, Core::Id(Constants::STATUS), context); + command = Core::ActionManager::registerAction(statusFile, Core::Id(Constants::STATUS), context); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+S") : tr("Alt+H,Alt+S"))); connect(statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile())); @@ -257,21 +255,21 @@ void MercurialPlugin::createFileActions(const Core::Context &context) createSeparator(context, Core::Id("Mercurial.FileDirSeperator1")); m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this); - command = actionManager->registerAction(m_addAction, Core::Id(Constants::ADD), context); + command = Core::ActionManager::registerAction(m_addAction, Core::Id(Constants::ADD), context); command->setAttribute(Core::Command::CA_UpdateText); connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this); - command = actionManager->registerAction(m_deleteAction, Core::Id(Constants::DELETE), context); + command = Core::ActionManager::registerAction(m_deleteAction, Core::Id(Constants::DELETE), context); command->setAttribute(Core::Command::CA_UpdateText); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); revertFile = new ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this); - command = actionManager->registerAction(revertFile, Core::Id(Constants::REVERT), context); + command = Core::ActionManager::registerAction(revertFile, Core::Id(Constants::REVERT), context); command->setAttribute(Core::Command::CA_UpdateText); connect(revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); mercurialContainer->addAction(command); @@ -332,28 +330,28 @@ void MercurialPlugin::createDirectoryActions(const Core::Context &context) action = new QAction(tr("Diff"), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::DIFFMULTI), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::DIFFMULTI), context); connect(action, SIGNAL(triggered()), this, SLOT(diffRepository())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Log"), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::LOGMULTI), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::LOGMULTI), context); connect(action, SIGNAL(triggered()), this, SLOT(logRepository())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Revert..."), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::REVERTMULTI), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::REVERTMULTI), context); connect(action, SIGNAL(triggered()), this, SLOT(revertMulti())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Status"), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::STATUSMULTI), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::STATUSMULTI), context); connect(action, SIGNAL(triggered()), this, SLOT(statusMulti())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); @@ -396,56 +394,56 @@ void MercurialPlugin::createRepositoryActions(const Core::Context &context) { QAction *action = new QAction(tr("Pull..."), this); m_repositoryActionList.append(action); - Core::Command *command = actionManager->registerAction(action, Core::Id(Constants::PULL), context); + Core::Command *command = Core::ActionManager::registerAction(action, Core::Id(Constants::PULL), context); connect(action, SIGNAL(triggered()), this, SLOT(pull())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Push..."), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::PUSH), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::PUSH), context); connect(action, SIGNAL(triggered()), this, SLOT(push())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Update..."), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::UPDATE), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::UPDATE), context); connect(action, SIGNAL(triggered()), this, SLOT(update())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Import..."), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::IMPORT), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::IMPORT), context); connect(action, SIGNAL(triggered()), this, SLOT(import())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Incoming..."), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::INCOMING), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::INCOMING), context); connect(action, SIGNAL(triggered()), this, SLOT(incoming())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Outgoing..."), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::OUTGOING), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::OUTGOING), context); connect(action, SIGNAL(triggered()), this, SLOT(outgoing())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); action = new QAction(tr("Commit..."), this); m_repositoryActionList.append(action); - command = actionManager->registerAction(action, Core::Id(Constants::COMMIT), context); + command = Core::ActionManager::registerAction(action, Core::Id(Constants::COMMIT), context); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+C") : tr("Alt+H,Alt+C"))); connect(action, SIGNAL(triggered()), this, SLOT(commit())); mercurialContainer->addAction(command); m_commandLocator->appendCommand(command); m_createRepositoryAction = new QAction(tr("Create Repository..."), this); - command = actionManager->registerAction(m_createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context); + command = Core::ActionManager::registerAction(m_createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context); connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository())); mercurialContainer->addAction(command); } @@ -527,18 +525,18 @@ void MercurialPlugin::createSubmitEditorActions() Core::Command *command; editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); - command = actionManager->registerAction(editorCommit, Core::Id(Constants::COMMIT), context); + command = Core::ActionManager::registerAction(editorCommit, Core::Id(Constants::COMMIT), context); command->setAttribute(Core::Command::CA_UpdateText); connect(editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor())); editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); - command = actionManager->registerAction(editorDiff, Core::Id(Constants::DIFFEDITOR), context); + command = Core::ActionManager::registerAction(editorDiff, Core::Id(Constants::DIFFEDITOR), context); editorUndo = new QAction(tr("&Undo"), this); - command = actionManager->registerAction(editorUndo, Core::Id(Core::Constants::UNDO), context); + command = Core::ActionManager::registerAction(editorUndo, Core::Id(Core::Constants::UNDO), context); editorRedo = new QAction(tr("&Redo"), this); - command = actionManager->registerAction(editorRedo, Core::Id(Core::Constants::REDO), context); + command = Core::ActionManager::registerAction(editorRedo, Core::Id(Core::Constants::REDO), context); } void MercurialPlugin::commit() @@ -677,7 +675,7 @@ void MercurialPlugin::createRepositoryManagementActions(const Core::Context &con return; // QAction *action = new QAction(tr("Branch"), this); // actionList.append(action); - // Core::Command *command = actionManager->registerAction(action, Constants::BRANCH, context); + // Core::Command *command = Core::ActionManager::registerAction(action, Constants::BRANCH, context); // // connect(action, SIGNAL(triggered()), this, SLOT(branch())); // mercurialContainer->addAction(command); } @@ -693,7 +691,7 @@ void MercurialPlugin::createSeparator(const Core::Context &context, const Core:: { QAction *action = new QAction(this); action->setSeparator(true); - mercurialContainer->addAction(actionManager->registerAction(action, id, context)); + mercurialContainer->addAction(Core::ActionManager::registerAction(action, id, context)); } void MercurialPlugin::updateActions(VcsBasePlugin::ActionState as) diff --git a/src/plugins/mercurial/mercurialplugin.h b/src/plugins/mercurial/mercurialplugin.h index 17596be5f3..bb476ee4df 100644 --- a/src/plugins/mercurial/mercurialplugin.h +++ b/src/plugins/mercurial/mercurialplugin.h @@ -145,7 +145,6 @@ private: Core::ICore *core; Locator::CommandLocator *m_commandLocator; - Core::ActionManager *actionManager; Core::ActionContainer *mercurialContainer; QList<QAction *> m_repositoryActionList; diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 14bd8feb33..137083780b 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -221,13 +221,12 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = { }; static inline Core::Command *createSeparator(QObject *parent, - Core::ActionManager *ami, const char *id, const Core::Context &globalcontext) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); - return ami->registerAction(tmpaction, id, globalcontext); + return Core::ActionManager::registerAction(tmpaction, id, globalcontext); } bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage) @@ -258,14 +257,11 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er m_commandLocator = new Locator::CommandLocator(QLatin1String("Perforce"), prefix, prefix); addAutoReleasedObject(m_commandLocator); - //register actions - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *mtools = - am->actionContainer(Core::Constants::M_TOOLS); + Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *mperforce = - am->createMenu(Core::Id(CMD_ID_PERFORCE_MENU)); + Core::ActionManager::createMenu(Core::Id(CMD_ID_PERFORCE_MENU)); mperforce->menu()->setTitle(tr("&Perforce")); mtools->addMenu(mperforce); m_menuAction = mperforce->menu()->menuAction(); @@ -276,7 +272,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er Core::Command *command; m_diffFileAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, globalcontext); + command = Core::ActionManager::registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(tr("Diff Current File")); connect(m_diffFileAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); @@ -284,7 +280,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er m_commandLocator->appendCommand(command); m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext); + command = Core::ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(tr("Annotate Current File")); connect(m_annotateCurrentAction, SIGNAL(triggered()), this, SLOT(annotateCurrentFile())); @@ -292,7 +288,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er m_commandLocator->appendCommand(command); m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext); + command = Core::ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+F") : tr("Alt+P,Alt+F"))); command->setDescription(tr("Filelog Current File")); @@ -300,10 +296,10 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er mperforce->addAction(command); m_commandLocator->appendCommand(command); - mperforce->addAction(createSeparator(this, am, "Perforce.Sep.Edit", globalcontext)); + mperforce->addAction(createSeparator(this, "Perforce.Sep.Edit", globalcontext)); m_editAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_editAction, CMD_ID_EDIT, globalcontext); + command = Core::ActionManager::registerAction(m_editAction, CMD_ID_EDIT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+E") : tr("Alt+P,Alt+E"))); command->setDescription(tr("Edit File")); @@ -312,7 +308,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er m_commandLocator->appendCommand(command); m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_addAction, CMD_ID_ADD, globalcontext); + command = Core::ActionManager::registerAction(m_addAction, CMD_ID_ADD, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+A") : tr("Alt+P,Alt+A"))); command->setDescription(tr("Add File")); @@ -321,7 +317,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er m_commandLocator->appendCommand(command); m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext); + command = Core::ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(tr("Delete File")); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); @@ -329,7 +325,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er m_commandLocator->appendCommand(command); m_revertFileAction = new Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_revertFileAction, CMD_ID_REVERT, globalcontext); + command = Core::ActionManager::registerAction(m_revertFileAction, CMD_ID_REVERT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+R") : tr("Alt+P,Alt+R"))); command->setDescription(tr("Revert File")); @@ -337,11 +333,11 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er mperforce->addAction(command); m_commandLocator->appendCommand(command); - mperforce->addAction(createSeparator(this, am, "Perforce.Sep.Project", globalcontext)); + mperforce->addAction(createSeparator(this, "Perforce.Sep.Project", globalcontext)); const QString diffProjectDefaultText = tr("Diff Current Project/Session"); m_diffProjectAction = new Utils::ParameterAction(diffProjectDefaultText, tr("Diff Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = am->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext); + command = Core::ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+D") : tr("Alt+P,Alt+D"))); command->setDescription(diffProjectDefaultText); @@ -350,14 +346,14 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er m_commandLocator->appendCommand(command); m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); + command = Core::ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject())); mperforce->addAction(command); m_commandLocator->appendCommand(command); m_submitProjectAction = new Utils::ParameterAction(tr("Submit Project"), tr("Submit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_submitProjectAction, CMD_ID_SUBMIT, globalcontext); + command = Core::ActionManager::registerAction(m_submitProjectAction, CMD_ID_SUBMIT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+S") : tr("Alt+P,Alt+S"))); connect(m_submitProjectAction, SIGNAL(triggered()), this, SLOT(startSubmitProject())); @@ -366,7 +362,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er const QString updateProjectDefaultText = tr("Update Current Project"); m_updateProjectAction = new Utils::ParameterAction(updateProjectDefaultText, tr("Update Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = am->registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, globalcontext); + command = Core::ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, globalcontext); command->setDescription(updateProjectDefaultText); command->setAttribute(Core::Command::CA_UpdateText); connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateCurrentProject())); @@ -374,82 +370,82 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er m_commandLocator->appendCommand(command); m_revertUnchangedAction = new Utils::ParameterAction(tr("Revert Unchanged"), tr("Revert Unchanged Files of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, globalcontext); + command = Core::ActionManager::registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_revertUnchangedAction, SIGNAL(triggered()), this, SLOT(revertUnchangedCurrentProject())); mperforce->addAction(command); m_commandLocator->appendCommand(command); m_revertProjectAction = new Utils::ParameterAction(tr("Revert Project"), tr("Revert Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = am->registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, globalcontext); + command = Core::ActionManager::registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_revertProjectAction, SIGNAL(triggered()), this, SLOT(revertCurrentProject())); mperforce->addAction(command); m_commandLocator->appendCommand(command); - mperforce->addAction(createSeparator(this, am, "Perforce.Sep.Repository", globalcontext)); + mperforce->addAction(createSeparator(this, "Perforce.Sep.Repository", globalcontext)); m_diffAllAction = new QAction(tr("Diff Opened Files"), this); - command = am->registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, globalcontext); + command = Core::ActionManager::registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, globalcontext); connect(m_diffAllAction, SIGNAL(triggered()), this, SLOT(diffAllOpened())); mperforce->addAction(command); m_commandLocator->appendCommand(command); m_openedAction = new QAction(tr("Opened"), this); - command = am->registerAction(m_openedAction, CMD_ID_OPENED, globalcontext); + command = Core::ActionManager::registerAction(m_openedAction, CMD_ID_OPENED, globalcontext); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+O") : tr("Alt+P,Alt+O"))); connect(m_openedAction, SIGNAL(triggered()), this, SLOT(printOpenedFileList())); mperforce->addAction(command); m_commandLocator->appendCommand(command); m_logRepositoryAction = new QAction(tr("Repository Log"), this); - command = am->registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); + command = Core::ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository())); mperforce->addAction(command); m_commandLocator->appendCommand(command); m_pendingAction = new QAction(tr("Pending Changes..."), this); - command = am->registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, globalcontext); + command = Core::ActionManager::registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, globalcontext); connect(m_pendingAction, SIGNAL(triggered()), this, SLOT(printPendingChanges())); mperforce->addAction(command); m_commandLocator->appendCommand(command); m_updateAllAction = new QAction(tr("Update All"), this); - command = am->registerAction(m_updateAllAction, CMD_ID_UPDATEALL, globalcontext); + command = Core::ActionManager::registerAction(m_updateAllAction, CMD_ID_UPDATEALL, globalcontext); connect(m_updateAllAction, SIGNAL(triggered()), this, SLOT(updateAll())); mperforce->addAction(command); m_commandLocator->appendCommand(command); - mperforce->addAction(createSeparator(this, am, "Perforce.Sep.Dialogs", globalcontext)); + mperforce->addAction(createSeparator(this, "Perforce.Sep.Dialogs", globalcontext)); m_describeAction = new QAction(tr("Describe..."), this); - command = am->registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext); + command = Core::ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext); connect(m_describeAction, SIGNAL(triggered()), this, SLOT(describeChange())); mperforce->addAction(command); m_annotateAction = new QAction(tr("Annotate..."), this); - command = am->registerAction(m_annotateAction, CMD_ID_ANNOTATE, globalcontext); + command = Core::ActionManager::registerAction(m_annotateAction, CMD_ID_ANNOTATE, globalcontext); connect(m_annotateAction, SIGNAL(triggered()), this, SLOT(annotate())); mperforce->addAction(command); m_filelogAction = new QAction(tr("Filelog..."), this); - command = am->registerAction(m_filelogAction, CMD_ID_FILELOG, globalcontext); + command = Core::ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, globalcontext); connect(m_filelogAction, SIGNAL(triggered()), this, SLOT(filelog())); mperforce->addAction(command); m_submitCurrentLogAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Submit"), this); - command = am->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, perforcesubmitcontext); + command = Core::ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, perforcesubmitcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); m_diffSelectedFiles = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); - command = am->registerAction(m_diffSelectedFiles, Constants::DIFF_SELECTED, perforcesubmitcontext); + command = Core::ActionManager::registerAction(m_diffSelectedFiles, Constants::DIFF_SELECTED, perforcesubmitcontext); m_undoAction = new QAction(tr("&Undo"), this); - command = am->registerAction(m_undoAction, Core::Constants::UNDO, perforcesubmitcontext); + command = Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, perforcesubmitcontext); m_redoAction = new QAction(tr("&Redo"), this); - command = am->registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext); + command = Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext); return true; } diff --git a/src/plugins/projectexplorer/appoutputpane.cpp b/src/plugins/projectexplorer/appoutputpane.cpp index 77243d5c53..5ac9a7a3f4 100644 --- a/src/plugins/projectexplorer/appoutputpane.cpp +++ b/src/plugins/projectexplorer/appoutputpane.cpp @@ -133,7 +133,6 @@ AppOutputPane::AppOutputPane() : this, SLOT(reRunRunControl())); // Stop - Core::ActionManager *am = Core::ICore::actionManager(); Core::Context globalcontext(Core::Constants::C_GLOBAL); QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); @@ -142,7 +141,7 @@ AppOutputPane::AppOutputPane() : m_stopAction->setToolTip(tr("Stop")); m_stopAction->setEnabled(false); - Core::Command *cmd = am->registerAction(m_stopAction, Constants::STOP, globalcontext); + Core::Command *cmd = Core::ActionManager::registerAction(m_stopAction, Constants::STOP, globalcontext); m_stopButton->setDefaultAction(cmd->action()); m_stopButton->setAutoRaise(true); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 2315b21892..1efaa4f6e8 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -340,7 +340,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_taskHub = new TaskHub; addAutoReleasedObject(d->m_taskHub); - Core::ActionManager *am = Core::ICore::actionManager(); connect(Core::ICore::instance(), SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards())); d->m_welcomePage = new ProjectWelcomePage; @@ -429,15 +428,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // context menus Core::ActionContainer *msessionContextMenu = - am->createMenu(Constants::M_SESSIONCONTEXT); + Core::ActionManager::createMenu(Constants::M_SESSIONCONTEXT); Core::ActionContainer *mprojectContextMenu = - am->createMenu(Constants::M_PROJECTCONTEXT); + Core::ActionManager::createMenu(Constants::M_PROJECTCONTEXT); Core::ActionContainer *msubProjectContextMenu = - am->createMenu(Constants::M_SUBPROJECTCONTEXT); + Core::ActionManager::createMenu(Constants::M_SUBPROJECTCONTEXT); Core::ActionContainer *mfolderContextMenu = - am->createMenu(Constants::M_FOLDERCONTEXT); + Core::ActionManager::createMenu(Constants::M_FOLDERCONTEXT); Core::ActionContainer *mfileContextMenu = - am->createMenu(Constants::M_FILECONTEXT); + Core::ActionManager::createMenu(Constants::M_FILECONTEXT); d->m_sessionContextMenu = msessionContextMenu->menu(); d->m_projectMenu = mprojectContextMenu->menu(); @@ -446,24 +445,24 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_fileMenu = mfileContextMenu->menu(); Core::ActionContainer *mfile = - am->actionContainer(Core::Constants::M_FILE); + Core::ActionManager::actionContainer(Core::Constants::M_FILE); Core::ActionContainer *menubar = - am->actionContainer(Core::Constants::MENU_BAR); + Core::ActionManager::actionContainer(Core::Constants::MENU_BAR); // build menu Core::ActionContainer *mbuild = - am->createMenu(Constants::M_BUILDPROJECT); + Core::ActionManager::createMenu(Constants::M_BUILDPROJECT); mbuild->menu()->setTitle(tr("&Build")); menubar->addMenu(mbuild, Core::Constants::G_VIEW); // debug menu Core::ActionContainer *mdebug = - am->createMenu(Constants::M_DEBUG); + Core::ActionManager::createMenu(Constants::M_DEBUG); mdebug->menu()->setTitle(tr("&Debug")); menubar->addMenu(mdebug, Core::Constants::G_VIEW); Core::ActionContainer *mstartdebugging = - am->createMenu(Constants::M_DEBUG_STARTDEBUGGING); + Core::ActionManager::createMenu(Constants::M_DEBUG_STARTDEBUGGING); mstartdebugging->menu()->setTitle(tr("&Start Debugging")); mdebug->addMenu(mstartdebugging, Core::Constants::G_DEFAULT_ONE); @@ -499,7 +498,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er msubProjectContextMenu->appendGroup(Constants::G_PROJECT_LAST); msubProjectContextMenu->appendGroup(Constants::G_PROJECT_TREE); - Core::ActionContainer *runMenu = Core::ICore::actionManager()->createMenu(Constants::RUNMENUCONTEXTMENU); + Core::ActionContainer *runMenu = Core::ActionManager::createMenu(Constants::RUNMENUCONTEXTMENU); runMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide); QIcon runIcon = QIcon(QLatin1String(Constants::ICON_RUN)); runIcon.addFile(QLatin1String(Constants::ICON_RUN_SMALL)); @@ -518,7 +517,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er mfileContextMenu->appendGroup(Constants::G_PROJECT_TREE); // "open with" submenu Core::ActionContainer * const openWith = - am->createMenu(ProjectExplorer::Constants::M_OPENFILEWITHCONTEXT); + Core::ActionManager::createMenu(ProjectExplorer::Constants::M_OPENFILEWITHCONTEXT); openWith->setOnAllDisabledBehavior(Core::ActionContainer::Show); d->m_openWithMenu = openWith->menu(); d->m_openWithMenu->setTitle(tr("Open With")); @@ -535,40 +534,40 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Files.Sep"), projecTreeContext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Files.Sep"), projecTreeContext); msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Projects.Sep"), globalcontext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Projects.Sep"), globalcontext); mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT); sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Other.Sep"), globalcontext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Other.Sep"), globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_OTHER); sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.CancelBuild.Sep"), globalcontext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.CancelBuild.Sep"), globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_RUN); sep = new QAction(this); sep->setSeparator(true); - cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Rebuild.Sep"), globalcontext); + cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Rebuild.Sep"), globalcontext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); // @@ -577,13 +576,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // new action d->m_newAction = new QAction(tr("New Project..."), this); - cmd = am->registerAction(d->m_newAction, Constants::NEWPROJECT, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_newAction, Constants::NEWPROJECT, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+N"))); msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES); // open action d->m_loadAction = new QAction(tr("Load Project..."), this); - cmd = am->registerAction(d->m_loadAction, Constants::LOAD, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_loadAction, Constants::LOAD, globalcontext); #ifndef Q_OS_MAC cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+O"))); #endif @@ -591,24 +590,24 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // Default open action d->m_openFileAction = new QAction(tr("Open File"), this); - cmd = am->registerAction(d->m_openFileAction, ProjectExplorer::Constants::OPENFILE, + cmd = Core::ActionManager::registerAction(d->m_openFileAction, ProjectExplorer::Constants::OPENFILE, projecTreeContext); mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN); d->m_searchOnFileSystem = new QAction(FolderNavigationWidget::msgFindOnFileSystem(), this); - cmd = am->registerAction(d->m_searchOnFileSystem, ProjectExplorer::Constants::SEARCHONFILESYSTEM, projecTreeContext); + cmd = Core::ActionManager::registerAction(d->m_searchOnFileSystem, ProjectExplorer::Constants::SEARCHONFILESYSTEM, projecTreeContext); mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_CONFIG); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST); d->m_showInGraphicalShell = new QAction(Core::FileUtils::msgGraphicalShellAction(), this); - cmd = am->registerAction(d->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL, + cmd = Core::ActionManager::registerAction(d->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL, projecTreeContext); mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN); mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES); d->m_openTerminalHere = new QAction(Core::FileUtils::msgTerminalAction(), this); - cmd = am->registerAction(d->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE, + cmd = Core::ActionManager::registerAction(d->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE, projecTreeContext); mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN); mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES); @@ -618,7 +617,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // recent projects menu Core::ActionContainer *mrecent = - am->createMenu(Constants::M_RECENTPROJECTS); + Core::ActionManager::createMenu(Constants::M_RECENTPROJECTS); mrecent->menu()->setTitle(tr("Recent P&rojects")); mrecent->setOnAllDisabledBehavior(Core::ActionContainer::Show); mfile->addMenu(mrecent, Core::Constants::G_FILE_OPEN); @@ -626,7 +625,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er this, SLOT(updateRecentProjectMenu())); // session menu - Core::ActionContainer *msession = am->createMenu(Constants::M_SESSION); + Core::ActionContainer *msession = Core::ActionManager::createMenu(Constants::M_SESSION); msession->menu()->setTitle(tr("Sessions")); msession->setOnAllDisabledBehavior(Core::ActionContainer::Show); mfile->addMenu(msession, Core::Constants::G_FILE_OPEN); @@ -636,7 +635,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // session manager action d->m_sessionManagerAction = new QAction(tr("Session Manager..."), this); - cmd = am->registerAction(d->m_sessionManagerAction, Constants::NEWSESSION, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_sessionManagerAction, Constants::NEWSESSION, globalcontext); mfile->addAction(cmd, Core::Constants::G_FILE_OPEN); cmd->setDefaultKeySequence(QKeySequence()); @@ -645,14 +644,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // unload action d->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - cmd = am->registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_unloadAction->text()); mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT); // unload session action d->m_closeAllProjects = new QAction(tr("Close All Projects and Editors"), this); - cmd = am->registerAction(d->m_closeAllProjects, Constants::CLEARSESSION, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_closeAllProjects, Constants::CLEARSESSION, globalcontext); mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT); msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES); @@ -660,14 +659,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er QIcon buildIcon = QIcon(QLatin1String(Constants::ICON_BUILD)); buildIcon.addFile(QLatin1String(Constants::ICON_BUILD_SMALL)); d->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this); - cmd = am->registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B"))); mbuild->addAction(cmd, Constants::G_BUILD_BUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); // deploy session d->m_deploySessionAction = new QAction(tr("Deploy All"), this); - cmd = am->registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY); msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); @@ -675,7 +674,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er QIcon rebuildIcon = QIcon(QLatin1String(Constants::ICON_REBUILD)); rebuildIcon.addFile(QLatin1String(Constants::ICON_REBUILD_SMALL)); d->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this); - cmd = am->registerAction(d->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); @@ -683,7 +682,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er QIcon cleanIcon = QIcon(QLatin1String(Constants::ICON_CLEAN)); cleanIcon.addFile(QLatin1String(Constants::ICON_CLEAN_SMALL)); d->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this); - cmd = am->registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_CLEAN); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); @@ -691,7 +690,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); d->m_buildAction->setIcon(buildIcon); - cmd = am->registerAction(d->m_buildAction, Constants::BUILD, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_buildAction, Constants::BUILD, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_buildAction->text()); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B"))); @@ -703,7 +702,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // deploy action d->m_deployAction = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - cmd = am->registerAction(d->m_deployAction, Constants::DEPLOY, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_deployAction, Constants::DEPLOY, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_deployAction->text()); mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY); @@ -711,7 +710,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // rebuild action d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - cmd = am->registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_rebuildAction->text()); mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); @@ -719,7 +718,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // clean action d->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - cmd = am->registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_cleanAction->text()); mbuild->addAction(cmd, Constants::G_BUILD_CLEAN); @@ -728,12 +727,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL)); d->m_cancelBuildAction = new QAction(stopIcon, tr("Cancel Build"), this); - cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); // run action d->m_runAction = new QAction(runIcon, tr("Run"), this); - cmd = am->registerAction(d->m_runAction, Constants::RUN, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_runAction, Constants::RUN, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); @@ -743,61 +742,61 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // Run without deployment action d->m_runWithoutDeployAction = new QAction(tr("Run Without Deployment"), this); - cmd = am->registerAction(d->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY, globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_RUN); // Publish action d->m_publishAction = new Utils::ParameterAction(tr("Publish Project..."), tr("Publish Project \"%1\"..."), Utils::ParameterAction::AlwaysEnabled, this); - cmd = am->registerAction(d->m_publishAction, Constants::PUBLISH, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_publishAction, Constants::PUBLISH, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_publishAction->text()); mbuild->addAction(cmd, Constants::G_BUILD_RUN); // build action (context menu) d->m_buildActionContextMenu = new QAction(tr("Build"), this); - cmd = am->registerAction(d->m_buildActionContextMenu, Constants::BUILDCM, projecTreeContext); + cmd = Core::ActionManager::registerAction(d->m_buildActionContextMenu, Constants::BUILDCM, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD); // rebuild action (context menu) d->m_rebuildActionContextMenu = new QAction(tr("Rebuild"), this); - cmd = am->registerAction(d->m_rebuildActionContextMenu, Constants::REBUILDCM, projecTreeContext); + cmd = Core::ActionManager::registerAction(d->m_rebuildActionContextMenu, Constants::REBUILDCM, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); // clean action (context menu) d->m_cleanActionContextMenu = new QAction(tr("Clean"), this); - cmd = am->registerAction(d->m_cleanActionContextMenu, Constants::CLEANCM, projecTreeContext); + cmd = Core::ActionManager::registerAction(d->m_cleanActionContextMenu, Constants::CLEANCM, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); // build without dependencies action d->m_buildProjectOnlyAction = new QAction(tr("Build Without Dependencies"), this); - cmd = am->registerAction(d->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY, globalcontext); // rebuild without dependencies action d->m_rebuildProjectOnlyAction = new QAction(tr("Rebuild Without Dependencies"), this); - cmd = am->registerAction(d->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY, globalcontext); // deploy without dependencies action d->m_deployProjectOnlyAction = new QAction(tr("Deploy Without Dependencies"), this); - cmd = am->registerAction(d->m_deployProjectOnlyAction, Constants::DEPLOYPROJECTONLY, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_deployProjectOnlyAction, Constants::DEPLOYPROJECTONLY, globalcontext); // clean without dependencies action d->m_cleanProjectOnlyAction = new QAction(tr("Clean Without Dependencies"), this); - cmd = am->registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext); // deploy action (context menu) d->m_deployActionContextMenu = new QAction(tr("Deploy"), this); - cmd = am->registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext); + cmd = Core::ActionManager::registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this); - cmd = am->registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext); + cmd = Core::ActionManager::registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); // add new file action d->m_addNewFileAction = new QAction(tr("Add New..."), this); - cmd = am->registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE, + cmd = Core::ActionManager::registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); @@ -805,7 +804,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // add existing file action d->m_addExistingFilesAction = new QAction(tr("Add Existing Files..."), this); - cmd = am->registerAction(d->m_addExistingFilesAction, ProjectExplorer::Constants::ADDEXISTINGFILES, + cmd = Core::ActionManager::registerAction(d->m_addExistingFilesAction, ProjectExplorer::Constants::ADDEXISTINGFILES, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); @@ -813,37 +812,37 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // new subproject action d->m_addNewSubprojectAction = new QAction(tr("New Subproject..."), this); - cmd = am->registerAction(d->m_addNewSubprojectAction, ProjectExplorer::Constants::ADDNEWSUBPROJECT, + cmd = Core::ActionManager::registerAction(d->m_addNewSubprojectAction, ProjectExplorer::Constants::ADDNEWSUBPROJECT, projecTreeContext); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); // unload project again, in right position - mprojectContextMenu->addAction(am->command(Constants::UNLOAD), Constants::G_PROJECT_LAST); + mprojectContextMenu->addAction(Core::ActionManager::command(Constants::UNLOAD), Constants::G_PROJECT_LAST); // remove file action d->m_removeFileAction = new QAction(tr("Remove File..."), this); - cmd = am->registerAction(d->m_removeFileAction, ProjectExplorer::Constants::REMOVEFILE, + cmd = Core::ActionManager::registerAction(d->m_removeFileAction, ProjectExplorer::Constants::REMOVEFILE, projecTreeContext); cmd->setDefaultKeySequence(QKeySequence::Delete); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); //: Remove project from parent profile (Project explorer view); will not physically delete any files. d->m_removeProjectAction = new QAction(tr("Remove Project..."), this); - cmd = am->registerAction(d->m_removeProjectAction, ProjectExplorer::Constants::REMOVEPROJECT, + cmd = Core::ActionManager::registerAction(d->m_removeProjectAction, ProjectExplorer::Constants::REMOVEPROJECT, projecTreeContext); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); // delete file action d->m_deleteFileAction = new QAction(tr("Delete File..."), this); - cmd = am->registerAction(d->m_deleteFileAction, ProjectExplorer::Constants::DELETEFILE, + cmd = Core::ActionManager::registerAction(d->m_deleteFileAction, ProjectExplorer::Constants::DELETEFILE, projecTreeContext); cmd->setDefaultKeySequence(QKeySequence::Delete); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); // renamefile action d->m_renameFileAction = new QAction(tr("Rename..."), this); - cmd = am->registerAction(d->m_renameFileAction, ProjectExplorer::Constants::RENAMEFILE, + cmd = Core::ActionManager::registerAction(d->m_renameFileAction, ProjectExplorer::Constants::RENAMEFILE, projecTreeContext); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); // Not yet used by anyone, so hide for now @@ -855,7 +854,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_setStartupProjectAction = new Utils::ParameterAction(tr("Set as Active Project"), tr("Set \"%1\" as Active Project"), Utils::ParameterAction::AlwaysEnabled, this); - cmd = am->registerAction(d->m_setStartupProjectAction, ProjectExplorer::Constants::SETSTARTUP, + cmd = Core::ActionManager::registerAction(d->m_setStartupProjectAction, ProjectExplorer::Constants::SETSTARTUP, projecTreeContext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDescription(d->m_setStartupProjectAction->text()); @@ -864,10 +863,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er // Collapse All. sep = new QAction(this); sep->setSeparator(true); - Core::Command *treeSpacer = am->registerAction(sep, Core::Id("ProjectExplorer.Tree.Sep"), globalcontext); + Core::Command *treeSpacer = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Tree.Sep"), globalcontext); d->m_projectTreeCollapseAllAction = new QAction(tr("Collapse All"), this); - cmd = am->registerAction(d->m_projectTreeCollapseAllAction, Constants::PROJECTTREE_COLLAPSE_ALL, + cmd = Core::ActionManager::registerAction(d->m_projectTreeCollapseAllAction, Constants::PROJECTTREE_COLLAPSE_ALL, projecTreeContext); const Core::Id treeGroup = Constants::G_PROJECT_TREE; mfileContextMenu->addAction(treeSpacer, treeGroup); @@ -894,7 +893,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_projectSelectorActionMenu->setEnabled(false); d->m_projectSelectorActionMenu->setText(tr("Open Build/Run Target Selector...")); connect(d->m_projectSelectorActionMenu, SIGNAL(triggered()), d->m_targetSelector, SLOT(toggleVisible())); - cmd = am->registerAction(d->m_projectSelectorActionMenu, ProjectExplorer::Constants::SELECTTARGET, + cmd = Core::ActionManager::registerAction(d->m_projectSelectorActionMenu, ProjectExplorer::Constants::SELECTTARGET, globalcontext); mbuild->addAction(cmd, Constants::G_BUILD_RUN); @@ -902,7 +901,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er d->m_projectSelectorActionQuick->setEnabled(false); d->m_projectSelectorActionQuick->setText(tr("Quick Switch Target Selector")); connect(d->m_projectSelectorActionQuick, SIGNAL(triggered()), d->m_targetSelector, SLOT(nextOrShow())); - cmd = am->registerAction(d->m_projectSelectorActionQuick, ProjectExplorer::Constants::SELECTTARGETQUICK, globalcontext); + cmd = Core::ActionManager::registerAction(d->m_projectSelectorActionQuick, ProjectExplorer::Constants::SELECTTARGETQUICK, globalcontext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+T"))); connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), @@ -2436,7 +2435,7 @@ void ProjectExplorerPlugin::updateRecentProjectMenu() qDebug() << "ProjectExplorerPlugin::updateRecentProjectMenu"; Core::ActionContainer *aci = - Core::ICore::actionManager()->actionContainer(Constants::M_RECENTPROJECTS); + Core::ActionManager::actionContainer(Constants::M_RECENTPROJECTS); QMenu *menu = aci->menu(); menu->clear(); @@ -2518,7 +2517,7 @@ void ProjectExplorerPlugin::updateContextMenuActions() d->m_deleteFileAction->setVisible(true); d->m_runActionContextMenu->setVisible(false); - Core::ActionContainer *runMenu = Core::ICore::actionManager()->actionContainer(Constants::RUNMENUCONTEXTMENU); + Core::ActionContainer *runMenu = Core::ActionManager::actionContainer(Constants::RUNMENUCONTEXTMENU); runMenu->menu()->clear(); if (d->m_currentNode && d->m_currentNode->projectNode()) { diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp index e58ec74ee2..9cd69200c2 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.cpp +++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp @@ -122,10 +122,9 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error const Core::Context switchContext(QmlDesigner::Constants::C_QMLDESIGNER, QmlJSEditor::Constants::C_QMLJSEDITOR_ID); - Core::ActionManager *am = Core::ICore::actionManager(); - QAction *switchAction = new QAction(tr("Switch Text/Design"), this); - Core::Command *command = am->registerAction(switchAction, QmlDesigner::Constants::SWITCH_TEXT_DESIGN, switchContext); + Core::Command *command = Core::ActionManager::registerAction( + switchAction, QmlDesigner::Constants::SWITCH_TEXT_DESIGN, switchContext); command->setDefaultKeySequence(QKeySequence(Qt::Key_F4)); m_designerCore = new QmlDesigner::IntegrationCore; @@ -155,9 +154,8 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error void BauhausPlugin::createDesignModeWidget() { - Core::ActionManager *actionManager = Core::ICore::actionManager(); m_editorManager = Core::ICore::editorManager(); - Core::ActionContainer *editMenu = actionManager->actionContainer(Core::Constants::M_EDIT); + Core::ActionContainer *editMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT); m_mainWidget = new DesignModeWidget; @@ -168,100 +166,100 @@ void BauhausPlugin::createDesignModeWidget() Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR); // Revert to saved - actionManager->registerAction(m_revertToSavedAction, + Core::ActionManager::registerAction(m_revertToSavedAction, Core::Constants::REVERTTOSAVED, qmlDesignerMainContext); connect(m_revertToSavedAction, SIGNAL(triggered()), m_editorManager, SLOT(revertToSaved())); //Save - actionManager->registerAction(m_saveAction, Core::Constants::SAVE, qmlDesignerMainContext); + Core::ActionManager::registerAction(m_saveAction, Core::Constants::SAVE, qmlDesignerMainContext); connect(m_saveAction, SIGNAL(triggered()), m_editorManager, SLOT(saveDocument())); //Save As - actionManager->registerAction(m_saveAsAction, Core::Constants::SAVEAS, qmlDesignerMainContext); + Core::ActionManager::registerAction(m_saveAsAction, Core::Constants::SAVEAS, qmlDesignerMainContext); connect(m_saveAsAction, SIGNAL(triggered()), m_editorManager, SLOT(saveDocumentAs())); //Close Editor - actionManager->registerAction(m_closeCurrentEditorAction, Core::Constants::CLOSE, qmlDesignerMainContext); + Core::ActionManager::registerAction(m_closeCurrentEditorAction, Core::Constants::CLOSE, qmlDesignerMainContext); connect(m_closeCurrentEditorAction, SIGNAL(triggered()), m_editorManager, SLOT(closeEditor())); //Close All - actionManager->registerAction(m_closeAllEditorsAction, Core::Constants::CLOSEALL, qmlDesignerMainContext); + Core::ActionManager::registerAction(m_closeAllEditorsAction, Core::Constants::CLOSEALL, qmlDesignerMainContext); connect(m_closeAllEditorsAction, SIGNAL(triggered()), m_editorManager, SLOT(closeAllEditors())); //Close All Others Action - actionManager->registerAction(m_closeOtherEditorsAction, Core::Constants::CLOSEOTHERS, qmlDesignerMainContext); + Core::ActionManager::registerAction(m_closeOtherEditorsAction, Core::Constants::CLOSEOTHERS, qmlDesignerMainContext); connect(m_closeOtherEditorsAction, SIGNAL(triggered()), m_editorManager, SLOT(closeOtherEditors())); // Undo / Redo - actionManager->registerAction(m_mainWidget->undoAction(), Core::Constants::UNDO, qmlDesignerMainContext); - actionManager->registerAction(m_mainWidget->redoAction(), Core::Constants::REDO, qmlDesignerMainContext); + Core::ActionManager::registerAction(m_mainWidget->undoAction(), Core::Constants::UNDO, qmlDesignerMainContext); + Core::ActionManager::registerAction(m_mainWidget->redoAction(), Core::Constants::REDO, qmlDesignerMainContext); Core::Command *command; //GoIntoComponent - command = actionManager->registerAction(m_mainWidget->goIntoComponentAction(), + command = Core::ActionManager::registerAction(m_mainWidget->goIntoComponentAction(), Constants::GO_INTO_COMPONENT, qmlDesignerMainContext); command->setDefaultKeySequence(QKeySequence(Qt::Key_F2)); //Edit Menu - command = actionManager->registerAction(m_mainWidget->deleteAction(), + command = Core::ActionManager::registerAction(m_mainWidget->deleteAction(), QmlDesigner::Constants::DELETE, qmlDesignerFormEditorContext); - command = actionManager->registerAction(m_mainWidget->deleteAction(), + command = Core::ActionManager::registerAction(m_mainWidget->deleteAction(), QmlDesigner::Constants::DELETE, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::Delete); command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); - command = actionManager->registerAction(m_mainWidget->cutAction(), + command = Core::ActionManager::registerAction(m_mainWidget->cutAction(), Core::Constants::CUT, qmlDesignerFormEditorContext); - command = actionManager->registerAction(m_mainWidget->cutAction(), + command = Core::ActionManager::registerAction(m_mainWidget->cutAction(), Core::Constants::CUT, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::Cut); editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); - command = actionManager->registerAction(m_mainWidget->copyAction(), + command = Core::ActionManager::registerAction(m_mainWidget->copyAction(), Core::Constants::COPY, qmlDesignerFormEditorContext); - command = actionManager->registerAction(m_mainWidget->copyAction(), + command = Core::ActionManager::registerAction(m_mainWidget->copyAction(), Core::Constants::COPY, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::Copy); editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); - command = actionManager->registerAction(m_mainWidget->pasteAction(), + command = Core::ActionManager::registerAction(m_mainWidget->pasteAction(), Core::Constants::PASTE, qmlDesignerFormEditorContext); - command = actionManager->registerAction(m_mainWidget->pasteAction(), + command = Core::ActionManager::registerAction(m_mainWidget->pasteAction(), Core::Constants::PASTE, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::Paste); editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); - command = actionManager->registerAction(m_mainWidget->selectAllAction(), + command = Core::ActionManager::registerAction(m_mainWidget->selectAllAction(), Core::Constants::SELECTALL, qmlDesignerFormEditorContext); - command = actionManager->registerAction(m_mainWidget->selectAllAction(), + command = Core::ActionManager::registerAction(m_mainWidget->selectAllAction(), Core::Constants::SELECTALL, qmlDesignerNavigatorContext); command->setDefaultKeySequence(QKeySequence::SelectAll); editMenu->addAction(command, Core::Constants::G_EDIT_SELECTALL); - Core::ActionContainer *viewsMenu = actionManager->actionContainer(Core::Constants::M_WINDOW_VIEWS); + Core::ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS); - command = actionManager->registerAction(m_mainWidget->toggleLeftSidebarAction(), + command = Core::ActionManager::registerAction(m_mainWidget->toggleLeftSidebarAction(), Constants::TOGGLE_LEFT_SIDEBAR, qmlDesignerMainContext); command->setAttribute(Core::Command::CA_Hide); command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+0")); viewsMenu->addAction(command); - command = actionManager->registerAction(m_mainWidget->toggleRightSidebarAction(), + command = Core::ActionManager::registerAction(m_mainWidget->toggleRightSidebarAction(), Constants::TOGGLE_RIGHT_SIDEBAR, qmlDesignerMainContext); command->setAttribute(Core::Command::CA_Hide); command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+Shift+0")); viewsMenu->addAction(command); - command = actionManager->registerAction(m_mainWidget->restoreDefaultViewAction(), + command = Core::ActionManager::registerAction(m_mainWidget->restoreDefaultViewAction(), Constants::RESTORE_DEFAULT_VIEW, qmlDesignerMainContext); command->setAttribute(Core::Command::CA_Hide); viewsMenu->addAction(command); - command = actionManager->registerAction(m_mainWidget->hideSidebarsAction(), + command = Core::ActionManager::registerAction(m_mainWidget->hideSidebarsAction(), Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext); #ifdef Q_OS_MACX diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index c8bb4383af..b22de6a47d 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -1236,7 +1236,7 @@ void QmlJSTextEditorWidget::contextMenuEvent(QContextMenuEvent *e) refactoringMenu->setEnabled(!refactoringMenu->isEmpty()); - if (Core::ActionContainer *mcontext = Core::ICore::actionManager()->actionContainer(QmlJSEditor::Constants::M_CONTEXT)) { + if (Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(QmlJSEditor::Constants::M_CONTEXT)) { QMenu *contextMenu = mcontext->menu(); foreach (QAction *action, contextMenu->actions()) { menu->addAction(action); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 05f39c8962..57bcb026f1 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -117,14 +117,13 @@ QmlJSEditorPlugin::~QmlJSEditorPlugin() /*! Copied from cppplugin.cpp */ static inline -Core::Command *createSeparator(Core::ActionManager *am, - QObject *parent, +Core::Command *createSeparator(QObject *parent, Core::Context &context, const char *id) { QAction *separator = new QAction(parent); separator->setSeparator(true); - return am->registerAction(separator, Core::Id(id), context); + return Core::ActionManager::registerAction(separator, Core::Id(id), context); } bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) @@ -178,45 +177,44 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e | TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor); m_actionHandler->initializeActions(); - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *contextMenu = am->createMenu(QmlJSEditor::Constants::M_CONTEXT); - Core::ActionContainer *qmlToolsMenu = am->actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS)); + Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(QmlJSEditor::Constants::M_CONTEXT); + Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS)); Core::Context globalContext(Core::Constants::C_GLOBAL); - qmlToolsMenu->addAction(createSeparator(am, this, globalContext, QmlJSEditor::Constants::SEPARATOR3)); + qmlToolsMenu->addAction(createSeparator(this, globalContext, QmlJSEditor::Constants::SEPARATOR3)); Core::Command *cmd; - cmd = am->command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); + cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); QAction *findUsagesAction = new QAction(tr("Find Usages"), this); - cmd = am->registerAction(findUsagesAction, Constants::FIND_USAGES, context); + cmd = Core::ActionManager::registerAction(findUsagesAction, Constants::FIND_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); connect(findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); QAction *renameUsagesAction = new QAction(tr("Rename Symbol Under Cursor"), this); - cmd = am->registerAction(renameUsagesAction, Constants::RENAME_USAGES, context); + cmd = Core::ActionManager::registerAction(renameUsagesAction, Constants::RENAME_USAGES, context); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+R"))); connect(renameUsagesAction, SIGNAL(triggered()), this, SLOT(renameUsages())); contextMenu->addAction(cmd); qmlToolsMenu->addAction(cmd); QAction *semanticScan = new QAction(tr("Run Checks"), this); - cmd = am->registerAction(semanticScan, Core::Id(Constants::RUN_SEMANTIC_SCAN), globalContext); + cmd = Core::ActionManager::registerAction(semanticScan, Core::Id(Constants::RUN_SEMANTIC_SCAN), globalContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+C"))); connect(semanticScan, SIGNAL(triggered()), this, SLOT(runSemanticScan())); qmlToolsMenu->addAction(cmd); m_reformatFileAction = new QAction(tr("Reformat File"), this); - cmd = am->registerAction(m_reformatFileAction, Core::Id(Constants::REFORMAT_FILE), context); + cmd = Core::ActionManager::registerAction(m_reformatFileAction, Core::Id(Constants::REFORMAT_FILE), context); connect(m_reformatFileAction, SIGNAL(triggered()), this, SLOT(reformatFile())); qmlToolsMenu->addAction(cmd); QAction *showQuickToolbar = new QAction(tr("Show Qt Quick Toolbar"), this); - cmd = am->registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context); + cmd = Core::ActionManager::registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context); cmd->setDefaultKeySequence(Core::UseMacShortcuts ? QKeySequence(Qt::META + Qt::ALT + Qt::Key_Space) : QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Space)); connect(showQuickToolbar, SIGNAL(triggered()), this, SLOT(showContextPane())); @@ -224,17 +222,17 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e qmlToolsMenu->addAction(cmd); // Insert marker for "Refactoring" menu: - Core::Command *sep = createSeparator(am, this, globalContext, + Core::Command *sep = createSeparator(this, globalContext, Constants::SEPARATOR1); sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); contextMenu->addAction(sep); - contextMenu->addAction(createSeparator(am, this, globalContext, + contextMenu->addAction(createSeparator(this, globalContext, Constants::SEPARATOR2)); - cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); + cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION); contextMenu->addAction(cmd); - cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); + cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(cmd); m_quickFixAssistProvider = new QmlJSQuickFixAssistProvider; @@ -321,11 +319,11 @@ void QmlJSEditorPlugin::showContextPane() } -Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a, Core::ActionManager *am, +Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a, Core::Context &context, const Core::Id &id, Core::ActionContainer *c1, const QString &keySequence) { - Core::Command *command = am->registerAction(a, id, context); + Core::Command *command = Core::ActionManager::registerAction(a, id, context); if (!keySequence.isEmpty()) command->setDefaultKeySequence(QKeySequence(keySequence)); c1->addAction(command); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.h b/src/plugins/qmljseditor/qmljseditorplugin.h index 29e22f6b32..8c43192566 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.h +++ b/src/plugins/qmljseditor/qmljseditorplugin.h @@ -111,7 +111,7 @@ private Q_SLOTS: void checkCurrentEditorSemanticInfoUpToDate(); private: - Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const Core::Id &id, + Core::Command *addToolAction(QAction *a, Core::Context &context, const Core::Id &id, Core::ActionContainer *c1, const QString &keySequence); static QmlJSEditorPlugin *m_instance; diff --git a/src/plugins/qmljstools/qmljstoolsplugin.cpp b/src/plugins/qmljstools/qmljstoolsplugin.cpp index e2cfdc828a..28679e9ad3 100644 --- a/src/plugins/qmljstools/qmljstoolsplugin.cpp +++ b/src/plugins/qmljstools/qmljstoolsplugin.cpp @@ -77,8 +77,6 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error) Q_UNUSED(arguments) Q_UNUSED(error) - Core::ActionManager *am = Core::ICore::actionManager(); - m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings // Objects @@ -96,8 +94,8 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error) addAutoReleasedObject(new QmlJSCodeStyleSettingsPage); // Menus - Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); - Core::ActionContainer *mqmljstools = am->createMenu(Constants::M_TOOLS_QMLJS); + Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); + Core::ActionContainer *mqmljstools = Core::ActionManager::createMenu(Constants::M_TOOLS_QMLJS); QMenu *menu = mqmljstools->menu(); menu->setTitle(tr("&QML/JS")); menu->setEnabled(true); @@ -106,7 +104,8 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error) // Update context in global context m_resetCodeModelAction = new QAction(tr("Reset Code Model"), this); Core::Context globalContext(Core::Constants::C_GLOBAL); - Core::Command *cmd = am->registerAction(m_resetCodeModelAction, Core::Id(Constants::RESET_CODEMODEL), globalContext); + Core::Command *cmd = Core::ActionManager::registerAction( + m_resetCodeModelAction, Core::Id(Constants::RESET_CODEMODEL), globalContext); connect(m_resetCodeModelAction, SIGNAL(triggered()), m_modelManager, SLOT(resetCodeModel())); mqmljstools->addAction(cmd); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 287ffff211..191b23f904 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -177,22 +177,21 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent) Command *command = 0; const Context globalContext(C_GLOBAL); - ActionManager *am = ICore::actionManager(); - ActionContainer *menu = am->actionContainer(M_DEBUG_ANALYZER); - ActionContainer *options = am->createMenu(M_DEBUG_ANALYZER_QML_OPTIONS); + ActionContainer *menu = Core::ActionManager::actionContainer(M_DEBUG_ANALYZER); + ActionContainer *options = Core::ActionManager::createMenu(M_DEBUG_ANALYZER_QML_OPTIONS); options->menu()->setTitle(tr("QML Profiler Options")); menu->addMenu(options, G_ANALYZER_OPTIONS); options->menu()->setEnabled(true); QAction *act = d->m_loadQmlTrace = new QAction(tr("Load QML Trace"), options); - command = am->registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace", globalContext); + command = Core::ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace", globalContext); connect(act, SIGNAL(triggered()), this, SLOT(showLoadDialog())); options->addAction(command); act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options); d->m_saveQmlTrace->setEnabled(false); - command = am->registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace", globalContext); + command = Core::ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace", globalContext); connect(act, SIGNAL(triggered()), this, SLOT(showSaveDialog())); options->addAction(command); diff --git a/src/plugins/qt4projectmanager/profileeditor.cpp b/src/plugins/qt4projectmanager/profileeditor.cpp index 6169f04cf8..3ff0bcec68 100644 --- a/src/plugins/qt4projectmanager/profileeditor.cpp +++ b/src/plugins/qt4projectmanager/profileeditor.cpp @@ -200,8 +200,8 @@ void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e) { QMenu *menu = new QMenu(); - Core::ActionManager *am = Core::ICore::actionManager(); - Core::ActionContainer *mcontext = am->actionContainer(Qt4ProjectManager::Constants::M_CONTEXT); + Core::ActionContainer *mcontext = + Core::ActionManager::actionContainer(Qt4ProjectManager::Constants::M_CONTEXT); QMenu *contextMenu = mcontext->menu(); foreach (QAction *action, contextMenu->actions()) diff --git a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp index 2edae38eed..35c4bf9458 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp @@ -122,7 +122,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * return false; m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); - Core::ActionManager *am = Core::ICore::actionManager(); //create and register objects m_qt4ProjectManager = new Qt4Manager(this); @@ -177,13 +176,13 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * //menus Core::ActionContainer *mbuild = - am->actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); Core::ActionContainer *mproject = - am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); Core::ActionContainer *msubproject = - am->actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT); Core::ActionContainer *mfile = - am->actionContainer(ProjectExplorer::Constants::M_FILECONTEXT); + Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_FILECONTEXT); //register actions Core::Command *command; @@ -191,7 +190,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * m_buildSubProjectContextMenu = new Utils::ParameterAction(tr("Build"), tr("Build \"%1\""), Utils::ParameterAction::AlwaysEnabled/*handled manually*/, this); - command = am->registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext); + command = Core::ActionManager::registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_buildSubProjectContextMenu->text()); @@ -199,7 +198,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu())); m_runQMakeActionContextMenu = new QAction(tr("Run qmake"), this); - command = am->registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext); + command = Core::ActionManager::registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); @@ -208,30 +207,33 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * m_subProjectRebuildSeparator = new QAction(this); m_subProjectRebuildSeparator->setSeparator(true); command->setAttribute(Core::Command::CA_Hide); - command = am->registerAction(m_subProjectRebuildSeparator, Core::Id("ProjectExplorer.SubprojectRebuild.Sep"), projectContext); + command = Core::ActionManager::registerAction( + m_subProjectRebuildSeparator, Core::Id("ProjectExplorer.SubprojectRebuild.Sep"), projectContext); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); m_rebuildSubProjectContextMenu = new QAction(tr("Rebuild"), this); - command = am->registerAction(m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIRCONTEXTMENU, projectContext); + command = Core::ActionManager::registerAction( + m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIRCONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); connect(m_rebuildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(rebuildSubDirContextMenu())); m_cleanSubProjectContextMenu = new QAction(tr("Clean"), this); - command = am->registerAction(m_cleanSubProjectContextMenu, Constants::CLEANSUBDIRCONTEXTMENU, projectContext); + command = Core::ActionManager::registerAction( + m_cleanSubProjectContextMenu, Constants::CLEANSUBDIRCONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); connect(m_cleanSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(cleanSubDirContextMenu())); m_buildFileContextMenu = new QAction(tr("Build"), this); - command = am->registerAction(m_buildFileContextMenu, Constants::BUILDFILECONTEXTMENU, projectContext); + command = Core::ActionManager::registerAction(m_buildFileContextMenu, Constants::BUILDFILECONTEXTMENU, projectContext); command->setAttribute(Core::Command::CA_Hide); mfile->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER); connect(m_buildFileContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildFileContextMenu())); m_buildSubProjectAction = new Utils::ParameterAction(tr("Build Subproject"), tr("Build Subproject \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = am->registerAction(m_buildSubProjectAction, Constants::BUILDSUBDIR, projectContext); + command = Core::ActionManager::registerAction(m_buildSubProjectAction, Constants::BUILDSUBDIR, projectContext); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_buildSubProjectAction->text()); @@ -239,14 +241,14 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * connect(m_buildSubProjectAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu())); m_runQMakeAction = new QAction(tr("Run qmake"), this); - command = am->registerAction(m_runQMakeAction, Constants::RUNQMAKE, projectContext); + command = Core::ActionManager::registerAction(m_runQMakeAction, Constants::RUNQMAKE, projectContext); command->setAttribute(Core::Command::CA_Hide); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); connect(m_runQMakeAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMake())); m_rebuildSubProjectAction = new Utils::ParameterAction(tr("Rebuild Subproject"), tr("Rebuild Subproject \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = am->registerAction(m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext); + command = Core::ActionManager::registerAction(m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_rebuildSubProjectAction->text()); @@ -255,7 +257,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * m_cleanSubProjectAction = new Utils::ParameterAction(tr("Clean Subproject"), tr("Clean Subproject \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = am->registerAction(m_cleanSubProjectAction, Constants::CLEANSUBDIR, projectContext); + command = Core::ActionManager::registerAction(m_cleanSubProjectAction, Constants::CLEANSUBDIR, projectContext); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_cleanSubProjectAction->text()); @@ -264,7 +266,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * m_buildFileAction = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); - command = am->registerAction(m_buildFileAction, Constants::BUILDFILE, projectContext); + command = Core::ActionManager::registerAction(m_buildFileAction, Constants::BUILDFILE, projectContext); command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_UpdateText); command->setDescription(m_buildFileAction->text()); @@ -279,22 +281,22 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * connect(m_projectExplorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)), this, SLOT(updateContextActions(ProjectExplorer::Node*,ProjectExplorer::Project*))); - Core::ActionContainer *contextMenu = am->createMenu(Qt4ProjectManager::Constants::M_CONTEXT); + Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(Qt4ProjectManager::Constants::M_CONTEXT); Core::Context proFileEditorContext = Core::Context(Qt4ProjectManager::Constants::C_PROFILEEDITOR); - command = am->command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR); + command = Core::ActionManager::command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR); contextMenu->addAction(command); m_addLibraryAction = new QAction(tr("Add Library..."), this); - command = am->registerAction(m_addLibraryAction, + command = Core::ActionManager::registerAction(m_addLibraryAction, Constants::ADDLIBRARY, proFileEditorContext); connect(m_addLibraryAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(addLibrary())); contextMenu->addAction(command); m_addLibraryActionContextMenu = new QAction(tr("Add Library..."), this); - command = am->registerAction(m_addLibraryActionContextMenu, + command = Core::ActionManager::registerAction(m_addLibraryActionContextMenu, Constants::ADDLIBRARY, projecTreeContext); connect(m_addLibraryActionContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(addLibraryContextMenu())); @@ -303,10 +305,10 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString * QAction *separator = new QAction(this); separator->setSeparator(true); - contextMenu->addAction(am->registerAction(separator, + contextMenu->addAction(Core::ActionManager::registerAction(separator, Core::Id(Constants::SEPARATOR), proFileEditorContext)); - command = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); + command = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION); contextMenu->addAction(command); return true; diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp index 931350429b..743824d92a 100644 --- a/src/plugins/resourceeditor/resourceeditorplugin.cpp +++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp @@ -92,9 +92,8 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err const Core::Context context(Constants::C_RESOURCEEDITOR); m_undoAction = new QAction(tr("&Undo"), this); m_redoAction = new QAction(tr("&Redo"), this); - Core::ActionManager * const actionManager = Core::ICore::actionManager(); - actionManager->registerAction(m_undoAction, Core::Constants::UNDO, context); - actionManager->registerAction(m_redoAction, Core::Constants::REDO, context); + Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, context); + Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, context); connect(m_undoAction, SIGNAL(triggered()), this, SLOT(onUndo())); connect(m_redoAction, SIGNAL(triggered()), this, SLOT(onRedo())); diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index afac58b7be..f167722ea7 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -249,13 +249,12 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = { }; static inline Core::Command *createSeparator(QObject *parent, - Core::ActionManager *ami, const char*id, const Core::Context &globalcontext) { QAction *tmpaction = new QAction(parent); tmpaction->setSeparator(true); - return ami->registerAction(tmpaction, id, globalcontext); + return Core::ActionManager::registerAction(tmpaction, id, globalcontext); } bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *errorMessage) @@ -294,11 +293,10 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e addAutoReleasedObject(m_commandLocator); //register actions - Core::ActionManager *ami = Core::ICore::actionManager(); - Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS); + Core::ActionContainer *toolsContainer = Core::ActionManager::actionContainer(M_TOOLS); Core::ActionContainer *subversionMenu = - ami->createMenu(Core::Id(CMD_ID_SUBVERSION_MENU)); + Core::ActionManager::createMenu(Core::Id(CMD_ID_SUBVERSION_MENU)); subversionMenu->menu()->setTitle(tr("&Subversion")); toolsContainer->addMenu(subversionMenu); m_menuAction = subversionMenu->menu()->menuAction(); @@ -306,7 +304,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e Core::Command *command; m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_diffCurrentAction, + command = Core::ActionManager::registerAction(m_diffCurrentAction, CMD_ID_DIFF_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+D") : tr("Alt+S,Alt+D"))); @@ -315,7 +313,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e m_commandLocator->appendCommand(command); m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_filelogCurrentAction, + command = Core::ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_filelogCurrentAction, SIGNAL(triggered()), this, @@ -324,7 +322,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e m_commandLocator->appendCommand(command); m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_annotateCurrentAction, + command = Core::ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_annotateCurrentAction, SIGNAL(triggered()), this, @@ -332,10 +330,10 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e subversionMenu->addAction(command); m_commandLocator->appendCommand(command); - subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR0, globalcontext)); + subversionMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR0, globalcontext)); m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_addAction, CMD_ID_ADD, + command = Core::ActionManager::registerAction(m_addAction, CMD_ID_ADD, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+A") : tr("Alt+S,Alt+A"))); @@ -344,7 +342,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e m_commandLocator->appendCommand(command); m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_commitCurrentAction, + command = Core::ActionManager::registerAction(m_commitCurrentAction, CMD_ID_COMMIT_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+C") : tr("Alt+S,Alt+C"))); @@ -353,7 +351,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e m_commandLocator->appendCommand(command); m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, + command = Core::ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); @@ -361,17 +359,17 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e m_commandLocator->appendCommand(command); m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_revertAction, CMD_ID_REVERT, + command = Core::ActionManager::registerAction(m_revertAction, CMD_ID_REVERT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); - subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR1, globalcontext)); + subversionMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR1, globalcontext)); m_diffProjectAction = new Utils::ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, + command = Core::ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject())); @@ -379,7 +377,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e m_commandLocator->appendCommand(command); m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_statusProjectAction, CMD_ID_STATUS, + command = Core::ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus())); @@ -387,66 +385,66 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e m_commandLocator->appendCommand(command); m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); + command = Core::ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject())); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext); + command = Core::ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext); connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject())); command->setAttribute(Core::Command::CA_UpdateText); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); m_commitProjectAction = new Utils::ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); - command = ami->registerAction(m_commitProjectAction, CMD_ID_COMMIT_PROJECT, globalcontext); + command = Core::ActionManager::registerAction(m_commitProjectAction, CMD_ID_COMMIT_PROJECT, globalcontext); connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(startCommitProject())); command->setAttribute(Core::Command::CA_UpdateText); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); - subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext)); + subversionMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR2, globalcontext)); m_diffRepositoryAction = new QAction(tr("Diff Repository"), this); - command = ami->registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext); + command = Core::ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext); connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository())); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); m_statusRepositoryAction = new QAction(tr("Repository Status"), this); - command = ami->registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext); + command = Core::ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext); connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository())); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); m_logRepositoryAction = new QAction(tr("Log Repository"), this); - command = ami->registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); + command = Core::ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository())); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); m_updateRepositoryAction = new QAction(tr("Update Repository"), this); - command = ami->registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext); + command = Core::ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext); connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository())); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); m_commitAllAction = new QAction(tr("Commit All Files"), this); - command = ami->registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL, + command = Core::ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL, globalcontext); connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll())); subversionMenu->addAction(command); m_commandLocator->appendCommand(command); m_describeAction = new QAction(tr("Describe..."), this); - command = ami->registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext); + command = Core::ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext); connect(m_describeAction, SIGNAL(triggered()), this, SLOT(slotDescribe())); subversionMenu->addAction(command); m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this); - command = ami->registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL, + command = Core::ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL, globalcontext); connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll())); subversionMenu->addAction(command); @@ -456,18 +454,18 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e Core::Context svncommitcontext(Constants::SUBVERSIONCOMMITEDITOR); m_submitCurrentLogAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); - command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext); + command = Core::ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); m_submitDiffAction = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); - command = ami->registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, svncommitcontext); + command = Core::ActionManager::registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, svncommitcontext); m_submitUndoAction = new QAction(tr("&Undo"), this); - command = ami->registerAction(m_submitUndoAction, Core::Constants::UNDO, svncommitcontext); + command = Core::ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, svncommitcontext); m_submitRedoAction = new QAction(tr("&Redo"), this); - command = ami->registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext); + command = Core::ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext); return true; } diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 82ec47065a..dce1b5debf 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -6083,24 +6083,23 @@ QMimeData *BaseTextEditorWidget::duplicateMimeData(const QMimeData *source) cons void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu) { menu->addSeparator(); - Core::ActionManager *am = Core::ICore::actionManager(); - QAction *a = am->command(Core::Constants::CUT)->action(); + QAction *a = Core::ActionManager::command(Core::Constants::CUT)->action(); if (a && a->isEnabled()) menu->addAction(a); - a = am->command(Core::Constants::COPY)->action(); + a = Core::ActionManager::command(Core::Constants::COPY)->action(); if (a && a->isEnabled()) menu->addAction(a); - a = am->command(Core::Constants::PASTE)->action(); + a = Core::ActionManager::command(Core::Constants::PASTE)->action(); if (a && a->isEnabled()) menu->addAction(a); - a = am->command(Constants::CIRCULAR_PASTE)->action(); + a = Core::ActionManager::command(Constants::CIRCULAR_PASTE)->action(); if (a && a->isEnabled()) menu->addAction(a); BaseTextDocument *doc = baseTextDocument(); if (doc->codec()->name() == QString(QLatin1String("UTF-8"))) { - a = am->command(Constants::SWITCH_UTF8BOM)->action(); + a = Core::ActionManager::command(Constants::SWITCH_UTF8BOM)->action(); if (a && a->isEnabled()) { a->setText(doc->format().hasUtf8Bom ? tr("Delete UTF-8 BOM on Save") : tr("Add UTF-8 BOM on Save")); diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp index e8aab45cb1..26030bf9ad 100644 --- a/src/plugins/texteditor/texteditoractionhandler.cpp +++ b/src/plugins/texteditor/texteditoractionhandler.cpp @@ -152,27 +152,25 @@ void TextEditorActionHandler::createActions() m_gotoAction = registerNewAction(Core::Constants::GOTO, this, SLOT(gotoAction())); m_printAction = registerNewAction(Core::Constants::PRINT, this, SLOT(printAction())); - Core::ActionManager *am = Core::ICore::actionManager(); - - Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT); - Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED); + Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT); + Core::ActionContainer *advancedMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED); m_selectEncodingAction = new QAction(tr("Select Encoding..."), this); - Core::Command *command = am->registerAction(m_selectEncodingAction, Constants::SELECT_ENCODING, m_contextId); + Core::Command *command = Core::ActionManager::registerAction(m_selectEncodingAction, Constants::SELECT_ENCODING, m_contextId); connect(m_selectEncodingAction, SIGNAL(triggered()), this, SLOT(selectEncoding())); medit->addAction(command, Core::Constants::G_EDIT_OTHER); m_formatAction = new QAction(tr("Auto-&indent Selection"), this); m_modifyingActions << m_formatAction; - command = am->registerAction(m_formatAction, TextEditor::Constants::AUTO_INDENT_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(m_formatAction, TextEditor::Constants::AUTO_INDENT_SELECTION, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+I"))); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); connect(m_formatAction, SIGNAL(triggered(bool)), this, SLOT(formatAction())); m_rewrapParagraphAction = new QAction(tr("&Rewrap Paragraph"), this); m_modifyingActions << m_rewrapParagraphAction; - command = am->registerAction(m_rewrapParagraphAction, TextEditor::Constants::REWRAP_PARAGRAPH, m_contextId, true); + command = Core::ActionManager::registerAction(m_rewrapParagraphAction, TextEditor::Constants::REWRAP_PARAGRAPH, m_contextId, true); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, R") : tr("Ctrl+E, R"))); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); connect(m_rewrapParagraphAction, SIGNAL(triggered(bool)), this, SLOT(rewrapParagraphAction())); @@ -180,7 +178,7 @@ void TextEditorActionHandler::createActions() m_visualizeWhitespaceAction = new QAction(tr("&Visualize Whitespace"), this); m_visualizeWhitespaceAction->setCheckable(true); - command = am->registerAction(m_visualizeWhitespaceAction, + command = Core::ActionManager::registerAction(m_visualizeWhitespaceAction, TextEditor::Constants::VISUALIZE_WHITESPACE, m_contextId); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, Meta+V") : tr("Ctrl+E, Ctrl+V"))); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); @@ -188,7 +186,7 @@ void TextEditorActionHandler::createActions() m_cleanWhitespaceAction = new QAction(tr("Clean Whitespace"), this); m_modifyingActions << m_cleanWhitespaceAction; - command = am->registerAction(m_cleanWhitespaceAction, + command = Core::ActionManager::registerAction(m_cleanWhitespaceAction, TextEditor::Constants::CLEAN_WHITESPACE, m_contextId, true); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); @@ -196,7 +194,7 @@ void TextEditorActionHandler::createActions() m_textWrappingAction = new QAction(tr("Enable Text &Wrapping"), this); m_textWrappingAction->setCheckable(true); - command = am->registerAction(m_textWrappingAction, TextEditor::Constants::TEXT_WRAPPING, m_contextId); + command = Core::ActionManager::registerAction(m_textWrappingAction, TextEditor::Constants::TEXT_WRAPPING, m_contextId); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, Meta+W") : tr("Ctrl+E, Ctrl+W"))); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); connect(m_textWrappingAction, SIGNAL(triggered(bool)), this, SLOT(setTextWrapping(bool))); @@ -204,262 +202,262 @@ void TextEditorActionHandler::createActions() m_unCommentSelectionAction = new QAction(tr("Toggle Comment &Selection"), this); m_modifyingActions << m_unCommentSelectionAction; - command = am->registerAction(m_unCommentSelectionAction, Constants::UN_COMMENT_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(m_unCommentSelectionAction, Constants::UN_COMMENT_SELECTION, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+/"))); connect(m_unCommentSelectionAction, SIGNAL(triggered()), this, SLOT(unCommentSelection())); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); m_cutLineAction = new QAction(tr("Cut &Line"), this); m_modifyingActions << m_cutLineAction; - command = am->registerAction(m_cutLineAction, Constants::CUT_LINE, m_contextId, true); + command = Core::ActionManager::registerAction(m_cutLineAction, Constants::CUT_LINE, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Shift+Del"))); connect(m_cutLineAction, SIGNAL(triggered()), this, SLOT(cutLine())); m_copyLineAction = new QAction(tr("Copy &Line"), this); - command = am->registerAction(m_copyLineAction, Constants::COPY_LINE, m_contextId); + command = Core::ActionManager::registerAction(m_copyLineAction, Constants::COPY_LINE, m_contextId); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Ins"))); connect(m_copyLineAction, SIGNAL(triggered()), this, SLOT(copyLine())); m_deleteLineAction = new QAction(tr("Delete &Line"), this); m_modifyingActions << m_deleteLineAction; - command = am->registerAction(m_deleteLineAction, Constants::DELETE_LINE, m_contextId, true); + command = Core::ActionManager::registerAction(m_deleteLineAction, Constants::DELETE_LINE, m_contextId, true); connect(m_deleteLineAction, SIGNAL(triggered()), this, SLOT(deleteLine())); m_deleteEndOfWordAction = new QAction(tr("Delete Word from Cursor On"), this); m_modifyingActions << m_deleteEndOfWordAction; - am->registerAction(m_deleteEndOfWordAction, Constants::DELETE_END_OF_WORD, m_contextId, true); + Core::ActionManager::registerAction(m_deleteEndOfWordAction, Constants::DELETE_END_OF_WORD, m_contextId, true); connect(m_deleteEndOfWordAction, SIGNAL(triggered()), this, SLOT(deleteEndOfWord())); m_deleteEndOfWordCamelCaseAction = new QAction(tr("Delete Word Camel Case from Cursor On"), this); m_modifyingActions << m_deleteEndOfWordCamelCaseAction; - am->registerAction(m_deleteEndOfWordCamelCaseAction, Constants::DELETE_END_OF_WORD_CAMEL_CASE, m_contextId, true); + Core::ActionManager::registerAction(m_deleteEndOfWordCamelCaseAction, Constants::DELETE_END_OF_WORD_CAMEL_CASE, m_contextId, true); connect(m_deleteEndOfWordCamelCaseAction, SIGNAL(triggered()), this, SLOT(deleteEndOfWordCamelCase())); m_deleteStartOfWordAction = new QAction(tr("Delete Word up to Cursor"), this); m_modifyingActions << m_deleteStartOfWordAction; - am->registerAction(m_deleteStartOfWordAction, Constants::DELETE_START_OF_WORD, m_contextId, true); + Core::ActionManager::registerAction(m_deleteStartOfWordAction, Constants::DELETE_START_OF_WORD, m_contextId, true); connect(m_deleteStartOfWordAction, SIGNAL(triggered()), this, SLOT(deleteStartOfWord())); m_deleteStartOfWordCamelCaseAction = new QAction(tr("Delete Word Camel Case up to Cursor"), this); m_modifyingActions << m_deleteStartOfWordCamelCaseAction; - am->registerAction(m_deleteStartOfWordCamelCaseAction, Constants::DELETE_START_OF_WORD_CAMEL_CASE, m_contextId, true); + Core::ActionManager::registerAction(m_deleteStartOfWordCamelCaseAction, Constants::DELETE_START_OF_WORD_CAMEL_CASE, m_contextId, true); connect(m_deleteStartOfWordCamelCaseAction, SIGNAL(triggered()), this, SLOT(deleteStartOfWordCamelCase())); m_foldAction = new QAction(tr("Fold"), this); - command = am->registerAction(m_foldAction, Constants::FOLD, m_contextId, true); + command = Core::ActionManager::registerAction(m_foldAction, Constants::FOLD, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+<"))); connect(m_foldAction, SIGNAL(triggered()), this, SLOT(fold())); advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING); m_unfoldAction = new QAction(tr("Unfold"), this); - command = am->registerAction(m_unfoldAction, Constants::UNFOLD, m_contextId, true); + command = Core::ActionManager::registerAction(m_unfoldAction, Constants::UNFOLD, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+>"))); connect(m_unfoldAction, SIGNAL(triggered()), this, SLOT(unfold())); advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING); m_unfoldAllAction = new QAction(tr("Toggle &Fold All"), this); - command = am->registerAction(m_unfoldAllAction, Constants::UNFOLD_ALL, m_contextId, true); + command = Core::ActionManager::registerAction(m_unfoldAllAction, Constants::UNFOLD_ALL, m_contextId, true); connect(m_unfoldAllAction, SIGNAL(triggered()), this, SLOT(unfoldAll())); advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING); m_increaseFontSizeAction = new QAction(tr("Increase Font Size"), this); - command = am->registerAction(m_increaseFontSizeAction, Constants::INCREASE_FONT_SIZE, m_contextId); + command = Core::ActionManager::registerAction(m_increaseFontSizeAction, Constants::INCREASE_FONT_SIZE, m_contextId); command->setDefaultKeySequence(QKeySequence(tr("Ctrl++"))); connect(m_increaseFontSizeAction, SIGNAL(triggered()), this, SLOT(increaseFontSize())); advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT); m_decreaseFontSizeAction = new QAction(tr("Decrease Font Size"), this); - command = am->registerAction(m_decreaseFontSizeAction, Constants::DECREASE_FONT_SIZE, m_contextId); + command = Core::ActionManager::registerAction(m_decreaseFontSizeAction, Constants::DECREASE_FONT_SIZE, m_contextId); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+-"))); connect(m_decreaseFontSizeAction, SIGNAL(triggered()), this, SLOT(decreaseFontSize())); advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT); m_resetFontSizeAction = new QAction(tr("Reset Font Size"), this); - command = am->registerAction(m_resetFontSizeAction, Constants::RESET_FONT_SIZE, m_contextId); + command = Core::ActionManager::registerAction(m_resetFontSizeAction, Constants::RESET_FONT_SIZE, m_contextId); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? QString() : tr("Ctrl+0"))); connect(m_resetFontSizeAction, SIGNAL(triggered()), this, SLOT(resetFontSize())); advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT); m_gotoBlockStartAction = new QAction(tr("Go to Block Start"), this); - command = am->registerAction(m_gotoBlockStartAction, Constants::GOTO_BLOCK_START, m_contextId, true); + command = Core::ActionManager::registerAction(m_gotoBlockStartAction, Constants::GOTO_BLOCK_START, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+["))); connect(m_gotoBlockStartAction, SIGNAL(triggered()), this, SLOT(gotoBlockStart())); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); m_gotoBlockEndAction = new QAction(tr("Go to Block End"), this); - command = am->registerAction(m_gotoBlockEndAction, Constants::GOTO_BLOCK_END, m_contextId, true); + command = Core::ActionManager::registerAction(m_gotoBlockEndAction, Constants::GOTO_BLOCK_END, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+]"))); connect(m_gotoBlockEndAction, SIGNAL(triggered()), this, SLOT(gotoBlockEnd())); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); m_gotoBlockStartWithSelectionAction = new QAction(tr("Go to Block Start with Selection"), this); - command = am->registerAction(m_gotoBlockStartWithSelectionAction, Constants::GOTO_BLOCK_START_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(m_gotoBlockStartWithSelectionAction, Constants::GOTO_BLOCK_START_WITH_SELECTION, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+{"))); connect(m_gotoBlockStartWithSelectionAction, SIGNAL(triggered()), this, SLOT(gotoBlockStartWithSelection())); m_gotoBlockEndWithSelectionAction = new QAction(tr("Go to Block End with Selection"), this); - command = am->registerAction(m_gotoBlockEndWithSelectionAction, Constants::GOTO_BLOCK_END_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(m_gotoBlockEndWithSelectionAction, Constants::GOTO_BLOCK_END_WITH_SELECTION, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+}"))); connect(m_gotoBlockEndWithSelectionAction, SIGNAL(triggered()), this, SLOT(gotoBlockEndWithSelection())); m_selectBlockUpAction = new QAction(tr("Select Block Up"), this); - command = am->registerAction(m_selectBlockUpAction, Constants::SELECT_BLOCK_UP, m_contextId, true); + command = Core::ActionManager::registerAction(m_selectBlockUpAction, Constants::SELECT_BLOCK_UP, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+U"))); connect(m_selectBlockUpAction, SIGNAL(triggered()), this, SLOT(selectBlockUp())); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); m_selectBlockDownAction = new QAction(tr("Select Block Down"), this); - command = am->registerAction(m_selectBlockDownAction, Constants::SELECT_BLOCK_DOWN, m_contextId, true); + command = Core::ActionManager::registerAction(m_selectBlockDownAction, Constants::SELECT_BLOCK_DOWN, m_contextId, true); connect(m_selectBlockDownAction, SIGNAL(triggered()), this, SLOT(selectBlockDown())); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); m_moveLineUpAction = new QAction(tr("Move Line Up"), this); m_modifyingActions << m_moveLineUpAction; - command = am->registerAction(m_moveLineUpAction, Constants::MOVE_LINE_UP, m_contextId, true); + command = Core::ActionManager::registerAction(m_moveLineUpAction, Constants::MOVE_LINE_UP, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Up"))); connect(m_moveLineUpAction, SIGNAL(triggered()), this, SLOT(moveLineUp())); m_moveLineDownAction = new QAction(tr("Move Line Down"), this); m_modifyingActions << m_moveLineDownAction; - command = am->registerAction(m_moveLineDownAction, Constants::MOVE_LINE_DOWN, m_contextId, true); + command = Core::ActionManager::registerAction(m_moveLineDownAction, Constants::MOVE_LINE_DOWN, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Down"))); connect(m_moveLineDownAction, SIGNAL(triggered()), this, SLOT(moveLineDown())); m_copyLineUpAction = new QAction(tr("Copy Line Up"), this); m_modifyingActions << m_copyLineUpAction; - command = am->registerAction(m_copyLineUpAction, Constants::COPY_LINE_UP, m_contextId, true); + command = Core::ActionManager::registerAction(m_copyLineUpAction, Constants::COPY_LINE_UP, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Up"))); connect(m_copyLineUpAction, SIGNAL(triggered()), this, SLOT(copyLineUp())); m_copyLineDownAction = new QAction(tr("Copy Line Down"), this); m_modifyingActions << m_copyLineDownAction; - command = am->registerAction(m_copyLineDownAction, Constants::COPY_LINE_DOWN, m_contextId, true); + command = Core::ActionManager::registerAction(m_copyLineDownAction, Constants::COPY_LINE_DOWN, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Down"))); connect(m_copyLineDownAction, SIGNAL(triggered()), this, SLOT(copyLineDown())); m_joinLinesAction = new QAction(tr("Join Lines"), this); m_modifyingActions << m_joinLinesAction; - command = am->registerAction(m_joinLinesAction, Constants::JOIN_LINES, m_contextId, true); + command = Core::ActionManager::registerAction(m_joinLinesAction, Constants::JOIN_LINES, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+J"))); connect(m_joinLinesAction, SIGNAL(triggered()), this, SLOT(joinLines())); m_insertLineAboveAction = new QAction(tr("Insert Line Above Current Line"), this); m_modifyingActions << m_insertLineAboveAction; - command = am->registerAction(m_insertLineAboveAction, Constants::INSERT_LINE_ABOVE, m_contextId, true); + command = Core::ActionManager::registerAction(m_insertLineAboveAction, Constants::INSERT_LINE_ABOVE, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Return"))); connect(m_insertLineAboveAction, SIGNAL(triggered()), this, SLOT(insertLineAbove())); m_insertLineBelowAction = new QAction(tr("Insert Line Below Current Line"), this); m_modifyingActions << m_insertLineBelowAction; - command = am->registerAction(m_insertLineBelowAction, Constants::INSERT_LINE_BELOW, m_contextId, true); + command = Core::ActionManager::registerAction(m_insertLineBelowAction, Constants::INSERT_LINE_BELOW, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Return"))); connect(m_insertLineBelowAction, SIGNAL(triggered()), this, SLOT(insertLineBelow())); m_upperCaseSelectionAction = new QAction(tr("Uppercase Selection"), this); m_modifyingActions << m_upperCaseSelectionAction; - command = am->registerAction(m_upperCaseSelectionAction, Constants::UPPERCASE_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(m_upperCaseSelectionAction, Constants::UPPERCASE_SELECTION, m_contextId, true); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+U") : tr("Alt+Shift+U"))); connect(m_upperCaseSelectionAction, SIGNAL(triggered()), this, SLOT(uppercaseSelection())); m_lowerCaseSelectionAction = new QAction(tr("Lowercase Selection"), this); m_modifyingActions << m_lowerCaseSelectionAction; - command = am->registerAction(m_lowerCaseSelectionAction, Constants::LOWERCASE_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(m_lowerCaseSelectionAction, Constants::LOWERCASE_SELECTION, m_contextId, true); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+U") : tr("Alt+U"))); connect(m_lowerCaseSelectionAction, SIGNAL(triggered()), this, SLOT(lowercaseSelection())); m_circularPasteAction = new QAction(tr("Paste from Clipboard History"), this); m_modifyingActions << m_circularPasteAction; - command = am->registerAction(m_circularPasteAction, Constants::CIRCULAR_PASTE, m_contextId, true); + command = Core::ActionManager::registerAction(m_circularPasteAction, Constants::CIRCULAR_PASTE, m_contextId, true); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+V"))); connect(m_circularPasteAction, SIGNAL(triggered()), this, SLOT(circularPasteAction())); medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE); m_switchUtf8bomAction = new QAction(this); m_modifyingActions << m_switchUtf8bomAction; - command = am->registerAction(m_switchUtf8bomAction, Constants::SWITCH_UTF8BOM, m_contextId, true); + command = Core::ActionManager::registerAction(m_switchUtf8bomAction, Constants::SWITCH_UTF8BOM, m_contextId, true); connect(m_switchUtf8bomAction, SIGNAL(triggered()), this, SLOT(switchUtf8bomAction())); m_indentAction = new QAction(tr("Indent"), this); m_modifyingActions << m_indentAction; - command = am->registerAction(m_indentAction, Constants::INDENT, m_contextId, true); + command = Core::ActionManager::registerAction(m_indentAction, Constants::INDENT, m_contextId, true); connect(m_indentAction, SIGNAL(triggered()), this, SLOT(indent())); m_unindentAction = new QAction(tr("Unindent"), this); m_modifyingActions << m_unindentAction; - command = am->registerAction(m_unindentAction, Constants::UNINDENT, m_contextId, true); + command = Core::ActionManager::registerAction(m_unindentAction, Constants::UNINDENT, m_contextId, true); connect(m_unindentAction, SIGNAL(triggered()), this, SLOT(unindent())); m_followSymbolAction = new QAction(tr("Follow Symbol Under Cursor"), this); - command = am->registerAction(m_followSymbolAction, Constants::FOLLOW_SYMBOL_UNDER_CURSOR, m_contextId, true); + command = Core::ActionManager::registerAction(m_followSymbolAction, Constants::FOLLOW_SYMBOL_UNDER_CURSOR, m_contextId, true); command->setDefaultKeySequence(QKeySequence(Qt::Key_F2)); connect(m_followSymbolAction, SIGNAL(triggered()), this, SLOT(openLinkUnderCursor())); m_jumpToFileAction = new QAction(tr("Jump To File Under Cursor"), this); - command = am->registerAction(m_jumpToFileAction, Constants::JUMP_TO_FILE_UNDER_CURSOR, m_contextId, true); + command = Core::ActionManager::registerAction(m_jumpToFileAction, Constants::JUMP_TO_FILE_UNDER_CURSOR, m_contextId, true); command->setDefaultKeySequence(QKeySequence(Qt::Key_F2)); connect(m_jumpToFileAction, SIGNAL(triggered()), this, SLOT(openLinkUnderCursor())); QAction *a = 0; a = new QAction(tr("Go to Line Start"), this); - command = am->registerAction(a, Constants::GOTO_LINE_START, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_LINE_START, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStart())); a = new QAction(tr("Go to Line End"), this); - command = am->registerAction(a, Constants::GOTO_LINE_END, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_LINE_END, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEnd())); a = new QAction(tr("Go to Next Line"), this); - command = am->registerAction(a, Constants::GOTO_NEXT_LINE, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_LINE, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLine())); a = new QAction(tr("Go to Previous Line"), this); - command = am->registerAction(a, Constants::GOTO_PREVIOUS_LINE, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_LINE, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLine())); a = new QAction(tr("Go to Previous Character"), this); - command = am->registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacter())); a = new QAction(tr("Go to Next Character"), this); - command = am->registerAction(a, Constants::GOTO_NEXT_CHARACTER, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_CHARACTER, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacter())); a = new QAction(tr("Go to Previous Word"), this); - command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_WORD, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWord())); a = new QAction(tr("Go to Next Word"), this); - command = am->registerAction(a, Constants::GOTO_NEXT_WORD, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_WORD, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWord())); a = new QAction(tr("Go to Previous Word Camel Case"), this); - command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD_CAMEL_CASE, m_contextId); + command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_WORD_CAMEL_CASE, m_contextId); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordCamelCase())); a = new QAction(tr("Go to Next Word Camel Case"), this); - command = am->registerAction(a, Constants::GOTO_NEXT_WORD_CAMEL_CASE, m_contextId); + command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_WORD_CAMEL_CASE, m_contextId); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordCamelCase())); a = new QAction(tr("Go to Line Start with Selection"), this); - command = am->registerAction(a, Constants::GOTO_LINE_START_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_LINE_START_WITH_SELECTION, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStartWithSelection())); a = new QAction(tr("Go to Line End with Selection"), this); - command = am->registerAction(a, Constants::GOTO_LINE_END_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_LINE_END_WITH_SELECTION, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEndWithSelection())); a = new QAction(tr("Go to Next Line with Selection"), this); - command = am->registerAction(a, Constants::GOTO_NEXT_LINE_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_LINE_WITH_SELECTION, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLineWithSelection())); a = new QAction(tr("Go to Previous Line with Selection"), this); - command = am->registerAction(a, Constants::GOTO_PREVIOUS_LINE_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_LINE_WITH_SELECTION, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLineWithSelection())); a = new QAction(tr("Go to Previous Character with Selection"), this); - command = am->registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER_WITH_SELECTION, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacterWithSelection())); a = new QAction(tr("Go to Next Character with Selection"), this); - command = am->registerAction(a, Constants::GOTO_NEXT_CHARACTER_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_CHARACTER_WITH_SELECTION, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacterWithSelection())); a = new QAction(tr("Go to Previous Word with Selection"), this); - command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_WORD_WITH_SELECTION, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordWithSelection())); a = new QAction(tr("Go to Next Word with Selection"), this); - command = am->registerAction(a, Constants::GOTO_NEXT_WORD_WITH_SELECTION, m_contextId, true); + command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_WORD_WITH_SELECTION, m_contextId, true); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordWithSelection())); a = new QAction(tr("Go to Previous Word Camel Case with Selection"), this); - command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION, m_contextId); + command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION, m_contextId); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordCamelCaseWithSelection())); a = new QAction(tr("Go to Next Word Camel Case with Selection"), this); - command = am->registerAction(a, Constants::GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION, m_contextId); + command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION, m_contextId); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordCamelCaseWithSelection())); } @@ -475,7 +473,7 @@ QAction *TextEditorActionHandler::registerNewAction(const Core::Id &id, bool scr return 0; QAction *result = new QAction(title, this); - Core::ICore::actionManager()->registerAction(result, id, m_contextId, scriptable); + Core::ActionManager::registerAction(result, id, m_contextId, scriptable); return result; } diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 865f4307d7..7d8cdc9a63 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -181,14 +181,13 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe addAutoReleasedObject(m_lineNumberFilter); Core::Context context(TextEditor::Constants::C_TEXTEDITOR); - Core::ActionManager *am = Core::ICore::actionManager(); // Add shortcut for invoking automatic completion QShortcut *completionShortcut = new QShortcut(Core::ICore::mainWindow()); completionShortcut->setWhatsThis(tr("Triggers a completion in this scope")); // Make sure the shortcut still works when the completion widget is active completionShortcut->setContext(Qt::ApplicationShortcut); - Core::Command *command = am->registerShortcut(completionShortcut, Constants::COMPLETE_THIS, context); + Core::Command *command = Core::ActionManager::registerShortcut(completionShortcut, Constants::COMPLETE_THIS, context); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Space") : tr("Ctrl+Space"))); connect(completionShortcut, SIGNAL(activated()), this, SLOT(invokeCompletion())); @@ -197,7 +196,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe quickFixShortcut->setWhatsThis(tr("Triggers a quick fix in this scope")); // Make sure the shortcut still works when the quick fix widget is active quickFixShortcut->setContext(Qt::ApplicationShortcut); - Core::Command *quickFixCommand = am->registerShortcut(quickFixShortcut, Constants::QUICKFIX_THIS, context); + Core::Command *quickFixCommand = Core::ActionManager::registerShortcut(quickFixShortcut, Constants::QUICKFIX_THIS, context); quickFixCommand->setDefaultKeySequence(QKeySequence(tr("Alt+Return"))); connect(quickFixShortcut, SIGNAL(activated()), this, SLOT(invokeQuickFix())); diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp index f64b20cf9d..658c220317 100644 --- a/src/plugins/updateinfo/updateinfoplugin.cpp +++ b/src/plugins/updateinfo/updateinfoplugin.cpp @@ -142,7 +142,7 @@ bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString * return false; } - Core::ActionContainer* const helpActionContainer = Core::ICore::actionManager()->actionContainer(Core::Constants::M_HELP); + Core::ActionContainer* const helpActionContainer = Core::ActionManager::actionContainer(Core::Constants::M_HELP); helpActionContainer->menu()->addAction(tr("Start Updater"), this, SLOT(startUpdaterUiApplication())); //wait some time before we want to have the first check diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp index ca84ccf347..1899acdd9f 100644 --- a/src/plugins/valgrind/callgrindtool.cpp +++ b/src/plugins/valgrind/callgrindtool.cpp @@ -538,26 +538,24 @@ IAnalyzerTool::ToolMode CallgrindTool::toolMode() const void CallgrindTool::extensionsInitialized() { - Core::ActionManager *actionManager = Core::ICore::actionManager(); - Core::Context analyzerContext = Core::Context(Analyzer::Constants::C_ANALYZEMODE); // check if there is a CppEditor context menu, if true, add our own context menu actions if (Core::ActionContainer *editorContextMenu = - actionManager->actionContainer(CppEditor::Constants::M_CONTEXT)) { + Core::ActionManager::actionContainer(CppEditor::Constants::M_CONTEXT)) { QAction *action = 0; Core::Command *cmd = 0; action = new QAction(this); action->setSeparator(true); - cmd = actionManager->registerAction(action, "Analyzer.Callgrind.ContextMenu.Sep", + cmd = Core::ActionManager::registerAction(action, "Analyzer.Callgrind.ContextMenu.Sep", analyzerContext); editorContextMenu->addAction(cmd); action = new QAction(tr("Profile Costs of this Function and its Callees"), this); action->setIcon(QIcon(Analyzer::Constants::ANALYZER_CONTROL_START_ICON)); connect(action, SIGNAL(triggered()), d, SLOT(handleShowCostsOfFunction())); - cmd = actionManager->registerAction(action, "Analyzer.Callgrind.ShowCostsOfFunction", + cmd = Core::ActionManager::registerAction(action, "Analyzer.Callgrind.ShowCostsOfFunction", analyzerContext); editorContextMenu->addAction(cmd); cmd->setAttribute(Core::Command::CA_Hide); |