Commit 0f52663c authored by Nate Graham's avatar Nate Graham
Browse files

[KCM] Display scale factor as a percentage, not a decimal

Summary:
This is the way GNOME and Windows present this information, and I think it's clearer
than using a decimal value.

The underlying value is still a float, we just convert to an int in percentage form for
display purposes.

Test Plan: {F7500851}

Reviewers: #vdg, #plasma, romangg, ndavis

Reviewed By: #vdg, #plasma, romangg, ndavis

Subscribers: ndavis, dhaumann, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D24370
parent 019542ff
...@@ -91,10 +91,10 @@ ColumnLayout { ...@@ -91,10 +91,10 @@ ColumnLayout {
top: Math.max(spinbox.from, spinbox.to) * spinbox.factor top: Math.max(spinbox.from, spinbox.to) * spinbox.factor
} }
textFromValue: function(value, locale) { textFromValue: function(value, locale) {
return parseFloat(value * 1.0 / factor).toFixed(2); return i18nc("Global scale factor expressed in percentage form", "%1%", parseFloat(value * 1.0 / factor * 100.0));
} }
valueFromText: function(text, locale) { valueFromText: function(text, locale) {
return Number.fromLocaleString(locale, text) * factor return Number.fromLocaleString(locale, text) * factor / 100.0
} }
onValueModified: element.scale = realValue onValueModified: element.scale = realValue
} }
......
...@@ -91,10 +91,10 @@ ColumnLayout { ...@@ -91,10 +91,10 @@ ColumnLayout {
top: Math.max(spinbox.from, spinbox.to)*spinbox.factor top: Math.max(spinbox.from, spinbox.to)*spinbox.factor
} }
textFromValue: function(value, locale) { textFromValue: function(value, locale) {
return parseFloat(value * 1.0 / factor).toFixed(2); return i18nc("Global scale factor expressed in percentage form", "%1%", parseFloat(value * 1.0 / factor * 100.0));
} }
valueFromText: function(text, locale) { valueFromText: function(text, locale) {
return Number.fromLocaleString(locale, text) * factor return Number.fromLocaleString(locale, text) * factor / 100.0
} }
onValueModified: { onValueModified: {
kcm.globalScale = realValue; kcm.globalScale = realValue;
...@@ -112,7 +112,7 @@ ColumnLayout { ...@@ -112,7 +112,7 @@ ColumnLayout {
Kirigami.FormData.isSection: true Kirigami.FormData.isSection: true
Layout.fillWidth: true Layout.fillWidth: true
type: Kirigami.MessageType.Warning type: Kirigami.MessageType.Warning
text: i18n("Scale factors that are not a multiple of 0.25 may cause visual glitches in applications. Consider setting the scale factor to a multiple of 0.25 and adjusting the font size instead.") text: i18n("Scale factors that are not a multiple of 25% may cause visual glitches in applications. Consider setting the scale factor to a multiple of 25% and adjusting the font size instead.")
visible: false visible: false
showCloseButton: true showCloseButton: true
} }
......
Markdown is supported
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