Commit 60614d6c authored by hjk's avatar hjk
Browse files

WinRT: Use new core functionality to get free port for Qml debugger



Change-Id: I187f15760a2c81e02518e8c684b0990acf4b21eb
Reviewed-by: Oliver Wolff's avatarOliver Wolff <oliver.wolff@qt.io>
Reviewed-by: default avatarhjk <hjk@qt.io>
parent 63a75e3f
......@@ -64,11 +64,13 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl)
}
if (isQmlDebugging()) {
Utils::Port qmlDebugPort;
if (!getFreePort(qmlDebugPort))
QUrl qmlServer = ProjectExplorer::urlFromLocalHostAndFreePort();
if (qmlServer.port() <= 0) {
reportFailure(tr("Not enough free ports for QML debugging."));
return;
params.qmlServer.host = QHostAddress(QHostAddress::LocalHost).toString();
params.qmlServer.port = qmlDebugPort;
}
params.qmlServer.host = qmlServer.host();
params.qmlServer.port = Utils::Port(qmlServer.port());
}
QString errorMessage;
......@@ -118,18 +120,6 @@ WinRtDebugSupport::WinRtDebugSupport(RunControl *runControl)
"the current run configuration."));
}
bool WinRtDebugSupport::getFreePort(Utils::Port &qmlDebuggerPort)
{
QTcpServer server;
if (!server.listen(QHostAddress::LocalHost,
qmlDebuggerPort.isValid() ? qmlDebuggerPort.number() : 0)) {
reportFailure(tr("Not enough free ports for QML debugging."));
return false;
}
qmlDebuggerPort = Utils::Port(server.serverPort());
return true;
}
WinRtDebugSupport::~WinRtDebugSupport()
{
delete m_runner;
......
......@@ -42,8 +42,6 @@ public:
~WinRtDebugSupport();
private:
bool getFreePort(Utils::Port &qmlDebuggerPort);
WinRtRunnerHelper *m_runner = nullptr;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment