diff options
author | hjk <hjk@qt.io> | 2017-08-18 12:23:42 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2017-08-23 09:13:40 +0000 |
commit | c128731ff2949bcfff0135278daf7259ef037242 (patch) | |
tree | ef23ee4d93ef09eece3c927e5593ebfa2a17bef1 /src/plugins/android/androidrunner.cpp | |
parent | 60614d6ce1e11b35ed35bf23aebb08736f11f121 (diff) | |
download | qt-creator-c128731ff2949bcfff0135278daf7259ef037242.tar.gz |
Debugger: Use a QUrl for Qml server port and host
Host and port reasonably belong together, using a QUrl makes that more
explicit and follows the lead of the Qml profiler in that area.
Change-Id: I754cb17d165ce6b2f25c655eeebfd8ac8f5a93c7
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
Diffstat (limited to 'src/plugins/android/androidrunner.cpp')
-rw-r--r-- | src/plugins/android/androidrunner.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index 04d87284af..a2d7ebe54a 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -226,8 +226,7 @@ public: Utils::Port localGdbServerPort() const { return m_localGdbServerPort; } signals: - void remoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort, - QString qmlServerHost, int pid); + void remoteProcessStarted(Utils::Port gdbServerPort, const QUrl &qmlServer, int pid); void remoteProcessFinished(const QString &errString = QString()); void remoteOutput(const QString &output); @@ -258,8 +257,7 @@ private: bool m_useCppDebugger = false; QmlDebug::QmlDebugServicesPreset m_qmlDebugServices; Utils::Port m_localGdbServerPort; // Local end of forwarded debug socket. - QString m_qmlServerHost; - Utils::Port m_qmlPort; + QUrl m_qmlServer; QString m_pingFile; QString m_pongFile; QString m_gdbserverPath; @@ -297,10 +295,8 @@ AndroidRunnerWorker::AndroidRunnerWorker(RunControl *runControl, const AndroidRu QTC_ASSERT(server.listen(QHostAddress::LocalHost) || server.listen(QHostAddress::LocalHostIPv6), qDebug() << tr("No free ports available on host for QML debugging.")); - m_qmlServerHost = server.serverAddress().toString(); - m_qmlPort = Utils::Port(server.serverPort()); - } else { - m_qmlPort = Utils::Port(); + m_qmlServer.setHost(server.serverAddress().toString()); + m_qmlServer.setPort(server.serverPort()); } m_adb = AndroidConfigurations::currentConfig().adbToolPath().toString(); @@ -418,7 +414,7 @@ void AndroidRunnerWorker::asyncStart() if (m_qmlDebugServices != QmlDebug::NoQmlDebugServices) { // currently forward to same port on device and host - const QString port = QString("tcp:%1").arg(m_qmlPort.number()); + const QString port = QString("tcp:%1").arg(m_qmlServer.port()); if (!runAdb({"forward", port, port}, &errorMessage)) { emit remoteProcessFinished(tr("Failed to forward QML debugging ports. Reason: %1.") .arg(errorMessage)); @@ -428,7 +424,7 @@ void AndroidRunnerWorker::asyncStart() args << "-e" << "qml_debug" << "true" << "-e" << "qmljsdebugger" << QString("port:%1,block,services:%2") - .arg(m_qmlPort.number()).arg(QmlDebug::qmlDebugServices(m_qmlDebugServices)); + .arg(m_qmlServer.port()).arg(QmlDebug::qmlDebugServices(m_qmlDebugServices)); } if (!runAdb(args, &errorMessage)) { @@ -641,7 +637,7 @@ void AndroidRunnerWorker::onProcessIdChanged(qint64 pid) } else { // In debugging cases this will be funneled to the engine to actually start // and attach gdb. Afterwards this ends up in handleRemoteDebuggerRunning() below. - emit remoteProcessStarted(m_localGdbServerPort, m_qmlPort, m_qmlServerHost, m_processPID); + emit remoteProcessStarted(m_localGdbServerPort, m_qmlServer, m_processPID); logcatReadStandardOutput(); QTC_ASSERT(!m_psIsAlive, /**/); m_psIsAlive.reset(new QProcess); @@ -785,13 +781,12 @@ void AndroidRunner::remoteErrorOutput(const QString &output) m_outputParser.processOutput(output); } -void AndroidRunner::handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort, - QString qmlServerHost, int pid) +void AndroidRunner::handleRemoteProcessStarted(Utils::Port gdbServerPort, + const QUrl &qmlServer, int pid) { m_pid = ProcessHandle(pid); m_gdbServerPort = gdbServerPort; - m_qmlServerHost = qmlServerHost; - m_qmlServerPort = qmlServerPort; + m_qmlServer = qmlServer; reportStarted(); } |