Detach QML debugging option from qmakes build mode

The coupling of qml_debug to qmake's Debug profile is both brittle and
wrong. There are good reasons to also enable qml debugging in certain
Release builds and changing the build type of a specific build often
leaves the UI in an inconsistent state.

Change-Id: I89cb86849c984278ebfc54f66f139ec482b18d9a
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-10-01 15:41:04 +02:00
parent 14eafd5dca
commit 703ce02d4c
3 changed files with 16 additions and 28 deletions

View File

@@ -324,23 +324,15 @@ void QMakeStep::setUserArguments(const QString &arguments)
bool QMakeStep::linkQmlDebuggingLibrary() const
{
if (m_linkQmlDebuggingLibrary == DoLink)
return true;
if (m_linkQmlDebuggingLibrary == DoNotLink)
return false;
const Core::Context languages = project()->projectLanguages();
if (!languages.contains(ProjectExplorer::Constants::LANG_QMLJS))
return false;
return (qmakeBuildConfiguration()->buildType() & BuildConfiguration::Debug);
return m_linkQmlDebuggingLibrary;
}
void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
{
if ((enable && (m_linkQmlDebuggingLibrary == DoLink))
|| (!enable && (m_linkQmlDebuggingLibrary == DoNotLink)))
if (enable == m_linkQmlDebuggingLibrary)
return;
m_linkQmlDebuggingLibrary = enable ? DoLink : DoNotLink;
m_linkQmlDebuggingLibrary = enable;
emit linkQmlDebuggingLibraryChanged();
@@ -414,8 +406,7 @@ QVariantMap QMakeStep::toMap() const
{
QVariantMap map(AbstractProcessStep::toMap());
map.insert(QLatin1String(QMAKE_ARGUMENTS_KEY), m_userArgs);
map.insert(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), m_linkQmlDebuggingLibrary == DebugLink);
map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary == DoLink);
map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary);
map.insert(QLatin1String(QMAKE_FORCED_KEY), m_forced);
map.insert(QLatin1String(QMAKE_USE_QTQUICKCOMPILER), m_useQtQuickCompiler);
map.insert(QLatin1String(QMAKE_SEPARATEDEBUGINFO_KEY), m_separateDebugInfo);
@@ -427,13 +418,15 @@ bool QMakeStep::fromMap(const QVariantMap &map)
m_userArgs = map.value(QLatin1String(QMAKE_ARGUMENTS_KEY)).toString();
m_forced = map.value(QLatin1String(QMAKE_FORCED_KEY), false).toBool();
m_useQtQuickCompiler = map.value(QLatin1String(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(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), false).toBool()) {
m_linkQmlDebuggingLibrary = DebugLink;
m_linkQmlDebuggingLibrary =
project()->projectLanguages().contains(ProjectExplorer::Constants::LANG_QMLJS) &&
(qmakeBuildConfiguration()->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild);
} else {
if (map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool())
m_linkQmlDebuggingLibrary = DoLink;
else
m_linkQmlDebuggingLibrary = DoNotLink;
m_linkQmlDebuggingLibrary = map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool();
}
m_separateDebugInfo = map.value(QLatin1String(QMAKE_SEPARATEDEBUGINFO_KEY), false).toBool();