diff options
Diffstat (limited to 'src/qml/debugger/qqmldebugserver.cpp')
-rw-r--r-- | src/qml/debugger/qqmldebugserver.cpp | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/qml/debugger/qqmldebugserver.cpp b/src/qml/debugger/qqmldebugserver.cpp index 7c9928c43c..27e3d226cd 100644 --- a/src/qml/debugger/qqmldebugserver.cpp +++ b/src/qml/debugger/qqmldebugserver.cpp @@ -123,8 +123,9 @@ public: m_pluginName = pluginName; } - void setPort(int port, bool block, QString &hostAddress) { - m_port = port; + void setPortRange(int portFrom, int portTo, bool block, QString &hostAddress) { + m_portFrom = portFrom; + m_portTo = portTo; m_block = block; m_hostAddress = hostAddress; } @@ -133,7 +134,8 @@ public: private: QString m_pluginName; - int m_port; + int m_portFrom; + int m_portTo; bool m_block; QString m_hostAddress; }; @@ -225,7 +227,7 @@ void QQmlDebugServerThread::run() = server->d_func()->loadConnectionPlugin(m_pluginName); if (connection) { connection->setServer(QQmlDebugServer::instance()); - connection->setPort(m_port, m_block, m_hostAddress); + connection->setPortRange(m_portFrom, m_portTo, m_block, m_hostAddress); } else { QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp)); qWarning() << QString(QLatin1String("QML Debugger: Ignoring \"-qmljsdebugger=%1\". " @@ -272,12 +274,13 @@ QQmlDebugServer *QQmlDebugServer::instance() QCoreApplicationPrivate *appD = static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(qApp)); #ifndef QT_QML_NO_DEBUGGER // ### remove port definition when protocol is changed - int port = 0; + int portFrom = 0; + int portTo = 0; bool block = false; bool ok = false; QString hostAddress; - // format: qmljsdebugger=port:3768[,host:<ip address>][,block] OR qmljsdebugger=ost[,block] + // format: qmljsdebugger=port:<port_from>[,port_to],host:<ip address>][,block] if (!appD->qmljsDebugArgumentsString().isEmpty()) { if (!QQmlEnginePrivate::qml_debugging_enabled) { qWarning() << QString(QLatin1String( @@ -290,9 +293,21 @@ QQmlDebugServer *QQmlDebugServer::instance() QString pluginName; QStringList lstjsDebugArguments = appD->qmljsDebugArgumentsString() .split(QLatin1Char(',')); - foreach (const QString &strArgument, lstjsDebugArguments) { + QStringList::const_iterator argsItEnd = lstjsDebugArguments.end(); + QStringList::const_iterator argsIt = lstjsDebugArguments.begin(); + for (; argsIt != argsItEnd; ++argsIt) { + const QString strArgument = *argsIt; if (strArgument.startsWith(QLatin1String("port:"))) { - port = strArgument.mid(5).toInt(&ok); + portFrom = strArgument.mid(5).toInt(&ok); + portTo = portFrom; + QStringList::const_iterator argsNext = argsIt + 1; + if (argsNext == argsItEnd) + break; + const QString nextArgument = *argsNext; + if (ok && nextArgument.contains(QRegExp(QStringLiteral("^\\s*\\d+\\s*$")))) { + portTo = nextArgument.toInt(&ok); + ++argsIt; + } pluginName = QLatin1String("qmldbg_tcp"); } else if (strArgument.startsWith(QLatin1String("host:"))) { hostAddress = strArgument.mid(5); @@ -311,7 +326,7 @@ QQmlDebugServer *QQmlDebugServer::instance() qQmlDebugServer->d_func()->thread = thread; qQmlDebugServer->moveToThread(thread); thread->setPluginName(pluginName); - thread->setPort(port, block, hostAddress); + thread->setPortRange(portFrom, portTo, block, hostAddress); QQmlDebugServerPrivate *d = qQmlDebugServer->d_func(); d->blockingMode = block; @@ -325,8 +340,8 @@ QQmlDebugServer *QQmlDebugServer::instance() } else { qWarning() << QString(QLatin1String( "QML Debugger: Ignoring \"-qmljsdebugger=%1\". " - "Format is -qmljsdebugger=port:<port>[,block]")).arg( - appD->qmljsDebugArgumentsString()); + "Format is qmljsdebugger=port:<port_from>[,port_to],host:" + "<ip address>][,block]")).arg(appD->qmljsDebugArgumentsString()); } } #else |