diff options
author | hjk <hjk@qt.io> | 2019-08-05 14:43:17 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-08-06 08:31:47 +0000 |
commit | eefabf2b11bdecb572aa062d47c5245621ac5a12 (patch) | |
tree | bb497216a45def0ae26b8a444838c9be1c41663a /src/plugins/qnx | |
parent | ac091622e4a790fc07d6f9c7e354e6933b0a69c9 (diff) |
Qnx: Remove RemoteLinuxRunConfiguration base from QnxRunConfiguration
Also un-export RemoteLinuxRunConfiguration and make it clear that
this is not meant for inheritnace.
For a while the last code-reuse-by-inheritance RunConfiguration,
until it served as precedence again. Raise the bar a bit, even
if this means duplicating some aspect setup lines.
Change-Id: I588e07e3f7ddbe3cae089a37059781a9f71048e1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/qnx')
-rw-r--r-- | src/plugins/qnx/qnxrunconfiguration.cpp | 48 | ||||
-rw-r--r-- | src/plugins/qnx/qnxrunconfiguration.h | 4 |
2 files changed, 48 insertions, 4 deletions
diff --git a/src/plugins/qnx/qnxrunconfiguration.cpp b/src/plugins/qnx/qnxrunconfiguration.cpp index d098daabb8..fdc620aeb9 100644 --- a/src/plugins/qnx/qnxrunconfiguration.cpp +++ b/src/plugins/qnx/qnxrunconfiguration.cpp @@ -27,26 +27,70 @@ #include "qnxconstants.h" +#include <projectexplorer/deployablefile.h> +#include <projectexplorer/project.h> #include <projectexplorer/runcontrol.h> +#include <projectexplorer/target.h> + +#include <remotelinux/remotelinuxenvironmentaspect.h> + +#include <qtsupport/qtoutputformatter.h> using namespace ProjectExplorer; using namespace RemoteLinux; +using namespace Utils; namespace Qnx { namespace Internal { QnxRunConfiguration::QnxRunConfiguration(Target *target, Core::Id id) - : RemoteLinuxRunConfiguration(target, id) + : RunConfiguration(target, id) { + auto exeAspect = addAspect<ExecutableAspect>(); + exeAspect->setLabelText(tr("Executable on device:")); + exeAspect->setExecutablePathStyle(OsTypeLinux); + exeAspect->setPlaceHolderText(tr("Remote path not set")); + exeAspect->makeOverridable("RemoteLinux.RunConfig.AlternateRemoteExecutable", + "RemoteLinux.RunConfig.UseAlternateRemoteExecutable"); + exeAspect->setHistoryCompleter("RemoteLinux.AlternateExecutable.History"); + + auto symbolsAspect = addAspect<SymbolFileAspect>(); + symbolsAspect->setLabelText(tr("Executable on host:")); + symbolsAspect->setDisplayStyle(SymbolFileAspect::LabelDisplay); + + addAspect<ArgumentsAspect>(); + addAspect<WorkingDirectoryAspect>(); + addAspect<TerminalAspect>(); + addAspect<RemoteLinuxEnvironmentAspect>(target); + auto libAspect = addAspect<QtLibPathAspect>(); libAspect->setSettingsKey("Qt4ProjectManager.QnxRunConfiguration.QtLibPath"); libAspect->setLabelText(tr("Path to Qt libraries on device")); libAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay); + + setOutputFormatter<QtSupport::QtOutputFormatter>(); + + auto updateTargetInformation = [this, target, exeAspect, symbolsAspect] { + + BuildTargetInfo bti = buildTargetInfo(); + QString localExecutable = bti.targetFilePath.toString(); + DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable); + + exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath())); + symbolsAspect->setValue(localExecutable); + + emit enabledChanged(); + }; + + connect(target, &Target::deploymentDataChanged, this, updateTargetInformation); + connect(target, &Target::applicationTargetsChanged, this, updateTargetInformation); + connect(target->project(), &Project::parsingFinished, this, updateTargetInformation); + connect(target, &Target::kitChanged, this, updateTargetInformation); } Runnable QnxRunConfiguration::runnable() const { - Runnable r = RemoteLinuxRunConfiguration::runnable(); + Runnable r = RunConfiguration::runnable(); QString libPath = aspect<QtLibPathAspect>()->value(); if (!libPath.isEmpty()) { r.environment.appendOrSet("LD_LIBRARY_PATH", libPath + "/lib:$LD_LIBRARY_PATH"); diff --git a/src/plugins/qnx/qnxrunconfiguration.h b/src/plugins/qnx/qnxrunconfiguration.h index 390224d120..75ec72a66c 100644 --- a/src/plugins/qnx/qnxrunconfiguration.h +++ b/src/plugins/qnx/qnxrunconfiguration.h @@ -39,7 +39,7 @@ public: QtLibPathAspect() = default; }; -class QnxRunConfiguration : public RemoteLinux::RemoteLinuxRunConfiguration +class QnxRunConfiguration final : public ProjectExplorer::RunConfiguration { Q_OBJECT @@ -50,7 +50,7 @@ private: ProjectExplorer::Runnable runnable() const override; }; -class QnxRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory +class QnxRunConfigurationFactory final : public ProjectExplorer::RunConfigurationFactory { public: QnxRunConfigurationFactory(); |