forked from qt-creator/qt-creator
Create RunConfiguration specific QmlPreviewWorkerFactories
Instead of relying on the QmlPreviewRunWorkerFactory to match for all RunConfiguration, every plugin needs to create a WorkerFactory for its own RunConfiguration. Similar to the SimpleTargetRunnerFactory there is now a SimpleQmlPreviewRunnerFactory which makes the setup easy. Change-Id: I350e5a047033a259dae91045486d4f41e7f58994 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -178,6 +178,7 @@ const char PERFPROFILER_RUNNER[]="PerfProfiler.Runner";
|
|||||||
|
|
||||||
// RunWorkerFactory
|
// RunWorkerFactory
|
||||||
const char QML_PROFILER_RUN_FACTORY[] = "RunWorkerFactory.LocalQmlProfilerSupport";
|
const char QML_PROFILER_RUN_FACTORY[] = "RunWorkerFactory.LocalQmlProfilerSupport";
|
||||||
|
const char QML_PREVIEW_RUN_FACTORY[] = "RunWorkerFactory.LocalQmlPreviewSupport";
|
||||||
|
|
||||||
// RunConfig
|
// RunConfig
|
||||||
const char QMAKE_RUNCONFIG_ID[] = "Qt4ProjectManager.Qt4RunConfiguration:";
|
const char QMAKE_RUNCONFIG_ID[] = "Qt4ProjectManager.Qt4RunConfiguration:";
|
||||||
|
@@ -235,9 +235,14 @@ public:
|
|||||||
|
|
||||||
LocalQmlPreviewSupportFactory::LocalQmlPreviewSupportFactory()
|
LocalQmlPreviewSupportFactory::LocalQmlPreviewSupportFactory()
|
||||||
{
|
{
|
||||||
|
setId(ProjectExplorer::Constants::QML_PREVIEW_RUN_FACTORY);
|
||||||
setProduct<LocalQmlPreviewSupport>();
|
setProduct<LocalQmlPreviewSupport>();
|
||||||
addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE);
|
addSupportedRunMode(ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE);
|
||||||
addSupportedDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
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
|
} // QmlPreview
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "qmlpreviewplugin.h"
|
#include "qmlpreviewplugin.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/runconfiguration.h>
|
#include <projectexplorer/runconfiguration.h>
|
||||||
|
|
||||||
namespace QmlPreview {
|
namespace QmlPreview {
|
||||||
@@ -31,4 +32,17 @@ public:
|
|||||||
LocalQmlPreviewSupportFactory();
|
LocalQmlPreviewSupportFactory();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SimplePreviewRunnerFactory final : public ProjectExplorer::RunWorkerFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit SimplePreviewRunnerFactory(const QList<Utils::Id> &runConfigs, const QList<Utils::Id> &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
|
} // QmlPreview
|
||||||
|
@@ -42,6 +42,8 @@
|
|||||||
|
|
||||||
#include <qmljstools/qmljstoolsconstants.h>
|
#include <qmljstools/qmljstoolsconstants.h>
|
||||||
|
|
||||||
|
#include <qmlpreview/qmlpreviewruncontrol.h>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <extensionsystem/pluginspec.h>
|
#include <extensionsystem/pluginspec.h>
|
||||||
|
|
||||||
@@ -59,6 +61,7 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
using namespace QmlPreview;
|
||||||
using namespace QmlProfiler;
|
using namespace QmlProfiler;
|
||||||
using namespace Debugger;
|
using namespace Debugger;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -257,6 +260,7 @@ private:
|
|||||||
static SimpleTargetRunnerFactory runWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
|
static SimpleTargetRunnerFactory runWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
|
||||||
static SimpleQmlProfilerRunnerFactory qmlProfilerRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
|
static SimpleQmlProfilerRunnerFactory qmlProfilerRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
|
||||||
static SimpleDebugRunnerFactory debugRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
|
static SimpleDebugRunnerFactory debugRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
|
||||||
|
static SimplePreviewRunnerFactory previewRunWorkerFactory{{Constants::QML_RUNCONFIG_ID}};
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayQmlLandingPage();
|
void displayQmlLandingPage();
|
||||||
|
Reference in New Issue
Block a user