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>
This commit is contained in:
Ulf Hermann
2016-04-19 16:43:30 +02:00
parent e14238650c
commit 385237dbbd
62 changed files with 239 additions and 187 deletions

View File

@@ -86,15 +86,15 @@ QmlProfilerRunControl::QmlProfilerRunControl(RunConfiguration *runConfiguration,
d->m_noDebugOutputTimer.setSingleShot(true);
d->m_noDebugOutputTimer.setInterval(4000);
connect(&d->m_noDebugOutputTimer, &QTimer::timeout,
this, [this](){processIsRunning(0);});
this, [this](){processIsRunning(Utils::Port());});
d->m_outputParser.setNoOutputText(ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput());
connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::waitingForConnectionOnPort,
this, &QmlProfilerRunControl::processIsRunning);
connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::noOutputMessage,
this, [this](){processIsRunning(0);});
this, [this](){processIsRunning(Utils::Port());});
connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::connectingToSocketMessage,
this, [this](){processIsRunning(0);});
this, [this](){processIsRunning(Utils::Port());});
connect(&d->m_outputParser, &QmlDebug::QmlOutputParser::errorMessage,
this, &QmlProfilerRunControl::wrongSetupMessageBox);
}
@@ -114,7 +114,7 @@ void QmlProfilerRunControl::start()
QTC_ASSERT(connection().is<AnalyzerConnection>(), finished(); return);
auto conn = connection().as<AnalyzerConnection>();
if (conn.analyzerPort != 0)
if (conn.analyzerPort.isValid())
emit processRunning(conn.analyzerPort);
else if (conn.analyzerSocket.isEmpty())
d->m_noDebugOutputTimer.start();
@@ -236,19 +236,19 @@ void QmlProfilerRunControl::wrongSetupMessageBoxFinished(int button)
}
}
void QmlProfilerRunControl::notifyRemoteSetupDone(quint16 port)
void QmlProfilerRunControl::notifyRemoteSetupDone(Utils::Port port)
{
d->m_noDebugOutputTimer.stop();
emit processRunning(port);
}
void QmlProfilerRunControl::processIsRunning(quint16 port)
void QmlProfilerRunControl::processIsRunning(Utils::Port port)
{
d->m_noDebugOutputTimer.stop();
if (port == 0)
if (!port.isValid())
port = connection().as<AnalyzerConnection>().analyzerPort;
if (port != 0)
if (port.isValid())
emit processRunning(port);
}