forked from qt-creator/qt-creator
ActionManager API cleanup.
d-pointer instead of inheritance static methods Change-Id: I7b2f0c8b05ad3951e1ff26a7d4e08e195d2dd258 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user