forked from qt-creator/qt-creator
ActionManager API cleanup.
d-pointer instead of inheritance static methods Change-Id: I7b2f0c8b05ad3951e1ff26a7d4e08e195d2dd258 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -155,8 +155,6 @@ bool BazaarPlugin::initialize(const QStringList &arguments, QString *errorMessag
|
||||
m_client = new BazaarClient(&m_bazaarSettings);
|
||||
initializeVcs(new BazaarControl(m_client));
|
||||
|
||||
m_actionManager = Core::ICore::actionManager();
|
||||
|
||||
m_optionsPage = new OptionsPage();
|
||||
addAutoReleasedObject(m_optionsPage);
|
||||
m_bazaarSettings.readSettings(Core::ICore::settings());
|
||||
@@ -214,7 +212,7 @@ void BazaarPlugin::createMenu()
|
||||
Core::Context context(Core::Constants::C_GLOBAL);
|
||||
|
||||
// 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();
|
||||
menu->setTitle(tr("Bazaar"));
|
||||
|
||||
@@ -226,7 +224,7 @@ void BazaarPlugin::createMenu()
|
||||
createSeparator(context, Core::Id("Bazaar.Repository Management"));
|
||||
|
||||
// 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);
|
||||
m_menuAction = m_bazaarContainer->menu()->menuAction();
|
||||
}
|
||||
@@ -236,14 +234,14 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
|
||||
Core::Command *command;
|
||||
|
||||
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);
|
||||
connect(m_annotateFile, SIGNAL(triggered()), this, SLOT(annotateCurrentFile()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
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->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+D") : tr("ALT+Z,Alt+D")));
|
||||
connect(m_diffFile, SIGNAL(triggered()), this, SLOT(diffCurrentFile()));
|
||||
@@ -251,7 +249,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
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->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+L") : tr("ALT+Z,Alt+L")));
|
||||
connect(m_logFile, SIGNAL(triggered()), this, SLOT(logCurrentFile()));
|
||||
@@ -259,7 +257,7 @@ void BazaarPlugin::createFileActions(const Core::Context &context)
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
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->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+Z,Meta+S") : tr("ALT+Z,Alt+S")));
|
||||
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"));
|
||||
|
||||
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);
|
||||
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
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);
|
||||
connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(promptToDeleteCurrentFile()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
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);
|
||||
connect(m_revertFile, SIGNAL(triggered()), this, SLOT(revertCurrentFile()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
@@ -348,28 +346,28 @@ void BazaarPlugin::createDirectoryActions(const Core::Context &context)
|
||||
|
||||
action = new QAction(tr("Diff"), this);
|
||||
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()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Log"), this);
|
||||
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()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Revert..."), this);
|
||||
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()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Status"), this);
|
||||
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()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
@@ -419,35 +417,35 @@ void BazaarPlugin::createRepositoryActions(const Core::Context &context)
|
||||
|
||||
action = new QAction(tr("Pull..."), this);
|
||||
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()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Push..."), this);
|
||||
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()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Update..."), this);
|
||||
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()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
action = new QAction(tr("Commit..."), this);
|
||||
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")));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(commit()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
m_commandLocator->appendCommand(command);
|
||||
|
||||
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()));
|
||||
m_bazaarContainer->addAction(command);
|
||||
}
|
||||
@@ -514,18 +512,18 @@ void BazaarPlugin::createSubmitEditorActions()
|
||||
Core::Command *command;
|
||||
|
||||
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);
|
||||
connect(m_editorCommit, SIGNAL(triggered()), this, SLOT(commitFromEditor()));
|
||||
|
||||
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);
|
||||
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);
|
||||
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()
|
||||
@@ -682,7 +680,7 @@ void BazaarPlugin::createSeparator(const Core::Context &context, const Core::Id
|
||||
{
|
||||
QAction *action = new QAction(this);
|
||||
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)
|
||||
|
Reference in New Issue
Block a user