From 0a8c34d382a64f21c446c6201287581246e38eec Mon Sep 17 00:00:00 2001
From: Kai Koehne <kai.koehne@nokia.com>
Date: Sat, 9 Oct 2010 21:20:15 +0200
Subject: [PATCH] QmlApp: Only use QMLJSDEBUGGER define to activate qml
 debugging

Don't confuse users by two defines they have to comment in when
they just want to 'debug': Instead QMLJSDEBUGGER now activates
both the Js Debugger & and the QmlObserver services. Finetuning
can still be done by using the (undocumented) NO_JSDEBUGGER,
NO_QMLOBSERVER defines.
---
 share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri   | 4 +++-
 share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro       | 2 --
 share/qtcreator/qml/qmlobserver/qmlobserver.pro           | 1 -
 share/qtcreator/templates/qmlapp/app.pro                  | 7 +++----
 .../qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp  | 8 ++++----
 .../qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri  | 4 ----
 6 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri
index 6abc94f3aca..50135803cde 100644
--- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri
+++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri
@@ -9,14 +9,16 @@ contains(CONFIG, dll) {
 }
 
 ## Input
+!contains(DEFINES, NO_JSDEBUGGER) {
 HEADERS += \
     include/jsdebuggeragent.h \
     include/qmljsdebugger_global.h
 
 SOURCES += \
     jsdebuggeragent.cpp
+}
 
-contains(DEFINES, QMLOBSERVER) {
+!contains(DEFINES, NO_QMLOBSERVER) {
     include($$PWD/editor/editor.pri)
 
     HEADERS += \
diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro
index 1fc040262e9..013795a1db6 100644
--- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro
+++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro
@@ -2,8 +2,6 @@ TEMPLATE = lib
 CONFIG+=dll
 TARGET = QmlJSDebugger
 
-DEFINES += QMLOBSERVER
-
 unix:QMAKE_CXXFLAGS_DEBUG += -O3
 
 include(../../../../src/qtcreatorlibrary.pri)
diff --git a/share/qtcreator/qml/qmlobserver/qmlobserver.pro b/share/qtcreator/qml/qmlobserver/qmlobserver.pro
index d05ca7ee1e6..379ca5fb040 100644
--- a/share/qtcreator/qml/qmlobserver/qmlobserver.pro
+++ b/share/qtcreator/qml/qmlobserver/qmlobserver.pro
@@ -1,5 +1,4 @@
 TEMPLATE = app
-DEFINES += QMLOBSERVER
 
 ### FIXME: only debug plugins are now supported.
 CONFIG -= release
diff --git a/share/qtcreator/templates/qmlapp/app.pro b/share/qtcreator/templates/qmlapp/app.pro
index cb0abcbfd31..c27c04e91e5 100644
--- a/share/qtcreator/templates/qmlapp/app.pro
+++ b/share/qtcreator/templates/qmlapp/app.pro
@@ -20,10 +20,9 @@ DEFINES += NETWORKACCESS
 # TARGETUID3 #
 symbian:TARGET.UID3 = 0xE1111234
 
-# Define QMLJSDEBUGGER to enable basic debugging (setting breakpoints etc)
-# Define QMLOBSERVER for advanced features (requires experimental QmlInspector plugin!)
-#DEFINES += QMLJSDEBUGGER
-#DEFINES += QMLOBSERVER
+# Define QMLJSDEBUGGER to allow debugging of QML
+# (This might significantly increase build time)
+# DEFINES += QMLJSDEBUGGER
 
 # The .cpp file which was generated for your project. Feel free to hack it.
 SOURCES += main.cpp
diff --git a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp
index 2e4adfc3b2f..3e2ed95be83 100644
--- a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp
+++ b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.cpp
@@ -7,10 +7,10 @@
 #include <QtDeclarative/QDeclarativeEngine>
 #include <QtDeclarative/QDeclarativeContext>
 
-#if defined(QMLJSDEBUGGER)
+#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER)
 #include <jsdebuggeragent.h>
 #endif
-#if defined(QMLOBSERVER)
+#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER)
 #include <qdeclarativeviewobserver.h>
 #endif
 
@@ -53,10 +53,10 @@ QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) :
 {
     connect(engine(), SIGNAL(quit()), SLOT(close()));
     setResizeMode(QDeclarativeView::SizeRootObjectToView);
-#ifdef QMLJSDEBUGGER
+#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER)
     new QmlJSDebugger::JSDebuggerAgent(engine());
 #endif
-#ifdef QMLOBSERVER
+#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER)
     new QmlJSDebugger::QDeclarativeViewObserver(this, parent);
 #endif
 }
diff --git a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri
index 319587d7821..5c8ff0585ff 100644
--- a/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri
+++ b/share/qtcreator/templates/qmlapp/qmlapplicationviewer/qmlapplicationviewer.pri
@@ -7,10 +7,6 @@ SOURCES += $$PWD/qmlapplicationviewer.cpp
 HEADERS += $$PWD/qmlapplicationviewer.h
 INCLUDEPATH += $$PWD
 
-contains(DEFINES, QMLOBSERVER) {
-    DEFINES *= QMLJSDEBUGGER
-}
-
 defineTest(minQtVersion) {
     maj = $$1
     min = $$2
-- 
GitLab