diff options
author | Simjees Abraham <simjees.abraham@nokia.com> | 2012-03-14 13:35:17 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-19 12:05:03 +0100 |
commit | e0e81d6f20e2190becd6354785a148c147f00ad8 (patch) | |
tree | f59f9c80ea686077c6464e2d110a92970ce61e23 /src/qml/debugger | |
parent | 5c05f5df1f35291070962b7fe295004e4942f2ce (diff) |
Debugger: Add optional 'host' argument to -qmljsdebugger
Change-Id: I5bb2e48e2ad2019b8a92f6f8842b88027fcd2d28
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Diffstat (limited to 'src/qml/debugger')
-rw-r--r-- | src/qml/debugger/qqmldebugserver.cpp | 35 | ||||
-rw-r--r-- | src/qml/debugger/qqmldebugserverconnection_p.h | 2 |
2 files changed, 23 insertions, 14 deletions
diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp index ec3f9dafc2..dcf93b400e 100644 --- a/src/qml/debugger/qqmldebugserver.cpp +++ b/src/qml/debugger/qqmldebugserver.cpp @@ -117,9 +117,10 @@ public: m_pluginName = pluginName; } - void setPort(int port, bool block) { + void setPort(int port, bool block, QString &hostAddress) { m_port = port; m_block = block; + m_hostAddress = hostAddress; } void run(); @@ -128,6 +129,7 @@ private: QString m_pluginName; int m_port; bool m_block; + QString m_hostAddress; }; QQmlDebugServerPrivate::QQmlDebugServerPrivate() : @@ -214,7 +216,7 @@ void QQmlDebugServerThread::run() = server->d_func()->loadConnectionPlugin(m_pluginName); if (connection) { connection->setServer(QQmlDebugServer::instance()); - connection->setPort(m_port, m_block); + connection->setPort(m_port, m_block, m_hostAddress); } else { QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp)); qWarning() << QString(QLatin1String("QML Debugger: Ignoring \"-qmljsdebugger=%1\". " @@ -258,8 +260,9 @@ QQmlDebugServer *QQmlDebugServer::instance() int port = 0; bool block = false; bool ok = false; + QString hostAddress; - // format: qmljsdebugger=port:3768[,block] OR qmljsdebugger=ost[,block] + // format: qmljsdebugger=port:3768[,host:<ip address>][,block] OR qmljsdebugger=ost[,block] if (!appD->qmljsDebugArgumentsString().isEmpty()) { if (!QQmlEnginePrivate::qml_debugging_enabled) { qWarning() << QString(QLatin1String( @@ -270,24 +273,30 @@ QQmlDebugServer *QQmlDebugServer::instance() } QString pluginName; - if (appD->qmljsDebugArgumentsString().indexOf(QLatin1String("port:")) == 0) { - int separatorIndex = appD->qmljsDebugArgumentsString().indexOf(QLatin1Char(',')); - port = appD->qmljsDebugArgumentsString().mid(5, separatorIndex - 5).toInt(&ok); - pluginName = QStringLiteral("qmldbg_tcp"); - } else if (appD->qmljsDebugArgumentsString().contains(QLatin1String("ost"))) { - pluginName = QStringLiteral("qmldbg_ost"); - ok = true; + QStringList lstjsDebugArguments = appD->qmljsDebugArgumentsString() + .split(QLatin1Char(',')); + foreach (const QString &strArgument, lstjsDebugArguments) { + if (strArgument.startsWith(QLatin1String("port:"))) { + port = strArgument.mid(5).toInt(&ok); + pluginName = QLatin1String("qmldbg_tcp"); + } else if (strArgument.startsWith(QLatin1String("host:"))) { + hostAddress = strArgument.mid(5); + } else if (strArgument == QLatin1String("block")) { + block = true; + } else { + qWarning() << QString::fromLatin1("QML Debugger: Invalid argument '%1' " + "detected. Ignoring the same.") + .arg(strArgument); + } } - block = appD->qmljsDebugArgumentsString().contains(QLatin1String("block")); - if (ok) { qQmlDebugServer = new QQmlDebugServer(); QQmlDebugServerThread *thread = new QQmlDebugServerThread; qQmlDebugServer->d_func()->thread = thread; qQmlDebugServer->moveToThread(thread); thread->setPluginName(pluginName); - thread->setPort(port, block); + thread->setPort(port, block, hostAddress); thread->start(); if (block) { diff --git a/src/qml/debugger/qqmldebugserverconnection_p.h b/src/qml/debugger/qqmldebugserverconnection_p.h index ab9e7bd73f..920e82ed47 100644 --- a/src/qml/debugger/qqmldebugserverconnection_p.h +++ b/src/qml/debugger/qqmldebugserverconnection_p.h @@ -69,7 +69,7 @@ public: virtual ~QQmlDebugServerConnection() {} virtual void setServer(QQmlDebugServer *server) = 0; - virtual void setPort(int port, bool bock) = 0; + virtual void setPort(int port, bool bock, const QString &hostaddress) = 0; virtual bool isConnected() const = 0; virtual void send(const QList<QByteArray> &messages) = 0; virtual void disconnect() = 0; |