diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index e21c99e8571..5ab64f824a1 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -9,6 +9,7 @@ #include "kitinformation.h" #include "projectexplorer.h" #include "projectexplorersettings.h" +#include "projectexplorertr.h" #include "target.h" #include @@ -870,4 +871,37 @@ void InterpreterAspect::updateComboBox() updateCurrentInterpreter(); } +/*! + \class ProjectExplorer::X11ForwardingAspect + \inmodule QtCreator + + \brief The X11ForwardingAspect class lets a user specify a display + for a remotely running X11 client. +*/ + +static QString defaultDisplay() +{ + return qtcEnvironmentVariable("DISPLAY"); +} + +X11ForwardingAspect::X11ForwardingAspect(const MacroExpander *expander) + : m_macroExpander(expander) +{ + setLabelText(Tr::tr("X11 Forwarding:")); + setDisplayStyle(LineEditDisplay); + setId("X11ForwardingAspect"); + setSettingsKey("RunConfiguration.X11Forwarding"); + makeCheckable(CheckBoxPlacement::Right, Tr::tr("Forward to local display"), + "RunConfiguration.UseX11Forwarding"); + setValue(defaultDisplay()); + + addDataExtractor(this, &X11ForwardingAspect::display, &Data::display); +} + +QString X11ForwardingAspect::display() const +{ + QTC_ASSERT(m_macroExpander, return value()); + return !isChecked() ? QString() : m_macroExpander->expandProcessArgs(value()); +} + } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/runconfigurationaspects.h b/src/plugins/projectexplorer/runconfigurationaspects.h index d3d579070db..ff474572869 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.h +++ b/src/plugins/projectexplorer/runconfigurationaspects.h @@ -257,4 +257,19 @@ public: MainScriptAspect() = default; }; +class PROJECTEXPLORER_EXPORT X11ForwardingAspect : public Utils::StringAspect +{ + Q_OBJECT + +public: + X11ForwardingAspect(const Utils::MacroExpander *macroExpander); + + struct Data : StringAspect::Data { QString display; }; + + QString display() const; + +private: + const Utils::MacroExpander *m_macroExpander; +}; + } // namespace ProjectExplorer diff --git a/src/plugins/remotelinux/CMakeLists.txt b/src/plugins/remotelinux/CMakeLists.txt index 75899417c2b..e317e2e7865 100644 --- a/src/plugins/remotelinux/CMakeLists.txt +++ b/src/plugins/remotelinux/CMakeLists.txt @@ -35,7 +35,6 @@ add_qtc_plugin(RemoteLinux sshprocessinterface.h tarpackagecreationstep.cpp tarpackagecreationstep.h tarpackagedeploystep.cpp tarpackagedeploystep.h - x11forwardingaspect.cpp x11forwardingaspect.h ) extend_qtc_plugin(RemoteLinux diff --git a/src/plugins/remotelinux/remotelinux.qbs b/src/plugins/remotelinux/remotelinux.qbs index 4ad512e75d4..952818ccb22 100644 --- a/src/plugins/remotelinux/remotelinux.qbs +++ b/src/plugins/remotelinux/remotelinux.qbs @@ -74,8 +74,6 @@ Project { "tarpackagecreationstep.h", "tarpackagedeploystep.cpp", "tarpackagedeploystep.h", - "x11forwardingaspect.cpp", - "x11forwardingaspect.h", "images/embeddedtarget.png", ] diff --git a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp index 6e536959328..d45870fded8 100644 --- a/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxcustomrunconfiguration.cpp @@ -6,7 +6,6 @@ #include "remotelinux_constants.h" #include "remotelinuxtr.h" #include "remotelinuxenvironmentaspect.h" -#include "x11forwardingaspect.h" #include #include diff --git a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp index 99ff7d7ff2c..48a150d54d8 100644 --- a/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp +++ b/src/plugins/remotelinux/remotelinuxrunconfiguration.cpp @@ -6,7 +6,6 @@ #include "remotelinux_constants.h" #include "remotelinuxenvironmentaspect.h" #include "remotelinuxtr.h" -#include "x11forwardingaspect.h" #include #include diff --git a/src/plugins/remotelinux/x11forwardingaspect.cpp b/src/plugins/remotelinux/x11forwardingaspect.cpp deleted file mode 100644 index a470bdb5313..00000000000 --- a/src/plugins/remotelinux/x11forwardingaspect.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 - -#include "x11forwardingaspect.h" - -#include "remotelinuxtr.h" - -#include -#include -#include - -using namespace Utils; - -namespace RemoteLinux { - -static QString defaultDisplay() -{ - return qtcEnvironmentVariable("DISPLAY"); -} - -X11ForwardingAspect::X11ForwardingAspect(const MacroExpander *expander) - : m_macroExpander(expander) -{ - setLabelText(Tr::tr("X11 Forwarding:")); - setDisplayStyle(LineEditDisplay); - setId("X11ForwardingAspect"); - setSettingsKey("RunConfiguration.X11Forwarding"); - makeCheckable(CheckBoxPlacement::Right, Tr::tr("Forward to local display"), - "RunConfiguration.UseX11Forwarding"); - setValue(defaultDisplay()); - - addDataExtractor(this, &X11ForwardingAspect::display, &Data::display); -} - -QString X11ForwardingAspect::display() const -{ - QTC_ASSERT(m_macroExpander, return value()); - return !isChecked() ? QString() : m_macroExpander->expandProcessArgs(value()); -} - -} // namespace RemoteLinux diff --git a/src/plugins/remotelinux/x11forwardingaspect.h b/src/plugins/remotelinux/x11forwardingaspect.h deleted file mode 100644 index 5379326581d..00000000000 --- a/src/plugins/remotelinux/x11forwardingaspect.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2018 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 - -#pragma once - -#include "remotelinux_export.h" - -#include - -namespace Utils { class MacroExpander; } - -namespace RemoteLinux { - -class REMOTELINUX_EXPORT X11ForwardingAspect : public Utils::StringAspect -{ - Q_OBJECT - -public: - X11ForwardingAspect(const Utils::MacroExpander *macroExpander); - - struct Data : StringAspect::Data - { - QString display; - }; - - QString display() const; - -private: - const Utils::MacroExpander *m_macroExpander; -}; - -} // namespace RemoteLinux