ActionManager API cleanup.

d-pointer instead of inheritance
static methods

Change-Id: I7b2f0c8b05ad3951e1ff26a7d4e08e195d2dd258
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Eike Ziller
2012-05-24 13:49:06 +02:00
committed by hjk
parent 7c7ccdc764
commit 3934347fe9
78 changed files with 1198 additions and 1338 deletions

View File

@@ -170,13 +170,13 @@
\row \row
\o Add a menu or menu item. \o Add a menu or menu item.
\o You can extend existing menus or create new ones. \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 \row
\o Add a configurable keyboard shortcut. \o Add a configurable keyboard shortcut.
\o Registering shortcuts makes it possible for users to configure them in \o Registering shortcuts makes it possible for users to configure them in
the common shortcut settings dialog. the common shortcut settings dialog.
\o \l{Core::ActionManager}, \l{Core::Command}, \l{Core::ICore::actionManager()} \o \l{Core::ActionManager}, \l{Core::Command}
\row \row
\o Add a mode. \o Add a mode.

View File

@@ -39,18 +39,17 @@ bool %PluginName%Plugin::initialize(const QStringList &arguments, QString *error
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(errorString) Q_UNUSED(errorString)
Core::ActionManager *am = Core::ICore::actionManager();
QAction *action = new QAction(tr("%PluginName% action"), this); 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)); Core::Context(Core::Constants::C_GLOBAL));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A")));
connect(action, SIGNAL(triggered()), this, SLOT(triggerAction())); 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->menu()->setTitle(tr("%PluginName%"));
menu->addAction(cmd); menu->addAction(cmd);
am->actionContainer(Core::Constants::M_TOOLS)->addMenu(menu); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(menu);
return true; return true;
} }

View File

@@ -258,12 +258,11 @@ AnalyzerManagerPrivate::~AnalyzerManagerPrivate()
void AnalyzerManagerPrivate::setupActions() void AnalyzerManagerPrivate::setupActions()
{ {
ActionManager *am = ICore::actionManager();
const Context globalcontext(C_GLOBAL); const Context globalcontext(C_GLOBAL);
Command *command = 0; Command *command = 0;
// Menus // 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()->setTitle(tr("&Analyze"));
m_menu->menu()->setEnabled(true); m_menu->menu()->setEnabled(true);
@@ -272,36 +271,36 @@ void AnalyzerManagerPrivate::setupActions()
m_menu->appendGroup(G_ANALYZER_REMOTE_TOOLS); m_menu->appendGroup(G_ANALYZER_REMOTE_TOOLS);
m_menu->appendGroup(G_ANALYZER_OPTIONS); m_menu->appendGroup(G_ANALYZER_OPTIONS);
ActionContainer *menubar = am->actionContainer(MENU_BAR); ActionContainer *menubar = Core::ActionManager::actionContainer(MENU_BAR);
ActionContainer *mtools = am->actionContainer(M_TOOLS); ActionContainer *mtools = Core::ActionManager::actionContainer(M_TOOLS);
menubar->addMenu(mtools, m_menu); menubar->addMenu(mtools, m_menu);
m_startAction = new QAction(tr("Start"), m_menu); m_startAction = new QAction(tr("Start"), m_menu);
m_startAction->setIcon(QIcon(QLatin1String(ANALYZER_CONTROL_START_ICON))); 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())); connect(m_startAction, SIGNAL(triggered()), this, SLOT(startTool()));
m_stopAction = new QAction(tr("Stop"), m_menu); m_stopAction = new QAction(tr("Stop"), m_menu);
m_stopAction->setEnabled(false); m_stopAction->setEnabled(false);
m_stopAction->setIcon(QIcon(QLatin1String(ANALYZER_CONTROL_STOP_ICON))); 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); m_menu->addAction(command, G_ANALYZER_CONTROL);
QAction *separatorAction1 = new QAction(m_menu); QAction *separatorAction1 = new QAction(m_menu);
separatorAction1->setSeparator(true); separatorAction1->setSeparator(true);
command = am->registerAction(separatorAction1, command = Core::ActionManager::registerAction(separatorAction1,
"Menu.Action.Analyzer.Tools.Separator1", globalcontext); "Menu.Action.Analyzer.Tools.Separator1", globalcontext);
m_menu->addAction(command, G_ANALYZER_TOOLS); m_menu->addAction(command, G_ANALYZER_TOOLS);
QAction *separatorAction2 = new QAction(m_menu); QAction *separatorAction2 = new QAction(m_menu);
separatorAction2->setSeparator(true); separatorAction2->setSeparator(true);
command = am->registerAction(separatorAction2, command = Core::ActionManager::registerAction(separatorAction2,
"Menu.Action.Analyzer.Tools.Separator2", globalcontext); "Menu.Action.Analyzer.Tools.Separator2", globalcontext);
m_menu->addAction(command, G_ANALYZER_REMOTE_TOOLS); m_menu->addAction(command, G_ANALYZER_REMOTE_TOOLS);
QAction *separatorAction3 = new QAction(m_menu); QAction *separatorAction3 = new QAction(m_menu);
separatorAction3->setSeparator(true); separatorAction3->setSeparator(true);
command = am->registerAction(separatorAction3, command = Core::ActionManager::registerAction(separatorAction3,
"Menu.Action.Analyzer.Tools.Separator3", globalcontext); "Menu.Action.Analyzer.Tools.Separator3", globalcontext);
m_menu->addAction(command, G_ANALYZER_OPTIONS); m_menu->addAction(command, G_ANALYZER_OPTIONS);
} }
@@ -334,21 +333,20 @@ void AnalyzerManagerPrivate::delayedInit()
// Populate Windows->Views menu with standard actions. // Populate Windows->Views menu with standard actions.
Context analyzerContext(C_ANALYZEMODE); Context analyzerContext(C_ANALYZEMODE);
ActionManager *am = ICore::actionManager(); ActionContainer *viewsMenu = Core::ActionManager::actionContainer(Id(M_WINDOW_VIEWS));
ActionContainer *viewsMenu = am->actionContainer(Id(M_WINDOW_VIEWS)); Command *cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator1(),
Command *cmd = am->registerAction(m_mainWindow->menuSeparator1(),
Id("Analyzer.Views.Separator1"), analyzerContext); Id("Analyzer.Views.Separator1"), analyzerContext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE); viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = am->registerAction(m_mainWindow->toggleLockedAction(), cmd = Core::ActionManager::registerAction(m_mainWindow->toggleLockedAction(),
Id("Analyzer.Views.ToggleLocked"), analyzerContext); Id("Analyzer.Views.ToggleLocked"), analyzerContext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE); viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = am->registerAction(m_mainWindow->menuSeparator2(), cmd = Core::ActionManager::registerAction(m_mainWindow->menuSeparator2(),
Id("Analyzer.Views.Separator2"), analyzerContext); Id("Analyzer.Views.Separator2"), analyzerContext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE); viewsMenu->addAction(cmd, G_DEFAULT_THREE);
cmd = am->registerAction(m_mainWindow->resetLayoutAction(), cmd = Core::ActionManager::registerAction(m_mainWindow->resetLayoutAction(),
Id("Analyzer.Views.ResetSimple"), analyzerContext); Id("Analyzer.Views.ResetSimple"), analyzerContext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
viewsMenu->addAction(cmd, G_DEFAULT_THREE); viewsMenu->addAction(cmd, G_DEFAULT_THREE);
@@ -428,22 +426,20 @@ void AnalyzerManagerPrivate::activateDock(Qt::DockWidgetArea area, QDockWidget *
Context globalContext(C_GLOBAL); Context globalContext(C_GLOBAL);
ActionManager *am = ICore::actionManager();
QAction *toggleViewAction = dockWidget->toggleViewAction(); QAction *toggleViewAction = dockWidget->toggleViewAction();
toggleViewAction->setText(dockWidget->windowTitle()); toggleViewAction->setText(dockWidget->windowTitle());
Command *cmd = am->registerAction(toggleViewAction, Command *cmd = Core::ActionManager::registerAction(toggleViewAction,
Id(QLatin1String("Analyzer.") + dockWidget->objectName()), globalContext); Id(QLatin1String("Analyzer.") + dockWidget->objectName()), globalContext);
cmd->setAttribute(Command::CA_Hide); 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); viewsMenu->addAction(cmd);
} }
void AnalyzerManagerPrivate::deactivateDock(QDockWidget *dockWidget) void AnalyzerManagerPrivate::deactivateDock(QDockWidget *dockWidget)
{ {
ActionManager *am = ICore::actionManager();
QAction *toggleViewAction = dockWidget->toggleViewAction(); 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); m_mainWindow->removeDockWidget(dockWidget);
dockWidget->hide(); dockWidget->hide();
// Prevent saveState storing the data of the wrong children. // 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. delayedInit(); // Make sure that there is a valid IMode instance.
const bool blocked = m_toolBox->blockSignals(true); // Do not make current. const bool blocked = m_toolBox->blockSignals(true); // Do not make current.
ActionManager *am = ICore::actionManager();
foreach (StartMode mode, modes) { foreach (StartMode mode, modes) {
QString actionName = tool->actionName(mode); QString actionName = tool->actionName(mode);
Id menuGroup = tool->menuGroup(mode); Id menuGroup = tool->menuGroup(mode);
Id actionId = tool->actionId(mode); Id actionId = tool->actionId(mode);
QAction *action = new QAction(actionName, 0); 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); m_menu->addAction(command, menuGroup);
command->action()->setData(int(StartLocal)); command->action()->setData(int(StartLocal));
// Assuming this happens before project loading. // Assuming this happens before project loading.

View File

@@ -155,8 +155,6 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
m_client = new BazaarClient(&m_bazaarSettings); m_client = new BazaarClient(&m_bazaarSettings);
initializeVcs(new BazaarControl(m_client)); initializeVcs(new BazaarControl(m_client));
m_actionManager = Core::ICore::actionManager();
m_optionsPage = new OptionsPage(); m_optionsPage = new OptionsPage();
addAutoReleasedObject(m_optionsPage); addAutoReleasedObject(m_optionsPage);
m_bazaarSettings.readSettings(Core::ICore::settings()); m_bazaarSettings.readSettings(Core::ICore::settings());
@@ -214,7 +212,7 @@ void BazaarPlugin::createMenu()
Core::Context context(Core::Constants::C_GLOBAL); Core::Context context(Core::Constants::C_GLOBAL);
// Create menu item for Bazaar // Create menu item for Bazaar
m_bazaarContainer = m_actionManager->createMenu(Core::Id("Bazaar.BazaarMenu")); m_bazaarContainer = Core::ActionManager::createMenu(Core::Id("Bazaar.BazaarMenu"));
QMenu *menu = m_bazaarContainer->menu(); QMenu *menu = m_bazaarContainer->menu();
menu->setTitle(tr("Bazaar")); menu->setTitle(tr("Bazaar"));
@@ -226,7 +224,7 @@ void BazaarPlugin::createMenu()
createSeparator(context, Core::Id("Bazaar.Repository Management")); createSeparator(context, Core::Id("Bazaar.Repository Management"));
// Request the Tools menu and add the Bazaar menu to it // Request the Tools menu and add the Bazaar menu to it
Core::ActionContainer *toolsMenu = m_actionManager->actionContainer(Core::Id(Core::Constants::M_TOOLS)); Core::ActionContainer *toolsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_TOOLS));
toolsMenu->addMenu(m_bazaarContainer); toolsMenu->addMenu(m_bazaarContainer);
m_menuAction = m_bazaarContainer->menu()->menuAction(); m_menuAction = m_bazaarContainer->menu()->menuAction();
} }
@@ -236,14 +234,14 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
Core::Command *command; Core::Command *command;
m_annotateFile = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_annotateFile = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_annotateFile, Core::Id(Constants::ANNOTATE), context); command = Core::ActionManager::registerAction(m_annotateFile, Core::Id(Constants::ANNOTATE), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile())); connect(m_annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_diffFile = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_diffFile, Core::Id(Constants::DIFF), context); command = Core::ActionManager::registerAction(m_diffFile, Core::Id(Constants::DIFF), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+D") : tr("ALT+Z,Alt+D"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+D") : tr("ALT+Z,Alt+D")));
connect(m_diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); connect(m_diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
@@ -251,7 +249,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_logFile = new Utils::ParameterAction(tr("Log Current File"), tr("Log \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_logFile = new Utils::ParameterAction(tr("Log Current File"), tr("Log \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_logFile, Core::Id(Constants::LOG), context); command = Core::ActionManager::registerAction(m_logFile, Core::Id(Constants::LOG), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+L") : tr("ALT+Z,Alt+L"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+L") : tr("ALT+Z,Alt+L")));
connect(m_logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile())); connect(m_logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile()));
@@ -259,7 +257,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_statusFile = new Utils::ParameterAction(tr("Status Current File"), tr("Status \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_statusFile, Core::Id(Constants::STATUS), context); command = Core::ActionManager::registerAction(m_statusFile, Core::Id(Constants::STATUS), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+S") : tr("ALT+Z,Alt+S"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+S") : tr("ALT+Z,Alt+S")));
connect(m_statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile())); connect(m_statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile()));
@@ -269,21 +267,21 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
createSeparator(context, Core::Id("Bazaar.FileDirSeperator1")); createSeparator(context, Core::Id("Bazaar.FileDirSeperator1"));
m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_addAction, Core::Id(Constants::ADD), context); command = Core::ActionManager::registerAction(m_addAction, Core::Id(Constants::ADD), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile())); connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_deleteAction, Core::Id(Constants::DELETE), context); command = Core::ActionManager::registerAction(m_deleteAction, Core::Id(Constants::DELETE), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); m_revertFile = new Utils::ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = m_actionManager->registerAction(m_revertFile, Core::Id(Constants::REVERT), context); command = Core::ActionManager::registerAction(m_revertFile, Core::Id(Constants::REVERT), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); connect(m_revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
@@ -348,28 +346,28 @@ void BazaarPlugin::createDirectoryActions(const Core::Context &context)
action = new QAction(tr("Diff"), this); action = new QAction(tr("Diff"), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::DIFFMULTI), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::DIFFMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(diffRepository())); connect(action, SIGNAL(triggered()), this, SLOT(diffRepository()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Log"), this); action = new QAction(tr("Log"), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::LOGMULTI), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::LOGMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(logRepository())); connect(action, SIGNAL(triggered()), this, SLOT(logRepository()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Revert..."), this); action = new QAction(tr("Revert..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::REVERTMULTI), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::REVERTMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(revertAll())); connect(action, SIGNAL(triggered()), this, SLOT(revertAll()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Status"), this); action = new QAction(tr("Status"), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::STATUSMULTI), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::STATUSMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(statusMulti())); connect(action, SIGNAL(triggered()), this, SLOT(statusMulti()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
@@ -419,35 +417,35 @@ void BazaarPlugin::createRepositoryActions(const Core::Context &context)
action = new QAction(tr("Pull..."), this); action = new QAction(tr("Pull..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::PULL), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::PULL), context);
connect(action, SIGNAL(triggered()), this, SLOT(pull())); connect(action, SIGNAL(triggered()), this, SLOT(pull()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Push..."), this); action = new QAction(tr("Push..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::PUSH), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::PUSH), context);
connect(action, SIGNAL(triggered()), this, SLOT(push())); connect(action, SIGNAL(triggered()), this, SLOT(push()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Update..."), this); action = new QAction(tr("Update..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::UPDATE), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::UPDATE), context);
connect(action, SIGNAL(triggered()), this, SLOT(update())); connect(action, SIGNAL(triggered()), this, SLOT(update()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Commit..."), this); action = new QAction(tr("Commit..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = m_actionManager->registerAction(action, Core::Id(Constants::COMMIT), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::COMMIT), context);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+C") : tr("ALT+Z,Alt+C"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+C") : tr("ALT+Z,Alt+C")));
connect(action, SIGNAL(triggered()), this, SLOT(commit())); connect(action, SIGNAL(triggered()), this, SLOT(commit()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
QAction *createRepositoryAction = new QAction(tr("Create Repository..."), this); QAction *createRepositoryAction = new QAction(tr("Create Repository..."), this);
command = m_actionManager->registerAction(createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context); command = Core::ActionManager::registerAction(createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context);
connect(createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository())); connect(createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
m_bazaarContainer->addAction(command); m_bazaarContainer->addAction(command);
} }
@@ -514,18 +512,18 @@ void BazaarPlugin::createSubmitEditorActions()
Core::Command *command; Core::Command *command;
m_editorCommit = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); m_editorCommit = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
command = m_actionManager->registerAction(m_editorCommit, Core::Id(Constants::COMMIT), context); command = Core::ActionManager::registerAction(m_editorCommit, Core::Id(Constants::COMMIT), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor())); connect(m_editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor()));
m_editorDiff = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); m_editorDiff = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
command = m_actionManager->registerAction(m_editorDiff, Core::Id(Constants::DIFFEDITOR), context); command = Core::ActionManager::registerAction(m_editorDiff, Core::Id(Constants::DIFFEDITOR), context);
m_editorUndo = new QAction(tr("&Undo"), this); m_editorUndo = new QAction(tr("&Undo"), this);
command = m_actionManager->registerAction(m_editorUndo, Core::Id(Core::Constants::UNDO), context); command = Core::ActionManager::registerAction(m_editorUndo, Core::Id(Core::Constants::UNDO), context);
m_editorRedo = new QAction(tr("&Redo"), this); m_editorRedo = new QAction(tr("&Redo"), this);
command = m_actionManager->registerAction(m_editorRedo, Core::Id(Core::Constants::REDO), context); command = Core::ActionManager::registerAction(m_editorRedo, Core::Id(Core::Constants::REDO), context);
} }
void BazaarPlugin::commit() void BazaarPlugin::commit()
@@ -682,7 +680,7 @@ void BazaarPlugin::createSeparator(const Core::Context &context, const Core::Id
{ {
QAction *action = new QAction(this); QAction *action = new QAction(this);
action->setSeparator(true); action->setSeparator(true);
m_bazaarContainer->addAction(m_actionManager->registerAction(action, id, context)); m_bazaarContainer->addAction(Core::ActionManager::registerAction(action, id, context));
} }
void BazaarPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as) void BazaarPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as)

View File

@@ -139,7 +139,6 @@ private:
BazaarClient *m_client; BazaarClient *m_client;
Locator::CommandLocator *m_commandLocator; Locator::CommandLocator *m_commandLocator;
Core::ActionManager *m_actionManager;
Core::ActionContainer *m_bazaarContainer; Core::ActionContainer *m_bazaarContainer;
QList<QAction *> m_repositoryActionList; QList<QAction *> m_repositoryActionList;

View File

@@ -464,7 +464,7 @@ BinEditorPlugin::~BinEditorPlugin()
QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title) QAction *BinEditorPlugin::registerNewAction(const QString &id, const QString &title)
{ {
QAction *result = new QAction(title, this); 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; return result;
} }

View File

@@ -70,52 +70,51 @@ void BookmarksPlugin::extensionsInitialized()
bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
{ {
Core::ActionManager *am = Core::ICore::actionManager();
Core::Context textcontext(TextEditor::Constants::C_TEXTEDITOR); Core::Context textcontext(TextEditor::Constants::C_TEXTEDITOR);
Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mbm = am->createMenu(Core::Id(BOOKMARKS_MENU)); Core::ActionContainer *mbm = Core::ActionManager::createMenu(Core::Id(BOOKMARKS_MENU));
mbm->menu()->setTitle(tr("&Bookmarks")); mbm->menu()->setTitle(tr("&Bookmarks"));
mtools->addMenu(mbm); mtools->addMenu(mbm);
//Toggle //Toggle
m_toggleAction = new QAction(tr("Toggle Bookmark"), this); m_toggleAction = new QAction(tr("Toggle Bookmark"), this);
Core::Command *cmd = 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"))); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+M") : tr("Ctrl+M")));
mbm->addAction(cmd); mbm->addAction(cmd);
QAction *sep = new QAction(this); QAction *sep = new QAction(this);
sep->setSeparator(true); 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); mbm->addAction(cmd);
//Previous //Previous
m_prevAction = new QAction(tr("Previous Bookmark"), this); 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+,"))); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+,") : tr("Ctrl+,")));
mbm->addAction(cmd); mbm->addAction(cmd);
//Next //Next
m_nextAction = new QAction(tr("Next Bookmark"), this); 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+."))); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+.") : tr("Ctrl+.")));
mbm->addAction(cmd); mbm->addAction(cmd);
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); 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); mbm->addAction(cmd);
//Previous Doc //Previous Doc
m_docPrevAction = new QAction(tr("Previous Bookmark in Document"), this); 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); mbm->addAction(cmd);
//Next Doc //Next Doc
m_docNextAction = new QAction(tr("Next Bookmark in Document"), this); 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); mbm->addAction(cmd);
m_bookmarkManager = new BookmarkManager; m_bookmarkManager = new BookmarkManager;

View File

@@ -146,8 +146,7 @@ void CMakeEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{ {
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
Core::ActionManager *am = Core::ICore::instance()->actionManager(); Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(Constants::M_CONTEXT);
Core::ActionContainer *mcontext = am->actionContainer(Constants::M_CONTEXT);
QMenu *contextMenu = mcontext->menu(); QMenu *contextMenu = mcontext->menu();
foreach (QAction *action, contextMenu->actions()) foreach (QAction *action, contextMenu->actions())

View File

@@ -57,20 +57,19 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
TextEditorActionHandler::UnCommentSelection TextEditorActionHandler::UnCommentSelection
| TextEditorActionHandler::JumpToFileUnderCursor); | TextEditorActionHandler::JumpToFileUnderCursor);
ActionManager *am = ICore::actionManager(); ActionContainer *contextMenu = Core::ActionManager::createMenu(Constants::M_CONTEXT);
ActionContainer *contextMenu = am->createMenu(Constants::M_CONTEXT);
Command *cmd; Command *cmd;
Context cmakeEditorContext = Context(Constants::C_CMAKEEDITOR); 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); contextMenu->addAction(cmd);
QAction *separator = new QAction(this); QAction *separator = new QAction(this);
separator->setSeparator(true); separator->setSeparator(true);
contextMenu->addAction(am->registerAction(separator, contextMenu->addAction(Core::ActionManager::registerAction(separator,
Id(Constants::SEPARATOR), cmakeEditorContext)); Id(Constants::SEPARATOR), cmakeEditorContext));
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
} }

View File

@@ -67,25 +67,25 @@ CMakeManager::CMakeManager(CMakeSettingsPage *cmakeSettingsPage)
connect(projectExplorer, SIGNAL(aboutToShowContextMenu(ProjectExplorer::Project*,ProjectExplorer::Node*)), connect(projectExplorer, SIGNAL(aboutToShowContextMenu(ProjectExplorer::Project*,ProjectExplorer::Node*)),
this, SLOT(updateContextMenu(ProjectExplorer::Project*,ProjectExplorer::Node*))); this, SLOT(updateContextMenu(ProjectExplorer::Project*,ProjectExplorer::Node*)));
Core::ActionManager *am = Core::ICore::actionManager();
Core::ActionContainer *mbuild = Core::ActionContainer *mbuild =
am->actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
Core::ActionContainer *mproject = Core::ActionContainer *mproject =
am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
Core::ActionContainer *msubproject = Core::ActionContainer *msubproject =
am->actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
const Core::Context projectContext(CMakeProjectManager::Constants::PROJECTCONTEXT); const Core::Context projectContext(CMakeProjectManager::Constants::PROJECTCONTEXT);
m_runCMakeAction = new QAction(QIcon(), tr("Run CMake"), this); 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); command->setAttribute(Core::Command::CA_Hide);
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_DEPLOY); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_DEPLOY);
connect(m_runCMakeAction, SIGNAL(triggered()), this, SLOT(runCMake())); connect(m_runCMakeAction, SIGNAL(triggered()), this, SLOT(runCMake()));
m_runCMakeActionContextMenu = new QAction(QIcon(), tr("Run CMake"), this); 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); command->setAttribute(Core::Command::CA_Hide);
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);

View File

@@ -30,6 +30,7 @@
** **
**************************************************************************/ **************************************************************************/
#include "actionmanager.h"
#include "actionmanager_p.h" #include "actionmanager_p.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "actioncontainer_p.h" #include "actioncontainer_p.h"
@@ -53,6 +54,9 @@ namespace {
enum { warnAboutFindFailures = 0 }; enum { warnAboutFindFailures = 0 };
} }
using namespace Core;
using namespace Core::Internal;
/*! /*!
\class Core::ActionManager \class Core::ActionManager
\mainclass \mainclass
@@ -61,11 +65,8 @@ namespace {
menu items and keyboard shortcuts. menu items and keyboard shortcuts.
The ActionManager is the central bookkeeper of actions and their shortcuts and layout. The ActionManager is the central bookkeeper of actions and their shortcuts and layout.
You get the only implementation of this class from the core interface It is a singleton containing mostly static methods. If you need access to the instance,
ICore::actionManager() method, e.g. e.g. for connecting to signals, is its ActionManager::instance() method.
\code
Core::ICore::actionManager()
\endcode
The main reasons for the need of this class is to provide a central place where the user The main reasons for the need of this class is to provide a central place where the user
can specify all his keyboard shortcuts, and to provide a solution for actions that should can specify all his keyboard shortcuts, and to provide a solution for actions that should
@@ -73,7 +74,7 @@ namespace {
\section1 Contexts \section1 Contexts
All actions that are registered with the same string ID (but different context lists) All actions that are registered with the same Id (but different context lists)
are considered to be overloads of the same command, represented by an instance are considered to be overloads of the same command, represented by an instance
of the Command class. of the Command class.
Exactly only one of the registered actions with the same ID is active at any time. Exactly only one of the registered actions with the same ID is active at any time.
@@ -99,9 +100,8 @@ namespace {
To register a globally active action "My Action" To register a globally active action "My Action"
put the following in your plugin's IPlugin::initialize method: put the following in your plugin's IPlugin::initialize method:
\code \code
Core::ActionManager *am = Core::ICore::actionManager();
QAction *myAction = new QAction(tr("My Action"), this); QAction *myAction = new QAction(tr("My Action"), this);
Core::Command *cmd = am->registerAction(myAction, Core::Command *cmd = Core::ActionManager::registerAction(myAction,
"myplugin.myaction", "myplugin.myaction",
Core::Context(C_GLOBAL)); Core::Context(C_GLOBAL));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+u"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+u")));
@@ -125,7 +125,7 @@ namespace {
Following the example adding "My Action" to the "Tools" menu would be done by Following the example adding "My Action" to the "Tools" menu would be done by
\code \code
am->actionContainer(Core::M_TOOLS)->addAction(cmd); Core::ActionManager::actionContainer(Core::M_TOOLS)->addAction(cmd);
\endcode \endcode
\section1 Important Guidelines: \section1 Important Guidelines:
@@ -146,9 +146,36 @@ namespace {
\sa Core::IContext \sa Core::IContext
*/ */
static ActionManager *m_instance = 0;
/*! /*!
\fn ActionContainer *ActionManager::createMenu(const Id &id) \internal
\brief Creates a new menu with the given string \a id. */
ActionManager::ActionManager(QObject *parent)
: QObject(parent),
d(new ActionManagerPrivate())
{
m_instance = this;
}
/*!
\internal
*/
ActionManager::~ActionManager()
{
delete d;
}
/*!
* \return Singleton action manager instance
*/
ActionManager *ActionManager::instance()
{
return m_instance;
}
/*!
\brief Creates a new menu with the given \a id.
Returns a new ActionContainer that you can use to get the QMenu instance Returns a new ActionContainer that you can use to get the QMenu instance
or to add menu items to the menu. The ActionManager owns or to add menu items to the menu. The ActionManager owns
@@ -156,19 +183,51 @@ namespace {
Add your menu to some other menu or a menu bar via the Add your menu to some other menu or a menu bar via the
ActionManager::actionContainer and ActionContainer::addMenu methods. ActionManager::actionContainer and ActionContainer::addMenu methods.
*/ */
ActionContainer *ActionManager::createMenu(const Id &id)
{
const ActionManagerPrivate::IdContainerMap::const_iterator it = m_instance->d->m_idContainerMap.constFind(id);
if (it != m_instance->d->m_idContainerMap.constEnd())
return it.value();
QMenu *m = new QMenu(ICore::mainWindow());
m->setObjectName(QLatin1String(id.name()));
MenuActionContainer *mc = new MenuActionContainer(id);
mc->setMenu(m);
m_instance->d->m_idContainerMap.insert(id, mc);
connect(mc, SIGNAL(destroyed()), m_instance->d, SLOT(containerDestroyed()));
return mc;
}
/*! /*!
\fn ActionContainer *ActionManager::createMenuBar(const Id &id) \brief Creates a new menu bar with the given \a id.
\brief Creates a new menu bar with the given string \a id.
Returns a new ActionContainer that you can use to get the QMenuBar instance Returns a new ActionContainer that you can use to get the QMenuBar instance
or to add menus to the menu bar. The ActionManager owns or to add menus to the menu bar. The ActionManager owns
the returned ActionContainer. the returned ActionContainer.
*/ */
ActionContainer *ActionManager::createMenuBar(const Id &id)
{
const ActionManagerPrivate::IdContainerMap::const_iterator it = m_instance->d->m_idContainerMap.constFind(id);
if (it != m_instance->d->m_idContainerMap.constEnd())
return it.value();
QMenuBar *mb = new QMenuBar; // No parent (System menu bar on Mac OS X)
mb->setObjectName(id.toString());
MenuBarActionContainer *mbc = new MenuBarActionContainer(id);
mbc->setMenuBar(mb);
m_instance->d->m_idContainerMap.insert(id, mbc);
connect(mbc, SIGNAL(destroyed()), m_instance->d, SLOT(containerDestroyed()));
return mbc;
}
/*! /*!
\fn Command *ActionManager::registerAction(QAction *action, const Id &id, const Context &context, bool scriptable) \brief Makes an \a action known to the system under the specified \a id.
\brief Makes an \a action known to the system under the specified string \a id.
Returns a command object that represents the action in the application and is Returns a command object that represents the action in the application and is
owned by the ActionManager. You can register several actions with the owned by the ActionManager. You can register several actions with the
@@ -178,10 +237,19 @@ namespace {
A scriptable action can be called from a script without the need for the user A scriptable action can be called from a script without the need for the user
to interact with it. to interact with it.
*/ */
Command *ActionManager::registerAction(QAction *action, const Id &id, const Context &context, bool scriptable)
{
Action *a = m_instance->d->overridableAction(id);
if (a) {
a->addOverrideAction(action, context, scriptable);
emit m_instance->commandListChanged();
emit m_instance->commandAdded(id.toString());
}
return a;
}
/*! /*!
\fn Command *ActionManager::registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable) \brief Makes a \a shortcut known to the system under the specified \a id.
\brief Makes a \a shortcut known to the system under the specified string \a id.
Returns a command object that represents the shortcut in the application and is Returns a command object that represents the shortcut in the application and is
owned by the ActionManager. You can registered several shortcuts with the owned by the ActionManager. You can registered several shortcuts with the
@@ -191,47 +259,199 @@ namespace {
A scriptable shortcut can be called from a script without the need for the user A scriptable shortcut can be called from a script without the need for the user
to interact with it. to interact with it.
*/ */
Command *ActionManager::registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable)
{
Shortcut *sc = 0;
if (CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0)) {
sc = qobject_cast<Shortcut *>(c);
if (!sc) {
qWarning() << "registerShortcut: id" << id.name()
<< "is registered with a different command type.";
return c;
}
} else {
sc = new Shortcut(id);
m_instance->d->m_idCmdMap.insert(id, sc);
}
if (sc->shortcut()) {
qWarning() << "registerShortcut: action already registered, id" << id.name() << ".";
return sc;
}
if (!m_instance->d->hasContext(context))
shortcut->setEnabled(false);
shortcut->setObjectName(id.toString());
shortcut->setParent(ICore::mainWindow());
sc->setShortcut(shortcut);
sc->setScriptable(scriptable);
if (context.isEmpty())
sc->setContext(Context(0));
else
sc->setContext(context);
emit m_instance->commandListChanged();
emit m_instance->commandAdded(id.toString());
if (isPresentationModeEnabled())
connect(sc->shortcut(), SIGNAL(activated()), m_instance->d, SLOT(shortcutTriggered()));
return sc;
}
/*! /*!
\fn Command *ActionManager::command(const Id &id) const
\brief Returns the Command object that is known to the system \brief Returns the Command object that is known to the system
under the given string \a id. under the given \a id.
\sa ActionManager::registerAction() \sa ActionManager::registerAction()
*/ */
Command *ActionManager::command(const Id &id)
{
const ActionManagerPrivate::IdCmdMap::const_iterator it = m_instance->d->m_idCmdMap.constFind(id);
if (it == m_instance->d->m_idCmdMap.constEnd()) {
if (warnAboutFindFailures)
qWarning() << "ActionManagerPrivate::command(): failed to find :"
<< id.name();
return 0;
}
return it.value();
}
/*! /*!
\fn ActionContainer *ActionManager::actionContainer(const Id &id) const
\brief Returns the IActionContainter object that is know to the system \brief Returns the IActionContainter object that is know to the system
under the given string \a id. under the given \a id.
\sa ActionManager::createMenu() \sa ActionManager::createMenu()
\sa ActionManager::createMenuBar() \sa ActionManager::createMenuBar()
*/ */
ActionContainer *ActionManager::actionContainer(const Id &id)
{
const ActionManagerPrivate::IdContainerMap::const_iterator it = m_instance->d->m_idContainerMap.constFind(id);
if (it == m_instance->d->m_idContainerMap.constEnd()) {
if (warnAboutFindFailures)
qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :"
<< id.name();
return 0;
}
return it.value();
}
/*! /*!
\fn Command *ActionManager::unregisterAction(QAction *action, const Id &id) * \brief Returns all commands that have been registered.
\brief Removes the knowledge about an \a action under the specified string \a id. */
QList<Command *> ActionManager::commands()
{
// transform list of CommandPrivate into list of Command
QList<Command *> result;
foreach (Command *cmd, m_instance->d->m_idCmdMap.values())
result << cmd;
return result;
}
/*!
\brief Removes the knowledge about an \a action under the specified \a id.
Usually you do not need to unregister actions. The only valid use case for unregistering Usually you do not need to unregister actions. The only valid use case for unregistering
actions, is for actions that represent user definable actions, like for the custom Locator actions, is for actions that represent user definable actions, like for the custom Locator
filters. If the user removes such an action, it also has to be unregistered from the action manager, filters. If the user removes such an action, it also has to be unregistered from the action manager,
to make it disappear from shortcut settings etc. to make it disappear from shortcut settings etc.
*/ */
void ActionManager::unregisterAction(QAction *action, const Id &id)
{
Action *a = 0;
CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0);
QTC_ASSERT(c, return);
a = qobject_cast<Action *>(c);
if (!a) {
qWarning() << "unregisterAction: id" << id.name()
<< "is registered with a different command type.";
return;
}
a->removeOverrideAction(action);
if (a->isEmpty()) {
// clean up
// ActionContainers listen to the commands' destroyed signals
ICore::mainWindow()->removeAction(a->action());
delete a->action();
m_instance->d->m_idCmdMap.remove(id);
delete a;
}
emit m_instance->commandListChanged();
}
/*! /*!
\fn ActionManager::ActionManager(QObject *parent) \brief Removes the knowledge about a shortcut under the specified \a id.
\internal
*/
/*!
\fn ActionManager::~ActionManager()
\internal
*/
using namespace Core; Usually you do not need to unregister shortcuts. The only valid use case for unregistering
using namespace Core::Internal; shortcuts, is for shortcuts that represent user definable actions. If the user removes such an action,
a corresponding shortcut also has to be unregistered from the action manager,
to make it disappear from shortcut settings etc.
*/
void ActionManager::unregisterShortcut(const Core::Id &id)
{
Shortcut *sc = 0;
CommandPrivate *c = m_instance->d->m_idCmdMap.value(id, 0);
QTC_ASSERT(c, return);
sc = qobject_cast<Shortcut *>(c);
if (!sc) {
qWarning() << "unregisterShortcut: id" << id.name()
<< "is registered with a different command type.";
return;
}
delete sc->shortcut();
m_instance->d->m_idCmdMap.remove(id);
delete sc;
emit m_instance->commandListChanged();
}
ActionManagerPrivate* ActionManagerPrivate::m_instance = 0;
void ActionManager::setPresentationModeEnabled(bool enabled)
{
if (enabled == isPresentationModeEnabled())
return;
// Signal/slots to commands:
foreach (Command *c, commands()) {
if (c->action()) {
if (enabled)
connect(c->action(), SIGNAL(triggered()), m_instance->d, SLOT(actionTriggered()));
else
disconnect(c->action(), SIGNAL(triggered()), m_instance->d, SLOT(actionTriggered()));
}
if (c->shortcut()) {
if (enabled)
connect(c->shortcut(), SIGNAL(activated()), m_instance->d, SLOT(shortcutTriggered()));
else
disconnect(c->shortcut(), SIGNAL(activated()), m_instance->d, SLOT(shortcutTriggered()));
}
}
// The label for the shortcuts:
if (!m_instance->d->m_presentationLabel) {
m_instance->d->m_presentationLabel = new QLabel(0, Qt::ToolTip | Qt::WindowStaysOnTopHint);
QFont font = m_instance->d->m_presentationLabel->font();
font.setPixelSize(45);
m_instance->d->m_presentationLabel->setFont(font);
m_instance->d->m_presentationLabel->setAlignment(Qt::AlignCenter);
m_instance->d->m_presentationLabel->setMargin(5);
connect(&m_instance->d->m_presentationLabelTimer, SIGNAL(timeout()), m_instance->d->m_presentationLabel, SLOT(hide()));
} else {
m_instance->d->m_presentationLabelTimer.stop();
delete m_instance->d->m_presentationLabel;
m_instance->d->m_presentationLabel = 0;
}
}
bool ActionManager::isPresentationModeEnabled()
{
return m_instance->d->m_presentationLabel;
}
bool ActionManager::hasContext(int context)
{
return m_instance->d->m_context.contains(context);
}
/*! /*!
\class ActionManagerPrivate \class ActionManagerPrivate
@@ -239,13 +459,10 @@ ActionManagerPrivate* ActionManagerPrivate::m_instance = 0;
\internal \internal
*/ */
ActionManagerPrivate::ActionManagerPrivate(MainWindow *mainWnd) ActionManagerPrivate::ActionManagerPrivate()
: ActionManager(mainWnd), : m_presentationLabel(0)
m_mainWnd(mainWnd),
m_presentationLabel(0)
{ {
m_presentationLabelTimer.setInterval(1000); m_presentationLabelTimer.setInterval(1000);
m_instance = this;
} }
ActionManagerPrivate::~ActionManagerPrivate() ActionManagerPrivate::~ActionManagerPrivate()
@@ -257,25 +474,6 @@ ActionManagerPrivate::~ActionManagerPrivate()
qDeleteAll(m_idCmdMap.values()); qDeleteAll(m_idCmdMap.values());
} }
ActionManagerPrivate *ActionManagerPrivate::instance()
{
return m_instance;
}
QList<Command *> ActionManagerPrivate::commands() const
{
// transform list of CommandPrivate into list of Command
QList<Command *> result;
foreach (Command *cmd, m_idCmdMap.values())
result << cmd;
return result;
}
bool ActionManagerPrivate::hasContext(int context) const
{
return m_context.contains(context);
}
QDebug operator<<(QDebug in, const Context &context) QDebug operator<<(QDebug in, const Context &context)
{ {
in << "CONTEXT: "; in << "CONTEXT: ";
@@ -304,42 +502,6 @@ bool ActionManagerPrivate::hasContext(const Context &context) const
return false; return false;
} }
ActionContainer *ActionManagerPrivate::createMenu(const Id &id)
{
const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id);
if (it != m_idContainerMap.constEnd())
return it.value();
QMenu *m = new QMenu(m_mainWnd);
m->setObjectName(QLatin1String(id.name()));
MenuActionContainer *mc = new MenuActionContainer(id);
mc->setMenu(m);
m_idContainerMap.insert(id, mc);
connect(mc, SIGNAL(destroyed()), this, SLOT(containerDestroyed()));
return mc;
}
ActionContainer *ActionManagerPrivate::createMenuBar(const Id &id)
{
const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id);
if (it != m_idContainerMap.constEnd())
return it.value();
QMenuBar *mb = new QMenuBar; // No parent (System menu bar on Mac OS X)
mb->setObjectName(id.toString());
MenuBarActionContainer *mbc = new MenuBarActionContainer(id);
mbc->setMenuBar(mb);
m_idContainerMap.insert(id, mbc);
connect(mbc, SIGNAL(destroyed()), this, SLOT(containerDestroyed()));
return mbc;
}
void ActionManagerPrivate::containerDestroyed() void ActionManagerPrivate::containerDestroyed()
{ {
ActionContainerPrivate *container = static_cast<ActionContainerPrivate *>(sender()); ActionContainerPrivate *container = static_cast<ActionContainerPrivate *>(sender());
@@ -362,13 +524,13 @@ void ActionManagerPrivate::shortcutTriggered()
void ActionManagerPrivate::showShortcutPopup(const QString &shortcut) void ActionManagerPrivate::showShortcutPopup(const QString &shortcut)
{ {
if (shortcut.isEmpty() || !isPresentationModeEnabled()) if (shortcut.isEmpty() || !ActionManager::isPresentationModeEnabled())
return; return;
m_presentationLabel->setText(shortcut); m_presentationLabel->setText(shortcut);
m_presentationLabel->adjustSize(); m_presentationLabel->adjustSize();
QPoint p = m_mainWnd->mapToGlobal(m_mainWnd->rect().center() - m_presentationLabel->rect().center()); QPoint p = ICore::mainWindow()->mapToGlobal(ICore::mainWindow()->rect().center() - m_presentationLabel->rect().center());
m_presentationLabel->move(p); m_presentationLabel->move(p);
m_presentationLabel->show(); m_presentationLabel->show();
@@ -376,17 +538,6 @@ void ActionManagerPrivate::showShortcutPopup(const QString &shortcut)
m_presentationLabelTimer.start(); m_presentationLabelTimer.start();
} }
Command *ActionManagerPrivate::registerAction(QAction *action, const Id &id, const Context &context, bool scriptable)
{
Action *a = overridableAction(id);
if (a) {
a->addOverrideAction(action, context, scriptable);
emit commandListChanged();
emit commandAdded(id.toString());
}
return a;
}
Action *ActionManagerPrivate::overridableAction(const Id &id) Action *ActionManagerPrivate::overridableAction(const Id &id)
{ {
Action *a = 0; Action *a = 0;
@@ -400,105 +551,18 @@ Action *ActionManagerPrivate::overridableAction(const Id &id)
} else { } else {
a = new Action(id); a = new Action(id);
m_idCmdMap.insert(id, a); m_idCmdMap.insert(id, a);
m_mainWnd->addAction(a->action()); ICore::mainWindow()->addAction(a->action());
a->action()->setObjectName(id.toString()); a->action()->setObjectName(id.toString());
a->action()->setShortcutContext(Qt::ApplicationShortcut); a->action()->setShortcutContext(Qt::ApplicationShortcut);
a->setCurrentContext(m_context); a->setCurrentContext(m_context);
if (isPresentationModeEnabled()) if (ActionManager::isPresentationModeEnabled())
connect(a->action(), SIGNAL(triggered()), this, SLOT(actionTriggered())); connect(a->action(), SIGNAL(triggered()), this, SLOT(actionTriggered()));
} }
return a; return a;
} }
void ActionManagerPrivate::unregisterAction(QAction *action, const Id &id)
{
Action *a = 0;
CommandPrivate *c = m_idCmdMap.value(id, 0);
QTC_ASSERT(c, return);
a = qobject_cast<Action *>(c);
if (!a) {
qWarning() << "unregisterAction: id" << id.name()
<< "is registered with a different command type.";
return;
}
a->removeOverrideAction(action);
if (a->isEmpty()) {
// clean up
// ActionContainers listen to the commands' destroyed signals
m_mainWnd->removeAction(a->action());
delete a->action();
m_idCmdMap.remove(id);
delete a;
}
emit commandListChanged();
}
Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable)
{
Shortcut *sc = 0;
if (CommandPrivate *c = m_idCmdMap.value(id, 0)) {
sc = qobject_cast<Shortcut *>(c);
if (!sc) {
qWarning() << "registerShortcut: id" << id.name()
<< "is registered with a different command type.";
return c;
}
} else {
sc = new Shortcut(id);
m_idCmdMap.insert(id, sc);
}
if (sc->shortcut()) {
qWarning() << "registerShortcut: action already registered, id" << id.name() << ".";
return sc;
}
if (!hasContext(context))
shortcut->setEnabled(false);
shortcut->setObjectName(id.toString());
shortcut->setParent(m_mainWnd);
sc->setShortcut(shortcut);
sc->setScriptable(scriptable);
if (context.isEmpty())
sc->setContext(Context(0));
else
sc->setContext(context);
emit commandListChanged();
emit commandAdded(id.toString());
if (isPresentationModeEnabled())
connect(sc->shortcut(), SIGNAL(activated()), this, SLOT(shortcutTriggered()));
return sc;
}
Command *ActionManagerPrivate::command(const Id &id) const
{
const IdCmdMap::const_iterator it = m_idCmdMap.constFind(id);
if (it == m_idCmdMap.constEnd()) {
if (warnAboutFindFailures)
qWarning() << "ActionManagerPrivate::command(): failed to find :"
<< id.name();
return 0;
}
return it.value();
}
ActionContainer *ActionManagerPrivate::actionContainer(const Id &id) const
{
const IdContainerMap::const_iterator it = m_idContainerMap.constFind(id);
if (it == m_idContainerMap.constEnd()) {
if (warnAboutFindFailures)
qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :"
<< id.name();
return 0;
}
return it.value();
}
static const char settingsGroup[] = "KeyBindings"; static const char settingsGroup[] = "KeyBindings";
static const char idKey[] = "ID"; static const char idKey[] = "ID";
static const char sequenceKey[] = "Keysequence"; static const char sequenceKey[] = "Keysequence";
@@ -512,7 +576,7 @@ void ActionManagerPrivate::initialize()
const QKeySequence key(settings->value(QLatin1String(sequenceKey)).toString()); const QKeySequence key(settings->value(QLatin1String(sequenceKey)).toString());
const Id id = Id(settings->value(QLatin1String(idKey)).toString()); const Id id = Id(settings->value(QLatin1String(idKey)).toString());
Command *cmd = command(id); Command *cmd = ActionManager::command(id);
if (cmd) if (cmd)
cmd->setKeySequence(key); cmd->setKeySequence(key);
} }
@@ -539,63 +603,3 @@ void ActionManagerPrivate::saveSettings(QSettings *settings)
settings->endArray(); settings->endArray();
} }
void ActionManagerPrivate::unregisterShortcut(const Core::Id &id)
{
Shortcut *sc = 0;
CommandPrivate *c = m_idCmdMap.value(id, 0);
QTC_ASSERT(c, return);
sc = qobject_cast<Shortcut *>(c);
if (!sc) {
qWarning() << "unregisterShortcut: id" << id.name()
<< "is registered with a different command type.";
return;
}
delete sc->shortcut();
m_idCmdMap.remove(id);
delete sc;
emit commandListChanged();
}
void ActionManagerPrivate::setPresentationModeEnabled(bool enabled)
{
if (enabled == isPresentationModeEnabled())
return;
// Signal/slots to commands:
foreach (Command *c, commands()) {
if (c->action()) {
if (enabled)
connect(c->action(), SIGNAL(triggered()), this, SLOT(actionTriggered()));
else
disconnect(c->action(), SIGNAL(triggered()), this, SLOT(actionTriggered()));
}
if (c->shortcut()) {
if (enabled)
connect(c->shortcut(), SIGNAL(activated()), this, SLOT(shortcutTriggered()));
else
disconnect(c->shortcut(), SIGNAL(activated()), this, SLOT(shortcutTriggered()));
}
}
// The label for the shortcuts:
if (!m_presentationLabel) {
m_presentationLabel = new QLabel(0, Qt::ToolTip | Qt::WindowStaysOnTopHint);
QFont font = m_presentationLabel->font();
font.setPixelSize(45);
m_presentationLabel->setFont(font);
m_presentationLabel->setAlignment(Qt::AlignCenter);
m_presentationLabel->setMargin(5);
connect(&m_presentationLabelTimer, SIGNAL(timeout()), m_presentationLabel, SLOT(hide()));
} else {
m_presentationLabelTimer.stop();
delete m_presentationLabel;
m_presentationLabel = 0;
}
}
bool ActionManagerPrivate::isPresentationModeEnabled()
{
return m_presentationLabel;
}

View File

@@ -51,30 +51,46 @@ namespace Core {
class ActionContainer; class ActionContainer;
namespace Internal {
class ActionManagerPrivate;
class MainWindow;
}
class CORE_EXPORT ActionManager : public QObject class CORE_EXPORT ActionManager : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
ActionManager(QObject *parent = 0) : QObject(parent) {} static ActionManager *instance();
virtual ~ActionManager() {}
virtual ActionContainer *createMenu(const Id &id) = 0; static ActionContainer *createMenu(const Id &id);
virtual ActionContainer *createMenuBar(const Id &id) = 0; static ActionContainer *createMenuBar(const Id &id);
virtual Command *registerAction(QAction *action, const Id &id, const Context &context, bool scriptable = false) = 0; static Command *registerAction(QAction *action, const Id &id, const Context &context, bool scriptable = false);
virtual Command *registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable = false) = 0; static Command *registerShortcut(QShortcut *shortcut, const Id &id, const Context &context, bool scriptable = false);
virtual Command *command(const Id &id) const = 0; static Command *command(const Id &id);
virtual ActionContainer *actionContainer(const Id &id) const = 0; static ActionContainer *actionContainer(const Id &id);
virtual QList<Command *> commands() const = 0; static QList<Command *> commands();
virtual void unregisterAction(QAction *action, const Id &id) = 0; static void unregisterAction(QAction *action, const Id &id);
virtual void unregisterShortcut(const Id &id) = 0; static void unregisterShortcut(const Id &id);
static void setPresentationModeEnabled(bool enabled);
static bool isPresentationModeEnabled();
static bool hasContext(int context);
signals: signals:
void commandListChanged(); void commandListChanged();
void commandAdded(const QString &id); void commandAdded(const QString &id);
private:
ActionManager(QObject *parent = 0);
~ActionManager();
Internal::ActionManagerPrivate *d;
friend class Core::Internal::MainWindow;
}; };
} // namespace Core } // namespace Core

View File

@@ -33,8 +33,8 @@
#ifndef ACTIONMANAGERPRIVATE_H #ifndef ACTIONMANAGERPRIVATE_H
#define ACTIONMANAGERPRIVATE_H #define ACTIONMANAGERPRIVATE_H
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command_p.h> #include <coreplugin/actionmanager/command_p.h>
#include <coreplugin/actionmanager/actioncontainer_p.h>
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <QMap> #include <QMap>
@@ -48,21 +48,23 @@ class QSettings;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { namespace Core {
namespace Internal { namespace Internal {
class ActionContainerPrivate; class ActionContainerPrivate;
class MainWindow; class MainWindow;
class CommandPrivate; class CommandPrivate;
class ActionManagerPrivate : public Core::ActionManager class ActionManagerPrivate : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ActionManagerPrivate(MainWindow *mainWnd); typedef QHash<Core::Id, CommandPrivate *> IdCmdMap;
~ActionManagerPrivate(); typedef QHash<Core::Id, ActionContainerPrivate *> IdContainerMap;
static ActionManagerPrivate *instance(); explicit ActionManagerPrivate();
~ActionManagerPrivate();
void initialize(); void initialize();
@@ -71,49 +73,23 @@ public:
void saveSettings(QSettings *settings); 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();
private slots:
void containerDestroyed();
void actionTriggered();
void shortcutTriggered();
private:
void showShortcutPopup(const QString &shortcut); void showShortcutPopup(const QString &shortcut);
bool hasContext(const Context &context) const; bool hasContext(const Context &context) const;
Action *overridableAction(const Id &id); Action *overridableAction(const Id &id);
static ActionManagerPrivate *m_instance; public slots:
void containerDestroyed();
typedef QHash<Core::Id, CommandPrivate *> IdCmdMap; void actionTriggered();
void shortcutTriggered();
public:
IdCmdMap m_idCmdMap; IdCmdMap m_idCmdMap;
typedef QHash<Core::Id, ActionContainerPrivate *> IdContainerMap;
IdContainerMap m_idContainerMap; IdContainerMap m_idContainerMap;
// typedef QMap<int, int> GlobalGroupMap;
// GlobalGroupMap m_globalgroups;
//
Context m_context; Context m_context;
MainWindow *m_mainWnd;
QLabel *m_presentationLabel; QLabel *m_presentationLabel;
QTimer m_presentationLabelTimer; QTimer m_presentationLabelTimer;
}; };

View File

@@ -33,9 +33,6 @@
#include "commandmappings.h" #include "commandmappings.h"
#include "shortcutsettings.h" #include "shortcutsettings.h"
#include "ui_commandmappings.h" #include "ui_commandmappings.h"
#include "actionmanager_p.h"
#include "actionmanager/command.h"
#include "command_p.h"
#include "commandsfile.h" #include "commandsfile.h"
#include "coreconstants.h" #include "coreconstants.h"
#include "documentmanager.h" #include "documentmanager.h"

View File

@@ -31,6 +31,7 @@
**************************************************************************/ **************************************************************************/
#include "coreplugin.h" #include "coreplugin.h"
#include "actionmanager.h"
#include "designmode.h" #include "designmode.h"
#include "editmode.h" #include "editmode.h"
#include "editormanager.h" #include "editormanager.h"
@@ -81,7 +82,7 @@ void CorePlugin::parseArguments(const QStringList &arguments)
i++; // skip the argument i++; // skip the argument
} }
if (arguments.at(i) == QLatin1String("-presentationMode")) if (arguments.at(i) == QLatin1String("-presentationMode"))
m_mainWindow->setPresentationModeEnabled(true); ActionManager::setPresentationModeEnabled(true);
} }
} }

View File

@@ -31,7 +31,7 @@
**************************************************************************/ **************************************************************************/
#include "shortcutsettings.h" #include "shortcutsettings.h"
#include "actionmanager_p.h" #include "actionmanager/actionmanager.h"
#include "actionmanager/command.h" #include "actionmanager/command.h"
#include "command_p.h" #include "command_p.h"
#include "commandsfile.h" #include "commandsfile.h"
@@ -61,8 +61,7 @@ using namespace Core::Internal;
ShortcutSettings::ShortcutSettings(QObject *parent) ShortcutSettings::ShortcutSettings(QObject *parent)
: CommandMappings(parent), m_initialized(false) : CommandMappings(parent), m_initialized(false)
{ {
Core::Internal::ActionManagerPrivate *am = ActionManagerPrivate::instance(); connect(ActionManager::instance(), SIGNAL(commandListChanged()), this, SLOT(initialize()));
connect(am, SIGNAL(commandListChanged()), this, SLOT(initialize()));
setId(QLatin1String(Core::Constants::SETTINGS_ID_SHORTCUTS)); setId(QLatin1String(Core::Constants::SETTINGS_ID_SHORTCUTS));
setDisplayName(tr("Keyboard")); setDisplayName(tr("Keyboard"));
@@ -265,10 +264,9 @@ void ShortcutSettings::initialize()
if (!m_initialized) if (!m_initialized)
return; return;
clear(); clear();
Core::Internal::ActionManagerPrivate *am = ActionManagerPrivate::instance();
QMap<QString, QTreeWidgetItem *> sections; QMap<QString, QTreeWidgetItem *> sections;
foreach (Command *c, am->commands()) { foreach (Command *c, ActionManager::instance()->commands()) {
if (c->hasAttribute(Command::CA_NonConfigurable)) if (c->hasAttribute(Command::CA_NonConfigurable))
continue; continue;
if (c->action() && c->action()->isSeparator()) if (c->action() && c->action()->isSeparator())

View File

@@ -274,12 +274,12 @@ static EditorManager *m_instance = 0;
EditorManager *EditorManager::instance() { return m_instance; } EditorManager *EditorManager::instance() { return m_instance; }
static Command *createSeparator(ActionManager *am, QObject *parent, static Command *createSeparator(QObject *parent,
const Id &id, const Context &context) const Id &id, const Context &context)
{ {
QAction *tmpaction = new QAction(parent); QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true); tmpaction->setSeparator(true);
Command *cmd = am->registerAction(tmpaction, id, context); Command *cmd = ActionManager::registerAction(tmpaction, id, context);
return cmd; return cmd;
} }
@@ -296,12 +296,11 @@ EditorManager::EditorManager(QWidget *parent) :
// combined context for edit & design modes // combined context for edit & design modes
const Context editDesignContext(Constants::C_EDITORMANAGER, Constants::C_DESIGN_MODE); const Context editDesignContext(Constants::C_EDITORMANAGER, Constants::C_DESIGN_MODE);
ActionManager *am = ICore::actionManager(); ActionContainer *mfile = ActionManager::actionContainer(Constants::M_FILE);
ActionContainer *mfile = am->actionContainer(Constants::M_FILE);
// Revert to saved // Revert to saved
d->m_revertToSavedAction->setIcon(QIcon::fromTheme(QLatin1String("document-revert"))); d->m_revertToSavedAction->setIcon(QIcon::fromTheme(QLatin1String("document-revert")));
Command *cmd = am->registerAction(d->m_revertToSavedAction, Command *cmd = ActionManager::registerAction(d->m_revertToSavedAction,
Constants::REVERTTOSAVED, editManagerContext); Constants::REVERTTOSAVED, editManagerContext);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(tr("Revert File to Saved")); cmd->setDescription(tr("Revert File to Saved"));
@@ -309,29 +308,29 @@ EditorManager::EditorManager(QWidget *parent) :
connect(d->m_revertToSavedAction, SIGNAL(triggered()), this, SLOT(revertToSaved())); connect(d->m_revertToSavedAction, SIGNAL(triggered()), this, SLOT(revertToSaved()));
// Save Action // Save Action
am->registerAction(d->m_saveAction, Constants::SAVE, editManagerContext); ActionManager::registerAction(d->m_saveAction, Constants::SAVE, editManagerContext);
connect(d->m_saveAction, SIGNAL(triggered()), this, SLOT(saveDocument())); connect(d->m_saveAction, SIGNAL(triggered()), this, SLOT(saveDocument()));
// Save As Action // Save As Action
am->registerAction(d->m_saveAsAction, Constants::SAVEAS, editManagerContext); ActionManager::registerAction(d->m_saveAsAction, Constants::SAVEAS, editManagerContext);
connect(d->m_saveAsAction, SIGNAL(triggered()), this, SLOT(saveDocumentAs())); connect(d->m_saveAsAction, SIGNAL(triggered()), this, SLOT(saveDocumentAs()));
// Window Menu // Window Menu
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
// Window menu separators // Window menu separators
QAction *tmpaction = new QAction(this); QAction *tmpaction = new QAction(this);
tmpaction->setSeparator(true); tmpaction->setSeparator(true);
cmd = am->registerAction(tmpaction, "QtCreator.Window.Sep.Split", editManagerContext); cmd = ActionManager::registerAction(tmpaction, "QtCreator.Window.Sep.Split", editManagerContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
tmpaction = new QAction(this); tmpaction = new QAction(this);
tmpaction->setSeparator(true); tmpaction->setSeparator(true);
cmd = am->registerAction(tmpaction, "QtCreator.Window.Sep.Navigate", editManagerContext); cmd = ActionManager::registerAction(tmpaction, "QtCreator.Window.Sep.Navigate", editManagerContext);
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
// Close Action // Close Action
cmd = am->registerAction(d->m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext, true); cmd = ActionManager::registerAction(d->m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext, true);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+W"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+W")));
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDescription(d->m_closeCurrentEditorAction->text()); cmd->setDescription(d->m_closeCurrentEditorAction->text());
@@ -341,20 +340,20 @@ EditorManager::EditorManager(QWidget *parent) :
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
// workaround for QTCREATORBUG-72 // workaround for QTCREATORBUG-72
QShortcut *sc = new QShortcut(parent); QShortcut *sc = new QShortcut(parent);
cmd = am->registerShortcut(sc, Constants::CLOSE_ALTERNATIVE, editManagerContext); cmd = ActionManager::registerShortcut(sc, Constants::CLOSE_ALTERNATIVE, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F4"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F4")));
cmd->setDescription(EditorManager::tr("Close")); cmd->setDescription(EditorManager::tr("Close"));
connect(sc, SIGNAL(activated()), this, SLOT(closeEditor())); connect(sc, SIGNAL(activated()), this, SLOT(closeEditor()));
#endif #endif
// Close All Action // Close All Action
cmd = am->registerAction(d->m_closeAllEditorsAction, Constants::CLOSEALL, editManagerContext, true); cmd = ActionManager::registerAction(d->m_closeAllEditorsAction, Constants::CLOSEALL, editManagerContext, true);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+W"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+W")));
mfile->addAction(cmd, Constants::G_FILE_CLOSE); mfile->addAction(cmd, Constants::G_FILE_CLOSE);
connect(d->m_closeAllEditorsAction, SIGNAL(triggered()), this, SLOT(closeAllEditors())); connect(d->m_closeAllEditorsAction, SIGNAL(triggered()), this, SLOT(closeAllEditors()));
// Close All Others Action // Close All Others Action
cmd = am->registerAction(d->m_closeOtherEditorsAction, Constants::CLOSEOTHERS, editManagerContext, true); cmd = ActionManager::registerAction(d->m_closeOtherEditorsAction, Constants::CLOSEOTHERS, editManagerContext, true);
mfile->addAction(cmd, Constants::G_FILE_CLOSE); mfile->addAction(cmd, Constants::G_FILE_CLOSE);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
connect(d->m_closeOtherEditorsAction, SIGNAL(triggered()), this, SLOT(closeOtherEditors())); connect(d->m_closeOtherEditorsAction, SIGNAL(triggered()), this, SLOT(closeOtherEditors()));
@@ -368,61 +367,61 @@ EditorManager::EditorManager(QWidget *parent) :
connect(d->m_openTerminalAction, SIGNAL(triggered()), this, SLOT(openTerminal())); connect(d->m_openTerminalAction, SIGNAL(triggered()), this, SLOT(openTerminal()));
// Goto Previous In History Action // Goto Previous In History Action
cmd = am->registerAction(d->m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext); cmd = ActionManager::registerAction(d->m_gotoPreviousDocHistoryAction, Constants::GOTOPREVINHISTORY, editDesignContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Tab") : tr("Ctrl+Tab"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Tab") : tr("Ctrl+Tab")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_gotoPreviousDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoPreviousDocHistory())); connect(d->m_gotoPreviousDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoPreviousDocHistory()));
// Goto Next In History Action // Goto Next In History Action
cmd = am->registerAction(d->m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext); cmd = ActionManager::registerAction(d->m_gotoNextDocHistoryAction, Constants::GOTONEXTINHISTORY, editDesignContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Shift+Tab") : tr("Ctrl+Shift+Tab"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Alt+Shift+Tab") : tr("Ctrl+Shift+Tab")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_gotoNextDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoNextDocHistory())); connect(d->m_gotoNextDocHistoryAction, SIGNAL(triggered()), this, SLOT(gotoNextDocHistory()));
// Go back in navigation history // Go back in navigation history
cmd = am->registerAction(d->m_goBackAction, Constants::GO_BACK, editDesignContext); cmd = ActionManager::registerAction(d->m_goBackAction, Constants::GO_BACK, editDesignContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Left") : tr("Alt+Left"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Left") : tr("Alt+Left")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_goBackAction, SIGNAL(triggered()), this, SLOT(goBackInNavigationHistory())); connect(d->m_goBackAction, SIGNAL(triggered()), this, SLOT(goBackInNavigationHistory()));
// Go forward in navigation history // Go forward in navigation history
cmd = am->registerAction(d->m_goForwardAction, Constants::GO_FORWARD, editDesignContext); cmd = ActionManager::registerAction(d->m_goForwardAction, Constants::GO_FORWARD, editDesignContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Right") : tr("Alt+Right"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Alt+Right") : tr("Alt+Right")));
mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE); mwindow->addAction(cmd, Constants::G_WINDOW_NAVIGATE);
connect(d->m_goForwardAction, SIGNAL(triggered()), this, SLOT(goForwardInNavigationHistory())); connect(d->m_goForwardAction, SIGNAL(triggered()), this, SLOT(goForwardInNavigationHistory()));
d->m_splitAction = new QAction(tr("Split"), this); d->m_splitAction = new QAction(tr("Split"), this);
cmd = am->registerAction(d->m_splitAction, Constants::SPLIT, editManagerContext); cmd = ActionManager::registerAction(d->m_splitAction, Constants::SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,2") : tr("Ctrl+E,2")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_splitAction, SIGNAL(triggered()), this, SLOT(split())); connect(d->m_splitAction, SIGNAL(triggered()), this, SLOT(split()));
d->m_splitSideBySideAction = new QAction(tr("Split Side by Side"), this); d->m_splitSideBySideAction = new QAction(tr("Split Side by Side"), this);
cmd = am->registerAction(d->m_splitSideBySideAction, Constants::SPLIT_SIDE_BY_SIDE, editManagerContext); cmd = ActionManager::registerAction(d->m_splitSideBySideAction, Constants::SPLIT_SIDE_BY_SIDE, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,3") : tr("Ctrl+E,3"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,3") : tr("Ctrl+E,3")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_splitSideBySideAction, SIGNAL(triggered()), this, SLOT(splitSideBySide())); connect(d->m_splitSideBySideAction, SIGNAL(triggered()), this, SLOT(splitSideBySide()));
d->m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this); d->m_removeCurrentSplitAction = new QAction(tr("Remove Current Split"), this);
cmd = am->registerAction(d->m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext); cmd = ActionManager::registerAction(d->m_removeCurrentSplitAction, Constants::REMOVE_CURRENT_SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,0") : tr("Ctrl+E,0"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,0") : tr("Ctrl+E,0")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_removeCurrentSplitAction, SIGNAL(triggered()), this, SLOT(removeCurrentSplit())); connect(d->m_removeCurrentSplitAction, SIGNAL(triggered()), this, SLOT(removeCurrentSplit()));
d->m_removeAllSplitsAction = new QAction(tr("Remove All Splits"), this); d->m_removeAllSplitsAction = new QAction(tr("Remove All Splits"), this);
cmd = am->registerAction(d->m_removeAllSplitsAction, Constants::REMOVE_ALL_SPLITS, editManagerContext); cmd = ActionManager::registerAction(d->m_removeAllSplitsAction, Constants::REMOVE_ALL_SPLITS, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,1") : tr("Ctrl+E,1"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,1") : tr("Ctrl+E,1")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits())); connect(d->m_removeAllSplitsAction, SIGNAL(triggered()), this, SLOT(removeAllSplits()));
d->m_gotoOtherSplitAction = new QAction(tr("Go to Next Split"), this); d->m_gotoOtherSplitAction = new QAction(tr("Go to Next Split"), this);
cmd = am->registerAction(d->m_gotoOtherSplitAction, Constants::GOTO_OTHER_SPLIT, editManagerContext); cmd = ActionManager::registerAction(d->m_gotoOtherSplitAction, Constants::GOTO_OTHER_SPLIT, editManagerContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,o") : tr("Ctrl+E,o"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+E,o") : tr("Ctrl+E,o")));
mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT); mwindow->addAction(cmd, Constants::G_WINDOW_SPLIT);
connect(d->m_gotoOtherSplitAction, SIGNAL(triggered()), this, SLOT(gotoOtherSplit())); connect(d->m_gotoOtherSplitAction, SIGNAL(triggered()), this, SLOT(gotoOtherSplit()));
ActionContainer *medit = am->actionContainer(Constants::M_EDIT); ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT);
ActionContainer *advancedMenu = am->createMenu(Constants::M_EDIT_ADVANCED); ActionContainer *advancedMenu = ActionManager::createMenu(Constants::M_EDIT_ADVANCED);
medit->addMenu(advancedMenu, Constants::G_EDIT_ADVANCED); medit->addMenu(advancedMenu, Constants::G_EDIT_ADVANCED);
advancedMenu->menu()->setTitle(tr("Ad&vanced")); advancedMenu->menu()->setTitle(tr("Ad&vanced"));
advancedMenu->appendGroup(Constants::G_EDIT_FORMAT); advancedMenu->appendGroup(Constants::G_EDIT_FORMAT);
@@ -432,13 +431,13 @@ EditorManager::EditorManager(QWidget *parent) :
advancedMenu->appendGroup(Constants::G_EDIT_EDITOR); advancedMenu->appendGroup(Constants::G_EDIT_EDITOR);
// Advanced menu separators // Advanced menu separators
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Collapsing"), editManagerContext); cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Collapsing"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_COLLAPSING); advancedMenu->addAction(cmd, Constants::G_EDIT_COLLAPSING);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Blocks"), editManagerContext); cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Blocks"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_BLOCKS); advancedMenu->addAction(cmd, Constants::G_EDIT_BLOCKS);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Font"), editManagerContext); cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Font"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Constants::G_EDIT_FONT);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Editor"), editManagerContext); cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Editor"), editManagerContext);
advancedMenu->addAction(cmd, Constants::G_EDIT_EDITOR); advancedMenu->addAction(cmd, Constants::G_EDIT_EDITOR);
// other setup // other setup

View File

@@ -200,12 +200,11 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
this, SIGNAL(closeSplitClicked()), Qt::QueuedConnection); this, SIGNAL(closeSplitClicked()), Qt::QueuedConnection);
ActionManager *am = ICore::actionManager(); connect(ActionManager::command(Constants::CLOSE), SIGNAL(keySequenceChanged()),
connect(am->command(Constants::CLOSE), SIGNAL(keySequenceChanged()),
this, SLOT(updateActionShortcuts())); this, SLOT(updateActionShortcuts()));
connect(am->command(Constants::GO_BACK), SIGNAL(keySequenceChanged()), connect(ActionManager::command(Constants::GO_BACK), SIGNAL(keySequenceChanged()),
this, SLOT(updateActionShortcuts())); this, SLOT(updateActionShortcuts()));
connect(am->command(Constants::GO_FORWARD), SIGNAL(keySequenceChanged()), connect(ActionManager::command(Constants::GO_FORWARD), SIGNAL(keySequenceChanged()),
this, SLOT(updateActionShortcuts())); this, SLOT(updateActionShortcuts()));
updateActionShortcuts(); updateActionShortcuts();
@@ -362,11 +361,10 @@ void EditorToolBar::setCanGoForward(bool canGoForward)
void EditorToolBar::updateActionShortcuts() void EditorToolBar::updateActionShortcuts()
{ {
ActionManager *am = ICore::actionManager(); d->m_closeEditorButton->setToolTip(ActionManager::command(Constants::CLOSE)->stringWithAppendedShortcut(EditorManager::tr("Close Document")));
d->m_closeEditorButton->setToolTip(am->command(Constants::CLOSE)->stringWithAppendedShortcut(EditorManager::tr("Close Document"))); d->m_goBackAction->setToolTip(ActionManager::command(Constants::GO_BACK)->action()->toolTip());
d->m_goBackAction->setToolTip(am->command(Constants::GO_BACK)->action()->toolTip()); d->m_goForwardAction->setToolTip(ActionManager::command(Constants::GO_FORWARD)->action()->toolTip());
d->m_goForwardAction->setToolTip(am->command(Constants::GO_FORWARD)->action()->toolTip()); d->m_closeSplitButton->setToolTip(ActionManager::command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(tr("Remove Split")));
d->m_closeSplitButton->setToolTip(am->command(Constants::REMOVE_CURRENT_SPLIT)->stringWithAppendedShortcut(tr("Remove Split")));
} }
void EditorToolBar::checkEditorStatus() void EditorToolBar::checkEditorStatus()

View File

@@ -710,10 +710,9 @@ void ExternalToolManager::initialize()
connect(m_configureAction, SIGNAL(triggered()), this, SLOT(openPreferences())); connect(m_configureAction, SIGNAL(triggered()), this, SLOT(openPreferences()));
// add the external tools menu // add the external tools menu
ActionManager *am = ICore::actionManager(); ActionContainer *mexternaltools = ActionManager::createMenu(Id(Constants::M_TOOLS_EXTERNAL));
ActionContainer *mexternaltools = am->createMenu(Id(Constants::M_TOOLS_EXTERNAL));
mexternaltools->menu()->setTitle(tr("&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); mtools->addMenu(mexternaltools, Constants::G_DEFAULT_THREE);
QMap<QString, QMultiMap<int, ExternalTool*> > categoryPriorityMap; 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) void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal::ExternalTool *> > &tools)
{ {
// clear menu // clear menu
ActionManager *am = ICore::actionManager(); ActionContainer *mexternaltools = ActionManager::actionContainer(Id(Constants::M_TOOLS_EXTERNAL));
ActionContainer *mexternaltools = am->actionContainer(Id(Constants::M_TOOLS_EXTERNAL));
mexternaltools->clear(); mexternaltools->clear();
// delete old tools and create list of new ones // 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."); const QString externalToolsPrefix = QLatin1String("Tools.External.");
while (remainingActions.hasNext()) { while (remainingActions.hasNext()) {
remainingActions.next(); remainingActions.next();
am->unregisterAction(remainingActions.value(), Id(externalToolsPrefix + remainingActions.key())); ActionManager::unregisterAction(remainingActions.value(), Id(externalToolsPrefix + remainingActions.key()));
delete remainingActions.value(); delete remainingActions.value();
} }
m_actions.clear(); m_actions.clear();
@@ -847,7 +845,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
if (m_containers.contains(containerName)) { if (m_containers.contains(containerName)) {
container = m_containers.take(containerName); // remove to avoid deletion below container = m_containers.take(containerName); // remove to avoid deletion below
} else { } else {
container = am->createMenu(Id(QLatin1String("Tools.External.Category.") + containerName)); container = ActionManager::createMenu(Id(QLatin1String("Tools.External.Category.") + containerName));
} }
newContainers.insert(containerName, container); newContainers.insert(containerName, container);
mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE); mexternaltools->addMenu(container, Constants::G_DEFAULT_ONE);
@@ -860,13 +858,13 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<Internal:
Command *command = 0; Command *command = 0;
if (m_actions.contains(toolId)) { if (m_actions.contains(toolId)) {
action = m_actions.value(toolId); action = m_actions.value(toolId);
command = am->command(Id(externalToolsPrefix + toolId)); command = ActionManager::command(Id(externalToolsPrefix + toolId));
} else { } else {
action = new QAction(tool->displayName(), this); action = new QAction(tool->displayName(), this);
action->setData(toolId); action->setData(toolId);
m_actions.insert(toolId, action); m_actions.insert(toolId, action);
connect(action, SIGNAL(triggered()), this, SLOT(menuActivated())); 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); command->setAttribute(Command::CA_UpdateText);
} }
action->setText(tool->displayName()); action->setText(tool->displayName());

View File

@@ -94,7 +94,7 @@ public:
const QString &settingsId = QString(), const QString &settingsId = QString(),
QWidget *parent = 0); QWidget *parent = 0);
static ActionManager *actionManager(); static QT_DEPRECATED ActionManager *actionManager(); // Use Actionmanager::... directly.
static QT_DEPRECATED DocumentManager *documentManager(); // Use DocumentManager::... directly. static QT_DEPRECATED DocumentManager *documentManager(); // Use DocumentManager::... directly.
static MessageManager *messageManager(); static MessageManager *messageManager();
static EditorManager *editorManager(); static EditorManager *editorManager();

View File

@@ -33,6 +33,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "actioncontainer.h" #include "actioncontainer.h"
#include "command.h" #include "command.h"
#include "actionmanager.h"
#include "actionmanager_p.h" #include "actionmanager_p.h"
#include "icore.h" #include "icore.h"
#include "coreconstants.h" #include "coreconstants.h"
@@ -138,7 +139,7 @@ MainWindow::MainWindow() :
QLatin1String("QtCreator"), QLatin1String("QtCreator"),
this)), this)),
m_printer(0), m_printer(0),
m_actionManager(new ActionManagerPrivate(this)), m_actionManager(new ActionManager(this)),
m_editorManager(0), m_editorManager(0),
m_externalToolManager(0), m_externalToolManager(0),
m_progressManager(new ProgressManagerPrivate()), m_progressManager(new ProgressManagerPrivate()),
@@ -266,16 +267,6 @@ void MainWindow::setOverrideColor(const QColor &color)
m_overrideColor = color; m_overrideColor = color;
} }
bool MainWindow::isPresentationModeEnabled()
{
return m_actionManager->isPresentationModeEnabled();
}
void MainWindow::setPresentationModeEnabled(bool enabled)
{
m_actionManager->setPresentationModeEnabled(enabled);
}
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
void MainWindow::setIsFullScreen(bool fullScreen) void MainWindow::setIsFullScreen(bool fullScreen)
{ {
@@ -384,7 +375,7 @@ void MainWindow::extensionsInitialized()
m_navigationWidget->setFactories(ExtensionSystem::PluginManager::instance()->getObjects<INavigationWidgetFactory>()); m_navigationWidget->setFactories(ExtensionSystem::PluginManager::instance()->getObjects<INavigationWidgetFactory>());
// reading the shortcut settings must be done after all shortcuts have been registered // reading the shortcut settings must be done after all shortcuts have been registered
m_actionManager->initialize(); m_actionManager->d->initialize();
readSettings(); readSettings();
updateContext(); updateContext();
@@ -497,9 +488,7 @@ QStatusBar *MainWindow::statusBar() const
void MainWindow::registerDefaultContainers() void MainWindow::registerDefaultContainers()
{ {
ActionManagerPrivate *am = m_actionManager; ActionContainer *menubar = ActionManager::createMenuBar(Constants::MENU_BAR);
ActionContainer *menubar = am->createMenuBar(Constants::MENU_BAR);
#ifndef Q_OS_MAC // System menu bar on Mac #ifndef Q_OS_MAC // System menu bar on Mac
setMenuBar(menubar->menuBar()); setMenuBar(menubar->menuBar());
@@ -512,7 +501,7 @@ void MainWindow::registerDefaultContainers()
menubar->appendGroup(Constants::G_HELP); menubar->appendGroup(Constants::G_HELP);
// File Menu // File Menu
ActionContainer *filemenu = am->createMenu(Constants::M_FILE); ActionContainer *filemenu = ActionManager::createMenu(Constants::M_FILE);
menubar->addMenu(filemenu, Constants::G_FILE); menubar->addMenu(filemenu, Constants::G_FILE);
filemenu->menu()->setTitle(tr("&File")); filemenu->menu()->setTitle(tr("&File"));
filemenu->appendGroup(Constants::G_FILE_NEW); filemenu->appendGroup(Constants::G_FILE_NEW);
@@ -526,7 +515,7 @@ void MainWindow::registerDefaultContainers()
// Edit Menu // Edit Menu
ActionContainer *medit = am->createMenu(Constants::M_EDIT); ActionContainer *medit = ActionManager::createMenu(Constants::M_EDIT);
menubar->addMenu(medit, Constants::G_EDIT); menubar->addMenu(medit, Constants::G_EDIT);
medit->menu()->setTitle(tr("&Edit")); medit->menu()->setTitle(tr("&Edit"));
medit->appendGroup(Constants::G_EDIT_UNDOREDO); medit->appendGroup(Constants::G_EDIT_UNDOREDO);
@@ -537,12 +526,12 @@ void MainWindow::registerDefaultContainers()
medit->appendGroup(Constants::G_EDIT_OTHER); medit->appendGroup(Constants::G_EDIT_OTHER);
// Tools Menu // Tools Menu
ActionContainer *ac = am->createMenu(Constants::M_TOOLS); ActionContainer *ac = ActionManager::createMenu(Constants::M_TOOLS);
menubar->addMenu(ac, Constants::G_TOOLS); menubar->addMenu(ac, Constants::G_TOOLS);
ac->menu()->setTitle(tr("&Tools")); ac->menu()->setTitle(tr("&Tools"));
// Window Menu // Window Menu
ActionContainer *mwindow = am->createMenu(Constants::M_WINDOW); ActionContainer *mwindow = ActionManager::createMenu(Constants::M_WINDOW);
menubar->addMenu(mwindow, Constants::G_WINDOW); menubar->addMenu(mwindow, Constants::G_WINDOW);
mwindow->menu()->setTitle(tr("&Window")); mwindow->menu()->setTitle(tr("&Window"));
mwindow->appendGroup(Constants::G_WINDOW_SIZE); mwindow->appendGroup(Constants::G_WINDOW_SIZE);
@@ -553,71 +542,70 @@ void MainWindow::registerDefaultContainers()
mwindow->appendGroup(Constants::G_WINDOW_OTHER); mwindow->appendGroup(Constants::G_WINDOW_OTHER);
// Help Menu // Help Menu
ac = am->createMenu(Constants::M_HELP); ac = ActionManager::createMenu(Constants::M_HELP);
menubar->addMenu(ac, Constants::G_HELP); menubar->addMenu(ac, Constants::G_HELP);
ac->menu()->setTitle(tr("&Help")); ac->menu()->setTitle(tr("&Help"));
ac->appendGroup(Constants::G_HELP_HELP); ac->appendGroup(Constants::G_HELP_HELP);
ac->appendGroup(Constants::G_HELP_ABOUT); ac->appendGroup(Constants::G_HELP_ABOUT);
} }
static Command *createSeparator(ActionManager *am, QObject *parent, static Command *createSeparator(QObject *parent,
const Id &id, const Context &context) const Id &id, const Context &context)
{ {
QAction *tmpaction = new QAction(parent); QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true); tmpaction->setSeparator(true);
Command *cmd = am->registerAction(tmpaction, id, context); Command *cmd = ActionManager::registerAction(tmpaction, id, context);
return cmd; return cmd;
} }
void MainWindow::registerDefaultActions() void MainWindow::registerDefaultActions()
{ {
ActionManagerPrivate *am = m_actionManager; ActionContainer *mfile = ActionManager::actionContainer(Constants::M_FILE);
ActionContainer *mfile = am->actionContainer(Constants::M_FILE); ActionContainer *medit = ActionManager::actionContainer(Constants::M_EDIT);
ActionContainer *medit = am->actionContainer(Constants::M_EDIT); ActionContainer *mtools = ActionManager::actionContainer(Constants::M_TOOLS);
ActionContainer *mtools = am->actionContainer(Constants::M_TOOLS); ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); ActionContainer *mhelp = ActionManager::actionContainer(Constants::M_HELP);
ActionContainer *mhelp = am->actionContainer(Constants::M_HELP);
Context globalContext(Constants::C_GLOBAL); Context globalContext(Constants::C_GLOBAL);
// File menu separators // File menu separators
Command *cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Save"), globalContext); Command *cmd = createSeparator(this, Id("QtCreator.File.Sep.Save"), globalContext);
mfile->addAction(cmd, Constants::G_FILE_SAVE); mfile->addAction(cmd, Constants::G_FILE_SAVE);
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Print"), globalContext); cmd = createSeparator(this, Id("QtCreator.File.Sep.Print"), globalContext);
QIcon icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT))); QIcon icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT)));
mfile->addAction(cmd, Constants::G_FILE_PRINT); mfile->addAction(cmd, Constants::G_FILE_PRINT);
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Close"), globalContext); cmd = createSeparator(this, Id("QtCreator.File.Sep.Close"), globalContext);
mfile->addAction(cmd, Constants::G_FILE_CLOSE); mfile->addAction(cmd, Constants::G_FILE_CLOSE);
cmd = createSeparator(am, this, Id("QtCreator.File.Sep.Other"), globalContext); cmd = createSeparator(this, Id("QtCreator.File.Sep.Other"), globalContext);
mfile->addAction(cmd, Constants::G_FILE_OTHER); mfile->addAction(cmd, Constants::G_FILE_OTHER);
// Edit menu separators // Edit menu separators
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.CopyPaste"), globalContext); cmd = createSeparator(this, Id("QtCreator.Edit.Sep.CopyPaste"), globalContext);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.SelectAll"), globalContext); cmd = createSeparator(this, Id("QtCreator.Edit.Sep.SelectAll"), globalContext);
medit->addAction(cmd, Constants::G_EDIT_SELECTALL); medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Find"), globalContext); cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Find"), globalContext);
medit->addAction(cmd, Constants::G_EDIT_FIND); medit->addAction(cmd, Constants::G_EDIT_FIND);
cmd = createSeparator(am, this, Id("QtCreator.Edit.Sep.Advanced"), globalContext); cmd = createSeparator(this, Id("QtCreator.Edit.Sep.Advanced"), globalContext);
medit->addAction(cmd, Constants::G_EDIT_ADVANCED); medit->addAction(cmd, Constants::G_EDIT_ADVANCED);
// Return to editor shortcut: Note this requires Qt to fix up // Return to editor shortcut: Note this requires Qt to fix up
// handling of shortcut overrides in menus, item views, combos.... // handling of shortcut overrides in menus, item views, combos....
m_focusToEditor = new QShortcut(this); m_focusToEditor = new QShortcut(this);
cmd = am->registerShortcut(m_focusToEditor, Constants::S_RETURNTOEDITOR, globalContext); cmd = ActionManager::registerShortcut(m_focusToEditor, Constants::S_RETURNTOEDITOR, globalContext);
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_Escape)); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_Escape));
connect(m_focusToEditor, SIGNAL(activated()), this, SLOT(setFocusToEditor())); connect(m_focusToEditor, SIGNAL(activated()), this, SLOT(setFocusToEditor()));
// New File Action // New File Action
icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(Constants::ICON_NEWFILE))); icon = QIcon::fromTheme(QLatin1String("document-new"), QIcon(QLatin1String(Constants::ICON_NEWFILE)));
m_newAction = new QAction(icon, tr("&New File or Project..."), this); m_newAction = new QAction(icon, tr("&New File or Project..."), this);
cmd = am->registerAction(m_newAction, Constants::NEW, globalContext); cmd = ActionManager::registerAction(m_newAction, Constants::NEW, globalContext);
cmd->setDefaultKeySequence(QKeySequence::New); cmd->setDefaultKeySequence(QKeySequence::New);
mfile->addAction(cmd, Constants::G_FILE_NEW); mfile->addAction(cmd, Constants::G_FILE_NEW);
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile())); connect(m_newAction, SIGNAL(triggered()), this, SLOT(newFile()));
@@ -625,19 +613,19 @@ void MainWindow::registerDefaultActions()
// Open Action // Open Action
icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(QLatin1String(Constants::ICON_OPENFILE))); icon = QIcon::fromTheme(QLatin1String("document-open"), QIcon(QLatin1String(Constants::ICON_OPENFILE)));
m_openAction = new QAction(icon, tr("&Open File or Project..."), this); m_openAction = new QAction(icon, tr("&Open File or Project..."), this);
cmd = am->registerAction(m_openAction, Constants::OPEN, globalContext); cmd = ActionManager::registerAction(m_openAction, Constants::OPEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Open); cmd->setDefaultKeySequence(QKeySequence::Open);
mfile->addAction(cmd, Constants::G_FILE_OPEN); mfile->addAction(cmd, Constants::G_FILE_OPEN);
connect(m_openAction, SIGNAL(triggered()), this, SLOT(openFile())); connect(m_openAction, SIGNAL(triggered()), this, SLOT(openFile()));
// Open With Action // Open With Action
m_openWithAction = new QAction(tr("Open File &With..."), this); m_openWithAction = new QAction(tr("Open File &With..."), this);
cmd = am->registerAction(m_openWithAction, Constants::OPEN_WITH, globalContext); cmd = ActionManager::registerAction(m_openWithAction, Constants::OPEN_WITH, globalContext);
mfile->addAction(cmd, Constants::G_FILE_OPEN); mfile->addAction(cmd, Constants::G_FILE_OPEN);
connect(m_openWithAction, SIGNAL(triggered()), this, SLOT(openFileWith())); connect(m_openWithAction, SIGNAL(triggered()), this, SLOT(openFileWith()));
// File->Recent Files Menu // File->Recent Files Menu
ActionContainer *ac = am->createMenu(Constants::M_FILE_RECENTFILES); ActionContainer *ac = ActionManager::createMenu(Constants::M_FILE_RECENTFILES);
mfile->addMenu(ac, Constants::G_FILE_OPEN); mfile->addMenu(ac, Constants::G_FILE_OPEN);
ac->menu()->setTitle(tr("Recent &Files")); ac->menu()->setTitle(tr("Recent &Files"));
ac->setOnAllDisabledBehavior(ActionContainer::Show); ac->setOnAllDisabledBehavior(ActionContainer::Show);
@@ -646,7 +634,7 @@ void MainWindow::registerDefaultActions()
icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(QLatin1String(Constants::ICON_SAVEFILE))); icon = QIcon::fromTheme(QLatin1String("document-save"), QIcon(QLatin1String(Constants::ICON_SAVEFILE)));
QAction *tmpaction = new QAction(icon, tr("&Save"), this); QAction *tmpaction = new QAction(icon, tr("&Save"), this);
tmpaction->setEnabled(false); tmpaction->setEnabled(false);
cmd = am->registerAction(tmpaction, Constants::SAVE, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::SAVE, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Save); cmd->setDefaultKeySequence(QKeySequence::Save);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(tr("Save")); cmd->setDescription(tr("Save"));
@@ -656,7 +644,7 @@ void MainWindow::registerDefaultActions()
icon = QIcon::fromTheme(QLatin1String("document-save-as")); icon = QIcon::fromTheme(QLatin1String("document-save-as"));
tmpaction = new QAction(icon, tr("Save &As..."), this); tmpaction = new QAction(icon, tr("Save &As..."), this);
tmpaction->setEnabled(false); tmpaction->setEnabled(false);
cmd = am->registerAction(tmpaction, Constants::SAVEAS, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::SAVEAS, globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+S") : QString())); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+S") : QString()));
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(tr("Save As...")); cmd->setDescription(tr("Save As..."));
@@ -664,7 +652,7 @@ void MainWindow::registerDefaultActions()
// SaveAll Action // SaveAll Action
m_saveAllAction = new QAction(tr("Save A&ll"), this); m_saveAllAction = new QAction(tr("Save A&ll"), this);
cmd = am->registerAction(m_saveAllAction, Constants::SAVEALL, globalContext); cmd = ActionManager::registerAction(m_saveAllAction, Constants::SAVEALL, globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("Ctrl+Shift+S"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("Ctrl+Shift+S")));
mfile->addAction(cmd, Constants::G_FILE_SAVE); mfile->addAction(cmd, Constants::G_FILE_SAVE);
connect(m_saveAllAction, SIGNAL(triggered()), this, SLOT(saveAll())); connect(m_saveAllAction, SIGNAL(triggered()), this, SLOT(saveAll()));
@@ -673,14 +661,14 @@ void MainWindow::registerDefaultActions()
icon = QIcon::fromTheme(QLatin1String("document-print")); icon = QIcon::fromTheme(QLatin1String("document-print"));
tmpaction = new QAction(icon, tr("&Print..."), this); tmpaction = new QAction(icon, tr("&Print..."), this);
tmpaction->setEnabled(false); tmpaction->setEnabled(false);
cmd = am->registerAction(tmpaction, Constants::PRINT, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::PRINT, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Print); cmd->setDefaultKeySequence(QKeySequence::Print);
mfile->addAction(cmd, Constants::G_FILE_PRINT); mfile->addAction(cmd, Constants::G_FILE_PRINT);
// Exit Action // Exit Action
icon = QIcon::fromTheme(QLatin1String("application-exit")); icon = QIcon::fromTheme(QLatin1String("application-exit"));
m_exitAction = new QAction(icon, tr("E&xit"), this); m_exitAction = new QAction(icon, tr("E&xit"), this);
cmd = am->registerAction(m_exitAction, Constants::EXIT, globalContext); cmd = ActionManager::registerAction(m_exitAction, Constants::EXIT, globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Q")));
mfile->addAction(cmd, Constants::G_FILE_OTHER); mfile->addAction(cmd, Constants::G_FILE_OTHER);
connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit())); connect(m_exitAction, SIGNAL(triggered()), this, SLOT(exit()));
@@ -688,7 +676,7 @@ void MainWindow::registerDefaultActions()
// Undo Action // Undo Action
icon = QIcon::fromTheme(QLatin1String("edit-undo"), QIcon(QLatin1String(Constants::ICON_UNDO))); icon = QIcon::fromTheme(QLatin1String("edit-undo"), QIcon(QLatin1String(Constants::ICON_UNDO)));
tmpaction = new QAction(icon, tr("&Undo"), this); tmpaction = new QAction(icon, tr("&Undo"), this);
cmd = am->registerAction(tmpaction, Constants::UNDO, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::UNDO, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Undo); cmd->setDefaultKeySequence(QKeySequence::Undo);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(tr("Undo")); cmd->setDescription(tr("Undo"));
@@ -698,7 +686,7 @@ void MainWindow::registerDefaultActions()
// Redo Action // Redo Action
icon = QIcon::fromTheme(QLatin1String("edit-redo"), QIcon(QLatin1String(Constants::ICON_REDO))); icon = QIcon::fromTheme(QLatin1String("edit-redo"), QIcon(QLatin1String(Constants::ICON_REDO)));
tmpaction = new QAction(icon, tr("&Redo"), this); tmpaction = new QAction(icon, tr("&Redo"), this);
cmd = am->registerAction(tmpaction, Constants::REDO, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::REDO, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Redo); cmd->setDefaultKeySequence(QKeySequence::Redo);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(tr("Redo")); cmd->setDescription(tr("Redo"));
@@ -708,7 +696,7 @@ void MainWindow::registerDefaultActions()
// Cut Action // Cut Action
icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT))); icon = QIcon::fromTheme(QLatin1String("edit-cut"), QIcon(QLatin1String(Constants::ICON_CUT)));
tmpaction = new QAction(icon, tr("Cu&t"), this); tmpaction = new QAction(icon, tr("Cu&t"), this);
cmd = am->registerAction(tmpaction, Constants::CUT, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::CUT, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Cut); cmd->setDefaultKeySequence(QKeySequence::Cut);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
tmpaction->setEnabled(false); tmpaction->setEnabled(false);
@@ -716,7 +704,7 @@ void MainWindow::registerDefaultActions()
// Copy Action // Copy Action
icon = QIcon::fromTheme(QLatin1String("edit-copy"), QIcon(QLatin1String(Constants::ICON_COPY))); icon = QIcon::fromTheme(QLatin1String("edit-copy"), QIcon(QLatin1String(Constants::ICON_COPY)));
tmpaction = new QAction(icon, tr("&Copy"), this); tmpaction = new QAction(icon, tr("&Copy"), this);
cmd = am->registerAction(tmpaction, Constants::COPY, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::COPY, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Copy); cmd->setDefaultKeySequence(QKeySequence::Copy);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
tmpaction->setEnabled(false); tmpaction->setEnabled(false);
@@ -724,7 +712,7 @@ void MainWindow::registerDefaultActions()
// Paste Action // Paste Action
icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(QLatin1String(Constants::ICON_PASTE))); icon = QIcon::fromTheme(QLatin1String("edit-paste"), QIcon(QLatin1String(Constants::ICON_PASTE)));
tmpaction = new QAction(icon, tr("&Paste"), this); tmpaction = new QAction(icon, tr("&Paste"), this);
cmd = am->registerAction(tmpaction, Constants::PASTE, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::PASTE, globalContext);
cmd->setDefaultKeySequence(QKeySequence::Paste); cmd->setDefaultKeySequence(QKeySequence::Paste);
medit->addAction(cmd, Constants::G_EDIT_COPYPASTE); medit->addAction(cmd, Constants::G_EDIT_COPYPASTE);
tmpaction->setEnabled(false); tmpaction->setEnabled(false);
@@ -732,7 +720,7 @@ void MainWindow::registerDefaultActions()
// Select All // Select All
icon = QIcon::fromTheme(QLatin1String("edit-select-all")); icon = QIcon::fromTheme(QLatin1String("edit-select-all"));
tmpaction = new QAction(icon, tr("Select &All"), this); tmpaction = new QAction(icon, tr("Select &All"), this);
cmd = am->registerAction(tmpaction, Constants::SELECTALL, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::SELECTALL, globalContext);
cmd->setDefaultKeySequence(QKeySequence::SelectAll); cmd->setDefaultKeySequence(QKeySequence::SelectAll);
medit->addAction(cmd, Constants::G_EDIT_SELECTALL); medit->addAction(cmd, Constants::G_EDIT_SELECTALL);
tmpaction->setEnabled(false); tmpaction->setEnabled(false);
@@ -740,17 +728,17 @@ void MainWindow::registerDefaultActions()
// Goto Action // Goto Action
icon = QIcon::fromTheme(QLatin1String("go-jump")); icon = QIcon::fromTheme(QLatin1String("go-jump"));
tmpaction = new QAction(icon, tr("&Go to Line..."), this); tmpaction = new QAction(icon, tr("&Go to Line..."), this);
cmd = am->registerAction(tmpaction, Constants::GOTO, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::GOTO, globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+L")));
medit->addAction(cmd, Constants::G_EDIT_OTHER); medit->addAction(cmd, Constants::G_EDIT_OTHER);
tmpaction->setEnabled(false); tmpaction->setEnabled(false);
// Options Action // Options Action
mtools->appendGroup(Constants::G_TOOLS_OPTIONS); mtools->appendGroup(Constants::G_TOOLS_OPTIONS);
cmd = createSeparator(am, this, Id("QtCreator.Tools.Sep.Options"), globalContext); cmd = createSeparator(this, Id("QtCreator.Tools.Sep.Options"), globalContext);
mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS); mtools->addAction(cmd, Constants::G_TOOLS_OPTIONS);
m_optionsAction = new QAction(tr("&Options..."), this); m_optionsAction = new QAction(tr("&Options..."), this);
cmd = am->registerAction(m_optionsAction, Constants::OPTIONS, globalContext); cmd = ActionManager::registerAction(m_optionsAction, Constants::OPTIONS, globalContext);
if (UseMacShortcuts) { if (UseMacShortcuts) {
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+,")));
cmd->action()->setMenuRole(QAction::PreferencesRole); cmd->action()->setMenuRole(QAction::PreferencesRole);
@@ -761,19 +749,19 @@ void MainWindow::registerDefaultActions()
if (UseMacShortcuts) { if (UseMacShortcuts) {
// Minimize Action // Minimize Action
m_minimizeAction = new QAction(tr("Minimize"), this); m_minimizeAction = new QAction(tr("Minimize"), this);
cmd = am->registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext); cmd = ActionManager::registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized())); connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
// Zoom Action // Zoom Action
m_zoomAction = new QAction(tr("Zoom"), this); m_zoomAction = new QAction(tr("Zoom"), this);
cmd = am->registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext); cmd = ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized())); connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
// Window separator // Window separator
cmd = createSeparator(am, this, Id("QtCreator.Window.Sep.Size"), globalContext); cmd = createSeparator(this, Id("QtCreator.Window.Sep.Size"), globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
} }
@@ -781,7 +769,7 @@ void MainWindow::registerDefaultActions()
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)), m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
tr("Show Sidebar"), this); tr("Show Sidebar"), this);
m_toggleSideBarAction->setCheckable(true); m_toggleSideBarAction->setCheckable(true);
cmd = am->registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext); cmd = ActionManager::registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+0") : tr("Alt+0"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+0") : tr("Alt+0")));
connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool))); connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));
@@ -802,7 +790,7 @@ void MainWindow::registerDefaultActions()
// Full Screen Action // Full Screen Action
m_toggleFullScreenAction = new QAction(fullScreenActionText, this); m_toggleFullScreenAction = new QAction(fullScreenActionText, this);
m_toggleFullScreenAction->setCheckable(fullScreenCheckable); m_toggleFullScreenAction->setCheckable(fullScreenCheckable);
cmd = am->registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext); cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
cmd->setAttribute(Command::CA_UpdateText); /* for Mac */ cmd->setAttribute(Command::CA_UpdateText); /* for Mac */
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
@@ -810,7 +798,7 @@ void MainWindow::registerDefaultActions()
} }
// Window->Views // Window->Views
ActionContainer *mviews = am->createMenu(Constants::M_WINDOW_VIEWS); ActionContainer *mviews = ActionManager::createMenu(Constants::M_WINDOW_VIEWS);
mwindow->addMenu(mviews, Constants::G_WINDOW_VIEWS); mwindow->addMenu(mviews, Constants::G_WINDOW_VIEWS);
mviews->menu()->setTitle(tr("&Views")); mviews->menu()->setTitle(tr("&Views"));
@@ -821,7 +809,7 @@ void MainWindow::registerDefaultActions()
#else #else
tmpaction = new QAction(icon, tr("About &Qt Creator..."), this); tmpaction = new QAction(icon, tr("About &Qt Creator..."), this);
#endif #endif
cmd = am->registerAction(tmpaction, Constants::ABOUT_QTCREATOR, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_QTCREATOR, globalContext);
mhelp->addAction(cmd, Constants::G_HELP_ABOUT); mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
tmpaction->setEnabled(true); tmpaction->setEnabled(true);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@@ -831,7 +819,7 @@ void MainWindow::registerDefaultActions()
//About Plugins Action //About Plugins Action
tmpaction = new QAction(tr("About &Plugins..."), this); tmpaction = new QAction(tr("About &Plugins..."), this);
cmd = am->registerAction(tmpaction, Constants::ABOUT_PLUGINS, globalContext); cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_PLUGINS, globalContext);
mhelp->addAction(cmd, Constants::G_HELP_ABOUT); mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
tmpaction->setEnabled(true); tmpaction->setEnabled(true);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
@@ -840,7 +828,7 @@ void MainWindow::registerDefaultActions()
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutPlugins())); connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutPlugins()));
// About Qt Action // About Qt Action
// tmpaction = new QAction(tr("About &Qt..."), this); // tmpaction = new QAction(tr("About &Qt..."), this);
// cmd = am->registerAction(tmpaction, Constants:: ABOUT_QT, globalContext); // cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT, globalContext);
// mhelp->addAction(cmd, Constants::G_HELP_ABOUT); // mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
// tmpaction->setEnabled(true); // tmpaction->setEnabled(true);
// connect(tmpaction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); // connect(tmpaction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
@@ -848,7 +836,7 @@ void MainWindow::registerDefaultActions()
#ifndef Q_OS_MAC // doesn't have the "About" actions in the Help menu #ifndef Q_OS_MAC // doesn't have the "About" actions in the Help menu
tmpaction = new QAction(this); tmpaction = new QAction(this);
tmpaction->setSeparator(true); tmpaction->setSeparator(true);
cmd = am->registerAction(tmpaction, "QtCreator.Help.Sep.About", globalContext); cmd = ActionManager::registerAction(tmpaction, "QtCreator.Help.Sep.About", globalContext);
mhelp->addAction(cmd, Constants::G_HELP_ABOUT); mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
#endif #endif
} }
@@ -1256,7 +1244,7 @@ void MainWindow::writeSettings()
m_settings->endGroup(); m_settings->endGroup();
DocumentManager::saveSettings(); DocumentManager::saveSettings();
m_actionManager->saveSettings(m_settings); m_actionManager->d->saveSettings(m_settings);
m_editorManager->saveSettings(); m_editorManager->saveSettings();
m_navigationWidget->saveSettings(m_settings); m_navigationWidget->saveSettings(m_settings);
} }
@@ -1285,7 +1273,7 @@ void MainWindow::updateAdditionalContexts(const Context &remove, const Context &
bool MainWindow::hasContext(int context) const bool MainWindow::hasContext(int context) const
{ {
return m_actionManager->hasContext(context); return ActionManager::hasContext(context);
} }
void MainWindow::updateContext() void MainWindow::updateContext()
@@ -1304,14 +1292,14 @@ void MainWindow::updateContext()
uniquecontexts.add(c); uniquecontexts.add(c);
} }
m_actionManager->setContext(uniquecontexts); m_actionManager->d->setContext(uniquecontexts);
emit m_coreImpl->contextChanged(m_activeContext, m_additionalContexts); emit m_coreImpl->contextChanged(m_activeContext, m_additionalContexts);
} }
void MainWindow::aboutToShowRecentFiles() void MainWindow::aboutToShowRecentFiles()
{ {
ActionContainer *aci = ActionContainer *aci =
m_actionManager->actionContainer(Constants::M_FILE_RECENTFILES); ActionManager::actionContainer(Constants::M_FILE_RECENTFILES);
aci->menu()->clear(); aci->menu()->clear();
bool hasRecentFiles = false; bool hasRecentFiles = false;

View File

@@ -124,9 +124,6 @@ public:
void setOverrideColor(const QColor &color); void setOverrideColor(const QColor &color);
bool isPresentationModeEnabled();
void setPresentationModeEnabled(bool);
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
void setIsFullScreen(bool fullScreen); void setIsFullScreen(bool fullScreen);
#endif #endif
@@ -189,7 +186,7 @@ private:
QSettings *m_globalSettings; QSettings *m_globalSettings;
SettingsDatabase *m_settingsDatabase; SettingsDatabase *m_settingsDatabase;
mutable QPrinter *m_printer; mutable QPrinter *m_printer;
ActionManagerPrivate *m_actionManager; ActionManager *m_actionManager;
EditorManager *m_editorManager; EditorManager *m_editorManager;
ExternalToolManager *m_externalToolManager; ExternalToolManager *m_externalToolManager;
MessageManager *m_messageManager; MessageManager *m_messageManager;

View File

@@ -197,11 +197,10 @@ void ModeManager::objectAdded(QObject *obj)
d->m_modeStack->setTabEnabled(index, mode->isEnabled()); d->m_modeStack->setTabEnabled(index, mode->isEnabled());
// Register mode shortcut // Register mode shortcut
ActionManager *am = d->m_mainWindow->actionManager();
const Id shortcutId(QLatin1String("QtCreator.Mode.") + mode->id().toString()); const Id shortcutId(QLatin1String("QtCreator.Mode.") + mode->id().toString());
QShortcut *shortcut = new QShortcut(d->m_mainWindow); QShortcut *shortcut = new QShortcut(d->m_mainWindow);
shortcut->setWhatsThis(tr("Switch to <b>%1</b> mode").arg(mode->displayName())); shortcut->setWhatsThis(tr("Switch to <b>%1</b> mode").arg(mode->displayName()));
Command *cmd = am->registerShortcut(shortcut, shortcutId, Context(Constants::C_GLOBAL)); Command *cmd = ActionManager::registerShortcut(shortcut, shortcutId, Context(Constants::C_GLOBAL));
d->m_modeShortcuts.insert(index, cmd); d->m_modeShortcuts.insert(index, cmd);
connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip())); connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updateModeToolTip()));

View File

@@ -187,7 +187,6 @@ NavigationWidget *NavigationWidget::instance()
void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> factories) void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> factories)
{ {
ActionManager *am = ICore::actionManager();
Context navicontext(Core::Constants::C_NAVIGATION_PANE); Context navicontext(Core::Constants::C_NAVIGATION_PANE);
foreach (INavigationWidgetFactory *factory, factories) { foreach (INavigationWidgetFactory *factory, factories) {
@@ -198,7 +197,7 @@ void NavigationWidget::setFactories(const QList<INavigationWidgetFactory *> fact
connect(shortcut, SIGNAL(activated()), this, SLOT(activateSubWidget())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateSubWidget()));
d->m_shortcutMap.insert(shortcut, id); d->m_shortcutMap.insert(shortcut, id);
Command *cmd = am->registerShortcut(shortcut, Command *cmd = ActionManager::registerShortcut(shortcut,
Id(QLatin1String("QtCreator.Sidebar.") + QLatin1String(id.name())), navicontext); Id(QLatin1String("QtCreator.Sidebar.") + QLatin1String(id.name())), navicontext);
cmd->setDefaultKeySequence(factory->activationSequence()); cmd->setDefaultKeySequence(factory->activationSequence());
d->m_commandMap.insert(id, cmd); d->m_commandMap.insert(id, cmd);

View File

@@ -208,12 +208,11 @@ static inline int paneShortCut(int number)
void OutputPaneManager::init() void OutputPaneManager::init()
{ {
ActionManager *am = Core::ICore::actionManager(); ActionContainer *mwindow = ActionManager::actionContainer(Constants::M_WINDOW);
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
const Context globalContext(Constants::C_GLOBAL); const Context globalContext(Constants::C_GLOBAL);
// Window->Output Panes // Window->Output Panes
ActionContainer *mpanes = am->createMenu(Constants::M_WINDOW_PANES); ActionContainer *mpanes = ActionManager::createMenu(Constants::M_WINDOW_PANES);
mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES); mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES);
mpanes->menu()->setTitle(tr("Output &Panes")); mpanes->menu()->setTitle(tr("Output &Panes"));
mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup"); mpanes->appendGroup("Coreplugin.OutputPane.ActionsGroup");
@@ -221,21 +220,21 @@ void OutputPaneManager::init()
Command *cmd; Command *cmd;
cmd = am->registerAction(m_clearAction, "Coreplugin.OutputPane.clear", globalContext); cmd = ActionManager::registerAction(m_clearAction, "Coreplugin.OutputPane.clear", globalContext);
m_clearButton->setDefaultAction(cmd->action()); m_clearButton->setDefaultAction(cmd->action());
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = am->registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalContext); cmd = ActionManager::registerAction(m_prevAction, "Coreplugin.OutputPane.previtem", globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6"))); cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F6")));
m_prevToolButton->setDefaultAction(cmd->action()); m_prevToolButton->setDefaultAction(cmd->action());
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = am->registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalContext); cmd = ActionManager::registerAction(m_nextAction, "Coreplugin.OutputPane.nextitem", globalContext);
m_nextToolButton->setDefaultAction(cmd->action()); m_nextToolButton->setDefaultAction(cmd->action());
cmd->setDefaultKeySequence(QKeySequence(tr("F6"))); cmd->setDefaultKeySequence(QKeySequence(tr("F6")));
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = am->registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalContext); cmd = ActionManager::registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+9") : tr("Alt+9"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+9") : tr("Alt+9")));
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateIcon); cmd->setAttribute(Command::CA_UpdateIcon);
@@ -245,7 +244,7 @@ void OutputPaneManager::init()
QAction *sep = new QAction(this); QAction *sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, "Coreplugin.OutputPane.Sep", globalContext); cmd = ActionManager::registerAction(sep, "Coreplugin.OutputPane.Sep", globalContext);
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup"); mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
QFontMetrics titleFm = m_titleLabel->fontMetrics(); QFontMetrics titleFm = m_titleLabel->fontMetrics();
@@ -284,7 +283,7 @@ void OutputPaneManager::init()
actionId.remove(QLatin1Char(' ')); actionId.remove(QLatin1Char(' '));
Id id(actionId); Id id(actionId);
QAction *action = new QAction(outPane->displayName(), this); QAction *action = new QAction(outPane->displayName(), this);
Command *cmd = am->registerAction(action, id, globalContext); Command *cmd = ActionManager::registerAction(action, id, globalContext);
mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup"); mpanes->addAction(cmd, "Coreplugin.OutputPane.PanesGroup");
m_actions.append(cmd->action()); m_actions.append(cmd->action());

View File

@@ -75,13 +75,12 @@ OutputWindow::OutputWindow(Core::Context context, QWidget *parent)
QAction *pasteAction = new QAction(this); QAction *pasteAction = new QAction(this);
QAction *selectAllAction = new QAction(this); QAction *selectAllAction = new QAction(this);
Core::ActionManager *am = ICore::actionManager(); ActionManager::registerAction(undoAction, Core::Constants::UNDO, context);
am->registerAction(undoAction, Core::Constants::UNDO, context); ActionManager::registerAction(redoAction, Core::Constants::REDO, context);
am->registerAction(redoAction, Core::Constants::REDO, context); ActionManager::registerAction(cutAction, Core::Constants::CUT, context);
am->registerAction(cutAction, Core::Constants::CUT, context); ActionManager::registerAction(copyAction, Core::Constants::COPY, context);
am->registerAction(copyAction, Core::Constants::COPY, context); ActionManager::registerAction(pasteAction, Core::Constants::PASTE, context);
am->registerAction(pasteAction, Core::Constants::PASTE, context); ActionManager::registerAction(selectAllAction, Core::Constants::SELECTALL, context);
am->registerAction(selectAllAction, Core::Constants::SELECTALL, context);
connect(undoAction, SIGNAL(triggered()), this, SLOT(undo())); connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));
connect(redoAction, SIGNAL(triggered()), this, SLOT(redo())); connect(redoAction, SIGNAL(triggered()), this, SLOT(redo()));

View File

@@ -160,37 +160,36 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *errorMe
this, SLOT(finishFetch(QString,QString,bool))); this, SLOT(finishFetch(QString,QString,bool)));
//register actions //register actions
Core::ActionManager *actionManager = ICore::actionManager();
Core::ActionContainer *toolsContainer = Core::ActionContainer *toolsContainer =
actionManager->actionContainer(Core::Constants::M_TOOLS); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *cpContainer = Core::ActionContainer *cpContainer =
actionManager->createMenu(Core::Id("CodePaster")); Core::ActionManager::createMenu(Core::Id("CodePaster"));
cpContainer->menu()->setTitle(tr("&Code Pasting")); cpContainer->menu()->setTitle(tr("&Code Pasting"));
toolsContainer->addMenu(cpContainer); toolsContainer->addMenu(cpContainer);
Core::Command *command; Core::Command *command;
m_postEditorAction = new QAction(tr("Paste Snippet..."), this); m_postEditorAction = new QAction(tr("Paste Snippet..."), this);
command = actionManager->registerAction(m_postEditorAction, "CodePaster.Post", globalcontext); command = Core::ActionManager::registerAction(m_postEditorAction, "CodePaster.Post", globalcontext);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+P") : tr("Alt+C,Alt+P"))); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+P") : tr("Alt+C,Alt+P")));
connect(m_postEditorAction, SIGNAL(triggered()), this, SLOT(postEditor())); connect(m_postEditorAction, SIGNAL(triggered()), this, SLOT(postEditor()));
cpContainer->addAction(command); cpContainer->addAction(command);
m_postClipboardAction = new QAction(tr("Paste Clipboard..."), this); m_postClipboardAction = new QAction(tr("Paste Clipboard..."), this);
command = actionManager->registerAction(m_postClipboardAction, "CodePaster.PostClipboard", globalcontext); command = Core::ActionManager::registerAction(m_postClipboardAction, "CodePaster.PostClipboard", globalcontext);
connect(m_postClipboardAction, SIGNAL(triggered()), this, SLOT(postClipboard())); connect(m_postClipboardAction, SIGNAL(triggered()), this, SLOT(postClipboard()));
cpContainer->addAction(command); cpContainer->addAction(command);
m_fetchAction = new QAction(tr("Fetch Snippet..."), this); m_fetchAction = new QAction(tr("Fetch Snippet..."), this);
command = actionManager->registerAction(m_fetchAction, "CodePaster.Fetch", globalcontext); command = Core::ActionManager::registerAction(m_fetchAction, "CodePaster.Fetch", globalcontext);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+F") : tr("Alt+C,Alt+F"))); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+F") : tr("Alt+C,Alt+F")));
connect(m_fetchAction, SIGNAL(triggered()), this, SLOT(fetch())); connect(m_fetchAction, SIGNAL(triggered()), this, SLOT(fetch()));
cpContainer->addAction(command); cpContainer->addAction(command);
m_fetchUrlAction = new QAction(tr("Fetch from URL..."), this); m_fetchUrlAction = new QAction(tr("Fetch from URL..."), this);
command = actionManager->registerAction(m_fetchUrlAction, "CodePaster.FetchUrl", globalcontext); command = Core::ActionManager::registerAction(m_fetchUrlAction, "CodePaster.FetchUrl", globalcontext);
connect(m_fetchUrlAction, SIGNAL(triggered()), this, SLOT(fetchUrl())); connect(m_fetchUrlAction, SIGNAL(triggered()), this, SLOT(fetchUrl()));
cpContainer->addAction(command); cpContainer->addAction(command);

View File

@@ -1562,12 +1562,11 @@ void CPPEditorWidget::contextMenuEvent(QContextMenuEvent *e)
QMenu *menu = new QMenu; QMenu *menu = new QMenu;
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(Constants::M_CONTEXT);
Core::ActionContainer *mcontext = am->actionContainer(Constants::M_CONTEXT);
QMenu *contextMenu = mcontext->menu(); QMenu *contextMenu = mcontext->menu();
QMenu *quickFixMenu = new QMenu(tr("&Refactor"), menu); QMenu *quickFixMenu = new QMenu(tr("&Refactor"), menu);
quickFixMenu->addAction(am->command(Constants::RENAME_SYMBOL_UNDER_CURSOR)->action()); quickFixMenu->addAction(Core::ActionManager::command(Constants::RENAME_SYMBOL_UNDER_CURSOR)->action());
QSignalMapper mapper; QSignalMapper mapper;
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int))); connect(&mapper, SIGNAL(mapped(int)), this, SLOT(performQuickFix(int)));

View File

@@ -370,8 +370,7 @@ void FunctionDeclDefLink::showMarker(CPPEditorWidget *editor)
else else
message = tr("Apply changes to declaration"); message = tr("Apply changes to declaration");
Core::ActionManager *actionManager = Core::ICore::actionManager(); Core::Command *quickfixCommand = Core::ActionManager::command(TextEditor::Constants::QUICKFIX_THIS);
Core::Command *quickfixCommand = actionManager->command(TextEditor::Constants::QUICKFIX_THIS);
if (quickfixCommand) if (quickfixCommand)
message = Utils::ProxyAction::stringWithAppendedShortcut(message, quickfixCommand->keySequence()); message = Utils::ProxyAction::stringWithAppendedShortcut(message, quickfixCommand->keySequence());

View File

@@ -124,14 +124,13 @@ QStringList CppEditorFactory::mimeTypes() const
///////////////////////////////// CppPlugin ////////////////////////////////// ///////////////////////////////// CppPlugin //////////////////////////////////
static inline static inline
Core::Command *createSeparator(Core::ActionManager *am, Core::Command *createSeparator(QObject *parent,
QObject *parent,
Core::Context &context, Core::Context &context,
const char *id) const char *id)
{ {
QAction *separator = new QAction(parent); QAction *separator = new QAction(parent);
separator->setSeparator(true); separator->setSeparator(true);
return am->registerAction(separator, Core::Id(id), context); return Core::ActionManager::registerAction(separator, Core::Id(id), context);
} }
CppPlugin *CppPlugin::m_instance = 0; CppPlugin *CppPlugin::m_instance = 0;
@@ -227,21 +226,20 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
Core::Context context(CppEditor::Constants::C_CPPEDITOR); Core::Context context(CppEditor::Constants::C_CPPEDITOR);
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *contextMenu= Core::ActionManager::createMenu(CppEditor::Constants::M_CONTEXT);
Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT);
Core::Command *cmd; Core::Command *cmd;
Core::ActionContainer *cppToolsMenu = am->actionContainer(Core::Id(CppTools::Constants::M_TOOLS_CPP)); Core::ActionContainer *cppToolsMenu = Core::ActionManager::actionContainer(Core::Id(CppTools::Constants::M_TOOLS_CPP));
cmd = am->command(Core::Id(CppTools::Constants::SWITCH_HEADER_SOURCE)); cmd = Core::ActionManager::command(Core::Id(CppTools::Constants::SWITCH_HEADER_SOURCE));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd); cppToolsMenu->addAction(cmd);
QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Method Declaration/Definition"), this); QAction *switchDeclarationDefinition = new QAction(tr("Switch Between Method Declaration/Definition"), this);
cmd = am->registerAction(switchDeclarationDefinition, cmd = Core::ActionManager::registerAction(switchDeclarationDefinition,
Constants::SWITCH_DECLARATION_DEFINITION, context, true); Constants::SWITCH_DECLARATION_DEFINITION, context, true);
cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F2"))); cmd->setDefaultKeySequence(QKeySequence(tr("Shift+F2")));
connect(switchDeclarationDefinition, SIGNAL(triggered()), connect(switchDeclarationDefinition, SIGNAL(triggered()),
@@ -250,14 +248,14 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
cppToolsMenu->addAction(cmd); cppToolsMenu->addAction(cmd);
m_findUsagesAction = new QAction(tr("Find Usages"), this); m_findUsagesAction = new QAction(tr("Find Usages"), this);
cmd = am->registerAction(m_findUsagesAction, Constants::FIND_USAGES, context); cmd = Core::ActionManager::registerAction(m_findUsagesAction, Constants::FIND_USAGES, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); connect(m_findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
cppToolsMenu->addAction(cmd); cppToolsMenu->addAction(cmd);
m_openTypeHierarchyAction = new QAction(tr("Open Type Hierarchy"), this); m_openTypeHierarchyAction = new QAction(tr("Open Type Hierarchy"), this);
cmd = am->registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context); cmd = Core::ActionManager::registerAction(m_openTypeHierarchyAction, Constants::OPEN_TYPE_HIERARCHY, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+T"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+T")));
connect(m_openTypeHierarchyAction, SIGNAL(triggered()), this, SLOT(openTypeHierarchy())); connect(m_openTypeHierarchyAction, SIGNAL(triggered()), this, SLOT(openTypeHierarchy()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
@@ -265,16 +263,16 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
// Refactoring sub-menu // Refactoring sub-menu
Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Context globalContext(Core::Constants::C_GLOBAL);
Core::Command *sep = createSeparator(am, this, globalContext, Core::Command *sep = createSeparator(this, globalContext,
Constants::SEPARATOR2); Constants::SEPARATOR2);
sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT)); sep->action()->setObjectName(QLatin1String(Constants::M_REFACTORING_MENU_INSERTION_POINT));
contextMenu->addAction(sep); contextMenu->addAction(sep);
contextMenu->addAction(createSeparator(am, this, globalContext, contextMenu->addAction(createSeparator(this, globalContext,
Constants::SEPARATOR3)); Constants::SEPARATOR3));
m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol Under Cursor"), m_renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol Under Cursor"),
this); this);
cmd = am->registerAction(m_renameSymbolUnderCursorAction, cmd = Core::ActionManager::registerAction(m_renameSymbolUnderCursorAction,
Constants::RENAME_SYMBOL_UNDER_CURSOR, Constants::RENAME_SYMBOL_UNDER_CURSOR,
context); context);
cmd->setDefaultKeySequence(QKeySequence(tr("CTRL+SHIFT+R"))); cmd->setDefaultKeySequence(QKeySequence(tr("CTRL+SHIFT+R")));
@@ -283,9 +281,9 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
cppToolsMenu->addAction(cmd); cppToolsMenu->addAction(cmd);
// Update context in global context // Update context in global context
cppToolsMenu->addAction(createSeparator(am, this, globalContext, CppEditor::Constants::SEPARATOR4)); cppToolsMenu->addAction(createSeparator(this, globalContext, CppEditor::Constants::SEPARATOR4));
m_updateCodeModelAction = new QAction(tr("Update Code Model"), this); m_updateCodeModelAction = new QAction(tr("Update Code Model"), this);
cmd = am->registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext); cmd = Core::ActionManager::registerAction(m_updateCodeModelAction, Core::Id(Constants::UPDATE_CODEMODEL), globalContext);
CPlusPlus::CppModelManagerInterface *cppModelManager = CPlusPlus::CppModelManagerInterface::instance(); CPlusPlus::CppModelManagerInterface *cppModelManager = CPlusPlus::CppModelManagerInterface::instance();
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
cppToolsMenu->addAction(cmd); cppToolsMenu->addAction(cmd);
@@ -298,12 +296,12 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
m_actionHandler->initializeActions(); m_actionHandler->initializeActions();
contextMenu->addAction(createSeparator(am, this, context, CppEditor::Constants::SEPARATOR)); contextMenu->addAction(createSeparator(this, context, CppEditor::Constants::SEPARATOR));
cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)), connect(Core::ICore::progressManager(), SIGNAL(taskStarted(QString)),

View File

@@ -102,8 +102,6 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(error) Q_UNUSED(error)
Core::ActionManager *am = Core::ICore::actionManager();
m_settings = new CppToolsSettings(this); // force registration of cpp tools settings m_settings = new CppToolsSettings(this); // force registration of cpp tools settings
// Objects // Objects
@@ -124,8 +122,8 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
addAutoReleasedObject(new CppCodeStyleSettingsPage); addAutoReleasedObject(new CppCodeStyleSettingsPage);
// Menus // Menus
Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mcpptools = am->createMenu(CppTools::Constants::M_TOOLS_CPP); Core::ActionContainer *mcpptools = Core::ActionManager::createMenu(CppTools::Constants::M_TOOLS_CPP);
QMenu *menu = mcpptools->menu(); QMenu *menu = mcpptools->menu();
menu->setTitle(tr("&C++")); menu->setTitle(tr("&C++"));
menu->setEnabled(true); menu->setEnabled(true);
@@ -135,7 +133,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
Core::Context context(CppEditor::Constants::C_CPPEDITOR); Core::Context context(CppEditor::Constants::C_CPPEDITOR);
QAction *switchAction = new QAction(tr("Switch Header/Source"), this); QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
Core::Command *command = am->registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true); Core::Command *command = Core::ActionManager::registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true);
command->setDefaultKeySequence(QKeySequence(Qt::Key_F4)); command->setDefaultKeySequence(QKeySequence(Qt::Key_F4));
mcpptools->addAction(command); mcpptools->addAction(command);
connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource())); connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource()));

View File

@@ -224,13 +224,12 @@ static const VcsBaseSubmitEditorParameters submitParameters = {
}; };
static Command *createSeparator(QObject *parent, static Command *createSeparator(QObject *parent,
ActionManager *ami,
const char *id, const char *id,
const Context &globalcontext) const Context &globalcontext)
{ {
QAction *tmpaction = new QAction(parent); QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true); tmpaction->setSeparator(true);
return ami->registerAction(tmpaction, id, globalcontext); return Core::ActionManager::registerAction(tmpaction, id, globalcontext);
} }
bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
@@ -269,10 +268,9 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
addAutoReleasedObject(m_commandLocator); addAutoReleasedObject(m_commandLocator);
// Register actions // Register actions
ActionManager *ami = ICore::actionManager(); ActionContainer *toolsContainer = Core::ActionManager::actionContainer(M_TOOLS);
ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS);
ActionContainer *cvsMenu = ami->createMenu(Id(CMD_ID_CVS_MENU)); ActionContainer *cvsMenu = Core::ActionManager::createMenu(Id(CMD_ID_CVS_MENU));
cvsMenu->menu()->setTitle(tr("&CVS")); cvsMenu->menu()->setTitle(tr("&CVS"));
toolsContainer->addMenu(cvsMenu); toolsContainer->addMenu(cvsMenu);
m_menuAction = cvsMenu->menu()->menuAction(); m_menuAction = cvsMenu->menu()->menuAction();
@@ -282,7 +280,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
Command *command; Command *command;
m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_diffCurrentAction, command = Core::ActionManager::registerAction(m_diffCurrentAction,
CMD_ID_DIFF_CURRENT, globalcontext); CMD_ID_DIFF_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+D") : tr("Alt+C,Alt+D"))); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+D") : tr("Alt+C,Alt+D")));
@@ -291,7 +289,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_filelogCurrentAction, command = Core::ActionManager::registerAction(m_filelogCurrentAction,
CMD_ID_FILELOG_CURRENT, globalcontext); CMD_ID_FILELOG_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_filelogCurrentAction, SIGNAL(triggered()), this, connect(m_filelogCurrentAction, SIGNAL(triggered()), this,
@@ -300,7 +298,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_annotateCurrentAction, command = Core::ActionManager::registerAction(m_annotateCurrentAction,
CMD_ID_ANNOTATE_CURRENT, globalcontext); CMD_ID_ANNOTATE_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_annotateCurrentAction, SIGNAL(triggered()), this, connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
@@ -308,10 +306,10 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR0, globalcontext)); cvsMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR0, globalcontext));
m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_addAction, CMD_ID_ADD, command = Core::ActionManager::registerAction(m_addAction, CMD_ID_ADD,
globalcontext); globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+A") : tr("Alt+C,Alt+A"))); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+A") : tr("Alt+C,Alt+A")));
@@ -320,7 +318,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_commitCurrentAction, command = Core::ActionManager::registerAction(m_commitCurrentAction,
CMD_ID_COMMIT_CURRENT, globalcontext); CMD_ID_COMMIT_CURRENT, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+C") : tr("Alt+C,Alt+C"))); command->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+C,Meta+C") : tr("Alt+C,Alt+C")));
@@ -329,7 +327,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, command = Core::ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
globalcontext); globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
@@ -337,39 +335,39 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_revertAction, CMD_ID_REVERT, command = Core::ActionManager::registerAction(m_revertAction, CMD_ID_REVERT,
globalcontext); globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR1, globalcontext)); cvsMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR1, globalcontext));
m_editCurrentAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_editCurrentAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, globalcontext); command = Core::ActionManager::registerAction(m_editCurrentAction, CMD_ID_EDIT_FILE, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_editCurrentAction, SIGNAL(triggered()), this, SLOT(editCurrentFile())); connect(m_editCurrentAction, SIGNAL(triggered()), this, SLOT(editCurrentFile()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_uneditCurrentAction = new Utils::ParameterAction(tr("Unedit"), tr("Unedit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_uneditCurrentAction = new Utils::ParameterAction(tr("Unedit"), tr("Unedit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, globalcontext); command = Core::ActionManager::registerAction(m_uneditCurrentAction, CMD_ID_UNEDIT_FILE, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_uneditCurrentAction, SIGNAL(triggered()), this, SLOT(uneditCurrentFile())); connect(m_uneditCurrentAction, SIGNAL(triggered()), this, SLOT(uneditCurrentFile()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_uneditRepositoryAction = new QAction(tr("Unedit Repository"), this); m_uneditRepositoryAction = new QAction(tr("Unedit Repository"), this);
command = ami->registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, globalcontext); command = Core::ActionManager::registerAction(m_uneditRepositoryAction, CMD_ID_UNEDIT_REPOSITORY, globalcontext);
connect(m_uneditRepositoryAction, SIGNAL(triggered()), this, SLOT(uneditCurrentRepository())); connect(m_uneditRepositoryAction, SIGNAL(triggered()), this, SLOT(uneditCurrentRepository()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext)); cvsMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR2, globalcontext));
m_diffProjectAction = new Utils::ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_diffProjectAction = new Utils::ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, command = Core::ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
globalcontext); globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject())); connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject()));
@@ -377,7 +375,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_statusProjectAction, CMD_ID_STATUS, command = Core::ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS,
globalcontext); globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus())); connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus()));
@@ -385,61 +383,61 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); command = Core::ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject())); connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext); command = Core::ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject())); connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_commitProjectAction = new Utils::ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_commitProjectAction = new Utils::ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, globalcontext); command = Core::ActionManager::registerAction(m_commitProjectAction, CMD_ID_PROJECTCOMMIT, globalcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(commitProject())); connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(commitProject()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR3, globalcontext)); cvsMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR3, globalcontext));
m_diffRepositoryAction = new QAction(tr("Diff Repository"), this); m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
command = ami->registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext); command = Core::ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext);
connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository())); connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_statusRepositoryAction = new QAction(tr("Repository Status"), this); m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
command = ami->registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext); command = Core::ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext);
connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository())); connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_logRepositoryAction = new QAction(tr("Repository Log"), this); m_logRepositoryAction = new QAction(tr("Repository Log"), this);
command = ami->registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); command = Core::ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository())); connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_updateRepositoryAction = new QAction(tr("Update Repository"), this); m_updateRepositoryAction = new QAction(tr("Update Repository"), this);
command = ami->registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext); command = Core::ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext);
connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository())); connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_commitAllAction = new QAction(tr("Commit All Files"), this); m_commitAllAction = new QAction(tr("Commit All Files"), this);
command = ami->registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL, command = Core::ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
globalcontext); globalcontext);
connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll())); connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this); m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
command = ami->registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL, command = Core::ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
globalcontext); globalcontext);
connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll())); connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll()));
cvsMenu->addAction(command); cvsMenu->addAction(command);
@@ -449,18 +447,18 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
Context cvscommitcontext(Constants::CVSCOMMITEDITOR); Context cvscommitcontext(Constants::CVSCOMMITEDITOR);
m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); m_submitCurrentLogAction = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, cvscommitcontext); command = Core::ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, cvscommitcontext);
command->setAttribute(Command::CA_UpdateText); command->setAttribute(Command::CA_UpdateText);
connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); m_submitDiffAction = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
command = ami->registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, cvscommitcontext); command = Core::ActionManager::registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, cvscommitcontext);
m_submitUndoAction = new QAction(tr("&Undo"), this); m_submitUndoAction = new QAction(tr("&Undo"), this);
command = ami->registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext); command = Core::ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, cvscommitcontext);
m_submitRedoAction = new QAction(tr("&Redo"), this); m_submitRedoAction = new QAction(tr("&Redo"), this);
command = ami->registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext); command = Core::ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, cvscommitcontext);
return true; return true;
} }

View File

@@ -324,9 +324,8 @@ void DebuggerMainWindow::onModeChanged(IMode *mode)
void DebuggerMainWindowPrivate::createViewsMenuItems() void DebuggerMainWindowPrivate::createViewsMenuItems()
{ {
ActionManager *am = ICore::actionManager();
Context debugcontext(Constants::C_DEBUGMODE); Context debugcontext(Constants::C_DEBUGMODE);
m_viewsMenu = am->actionContainer(Id(Core::Constants::M_WINDOW_VIEWS)); m_viewsMenu = Core::ActionManager::actionContainer(Id(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(m_viewsMenu, return); QTC_ASSERT(m_viewsMenu, return);
QAction *openMemoryEditorAction = new QAction(this); QAction *openMemoryEditorAction = new QAction(this);
@@ -336,25 +335,25 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
// Add menu items // Add menu items
Command *cmd = 0; Command *cmd = 0;
cmd = am->registerAction(openMemoryEditorAction, cmd = Core::ActionManager::registerAction(openMemoryEditorAction,
Core::Id("Debugger.Views.OpenMemoryEditor"), Core::Id("Debugger.Views.OpenMemoryEditor"),
debugcontext); debugcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = am->registerAction(q->menuSeparator1(), cmd = Core::ActionManager::registerAction(q->menuSeparator1(),
Core::Id("Debugger.Views.Separator1"), debugcontext); Core::Id("Debugger.Views.Separator1"), debugcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = am->registerAction(q->toggleLockedAction(), cmd = Core::ActionManager::registerAction(q->toggleLockedAction(),
Core::Id("Debugger.Views.ToggleLocked"), debugcontext); Core::Id("Debugger.Views.ToggleLocked"), debugcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = am->registerAction(q->menuSeparator2(), cmd = Core::ActionManager::registerAction(q->menuSeparator2(),
Core::Id("Debugger.Views.Separator2"), debugcontext); Core::Id("Debugger.Views.Separator2"), debugcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = am->registerAction(q->resetLayoutAction(), cmd = Core::ActionManager::registerAction(q->resetLayoutAction(),
Core::Id("Debugger.Views.ResetSimple"), debugcontext); Core::Id("Debugger.Views.ResetSimple"), debugcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
@@ -452,9 +451,8 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua
Context globalContext(Core::Constants::C_GLOBAL); Context globalContext(Core::Constants::C_GLOBAL);
ActionManager *am = ICore::actionManager();
QAction *toggleViewAction = dockWidget->toggleViewAction(); QAction *toggleViewAction = dockWidget->toggleViewAction();
Command *cmd = am->registerAction(toggleViewAction, Command *cmd = Core::ActionManager::registerAction(toggleViewAction,
Core::Id(QLatin1String("Debugger.") + widget->objectName()), globalContext); Core::Id(QLatin1String("Debugger.") + widget->objectName()), globalContext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
d->m_menuCommandsToAdd.append(cmd); d->m_menuCommandsToAdd.append(cmd);
@@ -486,12 +484,11 @@ void DebuggerMainWindow::addStagedMenuEntries()
QWidget *DebuggerMainWindow::createContents(IMode *mode) QWidget *DebuggerMainWindow::createContents(IMode *mode)
{ {
ActionManager *am = ICore::actionManager();
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance(); ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
d, SLOT(updateUiForProject(ProjectExplorer::Project*))); d, SLOT(updateUiForProject(ProjectExplorer::Project*)));
d->m_viewsMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS)); d->m_viewsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(d->m_viewsMenu, return 0); QTC_ASSERT(d->m_viewsMenu, return 0);
//d->m_mainWindow = new Internal::DebuggerMainWindow(this); //d->m_mainWindow = new Internal::DebuggerMainWindow(this);

View File

@@ -453,12 +453,12 @@ static QToolButton *toolButton(QAction *action)
static void setProxyAction(Utils::ProxyAction *proxy, const char *id) static void setProxyAction(Utils::ProxyAction *proxy, const char *id)
{ {
proxy->setAction(Core::ICore::actionManager()->command(id)->action()); proxy->setAction(Core::ActionManager::command(id)->action());
} }
static QToolButton *toolButton(const char *id) static QToolButton *toolButton(const char *id)
{ {
return toolButton(Core::ICore::actionManager()->command(id)->action()); return toolButton(Core::ActionManager::command(id)->action());
} }
static Abi anyAbiOfBinary(const QString &fileName) static Abi anyAbiOfBinary(const QString &fileName)
@@ -2855,9 +2855,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown())); connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(coreShutdown()));
ActionManager *am = ICore::actionManager();
QTC_ASSERT(am, return);
m_plugin->addObject(this); m_plugin->addObject(this);
const Context globalcontext(CC::C_GLOBAL); const Context globalcontext(CC::C_GLOBAL);
@@ -3000,16 +2997,16 @@ void DebuggerPluginPrivate::extensionsInitialized()
qmlSelectDummyAction->setCheckable(true); qmlSelectDummyAction->setCheckable(true);
qmlSelectDummyAction->setIcon(QIcon(_(":/debugger/images/qml/select.png"))); qmlSelectDummyAction->setIcon(QIcon(_(":/debugger/images/qml/select.png")));
qmlSelectDummyAction->setEnabled(false); qmlSelectDummyAction->setEnabled(false);
am->registerAction(qmlSelectDummyAction, Constants::QML_SELECTTOOL, globalcontext); Core::ActionManager::registerAction(qmlSelectDummyAction, Constants::QML_SELECTTOOL, globalcontext);
QAction *qmlZoomDummyAction = new QAction(tr("Zoom"), this); QAction *qmlZoomDummyAction = new QAction(tr("Zoom"), this);
qmlZoomDummyAction->setCheckable(true); qmlZoomDummyAction->setCheckable(true);
qmlZoomDummyAction->setIcon(QIcon(_(":/debugger/images/qml/zoom.png"))); qmlZoomDummyAction->setIcon(QIcon(_(":/debugger/images/qml/zoom.png")));
qmlZoomDummyAction->setEnabled(false); qmlZoomDummyAction->setEnabled(false);
am->registerAction(qmlZoomDummyAction, Constants::QML_ZOOMTOOL, globalcontext); Core::ActionManager::registerAction(qmlZoomDummyAction, Constants::QML_ZOOMTOOL, globalcontext);
ActionContainer *debugMenu = ActionContainer *debugMenu =
am->actionContainer(ProjectExplorer::Constants::M_DEBUG); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_DEBUG);
// Dock widgets // Dock widgets
QDockWidget *dock = 0; QDockWidget *dock = 0;
@@ -3127,9 +3124,9 @@ void DebuggerPluginPrivate::extensionsInitialized()
// G_START_QML // G_START_QML
Command *cmd = 0; Command *cmd = 0;
ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING); ActionContainer *mstart = Core::ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING);
cmd = am->registerAction(m_startAction, Constants::DEBUG, globalcontext); cmd = Core::ActionManager::registerAction(m_startAction, Constants::DEBUG, globalcontext);
cmd->setDescription(tr("Start Debugging")); cmd->setDescription(tr("Start Debugging"));
cmd->setDefaultKeySequence(debugKey); cmd->setDefaultKeySequence(debugKey);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
@@ -3142,17 +3139,17 @@ void DebuggerPluginPrivate::extensionsInitialized()
ModeManager::addAction(m_visibleStartAction, Constants::P_ACTION_DEBUG); ModeManager::addAction(m_visibleStartAction, Constants::P_ACTION_DEBUG);
cmd = am->registerAction(m_debugWithoutDeployAction, cmd = Core::ActionManager::registerAction(m_debugWithoutDeployAction,
"Debugger.DebugWithoutDeploy", globalcontext); "Debugger.DebugWithoutDeploy", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, CC::G_DEFAULT_ONE); mstart->addAction(cmd, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_attachToLocalProcessAction, cmd = Core::ActionManager::registerAction(m_attachToLocalProcessAction,
"Debugger.AttachToLocalProcess", globalcontext); "Debugger.AttachToLocalProcess", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_START_LOCAL); mstart->addAction(cmd, Constants::G_START_LOCAL);
cmd = am->registerAction(m_startLocalProcessAction, cmd = Core::ActionManager::registerAction(m_startLocalProcessAction,
"Debugger.StartLocalProcess", globalcontext); "Debugger.StartLocalProcess", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Debugger::Constants::G_START_LOCAL); mstart->addAction(cmd, Debugger::Constants::G_START_LOCAL);
@@ -3164,40 +3161,40 @@ void DebuggerPluginPrivate::extensionsInitialized()
// m_startRemoteProcessAction->setVisible(on); // m_startRemoteProcessAction->setVisible(on);
// m_startRemoteServerAction->setVisible(on); // m_startRemoteServerAction->setVisible(on);
cmd = am->registerAction(m_attachToCoreAction, cmd = Core::ActionManager::registerAction(m_attachToCoreAction,
"Debugger.AttachCore", globalcontext); "Debugger.AttachCore", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_START_LOCAL); mstart->addAction(cmd, Constants::G_START_LOCAL);
cmd = am->registerAction(m_attachToRemoteServerAction, cmd = Core::ActionManager::registerAction(m_attachToRemoteServerAction,
"Debugger.AttachToRemoteServer", globalcontext); "Debugger.AttachToRemoteServer", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
cmd = am->registerAction(m_startRemoteProcessAction, cmd = Core::ActionManager::registerAction(m_startRemoteProcessAction,
"Debugger.StartRemoteProcess", globalcontext); "Debugger.StartRemoteProcess", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
cmd = am->registerAction(m_startRemoteServerAction, cmd = Core::ActionManager::registerAction(m_startRemoteServerAction,
"Debugger.StartRemoteServer", globalcontext); "Debugger.StartRemoteServer", globalcontext);
cmd->setDescription(tr("Start Gdbserver")); cmd->setDescription(tr("Start Gdbserver"));
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
cmd = am->registerAction(m_attachToRemoteProcessAction, cmd = Core::ActionManager::registerAction(m_attachToRemoteProcessAction,
"Debugger.AttachToRemoteProcess", globalcontext); "Debugger.AttachToRemoteProcess", globalcontext);
cmd->setDescription(tr("Attach to Remote Process")); cmd->setDescription(tr("Attach to Remote Process"));
mstart->addAction(cmd, Debugger::Constants::G_AUTOMATIC_REMOTE); mstart->addAction(cmd, Debugger::Constants::G_AUTOMATIC_REMOTE);
#ifdef WITH_LLDB #ifdef WITH_LLDB
cmd = am->registerAction(m_startRemoteLldbAction, cmd = Core::ActionManager::registerAction(m_startRemoteLldbAction,
"Debugger.RemoteLldb", globalcontext); "Debugger.RemoteLldb", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
#endif #endif
if (m_startRemoteCdbAction) { if (m_startRemoteCdbAction) {
cmd = am->registerAction(m_startRemoteCdbAction, cmd = Core::ActionManager::registerAction(m_startRemoteCdbAction,
"Debugger.AttachRemoteCdb", globalcontext); "Debugger.AttachRemoteCdb", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
@@ -3205,31 +3202,31 @@ void DebuggerPluginPrivate::extensionsInitialized()
QAction *sep = new QAction(mstart); QAction *sep = new QAction(mstart);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, cmd = Core::ActionManager::registerAction(sep,
"Debugger.Start.Qml", globalcontext); "Debugger.Start.Qml", globalcontext);
mstart->addAction(cmd, Constants::G_START_QML); mstart->addAction(cmd, Constants::G_START_QML);
cmd = am->registerAction(m_attachToQmlPortAction, cmd = Core::ActionManager::registerAction(m_attachToQmlPortAction,
"Debugger.AttachToQmlPort", globalcontext); "Debugger.AttachToQmlPort", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
mstart->addAction(cmd, Constants::G_START_QML); mstart->addAction(cmd, Constants::G_START_QML);
cmd = am->registerAction(m_detachAction, cmd = Core::ActionManager::registerAction(m_detachAction,
"Debugger.Detach", globalcontext); "Debugger.Detach", globalcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_interruptAction, cmd = Core::ActionManager::registerAction(m_interruptAction,
Constants::INTERRUPT, globalcontext); Constants::INTERRUPT, globalcontext);
cmd->setDescription(tr("Interrupt Debugger")); cmd->setDescription(tr("Interrupt Debugger"));
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_continueAction, cmd = Core::ActionManager::registerAction(m_continueAction,
Constants::CONTINUE, globalcontext); Constants::CONTINUE, globalcontext);
cmd->setDefaultKeySequence(debugKey); cmd->setDefaultKeySequence(debugKey);
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_exitAction, cmd = Core::ActionManager::registerAction(m_exitAction,
Constants::STOP, globalcontext); Constants::STOP, globalcontext);
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
m_hiddenStopAction = new Utils::ProxyAction(this); m_hiddenStopAction = new Utils::ProxyAction(this);
@@ -3237,47 +3234,47 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_hiddenStopAction->setAttribute(Utils::ProxyAction::UpdateText); m_hiddenStopAction->setAttribute(Utils::ProxyAction::UpdateText);
m_hiddenStopAction->setAttribute(Utils::ProxyAction::UpdateIcon); m_hiddenStopAction->setAttribute(Utils::ProxyAction::UpdateIcon);
cmd = am->registerAction(m_hiddenStopAction, cmd = Core::ActionManager::registerAction(m_hiddenStopAction,
Constants::HIDDEN_STOP, globalcontext); Constants::HIDDEN_STOP, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+Ctrl+Y") : tr("Shift+F5"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+Ctrl+Y") : tr("Shift+F5")));
cmd = am->registerAction(m_abortAction, cmd = Core::ActionManager::registerAction(m_abortAction,
Constants::ABORT, globalcontext); Constants::ABORT, globalcontext);
cmd->setDescription(tr("Reset Debugger")); cmd->setDescription(tr("Reset Debugger"));
debugMenu->addAction(cmd, CC::G_DEFAULT_ONE); debugMenu->addAction(cmd, CC::G_DEFAULT_ONE);
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, "Debugger.Sep.Step", globalcontext); cmd = Core::ActionManager::registerAction(sep, "Debugger.Sep.Step", globalcontext);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
cmd = am->registerAction(m_nextAction, cmd = Core::ActionManager::registerAction(m_nextAction,
Constants::NEXT, globalcontext); Constants::NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+O") : tr("F10"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+O") : tr("F10")));
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
cmd = am->registerAction(m_stepAction, cmd = Core::ActionManager::registerAction(m_stepAction,
Constants::STEP, globalcontext); Constants::STEP, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+I") : tr("F11"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+I") : tr("F11")));
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
cmd = am->registerAction(m_stepOutAction, cmd = Core::ActionManager::registerAction(m_stepOutAction,
Constants::STEPOUT, cppDebuggercontext); Constants::STEPOUT, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+T") : tr("Shift+F11"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Shift+T") : tr("Shift+F11")));
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
cmd = am->registerAction(m_runToLineAction, cmd = Core::ActionManager::registerAction(m_runToLineAction,
"Debugger.RunToLine", cppDebuggercontext); "Debugger.RunToLine", cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+F8") : tr("Ctrl+F10"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Shift+F8") : tr("Ctrl+F10")));
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
cmd = am->registerAction(m_runToSelectedFunctionAction, cmd = Core::ActionManager::registerAction(m_runToSelectedFunctionAction,
"Debugger.RunToSelectedFunction", cppDebuggercontext); "Debugger.RunToSelectedFunction", cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+F6") : tr("Ctrl+F6"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+F6") : tr("Ctrl+F6")));
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
@@ -3285,17 +3282,17 @@ void DebuggerPluginPrivate::extensionsInitialized()
// and text up-to-date is a lot of hassle. // and text up-to-date is a lot of hassle.
// debugMenu->addAction(cmd); // debugMenu->addAction(cmd);
cmd = am->registerAction(m_jumpToLineAction, cmd = Core::ActionManager::registerAction(m_jumpToLineAction,
"Debugger.JumpToLine", cppDebuggercontext); "Debugger.JumpToLine", cppDebuggercontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
cmd = am->registerAction(m_returnFromFunctionAction, cmd = Core::ActionManager::registerAction(m_returnFromFunctionAction,
"Debugger.ReturnFromFunction", cppDebuggercontext); "Debugger.ReturnFromFunction", cppDebuggercontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
cmd = am->registerAction(m_reverseDirectionAction, cmd = Core::ActionManager::registerAction(m_reverseDirectionAction,
Constants::REVERSE, cppDebuggercontext); Constants::REVERSE, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("F12"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? QString() : tr("F12")));
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
@@ -3303,26 +3300,26 @@ void DebuggerPluginPrivate::extensionsInitialized()
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, "Debugger.Sep.Break", globalcontext); cmd = Core::ActionManager::registerAction(sep, "Debugger.Sep.Break", globalcontext);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
//cmd = am->registerAction(m_snapshotAction, //cmd = Core::ActionManager::registerAction(m_snapshotAction,
// "Debugger.Snapshot", cppDebuggercontext); // "Debugger.Snapshot", cppDebuggercontext);
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+S"))); //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+S")));
//cmd->setAttribute(Command::CA_Hide); //cmd->setAttribute(Command::CA_Hide);
//debugMenu->addAction(cmd); //debugMenu->addAction(cmd);
cmd = am->registerAction(m_frameDownAction, cmd = Core::ActionManager::registerAction(m_frameDownAction,
"Debugger.FrameDown", cppDebuggercontext); "Debugger.FrameDown", cppDebuggercontext);
cmd = am->registerAction(m_frameUpAction, cmd = Core::ActionManager::registerAction(m_frameUpAction,
"Debugger.FrameUp", cppDebuggercontext); "Debugger.FrameUp", cppDebuggercontext);
cmd = am->registerAction(action(OperateByInstruction), cmd = Core::ActionManager::registerAction(action(OperateByInstruction),
Constants::OPERATE_BY_INSTRUCTION, cppDebuggercontext); Constants::OPERATE_BY_INSTRUCTION, cppDebuggercontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
cmd = am->registerAction(m_breakAction, cmd = Core::ActionManager::registerAction(m_breakAction,
"Debugger.ToggleBreak", globalcontext); "Debugger.ToggleBreak", globalcontext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("F8") : tr("F9"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("F8") : tr("F9")));
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
@@ -3331,11 +3328,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, "Debugger.Sep.Watch", globalcontext); cmd = Core::ActionManager::registerAction(sep, "Debugger.Sep.Watch", globalcontext);
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
// Don't add '1' to the string as it shows up in the shortcut dialog. // Don't add '1' to the string as it shows up in the shortcut dialog.
cmd = am->registerAction(m_watchAction1, cmd = Core::ActionManager::registerAction(m_watchAction1,
"Debugger.AddToWatch", cppeditorcontext); "Debugger.AddToWatch", cppeditorcontext);
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+W"))); //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+W")));
debugMenu->addAction(cmd); debugMenu->addAction(cmd);
@@ -3343,13 +3340,13 @@ void DebuggerPluginPrivate::extensionsInitialized()
// If the CppEditor plugin is there, we want to add something to // If the CppEditor plugin is there, we want to add something to
// the editor context menu. // the editor context menu.
if (ActionContainer *editorContextMenu = if (ActionContainer *editorContextMenu =
am->actionContainer(CppEditor::Constants::M_CONTEXT)) { Core::ActionManager::actionContainer(CppEditor::Constants::M_CONTEXT)) {
cmd = am->registerAction(sep, "Debugger.Sep.Views", cmd = Core::ActionManager::registerAction(sep, "Debugger.Sep.Views",
cppDebuggercontext); cppDebuggercontext);
editorContextMenu->addAction(cmd); editorContextMenu->addAction(cmd);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
cmd = am->registerAction(m_watchAction2, cmd = Core::ActionManager::registerAction(m_watchAction2,
"Debugger.AddToWatch2", cppDebuggercontext); "Debugger.AddToWatch2", cppDebuggercontext);
cmd->action()->setEnabled(true); cmd->action()->setEnabled(true);
editorContextMenu->addAction(cmd); editorContextMenu->addAction(cmd);
@@ -3585,8 +3582,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
// Menu groups // Menu groups
const Context globalcontext(CC::C_GLOBAL); const Context globalcontext(CC::C_GLOBAL);
ActionManager *am = ICore::actionManager(); ActionContainer *mstart = Core::ActionManager::actionContainer(PE::M_DEBUG_STARTDEBUGGING);
ActionContainer *mstart = am->actionContainer(PE::M_DEBUG_STARTDEBUGGING);
mstart->appendGroup(Constants::G_START_LOCAL); mstart->appendGroup(Constants::G_START_LOCAL);
mstart->appendGroup(Constants::G_MANUAL_REMOTE); mstart->appendGroup(Constants::G_MANUAL_REMOTE);
@@ -3596,17 +3592,17 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
// Separators // Separators
QAction *sep = new QAction(mstart); QAction *sep = new QAction(mstart);
sep->setSeparator(true); sep->setSeparator(true);
Command *cmd = am->registerAction(sep, "Debugger.Local.Cpp", globalcontext); Command *cmd = Core::ActionManager::registerAction(sep, "Debugger.Local.Cpp", globalcontext);
mstart->addAction(cmd, Constants::G_START_LOCAL); mstart->addAction(cmd, Constants::G_START_LOCAL);
sep = new QAction(mstart); sep = new QAction(mstart);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, "Debugger.StartRemote.Cpp", globalcontext); cmd = Core::ActionManager::registerAction(sep, "Debugger.StartRemote.Cpp", globalcontext);
mstart->addAction(cmd, Constants::G_MANUAL_REMOTE); mstart->addAction(cmd, Constants::G_MANUAL_REMOTE);
sep = new QAction(mstart); sep = new QAction(mstart);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, "Debugger.AttachRemote.Cpp", globalcontext); cmd = Core::ActionManager::registerAction(sep, "Debugger.AttachRemote.Cpp", globalcontext);
mstart->addAction(cmd, Constants::G_AUTOMATIC_REMOTE); mstart->addAction(cmd, Constants::G_AUTOMATIC_REMOTE);
return theDebuggerCore->initialize(arguments, errorMessage); return theDebuggerCore->initialize(arguments, errorMessage);

View File

@@ -192,7 +192,6 @@ void QmlInspectorAdapter::clientStatusChanged(QmlDebug::ClientStatus status)
void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status) void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status)
{ {
Core::ActionManager *am = Core::ICore::actionManager();
BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender()); BaseToolsClient *client = qobject_cast<BaseToolsClient*>(sender());
if (status == QmlDebug::Enabled) { if (status == QmlDebug::Enabled) {
m_toolsClient = client; m_toolsClient = client;
@@ -212,10 +211,10 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status
// register actions here // register actions here
// because there can be multiple QmlEngines // because there can be multiple QmlEngines
// at the same time (but hopefully one one is connected) // at the same time (but hopefully one one is connected)
am->registerAction(m_selectAction, Core::ActionManager::registerAction(m_selectAction,
Core::Id(Constants::QML_SELECTTOOL), Core::Id(Constants::QML_SELECTTOOL),
m_inspectorToolsContext); m_inspectorToolsContext);
am->registerAction(m_zoomAction, Core::Id(Constants::QML_ZOOMTOOL), Core::ActionManager::registerAction(m_zoomAction, Core::Id(Constants::QML_ZOOMTOOL),
m_inspectorToolsContext); m_inspectorToolsContext);
Core::ICore::updateAdditionalContexts(Core::Context(), Core::ICore::updateAdditionalContexts(Core::Context(),
@@ -239,9 +238,9 @@ void QmlInspectorAdapter::toolsClientStatusChanged(QmlDebug::ClientStatus status
disconnect(client, SIGNAL(logActivity(QString,QString)), disconnect(client, SIGNAL(logActivity(QString,QString)),
m_debugAdapter, SLOT(logServiceActivity(QString,QString))); m_debugAdapter, SLOT(logServiceActivity(QString,QString)));
am->unregisterAction(m_selectAction, Core::ActionManager::unregisterAction(m_selectAction,
Core::Id(Constants::QML_SELECTTOOL)); Core::Id(Constants::QML_SELECTTOOL));
am->unregisterAction(m_zoomAction, Core::ActionManager::unregisterAction(m_zoomAction,
Core::Id(Constants::QML_ZOOMTOOL)); Core::Id(Constants::QML_ZOOMTOOL));
m_selectAction->setChecked(false); m_selectAction->setChecked(false);

View File

@@ -127,7 +127,6 @@ static inline QIcon designerIcon(const QString &iconName)
// Create a menu separator // Create a menu separator
static QAction *createSeparator(QObject *parent, static QAction *createSeparator(QObject *parent,
Core::ActionManager *am,
const Core::Context &context, const Core::Context &context,
Core::ActionContainer *container, Core::ActionContainer *container,
const Core::Id &id, const Core::Id &id,
@@ -135,7 +134,7 @@ static QAction *createSeparator(QObject *parent,
{ {
QAction *actSeparator = new QAction(parent); QAction *actSeparator = new QAction(parent);
actSeparator->setSeparator(true); actSeparator->setSeparator(true);
Core::Command *command = am->registerAction(actSeparator, id, context); Core::Command *command = Core::ActionManager::registerAction(actSeparator, id, context);
container->addAction(command, group); container->addAction(command, group);
return actSeparator; return actSeparator;
} }
@@ -227,15 +226,14 @@ FormEditorW::~FormEditorW()
} }
// Add an actioon to toggle the view state of a dock window // Add an actioon to toggle the view state of a dock window
void FormEditorW::addDockViewAction(Core::ActionManager *am, void FormEditorW::addDockViewAction(Core::ActionContainer *viewMenu,
Core::ActionContainer *viewMenu,
int index, const Core::Context &context, int index, const Core::Context &context,
const QString &title, const Core::Id &id) const QString &title, const Core::Id &id)
{ {
if (const QDockWidget *dw = m_editorWidget->designerDockWidgets()[index]) { if (const QDockWidget *dw = m_editorWidget->designerDockWidgets()[index]) {
QAction *action = dw->toggleViewAction(); QAction *action = dw->toggleViewAction();
action->setText(title); action->setText(title);
Core::Command *cmd = addToolAction(action, am, context, id, viewMenu, QString()); Core::Command *cmd = addToolAction(action, context, id, viewMenu, QString());
cmd->setAttribute(Core::Command::CA_Hide); cmd->setAttribute(Core::Command::CA_Hide);
} }
} }
@@ -243,35 +241,34 @@ void FormEditorW::addDockViewAction(Core::ActionManager *am,
void FormEditorW::setupViewActions() void FormEditorW::setupViewActions()
{ {
// Populate "View" menu of form editor menu // Populate "View" menu of form editor menu
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *viewMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
Core::ActionContainer *viewMenu = am->actionContainer(Core::Id(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(viewMenu, return); QTC_ASSERT(viewMenu, return);
addDockViewAction(am, viewMenu, WidgetBoxSubWindow, m_contexts, addDockViewAction(viewMenu, WidgetBoxSubWindow, m_contexts,
tr("Widget box"), Core::Id("FormEditor.WidgetBox")); tr("Widget box"), Core::Id("FormEditor.WidgetBox"));
addDockViewAction(am, viewMenu, ObjectInspectorSubWindow, m_contexts, addDockViewAction(viewMenu, ObjectInspectorSubWindow, m_contexts,
tr("Object Inspector"), Core::Id("FormEditor.ObjectInspector")); tr("Object Inspector"), Core::Id("FormEditor.ObjectInspector"));
addDockViewAction(am, viewMenu, PropertyEditorSubWindow, m_contexts, addDockViewAction(viewMenu, PropertyEditorSubWindow, m_contexts,
tr("Property Editor"), Core::Id("FormEditor.PropertyEditor")); tr("Property Editor"), Core::Id("FormEditor.PropertyEditor"));
addDockViewAction(am, viewMenu, SignalSlotEditorSubWindow, m_contexts, addDockViewAction(viewMenu, SignalSlotEditorSubWindow, m_contexts,
tr("Signals && Slots Editor"), Core::Id("FormEditor.SignalsAndSlotsEditor")); tr("Signals && Slots Editor"), Core::Id("FormEditor.SignalsAndSlotsEditor"));
addDockViewAction(am, viewMenu, ActionEditorSubWindow, m_contexts, addDockViewAction(viewMenu, ActionEditorSubWindow, m_contexts,
tr("Action Editor"), Core::Id("FormEditor.ActionEditor")); tr("Action Editor"), Core::Id("FormEditor.ActionEditor"));
// Lock/Reset // Lock/Reset
Core::Command *cmd = addToolAction(m_editorWidget->menuSeparator1(), am, m_contexts, Core::Id("FormEditor.SeparatorLock"), viewMenu, QString()); Core::Command *cmd = addToolAction(m_editorWidget->menuSeparator1(), m_contexts, Core::Id("FormEditor.SeparatorLock"), viewMenu, QString());
cmd->setAttribute(Core::Command::CA_Hide); cmd->setAttribute(Core::Command::CA_Hide);
cmd = addToolAction(m_editorWidget->toggleLockedAction(), am, m_contexts, Core::Id("FormEditor.Locked"), viewMenu, QString()); cmd = addToolAction(m_editorWidget->toggleLockedAction(), m_contexts, Core::Id("FormEditor.Locked"), viewMenu, QString());
cmd->setAttribute(Core::Command::CA_Hide); cmd->setAttribute(Core::Command::CA_Hide);
cmd = addToolAction(m_editorWidget->menuSeparator2(), am, m_contexts, Core::Id("FormEditor.SeparatorReset"), viewMenu, QString()); cmd = addToolAction(m_editorWidget->menuSeparator2(), m_contexts, Core::Id("FormEditor.SeparatorReset"), viewMenu, QString());
cmd->setAttribute(Core::Command::CA_Hide); cmd->setAttribute(Core::Command::CA_Hide);
cmd = addToolAction(m_editorWidget->resetLayoutAction(), am, m_contexts, Core::Id("FormEditor.ResetToDefaultLayout"), viewMenu, QString()); cmd = addToolAction(m_editorWidget->resetLayoutAction(), m_contexts, Core::Id("FormEditor.ResetToDefaultLayout"), viewMenu, QString());
connect(m_editorWidget, SIGNAL(resetLayout()), m_editorWidget, SLOT(resetToDefaultLayout())); connect(m_editorWidget, SIGNAL(resetLayout()), m_editorWidget, SLOT(resetToDefaultLayout()));
cmd->setAttribute(Core::Command::CA_Hide); cmd->setAttribute(Core::Command::CA_Hide);
} }
@@ -428,36 +425,35 @@ void FormEditorW::deleteInstance()
void FormEditorW::setupActions() void FormEditorW::setupActions()
{ {
Core::ActionManager *am = Core::ICore::actionManager();
Core::Command *command; Core::Command *command;
//menus //menus
Core::ActionContainer *medit = Core::ActionContainer *medit =
am->actionContainer(Core::Constants::M_EDIT); Core::ActionManager::actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *mtools = Core::ActionContainer *mtools =
am->actionContainer(Core::Constants::M_TOOLS); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mformtools = Core::ActionContainer *mformtools =
am->createMenu(M_FORMEDITOR); Core::ActionManager::createMenu(M_FORMEDITOR);
mformtools->menu()->setTitle(tr("For&m Editor")); mformtools->menu()->setTitle(tr("For&m Editor"));
mtools->addMenu(mformtools); mtools->addMenu(mformtools);
//overridden actions //overridden actions
bindShortcut(am->registerAction(m_fwm->actionUndo(), Core::Constants::UNDO, m_contexts), m_fwm->actionUndo()); bindShortcut(Core::ActionManager::registerAction(m_fwm->actionUndo(), Core::Constants::UNDO, m_contexts), m_fwm->actionUndo());
bindShortcut(am->registerAction(m_fwm->actionRedo(), Core::Constants::REDO, m_contexts), m_fwm->actionRedo()); bindShortcut(Core::ActionManager::registerAction(m_fwm->actionRedo(), Core::Constants::REDO, m_contexts), m_fwm->actionRedo());
bindShortcut(am->registerAction(m_fwm->actionCut(), Core::Constants::CUT, m_contexts), m_fwm->actionCut()); bindShortcut(Core::ActionManager::registerAction(m_fwm->actionCut(), Core::Constants::CUT, m_contexts), m_fwm->actionCut());
bindShortcut(am->registerAction(m_fwm->actionCopy(), Core::Constants::COPY, m_contexts), m_fwm->actionCopy()); bindShortcut(Core::ActionManager::registerAction(m_fwm->actionCopy(), Core::Constants::COPY, m_contexts), m_fwm->actionCopy());
bindShortcut(am->registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_contexts), m_fwm->actionPaste()); bindShortcut(Core::ActionManager::registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_contexts), m_fwm->actionPaste());
bindShortcut(am->registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_contexts), m_fwm->actionSelectAll()); bindShortcut(Core::ActionManager::registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_contexts), m_fwm->actionSelectAll());
m_actionPrint = new QAction(this); m_actionPrint = new QAction(this);
bindShortcut(am->registerAction(m_actionPrint, Core::Constants::PRINT, m_contexts), m_actionPrint); bindShortcut(Core::ActionManager::registerAction(m_actionPrint, Core::Constants::PRINT, m_contexts), m_actionPrint);
connect(m_actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(m_actionPrint, SIGNAL(triggered()), this, SLOT(print()));
//'delete' action. Do not set a shortcut as Designer handles //'delete' action. Do not set a shortcut as Designer handles
// the 'Delete' key by event filter. Setting a shortcut triggers // the 'Delete' key by event filter. Setting a shortcut triggers
// buggy behaviour on Mac (Pressing Delete in QLineEdit removing the widget). // buggy behaviour on Mac (Pressing Delete in QLineEdit removing the widget).
command = am->registerAction(m_fwm->actionDelete(), Core::Id("FormEditor.Edit.Delete"), m_contexts); command = Core::ActionManager::registerAction(m_fwm->actionDelete(), Core::Id("FormEditor.Edit.Delete"), m_contexts);
bindShortcut(command, m_fwm->actionDelete()); bindShortcut(command, m_fwm->actionDelete());
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE); medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
@@ -468,80 +464,80 @@ void FormEditorW::setupActions()
m_modeActionSeparator = new QAction(this); m_modeActionSeparator = new QAction(this);
m_modeActionSeparator->setSeparator(true); m_modeActionSeparator->setSeparator(true);
command = am->registerAction(m_modeActionSeparator, Core::Id("FormEditor.Sep.ModeActions"), m_contexts); command = Core::ActionManager::registerAction(m_modeActionSeparator, Core::Id("FormEditor.Sep.ModeActions"), m_contexts);
medit->addAction(command, Core::Constants::G_EDIT_OTHER); medit->addAction(command, Core::Constants::G_EDIT_OTHER);
m_toolActionIds.push_back(Core::Id("FormEditor.WidgetEditor")); m_toolActionIds.push_back(Core::Id("FormEditor.WidgetEditor"));
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit, createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
tr("Edit Widgets"), m_toolActionIds.back(), tr("Edit Widgets"), m_toolActionIds.back(),
EditModeWidgetEditor, QLatin1String("widgettool.png"), tr("F3")); EditModeWidgetEditor, QLatin1String("widgettool.png"), tr("F3"));
m_toolActionIds.push_back(Core::Id("FormEditor.SignalsSlotsEditor")); m_toolActionIds.push_back(Core::Id("FormEditor.SignalsSlotsEditor"));
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit, createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
tr("Edit Signals/Slots"), m_toolActionIds.back(), tr("Edit Signals/Slots"), m_toolActionIds.back(),
EditModeSignalsSlotEditor, QLatin1String("signalslottool.png"), tr("F4")); EditModeSignalsSlotEditor, QLatin1String("signalslottool.png"), tr("F4"));
m_toolActionIds.push_back(Core::Id("FormEditor.BuddyEditor")); m_toolActionIds.push_back(Core::Id("FormEditor.BuddyEditor"));
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit, createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
tr("Edit Buddies"), m_toolActionIds.back(), tr("Edit Buddies"), m_toolActionIds.back(),
EditModeBuddyEditor, QLatin1String("buddytool.png")); EditModeBuddyEditor, QLatin1String("buddytool.png"));
m_toolActionIds.push_back(Core::Id("FormEditor.TabOrderEditor")); m_toolActionIds.push_back(Core::Id("FormEditor.TabOrderEditor"));
createEditModeAction(m_actionGroupEditMode, m_contexts, am, medit, createEditModeAction(m_actionGroupEditMode, m_contexts, medit,
tr("Edit Tab Order"), m_toolActionIds.back(), tr("Edit Tab Order"), m_toolActionIds.back(),
EditModeTabOrderEditor, QLatin1String("tabordertool.png")); EditModeTabOrderEditor, QLatin1String("tabordertool.png"));
//tool actions //tool actions
m_toolActionIds.push_back(Core::Id("FormEditor.LayoutHorizontally")); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutHorizontally"));
const QString horizLayoutShortcut = Core::UseMacShortcuts ? tr("Meta+Shift+H") : tr("Ctrl+H"); const QString horizLayoutShortcut = Core::UseMacShortcuts ? tr("Meta+Shift+H") : tr("Ctrl+H");
addToolAction(m_fwm->actionHorizontalLayout(), am, m_contexts, addToolAction(m_fwm->actionHorizontalLayout(), m_contexts,
m_toolActionIds.back(), mformtools, horizLayoutShortcut); m_toolActionIds.back(), mformtools, horizLayoutShortcut);
m_toolActionIds.push_back(Core::Id("FormEditor.LayoutVertically")); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutVertically"));
const QString vertLayoutShortcut = Core::UseMacShortcuts ? tr("Meta+L") : tr("Ctrl+L"); const QString vertLayoutShortcut = Core::UseMacShortcuts ? tr("Meta+L") : tr("Ctrl+L");
addToolAction(m_fwm->actionVerticalLayout(), am, m_contexts, addToolAction(m_fwm->actionVerticalLayout(), m_contexts,
m_toolActionIds.back(), mformtools, vertLayoutShortcut); m_toolActionIds.back(), mformtools, vertLayoutShortcut);
m_toolActionIds.push_back(Core::Id("FormEditor.SplitHorizontal")); m_toolActionIds.push_back(Core::Id("FormEditor.SplitHorizontal"));
addToolAction(m_fwm->actionSplitHorizontal(), am, m_contexts, addToolAction(m_fwm->actionSplitHorizontal(), m_contexts,
m_toolActionIds.back(), mformtools); m_toolActionIds.back(), mformtools);
m_toolActionIds.push_back(Core::Id("FormEditor.SplitVertical")); m_toolActionIds.push_back(Core::Id("FormEditor.SplitVertical"));
addToolAction(m_fwm->actionSplitVertical(), am, m_contexts, addToolAction(m_fwm->actionSplitVertical(), m_contexts,
m_toolActionIds.back(), mformtools); m_toolActionIds.back(), mformtools);
m_toolActionIds.push_back(Core::Id("FormEditor.LayoutForm")); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutForm"));
addToolAction(m_fwm->actionFormLayout(), am, m_contexts, addToolAction(m_fwm->actionFormLayout(), m_contexts,
m_toolActionIds.back(), mformtools); m_toolActionIds.back(), mformtools);
m_toolActionIds.push_back(Core::Id("FormEditor.LayoutGrid")); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutGrid"));
const QString gridShortcut = Core::UseMacShortcuts ? tr("Meta+Shift+G") : tr("Ctrl+G"); const QString gridShortcut = Core::UseMacShortcuts ? tr("Meta+Shift+G") : tr("Ctrl+G");
addToolAction(m_fwm->actionGridLayout(), am, m_contexts, addToolAction(m_fwm->actionGridLayout(), m_contexts,
m_toolActionIds.back(), mformtools, gridShortcut); m_toolActionIds.back(), mformtools, gridShortcut);
m_toolActionIds.push_back(Core::Id("FormEditor.LayoutBreak")); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutBreak"));
addToolAction(m_fwm->actionBreakLayout(), am, m_contexts, addToolAction(m_fwm->actionBreakLayout(), m_contexts,
m_toolActionIds.back(), mformtools); m_toolActionIds.back(), mformtools);
m_toolActionIds.push_back(Core::Id("FormEditor.LayoutAdjustSize")); m_toolActionIds.push_back(Core::Id("FormEditor.LayoutAdjustSize"));
const QString adjustShortcut = Core::UseMacShortcuts ? tr("Meta+J") : tr("Ctrl+J"); const QString adjustShortcut = Core::UseMacShortcuts ? tr("Meta+J") : tr("Ctrl+J");
addToolAction(m_fwm->actionAdjustSize(), am, m_contexts, addToolAction(m_fwm->actionAdjustSize(), m_contexts,
m_toolActionIds.back(), mformtools, adjustShortcut); m_toolActionIds.back(), mformtools, adjustShortcut);
m_toolActionIds.push_back(Core::Id("FormEditor.SimplifyLayout")); m_toolActionIds.push_back(Core::Id("FormEditor.SimplifyLayout"));
addToolAction(m_fwm->actionSimplifyLayout(), am, m_contexts, addToolAction(m_fwm->actionSimplifyLayout(), m_contexts,
m_toolActionIds.back(), mformtools); m_toolActionIds.back(), mformtools);
createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator1")); createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator1"));
addToolAction(m_fwm->actionLower(), am, m_contexts, addToolAction(m_fwm->actionLower(), m_contexts,
Core::Id("FormEditor.Lower"), mformtools); Core::Id("FormEditor.Lower"), mformtools);
addToolAction(m_fwm->actionRaise(), am, m_contexts, addToolAction(m_fwm->actionRaise(), m_contexts,
Core::Id("FormEditor.Raise"), mformtools); Core::Id("FormEditor.Raise"), mformtools);
// Commands that do not go into the editor toolbar // Commands that do not go into the editor toolbar
createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator2")); createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator2"));
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
m_actionPreview = m_fwm->action(QDesignerFormWindowManagerInterface::DefaultPreviewAction); m_actionPreview = m_fwm->action(QDesignerFormWindowManagerInterface::DefaultPreviewAction);
@@ -549,7 +545,7 @@ void FormEditorW::setupActions()
m_actionPreview = m_fwm->actionDefaultPreview(); m_actionPreview = m_fwm->actionDefaultPreview();
#endif #endif
QTC_ASSERT(m_actionPreview, return); QTC_ASSERT(m_actionPreview, return);
addToolAction(m_actionPreview, am, m_contexts, addToolAction(m_actionPreview, m_contexts,
Core::Id("FormEditor.Preview"), mformtools, tr("Alt+Shift+R")); Core::Id("FormEditor.Preview"), mformtools, tr("Alt+Shift+R"));
// Preview in style... // Preview in style...
@@ -559,15 +555,15 @@ void FormEditorW::setupActions()
m_actionGroupPreviewInStyle = m_fwm->actionGroupPreviewInStyle(); m_actionGroupPreviewInStyle = m_fwm->actionGroupPreviewInStyle();
#endif #endif
Core::ActionContainer *previewAC = createPreviewStyleMenu(am, m_actionGroupPreviewInStyle); Core::ActionContainer *previewAC = createPreviewStyleMenu(m_actionGroupPreviewInStyle);
m_previewInStyleMenu = previewAC->menu(); m_previewInStyleMenu = previewAC->menu();
mformtools->addMenu(previewAC); mformtools->addMenu(previewAC);
setPreviewMenuEnabled(false); setPreviewMenuEnabled(false);
// Form settings // Form settings
createSeparator(this, am, m_contexts, medit, Core::Id("FormEditor.Edit.Separator2"), Core::Constants::G_EDIT_OTHER); createSeparator(this, m_contexts, medit, Core::Id("FormEditor.Edit.Separator2"), Core::Constants::G_EDIT_OTHER);
createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator3")); createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator3"));
m_actionSwitchSource = new QAction(tr("Switch Source/Form"), this); m_actionSwitchSource = new QAction(tr("Switch Source/Form"), this);
connect(m_actionSwitchSource, SIGNAL(triggered()), this, SLOT(switchSourceForm())); connect(m_actionSwitchSource, SIGNAL(triggered()), this, SLOT(switchSourceForm()));
@@ -575,20 +571,20 @@ void FormEditorW::setupActions()
// Switch form/source in editor/design contexts. // Switch form/source in editor/design contexts.
Core::Context switchContexts = m_contexts; Core::Context switchContexts = m_contexts;
switchContexts.add(Core::Constants::C_EDITORMANAGER); switchContexts.add(Core::Constants::C_EDITORMANAGER);
addToolAction(m_actionSwitchSource, am, switchContexts, Core::Id("FormEditor.FormSwitchSource"), mformtools, addToolAction(m_actionSwitchSource, switchContexts, Core::Id("FormEditor.FormSwitchSource"), mformtools,
tr("Shift+F4")); tr("Shift+F4"));
createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator4")); createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator4"));
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
QAction *actionFormSettings = m_fwm->action(QDesignerFormWindowManagerInterface::FormWindowSettingsDialogAction); QAction *actionFormSettings = m_fwm->action(QDesignerFormWindowManagerInterface::FormWindowSettingsDialogAction);
#else #else
QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog(); QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog();
#endif #endif
addToolAction(actionFormSettings, am, m_contexts, Core::Id("FormEditor.FormSettings"), mformtools); addToolAction(actionFormSettings, m_contexts, Core::Id("FormEditor.FormSettings"), mformtools);
createSeparator(this, am, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator5")); createSeparator(this, m_contexts, mformtools, Core::Id("FormEditor.Menu.Tools.Separator5"));
m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this); m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this);
addToolAction(m_actionAboutPlugins, am, m_contexts, addToolAction(m_actionAboutPlugins, m_contexts,
Core::Id("FormEditor.AboutPlugins"), mformtools); Core::Id("FormEditor.AboutPlugins"), mformtools);
connect(m_actionAboutPlugins, SIGNAL(triggered()), m_fwm, connect(m_actionAboutPlugins, SIGNAL(triggered()), m_fwm,
#if QT_VERSION >= 0x050000 #if QT_VERSION >= 0x050000
@@ -606,10 +602,9 @@ void FormEditorW::setupActions()
QToolBar *FormEditorW::createEditorToolBar() const QToolBar *FormEditorW::createEditorToolBar() const
{ {
QToolBar *editorToolBar = new QToolBar; QToolBar *editorToolBar = new QToolBar;
Core::ActionManager *am = Core::ICore::actionManager();
const QList<Core::Id>::const_iterator cend = m_toolActionIds.constEnd(); const QList<Core::Id>::const_iterator cend = m_toolActionIds.constEnd();
for (QList<Core::Id>::const_iterator it = m_toolActionIds.constBegin(); it != cend; ++it) { for (QList<Core::Id>::const_iterator it = m_toolActionIds.constBegin(); it != cend; ++it) {
Core::Command *cmd = am->command(*it); Core::Command *cmd = Core::ActionManager::command(*it);
QTC_ASSERT(cmd, continue); QTC_ASSERT(cmd, continue);
QAction *action = cmd->action(); QAction *action = cmd->action();
if (!action->icon().isNull()) // Simplify grid has no action yet if (!action->icon().isNull()) // Simplify grid has no action yet
@@ -621,11 +616,10 @@ QToolBar *FormEditorW::createEditorToolBar() const
return editorToolBar; return editorToolBar;
} }
Core::ActionContainer *FormEditorW::createPreviewStyleMenu(Core::ActionManager *am, Core::ActionContainer *FormEditorW::createPreviewStyleMenu(QActionGroup *actionGroup)
QActionGroup *actionGroup)
{ {
const QString menuId = QLatin1String(M_FORMEDITOR_PREVIEW); const QString menuId = QLatin1String(M_FORMEDITOR_PREVIEW);
Core::ActionContainer *menuPreviewStyle = am->createMenu(M_FORMEDITOR_PREVIEW); Core::ActionContainer *menuPreviewStyle = Core::ActionManager::createMenu(M_FORMEDITOR_PREVIEW);
menuPreviewStyle->menu()->setTitle(tr("Preview in")); menuPreviewStyle->menu()->setTitle(tr("Preview in"));
// The preview menu is a list of invisible actions for the embedded design // The preview menu is a list of invisible actions for the embedded design
@@ -647,7 +641,7 @@ Core::ActionContainer *FormEditorW::createPreviewStyleMenu(Core::ActionManager *
name += dot; name += dot;
} }
name += data.toString(); name += data.toString();
Core::Command *command = am->registerAction(a, Core::Id(name), m_contexts); Core::Command *command = Core::ActionManager::registerAction(a, Core::Id(name), m_contexts);
bindShortcut(command, a); bindShortcut(command, a);
if (isDeviceProfile) { if (isDeviceProfile) {
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
@@ -689,7 +683,6 @@ void FormEditorW::bindShortcut(Core::Command *command, QAction *action)
// Create an action to activate a designer tool // Create an action to activate a designer tool
QAction *FormEditorW::createEditModeAction(QActionGroup *ag, QAction *FormEditorW::createEditModeAction(QActionGroup *ag,
const Core::Context &context, const Core::Context &context,
Core::ActionManager *am,
Core::ActionContainer *medit, Core::ActionContainer *medit,
const QString &actionName, const QString &actionName,
const Core::Id &id, const Core::Id &id,
@@ -701,7 +694,7 @@ QAction *FormEditorW::createEditModeAction(QActionGroup *ag,
rc->setCheckable(true); rc->setCheckable(true);
if (!iconName.isEmpty()) if (!iconName.isEmpty())
rc->setIcon(designerIcon(iconName)); rc->setIcon(designerIcon(iconName));
Core::Command *command = am->registerAction(rc, id, context); Core::Command *command = Core::ActionManager::registerAction(rc, id, context);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
if (!keySequence.isEmpty()) if (!keySequence.isEmpty())
command->setDefaultKeySequence(QKeySequence(keySequence)); command->setDefaultKeySequence(QKeySequence(keySequence));
@@ -713,11 +706,11 @@ QAction *FormEditorW::createEditModeAction(QActionGroup *ag,
} }
// Create a tool action // Create a tool action
Core::Command *FormEditorW::addToolAction(QAction *a, Core::ActionManager *am, Core::Command *FormEditorW::addToolAction(QAction *a,
const Core::Context &context, const Core::Id &id, const Core::Context &context, const Core::Id &id,
Core::ActionContainer *c1, const QString &keySequence) Core::ActionContainer *c1, const QString &keySequence)
{ {
Core::Command *command = am->registerAction(a, id, context); Core::Command *command = Core::ActionManager::registerAction(a, id, context);
if (!keySequence.isEmpty()) if (!keySequence.isEmpty())
command->setDefaultKeySequence(QKeySequence(keySequence)); command->setDefaultKeySequence(QKeySequence(keySequence));
if (!a->isSeparator()) if (!a->isSeparator())

View File

@@ -147,27 +147,24 @@ private:
void setupActions(); void setupActions();
void setupViewActions(); void setupViewActions();
void addDockViewAction(Core::ActionManager *am, void addDockViewAction(Core::ActionContainer *viewMenu,
Core::ActionContainer *viewMenu,
int index, int index,
const Core::Context &context, const Core::Context &context,
const QString &title, const Core::Id &id); const QString &title, const Core::Id &id);
Core::ActionContainer *createPreviewStyleMenu(Core::ActionManager *am, Core::ActionContainer *createPreviewStyleMenu(QActionGroup *actionGroup);
QActionGroup *actionGroup);
void critical(const QString &errorMessage); void critical(const QString &errorMessage);
void bindShortcut(Core::Command *command, QAction *action); void bindShortcut(Core::Command *command, QAction *action);
QAction *createEditModeAction(QActionGroup *ag, QAction *createEditModeAction(QActionGroup *ag,
const Core::Context &context, const Core::Context &context,
Core::ActionManager *am,
Core::ActionContainer *medit, Core::ActionContainer *medit,
const QString &actionName, const QString &actionName,
const Core::Id &id, const Core::Id &id,
int toolNumber, int toolNumber,
const QString &iconName = QString(), const QString &iconName = QString(),
const QString &keySequence = QString()); const QString &keySequence = QString());
Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Command *addToolAction(QAction *a,
const Core::Context &context, const Core::Id &id, const Core::Context &context, const Core::Id &id,
Core::ActionContainer *c1, const QString &keySequence = QString()); Core::ActionContainer *c1, const QString &keySequence = QString());
QToolBar *createEditorToolBar() const; QToolBar *createEditorToolBar() const;

View File

@@ -376,12 +376,9 @@ QWidget *FakeVimExCommandsPage::createPage(QWidget *parent)
void FakeVimExCommandsPage::initialize() void FakeVimExCommandsPage::initialize()
{ {
ActionManager *am = ICore::actionManager();
QTC_ASSERT(am, return);
QMap<QString, QTreeWidgetItem *> sections; QMap<QString, QTreeWidgetItem *> sections;
foreach (Command *c, am->commands()) { foreach (Command *c, Core::ActionManager::commands()) {
if (c->action() && c->action()->isSeparator()) if (c->action() && c->action()->isSeparator())
continue; continue;
@@ -937,8 +934,6 @@ void FakeVimPluginPrivate::aboutToShutdown()
bool FakeVimPluginPrivate::initialize() bool FakeVimPluginPrivate::initialize()
{ {
EditorManager *editorManager = ICore::editorManager(); EditorManager *editorManager = ICore::editorManager();
ActionManager *actionManager = ICore::actionManager();
QTC_ASSERT(actionManager, return false);
//m_wordCompletion = new WordCompletion; //m_wordCompletion = new WordCompletion;
//q->addAutoReleasedObject(m_wordCompletion); //q->addAutoReleasedObject(m_wordCompletion);
@@ -968,12 +963,12 @@ bool FakeVimPluginPrivate::initialize()
readSettings(); readSettings();
Core::Command *cmd = 0; Core::Command *cmd = 0;
cmd = actionManager->registerAction(theFakeVimSetting(ConfigUseFakeVim), cmd = Core::ActionManager::registerAction(theFakeVimSetting(ConfigUseFakeVim),
Constants::INSTALL_HANDLER, globalcontext, true); Constants::INSTALL_HANDLER, globalcontext, true);
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+V,Meta+V") : tr("Alt+V,Alt+V"))); cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+V,Meta+V") : tr("Alt+V,Alt+V")));
ActionContainer *advancedMenu = ActionContainer *advancedMenu =
actionManager->actionContainer(Core::Constants::M_EDIT_ADVANCED); Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED);
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_EDITOR); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_EDITOR);
for (int i = 1; i < 10; ++i) { for (int i = 1; i < 10; ++i) {
@@ -981,7 +976,7 @@ bool FakeVimPluginPrivate::initialize()
act->setText(tr("Execute User Action #%1").arg(i)); act->setText(tr("Execute User Action #%1").arg(i));
act->setData(i); act->setData(i);
QString id = QString("FakeVim.UserAction%1").arg(i); QString id = QString("FakeVim.UserAction%1").arg(i);
cmd = actionManager->registerAction(act, Core::Id(id), globalcontext); cmd = Core::ActionManager::registerAction(act, Core::Id(id), globalcontext);
cmd->setDefaultKeySequence(QKeySequence((Core::UseMacShortcuts ? tr("Meta+V,%1") : tr("Alt+V,%1")).arg(i))); cmd->setDefaultKeySequence(QKeySequence((Core::UseMacShortcuts ? tr("Meta+V,%1") : tr("Alt+V,%1")).arg(i)));
connect(act, SIGNAL(triggered()), SLOT(userActionTriggered())); connect(act, SIGNAL(triggered()), SLOT(userActionTriggered()));
} }
@@ -1134,9 +1129,7 @@ void FakeVimPluginPrivate::showSettingsDialog()
void FakeVimPluginPrivate::triggerAction(const Id &id) void FakeVimPluginPrivate::triggerAction(const Id &id)
{ {
Core::ActionManager *am = ICore::actionManager(); Core::Command *cmd = Core::ActionManager::command(id);
QTC_ASSERT(am, return);
Core::Command *cmd = am->command(id);
QTC_ASSERT(cmd, qDebug() << "UNKNOWN CODE: " << id.name(); return); QTC_ASSERT(cmd, qDebug() << "UNKNOWN CODE: " << id.name(); return);
QAction *action = cmd->action(); QAction *action = cmd->action();
QTC_ASSERT(action, return); QTC_ASSERT(action, return);
@@ -1145,9 +1138,7 @@ void FakeVimPluginPrivate::triggerAction(const Id &id)
void FakeVimPluginPrivate::setActionChecked(const Id &id, bool check) void FakeVimPluginPrivate::setActionChecked(const Id &id, bool check)
{ {
Core::ActionManager *am = ICore::actionManager(); Core::Command *cmd = Core::ActionManager::command(id);
QTC_ASSERT(am, return);
Core::Command *cmd = am->command(id);
QTC_ASSERT(cmd, return); QTC_ASSERT(cmd, return);
QAction *action = cmd->action(); QAction *action = cmd->action();
QTC_ASSERT(action, return); QTC_ASSERT(action, return);

View File

@@ -196,9 +196,8 @@ void FindPlugin::openFindDialog(IFindFilter *filter)
void FindPlugin::setupMenu() void FindPlugin::setupMenu()
{ {
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT); Core::ActionContainer *mfind = Core::ActionManager::createMenu(Constants::M_FIND);
Core::ActionContainer *mfind = am->createMenu(Constants::M_FIND);
medit->addMenu(mfind, Core::Constants::G_EDIT_FIND); medit->addMenu(mfind, Core::Constants::G_EDIT_FIND);
mfind->menu()->setTitle(tr("&Find/Replace")); mfind->menu()->setTitle(tr("&Find/Replace"));
mfind->appendGroup(Constants::G_FIND_CURRENTDOCUMENT); mfind->appendGroup(Constants::G_FIND_CURRENTDOCUMENT);
@@ -210,19 +209,19 @@ void FindPlugin::setupMenu()
QAction *separator; QAction *separator;
separator = new QAction(this); separator = new QAction(this);
separator->setSeparator(true); separator->setSeparator(true);
cmd = am->registerAction(separator, "Find.Sep.Flags", globalcontext); cmd = Core::ActionManager::registerAction(separator, "Find.Sep.Flags", globalcontext);
mfind->addAction(cmd, Constants::G_FIND_FLAGS); mfind->addAction(cmd, Constants::G_FIND_FLAGS);
separator = new QAction(this); separator = new QAction(this);
separator->setSeparator(true); separator->setSeparator(true);
cmd = am->registerAction(separator, "Find.Sep.Actions", globalcontext); cmd = Core::ActionManager::registerAction(separator, "Find.Sep.Actions", globalcontext);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
Core::ActionContainer *mfindadvanced = am->createMenu(Constants::M_FIND_ADVANCED); Core::ActionContainer *mfindadvanced = Core::ActionManager::createMenu(Constants::M_FIND_ADVANCED);
mfindadvanced->menu()->setTitle(tr("Advanced Find")); mfindadvanced->menu()->setTitle(tr("Advanced Find"));
mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS); mfind->addMenu(mfindadvanced, Constants::G_FIND_FILTERS);
d->m_openFindDialog = new QAction(tr("Open Advanced Find..."), this); d->m_openFindDialog = new QAction(tr("Open Advanced Find..."), this);
d->m_openFindDialog->setIconText(tr("Advanced...")); d->m_openFindDialog->setIconText(tr("Advanced..."));
cmd = am->registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext); cmd = Core::ActionManager::registerAction(d->m_openFindDialog, Constants::ADVANCED_FIND, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F")));
mfindadvanced->addAction(cmd); mfindadvanced->addAction(cmd);
connect(d->m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter())); connect(d->m_openFindDialog, SIGNAL(triggered()), this, SLOT(openFindFilter()));
@@ -230,13 +229,12 @@ void FindPlugin::setupMenu()
void FindPlugin::setupFilterMenuItems() void FindPlugin::setupFilterMenuItems()
{ {
Core::ActionManager *am = Core::ICore::actionManager();
QList<IFindFilter*> findInterfaces = QList<IFindFilter*> findInterfaces =
ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>(); ExtensionSystem::PluginManager::instance()->getObjects<IFindFilter>();
Core::Command *cmd; Core::Command *cmd;
Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::ActionContainer *mfindadvanced = am->actionContainer(Constants::M_FIND_ADVANCED); Core::ActionContainer *mfindadvanced = Core::ActionManager::actionContainer(Constants::M_FIND_ADVANCED);
d->m_filterActions.clear(); d->m_filterActions.clear();
bool haveEnabledFilters = false; bool haveEnabledFilters = false;
foreach (IFindFilter *filter, findInterfaces) { foreach (IFindFilter *filter, findInterfaces) {
@@ -246,7 +244,7 @@ void FindPlugin::setupFilterMenuItems()
haveEnabledFilters = true; haveEnabledFilters = true;
action->setEnabled(isEnabled); action->setEnabled(isEnabled);
action->setData(qVariantFromValue(filter)); action->setData(qVariantFromValue(filter));
cmd = am->registerAction(action, Core::Id(QLatin1String("FindFilter.")+filter->id()), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id(QLatin1String("FindFilter.")+filter->id()), globalcontext);
cmd->setDefaultKeySequence(filter->defaultShortcut()); cmd->setDefaultKeySequence(filter->defaultShortcut());
mfindadvanced->addAction(cmd); mfindadvanced->addAction(cmd);
d->m_filterActions.insert(filter, action); d->m_filterActions.insert(filter, action);

View File

@@ -147,22 +147,21 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
// register actions // register actions
Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mfind = Core::ActionManager::actionContainer(Constants::M_FIND);
Core::ActionContainer *mfind = am->actionContainer(Constants::M_FIND);
Core::Command *cmd; Core::Command *cmd;
m_ui.advancedButton->setDefaultAction(am->command(Constants::ADVANCED_FIND)->action()); m_ui.advancedButton->setDefaultAction(Core::ActionManager::command(Constants::ADVANCED_FIND)->action());
QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace")); QIcon icon = QIcon::fromTheme(QLatin1String("edit-find-replace"));
m_findInDocumentAction = new QAction(icon, tr("Find/Replace"), this); m_findInDocumentAction = new QAction(icon, tr("Find/Replace"), this);
cmd = am->registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT, globalcontext); cmd = Core::ActionManager::registerAction(m_findInDocumentAction, Constants::FIND_IN_DOCUMENT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence::Find); cmd->setDefaultKeySequence(QKeySequence::Find);
mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT); mfind->addAction(cmd, Constants::G_FIND_CURRENTDOCUMENT);
connect(m_findInDocumentAction, SIGNAL(triggered()), this, SLOT(openFind())); connect(m_findInDocumentAction, SIGNAL(triggered()), this, SLOT(openFind()));
if (QApplication::clipboard()->supportsFindBuffer()) { if (QApplication::clipboard()->supportsFindBuffer()) {
m_enterFindStringAction = new QAction(tr("Enter Find String"), this); m_enterFindStringAction = new QAction(tr("Enter Find String"), this);
cmd = am->registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext); cmd = Core::ActionManager::registerAction(m_enterFindStringAction, "Find.EnterFindString", globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+E"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+E")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_enterFindStringAction, SIGNAL(triggered()), this, SLOT(putSelectionToFindClipboard())); connect(m_enterFindStringAction, SIGNAL(triggered()), this, SLOT(putSelectionToFindClipboard()));
@@ -170,33 +169,33 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
} }
m_findNextAction = new QAction(tr("Find Next"), this); m_findNextAction = new QAction(tr("Find Next"), this);
cmd = am->registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext); cmd = Core::ActionManager::registerAction(m_findNextAction, Constants::FIND_NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence::FindNext); cmd->setDefaultKeySequence(QKeySequence::FindNext);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(invokeFindNext())); connect(m_findNextAction, SIGNAL(triggered()), this, SLOT(invokeFindNext()));
m_ui.findNextButton->setDefaultAction(cmd->action()); m_ui.findNextButton->setDefaultAction(cmd->action());
m_findPreviousAction = new QAction(tr("Find Previous"), this); m_findPreviousAction = new QAction(tr("Find Previous"), this);
cmd = am->registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext); cmd = Core::ActionManager::registerAction(m_findPreviousAction, Constants::FIND_PREVIOUS, globalcontext);
cmd->setDefaultKeySequence(QKeySequence::FindPrevious); cmd->setDefaultKeySequence(QKeySequence::FindPrevious);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(invokeFindPrevious())); connect(m_findPreviousAction, SIGNAL(triggered()), this, SLOT(invokeFindPrevious()));
m_ui.findPreviousButton->setDefaultAction(cmd->action()); m_ui.findPreviousButton->setDefaultAction(cmd->action());
m_findNextSelectedAction = new QAction(tr("Find Next (Selected)"), this); m_findNextSelectedAction = new QAction(tr("Find Next (Selected)"), this);
cmd = am->registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext); cmd = Core::ActionManager::registerAction(m_findNextSelectedAction, Constants::FIND_NEXT_SELECTED, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F3"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+F3")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findNextSelectedAction, SIGNAL(triggered()), this, SLOT(findNextSelected())); connect(m_findNextSelectedAction, SIGNAL(triggered()), this, SLOT(findNextSelected()));
m_findPreviousSelectedAction = new QAction(tr("Find Previous (Selected)"), this); m_findPreviousSelectedAction = new QAction(tr("Find Previous (Selected)"), this);
cmd = am->registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED, globalcontext); cmd = Core::ActionManager::registerAction(m_findPreviousSelectedAction, Constants::FIND_PREV_SELECTED, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F3"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F3")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_findPreviousSelectedAction, SIGNAL(triggered()), this, SLOT(findPreviousSelected())); connect(m_findPreviousSelectedAction, SIGNAL(triggered()), this, SLOT(findPreviousSelected()));
m_replaceAction = new QAction(tr("Replace"), this); m_replaceAction = new QAction(tr("Replace"), this);
cmd = am->registerAction(m_replaceAction, Constants::REPLACE, globalcontext); cmd = Core::ActionManager::registerAction(m_replaceAction, Constants::REPLACE, globalcontext);
cmd->setDefaultKeySequence(QKeySequence()); cmd->setDefaultKeySequence(QKeySequence());
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceAction, SIGNAL(triggered()), this, SLOT(invokeReplace())); connect(m_replaceAction, SIGNAL(triggered()), this, SLOT(invokeReplace()));
@@ -204,21 +203,21 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_replaceNextAction = new QAction(tr("Replace && Find"), this); m_replaceNextAction = new QAction(tr("Replace && Find"), this);
m_replaceNextAction->setIconText(tr("Replace && Find")); // work around bug in Qt that kills ampersands in tool button m_replaceNextAction->setIconText(tr("Replace && Find")); // work around bug in Qt that kills ampersands in tool button
cmd = am->registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext); cmd = Core::ActionManager::registerAction(m_replaceNextAction, Constants::REPLACE_NEXT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+="))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+=")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceNextAction, SIGNAL(triggered()), this, SLOT(invokeReplaceNext())); connect(m_replaceNextAction, SIGNAL(triggered()), this, SLOT(invokeReplaceNext()));
m_ui.replaceNextButton->setDefaultAction(cmd->action()); m_ui.replaceNextButton->setDefaultAction(cmd->action());
m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this); m_replacePreviousAction = new QAction(tr("Replace && Find Previous"), this);
cmd = am->registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext); cmd = Core::ActionManager::registerAction(m_replacePreviousAction, Constants::REPLACE_PREVIOUS, globalcontext);
// shortcut removed, clashes with Ctrl++ on many keyboard layouts // shortcut removed, clashes with Ctrl++ on many keyboard layouts
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+="))); //cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+=")));
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replacePreviousAction, SIGNAL(triggered()), this, SLOT(invokeReplacePrevious())); connect(m_replacePreviousAction, SIGNAL(triggered()), this, SLOT(invokeReplacePrevious()));
m_replaceAllAction = new QAction(tr("Replace All"), this); m_replaceAllAction = new QAction(tr("Replace All"), this);
cmd = am->registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext); cmd = Core::ActionManager::registerAction(m_replaceAllAction, Constants::REPLACE_ALL, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_ACTIONS); mfind->addAction(cmd, Constants::G_FIND_ACTIONS);
connect(m_replaceAllAction, SIGNAL(triggered()), this, SLOT(invokeReplaceAll())); connect(m_replaceAllAction, SIGNAL(triggered()), this, SLOT(invokeReplaceAll()));
m_ui.replaceAllButton->setDefaultAction(cmd->action()); m_ui.replaceAllButton->setDefaultAction(cmd->action());
@@ -227,7 +226,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_caseSensitiveAction->setIcon(QIcon(QLatin1String(":/find/images/casesensitively.png"))); m_caseSensitiveAction->setIcon(QIcon(QLatin1String(":/find/images/casesensitively.png")));
m_caseSensitiveAction->setCheckable(true); m_caseSensitiveAction->setCheckable(true);
m_caseSensitiveAction->setChecked(false); m_caseSensitiveAction->setChecked(false);
cmd = am->registerAction(m_caseSensitiveAction, Constants::CASE_SENSITIVE, globalcontext); cmd = Core::ActionManager::registerAction(m_caseSensitiveAction, Constants::CASE_SENSITIVE, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_FLAGS); mfind->addAction(cmd, Constants::G_FIND_FLAGS);
connect(m_caseSensitiveAction, SIGNAL(triggered(bool)), this, SLOT(setCaseSensitive(bool))); connect(m_caseSensitiveAction, SIGNAL(triggered(bool)), this, SLOT(setCaseSensitive(bool)));
lineEditMenu->addAction(m_caseSensitiveAction); lineEditMenu->addAction(m_caseSensitiveAction);
@@ -236,7 +235,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_wholeWordAction->setIcon(QIcon(QLatin1String(":/find/images/wholewords.png"))); m_wholeWordAction->setIcon(QIcon(QLatin1String(":/find/images/wholewords.png")));
m_wholeWordAction->setCheckable(true); m_wholeWordAction->setCheckable(true);
m_wholeWordAction->setChecked(false); m_wholeWordAction->setChecked(false);
cmd = am->registerAction(m_wholeWordAction, Constants::WHOLE_WORDS, globalcontext); cmd = Core::ActionManager::registerAction(m_wholeWordAction, Constants::WHOLE_WORDS, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_FLAGS); mfind->addAction(cmd, Constants::G_FIND_FLAGS);
connect(m_wholeWordAction, SIGNAL(triggered(bool)), this, SLOT(setWholeWord(bool))); connect(m_wholeWordAction, SIGNAL(triggered(bool)), this, SLOT(setWholeWord(bool)));
lineEditMenu->addAction(m_wholeWordAction); lineEditMenu->addAction(m_wholeWordAction);
@@ -245,7 +244,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_regularExpressionAction->setIcon(QIcon(QLatin1String(":/find/images/regexp.png"))); m_regularExpressionAction->setIcon(QIcon(QLatin1String(":/find/images/regexp.png")));
m_regularExpressionAction->setCheckable(true); m_regularExpressionAction->setCheckable(true);
m_regularExpressionAction->setChecked(false); m_regularExpressionAction->setChecked(false);
cmd = am->registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext); cmd = Core::ActionManager::registerAction(m_regularExpressionAction, Constants::REGULAR_EXPRESSIONS, globalcontext);
mfind->addAction(cmd, Constants::G_FIND_FLAGS); mfind->addAction(cmd, Constants::G_FIND_FLAGS);
connect(m_regularExpressionAction, SIGNAL(triggered(bool)), this, SLOT(setRegularExpressions(bool))); connect(m_regularExpressionAction, SIGNAL(triggered(bool)), this, SLOT(setRegularExpressions(bool)));
lineEditMenu->addAction(m_regularExpressionAction); lineEditMenu->addAction(m_regularExpressionAction);

View File

@@ -279,7 +279,7 @@ SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel)
d->m_expandCollapseAction = new QAction(tr("Expand All"), this); d->m_expandCollapseAction = new QAction(tr("Expand All"), this);
d->m_expandCollapseAction->setCheckable(true); d->m_expandCollapseAction->setCheckable(true);
d->m_expandCollapseAction->setIcon(QIcon(QLatin1String(":/find/images/expand.png"))); d->m_expandCollapseAction->setIcon(QIcon(QLatin1String(":/find/images/expand.png")));
Core::Command *cmd = Core::ICore::actionManager()->registerAction( Core::Command *cmd = Core::ActionManager::registerAction(
d->m_expandCollapseAction, "Find.ExpandAll", d->m_expandCollapseAction, "Find.ExpandAll",
Core::Context(Core::Constants::C_GLOBAL)); Core::Context(Core::Constants::C_GLOBAL));
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);

View File

@@ -95,11 +95,10 @@ bool GenericProjectPlugin::initialize(const QStringList &, QString *errorMessage
addAutoReleasedObject(new GenericTargetFactory); addAutoReleasedObject(new GenericTargetFactory);
const Core::Context projectContext(Constants::PROJECTCONTEXT); const Core::Context projectContext(Constants::PROJECTCONTEXT);
Core::ActionManager *am = Core::ICore::actionManager();
Core::ActionContainer *mproject = Core::ActionContainer *mproject =
am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
m_editFilesAction = new QAction(tr("Edit Files..."), this); m_editFilesAction = new QAction(tr("Edit Files..."), this);
Core::Command *command = am->registerAction(m_editFilesAction, Constants::EDITFILESACTION, projectContext); Core::Command *command = Core::ActionManager::registerAction(m_editFilesAction, Constants::EDITFILESACTION, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_FILES);
connect(m_editFilesAction, SIGNAL(triggered()), this, SLOT(editFiles())); connect(m_editFilesAction, SIGNAL(triggered()), this, SLOT(editFiles()));

View File

@@ -346,11 +346,10 @@ bool GerritPlugin::initialize(Core::ActionContainer *ac)
{ {
m_parameters->fromSettings(Core::ICore::instance()->settings()); m_parameters->fromSettings(Core::ICore::instance()->settings());
Core::ActionManager *am = Core::ICore::instance()->actionManager();
QAction *openViewAction = new QAction(tr("Gerrit..."), this); QAction *openViewAction = new QAction(tr("Gerrit..."), this);
Core::Command *command = Core::Command *command =
am->registerAction(openViewAction, Constants::GERRIT_OPEN_VIEW, Core::ActionManager::registerAction(openViewAction, Constants::GERRIT_OPEN_VIEW,
Core::Context(Core::Constants::C_GLOBAL)); Core::Context(Core::Constants::C_GLOBAL));
connect(openViewAction, SIGNAL(triggered()), this, SLOT(openView())); connect(openViewAction, SIGNAL(triggered()), this, SLOT(openView()));
ac->addAction(command); ac->addAction(command);

View File

@@ -182,19 +182,18 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = {
Git::Constants::C_GITSUBMITEDITOR Git::Constants::C_GITSUBMITEDITOR
}; };
static Core::Command *createSeparator(Core::ActionManager *am, static Core::Command *createSeparator(const Core::Context &context,
const Core::Context &context, const Core::Id &id,
const Core::Id &id, QObject *parent)
QObject *parent)
{ {
QAction *a = new QAction(parent); QAction *a = new QAction(parent);
a->setSeparator(true); a->setSeparator(true);
return am->registerAction(a, id, context); return Core::ActionManager::registerAction(a, id, context);
} }
// Create a parameter action // Create a parameter action
ParameterActionCommandPair ParameterActionCommandPair
GitPlugin::createParameterAction(Core::ActionManager *am, Core::ActionContainer *ac, GitPlugin::createParameterAction(Core::ActionContainer *ac,
const QString &defaultText, const QString &parameterText, const QString &defaultText, const QString &parameterText,
const Core::Id &id, const Core::Context &context, const Core::Id &id, const Core::Context &context,
bool addToLocator) bool addToLocator)
@@ -202,7 +201,7 @@ ParameterActionCommandPair
Utils::ParameterAction *action = new Utils::ParameterAction(defaultText, parameterText, Utils::ParameterAction *action = new Utils::ParameterAction(defaultText, parameterText,
Utils::ParameterAction::EnabledWithParameter, Utils::ParameterAction::EnabledWithParameter,
this); this);
Core::Command *command = am->registerAction(action, id, context); Core::Command *command = Core::ActionManager::registerAction(action, id, context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
ac->addAction(command); ac->addAction(command);
if (addToLocator) if (addToLocator)
@@ -212,12 +211,12 @@ ParameterActionCommandPair
// Create an action to act on a file with a slot. // Create an action to act on a file with a slot.
ParameterActionCommandPair ParameterActionCommandPair
GitPlugin::createFileAction(Core::ActionManager *am, Core::ActionContainer *ac, GitPlugin::createFileAction(Core::ActionContainer *ac,
const QString &defaultText, const QString &parameterText, const QString &defaultText, const QString &parameterText,
const Core::Id &id, const Core::Context &context, bool addToLocator, const Core::Id &id, const Core::Context &context, bool addToLocator,
const char *pluginSlot) const char *pluginSlot)
{ {
const ParameterActionCommandPair rc = createParameterAction(am, ac, defaultText, parameterText, id, context, addToLocator); const ParameterActionCommandPair rc = createParameterAction(ac, defaultText, parameterText, id, context, addToLocator);
m_fileActions.push_back(rc.first); m_fileActions.push_back(rc.first);
connect(rc.first, SIGNAL(triggered()), this, pluginSlot); connect(rc.first, SIGNAL(triggered()), this, pluginSlot);
return rc; return rc;
@@ -225,12 +224,12 @@ ParameterActionCommandPair
// Create an action to act on a project with slot. // Create an action to act on a project with slot.
ParameterActionCommandPair ParameterActionCommandPair
GitPlugin::createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, GitPlugin::createProjectAction(Core::ActionContainer *ac,
const QString &defaultText, const QString &parameterText, const QString &defaultText, const QString &parameterText,
const Core::Id &id, const Core::Context &context, bool addToLocator, const Core::Id &id, const Core::Context &context, bool addToLocator,
const char *pluginSlot) const char *pluginSlot)
{ {
const ParameterActionCommandPair rc = createParameterAction(am, ac, defaultText, parameterText, id, context, addToLocator); const ParameterActionCommandPair rc = createParameterAction(ac, defaultText, parameterText, id, context, addToLocator);
m_projectActions.push_back(rc.first); m_projectActions.push_back(rc.first);
connect(rc.first, SIGNAL(triggered()), this, pluginSlot); connect(rc.first, SIGNAL(triggered()), this, pluginSlot);
return rc; return rc;
@@ -238,12 +237,12 @@ ParameterActionCommandPair
// Create an action to act on the repository // Create an action to act on the repository
ActionCommandPair ActionCommandPair
GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, GitPlugin::createRepositoryAction(Core::ActionContainer *ac,
const QString &text, const Core::Id &id, const QString &text, const Core::Id &id,
const Core::Context &context, bool addToLocator) const Core::Context &context, bool addToLocator)
{ {
QAction *action = new QAction(text, this); QAction *action = new QAction(text, this);
Core::Command *command = am->registerAction(action, id, context); Core::Command *command = Core::ActionManager::registerAction(action, id, context);
ac->addAction(command); ac->addAction(command);
m_repositoryActions.push_back(action); m_repositoryActions.push_back(action);
if (addToLocator) if (addToLocator)
@@ -253,12 +252,12 @@ ActionCommandPair
// Create an action to act on the repository with slot // Create an action to act on the repository with slot
ActionCommandPair ActionCommandPair
GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, GitPlugin::createRepositoryAction(Core::ActionContainer *ac,
const QString &text, const Core::Id &id, const QString &text, const Core::Id &id,
const Core::Context &context, bool addToLocator, const Core::Context &context, bool addToLocator,
const char *pluginSlot) const char *pluginSlot)
{ {
const ActionCommandPair rc = createRepositoryAction(am, ac, text, id, context, addToLocator); const ActionCommandPair rc = createRepositoryAction(ac, text, id, context, addToLocator);
connect(rc.first, SIGNAL(triggered()), this, pluginSlot); connect(rc.first, SIGNAL(triggered()), this, pluginSlot);
return rc; return rc;
} }
@@ -266,13 +265,13 @@ ActionCommandPair
// Action to act on the repository forwarded to a git client member function // Action to act on the repository forwarded to a git client member function
// taking the directory. Store the member function as data on the action. // taking the directory. Store the member function as data on the action.
ActionCommandPair ActionCommandPair
GitPlugin::createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, GitPlugin::createRepositoryAction(Core::ActionContainer *ac,
const QString &text, const Core::Id &id, const QString &text, const Core::Id &id,
const Core::Context &context, bool addToLocator, const Core::Context &context, bool addToLocator,
GitClientMemberFunc func) GitClientMemberFunc func)
{ {
// Set the member func as data and connect to generic slot // Set the member func as data and connect to generic slot
const ActionCommandPair rc = createRepositoryAction(am, ac, text, id, context, addToLocator); const ActionCommandPair rc = createRepositoryAction(ac, text, id, context, addToLocator);
rc.first->setData(qVariantFromValue(func)); rc.first->setData(qVariantFromValue(func));
connect(rc.first, SIGNAL(triggered()), this, SLOT(gitClientMemberFuncRepositoryAction())); connect(rc.first, SIGNAL(triggered()), this, SLOT(gitClientMemberFuncRepositoryAction()));
return rc; return rc;
@@ -313,68 +312,66 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
addAutoReleasedObject(m_commandLocator); addAutoReleasedObject(m_commandLocator);
//register actions //register actions
Core::ActionManager *actionManager = Core::ICore::actionManager();
Core::ActionContainer *toolsContainer = Core::ActionContainer *toolsContainer =
actionManager->actionContainer(Core::Constants::M_TOOLS); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *gitContainer = actionManager->createMenu("Git"); Core::ActionContainer *gitContainer = Core::ActionManager::createMenu("Git");
gitContainer->menu()->setTitle(tr("&Git")); gitContainer->menu()->setTitle(tr("&Git"));
toolsContainer->addMenu(gitContainer); toolsContainer->addMenu(gitContainer);
m_menuAction = gitContainer->menu()->menuAction(); m_menuAction = gitContainer->menu()->menuAction();
ParameterActionCommandPair parameterActionCommand ParameterActionCommandPair parameterActionCommand
= createFileAction(actionManager, gitContainer, = createFileAction(gitContainer,
tr("Blame Current File"), tr("Blame for \"%1\""), tr("Blame Current File"), tr("Blame for \"%1\""),
Core::Id("Git.Blame"), Core::Id("Git.Blame"),
globalcontext, true, SLOT(blameFile())); globalcontext, true, SLOT(blameFile()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+B") : tr("Alt+G,Alt+B"))); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+B") : tr("Alt+G,Alt+B")));
parameterActionCommand parameterActionCommand
= createFileAction(actionManager, gitContainer, = createFileAction(gitContainer,
tr("Diff Current File"), tr("Diff of \"%1\""), tr("Diff Current File"), tr("Diff of \"%1\""),
Core::Id("Git.Diff"), globalcontext, true, Core::Id("Git.Diff"), globalcontext, true,
SLOT(diffCurrentFile())); SLOT(diffCurrentFile()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+D") : tr("Alt+G,Alt+D"))); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+D") : tr("Alt+G,Alt+D")));
parameterActionCommand parameterActionCommand
= createFileAction(actionManager, gitContainer, = createFileAction(gitContainer,
tr("Log Current File"), tr("Log of \"%1\""), tr("Log Current File"), tr("Log of \"%1\""),
Core::Id("Git.Log"), globalcontext, true, SLOT(logFile())); Core::Id("Git.Log"), globalcontext, true, SLOT(logFile()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+L") : tr("Alt+G,Alt+L"))); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+L") : tr("Alt+G,Alt+L")));
// ------ // ------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.File"), this)); gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.File"), this));
parameterActionCommand parameterActionCommand
= createFileAction(actionManager, gitContainer, = createFileAction(gitContainer,
tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"), tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"),
Core::Id("Git.Stage"), globalcontext, true, SLOT(stageFile())); Core::Id("Git.Stage"), globalcontext, true, SLOT(stageFile()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+A") : tr("Alt+G,Alt+A"))); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+A") : tr("Alt+G,Alt+A")));
parameterActionCommand parameterActionCommand
= createFileAction(actionManager, gitContainer, = createFileAction(gitContainer,
tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"), tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"),
Core::Id("Git.Unstage"), globalcontext, true, SLOT(unstageFile())); Core::Id("Git.Unstage"), globalcontext, true, SLOT(unstageFile()));
parameterActionCommand parameterActionCommand
= createFileAction(actionManager, gitContainer, = createFileAction(gitContainer,
tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""), tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
Core::Id("Git.UndoUnstaged"), globalcontext, Core::Id("Git.UndoUnstaged"), globalcontext,
true, SLOT(undoUnstagedFileChanges())); true, SLOT(undoUnstagedFileChanges()));
parameterActionCommand parameterActionCommand
= createFileAction(actionManager, gitContainer, = createFileAction(gitContainer,
tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""), tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
Core::Id("Git.Undo"), globalcontext, Core::Id("Git.Undo"), globalcontext,
true, SLOT(undoFileChanges())); true, SLOT(undoFileChanges()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+U") : tr("Alt+G,Alt+U"))); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+U") : tr("Alt+G,Alt+U")));
// ------------ // ------------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Project"), this)); gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Project"), this));
parameterActionCommand parameterActionCommand
= createProjectAction(actionManager, gitContainer, = createProjectAction(gitContainer,
tr("Diff Current Project"), tr("Diff Project \"%1\""), tr("Diff Current Project"), tr("Diff Project \"%1\""),
Core::Id("Git.DiffProject"), Core::Id("Git.DiffProject"),
globalcontext, true, globalcontext, true,
@@ -382,84 +379,84 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+Shift+D") : tr("Alt+G,Alt+Shift+D"))); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+Shift+D") : tr("Alt+G,Alt+Shift+D")));
parameterActionCommand parameterActionCommand
= createProjectAction(actionManager, gitContainer, = createProjectAction(gitContainer,
tr("Log Project"), tr("Log Project \"%1\""), tr("Log Project"), tr("Log Project \"%1\""),
Core::Id("Git.LogProject"), globalcontext, true, Core::Id("Git.LogProject"), globalcontext, true,
SLOT(logProject())); SLOT(logProject()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+K") : tr("Alt+G,Alt+K"))); parameterActionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+K") : tr("Alt+G,Alt+K")));
parameterActionCommand parameterActionCommand
= createProjectAction(actionManager, gitContainer, = createProjectAction(gitContainer,
tr("Clean Project..."), tr("Clean Project \"%1\"..."), tr("Clean Project..."), tr("Clean Project \"%1\"..."),
Core::Id("Git.CleanProject"), globalcontext, Core::Id("Git.CleanProject"), globalcontext,
true, SLOT(cleanProject())); true, SLOT(cleanProject()));
// -------------- // --------------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Repository"), this)); gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Repository"), this));
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Diff"), Core::Id("Git.DiffRepository"), tr("Diff"), Core::Id("Git.DiffRepository"),
globalcontext, true, SLOT(diffRepository())); globalcontext, true, SLOT(diffRepository()));
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Log"), Core::Id("Git.LogRepository"), tr("Log"), Core::Id("Git.LogRepository"),
globalcontext, true, &GitClient::graphLog); globalcontext, true, &GitClient::graphLog);
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Status"), Core::Id("Git.StatusRepository"), tr("Status"), Core::Id("Git.StatusRepository"),
globalcontext, true, &GitClient::status); globalcontext, true, &GitClient::status);
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Undo Uncommitted Changes..."), Core::Id("Git.UndoRepository"), tr("Undo Uncommitted Changes..."), Core::Id("Git.UndoRepository"),
globalcontext, false, SLOT(undoRepositoryChanges())); globalcontext, false, SLOT(undoRepositoryChanges()));
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Clean..."), Core::Id("Git.CleanRepository"), tr("Clean..."), Core::Id("Git.CleanRepository"),
globalcontext, true, SLOT(cleanRepository())); globalcontext, true, SLOT(cleanRepository()));
m_createRepositoryAction = new QAction(tr("Create Repository..."), this); m_createRepositoryAction = new QAction(tr("Create Repository..."), this);
Core::Command *createRepositoryCommand = actionManager->registerAction(m_createRepositoryAction, "Git.CreateRepository", globalcontext); Core::Command *createRepositoryCommand = Core::ActionManager::registerAction(m_createRepositoryAction, "Git.CreateRepository", globalcontext);
connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository())); connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
gitContainer->addAction(createRepositoryCommand); gitContainer->addAction(createRepositoryCommand);
// -------------- // --------------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Info"), this)); gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Info"), this));
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Launch gitk"), Core::Id("Git.LaunchGitK"), tr("Launch gitk"), Core::Id("Git.LaunchGitK"),
globalcontext, true, &GitClient::launchGitK); globalcontext, true, &GitClient::launchGitK);
m_repositoryBrowserAction m_repositoryBrowserAction
= createRepositoryAction(actionManager, gitContainer, = createRepositoryAction(gitContainer,
tr("Launch repository browser"), Core::Id("Git.LaunchRepositoryBrowser"), tr("Launch repository browser"), Core::Id("Git.LaunchRepositoryBrowser"),
globalcontext, true, &GitClient::launchRepositoryBrowser).first; globalcontext, true, &GitClient::launchRepositoryBrowser).first;
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Branches..."), Core::Id("Git.BranchList"), tr("Branches..."), Core::Id("Git.BranchList"),
globalcontext, true, SLOT(branchList())); globalcontext, true, SLOT(branchList()));
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Remotes..."), Core::Id("Git.RemoteList"), tr("Remotes..."), Core::Id("Git.RemoteList"),
globalcontext, false, SLOT(remoteList())); globalcontext, false, SLOT(remoteList()));
m_showAction = new QAction(tr("Show..."), this); m_showAction = new QAction(tr("Show..."), this);
Core::Command *showCommitCommand = actionManager->registerAction(m_showAction, "Git.ShowCommit", globalcontext); Core::Command *showCommitCommand = Core::ActionManager::registerAction(m_showAction, "Git.ShowCommit", globalcontext);
connect(m_showAction, SIGNAL(triggered()), this, SLOT(showCommit())); connect(m_showAction, SIGNAL(triggered()), this, SLOT(showCommit()));
gitContainer->addAction(showCommitCommand); gitContainer->addAction(showCommitCommand);
// -------------- // --------------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.RarelyUsed"), this)); gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.RarelyUsed"), this));
Core::ActionContainer *patchMenu = actionManager->createMenu(Core::Id("Git.PatchMenu")); Core::ActionContainer *patchMenu = Core::ActionManager::createMenu(Core::Id("Git.PatchMenu"));
patchMenu->menu()->setTitle(tr("Patch")); patchMenu->menu()->setTitle(tr("Patch"));
gitContainer->addMenu(patchMenu); gitContainer->addMenu(patchMenu);
// Apply current file as patch is handled specially. // Apply current file as patch is handled specially.
parameterActionCommand = parameterActionCommand =
createParameterAction(actionManager, patchMenu, createParameterAction(patchMenu,
tr("Apply from Editor"), tr("Apply \"%1\""), tr("Apply from Editor"), tr("Apply \"%1\""),
Core::Id("Git.ApplyCurrentFilePatch"), Core::Id("Git.ApplyCurrentFilePatch"),
globalcontext, true); globalcontext, true);
@@ -467,84 +464,84 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this, connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this,
SLOT(applyCurrentFilePatch())); SLOT(applyCurrentFilePatch()));
createRepositoryAction(actionManager, patchMenu, createRepositoryAction(patchMenu,
tr("Apply from File..."), Core::Id("Git.ApplyPatch"), tr("Apply from File..."), Core::Id("Git.ApplyPatch"),
globalcontext, true, SLOT(promptApplyPatch())); globalcontext, true, SLOT(promptApplyPatch()));
Core::ActionContainer *stashMenu = actionManager->createMenu(Core::Id("Git.StashMenu")); Core::ActionContainer *stashMenu = Core::ActionManager::createMenu(Core::Id("Git.StashMenu"));
stashMenu->menu()->setTitle(tr("Stash")); stashMenu->menu()->setTitle(tr("Stash"));
gitContainer->addMenu(stashMenu); gitContainer->addMenu(stashMenu);
createRepositoryAction(actionManager, stashMenu, createRepositoryAction(stashMenu,
tr("Stashes..."), Core::Id("Git.StashList"), tr("Stashes..."), Core::Id("Git.StashList"),
globalcontext, false, SLOT(stashList())); globalcontext, false, SLOT(stashList()));
stashMenu->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.StashMenuPush"), this)); stashMenu->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.StashMenuPush"), this));
ActionCommandPair actionCommand = ActionCommandPair actionCommand =
createRepositoryAction(actionManager, stashMenu, createRepositoryAction(stashMenu,
tr("Stash"), Core::Id("Git.Stash"), tr("Stash"), Core::Id("Git.Stash"),
globalcontext, true, SLOT(stash())); globalcontext, true, SLOT(stash()));
actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository.")); actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository."));
actionCommand = createRepositoryAction(actionManager, stashMenu, actionCommand = createRepositoryAction(stashMenu,
tr("Take Snapshot..."), Core::Id("Git.StashSnapshot"), tr("Take Snapshot..."), Core::Id("Git.StashSnapshot"),
globalcontext, true, SLOT(stashSnapshot())); globalcontext, true, SLOT(stashSnapshot()));
actionCommand.first->setToolTip(tr("Saves the current state of your work.")); actionCommand.first->setToolTip(tr("Saves the current state of your work."));
stashMenu->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.StashMenuPop"), this)); stashMenu->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.StashMenuPop"), this));
actionCommand = createRepositoryAction(actionManager, stashMenu, actionCommand = createRepositoryAction(stashMenu,
tr("Stash Pop"), Core::Id("Git.StashPop"), tr("Stash Pop"), Core::Id("Git.StashPop"),
globalcontext, true, &GitClient::stashPop); globalcontext, true, &GitClient::stashPop);
actionCommand.first->setToolTip(tr("Restores changes saved to the stash list using \"Stash\".")); actionCommand.first->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
Core::ActionContainer *subversionMenu = actionManager->createMenu(Core::Id("Git.Subversion")); Core::ActionContainer *subversionMenu = Core::ActionManager::createMenu(Core::Id("Git.Subversion"));
subversionMenu->menu()->setTitle(tr("Subversion")); subversionMenu->menu()->setTitle(tr("Subversion"));
gitContainer->addMenu(subversionMenu); gitContainer->addMenu(subversionMenu);
createRepositoryAction(actionManager, subversionMenu, createRepositoryAction(subversionMenu,
tr("Log"), Core::Id("Git.Subversion.Log"), tr("Log"), Core::Id("Git.Subversion.Log"),
globalcontext, false, &GitClient::subversionLog); globalcontext, false, &GitClient::subversionLog);
createRepositoryAction(actionManager, subversionMenu, createRepositoryAction(subversionMenu,
tr("Fetch"), Core::Id("Git.Subversion.Fetch"), tr("Fetch"), Core::Id("Git.Subversion.Fetch"),
globalcontext, false, &GitClient::synchronousSubversionFetch); globalcontext, false, &GitClient::synchronousSubversionFetch);
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.PushPull"), this)); gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.PushPull"), this));
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Global"), this)); gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Global"), this));
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Fetch"), Core::Id("Git.Fetch"), tr("Fetch"), Core::Id("Git.Fetch"),
globalcontext, true, SLOT(fetch())); globalcontext, true, SLOT(fetch()));
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Pull"), Core::Id("Git.Pull"), tr("Pull"), Core::Id("Git.Pull"),
globalcontext, true, SLOT(pull())); globalcontext, true, SLOT(pull()));
actionCommand = createRepositoryAction(actionManager, gitContainer, actionCommand = createRepositoryAction(gitContainer,
tr("Push"), Core::Id("Git.Push"), tr("Push"), Core::Id("Git.Push"),
globalcontext, true, SLOT(push())); globalcontext, true, SLOT(push()));
actionCommand = createRepositoryAction(actionManager, gitContainer, actionCommand = createRepositoryAction(gitContainer,
tr("Commit..."), Core::Id("Git.Commit"), tr("Commit..."), Core::Id("Git.Commit"),
globalcontext, true, SLOT(startCommit())); globalcontext, true, SLOT(startCommit()));
actionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+C") : tr("Alt+G,Alt+C"))); actionCommand.second->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+G,Meta+C") : tr("Alt+G,Alt+C")));
createRepositoryAction(actionManager, gitContainer, createRepositoryAction(gitContainer,
tr("Amend Last Commit..."), Core::Id("Git.AmendCommit"), tr("Amend Last Commit..."), Core::Id("Git.AmendCommit"),
globalcontext, true, SLOT(startAmendCommit())); globalcontext, true, SLOT(startAmendCommit()));
// Subversion in a submenu. // Subversion in a submenu.
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Subversion"), this)); gitContainer->addAction(createSeparator(globalcontext, Core::Id("Git.Sep.Subversion"), this));
if (0) { if (0) {
const QList<QAction*> snapShotActions = createSnapShotTestActions(); const QList<QAction*> snapShotActions = createSnapShotTestActions();
const int count = snapShotActions.size(); const int count = snapShotActions.size();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
Core::Command *tCommand Core::Command *tCommand
= actionManager->registerAction(snapShotActions.at(i), = Core::ActionManager::registerAction(snapShotActions.at(i),
Core::Id(QLatin1String("Git.Snapshot.") + QString::number(i)), Core::Id(QLatin1String("Git.Snapshot.") + QString::number(i)),
globalcontext); globalcontext);
gitContainer->addAction(tCommand); gitContainer->addAction(tCommand);
@@ -554,18 +551,18 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
// Submit editor // Submit editor
Core::Context submitContext(Constants::C_GITSUBMITEDITOR); Core::Context submitContext(Constants::C_GITSUBMITEDITOR);
m_submitCurrentAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); m_submitCurrentAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
Core::Command *command = actionManager->registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext); Core::Command *command = Core::ActionManager::registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_submitCurrentAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); connect(m_submitCurrentAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
m_diffSelectedFilesAction = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); m_diffSelectedFilesAction = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
command = actionManager->registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext); command = Core::ActionManager::registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext);
m_undoAction = new QAction(tr("&Undo"), this); m_undoAction = new QAction(tr("&Undo"), this);
command = actionManager->registerAction(m_undoAction, Core::Constants::UNDO, submitContext); command = Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, submitContext);
m_redoAction = new QAction(tr("&Redo"), this); m_redoAction = new QAction(tr("&Redo"), this);
command = actionManager->registerAction(m_redoAction, Core::Constants::REDO, submitContext); command = Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, submitContext);
Gerrit::Internal::GerritPlugin *gp = new Gerrit::Internal::GerritPlugin(this); Gerrit::Internal::GerritPlugin *gp = new Gerrit::Internal::GerritPlugin(this);

View File

@@ -141,36 +141,36 @@ protected:
private: private:
inline ParameterActionCommandPair inline ParameterActionCommandPair
createParameterAction(Core::ActionManager *am, Core::ActionContainer *ac, createParameterAction(Core::ActionContainer *ac,
const QString &defaultText, const QString &parameterText, const QString &defaultText, const QString &parameterText,
const Core::Id &id, const Core::Context &context, bool addToLocator); const Core::Id &id, const Core::Context &context, bool addToLocator);
inline ParameterActionCommandPair inline ParameterActionCommandPair
createFileAction(Core::ActionManager *am, Core::ActionContainer *ac, createFileAction(Core::ActionContainer *ac,
const QString &defaultText, const QString &parameterText, const QString &defaultText, const QString &parameterText,
const Core::Id &id, const Core::Context &context, bool addToLocator, const Core::Id &id, const Core::Context &context, bool addToLocator,
const char *pluginSlot); const char *pluginSlot);
inline ParameterActionCommandPair inline ParameterActionCommandPair
createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, createProjectAction(Core::ActionContainer *ac,
const QString &defaultText, const QString &parameterText, const QString &defaultText, const QString &parameterText,
const Core::Id &id, const Core::Context &context, bool addToLocator); const Core::Id &id, const Core::Context &context, bool addToLocator);
inline ParameterActionCommandPair inline ParameterActionCommandPair
createProjectAction(Core::ActionManager *am, Core::ActionContainer *ac, createProjectAction(Core::ActionContainer *ac,
const QString &defaultText, const QString &parameterText, const QString &defaultText, const QString &parameterText,
const Core::Id &id, const Core::Context &context, bool addToLocator, const Core::Id &id, const Core::Context &context, bool addToLocator,
const char *pluginSlot); const char *pluginSlot);
inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
const QString &text, const Core::Id &id, const QString &text, const Core::Id &id,
const Core::Context &context, bool addToLocator); const Core::Context &context, bool addToLocator);
inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
const QString &text, const Core::Id &id, const QString &text, const Core::Id &id,
const Core::Context &context, const Core::Context &context,
bool addToLocator, const char *pluginSlot); bool addToLocator, const char *pluginSlot);
inline ActionCommandPair createRepositoryAction(Core::ActionManager *am, Core::ActionContainer *ac, inline ActionCommandPair createRepositoryAction(Core::ActionContainer *ac,
const QString &text, const Core::Id &id, const QString &text, const Core::Id &id,
const Core::Context &context, const Core::Context &context,
bool addToLocator, GitClientMemberFunc); bool addToLocator, GitClientMemberFunc);

View File

@@ -107,14 +107,13 @@ GLSLEditorPlugin::~GLSLEditorPlugin()
/*! Copied from cppplugin.cpp */ /*! Copied from cppplugin.cpp */
static inline static inline
Core::Command *createSeparator(Core::ActionManager *am, Core::Command *createSeparator(QObject *parent,
QObject *parent,
Core::Context &context, Core::Context &context,
const char *id) const char *id)
{ {
QAction *separator = new QAction(parent); QAction *separator = new QAction(parent);
separator->setSeparator(true); separator->setSeparator(true);
return am->registerAction(separator, Core::Id(id), context); return Core::ActionManager::registerAction(separator, Core::Id(id), context);
} }
bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
@@ -140,27 +139,26 @@ bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *er
| TextEditor::TextEditorActionHandler::UnCollapseAll); | TextEditor::TextEditorActionHandler::UnCollapseAll);
m_actionHandler->initializeActions(); m_actionHandler->initializeActions();
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(GLSLEditor::Constants::M_CONTEXT);
Core::ActionContainer *contextMenu = am->createMenu(GLSLEditor::Constants::M_CONTEXT); Core::ActionContainer *glslToolsMenu = Core::ActionManager::createMenu(Core::Id(Constants::M_TOOLS_GLSL));
Core::ActionContainer *glslToolsMenu = am->createMenu(Core::Id(Constants::M_TOOLS_GLSL));
glslToolsMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide); glslToolsMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide);
QMenu *menu = glslToolsMenu->menu(); QMenu *menu = glslToolsMenu->menu();
//: GLSL sub-menu in the Tools menu //: GLSL sub-menu in the Tools menu
menu->setTitle(tr("GLSL")); menu->setTitle(tr("GLSL"));
am->actionContainer(Core::Constants::M_TOOLS)->addMenu(glslToolsMenu); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS)->addMenu(glslToolsMenu);
Core::Command *cmd = 0; Core::Command *cmd = 0;
// Insert marker for "Refactoring" menu: // Insert marker for "Refactoring" menu:
Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Context globalContext(Core::Constants::C_GLOBAL);
Core::Command *sep = createSeparator(am, this, globalContext, Core::Command *sep = createSeparator(this, globalContext,
Constants::SEPARATOR1); Constants::SEPARATOR1);
sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT);
contextMenu->addAction(sep); contextMenu->addAction(sep);
contextMenu->addAction(createSeparator(am, this, globalContext, contextMenu->addAction(createSeparator(this, globalContext,
Constants::SEPARATOR2)); Constants::SEPARATOR2));
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
errorMessage->clear(); errorMessage->clear();
@@ -244,11 +242,11 @@ void GLSLEditorPlugin::initializeEditor(GLSLEditor::GLSLTextEditorWidget *editor
TextEditor::TextEditorSettings::instance()->initializeEditor(editor); TextEditor::TextEditorSettings::instance()->initializeEditor(editor);
} }
Core::Command *GLSLEditorPlugin::addToolAction(QAction *a, Core::ActionManager *am, Core::Command *GLSLEditorPlugin::addToolAction(QAction *a,
Core::Context &context, const Core::Id &id, Core::Context &context, const Core::Id &id,
Core::ActionContainer *c1, const QString &keySequence) Core::ActionContainer *c1, const QString &keySequence)
{ {
Core::Command *command = am->registerAction(a, id, context); Core::Command *command = Core::ActionManager::registerAction(a, id, context);
if (!keySequence.isEmpty()) if (!keySequence.isEmpty())
command->setDefaultKeySequence(QKeySequence(keySequence)); command->setDefaultKeySequence(QKeySequence(keySequence));
c1->addAction(command); c1->addAction(command);

View File

@@ -109,7 +109,7 @@ private:
void parseGlslFile(const QString &fileName, InitFile *initFile) const; void parseGlslFile(const QString &fileName, InitFile *initFile) const;
// FIXME: Unused? // FIXME: Unused?
Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const Core::Id &name, Core::Command *addToolAction(QAction *a, Core::Context &context, const Core::Id &name,
Core::ActionContainer *c1, const QString &keySequence); Core::ActionContainer *c1, const QString &keySequence);
static GLSLEditorPlugin *m_instance; static GLSLEditorPlugin *m_instance;

View File

@@ -105,14 +105,13 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe
connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld())); connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));
// Register the action with the action manager // Register the action with the action manager
Core::ActionManager *actionManager = Core::ICore::actionManager();
Core::Command *command = Core::Command *command =
actionManager->registerAction( Core::ActionManager::registerAction(
helloWorldAction, "HelloWorld.HelloWorldAction", context); helloWorldAction, "HelloWorld.HelloWorldAction", context);
// Create our own menu to place in the Tools menu // Create our own menu to place in the Tools menu
Core::ActionContainer *helloWorldMenu = Core::ActionContainer *helloWorldMenu =
actionManager->createMenu("HelloWorld.HelloWorldMenu"); Core::ActionManager::createMenu("HelloWorld.HelloWorldMenu");
QMenu *menu = helloWorldMenu->menu(); QMenu *menu = helloWorldMenu->menu();
menu->setTitle(tr("&Hello World")); menu->setTitle(tr("&Hello World"));
menu->setEnabled(true); menu->setEnabled(true);
@@ -122,7 +121,7 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe
// Request the Tools menu and add the Hello World menu to it // Request the Tools menu and add the Hello World menu to it
Core::ActionContainer *toolsMenu = Core::ActionContainer *toolsMenu =
actionManager->actionContainer(Core::Constants::M_TOOLS); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
toolsMenu->addMenu(helloWorldMenu); toolsMenu->addMenu(helloWorldMenu);
// Add a mode with a push button based on BaseMode. Like the BaseView, // Add a mode with a push button based on BaseMode. Like the BaseView,

View File

@@ -207,13 +207,12 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
// Add Home, Previous and Next actions (used in the toolbar) // Add Home, Previous and Next actions (used in the toolbar)
QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")), QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")),
tr("Home"), this); tr("Home"), this);
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager::registerAction(action, "Help.Home", globalcontext);
am->registerAction(action, "Help.Home", globalcontext);
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(home())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(home()));
action = new QAction(QIcon(QLatin1String(IMAGEPATH "previous.png")), action = new QAction(QIcon(QLatin1String(IMAGEPATH "previous.png")),
tr("Previous Page"), this); tr("Previous Page"), this);
Core::Command *cmd = am->registerAction(action, Core::Id("Help.Previous"), modecontext); Core::Command *cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Previous"), modecontext);
cmd->setDefaultKeySequence(QKeySequence::Back); cmd->setDefaultKeySequence(QKeySequence::Back);
action->setEnabled(m_centralWidget->isBackwardAvailable()); action->setEnabled(m_centralWidget->isBackwardAvailable());
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(backward())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(backward()));
@@ -222,7 +221,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
action = new QAction(QIcon(QLatin1String(IMAGEPATH "next.png")), tr("Next Page"), action = new QAction(QIcon(QLatin1String(IMAGEPATH "next.png")), tr("Next Page"),
this); this);
cmd = am->registerAction(action, Core::Id("Help.Next"), modecontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Next"), modecontext);
cmd->setDefaultKeySequence(QKeySequence::Forward); cmd->setDefaultKeySequence(QKeySequence::Forward);
action->setEnabled(m_centralWidget->isForwardAvailable()); action->setEnabled(m_centralWidget->isForwardAvailable());
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(forward())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(forward()));
@@ -231,7 +230,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
action = new QAction(QIcon(QLatin1String(IMAGEPATH "bookmark.png")), action = new QAction(QIcon(QLatin1String(IMAGEPATH "bookmark.png")),
tr("Add Bookmark"), this); tr("Add Bookmark"), this);
cmd = am->registerAction(action, Core::Id("Help.AddBookmark"), cmd = Core::ActionManager::registerAction(action, Core::Id("Help.AddBookmark"),
modecontext); modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_M)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_M));
connect(action, SIGNAL(triggered()), this, SLOT(addBookmark())); connect(action, SIGNAL(triggered()), this, SLOT(addBookmark()));
@@ -239,81 +238,81 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
// Add Contents, Index, and Context menu items and a separator to the Help menu // Add Contents, Index, and Context menu items and a separator to the Help menu
action = new QAction(QIcon::fromTheme(QLatin1String("help-contents")), action = new QAction(QIcon::fromTheme(QLatin1String("help-contents")),
tr(SB_CONTENTS), this); tr(SB_CONTENTS), this);
cmd = am->registerAction(action, Core::Id("Help.Contents"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Contents"), globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
connect(action, SIGNAL(triggered()), this, SLOT(activateContents())); connect(action, SIGNAL(triggered()), this, SLOT(activateContents()));
action = new QAction(tr(SB_INDEX), this); action = new QAction(tr(SB_INDEX), this);
cmd = am->registerAction(action, Core::Id("Help.Index"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Index"), globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
connect(action, SIGNAL(triggered()), this, SLOT(activateIndex())); connect(action, SIGNAL(triggered()), this, SLOT(activateIndex()));
action = new QAction(tr("Context Help"), this); action = new QAction(tr("Context Help"), this);
cmd = am->registerAction(action, Core::Id("Help.Context"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Context"), globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1)); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1));
connect(action, SIGNAL(triggered()), this, SLOT(activateContext())); connect(action, SIGNAL(triggered()), this, SLOT(activateContext()));
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
action = new QAction(this); action = new QAction(this);
action->setSeparator(true); action->setSeparator(true);
cmd = am->registerAction(action, Core::Id("Help.Separator"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator"), globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
#endif #endif
action = new QAction(tr("Technical Support"), this); action = new QAction(tr("Technical Support"), this);
cmd = am->registerAction(action, Core::Id("Help.TechSupport"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.TechSupport"), globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
connect(action, SIGNAL(triggered()), this, SLOT(slotOpenSupportPage())); connect(action, SIGNAL(triggered()), this, SLOT(slotOpenSupportPage()));
action = new QAction(tr("Report Bug..."), this); action = new QAction(tr("Report Bug..."), this);
cmd = am->registerAction(action, Core::Id("Help.ReportBug"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.ReportBug"), globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
connect(action, SIGNAL(triggered()), this, SLOT(slotReportBug())); connect(action, SIGNAL(triggered()), this, SLOT(slotReportBug()));
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
action = new QAction(this); action = new QAction(this);
action->setSeparator(true); action->setSeparator(true);
cmd = am->registerAction(action, Core::Id("Help.Separator2"), globalcontext); cmd = Core::ActionManager::registerAction(action, Core::Id("Help.Separator2"), globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); Core::ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
#endif #endif
action = new QAction(this); action = new QAction(this);
am->registerAction(action, Core::Constants::PRINT, modecontext); Core::ActionManager::registerAction(action, Core::Constants::PRINT, modecontext);
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(print())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(print()));
action = new QAction(this); action = new QAction(this);
cmd = am->registerAction(action, Core::Constants::COPY, modecontext); cmd = Core::ActionManager::registerAction(action, Core::Constants::COPY, modecontext);
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(copy())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(copy()));
action->setText(cmd->action()->text()); action->setText(cmd->action()->text());
action->setIcon(cmd->action()->icon()); action->setIcon(cmd->action()->icon());
if (Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED)) { if (Core::ActionContainer *advancedMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED)) {
// reuse TextEditor constants to avoid a second pair of menu actions // reuse TextEditor constants to avoid a second pair of menu actions
action = new QAction(tr("Increase Font Size"), this); action = new QAction(tr("Increase Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE, cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE,
modecontext); modecontext);
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomIn())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomIn()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
action = new QAction(tr("Decrease Font Size"), this); action = new QAction(tr("Decrease Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE, cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE,
modecontext); modecontext);
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomOut())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(zoomOut()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
action = new QAction(tr("Reset Font Size"), this); action = new QAction(tr("Reset Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::RESET_FONT_SIZE, cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::RESET_FONT_SIZE,
modecontext); modecontext);
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom())); connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
} }
if (Core::ActionContainer *windowMenu = am->actionContainer(Core::Constants::M_WINDOW)) { if (Core::ActionContainer *windowMenu = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW)) {
// reuse EditorManager constants to avoid a second pair of menu actions // reuse EditorManager constants to avoid a second pair of menu actions
action = new QAction(QApplication::translate("EditorManager", action = new QAction(QApplication::translate("EditorManager",
"Next Open Document in History"), this); "Next Open Document in History"), this);
Core::Command *ctrlTab = am->registerAction(action, Core::Constants::GOTOPREVINHISTORY, Core::Command *ctrlTab = Core::ActionManager::registerAction(action, Core::Constants::GOTOPREVINHISTORY,
modecontext); // Goto Previous In History Action modecontext); // Goto Previous In History Action
windowMenu->addAction(ctrlTab, Core::Constants::G_WINDOW_NAVIGATE); windowMenu->addAction(ctrlTab, Core::Constants::G_WINDOW_NAVIGATE);
connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(), connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(),
@@ -321,7 +320,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
action = new QAction(QApplication::translate("EditorManager", action = new QAction(QApplication::translate("EditorManager",
"Previous Open Document in History"), this); "Previous Open Document in History"), this);
Core::Command *ctrlShiftTab = am->registerAction(action, Core::Constants::GOTONEXTINHISTORY, Core::Command *ctrlShiftTab = Core::ActionManager::registerAction(action, Core::Constants::GOTONEXTINHISTORY,
modecontext); // Goto Next In History Action modecontext); // Goto Next In History Action
windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE); windowMenu->addAction(ctrlShiftTab, Core::Constants::G_WINDOW_NAVIGATE);
connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(), connect(action, SIGNAL(triggered()), &OpenPagesManager::instance(),
@@ -429,7 +428,6 @@ ExtensionSystem::IPlugin::ShutdownFlag HelpPlugin::aboutToShutdown()
void HelpPlugin::setupUi() void HelpPlugin::setupUi()
{ {
// side bar widgets and shortcuts // side bar widgets and shortcuts
Core::ActionManager *am = Core::ICore::actionManager();
Core::Context modecontext(Constants::C_MODE_HELP); Core::Context modecontext(Constants::C_MODE_HELP);
IndexWindow *indexWindow = new IndexWindow(); IndexWindow *indexWindow = new IndexWindow();
@@ -444,7 +442,7 @@ void HelpPlugin::setupUi()
QMap<QString, Core::Command*> shortcutMap; QMap<QString, Core::Command*> shortcutMap;
QShortcut *shortcut = new QShortcut(m_splitter); QShortcut *shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Index in Help mode")); shortcut->setWhatsThis(tr("Activate Index in Help mode"));
Core::Command* cmd = am->registerShortcut(shortcut, Core::Command* cmd = Core::ActionManager::registerShortcut(shortcut,
Core::Id("Help.IndexShortcut"), modecontext); Core::Id("Help.IndexShortcut"), modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateIndex())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateIndex()));
@@ -458,7 +456,7 @@ void HelpPlugin::setupUi()
shortcut = new QShortcut(m_splitter); shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Contents in Help mode")); shortcut->setWhatsThis(tr("Activate Contents in Help mode"));
cmd = am->registerShortcut(shortcut, Core::Id("Help.ContentsShortcut"), cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.ContentsShortcut"),
modecontext); modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateContents())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateContents()));
@@ -472,7 +470,7 @@ void HelpPlugin::setupUi()
shortcut = new QShortcut(m_splitter); shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Search in Help mode")); shortcut->setWhatsThis(tr("Activate Search in Help mode"));
cmd = am->registerShortcut(shortcut, Core::Id("Help.SearchShortcut"), cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.SearchShortcut"),
modecontext); modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Slash)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Slash));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateSearch())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateSearch()));
@@ -489,7 +487,7 @@ void HelpPlugin::setupUi()
shortcut = new QShortcut(m_splitter); shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Bookmarks in Help mode")); shortcut->setWhatsThis(tr("Activate Bookmarks in Help mode"));
cmd = am->registerShortcut(shortcut, Core::Id("Help.BookmarkShortcut"), cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.BookmarkShortcut"),
modecontext); modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateBookmarks())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateBookmarks()));
@@ -501,7 +499,7 @@ void HelpPlugin::setupUi()
shortcut = new QShortcut(m_splitter); shortcut = new QShortcut(m_splitter);
shortcut->setWhatsThis(tr("Activate Open Pages in Help mode")); shortcut->setWhatsThis(tr("Activate Open Pages in Help mode"));
cmd = am->registerShortcut(shortcut, Core::Id("Help.PagesShortcut"), cmd = Core::ActionManager::registerShortcut(shortcut, Core::Id("Help.PagesShortcut"),
modecontext); modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateOpenPages())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateOpenPages()));
@@ -527,7 +525,7 @@ void HelpPlugin::setupUi()
tr("Show Sidebar"), this); tr("Show Sidebar"), this);
m_toggleSideBarAction->setCheckable(true); m_toggleSideBarAction->setCheckable(true);
connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(showHideSidebar())); connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(showHideSidebar()));
cmd = am->registerAction(m_toggleSideBarAction, Core::Constants::TOGGLE_SIDEBAR, modecontext); cmd = Core::ActionManager::registerAction(m_toggleSideBarAction, Core::Constants::TOGGLE_SIDEBAR, modecontext);
} }
void HelpPlugin::resetFilter() void HelpPlugin::resetFilter()
@@ -621,7 +619,7 @@ void HelpPlugin::createRightPaneContextViewer()
Core::ICore::addContextObject(icontext); Core::ICore::addContextObject(icontext);
QAction *copy = new QAction(this); QAction *copy = new QAction(this);
Core::Command *cmd = Core::ICore::actionManager()->registerAction(copy, Core::Command *cmd = Core::ActionManager::registerAction(copy,
Core::Constants::COPY, context); Core::Constants::COPY, context);
copy->setText(cmd->action()->text()); copy->setText(cmd->action()->text());
copy->setIcon(cmd->action()->icon()); copy->setIcon(cmd->action()->icon());
@@ -637,23 +635,22 @@ void HelpPlugin::createRightPaneContextViewer()
connect(m_helpViewerForSideBar, SIGNAL(backwardAvailable(bool)), back, connect(m_helpViewerForSideBar, SIGNAL(backwardAvailable(bool)), back,
SLOT(setEnabled(bool))); SLOT(setEnabled(bool)));
Core::ActionManager *am = Core::ICore::actionManager(); if (Core::ActionContainer *advancedMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED)) {
if (Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED)) {
// reuse TextEditor constants to avoid a second pair of menu actions // reuse TextEditor constants to avoid a second pair of menu actions
QAction *action = new QAction(tr("Increase Font Size"), this); QAction *action = new QAction(tr("Increase Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE, cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::INCREASE_FONT_SIZE,
context); context);
connect(action, SIGNAL(triggered()), this, SLOT(scaleRightPaneUp())); connect(action, SIGNAL(triggered()), this, SLOT(scaleRightPaneUp()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
action = new QAction(tr("Decrease Font Size"), this); action = new QAction(tr("Decrease Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE, cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::DECREASE_FONT_SIZE,
context); context);
connect(action, SIGNAL(triggered()), this, SLOT(scaleRightPaneDown())); connect(action, SIGNAL(triggered()), this, SLOT(scaleRightPaneDown()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
action = new QAction(tr("Reset Font Size"), this); action = new QAction(tr("Reset Font Size"), this);
cmd = am->registerAction(action, TextEditor::Constants::RESET_FONT_SIZE, cmd = Core::ActionManager::registerAction(action, TextEditor::Constants::RESET_FONT_SIZE,
context); context);
connect(action, SIGNAL(triggered()), this, SLOT(resetRightPaneScale())); connect(action, SIGNAL(triggered()), this, SLOT(resetRightPaneScale()));
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
@@ -1065,11 +1062,10 @@ Utils::StyledBar *HelpPlugin::createIconToolBar(bool external)
tr("Add Bookmark"), toolBar); tr("Add Bookmark"), toolBar);
connect(bookmark, SIGNAL(triggered()), this, SLOT(addBookmark())); connect(bookmark, SIGNAL(triggered()), this, SLOT(addBookmark()));
} else { } else {
Core::ActionManager *am = Core::ICore::actionManager(); home = Core::ActionManager::command(Core::Id("Help.Home"))->action();
home = am->command(Core::Id("Help.Home"))->action(); back = Core::ActionManager::command(Core::Id("Help.Previous"))->action();
back = am->command(Core::Id("Help.Previous"))->action(); next = Core::ActionManager::command(Core::Id("Help.Next"))->action();
next = am->command(Core::Id("Help.Next"))->action(); bookmark = Core::ActionManager::command(Core::Id("Help.AddBookmark"))->action();
bookmark = am->command(Core::Id("Help.AddBookmark"))->action();
} }
setupNavigationMenus(back, next, toolBar); setupNavigationMenus(back, next, toolBar);

View File

@@ -108,11 +108,9 @@ void ImageViewerActionHandler::registerNewAction(int actionId, const Core::Id &i
const QString &title, const QKeySequence &key) const QString &title, const QKeySequence &key)
{ {
Core::Context context(Constants::IMAGEVIEWER_ID); Core::Context context(Constants::IMAGEVIEWER_ID);
Core::ActionManager *actionManager = Core::ICore::actionManager();
QAction *action = new QAction(title, this); QAction *action = new QAction(title, this);
Core::Command *command = actionManager->registerAction(action, id, context); Core::Command *command = Core::ActionManager::registerAction(action, id, context);
if (command) command->setDefaultKeySequence(key);
command->setDefaultKeySequence(key);
connect(action, SIGNAL(triggered()), m_signalMapper, SLOT(map())); connect(action, SIGNAL(triggered()), m_signalMapper, SLOT(map()));
m_signalMapper->setMapping(action, actionId); m_signalMapper->setMapping(action, actionId);
} }

View File

@@ -117,14 +117,14 @@ bool LocatorPlugin::initialize(const QStringList &, QString *)
addAutoReleasedObject(view); addAutoReleasedObject(view);
QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this); QAction *action = new QAction(m_locatorWidget->windowIcon(), m_locatorWidget->windowTitle(), this);
Core::Command *cmd = Core::ICore::actionManager() Core::Command *cmd = Core::ActionManager::registerAction(action, "QtCreator.Locate",
->registerAction(action, "QtCreator.Locate", Core::Context(Core::Constants::C_GLOBAL)); Core::Context(Core::Constants::C_GLOBAL));
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+K")));
connect(action, SIGNAL(triggered()), this, SLOT(openLocator())); connect(action, SIGNAL(triggered()), this, SLOT(openLocator()));
connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText())); connect(cmd, SIGNAL(keySequenceChanged()), this, SLOT(updatePlaceholderText()));
updatePlaceholderText(cmd); updatePlaceholderText(cmd);
Core::ActionContainer *mtools = Core::ICore::actionManager()->actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
mtools->addAction(cmd); mtools->addAction(cmd);
addObject(new LocatorManager(m_locatorWidget)); addObject(new LocatorManager(m_locatorWidget));

View File

@@ -316,7 +316,6 @@ void LocatorWidget::updateFilterList()
m_filterMenu->clear(); m_filterMenu->clear();
// update actions and menu // update actions and menu
Core::ActionManager *am = Core::ICore::actionManager();
QMap<QString, QAction *> actionCopy = m_filterActionMap; QMap<QString, QAction *> actionCopy = m_filterActionMap;
m_filterActionMap.clear(); m_filterActionMap.clear();
// register new actions, update existent // register new actions, update existent
@@ -329,7 +328,7 @@ void LocatorWidget::updateFilterList()
if (!actionCopy.contains(filter->id())) { if (!actionCopy.contains(filter->id())) {
// register new action // register new action
action = new QAction(filter->displayName(), this); action = new QAction(filter->displayName(), this);
cmd = am->registerAction(action, locatorId, cmd = Core::ActionManager::registerAction(action, locatorId,
Core::Context(Core::Constants::C_GLOBAL)); Core::Context(Core::Constants::C_GLOBAL));
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
connect(action, SIGNAL(triggered()), this, SLOT(filterSelected())); connect(action, SIGNAL(triggered()), this, SLOT(filterSelected()));
@@ -337,7 +336,7 @@ void LocatorWidget::updateFilterList()
} else { } else {
action = actionCopy.take(filter->id()); action = actionCopy.take(filter->id());
action->setText(filter->displayName()); action->setText(filter->displayName());
cmd = am->command(locatorId); cmd = Core::ActionManager::command(locatorId);
} }
m_filterActionMap.insert(filter->id(), action); m_filterActionMap.insert(filter->id(), action);
m_filterMenu->addAction(cmd->action()); m_filterMenu->addAction(cmd->action());
@@ -345,7 +344,7 @@ void LocatorWidget::updateFilterList()
// unregister actions that are deleted now // unregister actions that are deleted now
foreach (const QString &id, actionCopy.keys()) { foreach (const QString &id, actionCopy.keys()) {
am->unregisterAction(actionCopy.value(id), Core::Id(QLatin1String("Locator.") + id)); Core::ActionManager::unregisterAction(actionCopy.value(id), Core::Id(QLatin1String("Locator.") + id));
} }
qDeleteAll(actionCopy); qDeleteAll(actionCopy);

View File

@@ -64,12 +64,11 @@ ActionMacroHandler::ActionMacroHandler():
connect(m_mapper, SIGNAL(mapped(QString)), connect(m_mapper, SIGNAL(mapped(QString)),
this, SLOT(addActionEvent(QString))); this, SLOT(addActionEvent(QString)));
const Core::ActionManager *am = Core::ICore::actionManager(); connect(Core::ActionManager::instance(), SIGNAL(commandAdded(QString)),
connect(am, SIGNAL(commandAdded(QString)),
this, SLOT(addCommand(QString))); this, SLOT(addCommand(QString)));
// Register all existing scriptable actions // Register all existing scriptable actions
QList<Core::Command *> commands = am->commands(); QList<Core::Command *> commands = Core::ActionManager::commands();
foreach (Core::Command *command, commands) { foreach (Core::Command *command, commands) {
if (command->isScriptable()) { if (command->isScriptable()) {
QString id = command->id().toString(); QString id = command->id().toString();
@@ -85,9 +84,7 @@ bool ActionMacroHandler::canExecuteEvent(const MacroEvent &macroEvent)
bool ActionMacroHandler::executeEvent(const MacroEvent &macroEvent) bool ActionMacroHandler::executeEvent(const MacroEvent &macroEvent)
{ {
const Core::ActionManager *am = Core::ICore::actionManager(); QAction *action = Core::ActionManager::command(Core::Id(macroEvent.value(ACTIONNAME).toString()))->action();
QAction *action = am->command(Core::Id(macroEvent.value(ACTIONNAME).toString()))->action();
if (!action) if (!action)
return false; return false;
@@ -100,8 +97,7 @@ void ActionMacroHandler::addActionEvent(const QString &id)
if (!isRecording()) if (!isRecording())
return; return;
const Core::ActionManager *am = Core::ICore::actionManager(); const Core::Command *cmd = Core::ActionManager::command(Core::Id(id));
const Core::Command *cmd = am->command(Core::Id(id));
if (cmd->isScriptable(cmd->context())) { if (cmd->isScriptable(cmd->context())) {
MacroEvent e; MacroEvent e;
e.setId(EVENTNAME); e.setId(EVENTNAME);
@@ -114,14 +110,13 @@ void ActionMacroHandler::registerCommand(const QString &id)
{ {
if (!m_commandIds.contains(id)) { if (!m_commandIds.contains(id)) {
m_commandIds.insert(id); m_commandIds.insert(id);
const Core::ActionManager *am = Core::ICore::actionManager(); QAction* action = Core::ActionManager::command(Core::Id(id))->action();
QAction* action = am->command(Core::Id(id))->action();
if (action) { if (action) {
connect(action, SIGNAL(triggered()), m_mapper, SLOT(map())); connect(action, SIGNAL(triggered()), m_mapper, SLOT(map()));
m_mapper->setMapping(action, id); m_mapper->setMapping(action, id);
return; return;
} }
QShortcut* shortcut = am->command(Core::Id(id))->shortcut(); QShortcut* shortcut = Core::ActionManager::command(Core::Id(id))->shortcut();
if (shortcut) { if (shortcut) {
connect(shortcut, SIGNAL(activated()), m_mapper, SLOT(map())); connect(shortcut, SIGNAL(activated()), m_mapper, SLOT(map()));
m_mapper->setMapping(shortcut, id); m_mapper->setMapping(shortcut, id);
@@ -131,7 +126,6 @@ void ActionMacroHandler::registerCommand(const QString &id)
void ActionMacroHandler::addCommand(const QString &id) void ActionMacroHandler::addCommand(const QString &id)
{ {
const Core::ActionManager *am = Core::ICore::actionManager(); if (Core::ActionManager::command(Core::Id(id))->isScriptable())
if (am->command(Core::Id(id))->isScriptable())
registerCommand(id); registerCommand(id);
} }

View File

@@ -163,11 +163,10 @@ void MacroManager::MacroManagerPrivate::addMacro(Macro *macro)
{ {
// Add sortcut // Add sortcut
Core::Context context(TextEditor::Constants::C_TEXTEDITOR); Core::Context context(TextEditor::Constants::C_TEXTEDITOR);
Core::ActionManager *am = Core::ICore::actionManager();
QShortcut *shortcut = new QShortcut(Core::ICore::mainWindow()); QShortcut *shortcut = new QShortcut(Core::ICore::mainWindow());
shortcut->setWhatsThis(macro->description()); shortcut->setWhatsThis(macro->description());
const Core::Id macroId(QLatin1String(Constants::PREFIX_MACRO) + macro->displayName()); const Core::Id macroId(QLatin1String(Constants::PREFIX_MACRO) + macro->displayName());
am->registerShortcut(shortcut, macroId, context); Core::ActionManager::registerShortcut(shortcut, macroId, context);
connect(shortcut, SIGNAL(activated()), mapper, SLOT(map())); connect(shortcut, SIGNAL(activated()), mapper, SLOT(map()));
mapper->setMapping(shortcut, macro->displayName()); mapper->setMapping(shortcut, macro->displayName());
@@ -180,8 +179,7 @@ void MacroManager::MacroManagerPrivate::removeMacro(const QString &name)
if (!macros.contains(name)) if (!macros.contains(name))
return; return;
// Remove shortcut // Remove shortcut
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager::unregisterShortcut(Core::Id(Constants::PREFIX_MACRO+name));
am->unregisterShortcut(Core::Id(Constants::PREFIX_MACRO+name));
// Remove macro from the map // Remove macro from the map
Macro *macro = macros.take(name); Macro *macro = macros.take(name);
@@ -196,9 +194,7 @@ void MacroManager::MacroManagerPrivate::changeMacroDescription(Macro *macro, con
macro->save(macro->fileName(), Core::ICore::mainWindow()); macro->save(macro->fileName(), Core::ICore::mainWindow());
// Change shortcut what's this // Change shortcut what's this
Core::ActionManager *am = Core::ICore::actionManager(); Core::Command *command = Core::ActionManager::command(Core::Id(Constants::PREFIX_MACRO+macro->displayName()));
Core::Command *command = am->command(Core::Id(Constants::PREFIX_MACRO+macro->displayName()));
if (command && command->shortcut()) if (command && command->shortcut())
command->shortcut()->setWhatsThis(description); command->shortcut()->setWhatsThis(description);
} }
@@ -284,16 +280,15 @@ void MacroManager::startMacro()
delete d->currentMacro; delete d->currentMacro;
d->currentMacro = new Macro; d->currentMacro = new Macro;
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(false);
am->command(Constants::START_MACRO)->action()->setEnabled(false); Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(true);
am->command(Constants::END_MACRO)->action()->setEnabled(true); Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false);
am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false);
am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false);
foreach (IMacroHandler *handler, d->handlers) foreach (IMacroHandler *handler, d->handlers)
handler->startRecording(d->currentMacro); handler->startRecording(d->currentMacro);
QString endShortcut = am->command(Constants::END_MACRO)->defaultKeySequence().toString(); QString endShortcut = Core::ActionManager::command(Constants::END_MACRO)->defaultKeySequence().toString();
QString executeShortcut = am->command(Constants::EXECUTE_LAST_MACRO)->defaultKeySequence().toString(); QString executeShortcut = Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->defaultKeySequence().toString();
QString help = tr("Macro mode. Type \"%1\" to stop recording and \"%2\" to play it") QString help = tr("Macro mode. Type \"%1\" to stop recording and \"%2\" to play it")
.arg(endShortcut).arg(executeShortcut); .arg(endShortcut).arg(executeShortcut);
Core::EditorManager::instance()->showEditorStatusBar( Core::EditorManager::instance()->showEditorStatusBar(
@@ -306,11 +301,10 @@ void MacroManager::endMacro()
{ {
Core::EditorManager::instance()->hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER)); Core::EditorManager::instance()->hideEditorStatusBar(QLatin1String(Constants::M_STATUS_BUFFER));
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(true);
am->command(Constants::START_MACRO)->action()->setEnabled(true); Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false);
am->command(Constants::END_MACRO)->action()->setEnabled(false); Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true);
am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true); Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true);
am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true);
foreach (IMacroHandler *handler, d->handlers) foreach (IMacroHandler *handler, d->handlers)
handler->endRecordingMacro(d->currentMacro); handler->endRecordingMacro(d->currentMacro);
@@ -323,18 +317,17 @@ void MacroManager::executeLastMacro()
return; return;
// make sure the macro doesn't accidentally invoke a macro action // make sure the macro doesn't accidentally invoke a macro action
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(false);
am->command(Constants::START_MACRO)->action()->setEnabled(false); Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false);
am->command(Constants::END_MACRO)->action()->setEnabled(false); Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false);
am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(false); Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false);
am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(false);
d->executeMacro(d->currentMacro); d->executeMacro(d->currentMacro);
am->command(Constants::START_MACRO)->action()->setEnabled(true); Core::ActionManager::command(Constants::START_MACRO)->action()->setEnabled(true);
am->command(Constants::END_MACRO)->action()->setEnabled(false); Core::ActionManager::command(Constants::END_MACRO)->action()->setEnabled(false);
am->command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true); Core::ActionManager::command(Constants::EXECUTE_LAST_MACRO)->action()->setEnabled(true);
am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true); Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true);
} }
bool MacroManager::executeMacro(const QString &name) bool MacroManager::executeMacro(const QString &name)
@@ -352,8 +345,7 @@ bool MacroManager::executeMacro(const QString &name)
delete d->currentMacro; delete d->currentMacro;
d->currentMacro = macro; d->currentMacro = macro;
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager::command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true);
am->command(Constants::SAVE_LAST_MACRO)->action()->setEnabled(true);
return true; return true;
} }

View File

@@ -102,8 +102,6 @@ void MacroOptionsWidget::initialize()
void MacroOptionsWidget::createTable() void MacroOptionsWidget::createTable()
{ {
QDir dir(MacroManager::instance()->macrosDirectory()); QDir dir(MacroManager::instance()->macrosDirectory());
Core::ActionManager *am = Core::ICore::actionManager();
QMapIterator<QString, Macro *> it(MacroManager::instance()->macros()); QMapIterator<QString, Macro *> it(MacroManager::instance()->macros());
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
@@ -115,7 +113,8 @@ void MacroOptionsWidget::createTable()
macroItem->setData(0, NAME_ROLE, it.value()->displayName()); macroItem->setData(0, NAME_ROLE, it.value()->displayName());
macroItem->setData(0, WRITE_ROLE, it.value()->isWritable()); macroItem->setData(0, WRITE_ROLE, it.value()->isWritable());
Core::Command *command = am->command(Core::Id(Constants::PREFIX_MACRO+it.value()->displayName())); Core::Command *command =
Core::ActionManager::command(Core::Id(Constants::PREFIX_MACRO+it.value()->displayName()));
if (command && command->shortcut()) if (command && command->shortcut())
macroItem->setText(2, command->shortcut()->key().toString()); macroItem->setText(2, command->shortcut()->key().toString());
} }

View File

@@ -72,42 +72,40 @@ bool MacrosPlugin::initialize(const QStringList &arguments, QString *errorMessag
addAutoReleasedObject(new MacroOptionsPage); addAutoReleasedObject(new MacroOptionsPage);
addAutoReleasedObject(new MacroLocatorFilter); addAutoReleasedObject(new MacroLocatorFilter);
Core::ActionManager *am = Core::ICore::actionManager();
Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::Context textContext(TextEditor::Constants::C_TEXTEDITOR); Core::Context textContext(TextEditor::Constants::C_TEXTEDITOR);
m_macroManager = new MacroManager(this); m_macroManager = new MacroManager(this);
// Menus // Menus
Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mmacrotools = am->createMenu(Constants::M_TOOLS_MACRO); Core::ActionContainer *mmacrotools = Core::ActionManager::createMenu(Constants::M_TOOLS_MACRO);
QMenu *menu = mmacrotools->menu(); QMenu *menu = mmacrotools->menu();
menu->setTitle(tr("&Macros")); menu->setTitle(tr("&Macros"));
menu->setEnabled(true); menu->setEnabled(true);
mtools->addMenu(mmacrotools); mtools->addMenu(mmacrotools);
QAction *startMacro = new QAction(tr("Record Macro"), this); QAction *startMacro = new QAction(tr("Record Macro"), this);
Core::Command *command = am->registerAction(startMacro, Constants::START_MACRO, textContext); Core::Command *command = Core::ActionManager::registerAction(startMacro, Constants::START_MACRO, textContext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+(") : tr("Alt+("))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+(") : tr("Alt+(")));
mmacrotools->addAction(command); mmacrotools->addAction(command);
connect(startMacro, SIGNAL(triggered()), m_macroManager, SLOT(startMacro())); connect(startMacro, SIGNAL(triggered()), m_macroManager, SLOT(startMacro()));
QAction *endMacro = new QAction(tr("Stop Recording Macro"), this); QAction *endMacro = new QAction(tr("Stop Recording Macro"), this);
endMacro->setEnabled(false); endMacro->setEnabled(false);
command = am->registerAction(endMacro, Constants::END_MACRO, globalcontext); command = Core::ActionManager::registerAction(endMacro, Constants::END_MACRO, globalcontext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+)") : tr("Alt+)"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Ctrl+)") : tr("Alt+)")));
mmacrotools->addAction(command); mmacrotools->addAction(command);
connect(endMacro, SIGNAL(triggered()), m_macroManager, SLOT(endMacro())); connect(endMacro, SIGNAL(triggered()), m_macroManager, SLOT(endMacro()));
QAction *executeLastMacro = new QAction(tr("Play Last Macro"), this); QAction *executeLastMacro = new QAction(tr("Play Last Macro"), this);
command = am->registerAction(executeLastMacro, Constants::EXECUTE_LAST_MACRO, textContext); command = Core::ActionManager::registerAction(executeLastMacro, Constants::EXECUTE_LAST_MACRO, textContext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+R") : tr("Alt+R"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+R") : tr("Alt+R")));
mmacrotools->addAction(command); mmacrotools->addAction(command);
connect(executeLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(executeLastMacro())); connect(executeLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(executeLastMacro()));
QAction *saveLastMacro = new QAction(tr("Save Last Macro"), this); QAction *saveLastMacro = new QAction(tr("Save Last Macro"), this);
saveLastMacro->setEnabled(false); saveLastMacro->setEnabled(false);
command = am->registerAction(saveLastMacro, Constants::SAVE_LAST_MACRO, textContext); command = Core::ActionManager::registerAction(saveLastMacro, Constants::SAVE_LAST_MACRO, textContext);
mmacrotools->addAction(command); mmacrotools->addAction(command);
connect(saveLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(saveLastMacro())); connect(saveLastMacro, SIGNAL(triggered()), m_macroManager, SLOT(saveLastMacro()));

View File

@@ -78,8 +78,7 @@ void TextEditorMacroHandler::startRecording(Macros::Macro *macro)
m_currentEditor->widget()->installEventFilter(this); m_currentEditor->widget()->installEventFilter(this);
// Block completion // Block completion
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager::command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(true);
am->command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(true);
} }
void TextEditorMacroHandler::endRecordingMacro(Macros::Macro *macro) void TextEditorMacroHandler::endRecordingMacro(Macros::Macro *macro)
@@ -89,8 +88,7 @@ void TextEditorMacroHandler::endRecordingMacro(Macros::Macro *macro)
IMacroHandler::endRecordingMacro(macro); IMacroHandler::endRecordingMacro(macro);
// Unblock completion // Unblock completion
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionManager::command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(false);
am->command(TextEditor::Constants::COMPLETE_THIS)->shortcut()->blockSignals(false);
} }
bool TextEditorMacroHandler::canExecuteEvent(const MacroEvent &macroEvent) bool TextEditorMacroHandler::canExecuteEvent(const MacroEvent &macroEvent)

View File

@@ -97,8 +97,7 @@ MaemoQemuManager::MaemoQemuManager(QObject *parent)
m_qemuAction->setToolTip(tr("Start MeeGo Emulator")); m_qemuAction->setToolTip(tr("Start MeeGo Emulator"));
connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime())); connect(m_qemuAction, SIGNAL(triggered()), this, SLOT(startRuntime()));
Core::ActionManager *actionManager = Core::ICore::actionManager(); Core::Command *qemuCommand = Core::ActionManager::registerAction(m_qemuAction,
Core::Command *qemuCommand = actionManager->registerAction(m_qemuAction,
"MaemoEmulator", Core::Context(Core::Constants::C_GLOBAL)); "MaemoEmulator", Core::Context(Core::Constants::C_GLOBAL));
qemuCommand->setAttribute(Core::Command::CA_UpdateText); qemuCommand->setAttribute(Core::Command::CA_UpdateText);
qemuCommand->setAttribute(Core::Command::CA_UpdateIcon); qemuCommand->setAttribute(Core::Command::CA_UpdateIcon);

View File

@@ -153,8 +153,6 @@ bool MercurialPlugin::initialize(const QStringList & /* arguments */, QString *
m_client = new MercurialClient(&mercurialSettings); m_client = new MercurialClient(&mercurialSettings);
initializeVcs(new MercurialControl(m_client)); initializeVcs(new MercurialControl(m_client));
actionManager = Core::ICore::actionManager();
optionsPage = new OptionsPage(); optionsPage = new OptionsPage();
addAutoReleasedObject(optionsPage); addAutoReleasedObject(optionsPage);
mercurialSettings.readSettings(core->settings()); mercurialSettings.readSettings(core->settings());
@@ -199,7 +197,7 @@ void MercurialPlugin::createMenu()
Core::Context context(Core::Constants::C_GLOBAL); Core::Context context(Core::Constants::C_GLOBAL);
// Create menu item for Mercurial // Create menu item for Mercurial
mercurialContainer = actionManager->createMenu(Core::Id("Mercurial.MercurialMenu")); mercurialContainer = Core::ActionManager::createMenu(Core::Id("Mercurial.MercurialMenu"));
QMenu *menu = mercurialContainer->menu(); QMenu *menu = mercurialContainer->menu();
menu->setTitle(tr("Mercurial")); menu->setTitle(tr("Mercurial"));
@@ -214,7 +212,7 @@ void MercurialPlugin::createMenu()
createLessUsedActions(context); createLessUsedActions(context);
// Request the Tools menu and add the Mercurial menu to it // Request the Tools menu and add the Mercurial menu to it
Core::ActionContainer *toolsMenu = actionManager->actionContainer(Core::Id(Core::Constants::M_TOOLS)); Core::ActionContainer *toolsMenu = Core::ActionManager::actionContainer(Core::Id(Core::Constants::M_TOOLS));
toolsMenu->addMenu(mercurialContainer); toolsMenu->addMenu(mercurialContainer);
m_menuAction = mercurialContainer->menu()->menuAction(); m_menuAction = mercurialContainer->menu()->menuAction();
} }
@@ -224,14 +222,14 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
Core::Command *command; Core::Command *command;
annotateFile = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this); annotateFile = new ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(annotateFile, Core::Id(Constants::ANNOTATE), context); command = Core::ActionManager::registerAction(annotateFile, Core::Id(Constants::ANNOTATE), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile())); connect(annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
diffFile = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this); diffFile = new ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(diffFile, Core::Id(Constants::DIFF), context); command = Core::ActionManager::registerAction(diffFile, Core::Id(Constants::DIFF), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+D") : tr("Alt+H,Alt+D"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+D") : tr("Alt+H,Alt+D")));
connect(diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); connect(diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
@@ -239,7 +237,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
logFile = new ParameterAction(tr("Log Current File"), tr("Log \"%1\""), ParameterAction::EnabledWithParameter, this); logFile = new ParameterAction(tr("Log Current File"), tr("Log \"%1\""), ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(logFile, Core::Id(Constants::LOG), context); command = Core::ActionManager::registerAction(logFile, Core::Id(Constants::LOG), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+L") : tr("Alt+H,Alt+L"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+L") : tr("Alt+H,Alt+L")));
connect(logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile())); connect(logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile()));
@@ -247,7 +245,7 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
statusFile = new ParameterAction(tr("Status Current File"), tr("Status \"%1\""), ParameterAction::EnabledWithParameter, this); statusFile = new ParameterAction(tr("Status Current File"), tr("Status \"%1\""), ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(statusFile, Core::Id(Constants::STATUS), context); command = Core::ActionManager::registerAction(statusFile, Core::Id(Constants::STATUS), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+S") : tr("Alt+H,Alt+S"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+S") : tr("Alt+H,Alt+S")));
connect(statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile())); connect(statusFile, SIGNAL(triggered()), this, SLOT(statusCurrentFile()));
@@ -257,21 +255,21 @@ void MercurialPlugin::createFileActions(const Core::Context &context)
createSeparator(context, Core::Id("Mercurial.FileDirSeperator1")); createSeparator(context, Core::Id("Mercurial.FileDirSeperator1"));
m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this); m_addAction = new ParameterAction(tr("Add"), tr("Add \"%1\""), ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(m_addAction, Core::Id(Constants::ADD), context); command = Core::ActionManager::registerAction(m_addAction, Core::Id(Constants::ADD), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile())); connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this); m_deleteAction = new ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(m_deleteAction, Core::Id(Constants::DELETE), context); command = Core::ActionManager::registerAction(m_deleteAction, Core::Id(Constants::DELETE), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
revertFile = new ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this); revertFile = new ParameterAction(tr("Revert Current File..."), tr("Revert \"%1\"..."), ParameterAction::EnabledWithParameter, this);
command = actionManager->registerAction(revertFile, Core::Id(Constants::REVERT), context); command = Core::ActionManager::registerAction(revertFile, Core::Id(Constants::REVERT), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); connect(revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
@@ -332,28 +330,28 @@ void MercurialPlugin::createDirectoryActions(const Core::Context &context)
action = new QAction(tr("Diff"), this); action = new QAction(tr("Diff"), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::DIFFMULTI), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::DIFFMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(diffRepository())); connect(action, SIGNAL(triggered()), this, SLOT(diffRepository()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Log"), this); action = new QAction(tr("Log"), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::LOGMULTI), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::LOGMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(logRepository())); connect(action, SIGNAL(triggered()), this, SLOT(logRepository()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Revert..."), this); action = new QAction(tr("Revert..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::REVERTMULTI), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::REVERTMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(revertMulti())); connect(action, SIGNAL(triggered()), this, SLOT(revertMulti()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Status"), this); action = new QAction(tr("Status"), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::STATUSMULTI), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::STATUSMULTI), context);
connect(action, SIGNAL(triggered()), this, SLOT(statusMulti())); connect(action, SIGNAL(triggered()), this, SLOT(statusMulti()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
@@ -396,56 +394,56 @@ void MercurialPlugin::createRepositoryActions(const Core::Context &context)
{ {
QAction *action = new QAction(tr("Pull..."), this); QAction *action = new QAction(tr("Pull..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
Core::Command *command = actionManager->registerAction(action, Core::Id(Constants::PULL), context); Core::Command *command = Core::ActionManager::registerAction(action, Core::Id(Constants::PULL), context);
connect(action, SIGNAL(triggered()), this, SLOT(pull())); connect(action, SIGNAL(triggered()), this, SLOT(pull()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Push..."), this); action = new QAction(tr("Push..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::PUSH), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::PUSH), context);
connect(action, SIGNAL(triggered()), this, SLOT(push())); connect(action, SIGNAL(triggered()), this, SLOT(push()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Update..."), this); action = new QAction(tr("Update..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::UPDATE), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::UPDATE), context);
connect(action, SIGNAL(triggered()), this, SLOT(update())); connect(action, SIGNAL(triggered()), this, SLOT(update()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Import..."), this); action = new QAction(tr("Import..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::IMPORT), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::IMPORT), context);
connect(action, SIGNAL(triggered()), this, SLOT(import())); connect(action, SIGNAL(triggered()), this, SLOT(import()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Incoming..."), this); action = new QAction(tr("Incoming..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::INCOMING), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::INCOMING), context);
connect(action, SIGNAL(triggered()), this, SLOT(incoming())); connect(action, SIGNAL(triggered()), this, SLOT(incoming()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Outgoing..."), this); action = new QAction(tr("Outgoing..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::OUTGOING), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::OUTGOING), context);
connect(action, SIGNAL(triggered()), this, SLOT(outgoing())); connect(action, SIGNAL(triggered()), this, SLOT(outgoing()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
action = new QAction(tr("Commit..."), this); action = new QAction(tr("Commit..."), this);
m_repositoryActionList.append(action); m_repositoryActionList.append(action);
command = actionManager->registerAction(action, Core::Id(Constants::COMMIT), context); command = Core::ActionManager::registerAction(action, Core::Id(Constants::COMMIT), context);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+C") : tr("Alt+H,Alt+C"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+H,Meta+C") : tr("Alt+H,Alt+C")));
connect(action, SIGNAL(triggered()), this, SLOT(commit())); connect(action, SIGNAL(triggered()), this, SLOT(commit()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_createRepositoryAction = new QAction(tr("Create Repository..."), this); m_createRepositoryAction = new QAction(tr("Create Repository..."), this);
command = actionManager->registerAction(m_createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context); command = Core::ActionManager::registerAction(m_createRepositoryAction, Core::Id(Constants::CREATE_REPOSITORY), context);
connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository())); connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
mercurialContainer->addAction(command); mercurialContainer->addAction(command);
} }
@@ -527,18 +525,18 @@ void MercurialPlugin::createSubmitEditorActions()
Core::Command *command; Core::Command *command;
editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); editorCommit = new QAction(VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
command = actionManager->registerAction(editorCommit, Core::Id(Constants::COMMIT), context); command = Core::ActionManager::registerAction(editorCommit, Core::Id(Constants::COMMIT), context);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor())); connect(editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor()));
editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); editorDiff = new QAction(VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
command = actionManager->registerAction(editorDiff, Core::Id(Constants::DIFFEDITOR), context); command = Core::ActionManager::registerAction(editorDiff, Core::Id(Constants::DIFFEDITOR), context);
editorUndo = new QAction(tr("&Undo"), this); editorUndo = new QAction(tr("&Undo"), this);
command = actionManager->registerAction(editorUndo, Core::Id(Core::Constants::UNDO), context); command = Core::ActionManager::registerAction(editorUndo, Core::Id(Core::Constants::UNDO), context);
editorRedo = new QAction(tr("&Redo"), this); editorRedo = new QAction(tr("&Redo"), this);
command = actionManager->registerAction(editorRedo, Core::Id(Core::Constants::REDO), context); command = Core::ActionManager::registerAction(editorRedo, Core::Id(Core::Constants::REDO), context);
} }
void MercurialPlugin::commit() void MercurialPlugin::commit()
@@ -677,7 +675,7 @@ void MercurialPlugin::createRepositoryManagementActions(const Core::Context &con
return; return;
// QAction *action = new QAction(tr("Branch"), this); // QAction *action = new QAction(tr("Branch"), this);
// actionList.append(action); // actionList.append(action);
// Core::Command *command = actionManager->registerAction(action, Constants::BRANCH, context); // Core::Command *command = Core::ActionManager::registerAction(action, Constants::BRANCH, context);
// // connect(action, SIGNAL(triggered()), this, SLOT(branch())); // // connect(action, SIGNAL(triggered()), this, SLOT(branch()));
// mercurialContainer->addAction(command); // mercurialContainer->addAction(command);
} }
@@ -693,7 +691,7 @@ void MercurialPlugin::createSeparator(const Core::Context &context, const Core::
{ {
QAction *action = new QAction(this); QAction *action = new QAction(this);
action->setSeparator(true); action->setSeparator(true);
mercurialContainer->addAction(actionManager->registerAction(action, id, context)); mercurialContainer->addAction(Core::ActionManager::registerAction(action, id, context));
} }
void MercurialPlugin::updateActions(VcsBasePlugin::ActionState as) void MercurialPlugin::updateActions(VcsBasePlugin::ActionState as)

View File

@@ -145,7 +145,6 @@ private:
Core::ICore *core; Core::ICore *core;
Locator::CommandLocator *m_commandLocator; Locator::CommandLocator *m_commandLocator;
Core::ActionManager *actionManager;
Core::ActionContainer *mercurialContainer; Core::ActionContainer *mercurialContainer;
QList<QAction *> m_repositoryActionList; QList<QAction *> m_repositoryActionList;

View File

@@ -221,13 +221,12 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = {
}; };
static inline Core::Command *createSeparator(QObject *parent, static inline Core::Command *createSeparator(QObject *parent,
Core::ActionManager *ami,
const char *id, const char *id,
const Core::Context &globalcontext) const Core::Context &globalcontext)
{ {
QAction *tmpaction = new QAction(parent); QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true); tmpaction->setSeparator(true);
return ami->registerAction(tmpaction, id, globalcontext); return Core::ActionManager::registerAction(tmpaction, id, globalcontext);
} }
bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage) bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *errorMessage)
@@ -258,14 +257,11 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_commandLocator = new Locator::CommandLocator(QLatin1String("Perforce"), prefix, prefix); m_commandLocator = new Locator::CommandLocator(QLatin1String("Perforce"), prefix, prefix);
addAutoReleasedObject(m_commandLocator); addAutoReleasedObject(m_commandLocator);
//register actions
Core::ActionManager *am = Core::ICore::actionManager();
Core::ActionContainer *mtools = Core::ActionContainer *mtools =
am->actionContainer(Core::Constants::M_TOOLS); Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mperforce = Core::ActionContainer *mperforce =
am->createMenu(Core::Id(CMD_ID_PERFORCE_MENU)); Core::ActionManager::createMenu(Core::Id(CMD_ID_PERFORCE_MENU));
mperforce->menu()->setTitle(tr("&Perforce")); mperforce->menu()->setTitle(tr("&Perforce"));
mtools->addMenu(mperforce); mtools->addMenu(mperforce);
m_menuAction = mperforce->menu()->menuAction(); m_menuAction = mperforce->menu()->menuAction();
@@ -276,7 +272,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
Core::Command *command; Core::Command *command;
m_diffFileAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_diffFileAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, globalcontext); command = Core::ActionManager::registerAction(m_diffFileAction, CMD_ID_DIFF_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Diff Current File")); command->setDescription(tr("Diff Current File"));
connect(m_diffFileAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); connect(m_diffFileAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
@@ -284,7 +280,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext); command = Core::ActionManager::registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Annotate Current File")); command->setDescription(tr("Annotate Current File"));
connect(m_annotateCurrentAction, SIGNAL(triggered()), this, SLOT(annotateCurrentFile())); connect(m_annotateCurrentAction, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
@@ -292,7 +288,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext); command = Core::ActionManager::registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+F") : tr("Alt+P,Alt+F"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+F") : tr("Alt+P,Alt+F")));
command->setDescription(tr("Filelog Current File")); command->setDescription(tr("Filelog Current File"));
@@ -300,10 +296,10 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
mperforce->addAction(createSeparator(this, am, "Perforce.Sep.Edit", globalcontext)); mperforce->addAction(createSeparator(this, "Perforce.Sep.Edit", globalcontext));
m_editAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_editAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_editAction, CMD_ID_EDIT, globalcontext); command = Core::ActionManager::registerAction(m_editAction, CMD_ID_EDIT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+E") : tr("Alt+P,Alt+E"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+E") : tr("Alt+P,Alt+E")));
command->setDescription(tr("Edit File")); command->setDescription(tr("Edit File"));
@@ -312,7 +308,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_addAction, CMD_ID_ADD, globalcontext); command = Core::ActionManager::registerAction(m_addAction, CMD_ID_ADD, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+A") : tr("Alt+P,Alt+A"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+A") : tr("Alt+P,Alt+A")));
command->setDescription(tr("Add File")); command->setDescription(tr("Add File"));
@@ -321,7 +317,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext); command = Core::ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(tr("Delete File")); command->setDescription(tr("Delete File"));
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
@@ -329,7 +325,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_revertFileAction = new Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_revertFileAction = new Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_revertFileAction, CMD_ID_REVERT, globalcontext); command = Core::ActionManager::registerAction(m_revertFileAction, CMD_ID_REVERT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+R") : tr("Alt+P,Alt+R"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+R") : tr("Alt+P,Alt+R")));
command->setDescription(tr("Revert File")); command->setDescription(tr("Revert File"));
@@ -337,11 +333,11 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
mperforce->addAction(createSeparator(this, am, "Perforce.Sep.Project", globalcontext)); mperforce->addAction(createSeparator(this, "Perforce.Sep.Project", globalcontext));
const QString diffProjectDefaultText = tr("Diff Current Project/Session"); const QString diffProjectDefaultText = tr("Diff Current Project/Session");
m_diffProjectAction = new Utils::ParameterAction(diffProjectDefaultText, tr("Diff Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); m_diffProjectAction = new Utils::ParameterAction(diffProjectDefaultText, tr("Diff Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
command = am->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext); command = Core::ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+D") : tr("Alt+P,Alt+D"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+D") : tr("Alt+P,Alt+D")));
command->setDescription(diffProjectDefaultText); command->setDescription(diffProjectDefaultText);
@@ -350,14 +346,14 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); command = Core::ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject())); connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_submitProjectAction = new Utils::ParameterAction(tr("Submit Project"), tr("Submit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_submitProjectAction = new Utils::ParameterAction(tr("Submit Project"), tr("Submit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_submitProjectAction, CMD_ID_SUBMIT, globalcontext); command = Core::ActionManager::registerAction(m_submitProjectAction, CMD_ID_SUBMIT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+S") : tr("Alt+P,Alt+S"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+S") : tr("Alt+P,Alt+S")));
connect(m_submitProjectAction, SIGNAL(triggered()), this, SLOT(startSubmitProject())); connect(m_submitProjectAction, SIGNAL(triggered()), this, SLOT(startSubmitProject()));
@@ -366,7 +362,7 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
const QString updateProjectDefaultText = tr("Update Current Project"); const QString updateProjectDefaultText = tr("Update Current Project");
m_updateProjectAction = new Utils::ParameterAction(updateProjectDefaultText, tr("Update Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); m_updateProjectAction = new Utils::ParameterAction(updateProjectDefaultText, tr("Update Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this);
command = am->registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, globalcontext); command = Core::ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, globalcontext);
command->setDescription(updateProjectDefaultText); command->setDescription(updateProjectDefaultText);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateCurrentProject())); connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateCurrentProject()));
@@ -374,82 +370,82 @@ bool PerforcePlugin::initialize(const QStringList & /* arguments */, QString *er
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_revertUnchangedAction = new Utils::ParameterAction(tr("Revert Unchanged"), tr("Revert Unchanged Files of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_revertUnchangedAction = new Utils::ParameterAction(tr("Revert Unchanged"), tr("Revert Unchanged Files of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, globalcontext); command = Core::ActionManager::registerAction(m_revertUnchangedAction, CMD_ID_REVERT_UNCHANGED_PROJECT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertUnchangedAction, SIGNAL(triggered()), this, SLOT(revertUnchangedCurrentProject())); connect(m_revertUnchangedAction, SIGNAL(triggered()), this, SLOT(revertUnchangedCurrentProject()));
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_revertProjectAction = new Utils::ParameterAction(tr("Revert Project"), tr("Revert Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_revertProjectAction = new Utils::ParameterAction(tr("Revert Project"), tr("Revert Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = am->registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, globalcontext); command = Core::ActionManager::registerAction(m_revertProjectAction, CMD_ID_REVERT_PROJECT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertProjectAction, SIGNAL(triggered()), this, SLOT(revertCurrentProject())); connect(m_revertProjectAction, SIGNAL(triggered()), this, SLOT(revertCurrentProject()));
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
mperforce->addAction(createSeparator(this, am, "Perforce.Sep.Repository", globalcontext)); mperforce->addAction(createSeparator(this, "Perforce.Sep.Repository", globalcontext));
m_diffAllAction = new QAction(tr("Diff Opened Files"), this); m_diffAllAction = new QAction(tr("Diff Opened Files"), this);
command = am->registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, globalcontext); command = Core::ActionManager::registerAction(m_diffAllAction, CMD_ID_DIFF_ALL, globalcontext);
connect(m_diffAllAction, SIGNAL(triggered()), this, SLOT(diffAllOpened())); connect(m_diffAllAction, SIGNAL(triggered()), this, SLOT(diffAllOpened()));
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_openedAction = new QAction(tr("Opened"), this); m_openedAction = new QAction(tr("Opened"), this);
command = am->registerAction(m_openedAction, CMD_ID_OPENED, globalcontext); command = Core::ActionManager::registerAction(m_openedAction, CMD_ID_OPENED, globalcontext);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+O") : tr("Alt+P,Alt+O"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+P,Meta+O") : tr("Alt+P,Alt+O")));
connect(m_openedAction, SIGNAL(triggered()), this, SLOT(printOpenedFileList())); connect(m_openedAction, SIGNAL(triggered()), this, SLOT(printOpenedFileList()));
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_logRepositoryAction = new QAction(tr("Repository Log"), this); m_logRepositoryAction = new QAction(tr("Repository Log"), this);
command = am->registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); command = Core::ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository())); connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_pendingAction = new QAction(tr("Pending Changes..."), this); m_pendingAction = new QAction(tr("Pending Changes..."), this);
command = am->registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, globalcontext); command = Core::ActionManager::registerAction(m_pendingAction, CMD_ID_PENDING_CHANGES, globalcontext);
connect(m_pendingAction, SIGNAL(triggered()), this, SLOT(printPendingChanges())); connect(m_pendingAction, SIGNAL(triggered()), this, SLOT(printPendingChanges()));
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_updateAllAction = new QAction(tr("Update All"), this); m_updateAllAction = new QAction(tr("Update All"), this);
command = am->registerAction(m_updateAllAction, CMD_ID_UPDATEALL, globalcontext); command = Core::ActionManager::registerAction(m_updateAllAction, CMD_ID_UPDATEALL, globalcontext);
connect(m_updateAllAction, SIGNAL(triggered()), this, SLOT(updateAll())); connect(m_updateAllAction, SIGNAL(triggered()), this, SLOT(updateAll()));
mperforce->addAction(command); mperforce->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
mperforce->addAction(createSeparator(this, am, "Perforce.Sep.Dialogs", globalcontext)); mperforce->addAction(createSeparator(this, "Perforce.Sep.Dialogs", globalcontext));
m_describeAction = new QAction(tr("Describe..."), this); m_describeAction = new QAction(tr("Describe..."), this);
command = am->registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext); command = Core::ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext);
connect(m_describeAction, SIGNAL(triggered()), this, SLOT(describeChange())); connect(m_describeAction, SIGNAL(triggered()), this, SLOT(describeChange()));
mperforce->addAction(command); mperforce->addAction(command);
m_annotateAction = new QAction(tr("Annotate..."), this); m_annotateAction = new QAction(tr("Annotate..."), this);
command = am->registerAction(m_annotateAction, CMD_ID_ANNOTATE, globalcontext); command = Core::ActionManager::registerAction(m_annotateAction, CMD_ID_ANNOTATE, globalcontext);
connect(m_annotateAction, SIGNAL(triggered()), this, SLOT(annotate())); connect(m_annotateAction, SIGNAL(triggered()), this, SLOT(annotate()));
mperforce->addAction(command); mperforce->addAction(command);
m_filelogAction = new QAction(tr("Filelog..."), this); m_filelogAction = new QAction(tr("Filelog..."), this);
command = am->registerAction(m_filelogAction, CMD_ID_FILELOG, globalcontext); command = Core::ActionManager::registerAction(m_filelogAction, CMD_ID_FILELOG, globalcontext);
connect(m_filelogAction, SIGNAL(triggered()), this, SLOT(filelog())); connect(m_filelogAction, SIGNAL(triggered()), this, SLOT(filelog()));
mperforce->addAction(command); mperforce->addAction(command);
m_submitCurrentLogAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Submit"), this); m_submitCurrentLogAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Submit"), this);
command = am->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, perforcesubmitcontext); command = Core::ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, perforcesubmitcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
m_diffSelectedFiles = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); m_diffSelectedFiles = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
command = am->registerAction(m_diffSelectedFiles, Constants::DIFF_SELECTED, perforcesubmitcontext); command = Core::ActionManager::registerAction(m_diffSelectedFiles, Constants::DIFF_SELECTED, perforcesubmitcontext);
m_undoAction = new QAction(tr("&Undo"), this); m_undoAction = new QAction(tr("&Undo"), this);
command = am->registerAction(m_undoAction, Core::Constants::UNDO, perforcesubmitcontext); command = Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, perforcesubmitcontext);
m_redoAction = new QAction(tr("&Redo"), this); m_redoAction = new QAction(tr("&Redo"), this);
command = am->registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext); command = Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, perforcesubmitcontext);
return true; return true;
} }

View File

@@ -133,7 +133,6 @@ AppOutputPane::AppOutputPane() :
this, SLOT(reRunRunControl())); this, SLOT(reRunRunControl()));
// Stop // Stop
Core::ActionManager *am = Core::ICore::actionManager();
Core::Context globalcontext(Core::Constants::C_GLOBAL); Core::Context globalcontext(Core::Constants::C_GLOBAL);
QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP));
@@ -142,7 +141,7 @@ AppOutputPane::AppOutputPane() :
m_stopAction->setToolTip(tr("Stop")); m_stopAction->setToolTip(tr("Stop"));
m_stopAction->setEnabled(false); m_stopAction->setEnabled(false);
Core::Command *cmd = am->registerAction(m_stopAction, Constants::STOP, globalcontext); Core::Command *cmd = Core::ActionManager::registerAction(m_stopAction, Constants::STOP, globalcontext);
m_stopButton->setDefaultAction(cmd->action()); m_stopButton->setDefaultAction(cmd->action());
m_stopButton->setAutoRaise(true); m_stopButton->setAutoRaise(true);

View File

@@ -340,7 +340,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_taskHub = new TaskHub; d->m_taskHub = new TaskHub;
addAutoReleasedObject(d->m_taskHub); addAutoReleasedObject(d->m_taskHub);
Core::ActionManager *am = Core::ICore::actionManager();
connect(Core::ICore::instance(), SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards())); connect(Core::ICore::instance(), SIGNAL(newItemsDialogRequested()), this, SLOT(loadCustomWizards()));
d->m_welcomePage = new ProjectWelcomePage; d->m_welcomePage = new ProjectWelcomePage;
@@ -429,15 +428,15 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// context menus // context menus
Core::ActionContainer *msessionContextMenu = Core::ActionContainer *msessionContextMenu =
am->createMenu(Constants::M_SESSIONCONTEXT); Core::ActionManager::createMenu(Constants::M_SESSIONCONTEXT);
Core::ActionContainer *mprojectContextMenu = Core::ActionContainer *mprojectContextMenu =
am->createMenu(Constants::M_PROJECTCONTEXT); Core::ActionManager::createMenu(Constants::M_PROJECTCONTEXT);
Core::ActionContainer *msubProjectContextMenu = Core::ActionContainer *msubProjectContextMenu =
am->createMenu(Constants::M_SUBPROJECTCONTEXT); Core::ActionManager::createMenu(Constants::M_SUBPROJECTCONTEXT);
Core::ActionContainer *mfolderContextMenu = Core::ActionContainer *mfolderContextMenu =
am->createMenu(Constants::M_FOLDERCONTEXT); Core::ActionManager::createMenu(Constants::M_FOLDERCONTEXT);
Core::ActionContainer *mfileContextMenu = Core::ActionContainer *mfileContextMenu =
am->createMenu(Constants::M_FILECONTEXT); Core::ActionManager::createMenu(Constants::M_FILECONTEXT);
d->m_sessionContextMenu = msessionContextMenu->menu(); d->m_sessionContextMenu = msessionContextMenu->menu();
d->m_projectMenu = mprojectContextMenu->menu(); d->m_projectMenu = mprojectContextMenu->menu();
@@ -446,24 +445,24 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_fileMenu = mfileContextMenu->menu(); d->m_fileMenu = mfileContextMenu->menu();
Core::ActionContainer *mfile = Core::ActionContainer *mfile =
am->actionContainer(Core::Constants::M_FILE); Core::ActionManager::actionContainer(Core::Constants::M_FILE);
Core::ActionContainer *menubar = Core::ActionContainer *menubar =
am->actionContainer(Core::Constants::MENU_BAR); Core::ActionManager::actionContainer(Core::Constants::MENU_BAR);
// build menu // build menu
Core::ActionContainer *mbuild = Core::ActionContainer *mbuild =
am->createMenu(Constants::M_BUILDPROJECT); Core::ActionManager::createMenu(Constants::M_BUILDPROJECT);
mbuild->menu()->setTitle(tr("&Build")); mbuild->menu()->setTitle(tr("&Build"));
menubar->addMenu(mbuild, Core::Constants::G_VIEW); menubar->addMenu(mbuild, Core::Constants::G_VIEW);
// debug menu // debug menu
Core::ActionContainer *mdebug = Core::ActionContainer *mdebug =
am->createMenu(Constants::M_DEBUG); Core::ActionManager::createMenu(Constants::M_DEBUG);
mdebug->menu()->setTitle(tr("&Debug")); mdebug->menu()->setTitle(tr("&Debug"));
menubar->addMenu(mdebug, Core::Constants::G_VIEW); menubar->addMenu(mdebug, Core::Constants::G_VIEW);
Core::ActionContainer *mstartdebugging = Core::ActionContainer *mstartdebugging =
am->createMenu(Constants::M_DEBUG_STARTDEBUGGING); Core::ActionManager::createMenu(Constants::M_DEBUG_STARTDEBUGGING);
mstartdebugging->menu()->setTitle(tr("&Start Debugging")); mstartdebugging->menu()->setTitle(tr("&Start Debugging"));
mdebug->addMenu(mstartdebugging, Core::Constants::G_DEFAULT_ONE); mdebug->addMenu(mstartdebugging, Core::Constants::G_DEFAULT_ONE);
@@ -499,7 +498,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
msubProjectContextMenu->appendGroup(Constants::G_PROJECT_LAST); msubProjectContextMenu->appendGroup(Constants::G_PROJECT_LAST);
msubProjectContextMenu->appendGroup(Constants::G_PROJECT_TREE); msubProjectContextMenu->appendGroup(Constants::G_PROJECT_TREE);
Core::ActionContainer *runMenu = Core::ICore::actionManager()->createMenu(Constants::RUNMENUCONTEXTMENU); Core::ActionContainer *runMenu = Core::ActionManager::createMenu(Constants::RUNMENUCONTEXTMENU);
runMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide); runMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide);
QIcon runIcon = QIcon(QLatin1String(Constants::ICON_RUN)); QIcon runIcon = QIcon(QLatin1String(Constants::ICON_RUN));
runIcon.addFile(QLatin1String(Constants::ICON_RUN_SMALL)); runIcon.addFile(QLatin1String(Constants::ICON_RUN_SMALL));
@@ -518,7 +517,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
mfileContextMenu->appendGroup(Constants::G_PROJECT_TREE); mfileContextMenu->appendGroup(Constants::G_PROJECT_TREE);
// "open with" submenu // "open with" submenu
Core::ActionContainer * const openWith = Core::ActionContainer * const openWith =
am->createMenu(ProjectExplorer::Constants::M_OPENFILEWITHCONTEXT); Core::ActionManager::createMenu(ProjectExplorer::Constants::M_OPENFILEWITHCONTEXT);
openWith->setOnAllDisabledBehavior(Core::ActionContainer::Show); openWith->setOnAllDisabledBehavior(Core::ActionContainer::Show);
d->m_openWithMenu = openWith->menu(); d->m_openWithMenu = openWith->menu();
d->m_openWithMenu->setTitle(tr("Open With")); d->m_openWithMenu->setTitle(tr("Open With"));
@@ -535,40 +534,40 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext); cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Config.Sep"), projecTreeContext);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD);
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Files.Sep"), projecTreeContext); cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Files.Sep"), projecTreeContext);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES); msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Projects.Sep"), globalcontext); cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Projects.Sep"), globalcontext);
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT); mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Other.Sep"), globalcontext); cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Other.Sep"), globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); mbuild->addAction(cmd, Constants::G_BUILD_REBUILD);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_OTHER); msessionContextMenu->addAction(cmd, Constants::G_SESSION_OTHER);
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, Core::Id("ProjectExplorer.CancelBuild.Sep"), globalcontext); cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.CancelBuild.Sep"), globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext); cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Run.Sep"), globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_RUN); mbuild->addAction(cmd, Constants::G_BUILD_RUN);
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, Core::Id("ProjectExplorer.Rebuild.Sep"), globalcontext); cmd = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Rebuild.Sep"), globalcontext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD);
// //
@@ -577,13 +576,13 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// new action // new action
d->m_newAction = new QAction(tr("New Project..."), this); d->m_newAction = new QAction(tr("New Project..."), this);
cmd = am->registerAction(d->m_newAction, Constants::NEWPROJECT, globalcontext); cmd = Core::ActionManager::registerAction(d->m_newAction, Constants::NEWPROJECT, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+N"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+N")));
msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES); msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
// open action // open action
d->m_loadAction = new QAction(tr("Load Project..."), this); d->m_loadAction = new QAction(tr("Load Project..."), this);
cmd = am->registerAction(d->m_loadAction, Constants::LOAD, globalcontext); cmd = Core::ActionManager::registerAction(d->m_loadAction, Constants::LOAD, globalcontext);
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+O"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+O")));
#endif #endif
@@ -591,24 +590,24 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// Default open action // Default open action
d->m_openFileAction = new QAction(tr("Open File"), this); d->m_openFileAction = new QAction(tr("Open File"), this);
cmd = am->registerAction(d->m_openFileAction, ProjectExplorer::Constants::OPENFILE, cmd = Core::ActionManager::registerAction(d->m_openFileAction, ProjectExplorer::Constants::OPENFILE,
projecTreeContext); projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN); mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
d->m_searchOnFileSystem = new QAction(FolderNavigationWidget::msgFindOnFileSystem(), this); d->m_searchOnFileSystem = new QAction(FolderNavigationWidget::msgFindOnFileSystem(), this);
cmd = am->registerAction(d->m_searchOnFileSystem, ProjectExplorer::Constants::SEARCHONFILESYSTEM, projecTreeContext); cmd = Core::ActionManager::registerAction(d->m_searchOnFileSystem, ProjectExplorer::Constants::SEARCHONFILESYSTEM, projecTreeContext);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_CONFIG); mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_CONFIG);
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_LAST);
d->m_showInGraphicalShell = new QAction(Core::FileUtils::msgGraphicalShellAction(), this); d->m_showInGraphicalShell = new QAction(Core::FileUtils::msgGraphicalShellAction(), this);
cmd = am->registerAction(d->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL, cmd = Core::ActionManager::registerAction(d->m_showInGraphicalShell, ProjectExplorer::Constants::SHOWINGRAPHICALSHELL,
projecTreeContext); projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN); mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES); mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
d->m_openTerminalHere = new QAction(Core::FileUtils::msgTerminalAction(), this); d->m_openTerminalHere = new QAction(Core::FileUtils::msgTerminalAction(), this);
cmd = am->registerAction(d->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE, cmd = Core::ActionManager::registerAction(d->m_openTerminalHere, ProjectExplorer::Constants::OPENTERMIANLHERE,
projecTreeContext); projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN); mfileContextMenu->addAction(cmd, Constants::G_FILE_OPEN);
mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES); mfolderContextMenu->addAction(cmd, Constants::G_FOLDER_FILES);
@@ -618,7 +617,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// recent projects menu // recent projects menu
Core::ActionContainer *mrecent = Core::ActionContainer *mrecent =
am->createMenu(Constants::M_RECENTPROJECTS); Core::ActionManager::createMenu(Constants::M_RECENTPROJECTS);
mrecent->menu()->setTitle(tr("Recent P&rojects")); mrecent->menu()->setTitle(tr("Recent P&rojects"));
mrecent->setOnAllDisabledBehavior(Core::ActionContainer::Show); mrecent->setOnAllDisabledBehavior(Core::ActionContainer::Show);
mfile->addMenu(mrecent, Core::Constants::G_FILE_OPEN); mfile->addMenu(mrecent, Core::Constants::G_FILE_OPEN);
@@ -626,7 +625,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
this, SLOT(updateRecentProjectMenu())); this, SLOT(updateRecentProjectMenu()));
// session menu // session menu
Core::ActionContainer *msession = am->createMenu(Constants::M_SESSION); Core::ActionContainer *msession = Core::ActionManager::createMenu(Constants::M_SESSION);
msession->menu()->setTitle(tr("Sessions")); msession->menu()->setTitle(tr("Sessions"));
msession->setOnAllDisabledBehavior(Core::ActionContainer::Show); msession->setOnAllDisabledBehavior(Core::ActionContainer::Show);
mfile->addMenu(msession, Core::Constants::G_FILE_OPEN); mfile->addMenu(msession, Core::Constants::G_FILE_OPEN);
@@ -636,7 +635,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// session manager action // session manager action
d->m_sessionManagerAction = new QAction(tr("Session Manager..."), this); d->m_sessionManagerAction = new QAction(tr("Session Manager..."), this);
cmd = am->registerAction(d->m_sessionManagerAction, Constants::NEWSESSION, globalcontext); cmd = Core::ActionManager::registerAction(d->m_sessionManagerAction, Constants::NEWSESSION, globalcontext);
mfile->addAction(cmd, Core::Constants::G_FILE_OPEN); mfile->addAction(cmd, Core::Constants::G_FILE_OPEN);
cmd->setDefaultKeySequence(QKeySequence()); cmd->setDefaultKeySequence(QKeySequence());
@@ -645,14 +644,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// unload action // unload action
d->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""), d->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""),
Utils::ParameterAction::EnabledWithParameter, this); Utils::ParameterAction::EnabledWithParameter, this);
cmd = am->registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext); cmd = Core::ActionManager::registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDescription(d->m_unloadAction->text()); cmd->setDescription(d->m_unloadAction->text());
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT); mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
// unload session action // unload session action
d->m_closeAllProjects = new QAction(tr("Close All Projects and Editors"), this); d->m_closeAllProjects = new QAction(tr("Close All Projects and Editors"), this);
cmd = am->registerAction(d->m_closeAllProjects, Constants::CLEARSESSION, globalcontext); cmd = Core::ActionManager::registerAction(d->m_closeAllProjects, Constants::CLEARSESSION, globalcontext);
mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT); mfile->addAction(cmd, Core::Constants::G_FILE_PROJECT);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES); msessionContextMenu->addAction(cmd, Constants::G_SESSION_FILES);
@@ -660,14 +659,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
QIcon buildIcon = QIcon(QLatin1String(Constants::ICON_BUILD)); QIcon buildIcon = QIcon(QLatin1String(Constants::ICON_BUILD));
buildIcon.addFile(QLatin1String(Constants::ICON_BUILD_SMALL)); buildIcon.addFile(QLatin1String(Constants::ICON_BUILD_SMALL));
d->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this); d->m_buildSessionAction = new QAction(buildIcon, tr("Build All"), this);
cmd = am->registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext); cmd = Core::ActionManager::registerAction(d->m_buildSessionAction, Constants::BUILDSESSION, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+B")));
mbuild->addAction(cmd, Constants::G_BUILD_BUILD); mbuild->addAction(cmd, Constants::G_BUILD_BUILD);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
// deploy session // deploy session
d->m_deploySessionAction = new QAction(tr("Deploy All"), this); d->m_deploySessionAction = new QAction(tr("Deploy All"), this);
cmd = am->registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext); cmd = Core::ActionManager::registerAction(d->m_deploySessionAction, Constants::DEPLOYSESSION, globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY); mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
@@ -675,7 +674,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
QIcon rebuildIcon = QIcon(QLatin1String(Constants::ICON_REBUILD)); QIcon rebuildIcon = QIcon(QLatin1String(Constants::ICON_REBUILD));
rebuildIcon.addFile(QLatin1String(Constants::ICON_REBUILD_SMALL)); rebuildIcon.addFile(QLatin1String(Constants::ICON_REBUILD_SMALL));
d->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this); d->m_rebuildSessionAction = new QAction(rebuildIcon, tr("Rebuild All"), this);
cmd = am->registerAction(d->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext); cmd = Core::ActionManager::registerAction(d->m_rebuildSessionAction, Constants::REBUILDSESSION, globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); mbuild->addAction(cmd, Constants::G_BUILD_REBUILD);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD);
@@ -683,7 +682,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
QIcon cleanIcon = QIcon(QLatin1String(Constants::ICON_CLEAN)); QIcon cleanIcon = QIcon(QLatin1String(Constants::ICON_CLEAN));
cleanIcon.addFile(QLatin1String(Constants::ICON_CLEAN_SMALL)); cleanIcon.addFile(QLatin1String(Constants::ICON_CLEAN_SMALL));
d->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this); d->m_cleanSessionAction = new QAction(cleanIcon, tr("Clean All"), this);
cmd = am->registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext); cmd = Core::ActionManager::registerAction(d->m_cleanSessionAction, Constants::CLEANSESSION, globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_CLEAN); mbuild->addAction(cmd, Constants::G_BUILD_CLEAN);
msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD); msessionContextMenu->addAction(cmd, Constants::G_SESSION_REBUILD);
@@ -691,7 +690,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""), d->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
d->m_buildAction->setIcon(buildIcon); d->m_buildAction->setIcon(buildIcon);
cmd = am->registerAction(d->m_buildAction, Constants::BUILD, globalcontext); cmd = Core::ActionManager::registerAction(d->m_buildAction, Constants::BUILD, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDescription(d->m_buildAction->text()); cmd->setDescription(d->m_buildAction->text());
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+B")));
@@ -703,7 +702,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// deploy action // deploy action
d->m_deployAction = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""), d->m_deployAction = new Utils::ParameterAction(tr("Deploy Project"), tr("Deploy Project \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
cmd = am->registerAction(d->m_deployAction, Constants::DEPLOY, globalcontext); cmd = Core::ActionManager::registerAction(d->m_deployAction, Constants::DEPLOY, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDescription(d->m_deployAction->text()); cmd->setDescription(d->m_deployAction->text());
mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY); mbuild->addAction(cmd, Constants::G_BUILD_DEPLOY);
@@ -711,7 +710,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// rebuild action // rebuild action
d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""), d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
cmd = am->registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext); cmd = Core::ActionManager::registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDescription(d->m_rebuildAction->text()); cmd->setDescription(d->m_rebuildAction->text());
mbuild->addAction(cmd, Constants::G_BUILD_REBUILD); mbuild->addAction(cmd, Constants::G_BUILD_REBUILD);
@@ -719,7 +718,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// clean action // clean action
d->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""), d->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
cmd = am->registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext); cmd = Core::ActionManager::registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDescription(d->m_cleanAction->text()); cmd->setDescription(d->m_cleanAction->text());
mbuild->addAction(cmd, Constants::G_BUILD_CLEAN); mbuild->addAction(cmd, Constants::G_BUILD_CLEAN);
@@ -728,12 +727,12 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP)); QIcon stopIcon = QIcon(QLatin1String(Constants::ICON_STOP));
stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL)); stopIcon.addFile(QLatin1String(Constants::ICON_STOP_SMALL));
d->m_cancelBuildAction = new QAction(stopIcon, tr("Cancel Build"), this); d->m_cancelBuildAction = new QAction(stopIcon, tr("Cancel Build"), this);
cmd = am->registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext); cmd = Core::ActionManager::registerAction(d->m_cancelBuildAction, Constants::CANCELBUILD, globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_CANCEL); mbuild->addAction(cmd, Constants::G_BUILD_CANCEL);
// run action // run action
d->m_runAction = new QAction(runIcon, tr("Run"), this); d->m_runAction = new QAction(runIcon, tr("Run"), this);
cmd = am->registerAction(d->m_runAction, Constants::RUN, globalcontext); cmd = Core::ActionManager::registerAction(d->m_runAction, Constants::RUN, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
@@ -743,61 +742,61 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// Run without deployment action // Run without deployment action
d->m_runWithoutDeployAction = new QAction(tr("Run Without Deployment"), this); d->m_runWithoutDeployAction = new QAction(tr("Run Without Deployment"), this);
cmd = am->registerAction(d->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY, globalcontext); cmd = Core::ActionManager::registerAction(d->m_runWithoutDeployAction, Constants::RUNWITHOUTDEPLOY, globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_RUN); mbuild->addAction(cmd, Constants::G_BUILD_RUN);
// Publish action // Publish action
d->m_publishAction = new Utils::ParameterAction(tr("Publish Project..."), tr("Publish Project \"%1\"..."), d->m_publishAction = new Utils::ParameterAction(tr("Publish Project..."), tr("Publish Project \"%1\"..."),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
cmd = am->registerAction(d->m_publishAction, Constants::PUBLISH, globalcontext); cmd = Core::ActionManager::registerAction(d->m_publishAction, Constants::PUBLISH, globalcontext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDescription(d->m_publishAction->text()); cmd->setDescription(d->m_publishAction->text());
mbuild->addAction(cmd, Constants::G_BUILD_RUN); mbuild->addAction(cmd, Constants::G_BUILD_RUN);
// build action (context menu) // build action (context menu)
d->m_buildActionContextMenu = new QAction(tr("Build"), this); d->m_buildActionContextMenu = new QAction(tr("Build"), this);
cmd = am->registerAction(d->m_buildActionContextMenu, Constants::BUILDCM, projecTreeContext); cmd = Core::ActionManager::registerAction(d->m_buildActionContextMenu, Constants::BUILDCM, projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_BUILD);
// rebuild action (context menu) // rebuild action (context menu)
d->m_rebuildActionContextMenu = new QAction(tr("Rebuild"), this); d->m_rebuildActionContextMenu = new QAction(tr("Rebuild"), this);
cmd = am->registerAction(d->m_rebuildActionContextMenu, Constants::REBUILDCM, projecTreeContext); cmd = Core::ActionManager::registerAction(d->m_rebuildActionContextMenu, Constants::REBUILDCM, projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD);
// clean action (context menu) // clean action (context menu)
d->m_cleanActionContextMenu = new QAction(tr("Clean"), this); d->m_cleanActionContextMenu = new QAction(tr("Clean"), this);
cmd = am->registerAction(d->m_cleanActionContextMenu, Constants::CLEANCM, projecTreeContext); cmd = Core::ActionManager::registerAction(d->m_cleanActionContextMenu, Constants::CLEANCM, projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_REBUILD);
// build without dependencies action // build without dependencies action
d->m_buildProjectOnlyAction = new QAction(tr("Build Without Dependencies"), this); d->m_buildProjectOnlyAction = new QAction(tr("Build Without Dependencies"), this);
cmd = am->registerAction(d->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY, globalcontext); cmd = Core::ActionManager::registerAction(d->m_buildProjectOnlyAction, Constants::BUILDPROJECTONLY, globalcontext);
// rebuild without dependencies action // rebuild without dependencies action
d->m_rebuildProjectOnlyAction = new QAction(tr("Rebuild Without Dependencies"), this); d->m_rebuildProjectOnlyAction = new QAction(tr("Rebuild Without Dependencies"), this);
cmd = am->registerAction(d->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY, globalcontext); cmd = Core::ActionManager::registerAction(d->m_rebuildProjectOnlyAction, Constants::REBUILDPROJECTONLY, globalcontext);
// deploy without dependencies action // deploy without dependencies action
d->m_deployProjectOnlyAction = new QAction(tr("Deploy Without Dependencies"), this); d->m_deployProjectOnlyAction = new QAction(tr("Deploy Without Dependencies"), this);
cmd = am->registerAction(d->m_deployProjectOnlyAction, Constants::DEPLOYPROJECTONLY, globalcontext); cmd = Core::ActionManager::registerAction(d->m_deployProjectOnlyAction, Constants::DEPLOYPROJECTONLY, globalcontext);
// clean without dependencies action // clean without dependencies action
d->m_cleanProjectOnlyAction = new QAction(tr("Clean Without Dependencies"), this); d->m_cleanProjectOnlyAction = new QAction(tr("Clean Without Dependencies"), this);
cmd = am->registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext); cmd = Core::ActionManager::registerAction(d->m_cleanProjectOnlyAction, Constants::CLEANPROJECTONLY, globalcontext);
// deploy action (context menu) // deploy action (context menu)
d->m_deployActionContextMenu = new QAction(tr("Deploy"), this); d->m_deployActionContextMenu = new QAction(tr("Deploy"), this);
cmd = am->registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext); cmd = Core::ActionManager::registerAction(d->m_deployActionContextMenu, Constants::DEPLOYCM, projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this); d->m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
cmd = am->registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext); cmd = Core::ActionManager::registerAction(d->m_runActionContextMenu, Constants::RUNCONTEXTMENU, projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_RUN);
// add new file action // add new file action
d->m_addNewFileAction = new QAction(tr("Add New..."), this); d->m_addNewFileAction = new QAction(tr("Add New..."), this);
cmd = am->registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE, cmd = Core::ActionManager::registerAction(d->m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE,
projecTreeContext); projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
@@ -805,7 +804,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// add existing file action // add existing file action
d->m_addExistingFilesAction = new QAction(tr("Add Existing Files..."), this); d->m_addExistingFilesAction = new QAction(tr("Add Existing Files..."), this);
cmd = am->registerAction(d->m_addExistingFilesAction, ProjectExplorer::Constants::ADDEXISTINGFILES, cmd = Core::ActionManager::registerAction(d->m_addExistingFilesAction, ProjectExplorer::Constants::ADDEXISTINGFILES,
projecTreeContext); projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
@@ -813,37 +812,37 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// new subproject action // new subproject action
d->m_addNewSubprojectAction = new QAction(tr("New Subproject..."), this); d->m_addNewSubprojectAction = new QAction(tr("New Subproject..."), this);
cmd = am->registerAction(d->m_addNewSubprojectAction, ProjectExplorer::Constants::ADDNEWSUBPROJECT, cmd = Core::ActionManager::registerAction(d->m_addNewSubprojectAction, ProjectExplorer::Constants::ADDNEWSUBPROJECT,
projecTreeContext); projecTreeContext);
mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); mprojectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
// unload project again, in right position // unload project again, in right position
mprojectContextMenu->addAction(am->command(Constants::UNLOAD), Constants::G_PROJECT_LAST); mprojectContextMenu->addAction(Core::ActionManager::command(Constants::UNLOAD), Constants::G_PROJECT_LAST);
// remove file action // remove file action
d->m_removeFileAction = new QAction(tr("Remove File..."), this); d->m_removeFileAction = new QAction(tr("Remove File..."), this);
cmd = am->registerAction(d->m_removeFileAction, ProjectExplorer::Constants::REMOVEFILE, cmd = Core::ActionManager::registerAction(d->m_removeFileAction, ProjectExplorer::Constants::REMOVEFILE,
projecTreeContext); projecTreeContext);
cmd->setDefaultKeySequence(QKeySequence::Delete); cmd->setDefaultKeySequence(QKeySequence::Delete);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
//: Remove project from parent profile (Project explorer view); will not physically delete any files. //: Remove project from parent profile (Project explorer view); will not physically delete any files.
d->m_removeProjectAction = new QAction(tr("Remove Project..."), this); d->m_removeProjectAction = new QAction(tr("Remove Project..."), this);
cmd = am->registerAction(d->m_removeProjectAction, ProjectExplorer::Constants::REMOVEPROJECT, cmd = Core::ActionManager::registerAction(d->m_removeProjectAction, ProjectExplorer::Constants::REMOVEPROJECT,
projecTreeContext); projecTreeContext);
msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES); msubProjectContextMenu->addAction(cmd, Constants::G_PROJECT_FILES);
// delete file action // delete file action
d->m_deleteFileAction = new QAction(tr("Delete File..."), this); d->m_deleteFileAction = new QAction(tr("Delete File..."), this);
cmd = am->registerAction(d->m_deleteFileAction, ProjectExplorer::Constants::DELETEFILE, cmd = Core::ActionManager::registerAction(d->m_deleteFileAction, ProjectExplorer::Constants::DELETEFILE,
projecTreeContext); projecTreeContext);
cmd->setDefaultKeySequence(QKeySequence::Delete); cmd->setDefaultKeySequence(QKeySequence::Delete);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
// renamefile action // renamefile action
d->m_renameFileAction = new QAction(tr("Rename..."), this); d->m_renameFileAction = new QAction(tr("Rename..."), this);
cmd = am->registerAction(d->m_renameFileAction, ProjectExplorer::Constants::RENAMEFILE, cmd = Core::ActionManager::registerAction(d->m_renameFileAction, ProjectExplorer::Constants::RENAMEFILE,
projecTreeContext); projecTreeContext);
mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER); mfileContextMenu->addAction(cmd, Constants::G_FILE_OTHER);
// Not yet used by anyone, so hide for now // Not yet used by anyone, so hide for now
@@ -855,7 +854,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_setStartupProjectAction = new Utils::ParameterAction(tr("Set as Active Project"), d->m_setStartupProjectAction = new Utils::ParameterAction(tr("Set as Active Project"),
tr("Set \"%1\" as Active Project"), tr("Set \"%1\" as Active Project"),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
cmd = am->registerAction(d->m_setStartupProjectAction, ProjectExplorer::Constants::SETSTARTUP, cmd = Core::ActionManager::registerAction(d->m_setStartupProjectAction, ProjectExplorer::Constants::SETSTARTUP,
projecTreeContext); projecTreeContext);
cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setDescription(d->m_setStartupProjectAction->text()); cmd->setDescription(d->m_setStartupProjectAction->text());
@@ -864,10 +863,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// Collapse All. // Collapse All.
sep = new QAction(this); sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
Core::Command *treeSpacer = am->registerAction(sep, Core::Id("ProjectExplorer.Tree.Sep"), globalcontext); Core::Command *treeSpacer = Core::ActionManager::registerAction(sep, Core::Id("ProjectExplorer.Tree.Sep"), globalcontext);
d->m_projectTreeCollapseAllAction = new QAction(tr("Collapse All"), this); d->m_projectTreeCollapseAllAction = new QAction(tr("Collapse All"), this);
cmd = am->registerAction(d->m_projectTreeCollapseAllAction, Constants::PROJECTTREE_COLLAPSE_ALL, cmd = Core::ActionManager::registerAction(d->m_projectTreeCollapseAllAction, Constants::PROJECTTREE_COLLAPSE_ALL,
projecTreeContext); projecTreeContext);
const Core::Id treeGroup = Constants::G_PROJECT_TREE; const Core::Id treeGroup = Constants::G_PROJECT_TREE;
mfileContextMenu->addAction(treeSpacer, treeGroup); mfileContextMenu->addAction(treeSpacer, treeGroup);
@@ -894,7 +893,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_projectSelectorActionMenu->setEnabled(false); d->m_projectSelectorActionMenu->setEnabled(false);
d->m_projectSelectorActionMenu->setText(tr("Open Build/Run Target Selector...")); d->m_projectSelectorActionMenu->setText(tr("Open Build/Run Target Selector..."));
connect(d->m_projectSelectorActionMenu, SIGNAL(triggered()), d->m_targetSelector, SLOT(toggleVisible())); connect(d->m_projectSelectorActionMenu, SIGNAL(triggered()), d->m_targetSelector, SLOT(toggleVisible()));
cmd = am->registerAction(d->m_projectSelectorActionMenu, ProjectExplorer::Constants::SELECTTARGET, cmd = Core::ActionManager::registerAction(d->m_projectSelectorActionMenu, ProjectExplorer::Constants::SELECTTARGET,
globalcontext); globalcontext);
mbuild->addAction(cmd, Constants::G_BUILD_RUN); mbuild->addAction(cmd, Constants::G_BUILD_RUN);
@@ -902,7 +901,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
d->m_projectSelectorActionQuick->setEnabled(false); d->m_projectSelectorActionQuick->setEnabled(false);
d->m_projectSelectorActionQuick->setText(tr("Quick Switch Target Selector")); d->m_projectSelectorActionQuick->setText(tr("Quick Switch Target Selector"));
connect(d->m_projectSelectorActionQuick, SIGNAL(triggered()), d->m_targetSelector, SLOT(nextOrShow())); connect(d->m_projectSelectorActionQuick, SIGNAL(triggered()), d->m_targetSelector, SLOT(nextOrShow()));
cmd = am->registerAction(d->m_projectSelectorActionQuick, ProjectExplorer::Constants::SELECTTARGETQUICK, globalcontext); cmd = Core::ActionManager::registerAction(d->m_projectSelectorActionQuick, ProjectExplorer::Constants::SELECTTARGETQUICK, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+T"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+T")));
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()),
@@ -2436,7 +2435,7 @@ void ProjectExplorerPlugin::updateRecentProjectMenu()
qDebug() << "ProjectExplorerPlugin::updateRecentProjectMenu"; qDebug() << "ProjectExplorerPlugin::updateRecentProjectMenu";
Core::ActionContainer *aci = Core::ActionContainer *aci =
Core::ICore::actionManager()->actionContainer(Constants::M_RECENTPROJECTS); Core::ActionManager::actionContainer(Constants::M_RECENTPROJECTS);
QMenu *menu = aci->menu(); QMenu *menu = aci->menu();
menu->clear(); menu->clear();
@@ -2518,7 +2517,7 @@ void ProjectExplorerPlugin::updateContextMenuActions()
d->m_deleteFileAction->setVisible(true); d->m_deleteFileAction->setVisible(true);
d->m_runActionContextMenu->setVisible(false); d->m_runActionContextMenu->setVisible(false);
Core::ActionContainer *runMenu = Core::ICore::actionManager()->actionContainer(Constants::RUNMENUCONTEXTMENU); Core::ActionContainer *runMenu = Core::ActionManager::actionContainer(Constants::RUNMENUCONTEXTMENU);
runMenu->menu()->clear(); runMenu->menu()->clear();
if (d->m_currentNode && d->m_currentNode->projectNode()) { if (d->m_currentNode && d->m_currentNode->projectNode()) {

View File

@@ -122,10 +122,9 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error
const Core::Context switchContext(QmlDesigner::Constants::C_QMLDESIGNER, const Core::Context switchContext(QmlDesigner::Constants::C_QMLDESIGNER,
QmlJSEditor::Constants::C_QMLJSEDITOR_ID); QmlJSEditor::Constants::C_QMLJSEDITOR_ID);
Core::ActionManager *am = Core::ICore::actionManager();
QAction *switchAction = new QAction(tr("Switch Text/Design"), this); 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)); command->setDefaultKeySequence(QKeySequence(Qt::Key_F4));
m_designerCore = new QmlDesigner::IntegrationCore; m_designerCore = new QmlDesigner::IntegrationCore;
@@ -155,9 +154,8 @@ bool BauhausPlugin::initialize(const QStringList & /*arguments*/, QString *error
void BauhausPlugin::createDesignModeWidget() void BauhausPlugin::createDesignModeWidget()
{ {
Core::ActionManager *actionManager = Core::ICore::actionManager();
m_editorManager = Core::ICore::editorManager(); 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; m_mainWidget = new DesignModeWidget;
@@ -168,100 +166,100 @@ void BauhausPlugin::createDesignModeWidget()
Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR); Core::Context qmlDesignerNavigatorContext(Constants::C_QMLNAVIGATOR);
// Revert to saved // Revert to saved
actionManager->registerAction(m_revertToSavedAction, Core::ActionManager::registerAction(m_revertToSavedAction,
Core::Constants::REVERTTOSAVED, qmlDesignerMainContext); Core::Constants::REVERTTOSAVED, qmlDesignerMainContext);
connect(m_revertToSavedAction, SIGNAL(triggered()), m_editorManager, SLOT(revertToSaved())); connect(m_revertToSavedAction, SIGNAL(triggered()), m_editorManager, SLOT(revertToSaved()));
//Save //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())); connect(m_saveAction, SIGNAL(triggered()), m_editorManager, SLOT(saveDocument()));
//Save As //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())); connect(m_saveAsAction, SIGNAL(triggered()), m_editorManager, SLOT(saveDocumentAs()));
//Close Editor //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())); connect(m_closeCurrentEditorAction, SIGNAL(triggered()), m_editorManager, SLOT(closeEditor()));
//Close All //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())); connect(m_closeAllEditorsAction, SIGNAL(triggered()), m_editorManager, SLOT(closeAllEditors()));
//Close All Others Action //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())); connect(m_closeOtherEditorsAction, SIGNAL(triggered()), m_editorManager, SLOT(closeOtherEditors()));
// Undo / Redo // Undo / Redo
actionManager->registerAction(m_mainWidget->undoAction(), Core::Constants::UNDO, qmlDesignerMainContext); Core::ActionManager::registerAction(m_mainWidget->undoAction(), Core::Constants::UNDO, qmlDesignerMainContext);
actionManager->registerAction(m_mainWidget->redoAction(), Core::Constants::REDO, qmlDesignerMainContext); Core::ActionManager::registerAction(m_mainWidget->redoAction(), Core::Constants::REDO, qmlDesignerMainContext);
Core::Command *command; Core::Command *command;
//GoIntoComponent //GoIntoComponent
command = actionManager->registerAction(m_mainWidget->goIntoComponentAction(), command = Core::ActionManager::registerAction(m_mainWidget->goIntoComponentAction(),
Constants::GO_INTO_COMPONENT, qmlDesignerMainContext); Constants::GO_INTO_COMPONENT, qmlDesignerMainContext);
command->setDefaultKeySequence(QKeySequence(Qt::Key_F2)); command->setDefaultKeySequence(QKeySequence(Qt::Key_F2));
//Edit Menu //Edit Menu
command = actionManager->registerAction(m_mainWidget->deleteAction(), command = Core::ActionManager::registerAction(m_mainWidget->deleteAction(),
QmlDesigner::Constants::DELETE, qmlDesignerFormEditorContext); QmlDesigner::Constants::DELETE, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->deleteAction(), command = Core::ActionManager::registerAction(m_mainWidget->deleteAction(),
QmlDesigner::Constants::DELETE, qmlDesignerNavigatorContext); QmlDesigner::Constants::DELETE, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Delete); command->setDefaultKeySequence(QKeySequence::Delete);
command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes command->setAttribute(Core::Command::CA_Hide); // don't show delete in other modes
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); 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); Core::Constants::CUT, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->cutAction(), command = Core::ActionManager::registerAction(m_mainWidget->cutAction(),
Core::Constants::CUT, qmlDesignerNavigatorContext); Core::Constants::CUT, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Cut); command->setDefaultKeySequence(QKeySequence::Cut);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); 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); Core::Constants::COPY, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->copyAction(), command = Core::ActionManager::registerAction(m_mainWidget->copyAction(),
Core::Constants::COPY, qmlDesignerNavigatorContext); Core::Constants::COPY, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Copy); command->setDefaultKeySequence(QKeySequence::Copy);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); 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); Core::Constants::PASTE, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->pasteAction(), command = Core::ActionManager::registerAction(m_mainWidget->pasteAction(),
Core::Constants::PASTE, qmlDesignerNavigatorContext); Core::Constants::PASTE, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::Paste); command->setDefaultKeySequence(QKeySequence::Paste);
editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE); 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); Core::Constants::SELECTALL, qmlDesignerFormEditorContext);
command = actionManager->registerAction(m_mainWidget->selectAllAction(), command = Core::ActionManager::registerAction(m_mainWidget->selectAllAction(),
Core::Constants::SELECTALL, qmlDesignerNavigatorContext); Core::Constants::SELECTALL, qmlDesignerNavigatorContext);
command->setDefaultKeySequence(QKeySequence::SelectAll); command->setDefaultKeySequence(QKeySequence::SelectAll);
editMenu->addAction(command, Core::Constants::G_EDIT_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); Constants::TOGGLE_LEFT_SIDEBAR, qmlDesignerMainContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+0")); command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+0"));
viewsMenu->addAction(command); viewsMenu->addAction(command);
command = actionManager->registerAction(m_mainWidget->toggleRightSidebarAction(), command = Core::ActionManager::registerAction(m_mainWidget->toggleRightSidebarAction(),
Constants::TOGGLE_RIGHT_SIDEBAR, qmlDesignerMainContext); Constants::TOGGLE_RIGHT_SIDEBAR, qmlDesignerMainContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+Shift+0")); command->setDefaultKeySequence(QKeySequence("Ctrl+Alt+Shift+0"));
viewsMenu->addAction(command); viewsMenu->addAction(command);
command = actionManager->registerAction(m_mainWidget->restoreDefaultViewAction(), command = Core::ActionManager::registerAction(m_mainWidget->restoreDefaultViewAction(),
Constants::RESTORE_DEFAULT_VIEW, qmlDesignerMainContext); Constants::RESTORE_DEFAULT_VIEW, qmlDesignerMainContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
viewsMenu->addAction(command); viewsMenu->addAction(command);
command = actionManager->registerAction(m_mainWidget->hideSidebarsAction(), command = Core::ActionManager::registerAction(m_mainWidget->hideSidebarsAction(),
Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext); Core::Constants::TOGGLE_SIDEBAR, qmlDesignerMainContext);
#ifdef Q_OS_MACX #ifdef Q_OS_MACX

View File

@@ -1236,7 +1236,7 @@ void QmlJSTextEditorWidget::contextMenuEvent(QContextMenuEvent *e)
refactoringMenu->setEnabled(!refactoringMenu->isEmpty()); refactoringMenu->setEnabled(!refactoringMenu->isEmpty());
if (Core::ActionContainer *mcontext = Core::ICore::actionManager()->actionContainer(QmlJSEditor::Constants::M_CONTEXT)) { if (Core::ActionContainer *mcontext = Core::ActionManager::actionContainer(QmlJSEditor::Constants::M_CONTEXT)) {
QMenu *contextMenu = mcontext->menu(); QMenu *contextMenu = mcontext->menu();
foreach (QAction *action, contextMenu->actions()) { foreach (QAction *action, contextMenu->actions()) {
menu->addAction(action); menu->addAction(action);

View File

@@ -117,14 +117,13 @@ QmlJSEditorPlugin::~QmlJSEditorPlugin()
/*! Copied from cppplugin.cpp */ /*! Copied from cppplugin.cpp */
static inline static inline
Core::Command *createSeparator(Core::ActionManager *am, Core::Command *createSeparator(QObject *parent,
QObject *parent,
Core::Context &context, Core::Context &context,
const char *id) const char *id)
{ {
QAction *separator = new QAction(parent); QAction *separator = new QAction(parent);
separator->setSeparator(true); separator->setSeparator(true);
return am->registerAction(separator, Core::Id(id), context); return Core::ActionManager::registerAction(separator, Core::Id(id), context);
} }
bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage) bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
@@ -178,45 +177,44 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
| TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor); | TextEditor::TextEditorActionHandler::FollowSymbolUnderCursor);
m_actionHandler->initializeActions(); m_actionHandler->initializeActions();
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(QmlJSEditor::Constants::M_CONTEXT);
Core::ActionContainer *contextMenu = am->createMenu(QmlJSEditor::Constants::M_CONTEXT); Core::ActionContainer *qmlToolsMenu = Core::ActionManager::actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS));
Core::ActionContainer *qmlToolsMenu = am->actionContainer(Core::Id(QmlJSTools::Constants::M_TOOLS_QMLJS));
Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Context globalContext(Core::Constants::C_GLOBAL);
qmlToolsMenu->addAction(createSeparator(am, this, globalContext, QmlJSEditor::Constants::SEPARATOR3)); qmlToolsMenu->addAction(createSeparator(this, globalContext, QmlJSEditor::Constants::SEPARATOR3));
Core::Command *cmd; Core::Command *cmd;
cmd = am->command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR); cmd = Core::ActionManager::command(TextEditor::Constants::FOLLOW_SYMBOL_UNDER_CURSOR);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
qmlToolsMenu->addAction(cmd); qmlToolsMenu->addAction(cmd);
QAction *findUsagesAction = new QAction(tr("Find Usages"), this); QAction *findUsagesAction = new QAction(tr("Find Usages"), this);
cmd = am->registerAction(findUsagesAction, Constants::FIND_USAGES, context); cmd = Core::ActionManager::registerAction(findUsagesAction, Constants::FIND_USAGES, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+U")));
connect(findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); connect(findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
qmlToolsMenu->addAction(cmd); qmlToolsMenu->addAction(cmd);
QAction *renameUsagesAction = new QAction(tr("Rename Symbol Under Cursor"), this); QAction *renameUsagesAction = new QAction(tr("Rename Symbol Under Cursor"), this);
cmd = am->registerAction(renameUsagesAction, Constants::RENAME_USAGES, context); cmd = Core::ActionManager::registerAction(renameUsagesAction, Constants::RENAME_USAGES, context);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+R"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+R")));
connect(renameUsagesAction, SIGNAL(triggered()), this, SLOT(renameUsages())); connect(renameUsagesAction, SIGNAL(triggered()), this, SLOT(renameUsages()));
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
qmlToolsMenu->addAction(cmd); qmlToolsMenu->addAction(cmd);
QAction *semanticScan = new QAction(tr("Run Checks"), this); QAction *semanticScan = new QAction(tr("Run Checks"), this);
cmd = am->registerAction(semanticScan, Core::Id(Constants::RUN_SEMANTIC_SCAN), globalContext); cmd = Core::ActionManager::registerAction(semanticScan, Core::Id(Constants::RUN_SEMANTIC_SCAN), globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+C"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+C")));
connect(semanticScan, SIGNAL(triggered()), this, SLOT(runSemanticScan())); connect(semanticScan, SIGNAL(triggered()), this, SLOT(runSemanticScan()));
qmlToolsMenu->addAction(cmd); qmlToolsMenu->addAction(cmd);
m_reformatFileAction = new QAction(tr("Reformat File"), this); m_reformatFileAction = new QAction(tr("Reformat File"), this);
cmd = am->registerAction(m_reformatFileAction, Core::Id(Constants::REFORMAT_FILE), context); cmd = Core::ActionManager::registerAction(m_reformatFileAction, Core::Id(Constants::REFORMAT_FILE), context);
connect(m_reformatFileAction, SIGNAL(triggered()), this, SLOT(reformatFile())); connect(m_reformatFileAction, SIGNAL(triggered()), this, SLOT(reformatFile()));
qmlToolsMenu->addAction(cmd); qmlToolsMenu->addAction(cmd);
QAction *showQuickToolbar = new QAction(tr("Show Qt Quick Toolbar"), this); QAction *showQuickToolbar = new QAction(tr("Show Qt Quick Toolbar"), this);
cmd = am->registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context); cmd = Core::ActionManager::registerAction(showQuickToolbar, Constants::SHOW_QT_QUICK_HELPER, context);
cmd->setDefaultKeySequence(Core::UseMacShortcuts ? QKeySequence(Qt::META + Qt::ALT + Qt::Key_Space) cmd->setDefaultKeySequence(Core::UseMacShortcuts ? QKeySequence(Qt::META + Qt::ALT + Qt::Key_Space)
: QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Space)); : QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Space));
connect(showQuickToolbar, SIGNAL(triggered()), this, SLOT(showContextPane())); connect(showQuickToolbar, SIGNAL(triggered()), this, SLOT(showContextPane()));
@@ -224,17 +222,17 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
qmlToolsMenu->addAction(cmd); qmlToolsMenu->addAction(cmd);
// Insert marker for "Refactoring" menu: // Insert marker for "Refactoring" menu:
Core::Command *sep = createSeparator(am, this, globalContext, Core::Command *sep = createSeparator(this, globalContext,
Constants::SEPARATOR1); Constants::SEPARATOR1);
sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT); sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT);
contextMenu->addAction(sep); contextMenu->addAction(sep);
contextMenu->addAction(createSeparator(am, this, globalContext, contextMenu->addAction(createSeparator(this, globalContext,
Constants::SEPARATOR2)); Constants::SEPARATOR2));
cmd = am->command(TextEditor::Constants::AUTO_INDENT_SELECTION); cmd = Core::ActionManager::command(TextEditor::Constants::AUTO_INDENT_SELECTION);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); cmd = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(cmd); contextMenu->addAction(cmd);
m_quickFixAssistProvider = new QmlJSQuickFixAssistProvider; m_quickFixAssistProvider = new QmlJSQuickFixAssistProvider;
@@ -321,11 +319,11 @@ void QmlJSEditorPlugin::showContextPane()
} }
Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a, Core::ActionManager *am, Core::Command *QmlJSEditorPlugin::addToolAction(QAction *a,
Core::Context &context, const Core::Id &id, Core::Context &context, const Core::Id &id,
Core::ActionContainer *c1, const QString &keySequence) Core::ActionContainer *c1, const QString &keySequence)
{ {
Core::Command *command = am->registerAction(a, id, context); Core::Command *command = Core::ActionManager::registerAction(a, id, context);
if (!keySequence.isEmpty()) if (!keySequence.isEmpty())
command->setDefaultKeySequence(QKeySequence(keySequence)); command->setDefaultKeySequence(QKeySequence(keySequence));
c1->addAction(command); c1->addAction(command);

View File

@@ -111,7 +111,7 @@ private Q_SLOTS:
void checkCurrentEditorSemanticInfoUpToDate(); void checkCurrentEditorSemanticInfoUpToDate();
private: private:
Core::Command *addToolAction(QAction *a, Core::ActionManager *am, Core::Context &context, const Core::Id &id, Core::Command *addToolAction(QAction *a, Core::Context &context, const Core::Id &id,
Core::ActionContainer *c1, const QString &keySequence); Core::ActionContainer *c1, const QString &keySequence);
static QmlJSEditorPlugin *m_instance; static QmlJSEditorPlugin *m_instance;

View File

@@ -77,8 +77,6 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
Q_UNUSED(arguments) Q_UNUSED(arguments)
Q_UNUSED(error) Q_UNUSED(error)
Core::ActionManager *am = Core::ICore::actionManager();
m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings m_settings = new QmlJSToolsSettings(this); // force registration of qmljstools settings
// Objects // Objects
@@ -96,8 +94,8 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
addAutoReleasedObject(new QmlJSCodeStyleSettingsPage); addAutoReleasedObject(new QmlJSCodeStyleSettingsPage);
// Menus // Menus
Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS); Core::ActionContainer *mtools = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS);
Core::ActionContainer *mqmljstools = am->createMenu(Constants::M_TOOLS_QMLJS); Core::ActionContainer *mqmljstools = Core::ActionManager::createMenu(Constants::M_TOOLS_QMLJS);
QMenu *menu = mqmljstools->menu(); QMenu *menu = mqmljstools->menu();
menu->setTitle(tr("&QML/JS")); menu->setTitle(tr("&QML/JS"));
menu->setEnabled(true); menu->setEnabled(true);
@@ -106,7 +104,8 @@ bool QmlJSToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Update context in global context // Update context in global context
m_resetCodeModelAction = new QAction(tr("Reset Code Model"), this); m_resetCodeModelAction = new QAction(tr("Reset Code Model"), this);
Core::Context globalContext(Core::Constants::C_GLOBAL); Core::Context globalContext(Core::Constants::C_GLOBAL);
Core::Command *cmd = am->registerAction(m_resetCodeModelAction, Core::Id(Constants::RESET_CODEMODEL), globalContext); Core::Command *cmd = Core::ActionManager::registerAction(
m_resetCodeModelAction, Core::Id(Constants::RESET_CODEMODEL), globalContext);
connect(m_resetCodeModelAction, SIGNAL(triggered()), m_modelManager, SLOT(resetCodeModel())); connect(m_resetCodeModelAction, SIGNAL(triggered()), m_modelManager, SLOT(resetCodeModel()));
mqmljstools->addAction(cmd); mqmljstools->addAction(cmd);

View File

@@ -177,22 +177,21 @@ QmlProfilerTool::QmlProfilerTool(QObject *parent)
Command *command = 0; Command *command = 0;
const Context globalContext(C_GLOBAL); const Context globalContext(C_GLOBAL);
ActionManager *am = ICore::actionManager();
ActionContainer *menu = am->actionContainer(M_DEBUG_ANALYZER); ActionContainer *menu = Core::ActionManager::actionContainer(M_DEBUG_ANALYZER);
ActionContainer *options = am->createMenu(M_DEBUG_ANALYZER_QML_OPTIONS); ActionContainer *options = Core::ActionManager::createMenu(M_DEBUG_ANALYZER_QML_OPTIONS);
options->menu()->setTitle(tr("QML Profiler Options")); options->menu()->setTitle(tr("QML Profiler Options"));
menu->addMenu(options, G_ANALYZER_OPTIONS); menu->addMenu(options, G_ANALYZER_OPTIONS);
options->menu()->setEnabled(true); options->menu()->setEnabled(true);
QAction *act = d->m_loadQmlTrace = new QAction(tr("Load QML Trace"), options); QAction *act = d->m_loadQmlTrace = new QAction(tr("Load QML Trace"), options);
command = am->registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace", globalContext); command = Core::ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.LoadQMLTrace", globalContext);
connect(act, SIGNAL(triggered()), this, SLOT(showLoadDialog())); connect(act, SIGNAL(triggered()), this, SLOT(showLoadDialog()));
options->addAction(command); options->addAction(command);
act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options); act = d->m_saveQmlTrace = new QAction(tr("Save QML Trace"), options);
d->m_saveQmlTrace->setEnabled(false); d->m_saveQmlTrace->setEnabled(false);
command = am->registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace", globalContext); command = Core::ActionManager::registerAction(act, "Analyzer.Menu.StartAnalyzer.QMLProfilerOptions.SaveQMLTrace", globalContext);
connect(act, SIGNAL(triggered()), this, SLOT(showSaveDialog())); connect(act, SIGNAL(triggered()), this, SLOT(showSaveDialog()));
options->addAction(command); options->addAction(command);

View File

@@ -200,8 +200,8 @@ void ProFileEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{ {
QMenu *menu = new QMenu(); QMenu *menu = new QMenu();
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *mcontext =
Core::ActionContainer *mcontext = am->actionContainer(Qt4ProjectManager::Constants::M_CONTEXT); Core::ActionManager::actionContainer(Qt4ProjectManager::Constants::M_CONTEXT);
QMenu *contextMenu = mcontext->menu(); QMenu *contextMenu = mcontext->menu();
foreach (QAction *action, contextMenu->actions()) foreach (QAction *action, contextMenu->actions())

View File

@@ -122,7 +122,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
return false; return false;
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
Core::ActionManager *am = Core::ICore::actionManager();
//create and register objects //create and register objects
m_qt4ProjectManager = new Qt4Manager(this); m_qt4ProjectManager = new Qt4Manager(this);
@@ -177,13 +176,13 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
//menus //menus
Core::ActionContainer *mbuild = Core::ActionContainer *mbuild =
am->actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT);
Core::ActionContainer *mproject = Core::ActionContainer *mproject =
am->actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_PROJECTCONTEXT);
Core::ActionContainer *msubproject = Core::ActionContainer *msubproject =
am->actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_SUBPROJECTCONTEXT);
Core::ActionContainer *mfile = Core::ActionContainer *mfile =
am->actionContainer(ProjectExplorer::Constants::M_FILECONTEXT); Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_FILECONTEXT);
//register actions //register actions
Core::Command *command; Core::Command *command;
@@ -191,7 +190,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
m_buildSubProjectContextMenu = new Utils::ParameterAction(tr("Build"), tr("Build \"%1\""), m_buildSubProjectContextMenu = new Utils::ParameterAction(tr("Build"), tr("Build \"%1\""),
Utils::ParameterAction::AlwaysEnabled/*handled manually*/, Utils::ParameterAction::AlwaysEnabled/*handled manually*/,
this); this);
command = am->registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext); command = Core::ActionManager::registerAction(m_buildSubProjectContextMenu, Constants::BUILDSUBDIRCONTEXTMENU, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(m_buildSubProjectContextMenu->text()); command->setDescription(m_buildSubProjectContextMenu->text());
@@ -199,7 +198,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu())); connect(m_buildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu()));
m_runQMakeActionContextMenu = new QAction(tr("Run qmake"), this); m_runQMakeActionContextMenu = new QAction(tr("Run qmake"), this);
command = am->registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext); command = Core::ActionManager::registerAction(m_runQMakeActionContextMenu, Constants::RUNQMAKECONTEXTMENU, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); mproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
@@ -208,30 +207,33 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
m_subProjectRebuildSeparator = new QAction(this); m_subProjectRebuildSeparator = new QAction(this);
m_subProjectRebuildSeparator->setSeparator(true); m_subProjectRebuildSeparator->setSeparator(true);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
command = am->registerAction(m_subProjectRebuildSeparator, Core::Id("ProjectExplorer.SubprojectRebuild.Sep"), projectContext); command = Core::ActionManager::registerAction(
m_subProjectRebuildSeparator, Core::Id("ProjectExplorer.SubprojectRebuild.Sep"), projectContext);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
m_rebuildSubProjectContextMenu = new QAction(tr("Rebuild"), this); m_rebuildSubProjectContextMenu = new QAction(tr("Rebuild"), this);
command = am->registerAction(m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIRCONTEXTMENU, projectContext); command = Core::ActionManager::registerAction(
m_rebuildSubProjectContextMenu, Constants::REBUILDSUBDIRCONTEXTMENU, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_rebuildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(rebuildSubDirContextMenu())); connect(m_rebuildSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(rebuildSubDirContextMenu()));
m_cleanSubProjectContextMenu = new QAction(tr("Clean"), this); m_cleanSubProjectContextMenu = new QAction(tr("Clean"), this);
command = am->registerAction(m_cleanSubProjectContextMenu, Constants::CLEANSUBDIRCONTEXTMENU, projectContext); command = Core::ActionManager::registerAction(
m_cleanSubProjectContextMenu, Constants::CLEANSUBDIRCONTEXTMENU, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD); msubproject->addAction(command, ProjectExplorer::Constants::G_PROJECT_BUILD);
connect(m_cleanSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(cleanSubDirContextMenu())); connect(m_cleanSubProjectContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(cleanSubDirContextMenu()));
m_buildFileContextMenu = new QAction(tr("Build"), this); m_buildFileContextMenu = new QAction(tr("Build"), this);
command = am->registerAction(m_buildFileContextMenu, Constants::BUILDFILECONTEXTMENU, projectContext); command = Core::ActionManager::registerAction(m_buildFileContextMenu, Constants::BUILDFILECONTEXTMENU, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
mfile->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER); mfile->addAction(command, ProjectExplorer::Constants::G_FILE_OTHER);
connect(m_buildFileContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildFileContextMenu())); connect(m_buildFileContextMenu, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildFileContextMenu()));
m_buildSubProjectAction = new Utils::ParameterAction(tr("Build Subproject"), tr("Build Subproject \"%1\""), m_buildSubProjectAction = new Utils::ParameterAction(tr("Build Subproject"), tr("Build Subproject \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
command = am->registerAction(m_buildSubProjectAction, Constants::BUILDSUBDIR, projectContext); command = Core::ActionManager::registerAction(m_buildSubProjectAction, Constants::BUILDSUBDIR, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(m_buildSubProjectAction->text()); command->setDescription(m_buildSubProjectAction->text());
@@ -239,14 +241,14 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
connect(m_buildSubProjectAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu())); connect(m_buildSubProjectAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(buildSubDirContextMenu()));
m_runQMakeAction = new QAction(tr("Run qmake"), this); m_runQMakeAction = new QAction(tr("Run qmake"), this);
command = am->registerAction(m_runQMakeAction, Constants::RUNQMAKE, projectContext); command = Core::ActionManager::registerAction(m_runQMakeAction, Constants::RUNQMAKE, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD); mbuild->addAction(command, ProjectExplorer::Constants::G_BUILD_BUILD);
connect(m_runQMakeAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMake())); connect(m_runQMakeAction, SIGNAL(triggered()), m_qt4ProjectManager, SLOT(runQMake()));
m_rebuildSubProjectAction = new Utils::ParameterAction(tr("Rebuild Subproject"), tr("Rebuild Subproject \"%1\""), m_rebuildSubProjectAction = new Utils::ParameterAction(tr("Rebuild Subproject"), tr("Rebuild Subproject \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
command = am->registerAction(m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext); command = Core::ActionManager::registerAction(m_rebuildSubProjectAction, Constants::REBUILDSUBDIR, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(m_rebuildSubProjectAction->text()); command->setDescription(m_rebuildSubProjectAction->text());
@@ -255,7 +257,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
m_cleanSubProjectAction = new Utils::ParameterAction(tr("Clean Subproject"), tr("Clean Subproject \"%1\""), m_cleanSubProjectAction = new Utils::ParameterAction(tr("Clean Subproject"), tr("Clean Subproject \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
command = am->registerAction(m_cleanSubProjectAction, Constants::CLEANSUBDIR, projectContext); command = Core::ActionManager::registerAction(m_cleanSubProjectAction, Constants::CLEANSUBDIR, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(m_cleanSubProjectAction->text()); command->setDescription(m_cleanSubProjectAction->text());
@@ -264,7 +266,7 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
m_buildFileAction = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""), m_buildFileAction = new Utils::ParameterAction(tr("Build File"), tr("Build File \"%1\""),
Utils::ParameterAction::AlwaysEnabled, this); Utils::ParameterAction::AlwaysEnabled, this);
command = am->registerAction(m_buildFileAction, Constants::BUILDFILE, projectContext); command = Core::ActionManager::registerAction(m_buildFileAction, Constants::BUILDFILE, projectContext);
command->setAttribute(Core::Command::CA_Hide); command->setAttribute(Core::Command::CA_Hide);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDescription(m_buildFileAction->text()); command->setDescription(m_buildFileAction->text());
@@ -279,22 +281,22 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
connect(m_projectExplorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)), connect(m_projectExplorer, SIGNAL(currentNodeChanged(ProjectExplorer::Node*,ProjectExplorer::Project*)),
this, SLOT(updateContextActions(ProjectExplorer::Node*,ProjectExplorer::Project*))); this, SLOT(updateContextActions(ProjectExplorer::Node*,ProjectExplorer::Project*)));
Core::ActionContainer *contextMenu = am->createMenu(Qt4ProjectManager::Constants::M_CONTEXT); Core::ActionContainer *contextMenu = Core::ActionManager::createMenu(Qt4ProjectManager::Constants::M_CONTEXT);
Core::Context proFileEditorContext = Core::Context(Qt4ProjectManager::Constants::C_PROFILEEDITOR); Core::Context proFileEditorContext = Core::Context(Qt4ProjectManager::Constants::C_PROFILEEDITOR);
command = am->command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR); command = Core::ActionManager::command(TextEditor::Constants::JUMP_TO_FILE_UNDER_CURSOR);
contextMenu->addAction(command); contextMenu->addAction(command);
m_addLibraryAction = new QAction(tr("Add Library..."), this); m_addLibraryAction = new QAction(tr("Add Library..."), this);
command = am->registerAction(m_addLibraryAction, command = Core::ActionManager::registerAction(m_addLibraryAction,
Constants::ADDLIBRARY, proFileEditorContext); Constants::ADDLIBRARY, proFileEditorContext);
connect(m_addLibraryAction, SIGNAL(triggered()), connect(m_addLibraryAction, SIGNAL(triggered()),
m_qt4ProjectManager, SLOT(addLibrary())); m_qt4ProjectManager, SLOT(addLibrary()));
contextMenu->addAction(command); contextMenu->addAction(command);
m_addLibraryActionContextMenu = new QAction(tr("Add Library..."), this); m_addLibraryActionContextMenu = new QAction(tr("Add Library..."), this);
command = am->registerAction(m_addLibraryActionContextMenu, command = Core::ActionManager::registerAction(m_addLibraryActionContextMenu,
Constants::ADDLIBRARY, projecTreeContext); Constants::ADDLIBRARY, projecTreeContext);
connect(m_addLibraryActionContextMenu, SIGNAL(triggered()), connect(m_addLibraryActionContextMenu, SIGNAL(triggered()),
m_qt4ProjectManager, SLOT(addLibraryContextMenu())); m_qt4ProjectManager, SLOT(addLibraryContextMenu()));
@@ -303,10 +305,10 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
QAction *separator = new QAction(this); QAction *separator = new QAction(this);
separator->setSeparator(true); separator->setSeparator(true);
contextMenu->addAction(am->registerAction(separator, contextMenu->addAction(Core::ActionManager::registerAction(separator,
Core::Id(Constants::SEPARATOR), proFileEditorContext)); Core::Id(Constants::SEPARATOR), proFileEditorContext));
command = am->command(TextEditor::Constants::UN_COMMENT_SELECTION); command = Core::ActionManager::command(TextEditor::Constants::UN_COMMENT_SELECTION);
contextMenu->addAction(command); contextMenu->addAction(command);
return true; return true;

View File

@@ -92,9 +92,8 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err
const Core::Context context(Constants::C_RESOURCEEDITOR); const Core::Context context(Constants::C_RESOURCEEDITOR);
m_undoAction = new QAction(tr("&Undo"), this); m_undoAction = new QAction(tr("&Undo"), this);
m_redoAction = new QAction(tr("&Redo"), this); m_redoAction = new QAction(tr("&Redo"), this);
Core::ActionManager * const actionManager = Core::ICore::actionManager(); Core::ActionManager::registerAction(m_undoAction, Core::Constants::UNDO, context);
actionManager->registerAction(m_undoAction, Core::Constants::UNDO, context); Core::ActionManager::registerAction(m_redoAction, Core::Constants::REDO, context);
actionManager->registerAction(m_redoAction, Core::Constants::REDO, context);
connect(m_undoAction, SIGNAL(triggered()), this, SLOT(onUndo())); connect(m_undoAction, SIGNAL(triggered()), this, SLOT(onUndo()));
connect(m_redoAction, SIGNAL(triggered()), this, SLOT(onRedo())); connect(m_redoAction, SIGNAL(triggered()), this, SLOT(onRedo()));

View File

@@ -249,13 +249,12 @@ static const VcsBase::VcsBaseSubmitEditorParameters submitParameters = {
}; };
static inline Core::Command *createSeparator(QObject *parent, static inline Core::Command *createSeparator(QObject *parent,
Core::ActionManager *ami,
const char*id, const char*id,
const Core::Context &globalcontext) const Core::Context &globalcontext)
{ {
QAction *tmpaction = new QAction(parent); QAction *tmpaction = new QAction(parent);
tmpaction->setSeparator(true); tmpaction->setSeparator(true);
return ami->registerAction(tmpaction, id, globalcontext); return Core::ActionManager::registerAction(tmpaction, id, globalcontext);
} }
bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *errorMessage) bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *errorMessage)
@@ -294,11 +293,10 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
addAutoReleasedObject(m_commandLocator); addAutoReleasedObject(m_commandLocator);
//register actions //register actions
Core::ActionManager *ami = Core::ICore::actionManager(); Core::ActionContainer *toolsContainer = Core::ActionManager::actionContainer(M_TOOLS);
Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS);
Core::ActionContainer *subversionMenu = Core::ActionContainer *subversionMenu =
ami->createMenu(Core::Id(CMD_ID_SUBVERSION_MENU)); Core::ActionManager::createMenu(Core::Id(CMD_ID_SUBVERSION_MENU));
subversionMenu->menu()->setTitle(tr("&Subversion")); subversionMenu->menu()->setTitle(tr("&Subversion"));
toolsContainer->addMenu(subversionMenu); toolsContainer->addMenu(subversionMenu);
m_menuAction = subversionMenu->menu()->menuAction(); m_menuAction = subversionMenu->menu()->menuAction();
@@ -306,7 +304,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
Core::Command *command; Core::Command *command;
m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_diffCurrentAction, command = Core::ActionManager::registerAction(m_diffCurrentAction,
CMD_ID_DIFF_CURRENT, globalcontext); CMD_ID_DIFF_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+D") : tr("Alt+S,Alt+D"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+D") : tr("Alt+S,Alt+D")));
@@ -315,7 +313,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_filelogCurrentAction, command = Core::ActionManager::registerAction(m_filelogCurrentAction,
CMD_ID_FILELOG_CURRENT, globalcontext); CMD_ID_FILELOG_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_filelogCurrentAction, SIGNAL(triggered()), this, connect(m_filelogCurrentAction, SIGNAL(triggered()), this,
@@ -324,7 +322,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_annotateCurrentAction, command = Core::ActionManager::registerAction(m_annotateCurrentAction,
CMD_ID_ANNOTATE_CURRENT, globalcontext); CMD_ID_ANNOTATE_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_annotateCurrentAction, SIGNAL(triggered()), this, connect(m_annotateCurrentAction, SIGNAL(triggered()), this,
@@ -332,10 +330,10 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR0, globalcontext)); subversionMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR0, globalcontext));
m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_addAction, CMD_ID_ADD, command = Core::ActionManager::registerAction(m_addAction, CMD_ID_ADD,
globalcontext); globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+A") : tr("Alt+S,Alt+A"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+A") : tr("Alt+S,Alt+A")));
@@ -344,7 +342,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_commitCurrentAction, command = Core::ActionManager::registerAction(m_commitCurrentAction,
CMD_ID_COMMIT_CURRENT, globalcontext); CMD_ID_COMMIT_CURRENT, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+C") : tr("Alt+S,Alt+C"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+S,Meta+C") : tr("Alt+S,Alt+C")));
@@ -353,7 +351,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); m_deleteAction = new Utils::ParameterAction(tr("Delete..."), tr("Delete \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, command = Core::ActionManager::registerAction(m_deleteAction, CMD_ID_DELETE_FILE,
globalcontext); globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile())); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
@@ -361,17 +359,17 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this); m_revertAction = new Utils::ParameterAction(tr("Revert..."), tr("Revert \"%1\"..."), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_revertAction, CMD_ID_REVERT, command = Core::ActionManager::registerAction(m_revertAction, CMD_ID_REVERT,
globalcontext); globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile())); connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR1, globalcontext)); subversionMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR1, globalcontext));
m_diffProjectAction = new Utils::ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_diffProjectAction = new Utils::ParameterAction(tr("Diff Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, command = Core::ActionManager::registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT,
globalcontext); globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject())); connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject()));
@@ -379,7 +377,7 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status of Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_statusProjectAction, CMD_ID_STATUS, command = Core::ActionManager::registerAction(m_statusProjectAction, CMD_ID_STATUS,
globalcontext); globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus())); connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(projectStatus()));
@@ -387,66 +385,66 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext); command = Core::ActionManager::registerAction(m_logProjectAction, CMD_ID_PROJECTLOG, globalcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject())); connect(m_logProjectAction, SIGNAL(triggered()), this, SLOT(logProject()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_updateProjectAction = new Utils::ParameterAction(tr("Update Project"), tr("Update Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext); command = Core::ActionManager::registerAction(m_updateProjectAction, CMD_ID_UPDATE, globalcontext);
connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject())); connect(m_updateProjectAction, SIGNAL(triggered()), this, SLOT(updateProject()));
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_commitProjectAction = new Utils::ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); m_commitProjectAction = new Utils::ParameterAction(tr("Commit Project"), tr("Commit Project \"%1\""), Utils::ParameterAction::EnabledWithParameter, this);
command = ami->registerAction(m_commitProjectAction, CMD_ID_COMMIT_PROJECT, globalcontext); command = Core::ActionManager::registerAction(m_commitProjectAction, CMD_ID_COMMIT_PROJECT, globalcontext);
connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(startCommitProject())); connect(m_commitProjectAction, SIGNAL(triggered()), this, SLOT(startCommitProject()));
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext)); subversionMenu->addAction(createSeparator(this, CMD_ID_SEPARATOR2, globalcontext));
m_diffRepositoryAction = new QAction(tr("Diff Repository"), this); m_diffRepositoryAction = new QAction(tr("Diff Repository"), this);
command = ami->registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext); command = Core::ActionManager::registerAction(m_diffRepositoryAction, CMD_ID_REPOSITORYDIFF, globalcontext);
connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository())); connect(m_diffRepositoryAction, SIGNAL(triggered()), this, SLOT(diffRepository()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_statusRepositoryAction = new QAction(tr("Repository Status"), this); m_statusRepositoryAction = new QAction(tr("Repository Status"), this);
command = ami->registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext); command = Core::ActionManager::registerAction(m_statusRepositoryAction, CMD_ID_REPOSITORYSTATUS, globalcontext);
connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository())); connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_logRepositoryAction = new QAction(tr("Log Repository"), this); m_logRepositoryAction = new QAction(tr("Log Repository"), this);
command = ami->registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext); command = Core::ActionManager::registerAction(m_logRepositoryAction, CMD_ID_REPOSITORYLOG, globalcontext);
connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository())); connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_updateRepositoryAction = new QAction(tr("Update Repository"), this); m_updateRepositoryAction = new QAction(tr("Update Repository"), this);
command = ami->registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext); command = Core::ActionManager::registerAction(m_updateRepositoryAction, CMD_ID_REPOSITORYUPDATE, globalcontext);
connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository())); connect(m_updateRepositoryAction, SIGNAL(triggered()), this, SLOT(updateRepository()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_commitAllAction = new QAction(tr("Commit All Files"), this); m_commitAllAction = new QAction(tr("Commit All Files"), this);
command = ami->registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL, command = Core::ActionManager::registerAction(m_commitAllAction, CMD_ID_COMMIT_ALL,
globalcontext); globalcontext);
connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll())); connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_commandLocator->appendCommand(command); m_commandLocator->appendCommand(command);
m_describeAction = new QAction(tr("Describe..."), this); m_describeAction = new QAction(tr("Describe..."), this);
command = ami->registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext); command = Core::ActionManager::registerAction(m_describeAction, CMD_ID_DESCRIBE, globalcontext);
connect(m_describeAction, SIGNAL(triggered()), this, SLOT(slotDescribe())); connect(m_describeAction, SIGNAL(triggered()), this, SLOT(slotDescribe()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this); m_revertRepositoryAction = new QAction(tr("Revert Repository..."), this);
command = ami->registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL, command = Core::ActionManager::registerAction(m_revertRepositoryAction, CMD_ID_REVERT_ALL,
globalcontext); globalcontext);
connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll())); connect(m_revertRepositoryAction, SIGNAL(triggered()), this, SLOT(revertAll()));
subversionMenu->addAction(command); subversionMenu->addAction(command);
@@ -456,18 +454,18 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments */, QString *e
Core::Context svncommitcontext(Constants::SUBVERSIONCOMMITEDITOR); Core::Context svncommitcontext(Constants::SUBVERSIONCOMMITEDITOR);
m_submitCurrentLogAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this); m_submitCurrentLogAction = new QAction(VcsBase::VcsBaseSubmitEditor::submitIcon(), tr("Commit"), this);
command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext); command = Core::ActionManager::registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext);
command->setAttribute(Core::Command::CA_UpdateText); command->setAttribute(Core::Command::CA_UpdateText);
connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog())); connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
m_submitDiffAction = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this); m_submitDiffAction = new QAction(VcsBase::VcsBaseSubmitEditor::diffIcon(), tr("Diff &Selected Files"), this);
command = ami->registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, svncommitcontext); command = Core::ActionManager::registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, svncommitcontext);
m_submitUndoAction = new QAction(tr("&Undo"), this); m_submitUndoAction = new QAction(tr("&Undo"), this);
command = ami->registerAction(m_submitUndoAction, Core::Constants::UNDO, svncommitcontext); command = Core::ActionManager::registerAction(m_submitUndoAction, Core::Constants::UNDO, svncommitcontext);
m_submitRedoAction = new QAction(tr("&Redo"), this); m_submitRedoAction = new QAction(tr("&Redo"), this);
command = ami->registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext); command = Core::ActionManager::registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext);
return true; return true;
} }

View File

@@ -6083,24 +6083,23 @@ QMimeData *BaseTextEditorWidget::duplicateMimeData(const QMimeData *source) cons
void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu) void BaseTextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
{ {
menu->addSeparator(); menu->addSeparator();
Core::ActionManager *am = Core::ICore::actionManager();
QAction *a = am->command(Core::Constants::CUT)->action(); QAction *a = Core::ActionManager::command(Core::Constants::CUT)->action();
if (a && a->isEnabled()) if (a && a->isEnabled())
menu->addAction(a); menu->addAction(a);
a = am->command(Core::Constants::COPY)->action(); a = Core::ActionManager::command(Core::Constants::COPY)->action();
if (a && a->isEnabled()) if (a && a->isEnabled())
menu->addAction(a); menu->addAction(a);
a = am->command(Core::Constants::PASTE)->action(); a = Core::ActionManager::command(Core::Constants::PASTE)->action();
if (a && a->isEnabled()) if (a && a->isEnabled())
menu->addAction(a); menu->addAction(a);
a = am->command(Constants::CIRCULAR_PASTE)->action(); a = Core::ActionManager::command(Constants::CIRCULAR_PASTE)->action();
if (a && a->isEnabled()) if (a && a->isEnabled())
menu->addAction(a); menu->addAction(a);
BaseTextDocument *doc = baseTextDocument(); BaseTextDocument *doc = baseTextDocument();
if (doc->codec()->name() == QString(QLatin1String("UTF-8"))) { if (doc->codec()->name() == QString(QLatin1String("UTF-8"))) {
a = am->command(Constants::SWITCH_UTF8BOM)->action(); a = Core::ActionManager::command(Constants::SWITCH_UTF8BOM)->action();
if (a && a->isEnabled()) { if (a && a->isEnabled()) {
a->setText(doc->format().hasUtf8Bom ? tr("Delete UTF-8 BOM on Save") a->setText(doc->format().hasUtf8Bom ? tr("Delete UTF-8 BOM on Save")
: tr("Add UTF-8 BOM on Save")); : tr("Add UTF-8 BOM on Save"));

View File

@@ -152,27 +152,25 @@ void TextEditorActionHandler::createActions()
m_gotoAction = registerNewAction(Core::Constants::GOTO, this, SLOT(gotoAction())); m_gotoAction = registerNewAction(Core::Constants::GOTO, this, SLOT(gotoAction()));
m_printAction = registerNewAction(Core::Constants::PRINT, this, SLOT(printAction())); m_printAction = registerNewAction(Core::Constants::PRINT, this, SLOT(printAction()));
Core::ActionManager *am = Core::ICore::actionManager(); Core::ActionContainer *medit = Core::ActionManager::actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *advancedMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED);
Core::ActionContainer *medit = am->actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *advancedMenu = am->actionContainer(Core::Constants::M_EDIT_ADVANCED);
m_selectEncodingAction = new QAction(tr("Select Encoding..."), this); m_selectEncodingAction = new QAction(tr("Select Encoding..."), this);
Core::Command *command = am->registerAction(m_selectEncodingAction, Constants::SELECT_ENCODING, m_contextId); Core::Command *command = Core::ActionManager::registerAction(m_selectEncodingAction, Constants::SELECT_ENCODING, m_contextId);
connect(m_selectEncodingAction, SIGNAL(triggered()), this, SLOT(selectEncoding())); connect(m_selectEncodingAction, SIGNAL(triggered()), this, SLOT(selectEncoding()));
medit->addAction(command, Core::Constants::G_EDIT_OTHER); medit->addAction(command, Core::Constants::G_EDIT_OTHER);
m_formatAction = new QAction(tr("Auto-&indent Selection"), this); m_formatAction = new QAction(tr("Auto-&indent Selection"), this);
m_modifyingActions << m_formatAction; m_modifyingActions << m_formatAction;
command = am->registerAction(m_formatAction, TextEditor::Constants::AUTO_INDENT_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(m_formatAction, TextEditor::Constants::AUTO_INDENT_SELECTION, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+I"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+I")));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT);
connect(m_formatAction, SIGNAL(triggered(bool)), this, SLOT(formatAction())); connect(m_formatAction, SIGNAL(triggered(bool)), this, SLOT(formatAction()));
m_rewrapParagraphAction = new QAction(tr("&Rewrap Paragraph"), this); m_rewrapParagraphAction = new QAction(tr("&Rewrap Paragraph"), this);
m_modifyingActions << m_rewrapParagraphAction; m_modifyingActions << m_rewrapParagraphAction;
command = am->registerAction(m_rewrapParagraphAction, TextEditor::Constants::REWRAP_PARAGRAPH, m_contextId, true); command = Core::ActionManager::registerAction(m_rewrapParagraphAction, TextEditor::Constants::REWRAP_PARAGRAPH, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, R") : tr("Ctrl+E, R"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, R") : tr("Ctrl+E, R")));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT);
connect(m_rewrapParagraphAction, SIGNAL(triggered(bool)), this, SLOT(rewrapParagraphAction())); connect(m_rewrapParagraphAction, SIGNAL(triggered(bool)), this, SLOT(rewrapParagraphAction()));
@@ -180,7 +178,7 @@ void TextEditorActionHandler::createActions()
m_visualizeWhitespaceAction = new QAction(tr("&Visualize Whitespace"), this); m_visualizeWhitespaceAction = new QAction(tr("&Visualize Whitespace"), this);
m_visualizeWhitespaceAction->setCheckable(true); m_visualizeWhitespaceAction->setCheckable(true);
command = am->registerAction(m_visualizeWhitespaceAction, command = Core::ActionManager::registerAction(m_visualizeWhitespaceAction,
TextEditor::Constants::VISUALIZE_WHITESPACE, m_contextId); TextEditor::Constants::VISUALIZE_WHITESPACE, m_contextId);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, Meta+V") : tr("Ctrl+E, Ctrl+V"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, Meta+V") : tr("Ctrl+E, Ctrl+V")));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT);
@@ -188,7 +186,7 @@ void TextEditorActionHandler::createActions()
m_cleanWhitespaceAction = new QAction(tr("Clean Whitespace"), this); m_cleanWhitespaceAction = new QAction(tr("Clean Whitespace"), this);
m_modifyingActions << m_cleanWhitespaceAction; m_modifyingActions << m_cleanWhitespaceAction;
command = am->registerAction(m_cleanWhitespaceAction, command = Core::ActionManager::registerAction(m_cleanWhitespaceAction,
TextEditor::Constants::CLEAN_WHITESPACE, m_contextId, true); TextEditor::Constants::CLEAN_WHITESPACE, m_contextId, true);
advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT);
@@ -196,7 +194,7 @@ void TextEditorActionHandler::createActions()
m_textWrappingAction = new QAction(tr("Enable Text &Wrapping"), this); m_textWrappingAction = new QAction(tr("Enable Text &Wrapping"), this);
m_textWrappingAction->setCheckable(true); m_textWrappingAction->setCheckable(true);
command = am->registerAction(m_textWrappingAction, TextEditor::Constants::TEXT_WRAPPING, m_contextId); command = Core::ActionManager::registerAction(m_textWrappingAction, TextEditor::Constants::TEXT_WRAPPING, m_contextId);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, Meta+W") : tr("Ctrl+E, Ctrl+W"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+E, Meta+W") : tr("Ctrl+E, Ctrl+W")));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT);
connect(m_textWrappingAction, SIGNAL(triggered(bool)), this, SLOT(setTextWrapping(bool))); connect(m_textWrappingAction, SIGNAL(triggered(bool)), this, SLOT(setTextWrapping(bool)));
@@ -204,262 +202,262 @@ void TextEditorActionHandler::createActions()
m_unCommentSelectionAction = new QAction(tr("Toggle Comment &Selection"), this); m_unCommentSelectionAction = new QAction(tr("Toggle Comment &Selection"), this);
m_modifyingActions << m_unCommentSelectionAction; m_modifyingActions << m_unCommentSelectionAction;
command = am->registerAction(m_unCommentSelectionAction, Constants::UN_COMMENT_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(m_unCommentSelectionAction, Constants::UN_COMMENT_SELECTION, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+/"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+/")));
connect(m_unCommentSelectionAction, SIGNAL(triggered()), this, SLOT(unCommentSelection())); connect(m_unCommentSelectionAction, SIGNAL(triggered()), this, SLOT(unCommentSelection()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FORMAT);
m_cutLineAction = new QAction(tr("Cut &Line"), this); m_cutLineAction = new QAction(tr("Cut &Line"), this);
m_modifyingActions << m_cutLineAction; m_modifyingActions << m_cutLineAction;
command = am->registerAction(m_cutLineAction, Constants::CUT_LINE, m_contextId, true); command = Core::ActionManager::registerAction(m_cutLineAction, Constants::CUT_LINE, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Shift+Del"))); command->setDefaultKeySequence(QKeySequence(tr("Shift+Del")));
connect(m_cutLineAction, SIGNAL(triggered()), this, SLOT(cutLine())); connect(m_cutLineAction, SIGNAL(triggered()), this, SLOT(cutLine()));
m_copyLineAction = new QAction(tr("Copy &Line"), this); m_copyLineAction = new QAction(tr("Copy &Line"), this);
command = am->registerAction(m_copyLineAction, Constants::COPY_LINE, m_contextId); command = Core::ActionManager::registerAction(m_copyLineAction, Constants::COPY_LINE, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Ins"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Ins")));
connect(m_copyLineAction, SIGNAL(triggered()), this, SLOT(copyLine())); connect(m_copyLineAction, SIGNAL(triggered()), this, SLOT(copyLine()));
m_deleteLineAction = new QAction(tr("Delete &Line"), this); m_deleteLineAction = new QAction(tr("Delete &Line"), this);
m_modifyingActions << m_deleteLineAction; m_modifyingActions << m_deleteLineAction;
command = am->registerAction(m_deleteLineAction, Constants::DELETE_LINE, m_contextId, true); command = Core::ActionManager::registerAction(m_deleteLineAction, Constants::DELETE_LINE, m_contextId, true);
connect(m_deleteLineAction, SIGNAL(triggered()), this, SLOT(deleteLine())); connect(m_deleteLineAction, SIGNAL(triggered()), this, SLOT(deleteLine()));
m_deleteEndOfWordAction = new QAction(tr("Delete Word from Cursor On"), this); m_deleteEndOfWordAction = new QAction(tr("Delete Word from Cursor On"), this);
m_modifyingActions << m_deleteEndOfWordAction; m_modifyingActions << m_deleteEndOfWordAction;
am->registerAction(m_deleteEndOfWordAction, Constants::DELETE_END_OF_WORD, m_contextId, true); Core::ActionManager::registerAction(m_deleteEndOfWordAction, Constants::DELETE_END_OF_WORD, m_contextId, true);
connect(m_deleteEndOfWordAction, SIGNAL(triggered()), this, SLOT(deleteEndOfWord())); connect(m_deleteEndOfWordAction, SIGNAL(triggered()), this, SLOT(deleteEndOfWord()));
m_deleteEndOfWordCamelCaseAction = new QAction(tr("Delete Word Camel Case from Cursor On"), this); m_deleteEndOfWordCamelCaseAction = new QAction(tr("Delete Word Camel Case from Cursor On"), this);
m_modifyingActions << m_deleteEndOfWordCamelCaseAction; m_modifyingActions << m_deleteEndOfWordCamelCaseAction;
am->registerAction(m_deleteEndOfWordCamelCaseAction, Constants::DELETE_END_OF_WORD_CAMEL_CASE, m_contextId, true); Core::ActionManager::registerAction(m_deleteEndOfWordCamelCaseAction, Constants::DELETE_END_OF_WORD_CAMEL_CASE, m_contextId, true);
connect(m_deleteEndOfWordCamelCaseAction, SIGNAL(triggered()), this, SLOT(deleteEndOfWordCamelCase())); connect(m_deleteEndOfWordCamelCaseAction, SIGNAL(triggered()), this, SLOT(deleteEndOfWordCamelCase()));
m_deleteStartOfWordAction = new QAction(tr("Delete Word up to Cursor"), this); m_deleteStartOfWordAction = new QAction(tr("Delete Word up to Cursor"), this);
m_modifyingActions << m_deleteStartOfWordAction; m_modifyingActions << m_deleteStartOfWordAction;
am->registerAction(m_deleteStartOfWordAction, Constants::DELETE_START_OF_WORD, m_contextId, true); Core::ActionManager::registerAction(m_deleteStartOfWordAction, Constants::DELETE_START_OF_WORD, m_contextId, true);
connect(m_deleteStartOfWordAction, SIGNAL(triggered()), this, SLOT(deleteStartOfWord())); connect(m_deleteStartOfWordAction, SIGNAL(triggered()), this, SLOT(deleteStartOfWord()));
m_deleteStartOfWordCamelCaseAction = new QAction(tr("Delete Word Camel Case up to Cursor"), this); m_deleteStartOfWordCamelCaseAction = new QAction(tr("Delete Word Camel Case up to Cursor"), this);
m_modifyingActions << m_deleteStartOfWordCamelCaseAction; m_modifyingActions << m_deleteStartOfWordCamelCaseAction;
am->registerAction(m_deleteStartOfWordCamelCaseAction, Constants::DELETE_START_OF_WORD_CAMEL_CASE, m_contextId, true); Core::ActionManager::registerAction(m_deleteStartOfWordCamelCaseAction, Constants::DELETE_START_OF_WORD_CAMEL_CASE, m_contextId, true);
connect(m_deleteStartOfWordCamelCaseAction, SIGNAL(triggered()), this, SLOT(deleteStartOfWordCamelCase())); connect(m_deleteStartOfWordCamelCaseAction, SIGNAL(triggered()), this, SLOT(deleteStartOfWordCamelCase()));
m_foldAction = new QAction(tr("Fold"), this); m_foldAction = new QAction(tr("Fold"), this);
command = am->registerAction(m_foldAction, Constants::FOLD, m_contextId, true); command = Core::ActionManager::registerAction(m_foldAction, Constants::FOLD, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+<"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+<")));
connect(m_foldAction, SIGNAL(triggered()), this, SLOT(fold())); connect(m_foldAction, SIGNAL(triggered()), this, SLOT(fold()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING); advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING);
m_unfoldAction = new QAction(tr("Unfold"), this); m_unfoldAction = new QAction(tr("Unfold"), this);
command = am->registerAction(m_unfoldAction, Constants::UNFOLD, m_contextId, true); command = Core::ActionManager::registerAction(m_unfoldAction, Constants::UNFOLD, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+>"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+>")));
connect(m_unfoldAction, SIGNAL(triggered()), this, SLOT(unfold())); connect(m_unfoldAction, SIGNAL(triggered()), this, SLOT(unfold()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING); advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING);
m_unfoldAllAction = new QAction(tr("Toggle &Fold All"), this); m_unfoldAllAction = new QAction(tr("Toggle &Fold All"), this);
command = am->registerAction(m_unfoldAllAction, Constants::UNFOLD_ALL, m_contextId, true); command = Core::ActionManager::registerAction(m_unfoldAllAction, Constants::UNFOLD_ALL, m_contextId, true);
connect(m_unfoldAllAction, SIGNAL(triggered()), this, SLOT(unfoldAll())); connect(m_unfoldAllAction, SIGNAL(triggered()), this, SLOT(unfoldAll()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING); advancedMenu->addAction(command, Core::Constants::G_EDIT_COLLAPSING);
m_increaseFontSizeAction = new QAction(tr("Increase Font Size"), this); m_increaseFontSizeAction = new QAction(tr("Increase Font Size"), this);
command = am->registerAction(m_increaseFontSizeAction, Constants::INCREASE_FONT_SIZE, m_contextId); command = Core::ActionManager::registerAction(m_increaseFontSizeAction, Constants::INCREASE_FONT_SIZE, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl++"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl++")));
connect(m_increaseFontSizeAction, SIGNAL(triggered()), this, SLOT(increaseFontSize())); connect(m_increaseFontSizeAction, SIGNAL(triggered()), this, SLOT(increaseFontSize()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT);
m_decreaseFontSizeAction = new QAction(tr("Decrease Font Size"), this); m_decreaseFontSizeAction = new QAction(tr("Decrease Font Size"), this);
command = am->registerAction(m_decreaseFontSizeAction, Constants::DECREASE_FONT_SIZE, m_contextId); command = Core::ActionManager::registerAction(m_decreaseFontSizeAction, Constants::DECREASE_FONT_SIZE, m_contextId);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+-"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+-")));
connect(m_decreaseFontSizeAction, SIGNAL(triggered()), this, SLOT(decreaseFontSize())); connect(m_decreaseFontSizeAction, SIGNAL(triggered()), this, SLOT(decreaseFontSize()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT);
m_resetFontSizeAction = new QAction(tr("Reset Font Size"), this); m_resetFontSizeAction = new QAction(tr("Reset Font Size"), this);
command = am->registerAction(m_resetFontSizeAction, Constants::RESET_FONT_SIZE, m_contextId); command = Core::ActionManager::registerAction(m_resetFontSizeAction, Constants::RESET_FONT_SIZE, m_contextId);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? QString() : tr("Ctrl+0"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? QString() : tr("Ctrl+0")));
connect(m_resetFontSizeAction, SIGNAL(triggered()), this, SLOT(resetFontSize())); connect(m_resetFontSizeAction, SIGNAL(triggered()), this, SLOT(resetFontSize()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT); advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT);
m_gotoBlockStartAction = new QAction(tr("Go to Block Start"), this); m_gotoBlockStartAction = new QAction(tr("Go to Block Start"), this);
command = am->registerAction(m_gotoBlockStartAction, Constants::GOTO_BLOCK_START, m_contextId, true); command = Core::ActionManager::registerAction(m_gotoBlockStartAction, Constants::GOTO_BLOCK_START, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+["))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+[")));
connect(m_gotoBlockStartAction, SIGNAL(triggered()), this, SLOT(gotoBlockStart())); connect(m_gotoBlockStartAction, SIGNAL(triggered()), this, SLOT(gotoBlockStart()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS);
m_gotoBlockEndAction = new QAction(tr("Go to Block End"), this); m_gotoBlockEndAction = new QAction(tr("Go to Block End"), this);
command = am->registerAction(m_gotoBlockEndAction, Constants::GOTO_BLOCK_END, m_contextId, true); command = Core::ActionManager::registerAction(m_gotoBlockEndAction, Constants::GOTO_BLOCK_END, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+]"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+]")));
connect(m_gotoBlockEndAction, SIGNAL(triggered()), this, SLOT(gotoBlockEnd())); connect(m_gotoBlockEndAction, SIGNAL(triggered()), this, SLOT(gotoBlockEnd()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS);
m_gotoBlockStartWithSelectionAction = new QAction(tr("Go to Block Start with Selection"), this); m_gotoBlockStartWithSelectionAction = new QAction(tr("Go to Block Start with Selection"), this);
command = am->registerAction(m_gotoBlockStartWithSelectionAction, Constants::GOTO_BLOCK_START_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(m_gotoBlockStartWithSelectionAction, Constants::GOTO_BLOCK_START_WITH_SELECTION, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+{"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+{")));
connect(m_gotoBlockStartWithSelectionAction, SIGNAL(triggered()), this, SLOT(gotoBlockStartWithSelection())); connect(m_gotoBlockStartWithSelectionAction, SIGNAL(triggered()), this, SLOT(gotoBlockStartWithSelection()));
m_gotoBlockEndWithSelectionAction = new QAction(tr("Go to Block End with Selection"), this); m_gotoBlockEndWithSelectionAction = new QAction(tr("Go to Block End with Selection"), this);
command = am->registerAction(m_gotoBlockEndWithSelectionAction, Constants::GOTO_BLOCK_END_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(m_gotoBlockEndWithSelectionAction, Constants::GOTO_BLOCK_END_WITH_SELECTION, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+}"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+}")));
connect(m_gotoBlockEndWithSelectionAction, SIGNAL(triggered()), this, SLOT(gotoBlockEndWithSelection())); connect(m_gotoBlockEndWithSelectionAction, SIGNAL(triggered()), this, SLOT(gotoBlockEndWithSelection()));
m_selectBlockUpAction = new QAction(tr("Select Block Up"), this); m_selectBlockUpAction = new QAction(tr("Select Block Up"), this);
command = am->registerAction(m_selectBlockUpAction, Constants::SELECT_BLOCK_UP, m_contextId, true); command = Core::ActionManager::registerAction(m_selectBlockUpAction, Constants::SELECT_BLOCK_UP, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+U"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+U")));
connect(m_selectBlockUpAction, SIGNAL(triggered()), this, SLOT(selectBlockUp())); connect(m_selectBlockUpAction, SIGNAL(triggered()), this, SLOT(selectBlockUp()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS);
m_selectBlockDownAction = new QAction(tr("Select Block Down"), this); m_selectBlockDownAction = new QAction(tr("Select Block Down"), this);
command = am->registerAction(m_selectBlockDownAction, Constants::SELECT_BLOCK_DOWN, m_contextId, true); command = Core::ActionManager::registerAction(m_selectBlockDownAction, Constants::SELECT_BLOCK_DOWN, m_contextId, true);
connect(m_selectBlockDownAction, SIGNAL(triggered()), this, SLOT(selectBlockDown())); connect(m_selectBlockDownAction, SIGNAL(triggered()), this, SLOT(selectBlockDown()));
advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS); advancedMenu->addAction(command, Core::Constants::G_EDIT_BLOCKS);
m_moveLineUpAction = new QAction(tr("Move Line Up"), this); m_moveLineUpAction = new QAction(tr("Move Line Up"), this);
m_modifyingActions << m_moveLineUpAction; m_modifyingActions << m_moveLineUpAction;
command = am->registerAction(m_moveLineUpAction, Constants::MOVE_LINE_UP, m_contextId, true); command = Core::ActionManager::registerAction(m_moveLineUpAction, Constants::MOVE_LINE_UP, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Up"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Up")));
connect(m_moveLineUpAction, SIGNAL(triggered()), this, SLOT(moveLineUp())); connect(m_moveLineUpAction, SIGNAL(triggered()), this, SLOT(moveLineUp()));
m_moveLineDownAction = new QAction(tr("Move Line Down"), this); m_moveLineDownAction = new QAction(tr("Move Line Down"), this);
m_modifyingActions << m_moveLineDownAction; m_modifyingActions << m_moveLineDownAction;
command = am->registerAction(m_moveLineDownAction, Constants::MOVE_LINE_DOWN, m_contextId, true); command = Core::ActionManager::registerAction(m_moveLineDownAction, Constants::MOVE_LINE_DOWN, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Down"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Down")));
connect(m_moveLineDownAction, SIGNAL(triggered()), this, SLOT(moveLineDown())); connect(m_moveLineDownAction, SIGNAL(triggered()), this, SLOT(moveLineDown()));
m_copyLineUpAction = new QAction(tr("Copy Line Up"), this); m_copyLineUpAction = new QAction(tr("Copy Line Up"), this);
m_modifyingActions << m_copyLineUpAction; m_modifyingActions << m_copyLineUpAction;
command = am->registerAction(m_copyLineUpAction, Constants::COPY_LINE_UP, m_contextId, true); command = Core::ActionManager::registerAction(m_copyLineUpAction, Constants::COPY_LINE_UP, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Up"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Up")));
connect(m_copyLineUpAction, SIGNAL(triggered()), this, SLOT(copyLineUp())); connect(m_copyLineUpAction, SIGNAL(triggered()), this, SLOT(copyLineUp()));
m_copyLineDownAction = new QAction(tr("Copy Line Down"), this); m_copyLineDownAction = new QAction(tr("Copy Line Down"), this);
m_modifyingActions << m_copyLineDownAction; m_modifyingActions << m_copyLineDownAction;
command = am->registerAction(m_copyLineDownAction, Constants::COPY_LINE_DOWN, m_contextId, true); command = Core::ActionManager::registerAction(m_copyLineDownAction, Constants::COPY_LINE_DOWN, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Down"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Down")));
connect(m_copyLineDownAction, SIGNAL(triggered()), this, SLOT(copyLineDown())); connect(m_copyLineDownAction, SIGNAL(triggered()), this, SLOT(copyLineDown()));
m_joinLinesAction = new QAction(tr("Join Lines"), this); m_joinLinesAction = new QAction(tr("Join Lines"), this);
m_modifyingActions << m_joinLinesAction; m_modifyingActions << m_joinLinesAction;
command = am->registerAction(m_joinLinesAction, Constants::JOIN_LINES, m_contextId, true); command = Core::ActionManager::registerAction(m_joinLinesAction, Constants::JOIN_LINES, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+J"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+J")));
connect(m_joinLinesAction, SIGNAL(triggered()), this, SLOT(joinLines())); connect(m_joinLinesAction, SIGNAL(triggered()), this, SLOT(joinLines()));
m_insertLineAboveAction = new QAction(tr("Insert Line Above Current Line"), this); m_insertLineAboveAction = new QAction(tr("Insert Line Above Current Line"), this);
m_modifyingActions << m_insertLineAboveAction; m_modifyingActions << m_insertLineAboveAction;
command = am->registerAction(m_insertLineAboveAction, Constants::INSERT_LINE_ABOVE, m_contextId, true); command = Core::ActionManager::registerAction(m_insertLineAboveAction, Constants::INSERT_LINE_ABOVE, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Return"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+Return")));
connect(m_insertLineAboveAction, SIGNAL(triggered()), this, SLOT(insertLineAbove())); connect(m_insertLineAboveAction, SIGNAL(triggered()), this, SLOT(insertLineAbove()));
m_insertLineBelowAction = new QAction(tr("Insert Line Below Current Line"), this); m_insertLineBelowAction = new QAction(tr("Insert Line Below Current Line"), this);
m_modifyingActions << m_insertLineBelowAction; m_modifyingActions << m_insertLineBelowAction;
command = am->registerAction(m_insertLineBelowAction, Constants::INSERT_LINE_BELOW, m_contextId, true); command = Core::ActionManager::registerAction(m_insertLineBelowAction, Constants::INSERT_LINE_BELOW, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Return"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Return")));
connect(m_insertLineBelowAction, SIGNAL(triggered()), this, SLOT(insertLineBelow())); connect(m_insertLineBelowAction, SIGNAL(triggered()), this, SLOT(insertLineBelow()));
m_upperCaseSelectionAction = new QAction(tr("Uppercase Selection"), this); m_upperCaseSelectionAction = new QAction(tr("Uppercase Selection"), this);
m_modifyingActions << m_upperCaseSelectionAction; m_modifyingActions << m_upperCaseSelectionAction;
command = am->registerAction(m_upperCaseSelectionAction, Constants::UPPERCASE_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(m_upperCaseSelectionAction, Constants::UPPERCASE_SELECTION, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+U") : tr("Alt+Shift+U"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Shift+U") : tr("Alt+Shift+U")));
connect(m_upperCaseSelectionAction, SIGNAL(triggered()), this, SLOT(uppercaseSelection())); connect(m_upperCaseSelectionAction, SIGNAL(triggered()), this, SLOT(uppercaseSelection()));
m_lowerCaseSelectionAction = new QAction(tr("Lowercase Selection"), this); m_lowerCaseSelectionAction = new QAction(tr("Lowercase Selection"), this);
m_modifyingActions << m_lowerCaseSelectionAction; m_modifyingActions << m_lowerCaseSelectionAction;
command = am->registerAction(m_lowerCaseSelectionAction, Constants::LOWERCASE_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(m_lowerCaseSelectionAction, Constants::LOWERCASE_SELECTION, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+U") : tr("Alt+U"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+U") : tr("Alt+U")));
connect(m_lowerCaseSelectionAction, SIGNAL(triggered()), this, SLOT(lowercaseSelection())); connect(m_lowerCaseSelectionAction, SIGNAL(triggered()), this, SLOT(lowercaseSelection()));
m_circularPasteAction = new QAction(tr("Paste from Clipboard History"), this); m_circularPasteAction = new QAction(tr("Paste from Clipboard History"), this);
m_modifyingActions << m_circularPasteAction; m_modifyingActions << m_circularPasteAction;
command = am->registerAction(m_circularPasteAction, Constants::CIRCULAR_PASTE, m_contextId, true); command = Core::ActionManager::registerAction(m_circularPasteAction, Constants::CIRCULAR_PASTE, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+V"))); command->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+V")));
connect(m_circularPasteAction, SIGNAL(triggered()), this, SLOT(circularPasteAction())); connect(m_circularPasteAction, SIGNAL(triggered()), this, SLOT(circularPasteAction()));
medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE); medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
m_switchUtf8bomAction = new QAction(this); m_switchUtf8bomAction = new QAction(this);
m_modifyingActions << m_switchUtf8bomAction; m_modifyingActions << m_switchUtf8bomAction;
command = am->registerAction(m_switchUtf8bomAction, Constants::SWITCH_UTF8BOM, m_contextId, true); command = Core::ActionManager::registerAction(m_switchUtf8bomAction, Constants::SWITCH_UTF8BOM, m_contextId, true);
connect(m_switchUtf8bomAction, SIGNAL(triggered()), this, SLOT(switchUtf8bomAction())); connect(m_switchUtf8bomAction, SIGNAL(triggered()), this, SLOT(switchUtf8bomAction()));
m_indentAction = new QAction(tr("Indent"), this); m_indentAction = new QAction(tr("Indent"), this);
m_modifyingActions << m_indentAction; m_modifyingActions << m_indentAction;
command = am->registerAction(m_indentAction, Constants::INDENT, m_contextId, true); command = Core::ActionManager::registerAction(m_indentAction, Constants::INDENT, m_contextId, true);
connect(m_indentAction, SIGNAL(triggered()), this, SLOT(indent())); connect(m_indentAction, SIGNAL(triggered()), this, SLOT(indent()));
m_unindentAction = new QAction(tr("Unindent"), this); m_unindentAction = new QAction(tr("Unindent"), this);
m_modifyingActions << m_unindentAction; m_modifyingActions << m_unindentAction;
command = am->registerAction(m_unindentAction, Constants::UNINDENT, m_contextId, true); command = Core::ActionManager::registerAction(m_unindentAction, Constants::UNINDENT, m_contextId, true);
connect(m_unindentAction, SIGNAL(triggered()), this, SLOT(unindent())); connect(m_unindentAction, SIGNAL(triggered()), this, SLOT(unindent()));
m_followSymbolAction = new QAction(tr("Follow Symbol Under Cursor"), this); m_followSymbolAction = new QAction(tr("Follow Symbol Under Cursor"), this);
command = am->registerAction(m_followSymbolAction, Constants::FOLLOW_SYMBOL_UNDER_CURSOR, m_contextId, true); command = Core::ActionManager::registerAction(m_followSymbolAction, Constants::FOLLOW_SYMBOL_UNDER_CURSOR, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(Qt::Key_F2)); command->setDefaultKeySequence(QKeySequence(Qt::Key_F2));
connect(m_followSymbolAction, SIGNAL(triggered()), this, SLOT(openLinkUnderCursor())); connect(m_followSymbolAction, SIGNAL(triggered()), this, SLOT(openLinkUnderCursor()));
m_jumpToFileAction = new QAction(tr("Jump To File Under Cursor"), this); m_jumpToFileAction = new QAction(tr("Jump To File Under Cursor"), this);
command = am->registerAction(m_jumpToFileAction, Constants::JUMP_TO_FILE_UNDER_CURSOR, m_contextId, true); command = Core::ActionManager::registerAction(m_jumpToFileAction, Constants::JUMP_TO_FILE_UNDER_CURSOR, m_contextId, true);
command->setDefaultKeySequence(QKeySequence(Qt::Key_F2)); command->setDefaultKeySequence(QKeySequence(Qt::Key_F2));
connect(m_jumpToFileAction, SIGNAL(triggered()), this, SLOT(openLinkUnderCursor())); connect(m_jumpToFileAction, SIGNAL(triggered()), this, SLOT(openLinkUnderCursor()));
QAction *a = 0; QAction *a = 0;
a = new QAction(tr("Go to Line Start"), this); a = new QAction(tr("Go to Line Start"), this);
command = am->registerAction(a, Constants::GOTO_LINE_START, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_LINE_START, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStart())); connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStart()));
a = new QAction(tr("Go to Line End"), this); a = new QAction(tr("Go to Line End"), this);
command = am->registerAction(a, Constants::GOTO_LINE_END, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_LINE_END, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEnd())); connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEnd()));
a = new QAction(tr("Go to Next Line"), this); a = new QAction(tr("Go to Next Line"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_LINE, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_LINE, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLine())); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLine()));
a = new QAction(tr("Go to Previous Line"), this); a = new QAction(tr("Go to Previous Line"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_LINE, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_LINE, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLine())); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLine()));
a = new QAction(tr("Go to Previous Character"), this); a = new QAction(tr("Go to Previous Character"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacter())); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacter()));
a = new QAction(tr("Go to Next Character"), this); a = new QAction(tr("Go to Next Character"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_CHARACTER, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_CHARACTER, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacter())); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacter()));
a = new QAction(tr("Go to Previous Word"), this); a = new QAction(tr("Go to Previous Word"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_WORD, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWord())); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWord()));
a = new QAction(tr("Go to Next Word"), this); a = new QAction(tr("Go to Next Word"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_WORD, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_WORD, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWord())); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWord()));
a = new QAction(tr("Go to Previous Word Camel Case"), this); a = new QAction(tr("Go to Previous Word Camel Case"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD_CAMEL_CASE, m_contextId); command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_WORD_CAMEL_CASE, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordCamelCase())); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordCamelCase()));
a = new QAction(tr("Go to Next Word Camel Case"), this); a = new QAction(tr("Go to Next Word Camel Case"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_WORD_CAMEL_CASE, m_contextId); command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_WORD_CAMEL_CASE, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordCamelCase())); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordCamelCase()));
a = new QAction(tr("Go to Line Start with Selection"), this); a = new QAction(tr("Go to Line Start with Selection"), this);
command = am->registerAction(a, Constants::GOTO_LINE_START_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_LINE_START_WITH_SELECTION, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStartWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoLineStartWithSelection()));
a = new QAction(tr("Go to Line End with Selection"), this); a = new QAction(tr("Go to Line End with Selection"), this);
command = am->registerAction(a, Constants::GOTO_LINE_END_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_LINE_END_WITH_SELECTION, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEndWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoLineEndWithSelection()));
a = new QAction(tr("Go to Next Line with Selection"), this); a = new QAction(tr("Go to Next Line with Selection"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_LINE_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_LINE_WITH_SELECTION, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLineWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextLineWithSelection()));
a = new QAction(tr("Go to Previous Line with Selection"), this); a = new QAction(tr("Go to Previous Line with Selection"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_LINE_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_LINE_WITH_SELECTION, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLineWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousLineWithSelection()));
a = new QAction(tr("Go to Previous Character with Selection"), this); a = new QAction(tr("Go to Previous Character with Selection"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_CHARACTER_WITH_SELECTION, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacterWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousCharacterWithSelection()));
a = new QAction(tr("Go to Next Character with Selection"), this); a = new QAction(tr("Go to Next Character with Selection"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_CHARACTER_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_CHARACTER_WITH_SELECTION, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacterWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextCharacterWithSelection()));
a = new QAction(tr("Go to Previous Word with Selection"), this); a = new QAction(tr("Go to Previous Word with Selection"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_WORD_WITH_SELECTION, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordWithSelection()));
a = new QAction(tr("Go to Next Word with Selection"), this); a = new QAction(tr("Go to Next Word with Selection"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_WORD_WITH_SELECTION, m_contextId, true); command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_WORD_WITH_SELECTION, m_contextId, true);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordWithSelection()));
a = new QAction(tr("Go to Previous Word Camel Case with Selection"), this); a = new QAction(tr("Go to Previous Word Camel Case with Selection"), this);
command = am->registerAction(a, Constants::GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION, m_contextId); command = Core::ActionManager::registerAction(a, Constants::GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordCamelCaseWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoPreviousWordCamelCaseWithSelection()));
a = new QAction(tr("Go to Next Word Camel Case with Selection"), this); a = new QAction(tr("Go to Next Word Camel Case with Selection"), this);
command = am->registerAction(a, Constants::GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION, m_contextId); command = Core::ActionManager::registerAction(a, Constants::GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION, m_contextId);
connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordCamelCaseWithSelection())); connect(a, SIGNAL(triggered()), this, SLOT(gotoNextWordCamelCaseWithSelection()));
} }
@@ -475,7 +473,7 @@ QAction *TextEditorActionHandler::registerNewAction(const Core::Id &id, bool scr
return 0; return 0;
QAction *result = new QAction(title, this); QAction *result = new QAction(title, this);
Core::ICore::actionManager()->registerAction(result, id, m_contextId, scriptable); Core::ActionManager::registerAction(result, id, m_contextId, scriptable);
return result; return result;
} }

View File

@@ -181,14 +181,13 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
addAutoReleasedObject(m_lineNumberFilter); addAutoReleasedObject(m_lineNumberFilter);
Core::Context context(TextEditor::Constants::C_TEXTEDITOR); Core::Context context(TextEditor::Constants::C_TEXTEDITOR);
Core::ActionManager *am = Core::ICore::actionManager();
// Add shortcut for invoking automatic completion // Add shortcut for invoking automatic completion
QShortcut *completionShortcut = new QShortcut(Core::ICore::mainWindow()); QShortcut *completionShortcut = new QShortcut(Core::ICore::mainWindow());
completionShortcut->setWhatsThis(tr("Triggers a completion in this scope")); completionShortcut->setWhatsThis(tr("Triggers a completion in this scope"));
// Make sure the shortcut still works when the completion widget is active // Make sure the shortcut still works when the completion widget is active
completionShortcut->setContext(Qt::ApplicationShortcut); completionShortcut->setContext(Qt::ApplicationShortcut);
Core::Command *command = am->registerShortcut(completionShortcut, Constants::COMPLETE_THIS, context); Core::Command *command = Core::ActionManager::registerShortcut(completionShortcut, Constants::COMPLETE_THIS, context);
command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Space") : tr("Ctrl+Space"))); command->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Space") : tr("Ctrl+Space")));
connect(completionShortcut, SIGNAL(activated()), this, SLOT(invokeCompletion())); connect(completionShortcut, SIGNAL(activated()), this, SLOT(invokeCompletion()));
@@ -197,7 +196,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
quickFixShortcut->setWhatsThis(tr("Triggers a quick fix in this scope")); quickFixShortcut->setWhatsThis(tr("Triggers a quick fix in this scope"));
// Make sure the shortcut still works when the quick fix widget is active // Make sure the shortcut still works when the quick fix widget is active
quickFixShortcut->setContext(Qt::ApplicationShortcut); quickFixShortcut->setContext(Qt::ApplicationShortcut);
Core::Command *quickFixCommand = am->registerShortcut(quickFixShortcut, Constants::QUICKFIX_THIS, context); Core::Command *quickFixCommand = Core::ActionManager::registerShortcut(quickFixShortcut, Constants::QUICKFIX_THIS, context);
quickFixCommand->setDefaultKeySequence(QKeySequence(tr("Alt+Return"))); quickFixCommand->setDefaultKeySequence(QKeySequence(tr("Alt+Return")));
connect(quickFixShortcut, SIGNAL(activated()), this, SLOT(invokeQuickFix())); connect(quickFixShortcut, SIGNAL(activated()), this, SLOT(invokeQuickFix()));

View File

@@ -142,7 +142,7 @@ bool UpdateInfoPlugin::initialize(const QStringList & /* arguments */, QString *
return false; return false;
} }
Core::ActionContainer* const helpActionContainer = Core::ICore::actionManager()->actionContainer(Core::Constants::M_HELP); Core::ActionContainer* const helpActionContainer = Core::ActionManager::actionContainer(Core::Constants::M_HELP);
helpActionContainer->menu()->addAction(tr("Start Updater"), this, SLOT(startUpdaterUiApplication())); helpActionContainer->menu()->addAction(tr("Start Updater"), this, SLOT(startUpdaterUiApplication()));
//wait some time before we want to have the first check //wait some time before we want to have the first check

View File

@@ -538,26 +538,24 @@ IAnalyzerTool::ToolMode CallgrindTool::toolMode() const
void CallgrindTool::extensionsInitialized() void CallgrindTool::extensionsInitialized()
{ {
Core::ActionManager *actionManager = Core::ICore::actionManager();
Core::Context analyzerContext = Core::Context(Analyzer::Constants::C_ANALYZEMODE); Core::Context analyzerContext = Core::Context(Analyzer::Constants::C_ANALYZEMODE);
// check if there is a CppEditor context menu, if true, add our own context menu actions // check if there is a CppEditor context menu, if true, add our own context menu actions
if (Core::ActionContainer *editorContextMenu = if (Core::ActionContainer *editorContextMenu =
actionManager->actionContainer(CppEditor::Constants::M_CONTEXT)) { Core::ActionManager::actionContainer(CppEditor::Constants::M_CONTEXT)) {
QAction *action = 0; QAction *action = 0;
Core::Command *cmd = 0; Core::Command *cmd = 0;
action = new QAction(this); action = new QAction(this);
action->setSeparator(true); action->setSeparator(true);
cmd = actionManager->registerAction(action, "Analyzer.Callgrind.ContextMenu.Sep", cmd = Core::ActionManager::registerAction(action, "Analyzer.Callgrind.ContextMenu.Sep",
analyzerContext); analyzerContext);
editorContextMenu->addAction(cmd); editorContextMenu->addAction(cmd);
action = new QAction(tr("Profile Costs of this Function and its Callees"), this); action = new QAction(tr("Profile Costs of this Function and its Callees"), this);
action->setIcon(QIcon(Analyzer::Constants::ANALYZER_CONTROL_START_ICON)); action->setIcon(QIcon(Analyzer::Constants::ANALYZER_CONTROL_START_ICON));
connect(action, SIGNAL(triggered()), d, SLOT(handleShowCostsOfFunction())); connect(action, SIGNAL(triggered()), d, SLOT(handleShowCostsOfFunction()));
cmd = actionManager->registerAction(action, "Analyzer.Callgrind.ShowCostsOfFunction", cmd = Core::ActionManager::registerAction(action, "Analyzer.Callgrind.ShowCostsOfFunction",
analyzerContext); analyzerContext);
editorContextMenu->addAction(cmd); editorContextMenu->addAction(cmd);
cmd->setAttribute(Core::Command::CA_Hide); cmd->setAttribute(Core::Command::CA_Hide);