Vcs: Use PagedSettings for all plugin settings

Hopefully the last structural change for a while.

Settings lifetime is again tied to the plugin private.

Change-Id: I221e8b8baa69422306191b48a9f034ef5b1a0dc2
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2023-05-15 14:52:40 +02:00
parent 1697ff8748
commit ce7ee677d8
19 changed files with 176 additions and 283 deletions

View File

@@ -397,6 +397,7 @@ public:
void onApplySettings();
GitSettings setting;
CommandLocator *m_commandLocator = nullptr;
QAction *m_menuAction = nullptr;
@@ -433,8 +434,6 @@ public:
std::unique_ptr<BlameMark> m_blameMark;
QMetaObject::Connection m_blameCursorPosConn;
GitSettingsPage settingPage;
GitGrep gitGrep{&m_gitClient};
VcsEditorFactory svnLogEditorFactory {

View File

@@ -17,8 +17,21 @@ using namespace VcsBase;
namespace Git::Internal {
static GitSettings *theSettings;
GitSettings &settings()
{
return *theSettings;
}
GitSettings::GitSettings()
{
theSettings = this;
setId(VcsBase::Constants::VCS_ID_GIT);
setDisplayName(Tr::tr("Git"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
setSettingsGroup("Git");
path.setDisplayStyle(StringAspect::LineEditDisplay);
@@ -117,6 +130,44 @@ GitSettings::GitSettings()
timeout.setDefaultValue(Utils::HostOsInfo::isWindowsHost() ? 60 : 30);
setLayouter([this](QWidget *widget) {
using namespace Layouting;
Column {
Group {
title(Tr::tr("Configuration")),
Column {
Row { path },
winSetHomeEnvironment,
}
},
Group {
title(Tr::tr("Miscellaneous")),
Column {
Row { logCount, timeout, st },
pullRebase
}
},
Group {
title(Tr::tr("Gitk")),
Row { gitkOptions }
},
Group {
title(Tr::tr("Repository Browser")),
Row { repositoryBrowserCmd }
},
Group {
title(Tr::tr("Instant Blame")),
Row { instantBlame }
},
st
}.attachTo(widget);
});
connect(&binaryPath, &StringAspect::valueChanged, this, [this] { tryResolve = true; });
connect(&path, &StringAspect::valueChanged, this, [this] { tryResolve = true; });
}
@@ -146,60 +197,4 @@ FilePath GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
return resolvedBinPath;
}
// GitSettingsPage
GitSettingsPage::GitSettingsPage()
{
setId(VcsBase::Constants::VCS_ID_GIT);
setDisplayName(Tr::tr("Git"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
setSettings(&settings());
setLayouter([](QWidget *widget) {
GitSettings &s = settings();
using namespace Layouting;
Column {
Group {
title(Tr::tr("Configuration")),
Column {
Row { s.path },
s.winSetHomeEnvironment,
}
},
Group {
title(Tr::tr("Miscellaneous")),
Column {
Row { s.logCount, s.timeout, st },
s.pullRebase
}
},
Group {
title(Tr::tr("Gitk")),
Row { s.gitkOptions }
},
Group {
title(Tr::tr("Repository Browser")),
Row { s.repositoryBrowserCmd }
},
Group {
title(Tr::tr("Instant Blame")),
Row { s.instantBlame }
},
st
}.attachTo(widget);
});
}
GitSettings &settings()
{
static GitSettings theSettings;
return theSettings;
}
} // Git::Internal

View File

@@ -3,7 +3,6 @@
#pragma once
#include <coreplugin/dialogs/ioptionspage.h>
#include <vcsbase/vcsbaseclientsettings.h>
namespace Git::Internal {
@@ -48,10 +47,4 @@ public:
GitSettings &settings();
class GitSettingsPage final : public Core::IOptionsPage
{
public:
GitSettingsPage();
};
} // Git::Internal