forked from qt-creator/qt-creator
Qnx: Use new RunConfiguration::setRunnableModifier
Simplifies code. Change-Id: I8d1e2e93ae1142b40fef0158de3301aead54fc7b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -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,21 +78,18 @@ 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();
|
||||||
|
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
|
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||||
{
|
|
||||||
Runnable r = RunConfiguration::runnable();
|
|
||||||
QString libPath = aspect<QtLibPathAspect>()->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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// QnxRunConfigurationFactory
|
// QnxRunConfigurationFactory
|
||||||
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user