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
|
#pragma once
|
||||||
|
|
||||||
|
#include <coreplugin/id.h>
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
@@ -85,4 +88,24 @@ inline QString qmlDebugLocalArguments(QmlDebugServicesPreset services, const QSt
|
|||||||
return qmlDebugCommandLineArguments(services, QLatin1String("file:") + socket, block);
|
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
|
} // namespace QmlDebug
|
||||||
|
@@ -40,7 +40,7 @@ AndroidQmlToolingSupport::AndroidQmlToolingSupport(RunControl *runControl,
|
|||||||
auto runner = new AndroidRunner(runControl, intentName);
|
auto runner = new AndroidRunner(runControl, intentName);
|
||||||
addStartDependency(runner);
|
addStartDependency(runner);
|
||||||
|
|
||||||
auto profiler = runControl->createWorker(runControl->runMode());
|
auto profiler = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
|
||||||
profiler->addStartDependency(this);
|
profiler->addStartDependency(this);
|
||||||
|
|
||||||
connect(runner, &AndroidRunner::qmlServerReady, this, [this, profiler](const QUrl &server) {
|
connect(runner, &AndroidRunner::qmlServerReady, this, [this, profiler](const QUrl &server) {
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runcontrol.h>
|
||||||
|
|
||||||
#include <qmldebug/qmldebugcommandlinearguments.h>
|
#include <qmldebug/qmldebugcommandlinearguments.h>
|
||||||
|
|
||||||
|
@@ -200,18 +200,6 @@ void QdbDevice::setupDefaultNetworkSettings(const QString &host)
|
|||||||
setSshParameters(parameters);
|
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
|
// QdbDeviceWizard
|
||||||
|
|
||||||
class QdbSettingsPage : public QWizardPage
|
class QdbSettingsPage : public QWizardPage
|
||||||
|
@@ -52,9 +52,6 @@ public:
|
|||||||
|
|
||||||
void setupDefaultNetworkSettings(const QString &host);
|
void setupDefaultNetworkSettings(const QString &host);
|
||||||
|
|
||||||
std::function<ProjectExplorer::RunWorker *(ProjectExplorer::RunControl *)>
|
|
||||||
workerCreator(Core::Id id) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QdbDevice();
|
QdbDevice();
|
||||||
|
|
||||||
|
@@ -175,17 +175,17 @@ void QdbDeviceDebugSupport::stop()
|
|||||||
|
|
||||||
// QdbDeviceQmlProfilerSupport
|
// QdbDeviceQmlProfilerSupport
|
||||||
|
|
||||||
QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl,
|
QdbDeviceQmlToolingSupport::QdbDeviceQmlToolingSupport(RunControl *runControl)
|
||||||
QmlDebug::QmlDebugServicesPreset services)
|
|
||||||
: RunWorker(runControl)
|
: RunWorker(runControl)
|
||||||
{
|
{
|
||||||
setId("QdbDeviceQmlToolingSupport");
|
setId("QdbDeviceQmlToolingSupport");
|
||||||
|
|
||||||
|
QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl->runMode());
|
||||||
m_runner = new QdbDeviceInferiorRunner(runControl, false, false, true, services);
|
m_runner = new QdbDeviceInferiorRunner(runControl, false, false, true, services);
|
||||||
addStartDependency(m_runner);
|
addStartDependency(m_runner);
|
||||||
addStopDependency(m_runner);
|
addStopDependency(m_runner);
|
||||||
|
|
||||||
m_worker = runControl->createWorker(runControl->runMode());
|
m_worker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
|
||||||
m_worker->addStartDependency(this);
|
m_worker->addStartDependency(this);
|
||||||
addStopDependency(m_worker);
|
addStopDependency(m_worker);
|
||||||
}
|
}
|
||||||
|
@@ -47,8 +47,7 @@ private:
|
|||||||
class QdbDeviceQmlToolingSupport : public ProjectExplorer::RunWorker
|
class QdbDeviceQmlToolingSupport : public ProjectExplorer::RunWorker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QdbDeviceQmlToolingSupport(ProjectExplorer::RunControl *runControl,
|
QdbDeviceQmlToolingSupport(ProjectExplorer::RunControl *runControl);
|
||||||
QmlDebug::QmlDebugServicesPreset services);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void start() override;
|
void start() override;
|
||||||
@@ -57,22 +56,6 @@ private:
|
|||||||
ProjectExplorer::RunWorker *m_worker = nullptr;
|
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
|
class QdbDevicePerfProfilerSupport : public ProjectExplorer::RunWorker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@@ -197,16 +197,17 @@ public:
|
|||||||
supportedRunConfigs,
|
supportedRunConfigs,
|
||||||
{Qdb::Constants::QdbLinuxOsType}
|
{Qdb::Constants::QdbLinuxOsType}
|
||||||
};
|
};
|
||||||
RunWorkerFactory qmlProfilerWorkerFactory{
|
RunWorkerFactory qmlToolWorkerFactory{
|
||||||
RunWorkerFactory::make<QdbDeviceQmlProfilerSupport>(),
|
RunWorkerFactory::make<QdbDeviceQmlToolingSupport>(),
|
||||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
|
||||||
|
ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
||||||
supportedRunConfigs,
|
supportedRunConfigs,
|
||||||
{Qdb::Constants::QdbLinuxOsType}
|
{Qdb::Constants::QdbLinuxOsType}
|
||||||
};
|
};
|
||||||
RunWorkerFactory qmlPreviewWorkerFactory{
|
RunWorkerFactory perfRecorderFactory{
|
||||||
RunWorkerFactory::make<QdbDeviceQmlPreviewSupport>(),
|
RunWorkerFactory::make<QdbDevicePerfProfilerSupport>(),
|
||||||
{ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
{"PerfRecorder"},
|
||||||
supportedRunConfigs,
|
{},
|
||||||
{Qdb::Constants::QdbLinuxOsType}
|
{Qdb::Constants::QdbLinuxOsType}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -395,7 +395,7 @@ IosQmlProfilerSupport::IosQmlProfilerSupport(RunControl *runControl)
|
|||||||
m_runner->setQmlDebugging(QmlDebug::QmlProfilerServices);
|
m_runner->setQmlDebugging(QmlDebug::QmlProfilerServices);
|
||||||
addStartDependency(m_runner);
|
addStartDependency(m_runner);
|
||||||
|
|
||||||
m_profiler = runControl->createWorker(runControl->runMode());
|
m_profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER);
|
||||||
m_profiler->addStartDependency(this);
|
m_profiler->addStartDependency(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,9 +66,6 @@ public:
|
|||||||
PerfProfilerPluginPrivate()
|
PerfProfilerPluginPrivate()
|
||||||
{
|
{
|
||||||
RunConfiguration::registerAspect<PerfRunConfigurationAspect>();
|
RunConfiguration::registerAspect<PerfRunConfigurationAspect>();
|
||||||
|
|
||||||
RunControl::registerWorkerCreator(ProjectExplorer::Constants::PERFPROFILER_RUN_MODE,
|
|
||||||
[](RunControl *runControl){ return new PerfProfilerRunner(runControl); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunWorkerFactory profilerWorkerFactory{
|
RunWorkerFactory profilerWorkerFactory{
|
||||||
|
@@ -185,11 +185,10 @@ PerfProfilerRunner::PerfProfilerRunner(RunControl *runControl)
|
|||||||
// If the parser is gone, there is no point in going on.
|
// If the parser is gone, there is no point in going on.
|
||||||
m_perfParserWorker->setEssential(true);
|
m_perfParserWorker->setEssential(true);
|
||||||
|
|
||||||
if (auto perfRecorder = device()->workerCreator("PerfRecorder")) {
|
if ((m_perfRecordWorker = runControl->createWorker("PerfRecorder"))) {
|
||||||
m_perfRecordWorker = perfRecorder(runControl);
|
|
||||||
|
|
||||||
m_perfParserWorker->addStartDependency(m_perfRecordWorker);
|
m_perfParserWorker->addStartDependency(m_perfRecordWorker);
|
||||||
addStartDependency(m_perfParserWorker);
|
addStartDependency(m_perfParserWorker);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_perfRecordWorker = new LocalPerfRecordWorker(runControl);
|
m_perfRecordWorker = new LocalPerfRecordWorker(runControl);
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
#include "perftimelinemodelmanager.h"
|
#include "perftimelinemodelmanager.h"
|
||||||
|
|
||||||
#include <debugger/debuggermainwindow.h>
|
#include <debugger/debuggermainwindow.h>
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runcontrol.h>
|
||||||
#include <tracing/timelinezoomcontrol.h>
|
#include <tracing/timelinezoomcontrol.h>
|
||||||
#include <utils/fileinprojectfinder.h>
|
#include <utils/fileinprojectfinder.h>
|
||||||
|
|
||||||
|
@@ -267,8 +267,8 @@ public:
|
|||||||
|
|
||||||
m_portGatherer = qobject_cast<PortsGatherer *>(sharedEndpointGatherer);
|
m_portGatherer = qobject_cast<PortsGatherer *>(sharedEndpointGatherer);
|
||||||
if (m_portGatherer) {
|
if (m_portGatherer) {
|
||||||
if (auto creator = device()->workerCreator("ChannelForwarder")) {
|
if (auto forwarder = runControl->createWorker("ChannelForwarder")) {
|
||||||
m_channelForwarder = qobject_cast<ChannelForwarder *>(creator(runControl));
|
m_channelForwarder = qobject_cast<ChannelForwarder *>(forwarder);
|
||||||
if (m_channelForwarder) {
|
if (m_channelForwarder) {
|
||||||
m_channelForwarder->addStartDependency(m_portGatherer);
|
m_channelForwarder->addStartDependency(m_portGatherer);
|
||||||
m_channelForwarder->setFromUrlGetter([this] {
|
m_channelForwarder->setFromUrlGetter([this] {
|
||||||
@@ -338,11 +338,9 @@ ChannelProvider::ChannelProvider(RunControl *runControl, int requiredChannels)
|
|||||||
{
|
{
|
||||||
setId("ChannelProvider");
|
setId("ChannelProvider");
|
||||||
|
|
||||||
RunWorker *sharedEndpoints = nullptr;
|
RunWorker *sharedEndpoints = runControl->createWorker("SharedEndpointGatherer");
|
||||||
if (auto sharedEndpointGatherer = device()->workerCreator("SharedEndpointGatherer")) {
|
if (!sharedEndpoints) {
|
||||||
// null is a legit value indicating 'no need to share'.
|
// null is a legit value indicating 'no need to share'.
|
||||||
sharedEndpoints = sharedEndpointGatherer(runControl);
|
|
||||||
} else {
|
|
||||||
sharedEndpoints = new PortsGatherer(runControl);
|
sharedEndpoints = new PortsGatherer(runControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -60,8 +60,6 @@ class DeviceProcess;
|
|||||||
class DeviceProcessList;
|
class DeviceProcessList;
|
||||||
class Kit;
|
class Kit;
|
||||||
class Runnable;
|
class Runnable;
|
||||||
class RunControl;
|
|
||||||
class RunWorker;
|
|
||||||
|
|
||||||
namespace Internal { class IDevicePrivate; }
|
namespace Internal { class IDevicePrivate; }
|
||||||
|
|
||||||
@@ -182,8 +180,6 @@ public:
|
|||||||
virtual DeviceProcessSignalOperation::Ptr signalOperation() const = 0;
|
virtual DeviceProcessSignalOperation::Ptr signalOperation() const = 0;
|
||||||
virtual DeviceEnvironmentFetcher::Ptr environmentFetcher() const;
|
virtual DeviceEnvironmentFetcher::Ptr environmentFetcher() const;
|
||||||
|
|
||||||
virtual std::function<RunWorker *(RunControl *)> workerCreator(Core::Id) const { return {}; }
|
|
||||||
|
|
||||||
enum DeviceState { DeviceReadyToUse, DeviceConnected, DeviceDisconnected, DeviceStateUnknown };
|
enum DeviceState { DeviceReadyToUse, DeviceConnected, DeviceDisconnected, DeviceStateUnknown };
|
||||||
DeviceState deviceState() const;
|
DeviceState deviceState() const;
|
||||||
void setDeviceState(const DeviceState state);
|
void setDeviceState(const DeviceState state);
|
||||||
|
@@ -198,10 +198,13 @@ const char GENERATOR_ID_PREFIX[] = "PE.Wizard.Generator.";
|
|||||||
// RunMode
|
// RunMode
|
||||||
const char NO_RUN_MODE[]="RunConfiguration.NoRunMode";
|
const char NO_RUN_MODE[]="RunConfiguration.NoRunMode";
|
||||||
const char NORMAL_RUN_MODE[]="RunConfiguration.NormalRunMode";
|
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 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_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
|
// Navigation Widget
|
||||||
const char PROJECTTREE_ID[] = "Projects";
|
const char PROJECTTREE_ID[] = "Projects";
|
||||||
|
@@ -448,32 +448,15 @@ void RunControl::initiateFinish()
|
|||||||
QTimer::singleShot(0, d.get(), &RunControlPrivate::initiateFinish);
|
QTimer::singleShot(0, d.get(), &RunControlPrivate::initiateFinish);
|
||||||
}
|
}
|
||||||
|
|
||||||
using WorkerCreators = QHash<Core::Id, RunControl::WorkerCreator>;
|
RunWorker *RunControl::createWorker(Core::Id workerId)
|
||||||
|
|
||||||
static WorkerCreators &theWorkerCreators()
|
|
||||||
{
|
{
|
||||||
static WorkerCreators creators;
|
const auto check = std::bind(&RunWorkerFactory::canRun,
|
||||||
return creators;
|
std::placeholders::_1,
|
||||||
}
|
workerId,
|
||||||
|
DeviceTypeKitAspect::deviceTypeId(d->kit),
|
||||||
void RunControl::registerWorkerCreator(Core::Id id, const WorkerCreator &workerCreator)
|
QString{});
|
||||||
{
|
RunWorkerFactory *factory = Utils::findOrDefault(g_runWorkerFactories, check);
|
||||||
theWorkerCreators().insert(id, workerCreator);
|
return factory ? factory->producer()(this) : nullptr;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunControl::createMainWorker()
|
bool RunControl::createMainWorker()
|
||||||
|
@@ -251,12 +251,7 @@ public:
|
|||||||
const QString &cancelButtonText = QString(),
|
const QString &cancelButtonText = QString(),
|
||||||
bool *prompt = nullptr);
|
bool *prompt = nullptr);
|
||||||
|
|
||||||
RunWorker *createWorker(Core::Id id);
|
RunWorker *createWorker(Core::Id workerId);
|
||||||
|
|
||||||
using WorkerCreator = RunWorkerFactory::WorkerCreator;
|
|
||||||
using Constraint = std::function<bool(RunConfiguration *)>;
|
|
||||||
|
|
||||||
static void registerWorkerCreator(Core::Id id, const WorkerCreator &workerCreator);
|
|
||||||
|
|
||||||
bool createMainWorker();
|
bool createMainWorker();
|
||||||
static bool canRun(Core::Id runMode, Core::Id deviceType, Core::Id runConfigId);
|
static bool canRun(Core::Id runMode, Core::Id deviceType, Core::Id runConfigId);
|
||||||
|
@@ -142,7 +142,40 @@ public:
|
|||||||
float m_zoomFactor = -1.0;
|
float m_zoomFactor = -1.0;
|
||||||
QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr;
|
QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr;
|
||||||
QString m_locale;
|
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)
|
QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
|
||||||
@@ -152,13 +185,6 @@ QmlPreviewPluginPrivate::QmlPreviewPluginPrivate(QmlPreviewPlugin *parent)
|
|||||||
m_fileClassifer = &defaultFileClassifier;
|
m_fileClassifer = &defaultFileClassifier;
|
||||||
m_fpsHandler = &defaultFpsHandler;
|
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(
|
Core::ActionContainer *menu = Core::ActionManager::actionContainer(
|
||||||
Constants::M_BUILDPROJECT);
|
Constants::M_BUILDPROJECT);
|
||||||
QAction *action = new QAction(QmlPreviewPlugin::tr("QML Preview"), this);
|
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(q, &QmlPreviewPlugin::previewedFileChanged, this, &QmlPreviewPluginPrivate::checkFile);
|
||||||
connect(parser, &QmlPreviewParser::success, this, &QmlPreviewPluginPrivate::triggerPreview);
|
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();
|
attachToEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,12 +86,22 @@ public:
|
|||||||
QmlProfilerTool m_profilerTool;
|
QmlProfilerTool m_profilerTool;
|
||||||
QmlProfilerOptionsPage m_profilerOptionsPage;
|
QmlProfilerOptionsPage m_profilerOptionsPage;
|
||||||
QmlProfilerActions m_actions;
|
QmlProfilerActions m_actions;
|
||||||
RunWorkerFactory m_profilerWorkerFactory{
|
|
||||||
|
// The full local profiler.
|
||||||
|
RunWorkerFactory localQmlProfilerFactory {
|
||||||
RunWorkerFactory::make<LocalQmlProfilerSupport>(),
|
RunWorkerFactory::make<LocalQmlProfilerSupport>(),
|
||||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
||||||
{},
|
{},
|
||||||
{ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE}
|
{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)
|
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
|
||||||
@@ -107,14 +117,6 @@ void QmlProfilerPlugin::extensionsInitialized()
|
|||||||
d->m_actions.registerActions();
|
d->m_actions.registerActions();
|
||||||
|
|
||||||
RunConfiguration::registerAspect<QmlProfilerRunConfigurationAspect>();
|
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()
|
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
|
||||||
|
@@ -59,7 +59,7 @@ QnxQmlProfilerSupport::QnxQmlProfilerSupport(RunControl *runControl)
|
|||||||
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
auto slog2InfoRunner = new Slog2InfoRunner(runControl);
|
||||||
addStartDependency(slog2InfoRunner);
|
addStartDependency(slog2InfoRunner);
|
||||||
|
|
||||||
m_profiler = runControl->createWorker(runControl->runMode());
|
m_profiler = runControl->createWorker(ProjectExplorer::Constants::QML_PROFILER_RUNNER);
|
||||||
m_profiler->addStartDependency(this);
|
m_profiler->addStartDependency(this);
|
||||||
addStopDependency(m_profiler);
|
addStopDependency(m_profiler);
|
||||||
}
|
}
|
||||||
|
@@ -100,15 +100,10 @@ public:
|
|||||||
supportedRunConfigs,
|
supportedRunConfigs,
|
||||||
{Constants::GenericLinuxOsType}
|
{Constants::GenericLinuxOsType}
|
||||||
};
|
};
|
||||||
RunWorkerFactory qmlProfilerFactory{
|
RunWorkerFactory qmlToolingFactory{
|
||||||
RunWorkerFactory::make<RemoteLinuxQmlProfilerSupport>(),
|
RunWorkerFactory::make<RemoteLinuxQmlToolingSupport>(),
|
||||||
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
|
{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
|
||||||
supportedRunConfigs,
|
ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
||||||
{Constants::GenericLinuxOsType}
|
|
||||||
};
|
|
||||||
RunWorkerFactory qmlPreviewFactory{
|
|
||||||
RunWorkerFactory::make<RemoteLinuxQmlPreviewSupport>(),
|
|
||||||
{ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
|
|
||||||
supportedRunConfigs,
|
supportedRunConfigs,
|
||||||
{Constants::GenericLinuxOsType}
|
{Constants::GenericLinuxOsType}
|
||||||
};
|
};
|
||||||
|
@@ -25,9 +25,7 @@
|
|||||||
|
|
||||||
#include "remotelinuxqmltoolingsupport.h"
|
#include "remotelinuxqmltoolingsupport.h"
|
||||||
|
|
||||||
#include <ssh/sshconnection.h>
|
#include <qmldebug/qmldebugcommandlinearguments.h>
|
||||||
#include <utils/qtcprocess.h>
|
|
||||||
#include <utils/url.h>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -35,11 +33,8 @@ using namespace Utils;
|
|||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
// RemoteLinuxQmlProfilerSupport
|
RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(RunControl *runControl)
|
||||||
|
: SimpleTargetRunner(runControl)
|
||||||
RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(
|
|
||||||
RunControl *runControl, QmlDebug::QmlDebugServicesPreset services)
|
|
||||||
: SimpleTargetRunner(runControl), m_services(services)
|
|
||||||
{
|
{
|
||||||
setId("RemoteLinuxQmlToolingSupport");
|
setId("RemoteLinuxQmlToolingSupport");
|
||||||
|
|
||||||
@@ -50,7 +45,7 @@ RemoteLinuxQmlToolingSupport::RemoteLinuxQmlToolingSupport(
|
|||||||
// be started before.
|
// be started before.
|
||||||
addStopDependency(m_portsGatherer);
|
addStopDependency(m_portsGatherer);
|
||||||
|
|
||||||
m_runworker = runControl->createWorker(runControl->runMode());
|
m_runworker = runControl->createWorker(QmlDebug::runnerIdForRunMode(runControl->runMode()));
|
||||||
m_runworker->addStartDependency(this);
|
m_runworker->addStartDependency(this);
|
||||||
addStopDependency(m_runworker);
|
addStopDependency(m_runworker);
|
||||||
}
|
}
|
||||||
@@ -61,8 +56,11 @@ void RemoteLinuxQmlToolingSupport::start()
|
|||||||
|
|
||||||
m_runworker->recordData("QmlServerUrl", serverUrl);
|
m_runworker->recordData("QmlServerUrl", serverUrl);
|
||||||
|
|
||||||
|
QmlDebug::QmlDebugServicesPreset services = QmlDebug::servicesForRunMode(runControl()->runMode());
|
||||||
|
|
||||||
Runnable r = runnable();
|
Runnable r = runnable();
|
||||||
QtcProcess::addArg(&r.commandLineArguments, QmlDebug::qmlDebugTcpArguments(m_services, serverUrl),
|
QtcProcess::addArg(&r.commandLineArguments,
|
||||||
|
QmlDebug::qmlDebugTcpArguments(services, serverUrl),
|
||||||
device()->osType());
|
device()->osType());
|
||||||
|
|
||||||
setRunnable(r);
|
setRunnable(r);
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
#include <projectexplorer/devicesupport/deviceusedportsgatherer.h>
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
#include <qmldebug/qmldebugcommandlinearguments.h>
|
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -35,31 +34,13 @@ namespace Internal {
|
|||||||
class RemoteLinuxQmlToolingSupport : public ProjectExplorer::SimpleTargetRunner
|
class RemoteLinuxQmlToolingSupport : public ProjectExplorer::SimpleTargetRunner
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RemoteLinuxQmlToolingSupport(ProjectExplorer::RunControl *runControl,
|
explicit RemoteLinuxQmlToolingSupport(ProjectExplorer::RunControl *runControl);
|
||||||
QmlDebug::QmlDebugServicesPreset services);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void start() override;
|
void start() override;
|
||||||
|
|
||||||
ProjectExplorer::PortsGatherer *m_portsGatherer;
|
ProjectExplorer::PortsGatherer *m_portsGatherer;
|
||||||
ProjectExplorer::RunWorker *m_runworker;
|
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
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user