diff options
author | Aurindam Jana <aurindam.jana@digia.com> | 2013-04-17 17:45:53 +0200 |
---|---|---|
committer | Aurindam Jana <aurindam.jana@digia.com> | 2013-04-18 14:10:43 +0200 |
commit | f9d2b6498f042abe2de7797164dbb80fa6c8916f (patch) | |
tree | 5882692f3af46fd2b68e6c71aeabf4eb53cf3bd5 /src/plugins/debugger/debuggerrunner.cpp | |
parent | 49f1cd5334a50c98eb19010405e786570c4c5df0 (diff) | |
download | qt-creator-f9d2b6498f042abe2de7797164dbb80fa6c8916f.tar.gz |
QmlDebugging: Query available port
Use QTcpServer instead of TcpPortsGatherer.
Change-Id: I85133c5ae192b407009c5b21df332c9d3d94acda
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
Diffstat (limited to 'src/plugins/debugger/debuggerrunner.cpp')
-rw-r--r-- | src/plugins/debugger/debuggerrunner.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 5788164dc9..5c09efa633 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -56,11 +56,10 @@ #include <utils/qtcassert.h> #include <utils/qtcprocess.h> -#include <utils/portlist.h> -#include <utils/tcpportsgatherer.h> #include <coreplugin/icore.h> #include <QErrorMessage> +#include <QTcpServer> using namespace Debugger::Internal; using namespace ProjectExplorer; @@ -385,18 +384,14 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu DeviceKitInformation::device(runConfiguration->target()->kit()); sp.qmlServerAddress = _("127.0.0.1"); QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return sp); - TcpPortsGatherer portsGatherer; - portsGatherer.update(QAbstractSocket::UnknownNetworkLayerProtocol); - Utils::PortList portList = device->freePorts(); - int freePort = portsGatherer.getNextFreePort(&portList); - if (freePort == -1) { + QTcpServer server; + const bool canListen = server.listen(QHostAddress(sp.qmlServerAddress)); + if (!canListen) { if (errorMessage) - *errorMessage = DebuggerPlugin::tr("Not enough free ports for QML debugging. " - "Increase the port range for Desktop device in " - "Device settings."); + *errorMessage = DebuggerPlugin::tr("Not enough free ports for QML debugging. "); return sp; } - sp.qmlServerPort = freePort; + sp.qmlServerPort = server.serverPort(); sp.languages |= QmlLanguage; // Makes sure that all bindings go through the JavaScript engine, so that |