diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index 421a1556550..51edcf7efea 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -76,11 +76,11 @@ RemoteLinuxCustomRunConfiguration::RemoteLinuxCustomRunConfiguration(Target *tar if (HostOsInfo::isAnyUnixHost()) addAspect(); if (HostOsInfo::isAnyUnixHost()) - addAspect(); + addAspect(macroExpander()); setRunnableModifier([this](Runnable &r) { if (const auto * const forwardingAspect = aspect()) - r.extraData.insert("Ssh.X11ForwardToDisplay", forwardingAspect->display(macroExpander())); + r.extraData.insert("Ssh.X11ForwardToDisplay", forwardingAspect->display()); }); setDefaultDisplayName(runConfigDefaultDisplayName()); diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index ca16b4ddfc3..a0cccf4f6ef 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -75,7 +75,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id) if (HostOsInfo::isAnyUnixHost()) addAspect(); if (HostOsInfo::isAnyUnixHost()) - addAspect(); + addAspect(macroExpander()); setUpdater([this, target, exeAspect, symbolsAspect] { BuildTargetInfo bti = buildTargetInfo(); @@ -88,7 +88,7 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Id id) setRunnableModifier([this](Runnable &r) { if (const auto * const forwardingAspect = aspect()) - r.extraData.insert("Ssh.X11ForwardToDisplay", forwardingAspect->display(macroExpander())); + r.extraData.insert("Ssh.X11ForwardToDisplay", forwardingAspect->display()); }); connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); diff --git a/src/plugins/remotelinux/remotelinuxx11forwardingaspect.cpp b/src/plugins/remotelinux/remotelinuxx11forwardingaspect.cpp index 739a470321f..3fbeba70cc1 100644 --- a/src/plugins/remotelinux/remotelinuxx11forwardingaspect.cpp +++ b/src/plugins/remotelinux/remotelinuxx11forwardingaspect.cpp @@ -32,9 +32,10 @@ using namespace Utils; namespace RemoteLinux { -static QString defaultDisplay() { return QLatin1String(qgetenv("DISPLAY")); } +static QString defaultDisplay() { return qEnvironmentVariable("DISPLAY"); } -X11ForwardingAspect::X11ForwardingAspect() +X11ForwardingAspect::X11ForwardingAspect(const MacroExpander *expander) + : m_macroExpander(expander) { setLabelText(tr("X11 Forwarding:")); setDisplayStyle(LineEditDisplay); @@ -43,12 +44,14 @@ X11ForwardingAspect::X11ForwardingAspect() makeCheckable(CheckBoxPlacement::Right, tr("Forward to local display"), "RunConfiguration.UseX11Forwarding"); setValue(defaultDisplay()); + + addDataExtractor(this, &X11ForwardingAspect::display, &Data::display); } -QString X11ForwardingAspect::display(const Utils::MacroExpander *expander) const +QString X11ForwardingAspect::display() const { - QTC_ASSERT(expander, return value()); - return !isChecked() ? QString() : expander->expandProcessArgs(value()); + QTC_ASSERT(m_macroExpander, return value()); + return !isChecked() ? QString() : m_macroExpander->expandProcessArgs(value()); } } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/remotelinuxx11forwardingaspect.h b/src/plugins/remotelinux/remotelinuxx11forwardingaspect.h index b518782fbc8..2f7fa402d74 100644 --- a/src/plugins/remotelinux/remotelinuxx11forwardingaspect.h +++ b/src/plugins/remotelinux/remotelinuxx11forwardingaspect.h @@ -38,9 +38,17 @@ class REMOTELINUX_EXPORT X11ForwardingAspect : public Utils::StringAspect Q_OBJECT public: - X11ForwardingAspect(); + X11ForwardingAspect(const Utils::MacroExpander *macroExpander); - QString display(const Utils::MacroExpander *expander) const; + struct Data : BaseAspect::Data + { + QString display; + }; + + QString display() const; + +private: + const Utils::MacroExpander *m_macroExpander; }; } // namespace RemoteLinux