forked from qt-creator/qt-creator
ProjectExplorer: Add a base class for build aspects
... and make use of it in the QmlDebuggingAspect. A build setting is conceptually not a boolean, but a tri-state, as we need to support force-switching a feature on and off as well as specifying that it is to be left at its default value. Change-Id: I15552614c5cf4f5187c026909d233c13e3487e81 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -45,7 +45,6 @@
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
#include <qtsupport/qtbuildaspects.h>
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
@@ -150,8 +149,6 @@ void QbsBuildConfiguration::initialize()
|
||||
+ '_' + kitHash.toHex().left(16);
|
||||
|
||||
m_configurationName->setValue(uniqueConfigName);
|
||||
if (initialBuildType() == Release)
|
||||
aspect<QtSupport::QmlDebuggingAspect>()->setDefaultValue(false);
|
||||
|
||||
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||
auto bs = new QbsBuildStep(buildSteps);
|
||||
@@ -377,7 +374,12 @@ QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep)
|
||||
|
||||
bool QbsBuildConfiguration::isQmlDebuggingEnabled() const
|
||||
{
|
||||
return aspect<QtSupport::QmlDebuggingAspect>()->value();
|
||||
return qmlDebuggingSetting() == QtSupport::QmlDebuggingAspect::Value::Enabled;
|
||||
}
|
||||
|
||||
BaseTriStateAspect::Value QbsBuildConfiguration::qmlDebuggingSetting() const
|
||||
{
|
||||
return aspect<QtSupport::QmlDebuggingAspect>()->setting();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <qtsupport/baseqtversion.h>
|
||||
#include <qtsupport/qtbuildaspects.h>
|
||||
|
||||
namespace ProjectExplorer { class BuildStep; }
|
||||
|
||||
@@ -75,6 +76,7 @@ public:
|
||||
QString equivalentCommandLine(const ProjectExplorer::BuildStep *buildStep) const;
|
||||
|
||||
bool isQmlDebuggingEnabled() const;
|
||||
QtSupport::QmlDebuggingAspect::Value qmlDebuggingSetting() const;
|
||||
|
||||
signals:
|
||||
void qbsConfigurationChanged();
|
||||
|
||||
@@ -213,10 +213,17 @@ QVariantMap QbsBuildStep::qbsConfiguration(VariableHandling variableHandling) co
|
||||
{
|
||||
QVariantMap config = m_qbsConfiguration;
|
||||
config.insert(Constants::QBS_FORCE_PROBES_KEY, m_forceProbes);
|
||||
if (static_cast<QbsBuildConfiguration *>(buildConfiguration())->isQmlDebuggingEnabled())
|
||||
switch (static_cast<QbsBuildConfiguration *>(buildConfiguration())->qmlDebuggingSetting()) {
|
||||
case QtSupport::QmlDebuggingAspect::Value::Enabled:
|
||||
config.insert(Constants::QBS_CONFIG_QUICK_DEBUG_KEY, true);
|
||||
else
|
||||
break;
|
||||
case QtSupport::QmlDebuggingAspect::Value::Disabled:
|
||||
config.insert(Constants::QBS_CONFIG_QUICK_DEBUG_KEY, false);
|
||||
break;
|
||||
default:
|
||||
config.remove(Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
|
||||
break;
|
||||
}
|
||||
if (variableHandling == ExpandVariables) {
|
||||
const MacroExpander * const expander = buildConfiguration()->macroExpander();
|
||||
for (auto it = config.begin(), end = config.end(); it != end; ++it) {
|
||||
@@ -667,8 +674,16 @@ void QbsBuildStepConfigWidget::updateState()
|
||||
command += ' ' + m_propertyCache.at(i).name + ':' + m_propertyCache.at(i).effectiveValue;
|
||||
}
|
||||
|
||||
if (qbsBuildConfig->isQmlDebuggingEnabled())
|
||||
switch (qbsBuildConfig->qmlDebuggingSetting()) {
|
||||
case QtSupport::QmlDebuggingAspect::Value::Enabled:
|
||||
command.append(' ').append(Constants::QBS_CONFIG_QUICK_DEBUG_KEY).append(":true");
|
||||
break;
|
||||
case QtSupport::QmlDebuggingAspect::Value::Disabled:
|
||||
command.append(' ').append(Constants::QBS_CONFIG_QUICK_DEBUG_KEY).append(":false");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
commandLineTextEdit->setPlainText(command);
|
||||
|
||||
setSummaryText(tr("<b>Qbs:</b> %1").arg(command));
|
||||
|
||||
Reference in New Issue
Block a user