Commit 3387ca52 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

kcm: Expose the new XwaylandClientsScale setting on the UI

parent ac4f9bdc
Pipeline #191292 passed with stage
in 5 minutes
......@@ -8,6 +8,9 @@
<entry name="scaleFactor" key="ScaleFactor" type="Double">
<default>1.0</default>
</entry>
<entry name="xwaylandClientsScale" key="XwaylandClientsScale" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
......@@ -76,6 +76,7 @@ void KCMKScreen::configReady(ConfigOperation *op)
m_configHandler->setConfig(config);
setBackendReady(true);
Q_EMIT perOutputScalingChanged();
Q_EMIT xwaylandClientsScaleSupportedChanged();
Q_EMIT primaryOutputSupportedChanged();
Q_EMIT outputReplicationSupportedChanged();
Q_EMIT tabletModeAvailableChanged();
......@@ -338,6 +339,7 @@ void KCMKScreen::load()
m_configHandler.reset(new ConfigHandler(this));
Q_EMIT perOutputScalingChanged();
Q_EMIT xwaylandClientsScaleSupportedChanged();
connect(m_configHandler.get(), &ConfigHandler::outputModelChanged, this, &KCMKScreen::outputModelChanged);
connect(m_configHandler.get(), &ConfigHandler::outputConnect, this, [this](bool connected) {
Q_EMIT outputConnect(connected);
......@@ -445,6 +447,25 @@ void KCMKScreen::setGlobalScale(qreal scale)
Q_EMIT changed();
}
bool KCMKScreen::xwaylandClientsScale() const
{
return GlobalScaleSettings::self()->xwaylandClientsScale();
}
void KCMKScreen::setXwaylandClientsScale(bool scale)
{
GlobalScaleSettings::self()->setXwaylandClientsScale(scale);
Q_EMIT changed();
}
bool KCMKScreen::xwaylandClientsScaleSupported() const
{
if (!m_configHandler || !m_configHandler->config()) {
return false;
}
return m_configHandler->config()->supportedFeatures().testFlag(Config::Feature::XwaylandScales);
}
int KCMKScreen::outputRetention() const
{
if (!m_configHandler) {
......
......@@ -25,6 +25,7 @@ class KCMKScreen : public KQuickAddons::ManagedConfigModule
Q_PROPERTY(bool backendReady READ backendReady NOTIFY backendReadyChanged)
Q_PROPERTY(bool screenNormalized READ screenNormalized NOTIFY screenNormalizedChanged)
Q_PROPERTY(bool perOutputScaling READ perOutputScaling NOTIFY perOutputScalingChanged)
Q_PROPERTY(bool xwaylandClientsScaleSupported READ xwaylandClientsScaleSupported NOTIFY xwaylandClientsScaleSupportedChanged)
Q_PROPERTY(bool primaryOutputSupported READ primaryOutputSupported NOTIFY primaryOutputSupportedChanged)
Q_PROPERTY(bool outputReplicationSupported READ outputReplicationSupported NOTIFY outputReplicationSupportedChanged)
Q_PROPERTY(qreal globalScale READ globalScale WRITE setGlobalScale NOTIFY globalScaleChanged)
......@@ -32,6 +33,7 @@ class KCMKScreen : public KQuickAddons::ManagedConfigModule
Q_PROPERTY(bool autoRotationSupported READ autoRotationSupported NOTIFY autoRotationSupportedChanged)
Q_PROPERTY(bool orientationSensorAvailable READ orientationSensorAvailable NOTIFY orientationSensorAvailableChanged)
Q_PROPERTY(bool tabletModeAvailable READ tabletModeAvailable NOTIFY tabletModeAvailableChanged)
Q_PROPERTY(bool xwaylandClientsScale READ xwaylandClientsScale WRITE setXwaylandClientsScale NOTIFY xwaylandClientsScaleChanged)
public:
explicit KCMKScreen(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
......@@ -59,6 +61,10 @@ public:
qreal globalScale() const;
void setGlobalScale(qreal scale);
bool xwaylandClientsScale() const;
void setXwaylandClientsScale(bool scale);
bool xwaylandClientsScaleSupported() const;
int outputRetention() const;
void setOutputRetention(int retention);
......@@ -94,6 +100,8 @@ Q_SIGNALS:
void outputConnect(bool connected);
void settingsReverted();
void showRevertWarning();
void xwaylandClientsScaleChanged();
void xwaylandClientsScaleSupportedChanged();
private:
void setBackendReady(bool error);
......
......@@ -121,6 +121,57 @@ ColumnLayout {
}
}
Controls.ButtonGroup {
id: x11AppsScaling
onClicked: kcm.xwaylandClientsScale = (button === x11ScalingApps)
}
Controls.RadioButton {
Kirigami.FormData.label: i18n("Legacy Applications (X11):")
visible: kcm.xwaylandClientsScaleSupported
text: i18nc("The system will perform the x11 apps scaling", "Scaled by the system")
checked: !kcm.xwaylandClientsScale
Controls.ButtonGroup.group: x11AppsScaling
}
Controls.Label {
Layout.fillWidth: true
Layout.maximumWidth: Kirigami.Units.gridUnit * 20
visible: kcm.xwaylandClientsScaleSupported
text: i18n("All legacy applications will be scaled by the system to the correct size, however they will always look slightly blurry.")
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
wrapMode: Text.Wrap
}
Item {
Kirigami.FormData.isSection: false
visible: kcm.xwaylandClientsScaleSupported
}
Controls.RadioButton {
id: x11ScalingApps
visible: kcm.xwaylandClientsScaleSupported
text: i18nc("The apps themselves should scale to fit the displays", "Apply scaling themselves")
checked: kcm.xwaylandClientsScale
Controls.ButtonGroup.group: x11AppsScaling
}
Controls.Label {
Layout.fillWidth: true
Layout.maximumWidth: Kirigami.Units.gridUnit * 20
visible: kcm.xwaylandClientsScaleSupported
text: i18n("Legacy applications that support scaling will use it and look crisp, however those that don't will not be scaled at all.")
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
wrapMode: Text.Wrap
}
Item {
Kirigami.FormData.isSection: false
visible: kcm.xwaylandClientsScaleSupported
}
Kirigami.InlineMessage {
id: weirdScaleFactorMsg
Kirigami.FormData.isSection: true
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment