aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/macros/actionmacrohandler.cpp
diff options
context:
space:
mode:
authorEike Ziller <[email protected]>2012-05-24 13:49:06 +0200
committerhjk <[email protected]>2012-05-25 10:08:24 +0200
commit3934347fe9ed7e1567c3ff377f857928e8b03304 (patch)
tree09f1ccaf1af2d8032bb12ea0a5a05b4b4185d431 /src/plugins/macros/actionmacrohandler.cpp
parent7c7ccdc764629042729ceede4ca3e47b464aee42 (diff)
ActionManager API cleanup.
d-pointer instead of inheritance static methods Change-Id: I7b2f0c8b05ad3951e1ff26a7d4e08e195d2dd258 Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/macros/actionmacrohandler.cpp')
-rw-r--r--src/plugins/macros/actionmacrohandler.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/plugins/macros/actionmacrohandler.cpp b/src/plugins/macros/actionmacrohandler.cpp
index f425b8fb851..765cab12bc0 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 &macroEvent)
bool ActionMacroHandler::executeEvent(const MacroEvent &macroEvent)
{
- 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);
}