From e87e70dcf6ef9e07dcb1596b813b286c548b227c Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 30 Mar 2021 18:19:02 +0200 Subject: [PATCH] QmakeProjectManager: Fix settings default value Amends b5692587489c. The change dropped the special setup of m_warnAgainstUnalignedBuildDir and fumbled when flipping the the internal value for m_ignoreSystemFunction/m_runSystemFunction. Almost back to the first patch: Keep the value under the name (and meaning) "RunSystemFunction", but flip it for internal storage and user display. Change-Id: I4e8cf430fd9ad922357b581b862b7e491c035977 Reviewed-by: Alessandro Portale Reviewed-by: Christian Kandeler --- src/plugins/qmakeprojectmanager/qmakesettings.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/qmakeprojectmanager/qmakesettings.cpp b/src/plugins/qmakeprojectmanager/qmakesettings.cpp index e3075b02c78..12886c1486d 100644 --- a/src/plugins/qmakeprojectmanager/qmakesettings.cpp +++ b/src/plugins/qmakeprojectmanager/qmakesettings.cpp @@ -42,7 +42,7 @@ QmakeSettings::QmakeSettings() registerAspect(&m_warnAgainstUnalignedBuildDir); m_warnAgainstUnalignedBuildDir.setSettingsKey("QmakeProjectManager/WarnAgainstUnalignedBuildDir"); - m_warnAgainstUnalignedBuildDir.setDefaultValue(true); + m_warnAgainstUnalignedBuildDir.setDefaultValue(HostOsInfo::isWindowsHost()); m_warnAgainstUnalignedBuildDir.setLabelText(tr("Warn if a project's source and " "build directories are not at the same level")); m_warnAgainstUnalignedBuildDir.setToolTip(tr("Qmake has subtle bugs that " @@ -59,6 +59,11 @@ QmakeSettings::QmakeSettings() m_ignoreSystemFunction.setLabelText(tr("Ignore qmake's system() function when parsing a project")); m_ignoreSystemFunction.setToolTip(tr("Checking this option avoids unwanted side effects, " "but may result in inexact parsing results.")); + // The settings value has been stored with the opposite meaning for a while. + // Avoid changing the stored value, but flip it on read/write: + const auto invertBoolVariant = [](const QVariant &v) { return QVariant(!v.toBool()); }; + m_ignoreSystemFunction.setFromSettingsTransformation(invertBoolVariant); + m_ignoreSystemFunction.setToSettingsTransformation(invertBoolVariant); readSettings(Core::ICore::settings()); }