diff options
author | hjk <hjk@qt.io> | 2019-03-20 11:40:53 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-03-20 14:06:42 +0000 |
commit | 00eae6f204761ff5d551bc421af3d7fa59c4b980 (patch) | |
tree | b6928c201f18b1e322af84a75e7e7bb904e38faf /src/plugins/android/androidplugin.cpp | |
parent | 9dac0766503ec3fc6b8283f90149956c7e06cab2 (diff) |
ProjectExplorer: Replace one overload of RunControl::registerWorker
... by using factory members in the plugin pimpl. This also
(intentionally) transfers ownership of the factories to the
plugins, effectively progressing on the "FIXME:"
in runcontrol.h:164.
Change-Id: Ia75ee034d25a75b5d5bff6b2fa2b3471347d1a14
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/android/androidplugin.cpp')
-rw-r--r-- | src/plugins/android/androidplugin.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp index 607a29e7cac..27b3ae99bc3 100644 --- a/src/plugins/android/androidplugin.cpp +++ b/src/plugins/android/androidplugin.cpp @@ -88,6 +88,25 @@ public: } }; +class QmlPreviewRunWorkerFactory : public RunWorkerFactory +{ +public: + QmlPreviewRunWorkerFactory() + { + addSupportedRunMode(QML_PREVIEW_RUN_MODE); + setProducer([](RunControl *runControl) -> RunWorker * { + const Runnable runnable = runControl->runConfiguration()->runnable(); + return new AndroidQmlToolingSupport(runControl, runnable.executable); + }); + addConstraint([](RunConfiguration *runConfig) { + return runConfig->isEnabled() + && runConfig->id().name().startsWith("QmlProjectManager.QmlRunConfiguration") + && DeviceTypeKitAspect::deviceTypeId(runConfig->target()->kit()) + == Android::Constants::ANDROID_DEVICE_TYPE; + }); + } +}; + class AndroidPluginPrivate : public QObject { public: @@ -131,6 +150,7 @@ public: AndroidPackageInstallationFactory packackeInstallationFactory; AndroidManifestEditorFactory manifestEditorFactory; AndroidRunConfigurationFactory runConfigFactory; + SimpleRunWorkerFactory<AndroidRunConfiguration, AndroidRunSupport> runWorkerFactory; SimpleRunWorkerFactory<AndroidRunConfiguration, AndroidDebugSupport> debugWorkerFactory{DEBUG_RUN_MODE}; @@ -138,6 +158,8 @@ public: profilerWorkerFactory{QML_PROFILER_RUN_MODE}; SimpleRunWorkerFactory<AndroidRunConfiguration, AndroidQmlToolingSupport> qmlPreviewWorkerFactory{QML_PREVIEW_RUN_MODE}; + QmlPreviewRunWorkerFactory qmlPreviewWorkerFactory2; + AndroidBuildApkStepFactory buildApkStepFactory; AndroidGdbServerKitAspect gdbServerKitAspect; }; @@ -152,16 +174,6 @@ bool AndroidPlugin::initialize(const QStringList &arguments, QString *errorMessa Q_UNUSED(arguments); Q_UNUSED(errorMessage); - RunControl::registerWorker(QML_PREVIEW_RUN_MODE, [](RunControl *runControl) -> RunWorker* { - const Runnable runnable = runControl->runConfiguration()->runnable(); - return new AndroidQmlToolingSupport(runControl, runnable.executable); - }, [](RunConfiguration *runConfig) { - return runConfig->isEnabled() - && runConfig->id().name().startsWith("QmlProjectManager.QmlRunConfiguration") - && DeviceTypeKitAspect::deviceTypeId(runConfig->target()->kit()) - == Android::Constants::ANDROID_DEVICE_TYPE; - }); - d = new AndroidPluginPrivate; connect(KitManager::instance(), &KitManager::kitsLoaded, |