forked from qt-creator/qt-creator
QmlProfiler: Use StandardRunnable in LocalQmlProfilerRunner
Change-Id: I8c59f9dfe562717edd86453b0154b7f2811a06f3 Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
@@ -66,8 +66,7 @@ quint16 LocalQmlProfilerRunner::findFreePort(QString &host)
|
|||||||
LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration,
|
LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration,
|
||||||
QmlProfilerRunControl *engine) :
|
QmlProfilerRunControl *engine) :
|
||||||
QObject(engine),
|
QObject(engine),
|
||||||
m_configuration(configuration),
|
m_configuration(configuration)
|
||||||
m_engine(engine)
|
|
||||||
{
|
{
|
||||||
connect(&m_launcher, &ApplicationLauncher::appendMessage,
|
connect(&m_launcher, &ApplicationLauncher::appendMessage,
|
||||||
this, &LocalQmlProfilerRunner::appendMessage);
|
this, &LocalQmlProfilerRunner::appendMessage);
|
||||||
@@ -95,20 +94,21 @@ void LocalQmlProfilerRunner::start()
|
|||||||
m_configuration.socket);
|
m_configuration.socket);
|
||||||
|
|
||||||
|
|
||||||
if (!m_configuration.executableArguments.isEmpty())
|
if (!m_configuration.debuggee.commandLineArguments.isEmpty())
|
||||||
arguments += QLatin1Char(' ') + m_configuration.executableArguments;
|
arguments += QLatin1Char(' ') + m_configuration.debuggee.commandLineArguments;
|
||||||
|
|
||||||
if (QmlProfilerPlugin::debugOutput) {
|
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() ?
|
qPrintable(m_configuration.socket.isEmpty() ?
|
||||||
QString::number(m_configuration.port) : m_configuration.socket));
|
QString::number(m_configuration.port) : m_configuration.socket));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_launcher.setWorkingDirectory(m_configuration.workingDirectory);
|
m_launcher.setWorkingDirectory(m_configuration.debuggee.workingDirectory);
|
||||||
m_launcher.setEnvironment(m_configuration.environment);
|
m_launcher.setEnvironment(m_configuration.debuggee.environment);
|
||||||
connect(&m_launcher, &ApplicationLauncher::processExited,
|
connect(&m_launcher, &ApplicationLauncher::processExited,
|
||||||
this, &LocalQmlProfilerRunner::spontaneousStop);
|
this, &LocalQmlProfilerRunner::spontaneousStop);
|
||||||
m_launcher.start(ApplicationLauncher::Gui, m_configuration.executable, arguments);
|
m_launcher.start(ApplicationLauncher::Gui, m_configuration.debuggee.executable,
|
||||||
|
arguments);
|
||||||
|
|
||||||
emit started();
|
emit started();
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "qmlprofiler_global.h"
|
#include "qmlprofiler_global.h"
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <projectexplorer/applicationlauncher.h>
|
#include <projectexplorer/applicationlauncher.h>
|
||||||
|
#include <projectexplorer/runnables.h>
|
||||||
|
|
||||||
namespace QmlProfiler {
|
namespace QmlProfiler {
|
||||||
|
|
||||||
@@ -39,12 +40,9 @@ class QMLPROFILER_EXPORT LocalQmlProfilerRunner : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
struct Configuration {
|
struct Configuration {
|
||||||
QString executable;
|
ProjectExplorer::StandardRunnable debuggee;
|
||||||
QString executableArguments;
|
|
||||||
quint16 port;
|
quint16 port;
|
||||||
QString socket;
|
QString socket;
|
||||||
QString workingDirectory;
|
|
||||||
Utils::Environment environment;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerRunControl *engine);
|
LocalQmlProfilerRunner(const Configuration &configuration, QmlProfilerRunControl *engine);
|
||||||
@@ -65,7 +63,6 @@ private:
|
|||||||
|
|
||||||
Configuration m_configuration;
|
Configuration m_configuration;
|
||||||
ProjectExplorer::ApplicationLauncher m_launcher;
|
ProjectExplorer::ApplicationLauncher m_launcher;
|
||||||
QmlProfilerRunControl *m_engine;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlProfiler
|
} // namespace QmlProfiler
|
||||||
|
@@ -75,6 +75,12 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
|
|||||||
QTC_ASSERT(runConfiguration->runnable().is<StandardRunnable>(), return 0);
|
QTC_ASSERT(runConfiguration->runnable().is<StandardRunnable>(), return 0);
|
||||||
auto runnable = runConfiguration->runnable().as<StandardRunnable>();
|
auto runnable = runConfiguration->runnable().as<StandardRunnable>();
|
||||||
|
|
||||||
|
if (runnable.executable.isEmpty()) {
|
||||||
|
if (errorMessage)
|
||||||
|
*errorMessage = tr("No executable file to launch.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Kit *kit = runConfiguration->target()->kit();
|
Kit *kit = runConfiguration->target()->kit();
|
||||||
AnalyzerConnection connection;
|
AnalyzerConnection connection;
|
||||||
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
|
const QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(kit);
|
||||||
@@ -101,20 +107,10 @@ RunControl *QmlProfilerRunControlFactory::create(RunConfiguration *runConfigurat
|
|||||||
runControl->setConnection(connection);
|
runControl->setConnection(connection);
|
||||||
|
|
||||||
LocalQmlProfilerRunner::Configuration conf;
|
LocalQmlProfilerRunner::Configuration conf;
|
||||||
conf.executable = runnable.executable;
|
conf.debuggee = runnable;
|
||||||
conf.executableArguments = runnable.commandLineArguments;
|
|
||||||
conf.workingDirectory = runnable.workingDirectory;
|
|
||||||
conf.socket = connection.analyzerSocket;
|
conf.socket = connection.analyzerSocket;
|
||||||
if (EnvironmentAspect *environment = runConfiguration->extraAspect<EnvironmentAspect>())
|
|
||||||
conf.environment = environment->environment();
|
|
||||||
conf.port = connection.analyzerPort;
|
conf.port = connection.analyzerPort;
|
||||||
|
|
||||||
if (conf.executable.isEmpty()) {
|
|
||||||
if (errorMessage)
|
|
||||||
*errorMessage = tr("No executable file to launch.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) new LocalQmlProfilerRunner(conf, runControl);
|
(void) new LocalQmlProfilerRunner(conf, runControl);
|
||||||
return runControl;
|
return runControl;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user