Git: Simplify createChangeRelatedRepositoryAction

Change-Id: I0d374b071b73565bb3e48b4a1f32bc7baf988a28
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2015-11-20 11:41:29 +01:00
parent dda9380052
commit a01a8e7452
2 changed files with 11 additions and 22 deletions

View File

@@ -249,13 +249,11 @@ QAction *GitPlugin::createRepositoryAction(ActionContainer *ac,
return action;
}
QAction *GitPlugin::createChangeRelatedRepositoryAction(ActionContainer *ac,
const QString &text, Id id,
const Context &context, bool addToLocator,
const QKeySequence &keys)
QAction *GitPlugin::createChangeRelatedRepositoryAction(const QString &text, Id id,
const Context &context)
{
return createRepositoryAction(ac, text, id, context, addToLocator,
[this, id] { startChangeRelatedAction(id); }, keys);
return createRepositoryAction(nullptr, text, id, context, true,
[this, id] { startChangeRelatedAction(id); }, QKeySequence());
}
// Action to act on the repository forwarded to a git client member function
@@ -546,17 +544,10 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
// --------------
/* Actions only in locator */
createChangeRelatedRepositoryAction(0, tr("Show..."), "Git.Show",
context, true);
createChangeRelatedRepositoryAction(0, tr("Revert..."), "Git.Revert",
context, true);
createChangeRelatedRepositoryAction(0, tr("Cherry Pick..."), "Git.CherryPick",
context, true);
createChangeRelatedRepositoryAction(0, tr("Checkout..."), "Git.Checkout",
context, true);
createChangeRelatedRepositoryAction(tr("Show..."), "Git.Show", context);
createChangeRelatedRepositoryAction(tr("Revert..."), "Git.Revert", context);
createChangeRelatedRepositoryAction(tr("Cherry Pick..."), "Git.CherryPick", context);
createChangeRelatedRepositoryAction(tr("Checkout..."), "Git.Checkout", context);
createRepositoryAction(0, tr("Rebase..."), "Git.Rebase", context, true, [this] { branchList(); });
createRepositoryAction(0, tr("Merge..."), "Git.Merge", context, true, [this] { branchList(); });

View File

@@ -176,15 +176,13 @@ private:
const Core::Context &context, bool addToLocator,
const std::function<void()> &callback,
const QKeySequence &keys = QKeySequence());
QAction *createChangeRelatedRepositoryAction(Core::ActionContainer *ac,
const QString &text, Core::Id id,
const Core::Context &context,
bool addToLocator,
const QKeySequence &keys = QKeySequence());
QAction *createRepositoryAction(Core::ActionContainer *ac, const QString &text, Core::Id id,
const Core::Context &context, bool addToLocator,
GitClientMemberFunc, const QKeySequence &keys = QKeySequence());
QAction *createChangeRelatedRepositoryAction(const QString &text, Core::Id id,
const Core::Context &context);
void updateRepositoryBrowserAction();
bool isCommitEditorOpen() const;
Core::IEditor *openSubmitEditor(const QString &fileName, const CommitData &cd);