Core: Add some sanity check that settings containers don't auto-apply

We use manual 'Apply' in the dialog.

Also, mark a few pages as non-autoapply that were recently changed
away from PagedSettings again which did that autmatically.

Change-Id: Id78cac2770658b18c420813802a0e77443329f39
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-07-12 13:35:15 +02:00
parent 54a6145ae9
commit 4c02bc497c
6 changed files with 13 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ CTestTool::CTestTool()
: Autotest::ITestTool(false)
{
setSettingsGroups("Autotest", "CTest");
setAutoApply(false);
setLayouter([this] {
return Row { Form {

View File

@@ -129,6 +129,7 @@ AbstractSettings::AbstractSettings(const QString &name, const QString &ending)
.pathAppended(name))
{
setSettingsGroups(Utils::Constants::BEAUTIFIER_SETTINGS_GROUP, name);
setAutoApply(false);
command.setSettingsKey("command");
command.setExpectedKind(PathChooser::ExistingCommand);

View File

@@ -164,6 +164,13 @@ void IOptionsPage::apply()
if (m_settingsProvider) {
AspectContainer *container = m_settingsProvider();
QTC_ASSERT(container, return);
// Sanity check: Aspects in option pages should not autoapply.
if (!container->aspects().isEmpty()) {
BaseAspect *aspect = container->aspects().first();
QTC_ASSERT(aspect, return);
QTC_ASSERT(!aspect->isAutoApply(), container->setAutoApply(false));
}
if (container->isDirty()) {
container->apply();
container->writeSettings();

View File

@@ -53,6 +53,8 @@ FakeVimSettings &settings()
FakeVimSettings::FakeVimSettings()
{
setAutoApply(false);
setup(&useFakeVim, false, "UseFakeVim", {}, Tr::tr("Use FakeVim"));
// Specific FakeVim settings

View File

@@ -362,6 +362,7 @@ TerminalSettings &settings()
TerminalSettings::TerminalSettings()
{
setSettingsGroup("Terminal");
setAutoApply(false);
enableTerminal.setSettingsKey("EnableTerminal");
enableTerminal.setLabelText(Tr::tr("Use internal terminal"));

View File

@@ -31,6 +31,7 @@ VcpkgSettings &settings()
VcpkgSettings::VcpkgSettings()
{
setSettingsGroup("Vcpkg");
setAutoApply(false);
vcpkgRoot.setSettingsKey("VcpkgRoot");
vcpkgRoot.setExpectedKind(PathChooser::ExistingDirectory);