VCS: Simplify VcsEditor setup

Create the editor parameter structures in-place, and also
include the other two parameters in the struct to simplify
the signature of the c'tor.

Change-Id: Iff7d5ddf3096f4a3ed18e53265ae74806823af32
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2024-02-07 10:33:46 +01:00
parent be33c807a6
commit 2d37a7421f
10 changed files with 198 additions and 302 deletions

View File

@@ -132,48 +132,6 @@ public:
static const QVersionNumber minimumRequiredVersion{1, 9};
const VcsBaseEditorParameters svnLogEditorParameters {
OtherContent,
Git::Constants::GIT_SVN_LOG_EDITOR_ID,
Git::Constants::GIT_SVN_LOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.svnlog"
};
const VcsBaseEditorParameters logEditorParameters {
LogOutput,
Git::Constants::GIT_LOG_EDITOR_ID,
Git::Constants::GIT_LOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.log"
};
const VcsBaseEditorParameters reflogEditorParameters {
LogOutput,
Git::Constants::GIT_REFLOG_EDITOR_ID,
Git::Constants::GIT_REFLOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.reflog"
};
const VcsBaseEditorParameters blameEditorParameters {
AnnotateOutput,
Git::Constants::GIT_BLAME_EDITOR_ID,
Git::Constants::GIT_BLAME_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.annotation"
};
const VcsBaseEditorParameters commitTextEditorParameters {
OtherContent,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.commit"
};
const VcsBaseEditorParameters rebaseEditorParameters {
OtherContent,
Git::Constants::GIT_REBASE_EDITOR_ID,
Git::Constants::GIT_REBASE_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.rebase"
};
// GitPlugin
class GitPluginPrivate final : public VersionControlBase
@@ -366,41 +324,59 @@ public:
GitGrep gitGrep;
VcsEditorFactory svnLogEditorFactory {
&svnLogEditorParameters,
VcsEditorFactory svnLogEditorFactory {{
OtherContent,
Git::Constants::GIT_SVN_LOG_EDITOR_ID,
Git::Constants::GIT_SVN_LOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.svnlog",
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
}};
VcsEditorFactory logEditorFactory {
&logEditorParameters,
VcsEditorFactory logEditorFactory {{
LogOutput,
Git::Constants::GIT_LOG_EDITOR_ID,
Git::Constants::GIT_LOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.log",
[] { return new GitLogEditorWidgetT<GitEditorWidget>; },
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
}};
VcsEditorFactory reflogEditorFactory {
&reflogEditorParameters,
[] { return new GitLogEditorWidgetT<GitReflogEditorWidget>; },
VcsEditorFactory reflogEditorFactory {{
LogOutput,
Git::Constants::GIT_REFLOG_EDITOR_ID,
Git::Constants::GIT_REFLOG_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.reflog",
[] { return new GitLogEditorWidgetT<GitReflogEditorWidget>; },
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
}};
VcsEditorFactory blameEditorFactory {
&blameEditorParameters,
VcsEditorFactory blameEditorFactory {{
AnnotateOutput,
Git::Constants::GIT_BLAME_EDITOR_ID,
Git::Constants::GIT_BLAME_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.annotation",
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
}};
VcsEditorFactory commitTextEditorFactory {
&commitTextEditorParameters,
VcsEditorFactory commitTextEditorFactory {{
OtherContent,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_ID,
Git::Constants::GIT_COMMIT_TEXT_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.commit",
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
}};
VcsEditorFactory rebaseEditorFactory {
&rebaseEditorParameters,
VcsEditorFactory rebaseEditorFactory {{
OtherContent,
Git::Constants::GIT_REBASE_EDITOR_ID,
Git::Constants::GIT_REBASE_EDITOR_DISPLAY_NAME,
"text/vnd.qtcreator.git.rebase",
[] { return new GitEditorWidget; },
std::bind(&GitPluginPrivate::vcsDescribe, this, _1, _2)
};
}};
};
static GitPluginPrivate *dd = nullptr;