Vcs: Separate plugin and QObject parent roles for VcsSubmitEditorFactory

These are different when the factories are used as real members,
as already done in Bazaar.

Change-Id: I3c187896dcbacb5156be1543424ccacb9140a493
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2020-02-06 15:52:30 +01:00
parent e4738904d9
commit 9c02a11039
8 changed files with 11 additions and 9 deletions

View File

@@ -439,7 +439,7 @@ ClearCasePluginPrivate::ClearCasePluginPrivate()
new ClearCaseSettingsPage(this); new ClearCaseSettingsPage(this);
new VcsSubmitEditorFactory(submitParameters, [] { return new ClearCaseSubmitEditor; }, this); new VcsSubmitEditorFactory(submitParameters, [] { return new ClearCaseSubmitEditor; }, this, this);
// any editor responds to describe (when clicking a version) // any editor responds to describe (when clicking a version)
const auto describeFunc = [this](const QString &source, const QString &changeNr) { const auto describeFunc = [this](const QString &source, const QString &changeNr) {

View File

@@ -518,7 +518,7 @@ CvsPluginPrivate::CvsPluginPrivate()
new CvsSettingsPage([this] { configurationChanged(); }, &m_settings, this); new CvsSettingsPage([this] { configurationChanged(); }, &m_settings, this);
new VcsSubmitEditorFactory(submitParameters, [] { return new CvsSubmitEditor; }, this); new VcsSubmitEditorFactory(submitParameters, [] { return new CvsSubmitEditor; }, this, this);
const auto describeFunc = [this](const QString &source, const QString &changeNr) { const auto describeFunc = [this](const QString &source, const QString &changeNr) {
QString errorMessage; QString errorMessage;

View File

@@ -367,7 +367,7 @@ GitPluginPrivate::GitPluginPrivate()
for (int i = 0; i < editorCount; i++) for (int i = 0; i < editorCount; i++)
new VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc, this); new VcsEditorFactory(editorParameters + i, widgetCreator, describeFunc, this);
new VcsSubmitEditorFactory(submitParameters, [] { return new GitSubmitEditor; }, this); new VcsSubmitEditorFactory(submitParameters, [] { return new GitSubmitEditor; }, this, this);
const QString prefix = "git"; const QString prefix = "git";
m_commandLocator = new CommandLocator("Git", prefix, prefix, this); m_commandLocator = new CommandLocator("Git", prefix, prefix, this);

View File

@@ -256,7 +256,7 @@ MercurialPluginPrivate::MercurialPluginPrivate()
for (auto &editor : editorParameters) for (auto &editor : editorParameters)
new VcsEditorFactory(&editor, widgetCreator, describeFunc, this); new VcsEditorFactory(&editor, widgetCreator, describeFunc, this);
new VcsSubmitEditorFactory(submitEditorParameters, [] { return new CommitEditor; }, this); new VcsSubmitEditorFactory(submitEditorParameters, [] { return new CommitEditor; }, this, this);
const QString prefix = QLatin1String("hg"); const QString prefix = QLatin1String("hg");
m_commandLocator = new Core::CommandLocator("Mercurial", prefix, prefix, this); m_commandLocator = new Core::CommandLocator("Mercurial", prefix, prefix, this);

View File

@@ -381,7 +381,7 @@ PerforcePluginPrivate::PerforcePluginPrivate()
m_settings.fromSettings(ICore::settings()); m_settings.fromSettings(ICore::settings());
// Editor factories // Editor factories
new VcsSubmitEditorFactory(submitParameters, [] { return new PerforceSubmitEditor; }, this); new VcsSubmitEditorFactory(submitParameters, [] { return new PerforceSubmitEditor; }, this, this);
const auto describeFunc = [this](const QString &source, const QString &n) { const auto describeFunc = [this](const QString &source, const QString &n) {
describe(source, n); describe(source, n);

View File

@@ -388,7 +388,7 @@ SubversionPluginPrivate::SubversionPluginPrivate()
using namespace Core::Constants; using namespace Core::Constants;
Context context(SUBVERSION_CONTEXT); Context context(SUBVERSION_CONTEXT);
new VcsSubmitEditorFactory(submitParameters, [] { return new SubversionSubmitEditor; }, this); new VcsSubmitEditorFactory(submitParameters, [] { return new SubversionSubmitEditor; }, this, this);
const auto describeFunc = [this](const QString &source, const QString &id) { const auto describeFunc = [this](const QString &source, const QString &id) {
describe(source, id); describe(source, id);

View File

@@ -43,8 +43,9 @@ const char DIFF_SELECTED[] = "Vcs.DiffSelectedFiles";
VcsSubmitEditorFactory::VcsSubmitEditorFactory VcsSubmitEditorFactory::VcsSubmitEditorFactory
(const VcsBaseSubmitEditorParameters &parameters, (const VcsBaseSubmitEditorParameters &parameters,
const EditorCreator &editorCreator, const EditorCreator &editorCreator,
VcsBasePluginPrivate *plugin) VcsBasePluginPrivate *plugin,
: IEditorFactory(plugin) QObject *parent)
: IEditorFactory(parent)
{ {
setId(parameters.id); setId(parameters.id);
setDisplayName(QLatin1String(parameters.displayName)); setDisplayName(QLatin1String(parameters.displayName));

View File

@@ -49,7 +49,8 @@ public:
VcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters &parameters, VcsSubmitEditorFactory(const VcsBaseSubmitEditorParameters &parameters,
const EditorCreator &editorCreator, const EditorCreator &editorCreator,
VcsBasePluginPrivate *plugin); VcsBasePluginPrivate *plugin,
QObject *parent = nullptr);
private: private:
QAction *m_submitAction = nullptr; QAction *m_submitAction = nullptr;