Commit f80e5800 authored by hjk's avatar hjk
Browse files

Avoid Id->QString->Id round trip in macrohandler setup



A minor glitch in the startup profile.

Change-Id: I2195530e922b3fb37dbfadc800933a9378491833
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 16844e1f
...@@ -254,7 +254,7 @@ Command *ActionManager::registerAction(QAction *action, Id id, const Context &co ...@@ -254,7 +254,7 @@ Command *ActionManager::registerAction(QAction *action, Id id, const Context &co
if (a) { if (a) {
a->addOverrideAction(action, context, scriptable); a->addOverrideAction(action, context, scriptable);
emit m_instance->commandListChanged(); emit m_instance->commandListChanged();
emit m_instance->commandAdded(id.toString()); emit m_instance->commandAdded(id);
} }
return a; return a;
} }
......
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
signals: signals:
void commandListChanged(); void commandListChanged();
void commandAdded(const QString &id); void commandAdded(Core::Id id);
private: private:
ActionManager(QObject *parent = 0); ActionManager(QObject *parent = 0);
......
...@@ -59,8 +59,8 @@ ActionMacroHandler::ActionMacroHandler(): ...@@ -59,8 +59,8 @@ ActionMacroHandler::ActionMacroHandler():
connect(m_mapper, SIGNAL(mapped(QString)), connect(m_mapper, SIGNAL(mapped(QString)),
this, SLOT(addActionEvent(QString))); this, SLOT(addActionEvent(QString)));
connect(ActionManager::instance(), SIGNAL(commandAdded(QString)), connect(ActionManager::instance(), &ActionManager::commandAdded,
this, SLOT(addCommand(QString))); this, &ActionMacroHandler::addCommand);
// Register all existing scriptable actions // Register all existing scriptable actions
QList<Command *> commands = ActionManager::commands(); QList<Command *> commands = ActionManager::commands();
...@@ -113,9 +113,8 @@ void ActionMacroHandler::registerCommand(Id id) ...@@ -113,9 +113,8 @@ void ActionMacroHandler::registerCommand(Id id)
} }
} }
void ActionMacroHandler::addCommand(const QString &name) void ActionMacroHandler::addCommand(Id id)
{ {
const Id id = Id::fromString(name);
const Command *command = ActionManager::command(id); const Command *command = ActionManager::command(id);
if (command->isScriptable()) if (command->isScriptable())
registerCommand(id); registerCommand(id);
......
...@@ -55,13 +55,13 @@ public: ...@@ -55,13 +55,13 @@ public:
bool canExecuteEvent(const MacroEvent &macroEvent); bool canExecuteEvent(const MacroEvent &macroEvent);
bool executeEvent(const MacroEvent &macroEvent); bool executeEvent(const MacroEvent &macroEvent);
private slots:
void addActionEvent(const QString &id);
private: private:
void registerCommand(Core::Id id); void registerCommand(Core::Id id);
Core::Command *command(const QString &id); Core::Command *command(const QString &id);
void addCommand(Core::Id id);
private slots:
void addCommand(const QString &id);
void addActionEvent(const QString &id);
private: private:
QSet<Core::Id> m_commandIds; QSet<Core::Id> m_commandIds;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment