forked from qt-creator/qt-creator
Pass BuildConfiguration to Qml related build aspects constructors
Less weird then before. Change-Id: Ia36663721085132e6a2876783749d96d9a3983a3 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1187,6 +1187,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
|
||||
addAspect<SourceDirectoryAspect>();
|
||||
addAspect<BuildTypeAspect>();
|
||||
addAspect<QtSupport::QmlDebuggingAspect>(this);
|
||||
|
||||
appendInitialBuildStep(Constants::CMAKE_BUILD_STEP_ID);
|
||||
appendInitialCleanStep(Constants::CMAKE_BUILD_STEP_ID);
|
||||
@@ -1286,8 +1287,6 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
||||
setCMakeBuildType(info.typeName);
|
||||
});
|
||||
|
||||
const auto qmlDebuggingAspect = addAspect<QtSupport::QmlDebuggingAspect>();
|
||||
qmlDebuggingAspect->setKit(target->kit());
|
||||
setIsMultiConfig(CMakeGeneratorKitAspect::isMultiConfigGenerator(target->kit()));
|
||||
}
|
||||
|
||||
|
@@ -131,13 +131,11 @@ QbsBuildConfiguration::QbsBuildConfiguration(Target *target, Utils::Id id)
|
||||
connect(separateDebugInfoAspect, &SeparateDebugInfoAspect::changed,
|
||||
this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
||||
|
||||
const auto qmlDebuggingAspect = addAspect<QtSupport::QmlDebuggingAspect>();
|
||||
qmlDebuggingAspect->setKit(target->kit());
|
||||
const auto qmlDebuggingAspect = addAspect<QtSupport::QmlDebuggingAspect>(this);
|
||||
connect(qmlDebuggingAspect, &QtSupport::QmlDebuggingAspect::changed,
|
||||
this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
||||
|
||||
const auto qtQuickCompilerAspect = addAspect<QtSupport::QtQuickCompilerAspect>(qmlDebuggingAspect);
|
||||
qtQuickCompilerAspect->setKit(target->kit());
|
||||
const auto qtQuickCompilerAspect = addAspect<QtSupport::QtQuickCompilerAspect>(this);
|
||||
connect(qtQuickCompilerAspect, &QtSupport::QtQuickCompilerAspect::changed,
|
||||
this, &QbsBuildConfiguration::qbsConfigurationChanged);
|
||||
|
||||
|
@@ -189,16 +189,14 @@ QmakeBuildConfiguration::QmakeBuildConfiguration(Target *target, Utils::Id id)
|
||||
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
||||
});
|
||||
|
||||
const auto qmlDebuggingAspect = addAspect<QmlDebuggingAspect>();
|
||||
qmlDebuggingAspect->setKit(target->kit());
|
||||
const auto qmlDebuggingAspect = addAspect<QmlDebuggingAspect>(this);
|
||||
connect(qmlDebuggingAspect, &QmlDebuggingAspect::changed, this, [this] {
|
||||
emit qmlDebuggingChanged();
|
||||
emit qmakeBuildConfigurationChanged();
|
||||
qmakeBuildSystem()->scheduleUpdateAllNowOrLater();
|
||||
});
|
||||
|
||||
const auto qtQuickCompilerAspect = addAspect<QtQuickCompilerAspect>(qmlDebuggingAspect);
|
||||
qtQuickCompilerAspect->setKit(target->kit());
|
||||
const auto qtQuickCompilerAspect = addAspect<QtQuickCompilerAspect>(this);
|
||||
connect(qtQuickCompilerAspect, &QtQuickCompilerAspect::changed, this, [this] {
|
||||
emit useQtQuickCompilerChanged();
|
||||
emit qmakeBuildConfigurationChanged();
|
||||
|
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "baseqtversion.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildpropertiessettings.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
@@ -42,7 +43,8 @@ using namespace Utils;
|
||||
|
||||
namespace QtSupport {
|
||||
|
||||
QmlDebuggingAspect::QmlDebuggingAspect()
|
||||
QmlDebuggingAspect::QmlDebuggingAspect(BuildConfiguration *buildConfig)
|
||||
: m_buildConfig(buildConfig)
|
||||
{
|
||||
setSettingsKey("EnableQmlDebugging");
|
||||
setDisplayName(tr("QML debugging and profiling:"));
|
||||
@@ -58,7 +60,9 @@ void QmlDebuggingAspect::addToLayout(LayoutBuilder &builder)
|
||||
builder.addRow({{}, warningLabel});
|
||||
const auto changeHandler = [this, warningLabel] {
|
||||
QString warningText;
|
||||
const bool supported = m_kit && QtVersion::isQmlDebuggingSupported(m_kit, &warningText);
|
||||
QTC_ASSERT(m_buildConfig, return);
|
||||
Kit *kit = m_buildConfig->kit();
|
||||
const bool supported = kit && QtVersion::isQmlDebuggingSupported(kit, &warningText);
|
||||
if (!supported) {
|
||||
setValue(TriState::Default);
|
||||
} else if (value() == TriState::Enabled) {
|
||||
@@ -76,8 +80,8 @@ void QmlDebuggingAspect::addToLayout(LayoutBuilder &builder)
|
||||
changeHandler();
|
||||
}
|
||||
|
||||
QtQuickCompilerAspect::QtQuickCompilerAspect(QmlDebuggingAspect *qmlAspect)
|
||||
: m_qmlDebuggingAspect(qmlAspect)
|
||||
QtQuickCompilerAspect::QtQuickCompilerAspect(BuildConfiguration *buildConfig)
|
||||
: m_buildConfig(buildConfig)
|
||||
{
|
||||
setSettingsKey("QtQuickCompiler");
|
||||
setDisplayName(tr("Qt Quick Compiler:"));
|
||||
@@ -93,14 +97,18 @@ void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
|
||||
builder.addRow({{}, warningLabel});
|
||||
const auto changeHandler = [this, warningLabel] {
|
||||
QString warningText;
|
||||
const bool supported = m_kit
|
||||
&& QtVersion::isQtQuickCompilerSupported(m_kit, &warningText);
|
||||
QTC_ASSERT(m_buildConfig, return);
|
||||
Kit *kit = m_buildConfig->kit();
|
||||
const bool supported = kit
|
||||
&& QtVersion::isQtQuickCompilerSupported(kit, &warningText);
|
||||
if (!supported)
|
||||
setValue(TriState::Default);
|
||||
if (value() == TriState::Enabled
|
||||
&& m_qmlDebuggingAspect && m_qmlDebuggingAspect->value() == TriState::Enabled) {
|
||||
if (value() == TriState::Enabled) {
|
||||
if (auto qmlDebuggingAspect = m_buildConfig->aspect<QmlDebuggingAspect>()) {
|
||||
if (qmlDebuggingAspect->value() == TriState::Enabled)
|
||||
warningText = tr("Disables QML debugging. QML profiling will still work.");
|
||||
}
|
||||
}
|
||||
warningLabel->setText(warningText);
|
||||
setVisible(supported);
|
||||
const bool warningLabelsVisible = supported && !warningText.isEmpty();
|
||||
@@ -110,8 +118,8 @@ void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
|
||||
connect(KitManager::instance(), &KitManager::kitsChanged, warningLabel, changeHandler);
|
||||
connect(this, &QmlDebuggingAspect::changed, warningLabel, changeHandler);
|
||||
connect(this, &QtQuickCompilerAspect::changed, warningLabel, changeHandler);
|
||||
if (m_qmlDebuggingAspect)
|
||||
connect(m_qmlDebuggingAspect, &QmlDebuggingAspect::changed, warningLabel, changeHandler);
|
||||
if (auto qmlDebuggingAspect = m_buildConfig->aspect<QmlDebuggingAspect>())
|
||||
connect(qmlDebuggingAspect, &QmlDebuggingAspect::changed, warningLabel, changeHandler);
|
||||
changeHandler();
|
||||
}
|
||||
|
||||
|
@@ -29,36 +29,34 @@
|
||||
|
||||
#include <utils/aspects.h>
|
||||
|
||||
namespace ProjectExplorer { class Kit; }
|
||||
namespace ProjectExplorer { class BuildConfiguration; }
|
||||
|
||||
namespace QtSupport {
|
||||
|
||||
class QTSUPPORT_EXPORT QmlDebuggingAspect : public Utils::TriStateAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QmlDebuggingAspect();
|
||||
|
||||
void setKit(const ProjectExplorer::Kit *kit) { m_kit = kit; }
|
||||
public:
|
||||
explicit QmlDebuggingAspect(ProjectExplorer::BuildConfiguration *buildConfig);
|
||||
|
||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
||||
|
||||
private:
|
||||
const ProjectExplorer::Kit *m_kit = nullptr;
|
||||
const ProjectExplorer::BuildConfiguration *m_buildConfig = nullptr;
|
||||
};
|
||||
|
||||
class QTSUPPORT_EXPORT QtQuickCompilerAspect : public Utils::TriStateAspect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QtQuickCompilerAspect(QmlDebuggingAspect *qmlAspect);
|
||||
|
||||
void setKit(const ProjectExplorer::Kit *kit) { m_kit = kit; }
|
||||
public:
|
||||
QtQuickCompilerAspect(ProjectExplorer::BuildConfiguration *buildConfig);
|
||||
|
||||
private:
|
||||
void addToLayout(Utils::LayoutBuilder &builder) override;
|
||||
|
||||
const ProjectExplorer::Kit *m_kit = nullptr;
|
||||
const QmlDebuggingAspect *m_qmlDebuggingAspect = nullptr;
|
||||
const ProjectExplorer::BuildConfiguration *m_buildConfig = nullptr;
|
||||
};
|
||||
|
||||
} // namespace QtSupport
|
||||
|
Reference in New Issue
Block a user