Commit 4ab1c88b authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlJSDebugger: Split library up into a debugger & observer part

This allows us to enable/disable the experimental observer, independent
from the core javascript-debugger functionality.

Reviewed-by: Christiaan Janssen
parent 02171c7c
......@@ -63,6 +63,7 @@
#include "qmljsdebugger_global.h"
QT_FORWARD_DECLARE_CLASS(QScriptContext);
QT_FORWARD_DECLARE_CLASS(QDeclarativeEngine);
namespace QmlJSDebugger {
......@@ -73,6 +74,7 @@ class QMLJSDEBUGGER_EXPORT JSDebuggerAgent : public QDeclarativeDebugService , p
Q_OBJECT
public:
JSDebuggerAgent(QScriptEngine *engine);
JSDebuggerAgent(QDeclarativeEngine *engine);
~JSDebuggerAgent();
// reimplemented
......
......@@ -49,6 +49,7 @@
#include <QtCore/QUrl>
#include <QtCore/QDateTime>
#include <QtScript/qscriptvalueiterator.h>
#include <private/qdeclarativeengine_p.h>
namespace QmlJSDebugger {
......@@ -190,6 +191,12 @@ JSDebuggerAgent::JSDebuggerAgent(QScriptEngine *engine)
, state(NoState)
{}
JSDebuggerAgent::JSDebuggerAgent(QDeclarativeEngine *engine)
: QDeclarativeDebugService("JSDebugger")
, QScriptEngineAgent(QDeclarativeEnginePrivate::getScriptEngine(engine))
, state(NoState)
{}
/*!
Destroys this QScriptDebuggerAgent.
*/
......
......@@ -10,20 +10,26 @@ contains(CONFIG, dll) {
include($$PWD/private_headers.pri)
include($$PWD/editor/editor.pri)
## Input
HEADERS += \
include/jsdebuggeragent.h \
include/qdeclarativeviewobserver.h \
include/qdeclarativeobserverservice.h \
include/qmlobserverconstants.h \
include/qmljsdebugger_global.h \
qdeclarativeviewobserver_p.h
include/qmljsdebugger_global.h
SOURCES += \
jsdebuggeragent.cpp \
qdeclarativeviewobserver.cpp \
qdeclarativeobserverservice.cpp
jsdebuggeragent.cpp
contains(DEFINES, QMLOBSERVER) {
include($$PWD/editor/editor.pri)
HEADERS += \
include/qdeclarativeviewobserver.h \
include/qdeclarativeobserverservice.h \
include/qmlobserverconstants.h \
qdeclarativeviewobserver_p.h
SOURCES += \
qdeclarativeviewobserver.cpp \
qdeclarativeobserverservice.cpp
}
OTHER_FILES += qmljsdebugger.pri
......@@ -2,6 +2,8 @@ TEMPLATE = lib
CONFIG+=dll
TARGET = QmlJSDebugger
DEFINES += QMLOBSERVER
unix:QMAKE_CXXFLAGS_DEBUG += -O3
include(../../../src/qtcreatorlibrary.pri)
......
......@@ -22,8 +22,9 @@ symbian:TARGET.UID3 = 0xE1111234
symbian:ICON = symbianicon.svg
# Define to enable the Qml Observer in debug mode
# QMLOBSERVER #
# Define QMLJSDEBUGGER to enable basic debugging (setting breakpoints etc)
# Define QMLOBSERVER for advanced features (requires experimental QmlInspector plugin!)
#DEFINES += QMLJSDEBUGGER
#DEFINES += QMLOBSERVER
SOURCES += main.cpp
......
......@@ -7,6 +7,9 @@
#include <QtDeclarative/QDeclarativeEngine>
#include <QtDeclarative/QDeclarativeContext>
#if defined(QMLJSDEBUGGER)
#include <jsdebuggeragent.h>
#endif
#if defined(QMLOBSERVER)
#include <qdeclarativeviewobserver.h>
#endif
......@@ -50,6 +53,9 @@ QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) :
{
connect(engine(), SIGNAL(quit()), SLOT(close()));
setResizeMode(QDeclarativeView::SizeRootObjectToView);
#ifdef QMLJSDEBUGGER
new QmlJSDebugger::JSDebuggerAgent(engine());
#endif
#ifdef QMLOBSERVER
new QmlJSDebugger::QDeclarativeViewObserver(this, parent);
#endif
......
......@@ -8,14 +8,17 @@ HEADERS += $$PWD/qmlapplicationviewer.h
INCLUDEPATH += $$PWD
contains(DEFINES, QMLOBSERVER) {
DEFINES *= QMLJSDEBUGGER
}
contains(DEFINES, QMLJSDEBUGGER) {
CONFIG(debug, debug|release) {
isEmpty(QMLOBSERVER_PATH) {
warning(QMLOBSERVER_PATH was not set. QMLOBSERVER not activated.)
DEFINES -= QMLOBSERVER
isEmpty(QMLJSDEBUGGER_PATH) {
warning(QMLJSDEBUGGER_PATH was not set. QMLJSDEBUGGER not activated.)
DEFINES -= QMLJSDEBUGGER
} else {
include($$QMLOBSERVER_PATH/qmljsdebugger-lib.pri)
include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
}
} else {
DEFINES -= QMLOBSERVER
DEFINES -= QMLJSDEBUGGER
}
}
......@@ -128,7 +128,7 @@ QStringList QMakeStep::allArguments()
/// moreArguments,
/// -unix for Maemo
/// -after OBJECTS_DIR, MOC_DIR, UI_DIR, RCC_DIR
/// QMAKE_VAR_QMLOBSERVER_PATH
/// QMAKE_VAR_QMLJSDEBUGGER_PATH
QStringList QMakeStep::moreArguments()
{
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
......@@ -152,7 +152,7 @@ QStringList QMakeStep::moreArguments()
<< QLatin1String("RCC_DIR=rcc");
}
arguments << QLatin1String(Constants::QMAKEVAR_QMLOBSERVER_PATH) + QLatin1Char('=') +
arguments << QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH) + QLatin1Char('=') +
Core::ICore::instance()->resourcePath() + QLatin1String("/qmljsdebugger");
return arguments;
}
......
......@@ -525,7 +525,7 @@ QStringList Qt4BuildConfiguration::removeQMLInspectorFromArgumentList(const QStr
{
QStringList result;
foreach (const QString &str, old)
if (!str.startsWith(QLatin1String(Constants::QMAKEVAR_QMLOBSERVER_PATH)))
if (!str.startsWith(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)))
result << str;
return result;
}
......
......@@ -112,7 +112,7 @@ const char * const ICON_WINDOW = ":/qt4projectmanager/images/window.png";
const char * const ICON_QML_STANDALONE = ":/wizards/images/qml_standalone.png";
// Env variables
const char * const QMAKEVAR_QMLOBSERVER_PATH = "QMLOBSERVER_PATH";
const char * const QMAKEVAR_QMLJSDEBUGGER_PATH = "QMLJSDEBUGGER_PATH";
} // namespace Constants
} // namespace Qt4ProjectManager
......
......@@ -242,7 +242,7 @@ void QmlStandaloneApp::handleCurrentProFileTemplateLine(const QString &line,
}
}
proFile << "DEPLOYMENTFOLDERS = " << folders.join(QLatin1String(" ")) << endl;
} else if (line.contains(QLatin1String("# QMLOBSERVER"))) {
} else if (line.contains(QLatin1String("# QMLJSDEBUGGER"))) {
// ### disabled for now; figure out the private headers problem first.
//uncommentNextLine = true;
Q_UNUSED(uncommentNextLine);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment