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 | |
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')
-rw-r--r-- | src/plugins/android/androiddebugsupport.cpp | 3 | ||||
-rw-r--r-- | src/plugins/android/androidrunner.cpp | 25 | ||||
-rw-r--r-- | src/plugins/android/androidrunner.h | 9 |
3 files changed, 14 insertions, 23 deletions
diff --git a/src/plugins/android/androiddebugsupport.cpp b/src/plugins/android/androiddebugsupport.cpp index 5bc850fe64..e71ae4c09d 100644 --- a/src/plugins/android/androiddebugsupport.cpp +++ b/src/plugins/android/androiddebugsupport.cpp @@ -133,8 +133,7 @@ void AndroidDebugSupport::start() .appendPath(toNdkArch(AndroidManager::targetArch(target))).toString(); } if (isQmlDebugging()) { - params.qmlServer.host = m_runner->qmlServerHost(); - params.qmlServer.port = m_runner->qmlServerPort(); + params.qmlServer = m_runner->qmlServer(); //TODO: Not sure if these are the right paths. QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit); if (version) { 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(); } diff --git a/src/plugins/android/androidrunner.h b/src/plugins/android/androidrunner.h index 6215cc49a5..c878f95e9a 100644 --- a/src/plugins/android/androidrunner.h +++ b/src/plugins/android/androidrunner.h @@ -57,8 +57,7 @@ public: const AndroidRunnable &runnable() const { return m_androidRunnable; } Utils::Port gdbServerPort() const { return m_gdbServerPort; } - QString qmlServerHost() const { return m_qmlServerHost; } - Utils::Port qmlServerPort() const { return m_qmlServerPort; } + QUrl qmlServer() const { return m_qmlServer; } Utils::ProcessHandle pid() const { return m_pid; } void start() override; @@ -77,8 +76,7 @@ private: void remoteOutput(const QString &output); void remoteErrorOutput(const QString &output); void gotRemoteOutput(const QString &output); - void handleRemoteProcessStarted(Utils::Port gdbServerPort, Utils::Port qmlServerPort, - QString qmlServerHost, int pid); + void handleRemoteProcessStarted(Utils::Port gdbServerPort, const QUrl &qmlServer, int pid); void handleRemoteProcessFinished(const QString &errString = QString()); void checkAVD(); void launchAVD(); @@ -90,8 +88,7 @@ private: QScopedPointer<AndroidRunnerWorker> m_worker; QPointer<ProjectExplorer::Target> m_target; Utils::Port m_gdbServerPort; - QString m_qmlServerHost; - Utils::Port m_qmlServerPort; + QUrl m_qmlServer; Utils::ProcessHandle m_pid; QmlDebug::QmlOutputParser m_outputParser; }; |