From 6ceb2244d82bcddc607d5272f41448da4f0bcb0a Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 13 Apr 2021 09:49:35 +0200 Subject: [PATCH] Qnx: Use new RunConfiguration::setRunnableModifier Simplifies code. Change-Id: I8d1e2e93ae1142b40fef0158de3301aead54fc7b Reviewed-by: Christian Kandeler --- src/plugins/qnx/qnxrunconfiguration.cpp | 27 +++++++++++-------------- src/plugins/qnx/qnxrunconfiguration.h | 11 ---------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/plugins/qnx/qnxrunconfiguration.cpp b/src/plugins/qnx/qnxrunconfiguration.cpp index c8735c177b0..02f61894b71 100644 --- a/src/plugins/qnx/qnxrunconfiguration.cpp +++ b/src/plugins/qnx/qnxrunconfiguration.cpp @@ -64,7 +64,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Utils::Id id) addAspect(); addAspect(target); - auto libAspect = addAspect(); + auto libAspect = addAspect(); libAspect->setSettingsKey("Qt4ProjectManager.QnxRunConfiguration.QtLibPath"); libAspect->setLabelText(tr("Path to Qt libraries on device")); libAspect->setDisplayStyle(StringAspect::LineEditDisplay); @@ -78,21 +78,18 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Utils::Id id) symbolsAspect->setFilePath(localExecutable); }); - connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); -} + setRunnableModifier([libAspect](Runnable &r) { + QString libPath = libAspect->value(); + if (!libPath.isEmpty()) { + r.environment.appendOrSet("LD_LIBRARY_PATH", libPath + "/lib:$LD_LIBRARY_PATH"); + r.environment.appendOrSet("QML_IMPORT_PATH", libPath + "/imports:$QML_IMPORT_PATH"); + r.environment.appendOrSet("QML2_IMPORT_PATH", libPath + "/qml:$QML2_IMPORT_PATH"); + r.environment.appendOrSet("QT_PLUGIN_PATH", libPath + "/plugins:$QT_PLUGIN_PATH"); + r.environment.set("QT_QPA_FONTDIR", libPath + "/lib/fonts"); + } + }); -Runnable QnxRunConfiguration::runnable() const -{ - Runnable r = RunConfiguration::runnable(); - QString libPath = aspect()->value(); - if (!libPath.isEmpty()) { - r.environment.appendOrSet("LD_LIBRARY_PATH", libPath + "/lib:$LD_LIBRARY_PATH"); - r.environment.appendOrSet("QML_IMPORT_PATH", libPath + "/imports:$QML_IMPORT_PATH"); - r.environment.appendOrSet("QML2_IMPORT_PATH", libPath + "/qml:$QML2_IMPORT_PATH"); - r.environment.appendOrSet("QT_PLUGIN_PATH", libPath + "/plugins:$QT_PLUGIN_PATH"); - r.environment.set("QT_QPA_FONTDIR", libPath + "/lib/fonts"); - } - return r; + connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); } // QnxRunConfigurationFactory diff --git a/src/plugins/qnx/qnxrunconfiguration.h b/src/plugins/qnx/qnxrunconfiguration.h index e56d00fe343..2f52bc930d6 100644 --- a/src/plugins/qnx/qnxrunconfiguration.h +++ b/src/plugins/qnx/qnxrunconfiguration.h @@ -31,23 +31,12 @@ namespace Qnx { namespace Internal { -class QtLibPathAspect : public Utils::StringAspect -{ - Q_OBJECT - -public: - QtLibPathAspect() = default; -}; - class QnxRunConfiguration final : public ProjectExplorer::RunConfiguration { Q_OBJECT public: QnxRunConfiguration(ProjectExplorer::Target *target, Utils::Id id); - -private: - ProjectExplorer::Runnable runnable() const override; }; class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory