diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp index c60d8f15e6f..e55ae38d764 100644 --- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp @@ -56,17 +56,14 @@ class QmlProfilerPluginPrivate { public: QmlProfilerTool m_profilerTool; - - // The full local profiler. - LocalQmlProfilerRunWorkerFactory localQmlProfilerRunWorkerFactory; - // The bits plugged in in remote setups. - QmlProfilerRunWorkerFactory qmlProfilerRunWorkerFactory; }; bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString) { Q_UNUSED(arguments) + setupQmlProfilerRunning(); + #ifdef WITH_TESTS addTest(); addTest(); diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 1fc8f83bd03..4d04aea2900 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -239,18 +239,33 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const Q // Factories // The bits plugged in in remote setups. -QmlProfilerRunWorkerFactory::QmlProfilerRunWorkerFactory() +class QmlProfilerRunWorkerFactory final : public RunWorkerFactory { - setProduct(); - addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUNNER); -} +public: + QmlProfilerRunWorkerFactory() + { + setProduct(); + addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUNNER); + } +}; // The full local profiler. -LocalQmlProfilerRunWorkerFactory::LocalQmlProfilerRunWorkerFactory() +class LocalQmlProfilerRunWorkerFactory final : public RunWorkerFactory { - setProduct(); - addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); - addSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); +public: + LocalQmlProfilerRunWorkerFactory() + { + setProduct(); + addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); + addSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); + } +}; + +void setupQmlProfilerRunning() +{ + static QmlProfilerRunWorkerFactory theQmlProfilerRunWorkerFactory; + static LocalQmlProfilerRunWorkerFactory theLocalQmlProfilerRunWorkerFactory; } + } // QmlProfiler::Internal diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h index f23e59666e1..4dbbdf6600c 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h @@ -50,18 +50,6 @@ public: const QUrl &serverUrl); }; -// The bits plugged in in remote setups. -class QmlProfilerRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory -{ -public: - QmlProfilerRunWorkerFactory(); -}; - -// The full local profiler. -class LocalQmlProfilerRunWorkerFactory final : public ProjectExplorer::RunWorkerFactory -{ -public: - LocalQmlProfilerRunWorkerFactory(); -}; +void setupQmlProfilerRunning(); } // QmlProfiler::Internal