diff options
author | hjk <qtc-committer@nokia.com> | 2012-01-24 15:36:40 +0100 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-01-24 18:48:47 +0100 |
commit | 4a21f0c3c8b30cd0bc5957110506e304c629a99b (patch) | |
tree | 3d2477e3f1485ccaa319557bb2229e3f34324867 /src/plugins/macros | |
parent | c14a4756a92586424f0f1a00c6134e441db50afd (diff) | |
download | qt-creator-4a21f0c3c8b30cd0bc5957110506e304c629a99b.tar.gz |
Use new static ICore interface.
Change-Id: I9b690d9b150c8d162b15370f9f8986267c9128f1
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Diffstat (limited to 'src/plugins/macros')
-rw-r--r-- | src/plugins/macros/actionmacrohandler.cpp | 15 | ||||
-rw-r--r-- | src/plugins/macros/macromanager.cpp | 27 | ||||
-rw-r--r-- | src/plugins/macros/macrooptionswidget.cpp | 3 | ||||
-rw-r--r-- | src/plugins/macros/macrosplugin.cpp | 3 | ||||
-rw-r--r-- | src/plugins/macros/texteditormacrohandler.cpp | 4 |
5 files changed, 21 insertions, 31 deletions
diff --git a/src/plugins/macros/actionmacrohandler.cpp b/src/plugins/macros/actionmacrohandler.cpp index 8253527b55..3a009adbf1 100644 --- a/src/plugins/macros/actionmacrohandler.cpp +++ b/src/plugins/macros/actionmacrohandler.cpp @@ -64,8 +64,7 @@ ActionMacroHandler::ActionMacroHandler(): connect(m_mapper, SIGNAL(mapped(const QString &)), this, SLOT(addActionEvent(const QString &))); - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); connect(am, SIGNAL(commandAdded(QString)), this, SLOT(addCommand(QString))); @@ -86,8 +85,7 @@ bool ActionMacroHandler::canExecuteEvent(const MacroEvent ¯oEvent) bool ActionMacroHandler::executeEvent(const MacroEvent ¯oEvent) { - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); QAction *action = am->command(Core::Id(macroEvent.value(ACTIONNAME).toString()))->action(); if (!action) @@ -102,8 +100,7 @@ void ActionMacroHandler::addActionEvent(const QString &id) if (!isRecording()) return; - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); const Core::Command *cmd = am->command(Core::Id(id)); if (cmd->isScriptable(cmd->context())) { MacroEvent e; @@ -117,8 +114,7 @@ void ActionMacroHandler::registerCommand(const QString &id) { if (!m_commandIds.contains(id)) { m_commandIds.insert(id); - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); QAction* action = am->command(Core::Id(id))->action(); if (action) { connect(action, SIGNAL(triggered()), m_mapper, SLOT(map())); @@ -135,8 +131,7 @@ void ActionMacroHandler::registerCommand(const QString &id) void ActionMacroHandler::addCommand(const QString &id) { - const Core::ICore *core = Core::ICore::instance(); - const Core::ActionManager *am = core->actionManager(); + const Core::ActionManager *am = Core::ICore::actionManager(); if (am->command(Core::Id(id))->isScriptable()) registerCommand(id); } diff --git a/src/plugins/macros/macromanager.cpp b/src/plugins/macros/macromanager.cpp index 2c3ef74860..0951f08599 100644 --- a/src/plugins/macros/macromanager.cpp +++ b/src/plugins/macros/macromanager.cpp @@ -163,9 +163,8 @@ void MacroManager::MacroManagerPrivate::addMacro(Macro *macro) { // Add sortcut Core::Context context(TextEditor::Constants::C_TEXTEDITOR); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); - QShortcut *shortcut = new QShortcut(core->mainWindow()); + 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); @@ -181,8 +180,7 @@ void MacroManager::MacroManagerPrivate::removeMacro(const QString &name) if (!macros.contains(name)) return; // Remove shortcut - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->unregisterShortcut(Core::Id(Constants::PREFIX_MACRO+name)); // Remove macro from the map @@ -195,11 +193,10 @@ void MacroManager::MacroManagerPrivate::changeMacroDescription(Macro *macro, con if (!macro->load()) return; macro->setDescription(description); - macro->save(macro->fileName(), Core::ICore::instance()->mainWindow()); + macro->save(macro->fileName(), Core::ICore::mainWindow()); // Change shortcut what's this - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::Command *command = am->command(Core::Id(Constants::PREFIX_MACRO+macro->displayName())); if (command && command->shortcut()) @@ -222,7 +219,7 @@ bool MacroManager::MacroManagerPrivate::executeMacro(Macro *macro) } if (error) { - QMessageBox::warning(Core::ICore::instance()->mainWindow(), + QMessageBox::warning(Core::ICore::mainWindow(), tr("Playing Macro"), tr("An error occurred while replaying the macro, execution stopped.")); } @@ -238,7 +235,7 @@ bool MacroManager::MacroManagerPrivate::executeMacro(Macro *macro) void MacroManager::MacroManagerPrivate::showSaveDialog() { - QMainWindow *mainWindow = Core::ICore::instance()->mainWindow(); + QMainWindow *mainWindow = Core::ICore::mainWindow(); SaveDialog dialog(mainWindow); if (dialog.exec()) { if (dialog.name().isEmpty()) @@ -288,7 +285,7 @@ void MacroManager::startMacro() delete d->currentMacro; d->currentMacro = new Macro; - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + 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); @@ -310,7 +307,7 @@ void MacroManager::endMacro() { Core::EditorManager::instance()->hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER)); - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + 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); @@ -327,7 +324,7 @@ void MacroManager::executeLastMacro() return; // make sure the macro doesn't accidentally invoke a macro action - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + 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); @@ -356,7 +353,7 @@ bool MacroManager::executeMacro(const QString &name) delete d->currentMacro; d->currentMacro = macro; - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); return true; @@ -407,7 +404,7 @@ void Macros::MacroManager::saveLastMacro() QString Macros::MacroManager::macrosDirectory() const { const QString &path = - Core::ICore::instance()->userResourcePath() + QLatin1String("/macros"); + Core::ICore::userResourcePath() + QLatin1String("/macros"); if (QFile::exists(path) || QDir().mkpath(path)) return path; return QString(); diff --git a/src/plugins/macros/macrooptionswidget.cpp b/src/plugins/macros/macrooptionswidget.cpp index 00e255653e..7154071b90 100644 --- a/src/plugins/macros/macrooptionswidget.cpp +++ b/src/plugins/macros/macrooptionswidget.cpp @@ -102,8 +102,7 @@ void MacroOptionsWidget::initialize() void MacroOptionsWidget::createTable() { QDir dir(MacroManager::instance()->macrosDirectory()); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); QMapIterator<QString, Macro *> it(MacroManager::instance()->macros()); while (it.hasNext()) { diff --git a/src/plugins/macros/macrosplugin.cpp b/src/plugins/macros/macrosplugin.cpp index 7d9962342c..d29d02a79e 100644 --- a/src/plugins/macros/macrosplugin.cpp +++ b/src/plugins/macros/macrosplugin.cpp @@ -72,8 +72,7 @@ bool MacrosPlugin::initialize(const QStringList &arguments, QString *errorMessag addAutoReleasedObject(new MacroOptionsPage); addAutoReleasedObject(new MacroLocatorFilter); - Core::ICore *core = Core::ICore::instance(); - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context textContext(TextEditor::Constants::C_TEXTEDITOR); diff --git a/src/plugins/macros/texteditormacrohandler.cpp b/src/plugins/macros/texteditormacrohandler.cpp index 22073930fa..11d58f3e80 100644 --- a/src/plugins/macros/texteditormacrohandler.cpp +++ b/src/plugins/macros/texteditormacrohandler.cpp @@ -78,7 +78,7 @@ void TextEditorMacroHandler::startRecording(Macros::Macro *macro) m_currentEditor->widget()->installEventFilter(this); // Block completion - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(true); } @@ -89,7 +89,7 @@ void TextEditorMacroHandler::endRecordingMacro(Macros::Macro *macro) IMacroHandler::endRecordingMacro(macro); // Unblock completion - Core::ActionManager *am = Core::ICore::instance()->actionManager(); + Core::ActionManager *am = Core::ICore::actionManager(); am->command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(false); } |