diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp index fff0a1fd5d3..3fca1a4a3e7 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp @@ -53,18 +53,6 @@ using namespace QmakeProjectManager::Internal; namespace QmakeProjectManager { -class RunSystemAspect : public TriStateAspect -{ - Q_OBJECT -public: - RunSystemAspect() - : TriStateAspect(nullptr, Tr::tr("Run"), Tr::tr("Ignore"), Tr::tr("Use global setting")) - { - setSettingsKey("RunSystemFunction"); - setDisplayName(Tr::tr("qmake system() behavior when parsing:")); - } -}; - QmakeExtraBuildInfo::QmakeExtraBuildInfo() { const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings(); @@ -120,9 +108,9 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Id id) if (!additionalArguments.isEmpty()) qmakeStep->userArguments.setArguments(additionalArguments); - aspect()->setValue(qmakeExtra.config.separateDebugInfo); - aspect()->setValue(qmakeExtra.config.linkQmlDebuggingQQ2); - aspect()->setValue(qmakeExtra.config.useQtQuickCompiler); + separateDebugInfo.setValue(qmakeExtra.config.separateDebugInfo); + qmlDebugging.setValue(qmakeExtra.config.linkQmlDebuggingQQ2); + useQtQuickCompiler.setValue(qmakeExtra.config.useQtQuickCompiler); setQMakeBuildConfiguration(config); @@ -166,30 +154,33 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Id id) connect(target, &Target::parsingFinished, this, &QmakeBuildConfiguration::updateProblemLabel); connect(target, &Target::kitChanged, this, &QmakeBuildConfiguration::updateProblemLabel); - const auto separateDebugInfoAspect = addAspect(); - connect(separateDebugInfoAspect, &SeparateDebugInfoAspect::changed, this, [this] { + connect(&separateDebugInfo, &BaseAspect::changed, this, [this] { emit separateDebugInfoChanged(); emit qmakeBuildConfigurationChanged(); qmakeBuildSystem()->scheduleUpdateAllNowOrLater(); }); - const auto qmlDebuggingAspect = addAspect(); - qmlDebuggingAspect->setBuildConfiguration(this); - connect(qmlDebuggingAspect, &QmlDebuggingAspect::changed, this, [this] { + qmlDebugging.setBuildConfiguration(this); + connect(&qmlDebugging, &BaseAspect::changed, this, [this] { emit qmlDebuggingChanged(); emit qmakeBuildConfigurationChanged(); qmakeBuildSystem()->scheduleUpdateAllNowOrLater(); }); - const auto qtQuickCompilerAspect = addAspect(); - qtQuickCompilerAspect->setBuildConfiguration(this); - connect(qtQuickCompilerAspect, &QtQuickCompilerAspect::changed, this, [this] { + useQtQuickCompiler.setBuildConfiguration(this); + connect(&useQtQuickCompiler, &QtQuickCompilerAspect::changed, this, [this] { emit useQtQuickCompilerChanged(); emit qmakeBuildConfigurationChanged(); qmakeBuildSystem()->scheduleUpdateAllNowOrLater(); }); - addAspect(); + runSystemFunctions.setSettingsKey("RunSystemFunction"); + runSystemFunctions.setDisplayStyle(SelectionAspect::DisplayStyle::ComboBox); + runSystemFunctions.setDisplayName(Tr::tr("qmake system() behavior when parsing:")); + runSystemFunctions.addOption(Tr::tr("Run")); + runSystemFunctions.addOption(Tr::tr("Ignore")); + runSystemFunctions.addOption(Tr::tr("Use global setting")); + runSystemFunctions.setDefaultValue(2); } QmakeBuildConfiguration::~QmakeBuildConfiguration() @@ -390,44 +381,27 @@ bool QmakeBuildConfiguration::isBuildDirAtSafeLocation() const return isBuildDirAtSafeLocation(project()->projectDirectory(), buildDirectory()); } -TriState QmakeBuildConfiguration::separateDebugInfo() const -{ - return aspect()->value(); -} - void QmakeBuildConfiguration::forceSeparateDebugInfo(bool sepDebugInfo) { - aspect()->setValue(sepDebugInfo - ? TriState::Enabled - : TriState::Disabled); -} - -TriState QmakeBuildConfiguration::qmlDebugging() const -{ - return aspect()->value(); + separateDebugInfo.setValue(sepDebugInfo ? TriState::Enabled : TriState::Disabled); } void QmakeBuildConfiguration::forceQmlDebugging(bool enable) { - aspect()->setValue(enable ? TriState::Enabled : TriState::Disabled); -} - -TriState QmakeBuildConfiguration::useQtQuickCompiler() const -{ - return aspect()->value(); + qmlDebugging.setValue(enable ? TriState::Enabled : TriState::Disabled); } void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable) { - aspect()->setValue(enable ? TriState::Enabled : TriState::Disabled); + useQtQuickCompiler.setValue(enable ? TriState::Enabled : TriState::Disabled); } -bool QmakeBuildConfiguration::runSystemFunction() const +bool QmakeBuildConfiguration::runQmakeSystemFunctions() const { - const TriState runSystem = aspect()->value(); - if (runSystem == TriState::Enabled) + const int sel = runSystemFunctions(); + if (sel == 0) return true; - if (runSystem == TriState::Disabled) + if (sel == 1) return false; return settings().runSystemFunction(); } @@ -857,5 +831,3 @@ void QmakeBuildConfiguration::restrictNextBuild(const RunConfiguration *rc) } } // namespace QmakeProjectManager - -#include diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h index 3b842cfd7cc..f5a38c99fce 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h @@ -5,8 +5,10 @@ #include "qmakeprojectmanager_global.h" +#include #include #include +#include #include @@ -76,16 +78,16 @@ public: const Utils::FilePath &buildDir); bool isBuildDirAtSafeLocation() const; - Utils::TriState separateDebugInfo() const; void forceSeparateDebugInfo(bool sepDebugInfo); - - Utils::TriState qmlDebugging() const; void forceQmlDebugging(bool enable); - - Utils::TriState useQtQuickCompiler() const; void forceQtQuickCompiler(bool enable); - bool runSystemFunction() const; + ProjectExplorer::SeparateDebugInfoAspect separateDebugInfo{this}; + QtSupport::QmlDebuggingAspect qmlDebugging{this}; + QtSupport::QtQuickCompilerAspect useQtQuickCompiler{this}; + Utils::SelectionAspect runSystemFunctions{this}; + + bool runQmakeSystemFunctions() const; signals: /// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index d7aefb50b8b..332b9e29bdd 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -872,7 +872,7 @@ QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFi }); m_qmakeGlobals->setCommandLineArguments(rootProFileName, qmakeArgs); - m_qmakeGlobals->runSystemFunction = bc->runSystemFunction(); + m_qmakeGlobals->runSystemFunction = bc->runQmakeSystemFunctions(); QtSupport::ProFileCacheManager::instance()->incRefCount();