ProjectExplorer: Reduce use of Runnable in SimpleTargetRunner

Runnable functionality is nowadays mostly accessed more directly
in QtcProcess and its setup functions.

Change-Id: I2a2b5433aef1d464dc58d5a35069376dee051d57
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
hjk
2022-05-23 16:09:43 +02:00
parent ae42604904
commit f79a71df7b
13 changed files with 123 additions and 110 deletions

View File

@@ -41,6 +41,8 @@
#include <utils/url.h>
#include <utils/fileutils.h>
using namespace Utils;
namespace QmlPreview {
static const QString QmlServerUrl = "QmlServerUrl";
@@ -126,9 +128,10 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC
addStopDependency(preview);
addStartDependency(preview);
setStarter([this, runControl, serverUrl] {
ProjectExplorer::Runnable runnable = runControl->runnable();
QStringList qmlProjectRunConfigurationArguments = runnable.command.splitArguments();
setStartModifier([this, runControl, serverUrl] {
CommandLine cmd = commandLine();
QStringList qmlProjectRunConfigurationArguments = cmd.splitArguments();
const auto currentTarget = runControl->target();
const auto *qmlBuildSystem = qobject_cast<QmlProjectManager::QmlBuildSystem *>(currentTarget->buildSystem());
@@ -142,15 +145,15 @@ LocalQmlPreviewSupport::LocalQmlPreviewSupport(ProjectExplorer::RunControl *runC
if (!currentFile.isEmpty() && qmlProjectRunConfigurationArguments.last().contains(mainScriptFromProject)) {
qmlProjectRunConfigurationArguments.removeLast();
runnable.command = Utils::CommandLine(runnable.command.executable(), qmlProjectRunConfigurationArguments);
runnable.command.addArg(currentFile);
cmd = Utils::CommandLine(cmd.executable(), qmlProjectRunConfigurationArguments);
cmd.addArg(currentFile);
}
}
runnable.command.addArg(QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlPreviewServices,
serverUrl.path()));
runnable.device.reset();
doStart(runnable);
cmd.addArg(QmlDebug::qmlDebugLocalArguments(QmlDebug::QmlPreviewServices, serverUrl.path()));
setCommandLine(cmd);
forceRunOnHost();
});
}