Commit eb9b15be authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Git: Clean up the menu of the git plugin

parent 9293ecab
......@@ -313,19 +313,6 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
m_menuAction = gitContainer->menu()->menuAction();
ParameterActionCommandPair parameterActionCommand
= createFileAction(actionManager, gitContainer,
tr("Diff Current File"), tr("Diff \"%1\""),
QLatin1String("Git.Diff"), globalcontext, true,
SLOT(diffCurrentFile()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+D")));
parameterActionCommand
= createFileAction(actionManager, gitContainer,
tr("Log File"), tr("Log of \"%1\""),
QLatin1String("Git.Log"), globalcontext, true, SLOT(logFile()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+L")));
parameterActionCommand
= createFileAction(actionManager, gitContainer,
tr("Blame"), tr("Blame for \"%1\""),
QLatin1String("Git.Blame"),
......@@ -334,16 +321,20 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
parameterActionCommand
= createFileAction(actionManager, gitContainer,
tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
QLatin1String("Git.UndoUnstaged"), globalcontext,
true, SLOT(undoUnstagedFileChanges()));
tr("Diff Current File"), tr("Diff of \"%1\""),
QLatin1String("Git.Diff"), globalcontext, true,
SLOT(diffCurrentFile()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+D")));
parameterActionCommand
= createFileAction(actionManager, gitContainer,
tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
QLatin1String("Git.Undo"), globalcontext,
true, SLOT(undoFileChanges()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+U")));
= createFileAction(actionManager, gitContainer,
tr("Log Current File"), tr("Log of \"%1\""),
QLatin1String("Git.Log"), globalcontext, true, SLOT(logFile()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+L")));
// ------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.File"), this));
parameterActionCommand
= createFileAction(actionManager, gitContainer,
......@@ -356,6 +347,21 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"),
QLatin1String("Git.Unstage"), globalcontext, true, SLOT(unstageFile()));
parameterActionCommand
= createFileAction(actionManager, gitContainer,
tr("Undo Unstaged Changes"), tr("Undo Unstaged Changes for \"%1\""),
QLatin1String("Git.UndoUnstaged"), globalcontext,
true, SLOT(undoUnstagedFileChanges()));
parameterActionCommand
= createFileAction(actionManager, gitContainer,
tr("Undo Uncommitted Changes"), tr("Undo Uncommitted Changes for \"%1\""),
QLatin1String("Git.Undo"), globalcontext,
true, SLOT(undoFileChanges()));
parameterActionCommand.second->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+U")));
// ------------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Project"), this));
parameterActionCommand
......@@ -379,63 +385,117 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
QLatin1String("Git.CleanProject"), globalcontext,
true, SLOT(cleanProject()));
// --------------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Repository"), this));
createRepositoryAction(actionManager, gitContainer,
tr("Diff Repository"), QLatin1String("Git.DiffRepository"),
tr("Diff"), QLatin1String("Git.DiffRepository"),
globalcontext, true, SLOT(diffRepository()));
createRepositoryAction(actionManager, gitContainer,
tr("Repository Status"), QLatin1String("Git.StatusRepository"),
globalcontext, true, &GitClient::status);
createRepositoryAction(actionManager, gitContainer,
tr("Log Repository"), QLatin1String("Git.LogRepository"),
tr("Log"), QLatin1String("Git.LogRepository"),
globalcontext, true, &GitClient::graphLog);
// Apply current file as patch is handled specially.
parameterActionCommand =
createParameterAction(actionManager, gitContainer,
tr("Apply Patch"), tr("Apply \"%1\""),
QLatin1String("Git.ApplyCurrentFilePatch"),
globalcontext, true);
m_applyCurrentFilePatchAction = parameterActionCommand.first;
connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this,
SLOT(applyCurrentFilePatch()));
createRepositoryAction(actionManager, gitContainer,
tr("Apply Patch..."), QLatin1String("Git.ApplyPatch"),
globalcontext, true, SLOT(promptApplyPatch()));
tr("Status"), QLatin1String("Git.StatusRepository"),
globalcontext, true, &GitClient::status);
createRepositoryAction(actionManager, gitContainer,
tr("Undo Repository Changes"), QLatin1String("Git.UndoRepository"),
tr("Reset..."), QLatin1String("Git.UndoRepository"),
globalcontext, false, SLOT(undoRepositoryChanges()));
createRepositoryAction(actionManager, gitContainer,
tr("Clean..."), QLatin1String("Git.CleanRepository"),
globalcontext, true, SLOT(cleanRepository()));
m_createRepositoryAction = new QAction(tr("Create Repository..."), this);
Core::Command *createRepositoryCommand = actionManager->registerAction(m_createRepositoryAction, "Git.CreateRepository", globalcontext);
connect(m_createRepositoryAction, SIGNAL(triggered()), this, SLOT(createRepository()));
gitContainer->addAction(createRepositoryCommand);
createRepositoryAction(actionManager, gitContainer,
tr("Clean Repository..."), QLatin1String("Git.CleanRepository"),
globalcontext, true, SLOT(cleanRepository()));
// --------------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Info"), this));
createRepositoryAction(actionManager, gitContainer,
tr("Launch gitk"), QLatin1String("Git.LaunchGitK"),
globalcontext, true, &GitClient::launchGitK);
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Global"), this));
createRepositoryAction(actionManager, gitContainer,
tr("Branches..."), QLatin1String("Git.BranchList"),
globalcontext, false, SLOT(branchList()));
m_showAction = new QAction(tr("Show Commit..."), this);
Core::Command *showCommitCommand = actionManager->registerAction(m_showAction, "Git.ShowCommit", globalcontext);
connect(m_showAction, SIGNAL(triggered()), this, SLOT(showCommit()));
gitContainer->addAction(showCommitCommand);
// --------------
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.RarelyUsed"), this));
Core::ActionContainer *patchMenu = actionManager->createMenu(Core::Id("Git.PatchMenu"));
patchMenu->menu()->setTitle(tr("Patch"));
gitContainer->addMenu(patchMenu);
// Apply current file as patch is handled specially.
parameterActionCommand =
createParameterAction(actionManager, patchMenu,
tr("Apply from Editor"), tr("Apply \"%1\""),
QLatin1String("Git.ApplyCurrentFilePatch"),
globalcontext, true);
m_applyCurrentFilePatchAction = parameterActionCommand.first;
connect(m_applyCurrentFilePatchAction, SIGNAL(triggered()), this,
SLOT(applyCurrentFilePatch()));
createRepositoryAction(actionManager, patchMenu,
tr("Apply from File..."), QLatin1String("Git.ApplyPatch"),
globalcontext, true, SLOT(promptApplyPatch()));
Core::ActionContainer *stashMenu = actionManager->createMenu(Core::Id("Git.StashMenu"));
stashMenu->menu()->setTitle(tr("Stash"));
gitContainer->addMenu(stashMenu);
createRepositoryAction(actionManager, stashMenu,
tr("Stashes..."), QLatin1String("Git.StashList"),
globalcontext, false, SLOT(stashList()));
stashMenu->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.StashMenuPush"), this));
ActionCommandPair actionCommand =
createRepositoryAction(actionManager, gitContainer,
tr("Stash Snapshot..."), QLatin1String("Git.StashSnapshot"),
createRepositoryAction(actionManager, stashMenu,
tr("Stash"), QLatin1String("Git.Stash"),
globalcontext, true, SLOT(stash()));
actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository."));
actionCommand = createRepositoryAction(actionManager, stashMenu,
tr("Take Snapshot..."), QLatin1String("Git.StashSnapshot"),
globalcontext, true, SLOT(stashSnapshot()));
actionCommand.first->setToolTip(tr("Saves the current state of your work."));
actionCommand = createRepositoryAction(actionManager, gitContainer,
tr("Stash"), QLatin1String("Git.Stash"),
globalcontext, true, SLOT(stash()));
actionCommand.first->setToolTip(tr("Saves the current state of your work and resets the repository."));
stashMenu->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.StashMenuPop"), this));
actionCommand = createRepositoryAction(actionManager, stashMenu,
tr("Stash Pop"), QLatin1String("Git.StashPop"),
globalcontext, true, &GitClient::stashPop);
actionCommand.first->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
Core::ActionContainer *subversionMenu = actionManager->createMenu(Core::Id("Git.Subversion"));
subversionMenu->menu()->setTitle(tr("Subversion"));
gitContainer->addMenu(subversionMenu);
createRepositoryAction(actionManager, subversionMenu,
tr("Log"), QLatin1String("Git.Subversion.Log"),
globalcontext, false, &GitClient::subversionLog);
createRepositoryAction(actionManager, subversionMenu,
tr("Fetch"), QLatin1String("Git.Subversion.Fetch"),
globalcontext, false, &GitClient::synchronousSubversionFetch);
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.PushPull"), this));
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Global"), this));
createRepositoryAction(actionManager, gitContainer,
tr("Fetch"), QLatin1String("Git.Fetch"),
......@@ -446,9 +506,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
globalcontext, true, SLOT(pull()));
actionCommand = createRepositoryAction(actionManager, gitContainer,
tr("Stash Pop"), QLatin1String("Git.StashPop"),
globalcontext, true, &GitClient::stashPop);
actionCommand.first->setToolTip(tr("Restores changes saved to the stash list using \"Stash\"."));
tr("Push"), QLatin1String("Git.Push"),
globalcontext, true, SLOT(push()));
actionCommand = createRepositoryAction(actionManager, gitContainer,
tr("Commit..."), QLatin1String("Git.Commit"),
......@@ -459,38 +518,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
tr("Amend Last Commit..."), QLatin1String("Git.AmendCommit"),
globalcontext, true, SLOT(startAmendCommit()));
actionCommand = createRepositoryAction(actionManager, gitContainer,
tr("Push"), QLatin1String("Git.Push"),
globalcontext, true, SLOT(push()));
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Branch"), this));
createRepositoryAction(actionManager, gitContainer,
tr("Branches..."), QLatin1String("Git.BranchList"),
globalcontext, false, SLOT(branchList()));
createRepositoryAction(actionManager, gitContainer,
tr("Stashes..."), QLatin1String("Git.StashList"),
globalcontext, false, SLOT(stashList()));
m_showAction = new QAction(tr("Show Commit..."), this);
Core::Command *showCommitCommand = actionManager->registerAction(m_showAction, "Git.ShowCommit", globalcontext);
connect(m_showAction, SIGNAL(triggered()), this, SLOT(showCommit()));
gitContainer->addAction(showCommitCommand);
// Subversion in a submenu.
gitContainer->addAction(createSeparator(actionManager, globalcontext, Core::Id("Git.Sep.Subversion"), this));
Core::ActionContainer *subversionMenu = actionManager->createMenu(Core::Id("Git.Subversion"));
subversionMenu->menu()->setTitle(tr("Subversion"));
gitContainer->addMenu(subversionMenu);
createRepositoryAction(actionManager, subversionMenu,
tr("Log"), QLatin1String("Git.Subversion.Log"),
globalcontext, false, &GitClient::subversionLog);
createRepositoryAction(actionManager, subversionMenu,
tr("Fetch"), QLatin1String("Git.Subversion.Fetch"),
globalcontext, false, &GitClient::synchronousSubversionFetch);
if (0) {
const QList<QAction*> snapShotActions = createSnapShotTestActions();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment