Commit 78a800cb authored by hjk's avatar hjk

Debugger: Use dedicated structure for Qml server parameters

The main idea is to start using ProjectExplorer::Connection later.

Change-Id: Ie91eacdfb0e93ae142fec7ce32bcf554a5282122
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 7e8d9835
......@@ -114,7 +114,7 @@ RunControl *AndroidDebugSupport::createDebugRunControl(AndroidRunConfiguration *
QTcpServer server;
QTC_ASSERT(server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6), return 0);
params.qmlServerAddress = server.serverAddress().toString();
params.qmlServer.host = server.serverAddress().toString();
//TODO: Not sure if these are the right paths.
Kit *kit = target->kit();
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
......
......@@ -916,7 +916,7 @@ void DebuggerEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &re
}
if (result.qmlServerPort.isValid()) {
d->m_runParameters.qmlServerPort = result.qmlServerPort;
d->m_runParameters.qmlServer.port = result.qmlServerPort;
d->m_runParameters.inferior.commandLineArguments.replace("%qml_port%",
QString::number(result.qmlServerPort.number()));
}
......
......@@ -2135,8 +2135,8 @@ void DebuggerPluginPrivate::attachToQmlPort()
const QVariant qmlServerPort = configValue("LastQmlServerPort");
if (qmlServerPort.isValid())
dlg.setPort(qmlServerPort.toInt());
else if (rp.qmlServerPort.isValid())
dlg.setPort(rp.qmlServerPort.number());
else if (rp.qmlServer.port.isValid())
dlg.setPort(rp.qmlServer.port.number());
else
dlg.setPort(-1);
......@@ -2157,9 +2157,9 @@ void DebuggerPluginPrivate::attachToQmlPort()
rp.connParams = device->sshParameters();
Connection toolControl = device->toolControlChannel(IDevice::QmlControlChannel);
QTC_ASSERT(toolControl.is<HostName>(), return);
rp.qmlServerAddress = toolControl.as<HostName>().host();
rp.qmlServer.host = toolControl.as<HostName>().host();
}
rp.qmlServerPort = Utils::Port(dlg.port());
rp.qmlServer.port = Utils::Port(dlg.port());
rp.startMode = AttachToRemoteProcess;
rp.closeMode = KillAtClose;
rp.languages = QmlLanguage;
......@@ -2903,11 +2903,11 @@ static QString formatStartParameters(DebuggerRunParameters &sp)
str << "Addtional Search Directories:"
<< sp.additionalSearchDirectories.join(QLatin1Char(' ')) << '\n';
}
if (!sp.qmlServerAddress.isEmpty())
str << "QML server: " << sp.qmlServerAddress << ':'
<< (sp.qmlServerPort.isValid() ? sp.qmlServerPort.number() : -1) << '\n';
if (!sp.remoteChannel.isEmpty())
str << "Remote: " << sp.remoteChannel << '\n';
if (!sp.qmlServer.host.isEmpty())
str << "QML server: " << sp.qmlServer.host << ':'
<< (sp.qmlServer.port.isValid() ? sp.qmlServer.port.number() : -1) << '\n';
str << "Sysroot: " << sp.sysRoot << '\n';
str << "Debug Source Location: " << sp.debugSourceLocation.join(QLatin1Char(':')) << '\n';
return rc;
......
......@@ -441,8 +441,10 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration *
errors->append(DebuggerPlugin::tr("Not enough free ports for QML debugging.") + ' ');
return 0;
}
rp.qmlServerAddress = server.serverAddress().toString();
rp.qmlServerPort = Utils::Port(server.serverPort());
TcpServerConnection conn;
conn.host = server.serverAddress().toString();
conn.port = Utils::Port(server.serverPort());
rp.qmlServer = conn;
// Makes sure that all bindings go through the JavaScript engine, so that
// breakpoints are actually hit!
......@@ -482,7 +484,7 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration *
QtcProcess::addArg(&rp.inferior.commandLineArguments,
(rp.languages & CppLanguage) && rp.nativeMixedEnabled ?
QmlDebug::qmlDebugNativeArguments(service, false) :
QmlDebug::qmlDebugTcpArguments(service, rp.qmlServerPort));
QmlDebug::qmlDebugTcpArguments(service, rp.qmlServer.port));
}
}
}
......
......@@ -57,6 +57,13 @@ public:
QString reason;
};
class DEBUGGER_EXPORT TcpServerConnection
{
public:
QString host;
Utils::Port port;
};
class DEBUGGER_EXPORT DebuggerStartParameters
{
public:
......@@ -72,8 +79,7 @@ public:
bool useTerminal = false;
// Used by Qml debugging.
QString qmlServerAddress;
Utils::Port qmlServerPort;
TcpServerConnection qmlServer;
// Used by general remote debugging.
QString remoteChannel;
......
......@@ -376,7 +376,7 @@ void QmlEngine::beginConnection(Utils::Port port)
QTC_ASSERT(state() == EngineRunRequested, return);
QString host = runParameters().qmlServerAddress;
QString host = runParameters().qmlServer.host;
// Use localhost as default
if (host.isEmpty())
host = "localhost";
......@@ -392,8 +392,8 @@ void QmlEngine::beginConnection(Utils::Port port)
* the connection will be closed again (instead of returning the "connection refused"
* error that we expect).
*/
if (runParameters().qmlServerPort.isValid())
port = runParameters().qmlServerPort;
if (runParameters().qmlServer.port.isValid())
port = runParameters().qmlServer.port;
if (!d->connection || d->connection->isConnected())
return;
......@@ -564,7 +564,7 @@ void QmlEngine::notifyEngineRemoteSetupFinished(const RemoteSetupResult &result)
if (result.success) {
if (result.qmlServerPort.isValid())
runParameters().qmlServerPort = result.qmlServerPort;
runParameters().qmlServer.port = result.qmlServerPort;
notifyEngineSetupOk();
......@@ -587,7 +587,7 @@ void QmlEngine::notifyEngineRemoteServerRunning(const QString &serverChannel, in
bool ok = false;
quint16 qmlPort = serverChannel.toUInt(&ok);
if (ok)
runParameters().qmlServerPort = Utils::Port(qmlPort);
runParameters().qmlServer.port = Utils::Port(qmlPort);
else
qWarning() << tr("QML debugging port not set: Unable to convert %1 to unsigned int.").arg(serverChannel);
......
......@@ -75,8 +75,8 @@ static DebuggerStartParameters createDebuggerStartParameters(QnxRunConfiguration
auto aspect = runConfig->extraAspect<DebuggerRunConfigurationAspect>();
if (aspect->useQmlDebugger()) {
params.qmlServerAddress = device->sshParameters().host;
params.qmlServerPort = Utils::Port(); // QML port is handed out later
params.qmlServer.host = device->sshParameters().host;
params.qmlServer.port = Utils::Port(); // QML port is handed out later
}
auto qtVersion = dynamic_cast<QnxQtVersion *>(QtSupport::QtKitInformation::qtVersion(k));
......
......@@ -118,8 +118,8 @@ RunControl *RemoteLinuxRunControlFactory::create(RunConfiguration *runConfig, Co
params.remoteSetupNeeded = true;
if (aspect->useQmlDebugger()) {
params.qmlServerAddress = dev->sshParameters().host;
params.qmlServerPort = Utils::Port(); // port is selected later on
params.qmlServer.host = dev->sshParameters().host;
params.qmlServer.port = Utils::Port(); // port is selected later on
}
if (aspect->useCppDebugger()) {
aspect->setUseMultiProcess(true);
......
......@@ -109,8 +109,8 @@ RunControl *WinRtDebugSupport::createDebugRunControl(WinRtRunConfiguration *runC
Utils::Port qmlDebugPort;
if (!getFreePort(qmlDebugPort, errorMessage))
return 0;
params.qmlServerAddress = QHostAddress(QHostAddress::LocalHost).toString();
params.qmlServerPort = qmlDebugPort;
params.qmlServer.host = QHostAddress(QHostAddress::LocalHost).toString();
params.qmlServer.port = qmlDebugPort;
}
WinRtRunnerHelper *runner = new WinRtRunnerHelper(runConfig, errorMessage);
......
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