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

@@ -17,12 +17,22 @@ using namespace Utils;
namespace Cvs::Internal {
// CvsSettings
static CvsSettings *theSettings;
CvsSettings &settings()
{
return *theSettings;
}
CvsSettings::CvsSettings()
{
theSettings = this;
setSettingsGroup("CVS");
setId(VcsBase::Constants::VCS_ID_CVS);
setDisplayName(Tr::tr("CVS"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
registerAspect(&binaryPath);
binaryPath.setDefaultValue("cvs" QTC_HOST_EXE_SUFFIX);
binaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
@@ -55,6 +65,30 @@ CvsSettings::CvsSettings()
registerAspect(&diffIgnoreBlankLines);
diffIgnoreBlankLines.setSettingsKey("DiffIgnoreBlankLines");
setLayouter([this](QWidget *widget) {
using namespace Layouting;
Column {
Group {
title(Tr::tr("Configuration")),
Form {
binaryPath, br,
cvsRoot
}
},
Group {
title(Tr::tr("Miscellaneous")),
Column {
Form {
timeout, br,
diffOptions,
},
describeByCommitId,
}
},
st
}.attachTo(widget);
});
}
QStringList CvsSettings::addOptions(const QStringList &args) const
@@ -70,44 +104,4 @@ QStringList CvsSettings::addOptions(const QStringList &args) const
return rc;
}
CvsSettingsPage::CvsSettingsPage()
{
setId(VcsBase::Constants::VCS_ID_CVS);
setDisplayName(Tr::tr("CVS"));
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
setSettings(&settings());
setLayouter([](QWidget *widget) {
CvsSettings &s = settings();
using namespace Layouting;
Column {
Group {
title(Tr::tr("Configuration")),
Form {
s.binaryPath, br,
s.cvsRoot
}
},
Group {
title(Tr::tr("Miscellaneous")),
Column {
Form {
s.timeout, br,
s.diffOptions,
},
s.describeByCommitId,
}
},
st
}.attachTo(widget);
});
}
CvsSettings &settings()
{
static CvsSettings theSettings;
return theSettings;
}
} // Cvs::Internal