diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp index 9f307ffb6ec..2bc4b5e360a 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp @@ -66,8 +66,7 @@ quint16 LocalQmlProfilerRunner::findFreePort(QString &host) LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerRunControl *engine) : QObject(engine), - m_configuration(configuration), - m_engine(engine) + m_configuration(configuration) { connect(&m_launcher, &ApplicationLauncher::appendMessage, this, &LocalQmlProfilerRunner::appendMessage); @@ -95,20 +94,21 @@ void LocalQmlProfilerRunner::start() m_configuration.socket); - if (!m_configuration.executableArguments.isEmpty()) - arguments += QLatin1Char(' ') + m_configuration.executableArguments; + if (!m_configuration.debuggee.commandLineArguments.isEmpty()) + arguments += QLatin1Char(' ') + m_configuration.debuggee.commandLineArguments; if (QmlProfilerPlugin::debugOutput) { - qWarning("QmlProfiler: Launching %s:%s", qPrintable(m_configuration.executable), + qWarning("QmlProfiler: Launching %s:%s", qPrintable(m_configuration.debuggee.executable), qPrintable(m_configuration.socket.isEmpty() ? QString::number(m_configuration.port) : m_configuration.socket)); } - m_launcher.setWorkingDirectory(m_configuration.workingDirectory); - m_launcher.setEnvironment(m_configuration.environment); + m_launcher.setWorkingDirectory(m_configuration.debuggee.workingDirectory); + m_launcher.setEnvironment(m_configuration.debuggee.environment); connect(&m_launcher, &ApplicationLauncher::processExited, this, &LocalQmlProfilerRunner::spontaneousStop); - m_launcher.start(ApplicationLauncher::Gui, m_configuration.executable, arguments); + m_launcher.start(ApplicationLauncher::Gui, m_configuration.debuggee.executable, + arguments); emit started(); } diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.h b/src/plugins/qmlprofiler/localqmlprofilerrunner.h index 785bb331cfc..e156e218125 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.h +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.h @@ -29,6 +29,7 @@ #include "qmlprofiler_global.h" #include #include +#include namespace QmlProfiler { @@ -39,12 +40,9 @@ class QMLPROFILER_EXPORT LocalQmlProfilerRunner : public QObject public: struct Configuration { - QString executable; - QString executableArguments; + ProjectExplorer::StandardRunnable debuggee; quint16 port; QString socket; - QString workingDirectory; - Utils::Environment environment; }; LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerRunControl *engine); @@ -65,7 +63,6 @@ private: Configuration m_configuration; ProjectExplorer::ApplicationLauncher m_launcher; - QmlProfilerRunControl *m_engine; }; } // namespace QmlProfiler diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp index 65c20ba11ab..885e0f4d898 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrolfactory.cpp @@ -75,6 +75,12 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat QTC_ASSERT(runConfiguration->runnable().is(), return 0); auto runnable = runConfiguration->runnable().as(); + if (runnable.executable.isEmpty()) { + if (errorMessage) + *errorMessage = tr("No executable file to launch."); + return 0; + } + Kit *kit = runConfiguration->target()->kit(); AnalyzerConnection connection; const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit); @@ -101,20 +107,10 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat runControl->setConnection(connection); LocalQmlProfilerRunner::Configuration conf; - conf.executable = runnable.executable; - conf.executableArguments = runnable.commandLineArguments; - conf.workingDirectory = runnable.workingDirectory; + conf.debuggee = runnable; conf.socket = connection.analyzerSocket; - if (EnvironmentAspect *environment = runConfiguration->extraAspect()) - conf.environment = environment->environment(); conf.port = connection.analyzerPort; - if (conf.executable.isEmpty()) { - if (errorMessage) - *errorMessage = tr("No executable file to launch."); - return 0; - } - (void) new LocalQmlProfilerRunner(conf, runControl); return runControl; }