Commit f8857855 authored by hjk's avatar hjk

Debugger: Remove use of setRunParameters in Qml attach dialog

Change-Id: I90ef143b9c9a0d8606e7d00346c1e508c32a4d88
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 53f68fd8
......@@ -120,6 +120,7 @@ enum DebuggerStartMode
AttachCore, // Attach to a core file
AttachToRemoteServer, // Attach to a running gdbserver
AttachToRemoteProcess, // Attach to a running remote process
AttachToQmlServer, // Attach to a running QmlServer
StartRemoteProcess // Start and attach to a remote process
};
......
......@@ -2145,14 +2145,11 @@ void DebuggerPlugin::getEnginesState(QByteArray *json) const
void DebuggerPluginPrivate::attachToQmlPort()
{
DebuggerRunParameters rp;
AttachToQmlPortDialog dlg(ICore::mainWindow());
const QVariant qmlServerPort = configValue("LastQmlServerPort");
if (qmlServerPort.isValid())
dlg.setPort(qmlServerPort.toInt());
else if (rp.qmlServer.port() > 0)
dlg.setPort(rp.qmlServer.port());
else
dlg.setPort(-1);
......@@ -2169,38 +2166,19 @@ void DebuggerPluginPrivate::attachToQmlPort()
setConfigValue("LastProfile", kit->id().toSetting());
IDevice::ConstPtr device = DeviceKitInformation::device(kit);
if (device) {
QSsh::SshConnectionParameters sshParameters = device->sshParameters();
rp.remoteChannel = QString("%1:%2").arg(sshParameters.host).arg(sshParameters.port);
QUrl toolControl = device->toolControlChannel(IDevice::QmlControlChannel);
rp.qmlServer.setHost(toolControl.host());
}
rp.qmlServer.setPort(dlg.port());
rp.startMode = AttachToRemoteProcess;
rp.closeMode = KillAtClose;
rp.languages = QmlLanguage;
rp.masterEngineType = QmlEngineType;
//
// get files from all the projects in the session
//
QList<Project *> projects = SessionManager::projects();
if (Project *startupProject = SessionManager::startupProject()) {
// startup project first
projects.removeOne(startupProject);
projects.insert(0, startupProject);
}
QStringList sourceFiles;
foreach (Project *project, projects)
sourceFiles << project->files(Project::SourceFiles);
rp.projectSourceDirectory =
!projects.isEmpty() ? projects.first()->projectDirectory().toString() : QString();
rp.projectSourceFiles = sourceFiles;
QTC_ASSERT(device, return);
auto debugger = DebuggerRunTool::createFromKit(kit);
QTC_ASSERT(debugger, return);
debugger->setRunParameters(rp);
QUrl qmlServer = device->toolControlChannel(IDevice::QmlControlChannel);
qmlServer.setPort(dlg.port());
debugger->setQmlServer(qmlServer);
QSsh::SshConnectionParameters sshParameters = device->sshParameters();
debugger->setRemoteChannel(sshParameters.host, sshParameters.port);
debugger->setStartMode(AttachToQmlServer);
debugger->startRunControl();
}
......
......@@ -187,7 +187,28 @@ void DebuggerRunTool::setBreakOnMainNextTime()
void DebuggerRunTool::setStartMode(DebuggerStartMode startMode)
{
m_runParameters.startMode = startMode;
if (startMode == AttachToQmlServer) {
m_runParameters.startMode = AttachToRemoteProcess;
m_runParameters.languages = QmlLanguage;
m_runParameters.masterEngineType = QmlEngineType;
m_runParameters.closeMode = KillAtClose;
// FIXME: This is horribly wrong.
// get files from all the projects in the session
QList<Project *> projects = SessionManager::projects();
if (Project *startupProject = SessionManager::startupProject()) {
// startup project first
projects.removeOne(startupProject);
projects.insert(0, startupProject);
}
foreach (Project *project, projects)
m_runParameters.projectSourceFiles.append(project->files(Project::SourceFiles));
if (!projects.isEmpty())
m_runParameters.projectSourceDirectory = projects.first()->projectDirectory().toString();
} else {
m_runParameters.startMode = startMode;
}
}
void DebuggerRunTool::setCloseMode(DebuggerCloseMode closeMode)
......
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