void QmlProfilerTool::startRemoteTool(ProjectExplorer::RunConfiguration *rc)
{
    Id kitId;
    quint16 port;
    Kit *kit = 0;

    {
        QSettings *settings = ICore::settings();

        kitId = Id::fromSetting(settings->value(QLatin1String("AnalyzerQmlAttachDialog/kitId")));
        port = settings->value(QLatin1String("AnalyzerQmlAttachDialog/port"), 3768).toUInt();

        QmlProfilerAttachDialog dialog;

        dialog.setKitId(kitId);
        dialog.setPort(port);

        if (dialog.exec() != QDialog::Accepted)
            return;

        kit = dialog.kit();
        port = dialog.port();

        settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), kit->id().toSetting());
        settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/port"), port);
    }

    AnalyzerConnection connection;

    IDevice::ConstPtr device = DeviceKitInformation::device(kit);
    if (device) {
        Connection toolControl = device->toolControlChannel(IDevice::QmlControlChannel);
        QTC_ASSERT(toolControl.is<HostName>(), return);
        connection.analyzerHost = toolControl.as<HostName>().host();
        connection.connParams = device->sshParameters();
    }
    connection.analyzerPort = Utils::Port(port);

    auto runControl = qobject_cast<QmlProfilerRunControl *>(createRunControl(rc));
    runControl->setConnection(connection);

    ProjectExplorerPlugin::startRunControl(runControl, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
}
Exemple #2
0
Core::Id KitChooser::currentKitId() const
{
    Kit *kit = currentKit();
    return kit ? kit->id() : Core::Id();
}