forked from qt-creator/qt-creator
RemoteLinux: Move X11Forwarding aspect to ProjectExplorer
Pretty small and self-contained, and will avoid an explicit dependency of the QmlProjectManagerPlugin on RemoteLinux. Task-number: QTCREATORBUG-28074 Change-Id: Ia3c1bb6a887336040ac6e87c3d52570bbe2bc01f Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "kitinformation.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorersettings.h"
|
||||
#include "projectexplorertr.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -74,8 +74,6 @@ Project {
|
||||
"tarpackagecreationstep.h",
|
||||
"tarpackagedeploystep.cpp",
|
||||
"tarpackagedeploystep.h",
|
||||
"x11forwardingaspect.cpp",
|
||||
"x11forwardingaspect.h",
|
||||
"images/embeddedtarget.png",
|
||||
]
|
||||
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "remotelinux_constants.h"
|
||||
#include "remotelinuxtr.h"
|
||||
#include "remotelinuxenvironmentaspect.h"
|
||||
#include "x11forwardingaspect.h"
|
||||
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "remotelinux_constants.h"
|
||||
#include "remotelinuxenvironmentaspect.h"
|
||||
#include "remotelinuxtr.h"
|
||||
#include "x11forwardingaspect.h"
|
||||
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/buildtargetinfo.h>
|
||||
|
@@ -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 <utils/environment.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
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
|
@@ -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 <utils/aspects.h>
|
||||
|
||||
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
|
Reference in New Issue
Block a user