forked from qt-creator/qt-creator
Qnx: Use Aspects more directly in QnxRunConfiguration
Change-Id: I450144e91842792cc5841b2fb61e8fc39b0daa1e Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -28,46 +28,38 @@ public:
|
|||||||
QnxRunConfiguration(Target *target, Id id)
|
QnxRunConfiguration(Target *target, Id id)
|
||||||
: RunConfiguration(target, id)
|
: RunConfiguration(target, id)
|
||||||
{
|
{
|
||||||
auto exeAspect = addAspect<ExecutableAspect>();
|
executable.setDeviceSelector(target, ExecutableAspect::RunDevice);
|
||||||
exeAspect->setDeviceSelector(target, ExecutableAspect::RunDevice);
|
executable.setLabelText(Tr::tr("Executable on device:"));
|
||||||
exeAspect->setLabelText(Tr::tr("Executable on device:"));
|
executable.setPlaceHolderText(Tr::tr("Remote path not set"));
|
||||||
exeAspect->setPlaceHolderText(Tr::tr("Remote path not set"));
|
executable.makeOverridable("RemoteLinux.RunConfig.AlternateRemoteExecutable",
|
||||||
exeAspect->makeOverridable("RemoteLinux.RunConfig.AlternateRemoteExecutable",
|
|
||||||
"RemoteLinux.RunConfig.UseAlternateRemoteExecutable");
|
"RemoteLinux.RunConfig.UseAlternateRemoteExecutable");
|
||||||
exeAspect->setHistoryCompleter("RemoteLinux.AlternateExecutable.History");
|
executable.setHistoryCompleter("RemoteLinux.AlternateExecutable.History");
|
||||||
|
|
||||||
auto symbolsAspect = addAspect<SymbolFileAspect>();
|
symbolFile.setLabelText(Tr::tr("Executable on host:"));
|
||||||
symbolsAspect->setLabelText(Tr::tr("Executable on host:"));
|
symbolFile.setDisplayStyle(SymbolFileAspect::LabelDisplay);
|
||||||
symbolsAspect->setDisplayStyle(SymbolFileAspect::LabelDisplay);
|
|
||||||
|
|
||||||
auto envAspect = addAspect<RemoteLinuxEnvironmentAspect>();
|
environment.setDeviceSelector(target, EnvironmentAspect::RunDevice);
|
||||||
envAspect->setDeviceSelector(target, EnvironmentAspect::RunDevice);
|
|
||||||
|
|
||||||
auto argsAspect = addAspect<ArgumentsAspect>();
|
arguments.setMacroExpander(macroExpander());
|
||||||
argsAspect->setMacroExpander(macroExpander());
|
|
||||||
|
|
||||||
auto workingDirAspect = addAspect<WorkingDirectoryAspect>();
|
workingDir.setMacroExpander(macroExpander());
|
||||||
workingDirAspect->setMacroExpander(macroExpander());
|
workingDir.setEnvironment(&environment);
|
||||||
workingDirAspect->setEnvironment(envAspect);
|
|
||||||
|
|
||||||
addAspect<TerminalAspect>();
|
qtLibraries.setSettingsKey("Qt4ProjectManager.QnxRunConfiguration.QtLibPath");
|
||||||
|
qtLibraries.setLabelText(Tr::tr("Path to Qt libraries on device"));
|
||||||
|
qtLibraries.setDisplayStyle(StringAspect::LineEditDisplay);
|
||||||
|
|
||||||
auto libAspect = addAspect<StringAspect>();
|
setUpdater([this, target] {
|
||||||
libAspect->setSettingsKey("Qt4ProjectManager.QnxRunConfiguration.QtLibPath");
|
|
||||||
libAspect->setLabelText(Tr::tr("Path to Qt libraries on device"));
|
|
||||||
libAspect->setDisplayStyle(StringAspect::LineEditDisplay);
|
|
||||||
|
|
||||||
setUpdater([this, target, exeAspect, symbolsAspect] {
|
|
||||||
const BuildTargetInfo bti = buildTargetInfo();
|
const BuildTargetInfo bti = buildTargetInfo();
|
||||||
const FilePath localExecutable = bti.targetFilePath;
|
const FilePath localExecutable = bti.targetFilePath;
|
||||||
const DeployableFile depFile = target->deploymentData()
|
const DeployableFile depFile = target->deploymentData()
|
||||||
.deployableForLocalFile(localExecutable);
|
.deployableForLocalFile(localExecutable);
|
||||||
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
executable.setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||||
symbolsAspect->setValue(localExecutable);
|
symbolFile.setValue(localExecutable);
|
||||||
});
|
});
|
||||||
|
|
||||||
setRunnableModifier([libAspect](Runnable &r) {
|
setRunnableModifier([this](Runnable &r) {
|
||||||
QString libPath = libAspect->value();
|
QString libPath = qtLibraries();
|
||||||
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");
|
||||||
@@ -79,6 +71,14 @@ public:
|
|||||||
|
|
||||||
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecutableAspect executable{this};
|
||||||
|
SymbolFileAspect symbolFile{this};
|
||||||
|
RemoteLinuxEnvironmentAspect environment{this};
|
||||||
|
ArgumentsAspect arguments{this};
|
||||||
|
WorkingDirectoryAspect workingDir{this};
|
||||||
|
TerminalAspect terminal{this};
|
||||||
|
StringAspect qtLibraries{this};
|
||||||
};
|
};
|
||||||
|
|
||||||
// QnxRunConfigurationFactory
|
// QnxRunConfigurationFactory
|
||||||
|
Reference in New Issue
Block a user