forked from qt-creator/qt-creator
ProjectExplorer: Standardize RunWorker creation logic
This unifies the remaining paths of RunWorker creation to always use RunWorkerFactories in the plugin pimpls. There were, and are, still effectively three basic kinds of workers: - "toplevel" tools corresponding to the run modes, that are often all that's used for local runs and directly started via the fat buttons or e.g. entries in the analyze menu, with factories already previously located in the plugin pimpls - core "tool helpers", providing tool specific functionality typically used in conjunction with a remote device specific run mechanism, set up via RunControl::registerWorkerCreator - target/device specific runhelper like port gatherers contructed e.g. via *Device::workerCreator(Core::Id id) Worse, these categories are partially overlapping, so it was not clear how a "clean" setup would look like, instead some ad-hoc cobbling "to make it work" happened. In some cases, the runMode id was used throughout the whole ensemble of run workers for a given run, and which worker exactly was created depended on which of the mechanism above was used in which order. With the new central setup, the top-level runmodes remain, but the second kind gets new ids, so the implicit dependencies on order of setup mechanism are avoided. This also helps in the cases where there was previously unclarity of where and how to set up worker factories: It's always and only the plugin pimpl now. Change-Id: Icd9a08e2d53e19abe8b21fe546f469fae353a69f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -25,6 +25,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
@@ -85,4 +88,24 @@ inline QString qmlDebugLocalArguments(QmlDebugServicesPreset services, const QSt
|
||||
return qmlDebugCommandLineArguments(services, QLatin1String("file:") + socket, block);
|
||||
}
|
||||
|
||||
inline Core::Id runnerIdForRunMode(Core::Id runMode)
|
||||
{
|
||||
if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
|
||||
return ProjectExplorer::Constants::QML_PROFILER_RUNNER;
|
||||
if (runMode == ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE)
|
||||
return ProjectExplorer::Constants::QML_PREVIEW_RUNNER;
|
||||
return {};
|
||||
}
|
||||
|
||||
inline QmlDebugServicesPreset servicesForRunMode(Core::Id runMode)
|
||||
{
|
||||
if (runMode == ProjectExplorer::Constants::QML_PROFILER_RUN_MODE)
|
||||
return QmlDebug::QmlProfilerServices;
|
||||
if (runMode == ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE)
|
||||
return QmlDebug::QmlPreviewServices;
|
||||
if (runMode == ProjectExplorer::Constants::DEBUG_RUN_MODE)
|
||||
return QmlDebug::QmlDebuggerServices;
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace QmlDebug
|
||||
|
@@ -40,7 +40,7 @@ AndroidQmlToolingSupport::AndroidQmlToolingSupport(RunControl *runControl,
|
||||
auto runner = new AndroidRunner(runControl, intentName);
|
||||
addStartDependency(runner);
|
||||
|
||||
auto profiler = runControl->createWorker(runControl->runMode());
|
||||
auto profiler = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
|
||||
profiler->addStartDependency(this);
|
||||
|
||||
connect(runner, &AndroidRunner::qmlServerReady, this, [this, profiler](const QUrl &server) {
|
||||
|
@@ -26,7 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
|
||||
#include <qmldebug/qmldebugcommandlinearguments.h>
|
||||
|
||||
|
@@ -200,18 +200,6 @@ void QdbDevice::setupDefaultNetworkSettings(const QString &host)
|
||||
setSshParameters(parameters);
|
||||
}
|
||||
|
||||
std::function<ProjectExplorer::RunWorker *(ProjectExplorer::RunControl *)>
|
||||
QdbDevice::workerCreator(Core::Id id) const
|
||||
{
|
||||
if (id == "PerfRecorder") {
|
||||
return [](ProjectExplorer::RunControl *runControl) {
|
||||
return new QdbDevicePerfProfilerSupport(runControl);
|
||||
};
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
// QdbDeviceWizard
|
||||
|
||||
class QdbSettingsPage : public QWizardPage
|
||||
|
@@ -52,9 +52,6 @@ public:
|
||||
|
||||
void setupDefaultNetworkSettings(const QString &host);
|
||||
|
||||
std::function<ProjectExplorer::RunWorker *(ProjectExplorer::RunControl *)>
|
||||
workerCreator(Core::Id id) const override;
|
||||
|
||||
private:
|
||||
QdbDevice();
|
||||
|
||||
|
@@ -175,17 +175,17 @@ void QdbDeviceDebugSupport::stop()
|
||||
|
||||
// QdbDeviceQmlProfilerSupport
|
||||
|
||||
QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl,
|
||||
QmlDebug::QmlDebugServicesPreset services)
|
||||
QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl)
|
||||
: RunWorker(runControl)
|
||||
{
|
||||
setId("QdbDeviceQmlToolingSupport");
|
||||
|
||||
QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode());
|
||||
m_runner = new QdbDeviceInferiorRunner(runControl, false, false, true, services);
|
||||
addStartDependency(m_runner);
|
||||
addStopDependency(m_runner);
|
||||
|
||||
m_worker = runControl->createWorker(runControl->runMode());
|
||||
m_worker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
|
||||
m_worker->addStartDependency(this);
|
||||
addStopDependency(m_worker);
|
||||
}
|
||||
|
@@ -47,8 +47,7 @@ private:
|
||||
class QdbDeviceQmlToolingSupport : public ProjectExplorer::RunWorker
|
||||
{
|
||||
public:
|
||||
QdbDeviceQmlToolingSupport(ProjectExplorer::RunControl *runControl,
|
||||
QmlDebug::QmlDebugServicesPreset services);
|
||||
QdbDeviceQmlToolingSupport(ProjectExplorer::RunControl *runControl);
|
||||
|
||||
private:
|
||||
void start() override;
|
||||
@@ -57,22 +56,6 @@ private:
|
||||
ProjectExplorer::RunWorker *m_worker = nullptr;
|
||||
};
|
||||
|
||||
class QdbDeviceQmlProfilerSupport : public QdbDeviceQmlToolingSupport
|
||||
{
|
||||
public:
|
||||
QdbDeviceQmlProfilerSupport(ProjectExplorer::RunControl *runControl) :
|
||||
QdbDeviceQmlToolingSupport(runControl, QmlDebug::QmlProfilerServices)
|
||||
{}
|
||||
};
|
||||
|
||||
class QdbDeviceQmlPreviewSupport : public QdbDeviceQmlToolingSupport
|
||||
{
|
||||
public:
|
||||
QdbDeviceQmlPreviewSupport(ProjectExplorer::RunControl *runControl) :
|
||||
QdbDeviceQmlToolingSupport(runControl, QmlDebug::QmlPreviewServices)
|
||||
{}
|
||||
};
|
||||
|
||||
class QdbDevicePerfProfilerSupport : public ProjectExplorer::RunWorker
|
||||
{
|
||||
public:
|
||||
|
@@ -197,16 +197,17 @@ public:
|
||||
supportedRunConfigs,
|
||||
{Qdb::Constants::QdbLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerWorkerFactory{
|
||||
RunWorkerFactory::make<QdbDeviceQmlProfilerSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||
RunWorkerFactory qmlToolWorkerFactory{
|
||||
RunWorkerFactory::make<QdbDeviceQmlToolingSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
|
||||
ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Qdb::Constants::QdbLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory qmlPreviewWorkerFactory{
|
||||
RunWorkerFactory::make<QdbDeviceQmlPreviewSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
RunWorkerFactory perfRecorderFactory{
|
||||
RunWorkerFactory::make<QdbDevicePerfProfilerSupport>(),
|
||||
{"PerfRecorder"},
|
||||
{},
|
||||
{Qdb::Constants::QdbLinuxOsType}
|
||||
};
|
||||
|
||||
|
@@ -395,7 +395,7 @@ IosQmlProfilerSupport::IosQmlProfilerSupport(RunControl *runControl)
|
||||
m_runner->setQmlDebugging(QmlDebug::QmlProfilerServices);
|
||||
addStartDependency(m_runner);
|
||||
|
||||
m_profiler = runControl->createWorker(runControl->runMode());
|
||||
m_profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER);
|
||||
m_profiler->addStartDependency(this);
|
||||
}
|
||||
|
||||
|
@@ -66,9 +66,6 @@ public:
|
||||
PerfProfilerPluginPrivate()
|
||||
{
|
||||
RunConfiguration::registerAspect<PerfRunConfigurationAspect>();
|
||||
|
||||
RunControl::registerWorkerCreator(ProjectExplorer::Constants::PERFPROFILER_RUN_MODE,
|
||||
[](RunControl *runControl){ return new PerfProfilerRunner(runControl); });
|
||||
}
|
||||
|
||||
RunWorkerFactory profilerWorkerFactory{
|
||||
|
@@ -185,11 +185,10 @@ PerfProfilerRunner::PerfProfilerRunner(RunControl *runControl)
|
||||
// If the parser is gone, there is no point in going on.
|
||||
m_perfParserWorker->setEssential(true);
|
||||
|
||||
if (auto perfRecorder = device()->workerCreator("PerfRecorder")) {
|
||||
m_perfRecordWorker = perfRecorder(runControl);
|
||||
|
||||
if ((m_perfRecordWorker = runControl->createWorker("PerfRecorder"))) {
|
||||
m_perfParserWorker->addStartDependency(m_perfRecordWorker);
|
||||
addStartDependency(m_perfParserWorker);
|
||||
|
||||
} else {
|
||||
m_perfRecordWorker = new LocalPerfRecordWorker(runControl);
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include "perftimelinemodelmanager.h"
|
||||
|
||||
#include <debugger/debuggermainwindow.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <tracing/timelinezoomcontrol.h>
|
||||
#include <utils/fileinprojectfinder.h>
|
||||
|
||||
|
@@ -267,8 +267,8 @@ public:
|
||||
|
||||
m_portGatherer = qobject_cast<PortsGatherer *>(sharedEndpointGatherer);
|
||||
if (m_portGatherer) {
|
||||
if (auto creator = device()->workerCreator("ChannelForwarder")) {
|
||||
m_channelForwarder = qobject_cast<ChannelForwarder *>(creator(runControl));
|
||||
if (auto forwarder = runControl->createWorker("ChannelForwarder")) {
|
||||
m_channelForwarder = qobject_cast<ChannelForwarder *>(forwarder);
|
||||
if (m_channelForwarder) {
|
||||
m_channelForwarder->addStartDependency(m_portGatherer);
|
||||
m_channelForwarder->setFromUrlGetter([this] {
|
||||
@@ -338,11 +338,9 @@ ChannelProvider::ChannelProvider(RunControl *runControl, int requiredChannels)
|
||||
{
|
||||
setId("ChannelProvider");
|
||||
|
||||
RunWorker *sharedEndpoints = nullptr;
|
||||
if (auto sharedEndpointGatherer = device()->workerCreator("SharedEndpointGatherer")) {
|
||||
RunWorker *sharedEndpoints = runControl->createWorker("SharedEndpointGatherer");
|
||||
if (!sharedEndpoints) {
|
||||
// null is a legit value indicating 'no need to share'.
|
||||
sharedEndpoints = sharedEndpointGatherer(runControl);
|
||||
} else {
|
||||
sharedEndpoints = new PortsGatherer(runControl);
|
||||
}
|
||||
|
||||
|
@@ -60,8 +60,6 @@ class DeviceProcess;
|
||||
class DeviceProcessList;
|
||||
class Kit;
|
||||
class Runnable;
|
||||
class RunControl;
|
||||
class RunWorker;
|
||||
|
||||
namespace Internal { class IDevicePrivate; }
|
||||
|
||||
@@ -182,8 +180,6 @@ public:
|
||||
virtual DeviceProcessSignalOperation::Ptr signalOperation() const = 0;
|
||||
virtual DeviceEnvironmentFetcher::Ptr environmentFetcher() const;
|
||||
|
||||
virtual std::function<RunWorker *(RunControl *)> workerCreator(Core::Id) const { return {}; }
|
||||
|
||||
enum DeviceState { DeviceReadyToUse, DeviceConnected, DeviceDisconnected, DeviceStateUnknown };
|
||||
DeviceState deviceState() const;
|
||||
void setDeviceState(const DeviceState state);
|
||||
|
@@ -198,10 +198,13 @@ const char GENERATOR_ID_PREFIX[] = "PE.Wizard.Generator.";
|
||||
// RunMode
|
||||
const char NO_RUN_MODE[]="RunConfiguration.NoRunMode";
|
||||
const char NORMAL_RUN_MODE[]="RunConfiguration.NormalRunMode";
|
||||
const char QML_PROFILER_RUN_MODE[]="RunConfiguration.QmlProfilerRunMode";
|
||||
const char PERFPROFILER_RUN_MODE[]="PerfProfiler.RunMode";
|
||||
const char DEBUG_RUN_MODE[]="RunConfiguration.DebugRunMode";
|
||||
const char QML_PROFILER_RUN_MODE[]="RunConfiguration.QmlProfilerRunMode";
|
||||
const char QML_PROFILER_RUNNER[]="RunConfiguration.QmlProfilerRunner";
|
||||
const char QML_PREVIEW_RUN_MODE[]="RunConfiguration.QmlPreviewRunMode";
|
||||
const char QML_PREVIEW_RUNNER[]="RunConfiguration.QmlPreviewRunner";
|
||||
const char PERFPROFILER_RUN_MODE[]="PerfProfiler.RunMode";
|
||||
const char PERFPROFILER_RUNNER[]="PerfProfiler.Runner";
|
||||
|
||||
// Navigation Widget
|
||||
const char PROJECTTREE_ID[] = "Projects";
|
||||
|
@@ -448,32 +448,15 @@ void RunControl::initiateFinish()
|
||||
QTimer::singleShot(0, d.get(), &RunControlPrivate::initiateFinish);
|
||||
}
|
||||
|
||||
using WorkerCreators = QHash<Core::Id, RunControl::WorkerCreator>;
|
||||
|
||||
static WorkerCreators &theWorkerCreators()
|
||||
RunWorker *RunControl::createWorker(Core::Id workerId)
|
||||
{
|
||||
static WorkerCreators creators;
|
||||
return creators;
|
||||
}
|
||||
|
||||
void RunControl::registerWorkerCreator(Core::Id id, const WorkerCreator &workerCreator)
|
||||
{
|
||||
theWorkerCreators().insert(id, workerCreator);
|
||||
auto keys = theWorkerCreators().keys();
|
||||
Q_UNUSED(keys)
|
||||
}
|
||||
|
||||
RunWorker *RunControl::createWorker(Core::Id id)
|
||||
{
|
||||
auto keys = theWorkerCreators().keys();
|
||||
Q_UNUSED(keys)
|
||||
WorkerCreator creator = theWorkerCreators().value(id);
|
||||
if (creator)
|
||||
return creator(this);
|
||||
creator = device()->workerCreator(id);
|
||||
if (creator)
|
||||
return creator(this);
|
||||
return nullptr;
|
||||
const auto check = std::bind(&RunWorkerFactory::canRun,
|
||||
std::placeholders::_1,
|
||||
workerId,
|
||||
DeviceTypeKitAspect::deviceTypeId(d->kit),
|
||||
QString{});
|
||||
RunWorkerFactory *factory = Utils::findOrDefault(g_runWorkerFactories, check);
|
||||
return factory ? factory->producer()(this) : nullptr;
|
||||
}
|
||||
|
||||
bool RunControl::createMainWorker()
|
||||
|
@@ -251,12 +251,7 @@ public:
|
||||
const QString &cancelButtonText = QString(),
|
||||
bool *prompt = nullptr);
|
||||
|
||||
RunWorker *createWorker(Core::Id id);
|
||||
|
||||
using WorkerCreator = RunWorkerFactory::WorkerCreator;
|
||||
using Constraint = std::function<bool(RunConfiguration *)>;
|
||||
|
||||
static void registerWorkerCreator(Core::Id id, const WorkerCreator &workerCreator);
|
||||
RunWorker *createWorker(Core::Id workerId);
|
||||
|
||||
bool createMainWorker();
|
||||
static bool canRun(Core::Id runMode, Core::Id deviceType, Core::Id runConfigId);
|
||||
|
@@ -142,7 +142,40 @@ public:
|
||||
float m_zoomFactor = -1.0;
|
||||
QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr;
|
||||
QString m_locale;
|
||||
std::unique_ptr<ProjectExplorer::RunWorkerFactory> m_runWorkerFactory;
|
||||
|
||||
RunWorkerFactory localRunWorkerFactory{
|
||||
RunWorkerFactory::make<LocalQmlPreviewSupport>(),
|
||||
{Constants::QML_PREVIEW_RUN_MODE},
|
||||
{}, // All runconfig.
|
||||
{Constants::DESKTOP_DEVICE_TYPE}
|
||||
};
|
||||
|
||||
RunWorkerFactory runWorkerFactory{
|
||||
[this](RunControl *runControl) {
|
||||
QmlPreviewRunner *runner = new QmlPreviewRunner(runControl, m_fileLoader, m_fileClassifer,
|
||||
m_fpsHandler, m_zoomFactor, m_locale);
|
||||
connect(q, &QmlPreviewPlugin::updatePreviews,
|
||||
runner, &QmlPreviewRunner::loadFile);
|
||||
connect(q, &QmlPreviewPlugin::rerunPreviews,
|
||||
runner, &QmlPreviewRunner::rerun);
|
||||
connect(runner, &QmlPreviewRunner::ready,
|
||||
this, &QmlPreviewPluginPrivate::previewCurrentFile);
|
||||
connect(q, &QmlPreviewPlugin::zoomFactorChanged,
|
||||
runner, &QmlPreviewRunner::zoom);
|
||||
connect(q, &QmlPreviewPlugin::localeChanged,
|
||||
runner, &QmlPreviewRunner::language);
|
||||
|
||||
connect(runner, &RunWorker::started, this, [this, runControl] {
|
||||
addPreview(runControl);
|
||||
});
|
||||
connect(runner, &RunWorker::stopped, this, [this, runControl] {
|
||||
removePreview(runControl);
|
||||
});
|
||||
|
||||
return runner;
|
||||
},
|
||||
{Constants::QML_PREVIEW_RUNNER}
|
||||
};
|
||||
};
|
||||
|
||||
QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
|
||||
@@ -152,13 +185,6 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
|
||||
m_fileClassifer = &defaultFileClassifier;
|
||||
m_fpsHandler = &defaultFpsHandler;
|
||||
|
||||
m_runWorkerFactory.reset(new RunWorkerFactory{
|
||||
RunWorkerFactory::make<LocalQmlPreviewSupport>(),
|
||||
{Constants::QML_PREVIEW_RUN_MODE},
|
||||
{}, // All runconfig.
|
||||
{Constants::DESKTOP_DEVICE_TYPE}
|
||||
});
|
||||
|
||||
Core::ActionContainer *menu = Core::ActionManager::actionContainer(
|
||||
Constants::M_BUILDPROJECT);
|
||||
QAction *action = new QAction(QmlPreviewPlugin::tr("QML Preview"), this);
|
||||
@@ -199,31 +225,6 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
|
||||
connect(q, &QmlPreviewPlugin::previewedFileChanged, this, &QmlPreviewPluginPrivate::checkFile);
|
||||
connect(parser, &QmlPreviewParser::success, this, &QmlPreviewPluginPrivate::triggerPreview);
|
||||
|
||||
RunControl::registerWorkerCreator(Constants::QML_PREVIEW_RUN_MODE,
|
||||
[this](RunControl *runControl) {
|
||||
QmlPreviewRunner *runner = new QmlPreviewRunner(runControl, m_fileLoader, m_fileClassifer,
|
||||
m_fpsHandler, m_zoomFactor, m_locale);
|
||||
QObject::connect(q, &QmlPreviewPlugin::updatePreviews,
|
||||
runner, &QmlPreviewRunner::loadFile);
|
||||
QObject::connect(q, &QmlPreviewPlugin::rerunPreviews,
|
||||
runner, &QmlPreviewRunner::rerun);
|
||||
QObject::connect(runner, &QmlPreviewRunner::ready,
|
||||
this, &QmlPreviewPluginPrivate::previewCurrentFile);
|
||||
QObject::connect(q, &QmlPreviewPlugin::zoomFactorChanged,
|
||||
runner, &QmlPreviewRunner::zoom);
|
||||
QObject::connect(q, &QmlPreviewPlugin::localeChanged,
|
||||
runner, &QmlPreviewRunner::language);
|
||||
|
||||
QObject::connect(runner, &RunWorker::started, this, [this, runControl]() {
|
||||
addPreview(runControl);
|
||||
});
|
||||
QObject::connect(runner, &RunWorker::stopped, this, [this, runControl]() {
|
||||
removePreview(runControl);
|
||||
});
|
||||
|
||||
return runner;
|
||||
});
|
||||
|
||||
attachToEditor();
|
||||
}
|
||||
|
||||
|
@@ -86,12 +86,22 @@ public:
|
||||
QmlProfilerTool m_profilerTool;
|
||||
QmlProfilerOptionsPage m_profilerOptionsPage;
|
||||
QmlProfilerActions m_actions;
|
||||
RunWorkerFactory m_profilerWorkerFactory{
|
||||
|
||||
// The full local profiler.
|
||||
RunWorkerFactory localQmlProfilerFactory {
|
||||
RunWorkerFactory::make<LocalQmlProfilerSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||
{},
|
||||
{ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE}
|
||||
};
|
||||
|
||||
// The bits plugged in in remote setups.
|
||||
RunWorkerFactory qmlProfilerWorkerFactory {
|
||||
RunWorkerFactory::make<QmlProfilerRunner>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUNNER},
|
||||
{},
|
||||
{}
|
||||
};
|
||||
};
|
||||
|
||||
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||
@@ -107,14 +117,6 @@ void QmlProfilerPlugin::extensionsInitialized()
|
||||
d->m_actions.registerActions();
|
||||
|
||||
RunConfiguration::registerAspect<QmlProfilerRunConfigurationAspect>();
|
||||
|
||||
RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
|
||||
[this](RunControl *runControl) {
|
||||
auto runner = new QmlProfilerRunner(runControl);
|
||||
connect(runner, &QmlProfilerRunner::starting,
|
||||
&d->m_profilerTool, &QmlProfilerTool::finalizeRunControl);
|
||||
return runner;
|
||||
});
|
||||
}
|
||||
|
||||
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
|
||||
|
@@ -59,7 +59,7 @@ QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl)
|
||||
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
||||
addStartDependency(slog2InfoRunner);
|
||||
|
||||
m_profiler = runControl->createWorker(runControl->runMode());
|
||||
m_profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER);
|
||||
m_profiler->addStartDependency(this);
|
||||
addStopDependency(m_profiler);
|
||||
}
|
||||
|
@@ -100,15 +100,10 @@ public:
|
||||
supportedRunConfigs,
|
||||
{Constants::GenericLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory qmlProfilerFactory{
|
||||
RunWorkerFactory::make<RemoteLinuxQmlProfilerSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Constants::GenericLinuxOsType}
|
||||
};
|
||||
RunWorkerFactory qmlPreviewFactory{
|
||||
RunWorkerFactory::make<RemoteLinuxQmlPreviewSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
||||
RunWorkerFactory qmlToolingFactory{
|
||||
RunWorkerFactory::make<RemoteLinuxQmlToolingSupport>(),
|
||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
|
||||
ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
||||
supportedRunConfigs,
|
||||
{Constants::GenericLinuxOsType}
|
||||
};
|
||||
|
@@ -25,9 +25,7 @@
|
||||
|
||||
#include "remotelinuxqmltoolingsupport.h"
|
||||
|
||||
#include <ssh/sshconnection.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/url.h>
|
||||
#include <qmldebug/qmldebugcommandlinearguments.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
@@ -35,11 +33,8 @@ using namespace Utils;
|
||||
namespace RemoteLinux {
|
||||
namespace Internal {
|
||||
|
||||
// RemoteLinuxQmlProfilerSupport
|
||||
|
||||
RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(
|
||||
RunControl *runControl, QmlDebug::QmlDebugServicesPreset services)
|
||||
: SimpleTargetRunner(runControl), m_services(services)
|
||||
RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(RunControl *runControl)
|
||||
: SimpleTargetRunner(runControl)
|
||||
{
|
||||
setId("RemoteLinuxQmlToolingSupport");
|
||||
|
||||
@@ -50,7 +45,7 @@ RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(
|
||||
// be started before.
|
||||
addStopDependency(m_portsGatherer);
|
||||
|
||||
m_runworker = runControl->createWorker(runControl->runMode());
|
||||
m_runworker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
|
||||
m_runworker->addStartDependency(this);
|
||||
addStopDependency(m_runworker);
|
||||
}
|
||||
@@ -61,8 +56,11 @@ void RemoteLinuxQmlToolingSupport::start()
|
||||
|
||||
m_runworker->recordData("QmlServerUrl", serverUrl);
|
||||
|
||||
QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl()->runMode());
|
||||
|
||||
Runnable r = runnable();
|
||||
QtcProcess::addArg(&r.commandLineArguments, QmlDebug::qmlDebugTcpArguments(m_services, serverUrl),
|
||||
QtcProcess::addArg(&r.commandLineArguments,
|
||||
QmlDebug::qmlDebugTcpArguments(services, serverUrl),
|
||||
device()->osType());
|
||||
|
||||
setRunnable(r);
|
||||
|
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <qmldebug/qmldebugcommandlinearguments.h>
|
||||
|
||||
namespace RemoteLinux {
|
||||
namespace Internal {
|
||||
@@ -35,31 +34,13 @@ namespace Internal {
|
||||
class RemoteLinuxQmlToolingSupport : public ProjectExplorer::SimpleTargetRunner
|
||||
{
|
||||
public:
|
||||
RemoteLinuxQmlToolingSupport(ProjectExplorer::RunControl *runControl,
|
||||
QmlDebug::QmlDebugServicesPreset services);
|
||||
explicit RemoteLinuxQmlToolingSupport(ProjectExplorer::RunControl *runControl);
|
||||
|
||||
private:
|
||||
void start() override;
|
||||
|
||||
ProjectExplorer::PortsGatherer *m_portsGatherer;
|
||||
ProjectExplorer::RunWorker *m_runworker;
|
||||
QmlDebug::QmlDebugServicesPreset m_services;
|
||||
};
|
||||
|
||||
class RemoteLinuxQmlProfilerSupport : public RemoteLinuxQmlToolingSupport
|
||||
{
|
||||
public:
|
||||
RemoteLinuxQmlProfilerSupport(ProjectExplorer::RunControl *runControl) :
|
||||
RemoteLinuxQmlToolingSupport(runControl, QmlDebug::QmlProfilerServices)
|
||||
{}
|
||||
};
|
||||
|
||||
class RemoteLinuxQmlPreviewSupport : public RemoteLinuxQmlToolingSupport
|
||||
{
|
||||
public:
|
||||
RemoteLinuxQmlPreviewSupport(ProjectExplorer::RunControl *runControl) :
|
||||
RemoteLinuxQmlToolingSupport(runControl, QmlDebug::QmlPreviewServices)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
Reference in New Issue
Block a user