Create RunConfiguration specific QmlProfilerWorkerFactories

Instead of relying on the QmlProfilerRunWorkerFactory to match for all
RunConfiguration, every plugin needs to create a WorkerFactory for
its own RunConfiguration.

Similar to the SimpleTargetRunnerFactory there is now a
SimpleQmlProfilerRunnerFactory which makes the setup easy.

Change-Id: I504ca5afe232cb4e3aa0bb0b67271637a7e7a9d0
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Dominik Holland
2024-01-17 10:25:21 +01:00
parent fca33684a7
commit 1d2ed65d93
4 changed files with 29 additions and 1 deletions

View File

@@ -176,6 +176,9 @@ const char QML_PREVIEW_RUNNER[]="RunConfiguration.QmlPreviewRunner";
const char PERFPROFILER_RUN_MODE[]="PerfProfiler.RunMode"; const char PERFPROFILER_RUN_MODE[]="PerfProfiler.RunMode";
const char PERFPROFILER_RUNNER[]="PerfProfiler.Runner"; const char PERFPROFILER_RUNNER[]="PerfProfiler.Runner";
// RunWorkerFactory
const char QML_PROFILER_RUN_FACTORY[] = "RunWorkerFactory.LocalQmlProfilerSupport";
// RunConfig // RunConfig
const char QMAKE_RUNCONFIG_ID[] = "Qt4ProjectManager.Qt4RunConfiguration:"; const char QMAKE_RUNCONFIG_ID[] = "Qt4ProjectManager.Qt4RunConfiguration:";
const char QBS_RUNCONFIG_ID[] = "Qbs.RunConfiguration:"; const char QBS_RUNCONFIG_ID[] = "Qbs.RunConfiguration:";

View File

@@ -255,9 +255,13 @@ class LocalQmlProfilerRunWorkerFactory final : public RunWorkerFactory
public: public:
LocalQmlProfilerRunWorkerFactory() LocalQmlProfilerRunWorkerFactory()
{ {
setId(ProjectExplorer::Constants::QML_PROFILER_RUN_FACTORY);
setProduct<LocalQmlProfilerSupport>(); setProduct<LocalQmlProfilerSupport>();
addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE); addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_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);
} }
}; };

View File

@@ -6,13 +6,15 @@
#include "qmlprofilerstatemanager.h" #include "qmlprofilerstatemanager.h"
#include <projectexplorer/runcontrol.h> #include <projectexplorer/runcontrol.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <utils/outputformat.h> #include <utils/outputformat.h>
#include <utils/port.h> #include <utils/port.h>
#include <qmldebug/qmloutputparser.h> #include <qmldebug/qmloutputparser.h>
namespace QmlProfiler::Internal { namespace QmlProfiler {
namespace Internal {
class QmlProfilerRunner : public ProjectExplorer::RunWorker class QmlProfilerRunner : public ProjectExplorer::RunWorker
{ {
@@ -53,3 +55,18 @@ public:
void setupQmlProfilerRunning(); void setupQmlProfilerRunning();
} // QmlProfiler::Internal } // QmlProfiler::Internal
class SimpleQmlProfilerRunnerFactory final : public ProjectExplorer::RunWorkerFactory
{
public:
explicit SimpleQmlProfilerRunnerFactory(const QList<Utils::Id> &runConfigs, const QList<Utils::Id> &extraRunModes = {})
{
cloneProduct(ProjectExplorer::Constants::QML_PROFILER_RUN_FACTORY);
addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
for (const Utils::Id &id : extraRunModes)
addSupportedRunMode(id);
setSupportedRunConfigs(runConfigs);
}
};
} // QmlProfiler

View File

@@ -33,6 +33,8 @@
#include <projectexplorer/projectmanager.h> #include <projectexplorer/projectmanager.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qmlprofiler/qmlprofilerruncontrol.h>
#include <qmljs/qmljsmodelmanagerinterface.h> #include <qmljs/qmljsmodelmanagerinterface.h>
#include <qmljseditor/qmljseditor.h> #include <qmljseditor/qmljseditor.h>
@@ -57,6 +59,7 @@
#include <QTimer> #include <QTimer>
using namespace Core; using namespace Core;
using namespace QmlProfiler;
using namespace Debugger; using namespace Debugger;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
@@ -101,6 +104,7 @@ public:
QmlProjectRunConfigurationFactory runConfigFactory; QmlProjectRunConfigurationFactory runConfigFactory;
SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}}; SimpleTargetRunnerFactory runWorkerFactory{{runConfigFactory.runConfigurationId()}};
SimpleDebugRunnerFactory debugRunWorkerFactory{{runConfigFactory.runConfigurationId()}}; SimpleDebugRunnerFactory debugRunWorkerFactory{{runConfigFactory.runConfigurationId()}};
SimpleQmlProfilerRunnerFactory qmlProfilerRunWorkerFactory{{runConfigFactory.runConfigurationId()}};
QPointer<QMessageBox> lastMessageBox; QPointer<QMessageBox> lastMessageBox;
QdsLandingPage *landingPage = nullptr; QdsLandingPage *landingPage = nullptr;
QdsLandingPageWidget *landingPageWidget = nullptr; QdsLandingPageWidget *landingPageWidget = nullptr;