// Copyright (C) 2019 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "qmakesettings.h" #include "qmakeprojectmanagertr.h" #include #include #include using namespace Utils; namespace QmakeProjectManager::Internal { static QmakeSettings *theSettings; QmakeSettings &settings() { return *theSettings; } QmakeSettings::QmakeSettings() { theSettings = this; setId("K.QmakeProjectManager.QmakeSettings"); setDisplayName(Tr::tr("Qmake")); setCategory(ProjectExplorer::Constants::BUILD_AND_RUN_SETTINGS_CATEGORY); setSettingsGroup("QmakeProjectManager"); registerAspect(&warnAgainstUnalignedBuildDir); warnAgainstUnalignedBuildDir.setSettingsKey("WarnAgainstUnalignedBuildDir"); warnAgainstUnalignedBuildDir.setDefaultValue(HostOsInfo::isWindowsHost()); warnAgainstUnalignedBuildDir.setLabelText(Tr::tr("Warn if a project's source and " "build directories are not at the same level")); warnAgainstUnalignedBuildDir.setToolTip(Tr::tr("Qmake has subtle bugs that " "can be triggered if source and build directory are not at the same level.")); registerAspect(&alwaysRunQmake); alwaysRunQmake.setSettingsKey("AlwaysRunQmake"); alwaysRunQmake.setLabelText(Tr::tr("Run qmake on every build")); alwaysRunQmake.setToolTip(Tr::tr("This option can help to prevent failures on " "incremental builds, but might slow them down unnecessarily in the general case.")); registerAspect(&ignoreSystemFunction); ignoreSystemFunction.setSettingsKey("RunSystemFunction"); ignoreSystemFunction.setLabelText(Tr::tr("Ignore qmake's system() function when parsing a project")); ignoreSystemFunction.setToolTip(Tr::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()); }; ignoreSystemFunction.setFromSettingsTransformation(invertBoolVariant); ignoreSystemFunction.setToSettingsTransformation(invertBoolVariant); setLayouter([this](QWidget *widget) { using namespace Layouting; Column { warnAgainstUnalignedBuildDir, alwaysRunQmake, ignoreSystemFunction, st }.attachTo(widget); }); readSettings(); } } // QmakeProjectManager::Internal