QmlDesigner: Adding useOnlyFallbackPuppet to settings

Change-Id: Id9e5f71865f50d3f148cd6cd556024d39b03b89a
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
This commit is contained in:
Thomas Hartmann
2014-08-05 18:18:27 +02:00
parent fb1f1c2c46
commit c7f35c63e6
5 changed files with 22 additions and 6 deletions

View File

@@ -47,12 +47,13 @@
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <qmldesignerwarning.h> #include <qmldesignerwarning.h>
#include <qmldesignerplugin.h>
#include <designersettings.h>
#include "puppetbuildprogressdialog.h" #include "puppetbuildprogressdialog.h"
namespace QmlDesigner { namespace QmlDesigner {
bool PuppetCreator::m_useOnlyFallbackPuppet = !qgetenv("USE_ONLY_FALLBACK_QML_PUPPET").isEmpty();
QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml1PuppetForKitPuppetHash; QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml1PuppetForKitPuppetHash;
QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml2PuppetForKitPuppetHash; QHash<Core::Id, PuppetCreator::PuppetType> PuppetCreator::m_qml2PuppetForKitPuppetHash;
@@ -105,6 +106,13 @@ QDateTime PuppetCreator::puppetSourceLastModified() const
return lastModified; 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) PuppetCreator::PuppetCreator(ProjectExplorer::Kit *kit, const QString &qtCreatorVersion)
: m_qtCreatorVersion(qtCreatorVersion), : m_qtCreatorVersion(qtCreatorVersion),
m_kit(kit), m_kit(kit),
@@ -252,7 +260,7 @@ void PuppetCreator::createQml1PuppetExecutableIfMissing()
{ {
m_availablePuppetType = FallbackPuppet; m_availablePuppetType = FallbackPuppet;
if (!m_useOnlyFallbackPuppet && m_kit) { if (!useOnlyFallbackPuppet() && m_kit) {
if (m_qml1PuppetForKitPuppetHash.contains(m_kit->id())) { if (m_qml1PuppetForKitPuppetHash.contains(m_kit->id())) {
m_availablePuppetType = m_qml1PuppetForKitPuppetHash.value(m_kit->id()); m_availablePuppetType = m_qml1PuppetForKitPuppetHash.value(m_kit->id());
} else if (checkQmlpuppetIsReady()) { } else if (checkQmlpuppetIsReady()) {
@@ -274,7 +282,7 @@ void PuppetCreator::createQml2PuppetExecutableIfMissing()
{ {
m_availablePuppetType = FallbackPuppet; m_availablePuppetType = FallbackPuppet;
if (!m_useOnlyFallbackPuppet && m_kit) { if (!useOnlyFallbackPuppet() && m_kit) {
if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) { if (m_qml2PuppetForKitPuppetHash.contains(m_kit->id())) {
m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id()); m_availablePuppetType = m_qml2PuppetForKitPuppetHash.value(m_kit->id());
} else if (checkQml2PuppetIsReady()) { } else if (checkQml2PuppetIsReady()) {

View File

@@ -110,12 +110,13 @@ protected:
QDateTime qtLastModified() const; QDateTime qtLastModified() const;
QDateTime puppetSourceLastModified() const; QDateTime puppetSourceLastModified() const;
bool useOnlyFallbackPuppet() const;
private: private:
QString m_qtCreatorVersion; QString m_qtCreatorVersion;
mutable QString m_compileLog; mutable QString m_compileLog;
ProjectExplorer::Kit *m_kit; ProjectExplorer::Kit *m_kit;
PuppetType m_availablePuppetType; PuppetType m_availablePuppetType;
static bool m_useOnlyFallbackPuppet;
static QHash<Core::Id, PuppetType> m_qml1PuppetForKitPuppetHash; static QHash<Core::Id, PuppetType> m_qml1PuppetForKitPuppetHash;
static QHash<Core::Id, PuppetType> m_qml2PuppetForKitPuppetHash; static QHash<Core::Id, PuppetType> m_qml2PuppetForKitPuppetHash;
}; };

View File

@@ -43,7 +43,8 @@ DesignerSettings::DesignerSettings()
designerWarningsInEditor(false), designerWarningsInEditor(false),
showDebugView(false), showDebugView(false),
enableDebugView(false), enableDebugView(false),
alwaysSaveInCrumbleBar(false) alwaysSaveInCrumbleBar(false),
useOnlyFallbackPuppet(false)
{} {}
void DesignerSettings::fromSettings(QSettings *settings) void DesignerSettings::fromSettings(QSettings *settings)
@@ -66,6 +67,8 @@ void DesignerSettings::fromSettings(QSettings *settings)
QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool(); QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool();
alwaysSaveInCrumbleBar = settings->value( alwaysSaveInCrumbleBar = settings->value(
QLatin1String(QmlDesigner::Constants::QML_ALWAYS_SAFE_IN_CRUMBLEBAR), QVariant(false)).toBool(); 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();
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_SHOW_DEBUGVIEW), showDebugView);
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView); 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_ALWAYS_SAFE_IN_CRUMBLEBAR), alwaysSaveInCrumbleBar);
settings->setValue(QLatin1String(QmlDesigner::Constants::QML_USE_ONLY_FALLBACK_PUPPET), useOnlyFallbackPuppet);
settings->endGroup(); settings->endGroup();
settings->endGroup(); settings->endGroup();
@@ -98,5 +102,6 @@ bool DesignerSettings::equals(const DesignerSettings &other) const
&& designerWarningsInEditor == other.designerWarningsInEditor && designerWarningsInEditor == other.designerWarningsInEditor
&& showDebugView == other.showDebugView && showDebugView == other.showDebugView
&& enableDebugView == other.enableDebugView && enableDebugView == other.enableDebugView
&& alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar; && alwaysSaveInCrumbleBar == other.alwaysSaveInCrumbleBar
&& useOnlyFallbackPuppet == other.useOnlyFallbackPuppet;
} }

View File

@@ -56,6 +56,7 @@ public:
bool showDebugView; bool showDebugView;
bool enableDebugView; bool enableDebugView;
bool alwaysSaveInCrumbleBar; bool alwaysSaveInCrumbleBar;
bool useOnlyFallbackPuppet;
}; };
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2) inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)

View File

@@ -65,6 +65,7 @@ const char QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY[] = "WarnAboutQtQuickD
const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView"; const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView";
const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView"; const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView";
const char QML_ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar"; const char QML_ALWAYS_SAFE_IN_CRUMBLEBAR[] = "AlwaysSafeInCrumbleBar";
const char QML_USE_ONLY_FALLBACK_PUPPET[] = "AseOnlyFallbackPuppet";
const char QML_DESIGNER_SUBFOLDER[] = "/designer/"; const char QML_DESIGNER_SUBFOLDER[] = "/designer/";