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

@@ -14,8 +14,22 @@ using namespace Utils;
namespace Mercurial::Internal {
static MercurialSettings *theSettings;
MercurialSettings &settings()
{
return *theSettings;
}
MercurialSettings::MercurialSettings()
{
theSettings = this;
setId(VcsBase::Constants::VCS_ID_MERCURIAL);
setDisplayName(Tr::tr("Mercurial"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
setSettings(&settings());
setSettingsGroup("Mercurial");
setAutoApply(false);
@@ -42,42 +56,27 @@ MercurialSettings::MercurialSettings()
registerAspect(&diffIgnoreBlankLines);
diffIgnoreBlankLines.setSettingsKey("diffIgnoreBlankLines");
}
// MercurialSettingsPage
MercurialSettingsPage::MercurialSettingsPage()
{
setId(VcsBase::Constants::VCS_ID_MERCURIAL);
setDisplayName(Tr::tr("Mercurial"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
setSettings(&settings());
setLayouter([](QWidget *widget) {
MercurialSettings &s = settings();
setLayouter([this](QWidget *widget) {
using namespace Layouting;
Column {
Group {
title(Tr::tr("Configuration")),
Row { s.binaryPath }
Row { binaryPath }
},
Group {
title(Tr::tr("User")),
Form {
s.userName, br,
s.userEmail
userName, br,
userEmail
}
},
Group {
title(Tr::tr("Miscellaneous")),
Row {
s.logCount,
s.timeout,
st
}
Row { logCount, timeout, st }
},
st
@@ -85,10 +84,4 @@ MercurialSettingsPage::MercurialSettingsPage()
});
}
MercurialSettings &settings()
{
static MercurialSettings theSettings;
return theSettings;
}
} // Mercurial::Internal