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