Commit 253a8522 authored by Aurindam Jana's avatar Aurindam Jana

QmlProfiler: Add members for QML port and host

Change-Id: If454497b87d84ce0f998edf7a99783ec833f352c
Reviewed-by: default avatarKai Koehne <kai.koehne@digia.com>
Reviewed-by: default avatarAurindam Jana <aurindam.jana@digia.com>
parent 5478cf3c
......@@ -61,6 +61,8 @@ public:
Utils::Environment environment;
QString workingDirectory;
QString sysroot;
QString analyzerHost;
quint16 analyzerPort;
};
} // namespace Analyzer
......
......@@ -66,12 +66,12 @@ namespace Internal {
class QmlProfilerEngine::QmlProfilerEnginePrivate
{
public:
QmlProfilerEnginePrivate(QmlProfilerEngine *qq) : q(qq), m_runner(0) {}
QmlProfilerEnginePrivate(QmlProfilerEngine *qq, const AnalyzerStartParameters &sp) : q(qq), m_runner(0), sp(sp) {}
~QmlProfilerEnginePrivate() { delete m_runner; }
bool attach(const QString &address, uint port);
static AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
QObject *parent);
AbstractQmlProfilerRunner *createRunner(ProjectExplorer::RunConfiguration *runConfiguration,
QObject *parent);
QmlProfilerEngine *q;
......@@ -80,6 +80,7 @@ public:
AbstractQmlProfilerRunner *m_runner;
QTimer m_noDebugOutputTimer;
QmlDebug::QmlOutputParser m_outputParser;
const AnalyzerStartParameters sp;
};
AbstractQmlProfilerRunner *
......@@ -121,10 +122,7 @@ QmlProfilerEngine::QmlProfilerEnginePrivate::createRunner(ProjectExplorer::RunCo
const ProjectExplorer::IDevice::ConstPtr device =
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
QTC_ASSERT(device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE, return 0);
QTcpServer server;
if (!server.listen(QHostAddress::LocalHost) || !server.listen(QHostAddress::LocalHostIPv6))
return 0;
conf.port = server.serverPort();
conf.port = sp.analyzerPort;
runner = new LocalQmlProfilerRunner(conf, parent);
}
return runner;
......@@ -138,7 +136,7 @@ QmlProfilerEngine::QmlProfilerEngine(IAnalyzerTool *tool,
const Analyzer::AnalyzerStartParameters &sp,
ProjectExplorer::RunConfiguration *runConfiguration)
: IAnalyzerEngine(tool, sp, runConfiguration)
, d(new QmlProfilerEnginePrivate(this))
, d(new QmlProfilerEnginePrivate(this, sp))
{
d->m_profilerState = 0;
......@@ -185,7 +183,7 @@ bool QmlProfilerEngine::start()
}
}
d->m_runner = QmlProfilerEnginePrivate::createRunner(runConfiguration(), this);
d->m_runner = d->createRunner(runConfiguration(), this);
if (LocalQmlProfilerRunner *qmlRunner = qobject_cast<LocalQmlProfilerRunner *>(d->m_runner)) {
if (!qmlRunner->hasExecutable()) {
......@@ -203,7 +201,7 @@ bool QmlProfilerEngine::start()
d->m_runner->start();
d->m_noDebugOutputTimer.start();
} else {
emit processRunning(startParameters().connParams.port);
emit processRunning(startParameters().analyzerPort);
}
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
......
......@@ -257,7 +257,7 @@ IAnalyzerEngine *QmlProfilerTool::createEngine(const AnalyzerStartParameters &sp
// FIXME: Check that there's something sensible in sp.connParams
if (isTcpConnection)
d->m_profilerConnections->setTcpConnection(sp.connParams.host, sp.connParams.port);
d->m_profilerConnections->setTcpConnection(sp.analyzerHost, sp.analyzerPort);
d->m_runConfiguration = runConfiguration;
......@@ -334,6 +334,8 @@ AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration
sp.analyzerCmdPrefix = rc3->commandPrefix();
sp.displayName = rc3->displayName();
sp.sysroot = sysroot(rc3);
sp.analyzerHost = sp.connParams.host;
sp.analyzerPort = sp.connParams.port;
} else {
// What could that be?
QTC_ASSERT(false, return sp);
......@@ -342,10 +344,12 @@ AnalyzerStartParameters QmlProfilerTool::createStartParameters(RunConfiguration
ProjectExplorer::DeviceKitInformation::device(runConfiguration->target()->kit());
if (device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
QTcpServer server;
if (!server.listen(QHostAddress::LocalHost) || !server.listen(QHostAddress::LocalHostIPv6))
if (!server.listen(QHostAddress::LocalHost) && !server.listen(QHostAddress::LocalHostIPv6)) {
qWarning() << "Cannot open port on host for QML profiling.";
return sp;
sp.connParams.host = server.serverAddress().toString();
sp.connParams.port = server.serverPort();
}
sp.analyzerHost = server.serverAddress().toString();
sp.analyzerPort = server.serverPort();
}
sp.startMode = StartQml;
return sp;
......@@ -550,6 +554,8 @@ static void startRemoteTool(IAnalyzerTool *tool, StartMode mode)
sp.connParams.host = host;
sp.connParams.port = port;
sp.sysroot = sysroot;
sp.analyzerHost = host;
sp.analyzerPort = port;
AnalyzerRunControl *rc = new AnalyzerRunControl(tool, sp, 0);
QObject::connect(AnalyzerManager::stopAction(), SIGNAL(triggered()), rc, SLOT(stopIt()));
......
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