ProjectExplorer: Use full class for TriState value

Allows more compact code on the user side in most cases and
can hide the internal 'int-ness' from user code by wrapping
Variant conversions in the TriState class itself.

Change-Id: I4c91e0cd798ee988a0b9cb057749251a4efebaff
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-11-15 16:20:33 +01:00
parent 3b9ce98865
commit ce434ccb5d
14 changed files with 151 additions and 162 deletions

View File

@@ -33,9 +33,9 @@ namespace ProjectExplorer {
class PROJECTEXPLORER_EXPORT BuildPropertiesSettings
{
public:
BaseTriStateAspect::Value separateDebugInfo = BaseTriStateAspect::Value::Default;
BaseTriStateAspect::Value qmlDebugging = BaseTriStateAspect::Value::Default;
BaseTriStateAspect::Value qtQuickCompiler = BaseTriStateAspect::Value::Default;
TriState separateDebugInfo;
TriState qmlDebugging;
TriState qtQuickCompiler;
bool showQtSettings = false;
};

View File

@@ -43,16 +43,16 @@ public:
const BuildPropertiesSettings &settings = ProjectExplorerPlugin::buildPropertiesSettings();
for (QComboBox * const comboBox : {&m_separateDebugInfoComboBox, &m_qmlDebuggingComboBox,
&m_qtQuickCompilerComboBox}) {
comboBox->addItem(tr("Enable"), int(BaseTriStateAspect::Value::Enabled));
comboBox->addItem(tr("Disable"), int(BaseTriStateAspect::Value::Disabled));
comboBox->addItem(tr("Use Project Default"), int(BaseTriStateAspect::Value::Default));
comboBox->addItem(tr("Enable"), TriState::Enabled.toVariant());
comboBox->addItem(tr("Disable"),TriState::Disabled.toVariant());
comboBox->addItem(tr("Use Project Default"), TriState::Default.toVariant());
}
m_separateDebugInfoComboBox.setCurrentIndex(m_separateDebugInfoComboBox
.findData(int(settings.separateDebugInfo)));
.findData(settings.separateDebugInfo.toVariant()));
m_qmlDebuggingComboBox.setCurrentIndex(m_qmlDebuggingComboBox
.findData(int(settings.qmlDebugging)));
.findData(settings.qmlDebugging.toVariant()));
m_qtQuickCompilerComboBox.setCurrentIndex(m_qtQuickCompilerComboBox
.findData(int(settings.qtQuickCompiler)));
.findData(settings.qtQuickCompiler.toVariant()));
const auto layout = new QFormLayout(this);
layout->addRow(tr("Separate debug info:"), &m_separateDebugInfoComboBox);
if (settings.showQtSettings) {
@@ -67,12 +67,9 @@ public:
BuildPropertiesSettings settings() const
{
BuildPropertiesSettings s;
s.separateDebugInfo = static_cast<BaseTriStateAspect::Value>(
m_separateDebugInfoComboBox.currentData().toInt());
s.qmlDebugging = static_cast<BaseTriStateAspect::Value>(
m_qmlDebuggingComboBox.currentData().toInt());
s.qtQuickCompiler = static_cast<BaseTriStateAspect::Value>(
m_qtQuickCompilerComboBox.currentData().toInt());
s.separateDebugInfo = TriState::fromVariant(m_separateDebugInfoComboBox.currentData());
s.qmlDebugging = TriState::fromVariant(m_qmlDebuggingComboBox.currentData());
s.qtQuickCompiler = TriState::fromVariant(m_qtQuickCompilerComboBox.currentData());
return s;
}

View File

@@ -688,18 +688,25 @@ BaseTriStateAspect::BaseTriStateAspect()
addOption(tr("Leave at Default"));
}
BaseTriStateAspect::Value BaseTriStateAspect::setting() const
TriState BaseTriStateAspect::setting() const
{
if (value() == 0)
return Value::Enabled;
if (value() == 1)
return Value::Disabled;
return Value::Default;
return TriState::fromVariant(value());
}
void BaseTriStateAspect::setSetting(BaseTriStateAspect::Value setting)
void BaseTriStateAspect::setSetting(TriState setting)
{
setValue(setting == Value::Enabled ? 0 : setting == Value::Disabled ? 1 : 2);
setValue(setting.toVariant().toInt());
}
const TriState TriState::Enabled{TriState::EnabledValue};
const TriState TriState::Disabled{TriState::DisabledValue};
const TriState TriState::Default{TriState::DefaultValue};
TriState TriState::fromVariant(const QVariant &variant)
{
int v = variant.toInt();
QTC_ASSERT(v == EnabledValue || v == DisabledValue || v == DefaultValue, v = DefaultValue);
return TriState(Value(v));
}
} // namespace ProjectExplorer

View File

@@ -190,15 +190,36 @@ private:
std::unique_ptr<Internal::BaseIntegerAspectPrivate> d;
};
class PROJECTEXPLORER_EXPORT TriState
{
enum Value { EnabledValue, DisabledValue, DefaultValue };
explicit TriState(Value v) : m_value(v) {}
public:
TriState() = default;
QVariant toVariant() const { return int(m_value); }
static TriState fromVariant(const QVariant &variant);
static const TriState Enabled;
static const TriState Disabled;
static const TriState Default;
friend bool operator==(TriState a, TriState b) { return a.m_value == b.m_value; }
friend bool operator!=(TriState a, TriState b) { return a.m_value != b.m_value; }
private:
Value m_value = DefaultValue;
};
class PROJECTEXPLORER_EXPORT BaseTriStateAspect : public BaseSelectionAspect
{
Q_OBJECT
public:
BaseTriStateAspect();
enum class Value { Enabled, Disabled, Default };
Value setting() const;
void setSetting(Value setting);
TriState setting() const;
void setSetting(TriState setting);
};
} // namespace ProjectExplorer

View File

@@ -1426,8 +1426,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
dd->m_projectExplorerSettings.buildDirectoryTemplate = Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE;
const auto loadTriStateValue = [&s](const QString &key) {
return static_cast<BaseTriStateAspect::Value>(
s->value(key, int(BaseTriStateAspect::Value::Default)).toInt());
return TriState::fromVariant(s->value(key, TriState::Default.toVariant()));
};
dd->m_buildPropertiesSettings.separateDebugInfo
= loadTriStateValue(Constants::SEPARATE_DEBUG_INFO_SETTINGS_KEY);
@@ -2049,11 +2048,11 @@ void ProjectExplorerPluginPrivate::savePersistentSettings()
s->setValue(Constants::DEFAULT_BUILD_DIRECTORY_TEMPLATE_KEY, dd->m_projectExplorerSettings.buildDirectoryTemplate);
s->setValue(Constants::SEPARATE_DEBUG_INFO_SETTINGS_KEY,
int(dd->m_buildPropertiesSettings.separateDebugInfo));
dd->m_buildPropertiesSettings.separateDebugInfo.toVariant());
s->setValue(Constants::QML_DEBUGGING_SETTINGS_KEY,
int(dd->m_buildPropertiesSettings.qmlDebugging));
dd->m_buildPropertiesSettings.qmlDebugging.toVariant());
s->setValue(Constants::QT_QUICK_COMPILER_SETTINGS_KEY,
int(dd->m_buildPropertiesSettings.qtQuickCompiler));
dd->m_buildPropertiesSettings.qtQuickCompiler.toVariant());
}
void ProjectExplorerPlugin::openProjectWelcomePage(const QString &fileName)

View File

@@ -383,20 +383,20 @@ QString QbsBuildConfiguration::equivalentCommandLine(const BuildStep *buildStep)
bool QbsBuildConfiguration::isQmlDebuggingEnabled() const
{
return qmlDebuggingSetting() == QtSupport::QmlDebuggingAspect::Value::Enabled;
return qmlDebuggingSetting() == TriState::Enabled;
}
BaseTriStateAspect::Value QbsBuildConfiguration::qmlDebuggingSetting() const
TriState QbsBuildConfiguration::qmlDebuggingSetting() const
{
return aspect<QtSupport::QmlDebuggingAspect>()->setting();
}
BaseTriStateAspect::Value QbsBuildConfiguration::qtQuickCompilerSetting() const
TriState QbsBuildConfiguration::qtQuickCompilerSetting() const
{
return aspect<QtSupport::QtQuickCompilerAspect>()->setting();
}
BaseTriStateAspect::Value QbsBuildConfiguration::separateDebugInfoSetting() const
TriState QbsBuildConfiguration::separateDebugInfoSetting() const
{
return aspect<SeparateDebugInfoAspect>()->setting();
}

View File

@@ -77,9 +77,9 @@ public:
QString equivalentCommandLine(const ProjectExplorer::BuildStep *buildStep) const;
bool isQmlDebuggingEnabled() const;
QtSupport::QmlDebuggingAspect::Value qmlDebuggingSetting() const;
QtSupport::QtQuickCompilerAspect::Value qtQuickCompilerSetting() const;
ProjectExplorer::SeparateDebugInfoAspect::Value separateDebugInfoSetting() const;
ProjectExplorer::TriState qmlDebuggingSetting() const;
ProjectExplorer::TriState qtQuickCompilerSetting() const;
ProjectExplorer::TriState separateDebugInfoSetting() const;
signals:
void qbsConfigurationChanged();

View File

@@ -214,39 +214,25 @@ QVariantMap QbsBuildStep::qbsConfiguration(VariableHandling variableHandling) co
QVariantMap config = m_qbsConfiguration;
const auto qbsBuildConfig = static_cast<QbsBuildConfiguration *>(buildConfiguration());
config.insert(Constants::QBS_FORCE_PROBES_KEY, m_forceProbes);
switch (qbsBuildConfig->separateDebugInfoSetting()) {
case SeparateDebugInfoAspect::Value::Enabled:
config.insert(Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY, true);
break;
case SeparateDebugInfoAspect::Value::Disabled:
config.insert(Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY, false);
break;
default:
config.remove(Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY);
break;
}
switch (qbsBuildConfig->qmlDebuggingSetting()) {
case QtSupport::QmlDebuggingAspect::Value::Enabled:
config.insert(Constants::QBS_CONFIG_QUICK_DEBUG_KEY, true);
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;
}
switch (qbsBuildConfig->qtQuickCompilerSetting()) {
case QtSupport::QtQuickCompilerAspect::Value::Enabled:
config.insert(Constants::QBS_CONFIG_QUICK_COMPILER_KEY, true);
break;
case QtSupport::QtQuickCompilerAspect::Value::Disabled:
config.insert(Constants::QBS_CONFIG_QUICK_COMPILER_KEY, false);
break;
default:
config.remove(Constants::QBS_CONFIG_QUICK_COMPILER_KEY);
break;
}
const auto store = [&config](TriState ts, const QString &key) {
if (ts == TriState::Enabled)
config.insert(key, true);
else if (ts == TriState::Disabled)
config.insert(key, false);
else
config.remove(key);
};
store(qbsBuildConfig->separateDebugInfoSetting(),
Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY);
store(qbsBuildConfig->qmlDebuggingSetting(),
Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
store(qbsBuildConfig->qtQuickCompilerSetting(),
Constants::QBS_CONFIG_QUICK_COMPILER_KEY);
if (variableHandling == ExpandVariables) {
const MacroExpander * const expander = buildConfiguration()->macroExpander();
for (auto it = config.begin(), end = config.end(); it != end; ++it) {
@@ -697,36 +683,23 @@ void QbsBuildStepConfigWidget::updateState()
command += ' ' + m_propertyCache.at(i).name + ':' + m_propertyCache.at(i).effectiveValue;
}
switch (qbsBuildConfig->separateDebugInfoSetting()) {
case SeparateDebugInfoAspect::Value::Enabled:
command.append(' ').append(Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY).append(":true");
break;
case SeparateDebugInfoAspect::Value::Disabled:
command.append(' ').append(Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY).append(":false");
break;
default:
break;
}
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;
}
switch (qbsBuildConfig->qtQuickCompilerSetting()) {
case QtSupport::QtQuickCompilerAspect::Value::Enabled:
command.append(' ').append(Constants::QBS_CONFIG_QUICK_COMPILER_KEY).append(":true");
break;
case QtSupport::QtQuickCompilerAspect::Value::Disabled:
command.append(' ').append(Constants::QBS_CONFIG_QUICK_COMPILER_KEY).append(":false");
break;
default:
break;
}
const auto addToCommand = [&command](TriState ts, const QString &key) {
if (ts == TriState::Enabled)
command.append(' ').append(key).append(":true");
else if (ts == TriState::Disabled)
command.append(' ').append(key).append(":false");
// Do nothing for TriState::Default
};
addToCommand(qbsBuildConfig->separateDebugInfoSetting(),
Constants::QBS_CONFIG_SEPARATE_DEBUG_INFO_KEY);
addToCommand(qbsBuildConfig->qmlDebuggingSetting(),
Constants::QBS_CONFIG_QUICK_DEBUG_KEY);
addToCommand(qbsBuildConfig->qtQuickCompilerSetting(),
Constants::QBS_CONFIG_QUICK_COMPILER_KEY);
commandLineTextEdit->setPlainText(command);
setSummaryText(tr("<b>Qbs:</b> %1").arg(command));

View File

@@ -38,10 +38,10 @@
using namespace QmakeProjectManager;
using namespace Internal;
using namespace ProjectExplorer;
using Utils::FilePath;
using Utils::QtcProcess;
using ProjectExplorer::BaseTriStateAspect;
using QtSupport::QtVersionManager;
using QtSupport::BaseQtVersion;
@@ -192,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 = BaseTriStateAspect::Value::Enabled;
m_config.linkQmlDebuggingQQ2 = TriState::Enabled;
else
m_config.linkQmlDebuggingQQ2 = BaseTriStateAspect::Value::Disabled;
m_config.linkQmlDebuggingQQ2 = TriState::Disabled;
} else if (value == QLatin1String("qtquickcompiler")) {
if (qa.op == QLatin1String("+="))
m_config.useQtQuickCompiler = BaseTriStateAspect::Value::Enabled;
m_config.useQtQuickCompiler = TriState::Enabled;
else
m_config.useQtQuickCompiler = BaseTriStateAspect::Value::Disabled;
m_config.useQtQuickCompiler = TriState::Disabled;
} else if (value == QLatin1String("force_debug_info")) {
if (qa.op == QLatin1String("+="))
foundForceDebugInfo = true;
@@ -225,7 +225,7 @@ void MakeFileParse::parseAssignments(QList<QMakeAssignment> *assignments)
}
if (foundForceDebugInfo && foundSeparateDebugInfo) {
m_config.separateDebugInfo = ProjectExplorer::BaseTriStateAspect::Value::Enabled;
m_config.separateDebugInfo = TriState::Enabled;
} else if (foundForceDebugInfo) {
// Found only force_debug_info, so readd it
QMakeAssignment newQA;
@@ -376,11 +376,11 @@ void MakeFileParse::parseCommandLine(const QString &command, const QString &proj
qCDebug(logging()) << " TargetArch" << m_config.archConfig;
qCDebug(logging()) << " OsType" << m_config.osType;
qCDebug(logging()) << " LinkQmlDebuggingQQ2"
<< (m_config.linkQmlDebuggingQQ2 == BaseTriStateAspect::Value::Enabled);
<< (m_config.linkQmlDebuggingQQ2 == TriState::Enabled);
qCDebug(logging()) << " Qt Quick Compiler"
<< (m_config.useQtQuickCompiler == BaseTriStateAspect::Value::Enabled);
<< (m_config.useQtQuickCompiler == TriState::Enabled);
qCDebug(logging()) << " Separate Debug Info"
<< (m_config.separateDebugInfo == BaseTriStateAspect::Value::Enabled);
<< (m_config.separateDebugInfo == TriState::Enabled);
// Create command line of all unfiltered arguments
foreach (const QMakeAssignment &qa, assignments)
@@ -525,8 +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 == BaseTriStateAspect::Value::Enabled, linkQmlDebuggingQQ2);
QCOMPARE(qmsc.useQtQuickCompiler == BaseTriStateAspect::Value::Enabled, useQtQuickCompiler);
QCOMPARE(qmsc.separateDebugInfo == BaseTriStateAspect::Value::Enabled, separateDebugInfo);
QCOMPARE(qmsc.linkQmlDebuggingQQ2 == TriState::Enabled, linkQmlDebuggingQQ2);
QCOMPARE(qmsc.useQtQuickCompiler == TriState::Enabled, useQtQuickCompiler);
QCOMPARE(qmsc.separateDebugInfo == TriState::Enabled, separateDebugInfo);
}
#endif

View File

@@ -179,16 +179,15 @@ void QmakeBuildConfiguration::initialize()
QString additionalArguments = qmakeExtra.additionalArguments;
if (!additionalArguments.isEmpty())
qmakeStep->setUserArguments(additionalArguments);
if (qmakeExtra.config.separateDebugInfo == SeparateDebugInfoAspect::Value::Enabled)
if (qmakeExtra.config.separateDebugInfo == TriState::Enabled)
forceSeparateDebugInfo(true);
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);
}
if (qmakeExtra.config.linkQmlDebuggingQQ2 != TriState::Default)
forceQmlDebugging(qmakeExtra.config.linkQmlDebuggingQQ2 == TriState::Enabled);
if (qmakeExtra.config.useQtQuickCompiler != TriState::Default)
forceQtQuickCompiler(qmakeExtra.config.useQtQuickCompiler == TriState::Enabled);
setQMakeBuildConfiguration(config);
@@ -418,7 +417,7 @@ bool QmakeBuildConfiguration::isBuildDirAtSafeLocation() const
buildDirectory().toString());
}
SeparateDebugInfoAspect::Value QmakeBuildConfiguration::separateDebugInfo() const
TriState QmakeBuildConfiguration::separateDebugInfo() const
{
return aspect<SeparateDebugInfoAspect>()->setting();
}
@@ -426,37 +425,33 @@ SeparateDebugInfoAspect::Value QmakeBuildConfiguration::separateDebugInfo() cons
void QmakeBuildConfiguration::forceSeparateDebugInfo(bool sepDebugInfo)
{
aspect<SeparateDebugInfoAspect>()->setSetting(sepDebugInfo
? SeparateDebugInfoAspect::Value::Enabled
: SeparateDebugInfoAspect::Value::Disabled);
? TriState::Enabled
: TriState::Disabled);
}
BaseTriStateAspect::Value QmakeBuildConfiguration::qmlDebugging() const
TriState QmakeBuildConfiguration::qmlDebugging() const
{
return aspect<QmlDebuggingAspect>()->setting();
}
bool QmakeBuildConfiguration::linkQmlDebuggingLibrary() const
{
return qmlDebugging() == QmlDebuggingAspect::Value::Enabled;
return qmlDebugging() == TriState::Enabled;
}
void QmakeBuildConfiguration::forceQmlDebugging(bool enable)
{
aspect<QmlDebuggingAspect>()->setSetting(enable
? QmlDebuggingAspect::Value::Enabled
: QmlDebuggingAspect::Value::Disabled);
aspect<QmlDebuggingAspect>()->setSetting(enable ? TriState::Enabled : TriState::Disabled);
}
BaseTriStateAspect::Value QmakeBuildConfiguration::useQtQuickCompiler() const
TriState QmakeBuildConfiguration::useQtQuickCompiler() const
{
return aspect<QtQuickCompilerAspect>()->setting();
}
void QmakeBuildConfiguration::forceQtQuickCompiler(bool enable)
{
aspect<QtQuickCompilerAspect>()->setSetting(enable
? QtQuickCompilerAspect::Value::Enabled
: QtQuickCompilerAspect::Value::Disabled);
aspect<QtQuickCompilerAspect>()->setSetting(enable ? TriState::Enabled : TriState::Disabled);
}
QStringList QmakeBuildConfiguration::configCommandLineArguments() const
@@ -743,7 +738,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 = QtQuickCompilerAspect::Value::Enabled;
extraInfo.config.useQtQuickCompiler = TriState::Enabled;
} else {
if (type == BuildConfiguration::Debug) {
//: The name of the debug build configuration created by default for a qmake project.
@@ -755,12 +750,12 @@ BuildInfo QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k,
info.displayName = tr("Profile");
//: Non-ASCII characters in directory suffix may cause build issues.
suffix = tr("Profile", "Shadow build directory suffix");
extraInfo.config.separateDebugInfo = SeparateDebugInfoAspect::Value::Enabled;
extraInfo.config.separateDebugInfo = TriState::Enabled;
if (version && version->isQtQuickCompilerSupported())
extraInfo.config.useQtQuickCompiler = QtQuickCompilerAspect::Value::Enabled;
extraInfo.config.useQtQuickCompiler = TriState::Enabled;
}
if (version && version->isQmlDebuggingSupported())
extraInfo.config.linkQmlDebuggingQQ2 = QmlDebuggingAspect::Value::Enabled;
extraInfo.config.linkQmlDebuggingQQ2 = TriState::Enabled;
}
info.typeName = info.displayName;
// Leave info.buildDirectory unset;
@@ -820,7 +815,7 @@ BuildConfiguration::BuildType QmakeBuildConfiguration::buildType() const
{
if (qmakeBuildConfiguration() & BaseQtVersion::DebugBuild)
return Debug;
if (separateDebugInfo() == SeparateDebugInfoAspect::Value::Enabled)
if (separateDebugInfo() == TriState::Enabled)
return Profile;
return Release;
}

View File

@@ -99,14 +99,14 @@ public:
static bool isBuildDirAtSafeLocation(const QString &sourceDir, const QString &buildDir);
bool isBuildDirAtSafeLocation() const;
ProjectExplorer::BaseTriStateAspect::Value separateDebugInfo() const;
ProjectExplorer::TriState separateDebugInfo() const;
void forceSeparateDebugInfo(bool sepDebugInfo);
ProjectExplorer::BaseTriStateAspect::Value qmlDebugging() const;
ProjectExplorer::TriState qmlDebugging() const;
bool linkQmlDebuggingLibrary() const;
void forceQmlDebugging(bool enable);
ProjectExplorer::BaseTriStateAspect::Value useQtQuickCompiler() const;
ProjectExplorer::TriState useQtQuickCompiler() const;
void forceQtQuickCompiler(bool enable);
signals:

View File

@@ -837,19 +837,19 @@ QStringList QMakeStepConfig::toArguments() const
else if (osType == IphoneOS)
arguments << "CONFIG+=iphoneos" << "CONFIG+=device" /*since Qt 5.7*/;
if (linkQmlDebuggingQQ2 == BaseTriStateAspect::Value::Enabled)
if (linkQmlDebuggingQQ2 == TriState::Enabled)
arguments << "CONFIG+=qml_debug";
else if (linkQmlDebuggingQQ2 == BaseTriStateAspect::Value::Disabled)
else if (linkQmlDebuggingQQ2 == TriState::Disabled)
arguments << "CONFIG-=qml_debug";
if (useQtQuickCompiler == BaseTriStateAspect::Value::Enabled)
if (useQtQuickCompiler == TriState::Enabled)
arguments << "CONFIG+=qtquickcompiler";
else if (useQtQuickCompiler == BaseTriStateAspect::Value::Disabled)
else if (useQtQuickCompiler == TriState::Disabled)
arguments << "CONFIG-=qtquickcompiler";
if (separateDebugInfo == BaseTriStateAspect::Value::Enabled)
if (separateDebugInfo == TriState::Enabled)
arguments << "CONFIG+=force_debug_info" << "CONFIG+=separate_debug_info";
else if (separateDebugInfo == BaseTriStateAspect::Value::Disabled)
else if (separateDebugInfo == TriState::Disabled)
arguments << "CONFIG-=separate_debug_info";
if (!sysRoot.isEmpty()) {

View File

@@ -84,12 +84,9 @@ public:
QString targetTriple;
TargetArchConfig archConfig = NoArch;
OsType osType = NoOsType;
ProjectExplorer::BaseTriStateAspect::Value separateDebugInfo
= ProjectExplorer::BaseTriStateAspect::Value::Default;
ProjectExplorer::BaseTriStateAspect::Value linkQmlDebuggingQQ2
= ProjectExplorer::BaseTriStateAspect::Value::Default;
ProjectExplorer::BaseTriStateAspect::Value useQtQuickCompiler
= ProjectExplorer::BaseTriStateAspect::Value::Default;
ProjectExplorer::TriState separateDebugInfo;
ProjectExplorer::TriState linkQmlDebuggingQQ2;
ProjectExplorer::TriState useQtQuickCompiler;
};
@@ -107,9 +104,9 @@ inline bool operator !=(const QMakeStepConfig &a, const QMakeStepConfig &b) {
inline QDebug operator<<(QDebug dbg, const QMakeStepConfig &c)
{
dbg << c.archConfig << c.osType
<< (c.linkQmlDebuggingQQ2 == ProjectExplorer::BaseTriStateAspect::Value::Enabled)
<< (c.useQtQuickCompiler == ProjectExplorer::BaseTriStateAspect::Value::Enabled)
<< (c.separateDebugInfo == ProjectExplorer::BaseTriStateAspect::Value::Enabled);
<< (c.linkQmlDebuggingQQ2 == ProjectExplorer::TriState::Enabled)
<< (c.useQtQuickCompiler == ProjectExplorer::TriState::Enabled)
<< (c.separateDebugInfo == ProjectExplorer::TriState::Enabled);
return dbg;
}

View File

@@ -60,8 +60,8 @@ void QmlDebuggingAspect::addToLayout(LayoutBuilder &builder)
QString warningText;
const bool supported = m_kit && BaseQtVersion::isQmlDebuggingSupported(m_kit, &warningText);
if (!supported) {
setSetting(Value::Default);
} else if (setting() == Value::Enabled) {
setSetting(TriState::Default);
} else if (setting() == TriState::Enabled) {
warningText = tr("Might make your application vulnerable.<br/>"
"Only use in a safe environment.");
}
@@ -97,9 +97,9 @@ void QtQuickCompilerAspect::addToLayout(LayoutBuilder &builder)
const bool supported = m_kit
&& BaseQtVersion::isQtQuickCompilerSupported(m_kit, &warningText);
if (!supported)
setSetting(Value::Default);
if (setting() == Value::Enabled
&& m_qmlDebuggingAspect && m_qmlDebuggingAspect->setting() == Value::Enabled) {
setSetting(TriState::Default);
if (setting() == TriState::Enabled
&& m_qmlDebuggingAspect && m_qmlDebuggingAspect->setting() == TriState::Enabled) {
warningText = tr("Disables QML debugging. QML profiling will still work.");
}
warningTextLabel->setText(warningText);