diff options
author | Aurindam Jana <aurindam.jana@digia.com> | 2013-07-19 16:13:10 +0200 |
---|---|---|
committer | Aurindam Jana <aurindam.jana@digia.com> | 2013-07-23 16:19:21 +0200 |
commit | d53609d27b1a2e552586ef4965826a96a681fb0d (patch) | |
tree | afcfdc88f0fc47cbefcbf09ac152185d2a9c7749 /src/plugins/qmlprofiler/localqmlprofilerrunner.cpp | |
parent | c57160eda676b7cefd9375191054a0df0c8d4408 (diff) | |
download | qt-creator-d53609d27b1a2e552586ef4965826a96a681fb0d.tar.gz |
QmlProfiler: Separate out LocalQmlProfilerRunner from engine
Change-Id: I6f9245179090bebb98b6d9849a7a696105e43a3a
Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/plugins/qmlprofiler/localqmlprofilerrunner.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/localqmlprofilerrunner.cpp | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp index a7883f506c..2a47feb46a 100644 --- a/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp +++ b/src/plugins/qmlprofiler/localqmlprofilerrunner.cpp @@ -29,13 +29,62 @@ #include "localqmlprofilerrunner.h" #include "qmlprofilerplugin.h" +#include "qmlprofilerengine.h" + +#include <analyzerbase/analyzerstartparameters.h> +#include <projectexplorer/runconfiguration.h> +#include <qmlprojectmanager/qmlprojectrunconfiguration.h> +#include <projectexplorer/localapplicationrunconfiguration.h> +#include <projectexplorer/environmentaspect.h> using namespace QmlProfiler; using namespace QmlProfiler::Internal; +using namespace ProjectExplorer; + +LocalQmlProfilerRunner *LocalQmlProfilerRunner::createLocalRunner( + RunConfiguration *runConfiguration, + const Analyzer::AnalyzerStartParameters &sp, + QString *errorMessage, + QmlProfilerEngine *engine) +{ + QmlProjectManager::QmlProjectRunConfiguration *rc1 = + qobject_cast<QmlProjectManager::QmlProjectRunConfiguration *>(runConfiguration); + LocalApplicationRunConfiguration *rc2 = + qobject_cast<LocalApplicationRunConfiguration *>(runConfiguration); + QTC_ASSERT(rc1 || rc2, return 0); + ProjectExplorer::EnvironmentAspect *environment + = runConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>(); + QTC_ASSERT(environment, return 0); + Configuration conf; + if (rc1) { + // This is a "plain" .qmlproject. + conf.executable = rc1->observerPath(); + conf.executableArguments = rc1->viewerArguments(); + conf.workingDirectory = rc1->workingDirectory(); + conf.environment = environment->environment(); + } else { + // FIXME: Check. + conf.executable = rc2->executable(); + conf.executableArguments = rc2->commandLineArguments(); + conf.workingDirectory = rc2->workingDirectory(); + conf.environment = environment->environment(); + } + + conf.port = sp.analyzerPort; -LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration, QObject *parent) : - AbstractQmlProfilerRunner(parent), - m_configuration(configuration) + if (conf.executable.isEmpty()) { + if (errorMessage) + *errorMessage = tr("No executable file to launch."); + return 0; + } + return new LocalQmlProfilerRunner(conf, engine); +} + +LocalQmlProfilerRunner::LocalQmlProfilerRunner(const Configuration &configuration, + QmlProfilerEngine *engine) : + AbstractQmlProfilerRunner(engine), + m_configuration(configuration), + m_engine(engine) { connect(&m_launcher, SIGNAL(appendMessage(QString,Utils::OutputFormat)), this, SIGNAL(appendMessage(QString,Utils::OutputFormat))); @@ -48,6 +97,9 @@ LocalQmlProfilerRunner::~LocalQmlProfilerRunner() void LocalQmlProfilerRunner::start() { + if (m_engine->mode() != Analyzer::StartQml) + return; + QString arguments = QString::fromLatin1("-qmljsdebugger=port:%1,block").arg(m_configuration.port); if (!m_configuration.executableArguments.isEmpty()) @@ -78,6 +130,9 @@ void LocalQmlProfilerRunner::spontaneousStop(int exitCode) void LocalQmlProfilerRunner::stop() { + if (m_engine->mode() != Analyzer::StartQml) + return; + if (QmlProfilerPlugin::debugOutput) qWarning("QmlProfiler: Stopping application ..."); |