aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilerplugin.cpp')
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerplugin.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
index e3a2a1aa3f..942ab9344d 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -80,12 +80,34 @@ namespace Internal {
Q_GLOBAL_STATIC(QmlProfilerSettings, qmlProfilerGlobalSettings)
+bool constraint(RunConfiguration *runConfiguration)
+{
+ Target *target = runConfiguration ? runConfiguration->target() : nullptr;
+ Kit *kit = target ? target->kit() : nullptr;
+ return DeviceTypeKitAspect::deviceTypeId(kit)
+ == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
+}
+
+class QmlProfilerRunWorkerFactory : public RunWorkerFactory
+{
+public:
+ QmlProfilerRunWorkerFactory(QmlProfilerTool *tool)
+ {
+ addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
+ setProducer([tool](RunControl *runControl) {
+ return new LocalQmlProfilerSupport(tool, runControl);
+ });
+ addConstraint(constraint);
+ }
+};
+
class QmlProfilerPluginPrivate
{
public:
QmlProfilerTool m_profilerTool;
QmlProfilerOptionsPage m_profilerOptionsPage;
QmlProfilerActions m_actions;
+ QmlProfilerRunWorkerFactory m_profilerWorkerFactory{&m_profilerTool};
};
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
@@ -102,13 +124,6 @@ void QmlProfilerPlugin::extensionsInitialized()
RunConfiguration::registerAspect<QmlProfilerRunConfigurationAspect>();
- auto constraint = [](RunConfiguration *runConfiguration) {
- Target *target = runConfiguration ? runConfiguration->target() : nullptr;
- Kit *kit = target ? target->kit() : nullptr;
- return DeviceTypeKitInformation::deviceTypeId(kit)
- == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
- };
-
RunControl::registerWorkerCreator(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
[this](RunControl *runControl) {
auto runner = new QmlProfilerRunner(runControl);
@@ -116,11 +131,6 @@ void QmlProfilerPlugin::extensionsInitialized()
&d->m_profilerTool, &QmlProfilerTool::finalizeRunControl);
return runner;
});
-
- RunControl::registerWorker(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE,
- [this](ProjectExplorer::RunControl *runControl) {
- return new LocalQmlProfilerSupport(&d->m_profilerTool, runControl);
- }, constraint);
}
ExtensionSystem::IPlugin::ShutdownFlag QmlProfilerPlugin::aboutToShutdown()
@@ -139,9 +149,9 @@ QmlProfilerSettings *QmlProfilerPlugin::globalSettings()
return qmlProfilerGlobalSettings();
}
-QList<QObject *> QmlProfiler::Internal::QmlProfilerPlugin::createTestObjects() const
+QVector<QObject *> QmlProfiler::Internal::QmlProfilerPlugin::createTestObjects() const
{
- QList<QObject *> tests;
+ QVector<QObject *> tests;
#ifdef WITH_TESTS
tests << new DebugMessagesModelTest;
tests << new FlameGraphModelTest;