aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2016-04-19 16:43:30 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-04-20 11:06:34 +0000
commit385237dbbd5261ff2825e5b054166ae6a225e423 (patch)
tree3020c9ec0187a614915d291a6768eb94b0105e7c /src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
parente14238650c841fdb314ded3ec59253beff1514a7 (diff)
Use Utils::Port where possible
This solves the ambiguity between 0 and -1 being the "invalid" port. Change-Id: I3bac11dd4117bb1820fbd58186699925b73df1c5 Reviewed-by: hjk <hjk@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmlprofiler/localqmlprofilerrunner.cpp')
-rw-r--r--src/plugins/qmlprofiler/localqmlprofilerrunner.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
index b79aa79e92..af137adcbf 100644
--- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
+++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp
@@ -51,16 +51,16 @@ QString LocalQmlProfilerRunner::findFreeSocket()
}
}
-quint16 LocalQmlProfilerRunner::findFreePort(QString &host)
+Utils::Port LocalQmlProfilerRunner::findFreePort(QString &host)
{
QTcpServer server;
if (!server.listen(QHostAddress::LocalHost)
&& !server.listen(QHostAddress::LocalHostIPv6)) {
qWarning() << "Cannot open port on host for QML profiling.";
- return 0;
+ return Utils::Port();
}
host = server.serverAddress().toString();
- return server.serverPort();
+ return Utils::Port(server.serverPort());
}
LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration,
@@ -102,9 +102,12 @@ void LocalQmlProfilerRunner::start()
runnable.runMode = ApplicationLauncher::Gui;
if (QmlProfilerPlugin::debugOutput) {
+ QString portOrSocket = m_configuration.socket.isEmpty() ?
+ QString::number(m_configuration.port.isValid() ?
+ m_configuration.port.number() : -1) :
+ m_configuration.socket;
qWarning("QmlProfiler: Launching %s:%s", qPrintable(m_configuration.debuggee.executable),
- qPrintable(m_configuration.socket.isEmpty() ?
- QString::number(m_configuration.port) : m_configuration.socket));
+ qPrintable(portOrSocket));
}
connect(&m_launcher, &ApplicationLauncher::processExited,