diff --git a/src/plugins/projectexplorer/projectexplorerconstants.h b/src/plugins/projectexplorer/projectexplorerconstants.h index d45837a4752..80ffefcc51f 100644 --- a/src/plugins/projectexplorer/projectexplorerconstants.h +++ b/src/plugins/projectexplorer/projectexplorerconstants.h @@ -178,6 +178,7 @@ const char PERFPROFILER_RUNNER[]="PerfProfiler.Runner"; // RunWorkerFactory const char QML_PROFILER_RUN_FACTORY[] = "RunWorkerFactory.LocalQmlProfilerSupport"; +const char QML_PREVIEW_RUN_FACTORY[] = "RunWorkerFactory.LocalQmlPreviewSupport"; // RunConfig const char QMAKE_RUNCONFIG_ID[] = "Qt4ProjectManager.Qt4RunConfiguration:"; diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp index cdd6388997d..9a011cd2b46 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.cpp @@ -235,9 +235,14 @@ public: LocalQmlPreviewSupportFactory::LocalQmlPreviewSupportFactory() { + setId(ProjectExplorer::Constants::QML_PREVIEW_RUN_FACTORY); setProduct(); addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE); addSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE); + addSupportedRunConfig(ProjectExplorer::Constants::QMAKE_RUNCONFIG_ID); + addSupportedRunConfig(ProjectExplorer::Constants::QBS_RUNCONFIG_ID); + addSupportedRunConfig(ProjectExplorer::Constants::CMAKE_RUNCONFIG_ID); + addSupportedRunConfig(ProjectExplorer::Constants::CUSTOM_EXECUTABLE_RUNCONFIG_ID); } } // QmlPreview diff --git a/src/plugins/qmlpreview/qmlpreviewruncontrol.h b/src/plugins/qmlpreview/qmlpreviewruncontrol.h index d1fbdb88d1c..3c9d859c41b 100644 --- a/src/plugins/qmlpreview/qmlpreviewruncontrol.h +++ b/src/plugins/qmlpreview/qmlpreviewruncontrol.h @@ -5,6 +5,7 @@ #include "qmlpreviewplugin.h" +#include #include namespace QmlPreview { @@ -31,4 +32,17 @@ public: LocalQmlPreviewSupportFactory(); }; +class SimplePreviewRunnerFactory final : public ProjectExplorer::RunWorkerFactory +{ +public: + explicit SimplePreviewRunnerFactory(const QList &runConfigs, const QList &extraRunModes = {}) + { + cloneProduct(ProjectExplorer::Constants::QML_PREVIEW_RUN_FACTORY); + addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE); + for (const Utils::Id &id : extraRunModes) + addSupportedRunMode(id); + setSupportedRunConfigs(runConfigs); + } +}; + } // QmlPreview diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp index c2f9347080d..cd2910ec7fe 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp @@ -42,6 +42,8 @@ #include +#include + #include #include @@ -59,6 +61,7 @@ #include using namespace Core; +using namespace QmlPreview; using namespace QmlProfiler; using namespace Debugger; using namespace ProjectExplorer; @@ -257,6 +260,7 @@ private: static SimpleTargetRunnerFactory runWorkerFactory{{Constants::QML_RUNCONFIG_ID}}; static SimpleQmlProfilerRunnerFactory qmlProfilerRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}}; static SimpleDebugRunnerFactory debugRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}}; + static SimplePreviewRunnerFactory previewRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}}; } void displayQmlLandingPage();