Changeset View
Changeset View
Standalone View
Standalone View
kcm/package/contents/ui/Panel.qml
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | 61 | RowLayout { | |||
---|---|---|---|---|---|
65 | visible: !kcm.perOutputScaling | 65 | visible: !kcm.perOutputScaling | ||
66 | 66 | | |||
67 | Controls.Slider { | 67 | Controls.Slider { | ||
68 | id: globalScaleSlider | 68 | id: globalScaleSlider | ||
69 | 69 | | |||
70 | Layout.fillWidth: true | 70 | Layout.fillWidth: true | ||
71 | from: 1 | 71 | from: 1 | ||
72 | to: 3 | 72 | to: 3 | ||
73 | stepSize: 0.1 | 73 | stepSize: 0.25 | ||
74 | live: true | 74 | live: true | ||
75 | value: kcm.globalScale | 75 | value: kcm.globalScale | ||
76 | onMoved: kcm.globalScale = value | 76 | onMoved: kcm.globalScale = value; | ||
77 | } | ||||
78 | Controls.SpinBox { | ||||
79 | id: spinbox | ||||
80 | // Because QQC2 SpinBox doesn't natively support decimal step | ||||
81 | // sizes: https://bugreports.qt.io/browse/QTBUG-67349 | ||||
82 | property real factor: 20.0 | ||||
83 | property real realValue: value / factor | ||||
84 | | ||||
85 | from : 1.0 * factor | ||||
86 | to : 3.0 * factor | ||||
87 | stepSize: 0.05 * factor | ||||
88 | value: kcm.globalScale * factor | ||||
89 | validator: DoubleValidator { | ||||
90 | bottom: Math.min(spinbox.from, spinbox.to)*spinbox.factor | ||||
91 | top: Math.max(spinbox.from, spinbox.to)*spinbox.factor | ||||
92 | } | ||||
93 | textFromValue: function(value, locale) { | ||||
94 | return parseFloat(value * 1.0 / factor).toFixed(2); | ||||
95 | } | ||||
96 | valueFromText: function(text, locale) { | ||||
97 | return Number.fromLocaleString(locale, text) * factor | ||||
98 | } | ||||
99 | onValueModified: { | ||||
100 | kcm.globalScale = realValue; | ||||
101 | if (kcm.globalScale % 0.25) { | ||||
102 | weirdScaleFactorMsg.visible = true; | ||||
103 | } else { | ||||
104 | weirdScaleFactorMsg.visible = false; | ||||
77 | } | 105 | } | ||
78 | Controls.Label { | | |||
79 | text: i18nc("Scale factor (e.g. 1.0x, 1.5x, 2.0x)","%1x", globalScaleSlider.value.toLocaleString(Qt.locale(), "f", 1)) | | |||
80 | } | 106 | } | ||
81 | } | 107 | } | ||
108 | } | ||||
109 | | ||||
110 | Kirigami.InlineMessage { | ||||
111 | id: weirdScaleFactorMsg | ||||
112 | Layout.fillWidth: true | ||||
113 | type: Kirigami.MessageType.Warning | ||||
114 | 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.") | ||||
115 | visible: false | ||||
116 | showCloseButton: true | ||||
117 | } | ||||
82 | 118 | | |||
83 | Controls.ButtonGroup { | 119 | Controls.ButtonGroup { | ||
84 | buttons: retentionSelector.children | 120 | buttons: retentionSelector.children | ||
85 | } | 121 | } | ||
86 | 122 | | |||
87 | ColumnLayout { | 123 | ColumnLayout { | ||
88 | id: retentionSelector | 124 | id: retentionSelector | ||
89 | 125 | | |||
Show All 20 Lines |