diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-09-21 08:06:18 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-09-21 08:06:18 (GMT) |
commit | a4d1be727573a7a87c523a2ef28074c77d16f165 (patch) | |
tree | d4f8f218c41771ca17c7ab324390485af868fa8e /src/declarative/debugger | |
parent | cd2fd21578a80bc5ac121c0419ee00b1799d0a60 (diff) | |
parent | 660ec910ef60513b511e2292255e53701dbb239b (diff) | |
download | Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.zip Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.gz Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
src/corelib/kernel/qobject.h
src/declarative/graphicsitems/qdeclarativeflickable.cpp
src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
src/declarative/util/qdeclarativelistmodel.cpp
Diffstat (limited to 'src/declarative/debugger')
-rw-r--r-- | src/declarative/debugger/qdeclarativedebugservice.cpp | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 1bbfcf4..1f2bf4f 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -49,6 +49,8 @@ #include <QtCore/qstringlist.h> #include <private/qobject_p.h> +#include <private/qapplication_p.h> +#include <QtGui/qapplication.h> QT_BEGIN_NAMESPACE @@ -147,24 +149,41 @@ bool QDeclarativeDebugServer::hasDebuggingClient() const QDeclarativeDebugServer *QDeclarativeDebugServer::instance() { - static bool envTested = false; + static bool commandLineTested = false; static QDeclarativeDebugServer *server = 0; - if (!envTested) { - envTested = true; - QByteArray env = qgetenv("QML_DEBUG_SERVER_PORT"); - QByteArray block = qgetenv("QML_DEBUG_SERVER_BLOCK"); + if (!commandLineTested) { + commandLineTested = true; +#ifndef QDECLARATIVE_NO_DEBUG_PROTOCOL + QApplicationPrivate *appD = static_cast<QApplicationPrivate*>(QObjectPrivate::get(qApp)); + // ### remove port definition when protocol is changed + int port = 0; + bool block = false; bool ok = false; - int port = env.toInt(&ok); - if (ok && port > 1024) { - server = new QDeclarativeDebugServer(port); - server->listen(); - if (!block.isEmpty()) { - server->waitForConnection(); + // format: qmljsdebugger=port:3768[,block] + if (!appD->qmljsDebugArguments.isEmpty()) { + + if (appD->qmljsDebugArguments.indexOf(QLatin1String("port:")) == 0) { + int separatorIndex = appD->qmljsDebugArguments.indexOf(QLatin1Char(',')); + port = appD->qmljsDebugArguments.mid(5, separatorIndex - 5).toInt(&ok); + } + block = appD->qmljsDebugArguments.contains(QLatin1String("block")); + + if (ok) { + server = new QDeclarativeDebugServer(port); + server->listen(); + if (block) { + server->waitForConnection(); + } + } else { + qWarning(QString("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". " + "Format is -qmljsdebugger=port:<port>[,block]").arg( + appD->qmljsDebugArguments).toAscii().constData()); } } +#endif } return server; |