Qnx: Use new RunConfiguration::setRunnableModifier

Simplifies code.

Change-Id: I8d1e2e93ae1142b40fef0158de3301aead54fc7b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-04-13 09:49:35 +02:00
parent e03af19edc
commit 6ceb2244d8
2 changed files with 12 additions and 26 deletions

View File

@@ -64,7 +64,7 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Utils::Id id)
addAspect<TerminalAspect>(); addAspect<TerminalAspect>();
addAspect<RemoteLinuxEnvironmentAspect>(target); addAspect<RemoteLinuxEnvironmentAspect>(target);
auto libAspect = addAspect<QtLibPathAspect>(); auto libAspect = addAspect<StringAspect>();
libAspect->setSettingsKey("Qt4ProjectManager.QnxRunConfiguration.QtLibPath"); libAspect->setSettingsKey("Qt4ProjectManager.QnxRunConfiguration.QtLibPath");
libAspect->setLabelText(tr("Path to Qt libraries on device")); libAspect->setLabelText(tr("Path to Qt libraries on device"));
libAspect->setDisplayStyle(StringAspect::LineEditDisplay); libAspect->setDisplayStyle(StringAspect::LineEditDisplay);
@@ -78,13 +78,8 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Utils::Id id)
symbolsAspect->setFilePath(localExecutable); symbolsAspect->setFilePath(localExecutable);
}); });
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); setRunnableModifier([libAspect](Runnable &r) {
} QString libPath = libAspect->value();
Runnable QnxRunConfiguration::runnable() const
{
Runnable r = RunConfiguration::runnable();
QString libPath = aspect<QtLibPathAspect>()->value();
if (!libPath.isEmpty()) { if (!libPath.isEmpty()) {
r.environment.appendOrSet("LD_LIBRARY_PATH", libPath + "/lib:$LD_LIBRARY_PATH"); 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("QML_IMPORT_PATH", libPath + "/imports:$QML_IMPORT_PATH");
@@ -92,7 +87,9 @@ Runnable QnxRunConfiguration::runnable() const
r.environment.appendOrSet("QT_PLUGIN_PATH", libPath + "/plugins:$QT_PLUGIN_PATH"); r.environment.appendOrSet("QT_PLUGIN_PATH", libPath + "/plugins:$QT_PLUGIN_PATH");
r.environment.set("QT_QPA_FONTDIR", libPath + "/lib/fonts"); r.environment.set("QT_QPA_FONTDIR", libPath + "/lib/fonts");
} }
return r; });
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
} }
// QnxRunConfigurationFactory // QnxRunConfigurationFactory

View File

@@ -31,23 +31,12 @@
namespace Qnx { namespace Qnx {
namespace Internal { namespace Internal {
class QtLibPathAspect : public Utils::StringAspect
{
Q_OBJECT
public:
QtLibPathAspect() = default;
};
class QnxRunConfiguration final : public ProjectExplorer::RunConfiguration class QnxRunConfiguration final : public ProjectExplorer::RunConfiguration
{ {
Q_OBJECT Q_OBJECT
public: public:
QnxRunConfiguration(ProjectExplorer::Target *target, Utils::Id id); QnxRunConfiguration(ProjectExplorer::Target *target, Utils::Id id);
private:
ProjectExplorer::Runnable runnable() const override;
}; };
class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory