Commit 3934347f authored by Eike Ziller's avatar Eike Ziller Committed by hjk

ActionManager API cleanup.

d-pointer instead of inheritance
static methods

Change-Id: I7b2f0c8b05ad3951e1ff26a7d4e08e195d2dd258
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 7c7ccdc7
......@@ -170,13 +170,13 @@
\row
\o Add a menu or menu item.
\o You can extend existing menus or create new ones.
\o \l{Core::ActionManager}, \l{Core::Command}, \l{Core::ICore::actionManager()}
\o \l{Core::ActionManager}, \l{Core::Command}
\row
\o Add a configurable keyboard shortcut.
\o Registering shortcuts makes it possible for users to configure them in
the common shortcut settings dialog.
\o \l{Core::ActionManager}, \l{Core::Command}, \l{Core::ICore::actionManager()}
\o \l{Core::ActionManager}, \l{Core::Command}
\row
\o Add a mode.
......
......@@ -39,18 +39,17 @@ bool %PluginName%Plugin::initialize(const QStringList &arguments, QString *error
Q_UNUSED(arguments)
Q_UNUSED(errorString)
Core::ActionManager *am = Core::ICore::actionManager();
QAction *action = new QAction(tr("%PluginName% action"), this);
Core::Command *cmd = am->registerAction(action, Constants::ACTION_ID,
Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID,
Core::Context(Core::Constants::C_GLOBAL));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A")));
connect(action, SIGNAL(triggered()), this, SLOT(triggerAction()));
Core::ActionContainer *menu = am->createMenu(Constants::MENU_ID);
Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID);
menu->menu()->setTitle(tr("%PluginName%"));
menu->addAction(cmd);
am->actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
return true;
}
......
......@@ -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.
......
This diff is collapsed.
......@@ -139,7 +139,6 @@ private:
BazaarClient *m_client;
Locator::CommandLocator *m_commandLocator;
Core::ActionManager *m_actionManager;
Core::ActionContainer *m_bazaarContainer;
QList<QAction *> m_repositoryActionList;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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())
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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
......
......@@ -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;
};
......
......@@ -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"
......
......@@ -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);
}
}
......
......@@ -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())
......
......@@ -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()
......
......@@ -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());
......
......@@ -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();
......
This diff is collapsed.