From c8e74916856fcc3d2f92fa9c2d4a9a956934b943 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 14 Jul 2023 06:58:35 +0200 Subject: [PATCH] RemoteLinux: Use aspects more directly in RemoteLinuxCustomRunRC This now also unconditionally enables the X11ForwardingAspect. Change-Id: I5c4c69fcc2902bd6b842adba1ec93978b846f651 Reviewed-by: Christian Kandeler --- .../remotelinuxcustomrunconfiguration.cpp | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index 631bc638b57..478fc1b1b40 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -27,56 +27,56 @@ public: private: Tasks checkForIssues() const override; + + RemoteLinuxEnvironmentAspect environment{this}; + ExecutableAspect executable{this}; + SymbolFileAspect symbolFile{this}; + ArgumentsAspect arguments{this}; + WorkingDirectoryAspect workingDir{this}; + TerminalAspect terminal{this}; + X11ForwardingAspect x11Forwarding{this}; }; RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *target, Id id) : RunConfiguration(target, id) { - auto envAspect = addAspect(); - envAspect->setDeviceSelector(target, EnvironmentAspect::RunDevice); + environment.setDeviceSelector(target, EnvironmentAspect::RunDevice); - auto exeAspect = addAspect(); - exeAspect->setDeviceSelector(target, ExecutableAspect::RunDevice); - exeAspect->setSettingsKey("RemoteLinux.CustomRunConfig.RemoteExecutable"); - exeAspect->setLabelText(Tr::tr("Remote executable:")); - exeAspect->setReadOnly(false); - exeAspect->setHistoryCompleter("RemoteLinux.CustomExecutable.History"); - exeAspect->setExpectedKind(PathChooser::Any); + executable.setDeviceSelector(target, ExecutableAspect::RunDevice); + executable.setSettingsKey("RemoteLinux.CustomRunConfig.RemoteExecutable"); + executable.setLabelText(Tr::tr("Remote executable:")); + executable.setReadOnly(false); + executable.setHistoryCompleter("RemoteLinux.CustomExecutable.History"); + executable.setExpectedKind(PathChooser::Any); - auto symbolsAspect = addAspect(); - symbolsAspect->setSettingsKey("RemoteLinux.CustomRunConfig.LocalExecutable"); - symbolsAspect->setLabelText(Tr::tr("Local executable:")); + symbolFile.setSettingsKey("RemoteLinux.CustomRunConfig.LocalExecutable"); + symbolFile.setLabelText(Tr::tr("Local executable:")); - auto argsAspect = addAspect(); - argsAspect->setMacroExpander(macroExpander()); + arguments.setMacroExpander(macroExpander()); - auto workingDirAspect = addAspect(); - workingDirAspect->setMacroExpander(macroExpander()); - workingDirAspect->setEnvironment(envAspect); + workingDir.setMacroExpander(macroExpander()); + workingDir.setEnvironment(&environment); - if (HostOsInfo::isAnyUnixHost()) - addAspect(); + terminal.setVisible(HostOsInfo::isAnyUnixHost()); - if (HostOsInfo::isAnyUnixHost()) { - auto x11Forwarding = addAspect(); - x11Forwarding->setMacroExpander(macroExpander()); - } + x11Forwarding.setMacroExpander(macroExpander()); setDefaultDisplayName(runConfigDefaultDisplayName()); } QString RemoteLinuxCustomRunConfiguration::runConfigDefaultDisplayName() { - QString remoteExecutable = aspect()->executable().toString(); + FilePath remoteExecutable = executable(); QString display = remoteExecutable.isEmpty() - ? Tr::tr("Custom Executable") : Tr::tr("Run \"%1\"").arg(remoteExecutable); - return RunConfigurationFactory::decoratedTargetName(display, target()); + ? Tr::tr("Custom Executable") + : Tr::tr("Run \"%1\"").arg(remoteExecutable.toUserOutput()); + return RunConfigurationFactory::decoratedTargetName(display, target()); } Tasks RemoteLinuxCustomRunConfiguration::checkForIssues() const { Tasks tasks; - if (aspect()->executable().isEmpty()) { + if (executable().isEmpty()) { tasks << createConfigurationIssue(Tr::tr("The remote executable must be set in order to run " "a custom remote run configuration.")); }