From c7f35c63e6c49466aefa068a68db8f210423036a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Tue, 5 Aug 2014 18:18:27 +0200 Subject: [PATCH] QmlDesigner: Adding useOnlyFallbackPuppet to settings Change-Id: Id9e5f71865f50d3f148cd6cd556024d39b03b89a Reviewed-by: Tim Jenssen --- .../designercore/instances/puppetcreator.cpp | 14 +++++++++++--- .../designercore/instances/puppetcreator.h | 3 ++- src/plugins/qmldesigner/designersettings.cpp | 9 +++++++-- src/plugins/qmldesigner/designersettings.h | 1 + src/plugins/qmldesigner/qmldesignerconstants.h | 1 + 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp index 07ae2ff08d3..ff66653875c 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.cpp @@ -47,12 +47,13 @@ #include #include +#include +#include #include "puppetbuildprogressdialog.h" namespace QmlDesigner { -bool PuppetCreator::m_useOnlyFallbackPuppet = !qgetenv("USE_ONLY_FALLBACK_QML_PUPPET").isEmpty(); QHash PuppetCreator::m_qml1PuppetForKitPuppetHash; QHash PuppetCreator::m_qml2PuppetForKitPuppetHash; @@ -105,6 +106,13 @@ QDateTime PuppetCreator::puppetSourceLastModified() const return lastModified; } +bool PuppetCreator::useOnlyFallbackPuppet() const +{ + DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); + return settings.useOnlyFallbackPuppet + || !qgetenv("USE_ONLY_FALLBACK_PUPPET").isEmpty(); +} + PuppetCreator::PuppetCreator(ProjectExplorer::Kit *kit, const QString &qtCreatorVersion) : m_qtCreatorVersion(qtCreatorVersion), m_kit(kit), @@ -252,7 +260,7 @@ void PuppetCreator::createQml1PuppetExecutableIfMissing() { m_availablePuppetType = FallbackPuppet; - if (!m_useOnlyFallbackPuppet && m_kit) { + if (!useOnlyFallbackPuppet() && m_kit) { if (m_qml1PuppetForKitPuppetHash.contains(m_kit->id())) { m_availablePuppetType = m_qml1PuppetForKitPuppetHash.value(m_kit->id()); } else if (checkQmlpuppetIsReady()) { @@ -274,7 +282,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing() { m_availablePuppetType = FallbackPuppet; - if (!m_useOnlyFallbackPuppet && m_kit) { + if (!useOnlyFallbackPuppet() && m_kit) { if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) { m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id()); } else if (checkQml2PuppetIsReady()) { diff --git a/src/plugins/qmldesigner/designercore/instances/puppetcreator.h b/src/plugins/qmldesigner/designercore/instances/puppetcreator.h index 4c9b8c337b3..8d6612828d7 100644 --- a/src/plugins/qmldesigner/designercore/instances/puppetcreator.h +++ b/src/plugins/qmldesigner/designercore/instances/puppetcreator.h @@ -110,12 +110,13 @@ protected: QDateTime qtLastModified() const; QDateTime puppetSourceLastModified() const; + bool useOnlyFallbackPuppet() const; + private: QString m_qtCreatorVersion; mutable QString m_compileLog; ProjectExplorer::Kit *m_kit; PuppetType m_availablePuppetType; - static bool m_useOnlyFallbackPuppet; static QHash m_qml1PuppetForKitPuppetHash; static QHash m_qml2PuppetForKitPuppetHash; }; diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index 94d30aca6f1..e318ae0bf72 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -43,7 +43,8 @@ DesignerSettings::DesignerSettings() designerWarningsInEditor(false), showDebugView(false), enableDebugView(false), - alwaysSaveInCrumbleBar(false) + alwaysSaveInCrumbleBar(false), + useOnlyFallbackPuppet(false) {} void DesignerSettings::fromSettings(QSettings *settings) @@ -66,6 +67,8 @@ void DesignerSettings::fromSettings(QSettings *settings) QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool(); alwaysSaveInCrumbleBar = settings->value( QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), QVariant(false)).toBool(); + useOnlyFallbackPuppet = settings->value( + QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), QVariant(false)).toBool(); settings->endGroup(); settings->endGroup(); @@ -84,6 +87,7 @@ void DesignerSettings::toSettings(QSettings *settings) const settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), showDebugView); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), alwaysSaveInCrumbleBar); + settings->setValue(QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), useOnlyFallbackPuppet); settings->endGroup(); settings->endGroup(); @@ -98,5 +102,6 @@ bool DesignerSettings::equals(const DesignerSettings &other) const && designerWarningsInEditor == other.designerWarningsInEditor && showDebugView == other.showDebugView && enableDebugView == other.enableDebugView - && alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar; + && alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar + && useOnlyFallbackPuppet == other.useOnlyFallbackPuppet; } diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h index 829e92dc7ca..78e12abc86c 100644 --- a/src/plugins/qmldesigner/designersettings.h +++ b/src/plugins/qmldesigner/designersettings.h @@ -56,6 +56,7 @@ public: bool showDebugView; bool enableDebugView; bool alwaysSaveInCrumbleBar; + bool useOnlyFallbackPuppet; }; inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2) diff --git a/src/plugins/qmldesigner/qmldesignerconstants.h b/src/plugins/qmldesigner/qmldesignerconstants.h index 7a6c9c1be30..deb20fd44d9 100644 --- a/src/plugins/qmldesigner/qmldesignerconstants.h +++ b/src/plugins/qmldesigner/qmldesignerconstants.h @@ -65,6 +65,7 @@ const char QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY[] = "WarnAboutQtQuickD const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView"; const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView"; const char QML_ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar"; +const char QML_USE_ONLY_FALLBACK_PUPPET[] = "AseOnlyFallbackPuppet"; const char QML_DESIGNER_SUBFOLDER[] = "/designer/";