Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpad/src/kcm/libinput/main.qml
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Copyright 2017 Roman Gilg <subdiff@gmail.com> | 2 | * Copyright 2017 Roman Gilg <subdiff@gmail.com> | ||
3 | * Copyright 2018 Furkan Tokac <furkantokac34@gmail.com> | ||||
3 | * | 4 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | 8 | * (at your option) any later version. | ||
8 | * | 9 | * | ||
9 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. | ||
13 | * | 14 | * | ||
14 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | 18 | */ | ||
18 | 19 | | |||
19 | import QtQuick 2.7 | 20 | import QtQuick 2.7 | ||
20 | import QtQuick.Controls 1.4 as Controls | 21 | import QtQuick.Controls 1.4 as Controls | ||
21 | import QtQuick.Layouts 1.3 as Layouts | 22 | import QtQuick.Layouts 1.3 as Layouts | ||
22 | import QtQuick.Controls.Styles 1.4 as Styles | 23 | import QtQuick.Controls.Styles 1.4 as Styles | ||
23 | 24 | | |||
25 | import org.kde.kcm 1.1 as KCM | ||||
26 | import org.kde.kirigami 2.4 as Kirigami | ||||
24 | import org.kde.plasma.core 2.0 as PlasmaCore | 27 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
25 | 28 | | |||
26 | import "components" | 29 | import "components" | ||
27 | 30 | | |||
28 | Item { | 31 | Kirigami.Page { | ||
29 | id: root | 32 | id: root | ||
30 | 33 | | |||
31 | property size sizeHint: Qt.size(maincol.width, maincol.height) | | |||
32 | property size minimumSizeHint: Qt.size(maincol.width/2, deviceSelector.height) | | |||
33 | property alias deviceIndex: deviceSelector.currentIndex | 34 | property alias deviceIndex: deviceSelector.currentIndex | ||
34 | signal changeSignal() | 35 | signal changeSignal() | ||
35 | 36 | | |||
36 | property QtObject touchpad | 37 | property QtObject touchpad | ||
37 | property int touchpadCount: backend.touchpadCount | 38 | property int touchpadCount: backend.touchpadCount | ||
38 | 39 | | |||
39 | property bool loading: false | 40 | property bool loading: false | ||
40 | 41 | | |||
41 | function resetModel(index) { | 42 | function resetModel(index) { | ||
42 | touchpadCount = backend.touchpadCount | 43 | touchpadCount = backend.touchpadCount | ||
43 | maincol.enabled = touchpadCount | 44 | formLayout.enabled = touchpadCount | ||
44 | deviceSelector.enabled = touchpadCount > 1 | 45 | deviceSelector.enabled = touchpadCount > 1 | ||
45 | 46 | | |||
46 | loading = true | 47 | loading = true | ||
47 | if (touchpadCount) { | 48 | if (touchpadCount) { | ||
48 | touchpad = deviceModel[index] | 49 | touchpad = deviceModel[index] | ||
49 | deviceSelector.model = deviceModel | 50 | deviceSelector.model = deviceModel | ||
50 | deviceSelector.currentIndex = index | 51 | deviceSelector.currentIndex = index | ||
51 | console.log("Touchpad configuration of device '" + | 52 | console.log("Touchpad configuration of device '" + | ||
Show All 22 Lines | 61 | function syncValuesFromBackend() { | |||
74 | scrollmethod.load() | 75 | scrollmethod.load() | ||
75 | naturalScroll.load() | 76 | naturalScroll.load() | ||
76 | // TODO: | 77 | // TODO: | ||
77 | // scrollbutton.load() | 78 | // scrollbutton.load() | ||
78 | 79 | | |||
79 | loading = false | 80 | loading = false | ||
80 | } | 81 | } | ||
81 | 82 | | |||
82 | Controls.ScrollView { | 83 | Kirigami.FormLayout { | ||
83 | anchors.fill: parent | 84 | id: formLayout | ||
84 | 85 | | |||
85 | Layouts.ColumnLayout { | 86 | topPadding: root.topPadding | ||
86 | id: maincol | 87 | leftPadding: root.leftPadding | ||
87 | enabled: touchpadCount | 88 | rightPadding: root.rightPadding | ||
88 | spacing: units.largeSpacing | 89 | bottomPadding: root.bottomPadding | ||
89 | 90 | anchors { | |||
90 | Layouts.RowLayout { | 91 | fill: parent | ||
furkantokac: This will go if nobody tells me it is necessary. I couldn't find any use case that this will be… | |||||
91 | spacing: units.largeSpacing | 92 | topMargin: root.header ? root.header.height : 0 | ||
92 | Layouts.Layout.leftMargin: 0.1 * parent.width | 93 | bottomMargin: root.footer ? root.footer.height : 0 | ||
93 | Layouts.Layout.rightMargin: 0.1 * parent.width | | |||
94 | | ||||
95 | Controls.Label { | | |||
96 | text: i18n("Device:") | | |||
97 | } | 94 | } | ||
98 | 95 | | |||
96 | // Device | ||||
99 | Controls.ComboBox { | 97 | Controls.ComboBox { | ||
98 | Kirigami.FormData.label: i18n("Device:") | ||||
100 | id: deviceSelector | 99 | id: deviceSelector | ||
101 | enabled: touchpadCount > 1 | 100 | enabled: touchpadCount > 1 | ||
101 | implicitWidth: units.gridUnit * 16 | ||||
I'm against this change for several reasons:
romangg: I'm against this change for several reasons:
* In general control elements shouldn't be… | |||||
102 | Layouts.Layout.fillWidth: true | 102 | Layouts.Layout.fillWidth: true | ||
103 | model: deviceModel | 103 | model: deviceModel | ||
104 | textRole: "name" | 104 | textRole: "name" | ||
105 | 105 | | |||
106 | onCurrentIndexChanged: { | 106 | onCurrentIndexChanged: { | ||
107 | if (touchpadCount) { | 107 | if (touchpadCount) { | ||
108 | touchpad = deviceModel[currentIndex] | 108 | touchpad = deviceModel[currentIndex] | ||
109 | if (!loading) { | 109 | if (!loading) { | ||
110 | changeSignal() | 110 | changeSignal() | ||
111 | } | 111 | } | ||
112 | console.log("Touchpad configuration of device '" + | 112 | console.log("Touchpad configuration of device '" + | ||
113 | (currentIndex+1) + " : " + touchpad.name + "' opened") | 113 | (currentIndex+1) + " : " + touchpad.name + "' opened") | ||
114 | } | 114 | } | ||
115 | root.syncValuesFromBackend() | 115 | root.syncValuesFromBackend() | ||
116 | } | 116 | } | ||
117 | } | 117 | } | ||
118 | } | | |||
119 | | ||||
120 | Row { | | |||
121 | spacing: units.largeSpacing * 2 | | |||
122 | 118 | | |||
123 | Column { | 119 | Kirigami.Separator { | ||
124 | spacing: units.smallSpacing * 2 | 120 | } | ||
125 | 121 | | |||
126 | Column { | 122 | // General settings | ||
127 | leftPadding: units.smallSpacing | | |||
128 | Column { | | |||
129 | spacing: units.smallSpacing | | |||
130 | Controls.Label { | | |||
131 | text: i18n("General settings:") | | |||
132 | } | | |||
133 | | ||||
134 | Column { | | |||
135 | leftPadding: units.smallSpacing | | |||
136 | Column { | | |||
137 | spacing: units.smallSpacing | | |||
138 | Controls.CheckBox { | 123 | Controls.CheckBox { | ||
124 | Kirigami.FormData.label: i18n("General:") | ||||
139 | id: deviceEnabled | 125 | id: deviceEnabled | ||
140 | text: i18n("Device enabled") | 126 | text: i18n("Device enabled") | ||
141 | 127 | | |||
142 | function load() { | 128 | function load() { | ||
143 | if (!maincol.enabled) { | 129 | if (!formLayout.enabled) { | ||
144 | checked = false | 130 | checked = false | ||
145 | return | 131 | return | ||
146 | } | 132 | } | ||
147 | enabled = touchpad.supportsDisableEvents | 133 | enabled = touchpad.supportsDisableEvents | ||
148 | checked = enabled && touchpad.enabled | 134 | checked = enabled && touchpad.enabled | ||
149 | } | 135 | } | ||
150 | 136 | | |||
151 | onCheckedChanged: { | 137 | onCheckedChanged: { | ||
152 | if (enabled && !root.loading) { | 138 | if (enabled && !root.loading) { | ||
153 | touchpad.enabled = checked | 139 | touchpad.enabled = checked | ||
154 | root.changeSignal() | 140 | root.changeSignal() | ||
155 | } | 141 | } | ||
156 | } | 142 | } | ||
157 | 143 | | |||
158 | ToolTip { | 144 | ToolTip { | ||
159 | text: i18n("Accept input through this device.") | 145 | text: i18n("Accept input through this device.") | ||
160 | } | 146 | } | ||
161 | } | 147 | } | ||
162 | 148 | | |||
163 | Controls.CheckBox { | 149 | Controls.CheckBox { | ||
164 | id: dwt | 150 | id: dwt | ||
165 | text: i18n("Disable while typing") | 151 | text: i18n("Disable while typing") | ||
166 | 152 | | |||
167 | function load() { | 153 | function load() { | ||
168 | if (!maincol.enabled) { | 154 | if (!formLayout.enabled) { | ||
169 | checked = false | 155 | checked = false | ||
170 | return | 156 | return | ||
171 | } | 157 | } | ||
172 | enabled = touchpad.supportsDisableWhileTyping | 158 | enabled = touchpad.supportsDisableWhileTyping | ||
173 | checked = enabled && touchpad.disableWhileTyping | 159 | checked = enabled && touchpad.disableWhileTyping | ||
174 | } | 160 | } | ||
175 | 161 | | |||
176 | onCheckedChanged: { | 162 | onCheckedChanged: { | ||
177 | if (enabled && !root.loading) { | 163 | if (enabled && !root.loading) { | ||
178 | touchpad.disableWhileTyping = checked | 164 | touchpad.disableWhileTyping = checked | ||
179 | root.changeSignal() | 165 | root.changeSignal() | ||
180 | } | 166 | } | ||
181 | } | 167 | } | ||
182 | 168 | | |||
183 | ToolTip { | 169 | ToolTip { | ||
184 | text: i18n("Disable touchpad while typing to prevent accidental inputs.") | 170 | text: i18n("Disable touchpad while typing to prevent accidental inputs.") | ||
185 | } | 171 | } | ||
186 | } | 172 | } | ||
187 | 173 | | |||
188 | Controls.CheckBox { | 174 | Controls.CheckBox { | ||
189 | id: leftHanded | 175 | id: leftHanded | ||
190 | text: i18n("Left handed mode") | 176 | text: i18n("Left handed mode") | ||
191 | 177 | | |||
192 | function load() { | 178 | function load() { | ||
193 | if (!maincol.enabled) { | 179 | if (!formLayout.enabled) { | ||
194 | checked = false | 180 | checked = false | ||
195 | return | 181 | return | ||
196 | } | 182 | } | ||
197 | enabled = touchpad.supportsLeftHanded | 183 | enabled = touchpad.supportsLeftHanded | ||
198 | checked = enabled && touchpad.leftHanded | 184 | checked = enabled && touchpad.leftHanded | ||
199 | } | 185 | } | ||
200 | 186 | | |||
201 | onCheckedChanged: { | 187 | onCheckedChanged: { | ||
202 | if (enabled && !root.loading) { | 188 | if (enabled && !root.loading) { | ||
203 | touchpad.leftHanded = checked | 189 | touchpad.leftHanded = checked | ||
204 | root.changeSignal() | 190 | root.changeSignal() | ||
205 | } | 191 | } | ||
206 | } | 192 | } | ||
207 | 193 | | |||
208 | ToolTip { | 194 | ToolTip { | ||
209 | text: i18n("Swap left and right buttons.") | 195 | text: i18n("Swap left and right buttons.") | ||
210 | } | 196 | } | ||
211 | } | 197 | } | ||
212 | 198 | | |||
213 | Controls.CheckBox { | 199 | Controls.CheckBox { | ||
214 | id: middleEmulation | 200 | id: middleEmulation | ||
215 | text: i18n("Emulate middle button") | 201 | text: i18n("Press left and right buttons for middle click") | ||
ngraham: "Press left and right buttons for middle click" | |||||
216 | 202 | | |||
217 | function load() { | 203 | function load() { | ||
218 | if (!maincol.enabled) { | 204 | if (!formLayout.enabled) { | ||
219 | checked = false | 205 | checked = false | ||
220 | return | 206 | return | ||
221 | } | 207 | } | ||
222 | enabled = touchpad.supportsMiddleEmulation | 208 | enabled = touchpad.supportsMiddleEmulation | ||
223 | checked = enabled && touchpad.middleEmulation | 209 | checked = enabled && touchpad.middleEmulation | ||
224 | } | 210 | } | ||
225 | 211 | | |||
226 | onCheckedChanged: { | 212 | onCheckedChanged: { | ||
227 | if (enabled && !root.loading) { | 213 | if (enabled && !root.loading) { | ||
228 | touchpad.middleEmulation = checked | 214 | touchpad.middleEmulation = checked | ||
229 | root.changeSignal() | 215 | root.changeSignal() | ||
230 | } | 216 | } | ||
231 | } | 217 | } | ||
232 | 218 | | |||
233 | ToolTip { | 219 | ToolTip { | ||
234 | text: i18n("Clicking left and right button simultaneously sends middle button click.") | 220 | text: i18n("Clicking left and right button simultaneously sends middle button click.") | ||
235 | } | 221 | } | ||
236 | } | 222 | } | ||
237 | } | | |||
238 | } | | |||
239 | } | | |||
240 | } | | |||
241 | 223 | | |||
242 | Column { | 224 | Kirigami.Separator { | ||
243 | leftPadding: units.smallSpacing | | |||
244 | Column { | | |||
245 | spacing: units.smallSpacing | | |||
246 | Controls.Label { | | |||
247 | text: i18n("Acceleration:") | | |||
248 | } | 225 | } | ||
249 | 226 | | |||
250 | Column { | 227 | // Acceleration | ||
251 | leftPadding: units.smallSpacing | | |||
252 | Column { | | |||
253 | spacing: units.smallSpacing * 2 | | |||
254 | | ||||
255 | Row { | | |||
256 | Controls.Slider { | 228 | Controls.Slider { | ||
229 | Kirigami.FormData.label: i18n("Pointer speed:") | ||||
257 | id: accelSpeed | 230 | id: accelSpeed | ||
258 | anchors.verticalCenter: parent.verticalCenter | | |||
259 | 231 | | |||
260 | tickmarksEnabled: true | 232 | tickmarksEnabled: true | ||
261 | 233 | | |||
262 | minimumValue: 1 | 234 | minimumValue: 1 | ||
263 | maximumValue: 10 | 235 | maximumValue: 10 | ||
264 | stepSize: 1 | 236 | stepSize: 1 | ||
265 | 237 | | |||
266 | implicitWidth: units.gridUnit * 9 | 238 | implicitWidth: units.gridUnit * 9 | ||
Show All 11 Lines | |||||
278 | onValueChanged: { | 250 | onValueChanged: { | ||
279 | if (touchpad != undefined && enabled && !root.loading) { | 251 | if (touchpad != undefined && enabled && !root.loading) { | ||
280 | // transform slider range [1, 10] to libinput's pointer acceleration range [-1, 1] | 252 | // transform slider range [1, 10] to libinput's pointer acceleration range [-1, 1] | ||
281 | touchpad.pointerAcceleration = Math.round( (value - 5.5) / 4.5 * 100 ) / 100 | 253 | touchpad.pointerAcceleration = Math.round( (value - 5.5) / 4.5 * 100 ) / 100 | ||
282 | root.changeSignal() | 254 | root.changeSignal() | ||
283 | } | 255 | } | ||
284 | } | 256 | } | ||
285 | } | 257 | } | ||
286 | } | | |||
287 | 258 | | |||
288 | ExclGroupBox { | 259 | ExclGroupBox { | ||
260 | Kirigami.FormData.label: i18n("Acceleration profile:") | ||||
289 | id: accelProfile | 261 | id: accelProfile | ||
290 | label: i18n("Acceleration Profile:") | | |||
291 | model: [i18n("Flat"), i18n("Adaptive")] | 262 | model: [i18n("Flat"), i18n("Adaptive")] | ||
292 | 263 | | |||
293 | function load() { | 264 | function load() { | ||
294 | enabled = touchpad.supportsPointerAccelerationProfileAdaptive | 265 | enabled = touchpad.supportsPointerAccelerationProfileAdaptive | ||
295 | 266 | | |||
296 | if (!enabled) { | 267 | if (!enabled) { | ||
297 | itemAt(0).checked = false | 268 | itemAt(0).checked = false | ||
298 | itemAt(1).checked = false | 269 | itemAt(1).checked = false | ||
Show All 10 Lines | |||||
309 | onCurrentChanged: { | 280 | onCurrentChanged: { | ||
310 | if (enabled && !root.loading) { | 281 | if (enabled && !root.loading) { | ||
311 | touchpad.pointerAccelerationProfileFlat = itemAt(0).checked | 282 | touchpad.pointerAccelerationProfileFlat = itemAt(0).checked | ||
312 | touchpad.pointerAccelerationProfileAdaptive = itemAt(1).checked | 283 | touchpad.pointerAccelerationProfileAdaptive = itemAt(1).checked | ||
313 | root.changeSignal() | 284 | root.changeSignal() | ||
314 | } | 285 | } | ||
315 | } | 286 | } | ||
316 | } | 287 | } | ||
317 | } | | |||
318 | } | | |||
319 | } | | |||
320 | } | | |||
321 | 288 | | |||
322 | Column { | 289 | Kirigami.Separator { | ||
323 | leftPadding: units.smallSpacing | | |||
324 | Column { | | |||
325 | spacing: units.smallSpacing | | |||
326 | Controls.Label { | | |||
327 | text: i18n("Tapping:") | | |||
328 | } | 290 | } | ||
329 | 291 | | |||
330 | Column { | 292 | // Tapping | ||
331 | leftPadding: units.smallSpacing | | |||
332 | Column { | | |||
333 | spacing: units.smallSpacing | | |||
334 | Controls.CheckBox { | 293 | Controls.CheckBox { | ||
294 | Kirigami.FormData.label: i18n("Tapping:") | ||||
335 | id: tapToClick | 295 | id: tapToClick | ||
336 | text: i18n("Tap-to-click") | 296 | text: i18n("Tap-to-click") | ||
337 | 297 | | |||
338 | function load() { | 298 | function load() { | ||
339 | enabled = touchpad.tapFingerCount > 0 | 299 | enabled = touchpad.tapFingerCount > 0 | ||
340 | checked = enabled && touchpad.tapToClick | 300 | checked = enabled && touchpad.tapToClick | ||
341 | } | 301 | } | ||
342 | 302 | | |||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 362 | if (enabled && !root.loading) { | |||
404 | root.changeSignal() | 364 | root.changeSignal() | ||
405 | } | 365 | } | ||
406 | } | 366 | } | ||
407 | 367 | | |||
408 | ToolTip { | 368 | ToolTip { | ||
409 | text: i18n("Dragging continues after a short finger lift.") | 369 | text: i18n("Dragging continues after a short finger lift.") | ||
410 | } | 370 | } | ||
411 | } | 371 | } | ||
412 | } | | |||
413 | } | | |||
414 | } | | |||
415 | } | | |||
416 | } | | |||
417 | 372 | | |||
418 | Column { | | |||
419 | spacing: units.smallSpacing * 2 | | |||
420 | | ||||
421 | Column { | | |||
422 | leftPadding: units.smallSpacing | | |||
423 | Column { | | |||
424 | leftPadding: units.smallSpacing | | |||
425 | ExclGroupBox { | 373 | ExclGroupBox { | ||
374 | Kirigami.FormData.label: i18n("Two-finger tap:") | ||||
426 | id: multiTap | 375 | id: multiTap | ||
427 | label: i18n("Multi tapping:") | | |||
428 | 376 | | |||
429 | function load() { | 377 | function load() { | ||
430 | enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked | 378 | enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked | ||
431 | if (touchpad.tapFingerCount > 2) { | 379 | if (touchpad.tapFingerCount > 2) { | ||
432 | model = [i18n("Two-tap right, three middle"), i18n("Two-tap middle, three right")] | 380 | model = [i18n("Right-click (three-finger tap to middle-click)"), | ||
ngraham: "Two finger tap to right-click; three finger tap to middle-click" | |||||
433 | itemAt(0).tooltiptext = i18n("Tap with two fingers triggers a right click, tap with three fingers a middle click.") | 381 | i18n("Middle-click (three-finger tap right-click)")] | ||
ngraham: "Two finger tap to middle-click; three finger tap to right-click" | |||||
434 | itemAt(1).tooltiptext = i18n("Tap with two fingers triggers a middle click, tap with three fingers a right click.") | 382 | itemAt(0).tooltiptext = i18n("Tap with two fingers to right-click, tap with three fingers to middle-click.") | ||
383 | itemAt(1).tooltiptext = i18n("Tap with two fingers to middle-click, tap with three fingers to right-click.") | ||||
435 | } else { | 384 | } else { | ||
436 | model = [i18n("Two-tap right click"), i18n("Two-tap middle click")] | 385 | model = [i18n("Righ-click"), i18n("Middle-click")] | ||
437 | itemAt(0).tooltiptext = i18n("Tap with two fingers triggers a right click.") | 386 | itemAt(0).tooltiptext = i18n("Tap with two fingers to right-click.") | ||
438 | itemAt(1).tooltiptext = i18n("Tap with two fingers triggers a middle click.") | 387 | itemAt(1).tooltiptext = i18n("Tap with two fingers to middle-click.") | ||
439 | } | 388 | } | ||
440 | 389 | | |||
441 | if (!enabled) { | 390 | if (!enabled) { | ||
442 | itemAt(0).checked = false | 391 | itemAt(0).checked = false | ||
443 | itemAt(1).checked = false | 392 | itemAt(1).checked = false | ||
444 | return | 393 | return | ||
445 | } | 394 | } | ||
446 | var toCheck = touchpad.lmrTapButtonMap ? 1 : 0 | 395 | var toCheck = touchpad.lmrTapButtonMap ? 1 : 0 | ||
447 | itemAt(toCheck).checked = true | 396 | itemAt(toCheck).checked = true | ||
448 | } | 397 | } | ||
449 | 398 | | |||
450 | onCurrentChanged: { | 399 | onCurrentChanged: { | ||
451 | if (enabled && !root.loading) { | 400 | if (enabled && !root.loading) { | ||
452 | touchpad.lmrTapButtonMap = itemAt(1).checked | 401 | touchpad.lmrTapButtonMap = itemAt(1).checked | ||
453 | root.changeSignal() | 402 | root.changeSignal() | ||
454 | } | 403 | } | ||
455 | } | 404 | } | ||
456 | } | 405 | } | ||
457 | } | | |||
458 | } | | |||
459 | 406 | | |||
460 | Column { | 407 | Kirigami.Separator { | ||
461 | leftPadding: units.smallSpacing | | |||
462 | Column { | | |||
463 | spacing: units.smallSpacing | | |||
464 | Controls.Label { | | |||
465 | text: i18n("Scrolling:") | | |||
466 | } | 408 | } | ||
467 | 409 | | |||
468 | Column { | 410 | // Scrolling | ||
469 | leftPadding: units.smallSpacing | | |||
470 | Column { | | |||
471 | spacing: units.smallSpacing | | |||
472 | ExclGroupBox { | 411 | ExclGroupBox { | ||
412 | Kirigami.FormData.label: i18n("Scrolling:") | ||||
473 | id: scrollmethod | 413 | id: scrollmethod | ||
474 | label: i18n("Scroll method:") | 414 | model: [i18n("Two fingers"), i18n("Touchpad edges")] | ||
475 | model: [i18n("Two fingers"), i18n("Touchpad edges"), /*i18n("On Button down"),*/ i18n("No scroll")] | | |||
476 | | ||||
477 | property bool isNoScroll: true | | |||
478 | 415 | | |||
479 | function load() { | 416 | function load() { | ||
480 | itemAt(0).enabled = touchpad.supportsScrollTwoFinger | 417 | itemAt(0).enabled = touchpad.supportsScrollTwoFinger | ||
481 | itemAt(1).enabled = touchpad.supportsScrollEdge | 418 | itemAt(1).enabled = touchpad.supportsScrollEdge | ||
482 | // TODO: | | |||
483 | // itemAt(2).enabled = touchpad.supportsScrollOnButtonDown | | |||
484 | 419 | | |||
485 | var toCheck = 2 | 420 | var toCheck = 0 | ||
486 | if (itemAt(0).enabled && touchpad.scrollTwoFinger) { | 421 | if (itemAt(0).enabled && touchpad.scrollTwoFinger) { | ||
487 | toCheck = 0 | 422 | toCheck = 0 | ||
488 | } else if (itemAt(1).enabled && touchpad.scrollEdge) { | 423 | } else if (itemAt(1).enabled && touchpad.scrollEdge) { | ||
489 | toCheck = 1 | 424 | toCheck = 1 | ||
490 | // } else if (itemAt(2).enabled && touchpad.scrollOnButtonDown) { | | |||
491 | // toCheck = 2 | | |||
492 | } | 425 | } | ||
493 | itemAt(0).tooltiptext = i18n("Slide with two fingers scrolls.") | 426 | itemAt(0).tooltiptext = i18n("Slide with two fingers scrolls.") | ||
494 | itemAt(1).tooltiptext = i18n("Slide on the touchpad edges scrolls.") | 427 | itemAt(1).tooltiptext = i18n("Slide on the touchpad edges scrolls.") | ||
495 | itemAt(2).tooltiptext = i18n("All forms of touchpad scrolling are deactivated.") | | |||
496 | 428 | | |||
497 | isNoScroll = (toCheck == 2) | 429 | itemAt(toCheck).checked = formLayout.enabled | ||
498 | itemAt(toCheck).checked = maincol.enabled | | |||
499 | } | 430 | } | ||
500 | 431 | | |||
501 | onCurrentChanged: { | 432 | onCurrentChanged: { | ||
502 | if (enabled && !root.loading) { | 433 | if (enabled && !root.loading) { | ||
503 | touchpad.scrollTwoFinger = itemAt(0).checked | 434 | touchpad.scrollTwoFinger = itemAt(0).checked | ||
504 | touchpad.scrollEdge = itemAt(1).checked | 435 | touchpad.scrollEdge = itemAt(1).checked | ||
505 | // touchpad.scrollOnButtonDown = itemAt(2).checked | | |||
506 | root.changeSignal() | 436 | root.changeSignal() | ||
507 | } | 437 | } | ||
508 | isNoScroll = itemAt(2).checked | | |||
509 | loading = true | 438 | loading = true | ||
510 | naturalScroll.load() | 439 | naturalScroll.load() | ||
511 | loading = false | 440 | loading = false | ||
512 | } | 441 | } | ||
513 | } | 442 | } | ||
514 | 443 | | |||
515 | Controls.CheckBox { | 444 | Controls.CheckBox { | ||
516 | id: naturalScroll | 445 | id: naturalScroll | ||
517 | text: i18n("Invert scroll direction") | 446 | text: i18n("Invert scroll direction (Natural scrolling)") | ||
Idea: change this string to:
This might help improve discoverability for people who are familiar with the term "Natural scrolling", which is used by Apple and GNOME. ngraham: Idea: change this string to:
> Invert scroll direction ("Natural scrolling")
This might help… | |||||
518 | 447 | | |||
519 | function load() { | 448 | function load() { | ||
520 | enabled = touchpad.supportsNaturalScroll && !scrollmethod.isNoScroll | 449 | enabled = touchpad.supportsNaturalScroll | ||
521 | checked = enabled && touchpad.naturalScroll | 450 | checked = enabled && touchpad.naturalScroll | ||
522 | } | 451 | } | ||
523 | 452 | | |||
524 | onCheckedChanged: { | 453 | onCheckedChanged: { | ||
525 | if (enabled && !root.loading) { | 454 | if (enabled && !root.loading) { | ||
526 | touchpad.naturalScroll = checked | 455 | touchpad.naturalScroll = checked | ||
527 | root.changeSignal() | 456 | root.changeSignal() | ||
528 | } | 457 | } | ||
529 | } | 458 | } | ||
530 | 459 | | |||
531 | ToolTip { | 460 | ToolTip { | ||
532 | text: i18n("Touchscreen like scrolling.") | 461 | text: i18n("Touchscreen like scrolling.") | ||
533 | } | 462 | } | ||
534 | } | 463 | } | ||
535 | } | 464 | } // END Kirigami.FormLayout | ||
536 | } | 465 | } // END Kirigami.ScrollablePage | ||
furkantokac: This comment will be changed as "END Kirigami.ScrollablePage" | |||||
537 | } | | |||
538 | } | | |||
539 | } | | |||
540 | } | | |||
541 | } | | |||
542 | } | | |||
543 | } | |
This will go if nobody tells me it is necessary. I couldn't find any use case that this will be important.