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>
This commit is contained in:
hjk
2017-08-18 12:23:42 +02:00
parent 60614d6ce1
commit c128731ff2
11 changed files with 43 additions and 64 deletions

View File

@@ -485,7 +485,7 @@ static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, Q
IDevice::ConstPtr device = runControl->device();
if (rp.languages & QmlLanguage) {
if (device && device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
if (rp.qmlServer.host.isEmpty() || !rp.qmlServer.port.isValid()) {
if (rp.qmlServer.host().isEmpty() || rp.qmlServer.port() <= 0) {
QTcpServer server;
const bool canListen = server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6);
@@ -493,10 +493,8 @@ static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, Q
m_errors.append(DebuggerPlugin::tr("Not enough free ports for QML debugging.") + ' ');
return false;
}
TcpServerConnection conn;
conn.host = server.serverAddress().toString();
conn.port = Utils::Port(server.serverPort());
rp.qmlServer = conn;
rp.qmlServer.setHost(server.serverAddress().toString());
rp.qmlServer.setPort(server.serverPort());
}
// Makes sure that all bindings go through the JavaScript engine, so that
@@ -534,10 +532,10 @@ static bool fixupParameters(DebuggerRunParameters &rp, RunControl *runControl, Q
service = QmlDebug::QmlDebuggerServices;
}
if (rp.startMode != AttachExternal && rp.startMode != AttachCrashedExternal) {
QtcProcess::addArg(&rp.inferior.commandLineArguments,
(rp.languages & CppLanguage) && rp.nativeMixedEnabled ?
QmlDebug::qmlDebugNativeArguments(service, false) :
QmlDebug::qmlDebugTcpArguments(service, rp.qmlServer.port));
QString qmlarg = (rp.languages & CppLanguage) && rp.nativeMixedEnabled
? QmlDebug::qmlDebugNativeArguments(service, false)
: QmlDebug::qmlDebugTcpArguments(service, Port(rp.qmlServer.port()));
QtcProcess::addArg(&rp.inferior.commandLineArguments, qmlarg);
}
}
}