diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/debugger/debuggerrunconfigurationaspect.cpp | 13 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/makefileparse.cpp | 26 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp | 62 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h | 18 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakestep.cpp | 225 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakestep.h | 41 |
6 files changed, 122 insertions, 263 deletions
diff --git a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp index 1c12b163f3..06cec3a92d 100644 --- a/src/plugins/debugger/debuggerrunconfigurationaspect.cpp +++ b/src/plugins/debugger/debuggerrunconfigurationaspect.cpp @@ -241,20 +241,13 @@ bool DebuggerRunConfigurationAspect::useQmlDebugger() const return false; // - // Try to find a build step (qmake) to check whether qml debugging is enabled there - // (Using the Qt metatype system to avoid a hard qt4projectmanager dependency) + // Try to find a build configuration to check whether qml debugging is enabled there + // (Using the Qt metatype system to avoid a hard build system dependency) // if (BuildConfiguration *bc = m_target->activeBuildConfiguration()) { - QVariant linkProperty = bc->property("linkQmlDebuggingLibrary"); + const QVariant linkProperty = bc->property("linkQmlDebuggingLibrary"); if (linkProperty.isValid() && linkProperty.canConvert(QVariant::Bool)) return linkProperty.toBool(); - if (BuildStepList *bsl = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)) { - foreach (BuildStep *step, bsl->steps()) { - QVariant linkProperty = step->property("linkQmlDebuggingLibrary"); - if (linkProperty.isValid() && linkProperty.canConvert(QVariant::Bool)) - return linkProperty.toBool(); - } - } } return !languages.contains(ProjectExplorer::Constants::CXX_LANGUAGE_ID); diff --git a/src/plugins/qmakeprojectmanager/makefileparse.cpp b/src/plugins/qmakeprojectmanager/makefileparse.cpp index 939704373c..d40ad62901 100644 --- a/src/plugins/qmakeprojectmanager/makefileparse.cpp +++ b/src/plugins/qmakeprojectmanager/makefileparse.cpp @@ -41,6 +41,7 @@ using namespace Internal; using Utils::FilePath; using Utils::QtcProcess; +using ProjectExplorer::BaseTriStateAspect; using QtSupport::QtVersionManager; using QtSupport::BaseQtVersion; @@ -191,14 +192,14 @@ void MakeFileParse::parseAssignments(QList<QMakeAssignment> *assignments) m_config.osType = QMakeStepConfig::NoOsType; } else if (value == QLatin1String("qml_debug")) { if (qa.op == QLatin1String("+=")) - m_config.linkQmlDebuggingQQ2 = true; + m_config.linkQmlDebuggingQQ2 = BaseTriStateAspect::Value::Enabled; else - m_config.linkQmlDebuggingQQ2 = false; + m_config.linkQmlDebuggingQQ2 = BaseTriStateAspect::Value::Disabled; } else if (value == QLatin1String("qtquickcompiler")) { if (qa.op == QLatin1String("+=")) - m_config.useQtQuickCompiler = true; + m_config.useQtQuickCompiler = BaseTriStateAspect::Value::Enabled; else - m_config.useQtQuickCompiler = false; + m_config.useQtQuickCompiler = BaseTriStateAspect::Value::Disabled; } else if (value == QLatin1String("force_debug_info")) { if (qa.op == QLatin1String("+=")) foundForceDebugInfo = true; @@ -224,7 +225,7 @@ void MakeFileParse::parseAssignments(QList<QMakeAssignment> *assignments) } if (foundForceDebugInfo && foundSeparateDebugInfo) { - m_config.separateDebugInfo = ProjectExplorer::SeparateDebugInfoAspect::Value::Enabled; + m_config.separateDebugInfo = ProjectExplorer::BaseTriStateAspect::Value::Enabled; } else if (foundForceDebugInfo) { // Found only force_debug_info, so readd it QMakeAssignment newQA; @@ -374,10 +375,12 @@ void MakeFileParse::parseCommandLine(const QString &command, const QString &proj qCDebug(logging()) << " Explicit NoBuildAll" << m_qmakeBuildConfig.explicitNoBuildAll; qCDebug(logging()) << " TargetArch" << m_config.archConfig; qCDebug(logging()) << " OsType" << m_config.osType; - qCDebug(logging()) << " LinkQmlDebuggingQQ2" << m_config.linkQmlDebuggingQQ2; - qCDebug(logging()) << " Qt Quick Compiler" << m_config.useQtQuickCompiler; + qCDebug(logging()) << " LinkQmlDebuggingQQ2" + << (m_config.linkQmlDebuggingQQ2 == BaseTriStateAspect::Value::Enabled); + qCDebug(logging()) << " Qt Quick Compiler" + << (m_config.useQtQuickCompiler == BaseTriStateAspect::Value::Enabled); qCDebug(logging()) << " Separate Debug Info" - << (m_config.separateDebugInfo == ProjectExplorer::SeparateDebugInfoAspect::Value::Enabled); + << (m_config.separateDebugInfo == BaseTriStateAspect::Value::Enabled); // Create command line of all unfiltered arguments foreach (const QMakeAssignment &qa, assignments) @@ -522,9 +525,8 @@ void QmakeProjectManagerPlugin::testMakefileParser() const QMakeStepConfig qmsc = parser.config(); QCOMPARE(qmsc.archConfig, static_cast<QMakeStepConfig::TargetArchConfig>(archConfig)); QCOMPARE(qmsc.osType, static_cast<QMakeStepConfig::OsType>(osType)); - QCOMPARE(qmsc.linkQmlDebuggingQQ2, linkQmlDebuggingQQ2); - QCOMPARE(qmsc.useQtQuickCompiler, useQtQuickCompiler); - QCOMPARE(qmsc.separateDebugInfo == ProjectExplorer::SeparateDebugInfoAspect::Value::Enabled, - separateDebugInfo); + QCOMPARE(qmsc.linkQmlDebuggingQQ2 == BaseTriStateAspect::Value::Enabled, linkQmlDebuggingQQ2); + QCOMPARE(qmsc.useQtQuickCompiler == BaseTriStateAspect::Value::Enabled, useQtQuickCompiler); + QCOMPARE(qmsc.separateDebugInfo == BaseTriStateAspect::Value::Enabled, separateDebugInfo); } #endif diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp index 665d2e27d5..9b44f14117 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp @@ -41,6 +41,7 @@ #include <coreplugin/documentmanager.h> #include <coreplugin/icore.h> +#include <projectexplorer/buildaspects.h> #include <projectexplorer/buildinfo.h> #include <projectexplorer/buildmanager.h> #include <projectexplorer/buildsteplist.h> @@ -50,6 +51,7 @@ #include <projectexplorer/projectmacroexpander.h> #include <projectexplorer/target.h> +#include <qtsupport/qtbuildaspects.h> #include <qtsupport/qtkitinformation.h> #include <qtsupport/qtversionmanager.h> @@ -136,6 +138,21 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Core::Id id) qmakeBuildSystem()->scheduleUpdateAllNowOrLater(); }); + const auto qmlDebuggingAspect = addAspect<QmlDebuggingAspect>(); + qmlDebuggingAspect->setKit(target->kit()); + connect(qmlDebuggingAspect, &QmlDebuggingAspect::changed, this, [this] { + emit qmlDebuggingChanged(); + emit qmakeBuildConfigurationChanged(); + qmakeBuildSystem()->scheduleUpdateAllNowOrLater(); + }); + + const auto qtQuickCompilerAspect = addAspect<QtQuickCompilerAspect>(); + qtQuickCompilerAspect->setKit(target->kit()); + connect(qtQuickCompilerAspect, &QtQuickCompilerAspect::changed, this, [this] { + emit useQtQuickCompilerChanged(); + emit qmakeBuildConfigurationChanged(); + qmakeBuildSystem()->scheduleUpdateAllNowOrLater(); + }); } void QmakeBuildConfiguration::initialize() @@ -162,10 +179,16 @@ void QmakeBuildConfiguration::initialize() QString additionalArguments = qmakeExtra.additionalArguments; if (!additionalArguments.isEmpty()) qmakeStep->setUserArguments(additionalArguments); - qmakeStep->setLinkQmlDebuggingLibrary(qmakeExtra.config.linkQmlDebuggingQQ2); if (qmakeExtra.config.separateDebugInfo == SeparateDebugInfoAspect::Value::Enabled) forceSeparateDebugInfo(true); - qmakeStep->setUseQtQuickCompiler(qmakeExtra.config.useQtQuickCompiler); + if (qmakeExtra.config.linkQmlDebuggingQQ2 != QmlDebuggingAspect::Value::Default) { + forceQmlDebugging(qmakeExtra.config.linkQmlDebuggingQQ2 + == QmlDebuggingAspect::Value::Enabled); + } + if (qmakeExtra.config.useQtQuickCompiler != QtQuickCompilerAspect::Value::Default) { + forceQtQuickCompiler(qmakeExtra.config.useQtQuickCompiler + == QtQuickCompilerAspect::Value::Enabled); + } setQMakeBuildConfiguration(config); @@ -407,6 +430,35 @@ void QmakeBuildConfiguration::forceSeparateDebugInfo(bool sepDebugInfo) : SeparateDebugInfoAspect::Value::Disabled); } +BaseTriStateAspect::Value QmakeBuildConfiguration::qmlDebugging() const +{ + return aspect<QmlDebuggingAspect>()->setting(); +} + +bool QmakeBuildConfiguration::linkQmlDebuggingLibrary() const +{ + return qmlDebugging() == QmlDebuggingAspect::Value::Enabled; +} + +void QmakeBuildConfiguration::forceQmlDebugging(bool enable) +{ + aspect<QmlDebuggingAspect>()->setSetting(enable + ? QmlDebuggingAspect::Value::Enabled + : QmlDebuggingAspect::Value::Disabled); +} + +BaseTriStateAspect::Value QmakeBuildConfiguration::useQtQuickCompiler() const +{ + return aspect<QtQuickCompilerAspect>()->setting(); +} + +void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable) +{ + aspect<QtQuickCompilerAspect>()->setSetting(enable + ? QtQuickCompilerAspect::Value::Enabled + : QtQuickCompilerAspect::Value::Disabled); +} + QStringList QmakeBuildConfiguration::configCommandLineArguments() const { QStringList result; @@ -691,7 +743,7 @@ BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k, //: Non-ASCII characters in directory suffix may cause build issues. suffix = tr("Release", "Shadow build directory suffix"); if (version && version->isQtQuickCompilerSupported()) - extraInfo.config.useQtQuickCompiler = true; + extraInfo.config.useQtQuickCompiler = QtQuickCompilerAspect::Value::Enabled; } else { if (type == BuildConfiguration::Debug) { //: The name of the debug build configuration created by default for a qmake project. @@ -705,10 +757,10 @@ BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k, suffix = tr("Profile", "Shadow build directory suffix"); extraInfo.config.separateDebugInfo = SeparateDebugInfoAspect::Value::Enabled; if (version && version->isQtQuickCompilerSupported()) - extraInfo.config.useQtQuickCompiler = true; + extraInfo.config.useQtQuickCompiler = QtQuickCompilerAspect::Value::Enabled; } if (version && version->isQmlDebuggingSupported()) - extraInfo.config.linkQmlDebuggingQQ2 = true; + extraInfo.config.linkQmlDebuggingQQ2 = QmlDebuggingAspect::Value::Enabled; } info.typeName = info.displayName; // Leave info.buildDirectory unset; diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h index a615b37882..be7b3f31a4 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.h @@ -27,7 +27,7 @@ #include "qmakeprojectmanager_global.h" -#include <projectexplorer/buildaspects.h> +#include <projectexplorer/projectconfigurationaspects.h> #include <projectexplorer/buildconfiguration.h> #include <qtsupport/baseqtversion.h> @@ -44,6 +44,9 @@ class QMAKEPROJECTMANAGER_EXPORT QmakeBuildConfiguration : public ProjectExplore { Q_OBJECT + // used in DebuggerRunConfigurationAspect + Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary NOTIFY qmlDebuggingChanged) + public: QmakeBuildConfiguration(ProjectExplorer::Target *target, Core::Id id); ~QmakeBuildConfiguration() override; @@ -96,15 +99,24 @@ public: static bool isBuildDirAtSafeLocation(const QString &sourceDir, const QString &buildDir); bool isBuildDirAtSafeLocation() const; - ProjectExplorer::SeparateDebugInfoAspect::Value separateDebugInfo() const; + ProjectExplorer::BaseTriStateAspect::Value separateDebugInfo() const; void forceSeparateDebugInfo(bool sepDebugInfo); + ProjectExplorer::BaseTriStateAspect::Value qmlDebugging() const; + bool linkQmlDebuggingLibrary() const; + void forceQmlDebugging(bool enable); + + ProjectExplorer::BaseTriStateAspect::Value useQtQuickCompiler() const; + void forceQtQuickCompiler(bool enable); + signals: /// emitted for setQMakeBuildConfig, not emitted for Qt version changes, even /// if those change the qmakebuildconfig void qmakeBuildConfigurationChanged(); - void separateDebugInfoChanged(); // TODO: Check whether really needed. + void separateDebugInfoChanged(); + void qmlDebuggingChanged(); + void useQtQuickCompilerChanged(); protected: bool fromMap(const QVariantMap &map) override; diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 5bc27dd7a1..4614a5a1d8 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -72,9 +72,6 @@ using namespace Utils; namespace { const char QMAKE_ARGUMENTS_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeArguments"; const char QMAKE_FORCED_KEY[] = "QtProjectManager.QMakeBuildStep.QMakeForced"; -const char QMAKE_USE_QTQUICKCOMPILER[] = "QtProjectManager.QMakeBuildStep.UseQtQuickCompiler"; -const char QMAKE_QMLDEBUGLIBAUTO_KEY[] = "QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto"; -const char QMAKE_QMLDEBUGLIB_KEY[] = "QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary"; } QMakeStep::QMakeStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Constants::QMAKE_BS_ID) @@ -161,13 +158,9 @@ QMakeStepConfig QMakeStep::deducedArguments() const config.archConfig = QMakeStepConfig::targetArchFor(targetAbi, version); config.osType = QMakeStepConfig::osTypeFor(targetAbi, version); - if (linkQmlDebuggingLibrary() && version && version->qtVersion().majorVersion >= 5) - config.linkQmlDebuggingQQ2 = true; - - if (useQtQuickCompiler() && version) - config.useQtQuickCompiler = true; - config.separateDebugInfo = qmakeBuildConfiguration()->separateDebugInfo(); + config.linkQmlDebuggingQQ2 = qmakeBuildConfiguration()->qmlDebugging(); + config.useQtQuickCompiler = qmakeBuildConfiguration()->useQtQuickCompiler(); return config; } @@ -396,42 +389,6 @@ void QMakeStep::setExtraParserArguments(const QStringList &args) m_extraParserArgs = args; } -bool QMakeStep::linkQmlDebuggingLibrary() const -{ - return m_linkQmlDebuggingLibrary; -} - -void QMakeStep::setLinkQmlDebuggingLibrary(bool enable) -{ - if (enable == m_linkQmlDebuggingLibrary) - return; - - m_linkQmlDebuggingLibrary = enable; - - emit linkQmlDebuggingLibraryChanged(); - - emit qmakeBuildConfiguration()->qmakeBuildConfigurationChanged(); - qmakeBuildSystem()->scheduleUpdateAllNowOrLater(); -} - -bool QMakeStep::useQtQuickCompiler() const -{ - return m_useQtQuickCompiler; -} - -void QMakeStep::setUseQtQuickCompiler(bool enable) -{ - if (enable == m_useQtQuickCompiler) - return; - - m_useQtQuickCompiler = enable; - - emit useQtQuickCompilerChanged(); - - emit qmakeBuildConfiguration()->qmakeBuildConfigurationChanged(); - qmakeBuildSystem()->scheduleUpdateAllNowOrLater(); -} - FilePath QMakeStep::makeCommand() const { if (auto ms = stepList()->firstOfType<MakeStep>()) @@ -507,9 +464,7 @@ QVariantMap QMakeStep::toMap() const { QVariantMap map(AbstractProcessStep::toMap()); map.insert(QMAKE_ARGUMENTS_KEY, m_userArgs); - map.insert(QMAKE_QMLDEBUGLIB_KEY, m_linkQmlDebuggingLibrary); map.insert(QMAKE_FORCED_KEY, m_forced); - map.insert(QMAKE_USE_QTQUICKCOMPILER, m_useQtQuickCompiler); return map; } @@ -517,24 +472,20 @@ bool QMakeStep::fromMap(const QVariantMap &map) { m_userArgs = map.value(QMAKE_ARGUMENTS_KEY).toString(); m_forced = map.value(QMAKE_FORCED_KEY, false).toBool(); - m_useQtQuickCompiler = map.value(QMAKE_USE_QTQUICKCOMPILER, false).toBool(); - - // QMAKE_QMLDEBUGLIBAUTO_KEY was used in versions 2.3 to 3.5 (both included) to automatically - // change the qml_debug CONFIG flag based no the qmake build configuration. - if (map.value(QMAKE_QMLDEBUGLIBAUTO_KEY, false).toBool()) { - m_linkQmlDebuggingLibrary = - project()->projectLanguages().contains( - ProjectExplorer::Constants::QMLJS_LANGUAGE_ID) && - (qmakeBuildConfiguration()->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild); - } else { - m_linkQmlDebuggingLibrary = map.value(QMAKE_QMLDEBUGLIB_KEY, false).toBool(); - } // Backwards compatibility with < Creator 4.12. const QVariant separateDebugInfo = map.value("QtProjectManager.QMakeBuildStep.SeparateDebugInfo"); if (separateDebugInfo.isValid()) qmakeBuildConfiguration()->forceSeparateDebugInfo(separateDebugInfo.toBool()); + const QVariant qmlDebugging + = map.value("QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary"); + if (qmlDebugging.isValid()) + qmakeBuildConfiguration()->forceQmlDebugging(qmlDebugging.toBool()); + const QVariant useQtQuickCompiler + = map.value("QtProjectManager.QMakeBuildStep.UseQtQuickCompiler"); + if (useQtQuickCompiler.isValid()) + qmakeBuildConfiguration()->forceQtQuickCompiler(useQtQuickCompiler.toBool()); return BuildStep::fromMap(map); } @@ -569,43 +520,6 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step) qmakeAdditonalArgumentsLineEdit = new QLineEdit(this); - debuggingLibraryLabel = new QLabel("Link QML debugging library:", this); - - auto widget_3 = new QWidget(this); - qmlDebuggingLibraryCheckBox = new QCheckBox(widget_3); - - qmlDebuggingWarningIcon = new QLabel(widget_3); - - auto horizontalLayout_3 = new QHBoxLayout(widget_3); - horizontalLayout_3->setContentsMargins(0, 0, 0, 0); - horizontalLayout_3->addWidget(qmlDebuggingLibraryCheckBox); - horizontalLayout_3->addWidget(qmlDebuggingWarningIcon); - - qmlDebuggingWarningText = new QLabel(widget_3); - - horizontalLayout_3->addWidget(qmlDebuggingWarningText); - - horizontalLayout_3->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); - - qtQuickCompilerLabel = new QLabel(tr("Use QML compiler:"), this); - - auto widget_4 = new QWidget(this); - auto horizontalLayout_4 = new QHBoxLayout(widget_4); - horizontalLayout_4->setContentsMargins(0, 0, 0, 0); - qtQuickCompilerCheckBox = new QCheckBox(widget_4); - - horizontalLayout_4->addWidget(qtQuickCompilerCheckBox); - - qtQuickCompilerWarningIcon = new QLabel(widget_4); - - horizontalLayout_4->addWidget(qtQuickCompilerWarningIcon); - - qtQuickCompilerWarningText = new QLabel(widget_4); - - horizontalLayout_4->addWidget(qtQuickCompilerWarningText); - - horizontalLayout_4->addItem(new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); - auto label = new QLabel(tr("Effective qmake call:"), this); label->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); @@ -619,23 +533,9 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step) abisListWidget = new QListWidget(this); - qmlDebuggingLibraryCheckBox->setText(QString()); - qmlDebuggingWarningText->setText(QString()); - qtQuickCompilerCheckBox->setText(QString()); - qtQuickCompilerWarningText->setText(QString()); - - qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments()); - qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary()); - qtQuickCompilerCheckBox->setChecked(m_step->useQtQuickCompiler()); - const QPixmap warning = Utils::Icons::WARNING.pixmap(); - qmlDebuggingWarningIcon->setPixmap(warning); - qtQuickCompilerWarningIcon->setPixmap(warning); - auto formLayout = new QFormLayout(this); formLayout->addRow(label_0, buildConfigurationWidget); formLayout->addRow(qmakeArgsLabel, qmakeAdditonalArgumentsLineEdit); - formLayout->addRow(debuggingLibraryLabel, widget_3); - formLayout->addRow(qtQuickCompilerLabel, widget_4); formLayout->addRow(label, qmakeArgumentsEdit); formLayout->addRow(abisLabel, abisListWidget); @@ -643,31 +543,21 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step) updateSummaryLabel(); updateEffectiveQMakeCall(); - updateQmlDebuggingOption(); - updateQtQuickCompilerOption(); connect(qmakeAdditonalArgumentsLineEdit, &QLineEdit::textEdited, this, &QMakeStepConfigWidget::qmakeArgumentsLineEdited); connect(buildConfigurationComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &QMakeStepConfigWidget::buildConfigurationSelected); - connect(qmlDebuggingLibraryCheckBox, &QCheckBox::toggled, - this, &QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked); - connect(qmlDebuggingLibraryCheckBox, &QCheckBox::clicked, - this, [this] { askForRebuild(tr("QML Debugging")); }); - connect(qtQuickCompilerCheckBox, &QAbstractButton::toggled, - this, &QMakeStepConfigWidget::useQtQuickCompilerChecked); - connect(qtQuickCompilerCheckBox, &QCheckBox::clicked, - this, [this] { askForRebuild(tr("QML Debugging")); }); connect(step, &QMakeStep::userArgumentsChanged, this, &QMakeStepConfigWidget::userArgumentsChanged); - connect(step, &QMakeStep::linkQmlDebuggingLibraryChanged, + connect(step->qmakeBuildConfiguration(), &QmakeBuildConfiguration::qmlDebuggingChanged, this, &QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged); connect(step->project(), &Project::projectLanguagesUpdated, this, &QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged); connect(step->target(), &Target::parsingFinished, this, &QMakeStepConfigWidget::updateEffectiveQMakeCall); - connect(step, &QMakeStep::useQtQuickCompilerChanged, + connect(step->qmakeBuildConfiguration(), &QmakeBuildConfiguration::useQtQuickCompilerChanged, this, &QMakeStepConfigWidget::useQtQuickCompilerChanged); connect(step->qmakeBuildConfiguration(), &QmakeBuildConfiguration::separateDebugInfoChanged, this, &QMakeStepConfigWidget::separateDebugInfoChanged); @@ -698,8 +588,6 @@ void QMakeStepConfigWidget::qtVersionChanged() { updateSummaryLabel(); updateEffectiveQMakeCall(); - updateQmlDebuggingOption(); - updateQtQuickCompilerOption(); } void QMakeStepConfigWidget::qmakeBuildConfigChanged() @@ -724,31 +612,20 @@ void QMakeStepConfigWidget::userArgumentsChanged() void QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged() { - if (m_ignoreChange) - return; - qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary()); - updateSummaryLabel(); updateEffectiveQMakeCall(); - updateQmlDebuggingOption(); + askForRebuild(tr("QML Debugging")); } void QMakeStepConfigWidget::useQtQuickCompilerChanged() { - if (m_ignoreChange) - return; - updateSummaryLabel(); updateEffectiveQMakeCall(); - updateQtQuickCompilerOption(); - updateQmlDebuggingOption(); + askForRebuild(tr("Qt Quick Compiler")); } void QMakeStepConfigWidget::separateDebugInfoChanged() { - if (m_ignoreChange) - return; - updateSummaryLabel(); updateEffectiveQMakeCall(); askForRebuild(tr("Separate Debug Information")); @@ -813,20 +690,6 @@ void QMakeStepConfigWidget::buildConfigurationSelected() updateEffectiveQMakeCall(); } -void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked) -{ - if (m_ignoreChange) - return; - - m_ignoreChange = true; - m_step->setLinkQmlDebuggingLibrary(checked); - m_ignoreChange = false; - - updateSummaryLabel(); - updateEffectiveQMakeCall(); - updateQmlDebuggingOption(); -} - void QMakeStepConfigWidget::askForRebuild(const QString &title) { auto *question = new QMessageBox(Core::ICore::mainWindow()); @@ -838,21 +701,6 @@ void QMakeStepConfigWidget::askForRebuild(const QString &title) question->show(); } -void QMakeStepConfigWidget::useQtQuickCompilerChecked(bool checked) -{ - if (m_ignoreChange) - return; - - m_ignoreChange = true; - m_step->setUseQtQuickCompiler(checked); - m_ignoreChange = false; - - updateSummaryLabel(); - updateEffectiveQMakeCall(); - updateQmlDebuggingOption(); - updateQtQuickCompilerOption(); -} - void QMakeStepConfigWidget::updateSummaryLabel() { BaseQtVersion *qtVersion = QtKitAspect::qtVersion(m_step->target()->kit()); @@ -896,39 +744,6 @@ void QMakeStepConfigWidget::updateSummaryLabel() setSummaryText(tr("<b>qmake:</b> %1 %2").arg(program, args)); } -void QMakeStepConfigWidget::updateQmlDebuggingOption() -{ - QString warningText; - bool supported = BaseQtVersion::isQmlDebuggingSupported(m_step->target()->kit(), - &warningText); - - qmlDebuggingLibraryCheckBox->setEnabled(supported); - debuggingLibraryLabel->setText(tr("Enable QML debugging and profiling:")); - - if (supported && m_step->linkQmlDebuggingLibrary()) - warningText = tr("Might make your application vulnerable. Only use in a safe environment."); - - qmlDebuggingWarningText->setText(warningText); - qmlDebuggingWarningIcon->setVisible(!warningText.isEmpty()); - - updateQtQuickCompilerOption(); // show or clear compiler warning text -} - -void QMakeStepConfigWidget::updateQtQuickCompilerOption() -{ - QString warningText; - bool supported = BaseQtVersion::isQtQuickCompilerSupported(m_step->target()->kit(), - &warningText); - qtQuickCompilerCheckBox->setEnabled(supported); - qtQuickCompilerLabel->setText(tr("Enable Qt Quick Compiler:")); - - if (supported && m_step->useQtQuickCompiler() && m_step->linkQmlDebuggingLibrary()) - warningText = tr("Disables QML debugging. QML profiling will still work."); - - qtQuickCompilerWarningText->setText(warningText); - qtQuickCompilerWarningIcon->setVisible(!warningText.isEmpty()); -} - void QMakeStepConfigWidget::updateEffectiveQMakeCall() { qmakeArgumentsEdit->setPlainText(m_step->effectiveQMakeCall()); @@ -1020,15 +835,19 @@ QStringList QMakeStepConfig::toArguments() const else if (osType == IphoneOS) arguments << "CONFIG+=iphoneos" << "CONFIG+=device" /*since Qt 5.7*/; - if (linkQmlDebuggingQQ2) + if (linkQmlDebuggingQQ2 == BaseTriStateAspect::Value::Enabled) arguments << "CONFIG+=qml_debug"; + else if (linkQmlDebuggingQQ2 == BaseTriStateAspect::Value::Disabled) + arguments << "CONFIG-=qml_debug"; - if (useQtQuickCompiler) + if (useQtQuickCompiler == BaseTriStateAspect::Value::Enabled) arguments << "CONFIG+=qtquickcompiler"; + else if (useQtQuickCompiler == BaseTriStateAspect::Value::Disabled) + arguments << "CONFIG-=qtquickcompiler"; - if (separateDebugInfo == SeparateDebugInfoAspect::Value::Enabled) + if (separateDebugInfo == BaseTriStateAspect::Value::Enabled) arguments << "CONFIG+=force_debug_info" << "CONFIG+=separate_debug_info"; - else if (separateDebugInfo == SeparateDebugInfoAspect::Value::Disabled) + else if (separateDebugInfo == BaseTriStateAspect::Value::Disabled) arguments << "CONFIG-=separate_debug_info"; if (!sysRoot.isEmpty()) { diff --git a/src/plugins/qmakeprojectmanager/qmakestep.h b/src/plugins/qmakeprojectmanager/qmakestep.h index b9126a8aae..3f2fee357d 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.h +++ b/src/plugins/qmakeprojectmanager/qmakestep.h @@ -28,7 +28,7 @@ #include "qmakeprojectmanager_global.h" #include <projectexplorer/abstractprocessstep.h> -#include <projectexplorer/buildaspects.h> +#include <projectexplorer/projectconfigurationaspects.h> #include <utils/fileutils.h> @@ -84,10 +84,12 @@ public: QString targetTriple; TargetArchConfig archConfig = NoArch; OsType osType = NoOsType; - ProjectExplorer::SeparateDebugInfoAspect::Value separateDebugInfo - = ProjectExplorer::SeparateDebugInfoAspect::Value::Default; - bool linkQmlDebuggingQQ2 = false; - bool useQtQuickCompiler = false; + ProjectExplorer::BaseTriStateAspect::Value separateDebugInfo + = ProjectExplorer::BaseTriStateAspect::Value::Default; + ProjectExplorer::BaseTriStateAspect::Value linkQmlDebuggingQQ2 + = ProjectExplorer::BaseTriStateAspect::Value::Default; + ProjectExplorer::BaseTriStateAspect::Value useQtQuickCompiler + = ProjectExplorer::BaseTriStateAspect::Value::Default; }; @@ -104,8 +106,10 @@ inline bool operator !=(const QMakeStepConfig &a, const QMakeStepConfig &b) { inline QDebug operator<<(QDebug dbg, const QMakeStepConfig &c) { - dbg << c.archConfig << c.osType << c.linkQmlDebuggingQQ2 << c.useQtQuickCompiler - << (c.separateDebugInfo == ProjectExplorer::SeparateDebugInfoAspect::Value::Enabled); + dbg << c.archConfig << c.osType + << (c.linkQmlDebuggingQQ2 == ProjectExplorer::BaseTriStateAspect::Value::Enabled) + << (c.useQtQuickCompiler == ProjectExplorer::BaseTriStateAspect::Value::Enabled) + << (c.separateDebugInfo == ProjectExplorer::BaseTriStateAspect::Value::Enabled); return dbg; } @@ -114,9 +118,6 @@ class QMAKEPROJECTMANAGER_EXPORT QMakeStep : public ProjectExplorer::AbstractPro Q_OBJECT friend class Internal::QMakeStepFactory; - // used in DebuggerRunConfigurationAspect - Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary WRITE setLinkQmlDebuggingLibrary NOTIFY linkQmlDebuggingLibraryChanged) - public: explicit QMakeStep(ProjectExplorer::BuildStepList *parent); @@ -150,10 +151,6 @@ public: QStringList extraParserArguments() const; void setExtraParserArguments(const QStringList &args); QString mkspec() const; - bool linkQmlDebuggingLibrary() const; - void setLinkQmlDebuggingLibrary(bool enable); - bool useQtQuickCompiler() const; - void setUseQtQuickCompiler(bool enable); Utils::FilePath makeCommand() const; QString makeArguments(const QString &makefile) const; @@ -164,8 +161,6 @@ public: signals: void userArgumentsChanged(); void extraArgumentsChanged(); - void linkQmlDebuggingLibraryChanged(); - void useQtQuickCompilerChanged(); protected: bool fromMap(const QVariantMap &map) override; @@ -195,8 +190,6 @@ private: bool m_needToRunQMake = false; // set in init(), read in run() bool m_runMakeQmake = false; - bool m_linkQmlDebuggingLibrary = false; - bool m_useQtQuickCompiler = false; bool m_scriptTemplate = false; }; @@ -221,15 +214,11 @@ private: // slots for dealing with user changes in our UI void qmakeArgumentsLineEdited(); void buildConfigurationSelected(); - void linkQmlDebuggingLibraryChecked(bool checked); - void useQtQuickCompilerChecked(bool checked); void askForRebuild(const QString &title); void recompileMessageBoxFinished(int button); void updateSummaryLabel(); - void updateQmlDebuggingOption(); - void updateQtQuickCompilerOption(); void updateEffectiveQMakeCall(); QMakeStep *m_step = nullptr; @@ -240,16 +229,8 @@ private: QLabel *abisLabel = nullptr; QComboBox *buildConfigurationComboBox = nullptr; QLineEdit *qmakeAdditonalArgumentsLineEdit = nullptr; - QLabel *debuggingLibraryLabel = nullptr; - QCheckBox *qmlDebuggingLibraryCheckBox = nullptr; - QCheckBox *qtQuickCompilerCheckBox = nullptr; QPlainTextEdit *qmakeArgumentsEdit = nullptr; QListWidget *abisListWidget = nullptr; - QLabel *qmlDebuggingWarningIcon = nullptr; - QLabel *qmlDebuggingWarningText = nullptr; - QLabel *qtQuickCompilerLabel = nullptr; - QLabel *qtQuickCompilerWarningIcon = nullptr; - QLabel *qtQuickCompilerWarningText = nullptr; }; } // namespace QmakeProjectManager |