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.ScrollablePage { | ||
29 | id: root | 32 | id: root | ||
30 | 33 | | |||
31 | property size sizeHint: Qt.size(maincol.width, maincol.height) | 34 | implicitWidth: Kirigami.Units.gridUnit * 20 | ||
32 | property size minimumSizeHint: Qt.size(maincol.width/2, deviceSelector.height) | 35 | implicitHeight: Math.min(flickable.contentHeight, Kirigami.Units.gridUnit * 20) | ||
36 | | ||||
33 | property alias deviceIndex: deviceSelector.currentIndex | 37 | property alias deviceIndex: deviceSelector.currentIndex | ||
34 | signal changeSignal() | 38 | signal changeSignal() | ||
35 | 39 | | |||
36 | property QtObject touchpad | 40 | property QtObject touchpad | ||
37 | property int touchpadCount: backend.touchpadCount | 41 | property int touchpadCount: backend.touchpadCount | ||
38 | 42 | | |||
39 | property bool loading: false | 43 | property bool loading: false | ||
40 | 44 | | |||
41 | function resetModel(index) { | 45 | function resetModel(index) { | ||
42 | touchpadCount = backend.touchpadCount | 46 | touchpadCount = backend.touchpadCount | ||
43 | maincol.enabled = touchpadCount | 47 | formLayout.enabled = touchpadCount | ||
44 | deviceSelector.enabled = touchpadCount > 1 | 48 | deviceSelector.enabled = touchpadCount > 1 | ||
45 | 49 | | |||
46 | loading = true | 50 | loading = true | ||
47 | if (touchpadCount) { | 51 | if (touchpadCount) { | ||
48 | touchpad = deviceModel[index] | 52 | touchpad = deviceModel[index] | ||
49 | deviceSelector.model = deviceModel | 53 | deviceSelector.model = deviceModel | ||
50 | deviceSelector.currentIndex = index | 54 | deviceSelector.currentIndex = index | ||
51 | console.log("Touchpad configuration of device '" + | 55 | console.log("Touchpad configuration of device '" + | ||
Show All 22 Lines | 64 | function syncValuesFromBackend() { | |||
74 | scrollmethod.load() | 78 | scrollmethod.load() | ||
75 | naturalScroll.load() | 79 | naturalScroll.load() | ||
76 | // TODO: | 80 | // TODO: | ||
77 | // scrollbutton.load() | 81 | // scrollbutton.load() | ||
78 | 82 | | |||
79 | loading = false | 83 | loading = false | ||
80 | } | 84 | } | ||
81 | 85 | | |||
82 | Controls.ScrollView { | 86 | Kirigami.FormLayout { | ||
83 | anchors.fill: parent | 87 | id: formLayout | ||
84 | | ||||
85 | Layouts.ColumnLayout { | | |||
86 | id: maincol | | |||
87 | enabled: touchpadCount | | |||
88 | spacing: units.largeSpacing | | |||
89 | | ||||
90 | Layouts.RowLayout { | | |||
91 | spacing: units.largeSpacing | | |||
92 | Layouts.Layout.leftMargin: 0.1 * parent.width | | |||
93 | Layouts.Layout.rightMargin: 0.1 * parent.width | | |||
94 | | ||||
95 | Controls.Label { | | |||
96 | text: i18n("Device:") | | |||
97 | } | | |||
98 | 88 | | |||
89 | // Device | ||||
99 | Controls.ComboBox { | 90 | Controls.ComboBox { | ||
91 | Kirigami.FormData.label: i18n("Device:") | ||||
100 | id: deviceSelector | 92 | id: deviceSelector | ||
101 | enabled: touchpadCount > 1 | 93 | enabled: touchpadCount > 1 | ||
102 | Layouts.Layout.fillWidth: true | 94 | //Layouts.Layout.fillWidth: true | ||
furkantokac: This will go if nobody tells me it is necessary. I couldn't find any use case that this will be… | |||||
95 | implicitWidth: units.gridUnit * 10 | ||||
103 | model: deviceModel | 96 | model: deviceModel | ||
104 | textRole: "name" | 97 | textRole: "name" | ||
105 | 98 | | |||
106 | onCurrentIndexChanged: { | 99 | onCurrentIndexChanged: { | ||
107 | if (touchpadCount) { | 100 | if (touchpadCount) { | ||
108 | touchpad = deviceModel[currentIndex] | 101 | touchpad = deviceModel[currentIndex] | ||
109 | if (!loading) { | 102 | if (!loading) { | ||
110 | changeSignal() | 103 | changeSignal() | ||
111 | } | 104 | } | ||
I'm against this change for several reasons:
romangg: I'm against this change for several reasons:
* In general control elements shouldn't be… | |||||
112 | console.log("Touchpad configuration of device '" + | 105 | console.log("Touchpad configuration of device '" + | ||
113 | (currentIndex+1) + " : " + touchpad.name + "' opened") | 106 | (currentIndex+1) + " : " + touchpad.name + "' opened") | ||
114 | } | 107 | } | ||
115 | root.syncValuesFromBackend() | 108 | root.syncValuesFromBackend() | ||
116 | } | 109 | } | ||
117 | } | 110 | } | ||
118 | } | | |||
119 | 111 | | |||
120 | Row { | 112 | Kirigami.Separator { | ||
121 | spacing: units.largeSpacing * 2 | 113 | } | ||
122 | | ||||
123 | Column { | | |||
124 | spacing: units.smallSpacing * 2 | | |||
125 | 114 | | |||
126 | Column { | 115 | // 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 { | 116 | Controls.CheckBox { | ||
117 | Kirigami.FormData.label: i18n("General settings:") | ||||
139 | id: deviceEnabled | 118 | id: deviceEnabled | ||
140 | text: i18n("Device enabled") | 119 | text: i18n("Device enabled") | ||
141 | 120 | | |||
142 | function load() { | 121 | function load() { | ||
143 | if (!maincol.enabled) { | 122 | if (!formLayout.enabled) { | ||
144 | checked = false | 123 | checked = false | ||
145 | return | 124 | return | ||
146 | } | 125 | } | ||
147 | enabled = touchpad.supportsDisableEvents | 126 | enabled = touchpad.supportsDisableEvents | ||
148 | checked = enabled && touchpad.enabled | 127 | checked = enabled && touchpad.enabled | ||
149 | } | 128 | } | ||
150 | 129 | | |||
151 | onCheckedChanged: { | 130 | onCheckedChanged: { | ||
152 | if (enabled && !root.loading) { | 131 | if (enabled && !root.loading) { | ||
153 | touchpad.enabled = checked | 132 | touchpad.enabled = checked | ||
154 | root.changeSignal() | 133 | root.changeSignal() | ||
155 | } | 134 | } | ||
156 | } | 135 | } | ||
157 | 136 | | |||
158 | ToolTip { | 137 | ToolTip { | ||
159 | text: i18n("Accept input through this device.") | 138 | text: i18n("Accept input through this device.") | ||
160 | } | 139 | } | ||
161 | } | 140 | } | ||
162 | 141 | | |||
163 | Controls.CheckBox { | 142 | Controls.CheckBox { | ||
164 | id: dwt | 143 | id: dwt | ||
165 | text: i18n("Disable while typing") | 144 | text: i18n("Disable while typing") | ||
166 | 145 | | |||
167 | function load() { | 146 | function load() { | ||
168 | if (!maincol.enabled) { | 147 | if (!formLayout.enabled) { | ||
169 | checked = false | 148 | checked = false | ||
170 | return | 149 | return | ||
171 | } | 150 | } | ||
172 | enabled = touchpad.supportsDisableWhileTyping | 151 | enabled = touchpad.supportsDisableWhileTyping | ||
173 | checked = enabled && touchpad.disableWhileTyping | 152 | checked = enabled && touchpad.disableWhileTyping | ||
174 | } | 153 | } | ||
175 | 154 | | |||
176 | onCheckedChanged: { | 155 | onCheckedChanged: { | ||
177 | if (enabled && !root.loading) { | 156 | if (enabled && !root.loading) { | ||
178 | touchpad.disableWhileTyping = checked | 157 | touchpad.disableWhileTyping = checked | ||
179 | root.changeSignal() | 158 | root.changeSignal() | ||
180 | } | 159 | } | ||
181 | } | 160 | } | ||
182 | 161 | | |||
183 | ToolTip { | 162 | ToolTip { | ||
184 | text: i18n("Disable touchpad while typing to prevent accidental inputs.") | 163 | text: i18n("Disable touchpad while typing to prevent accidental inputs.") | ||
185 | } | 164 | } | ||
186 | } | 165 | } | ||
187 | 166 | | |||
188 | Controls.CheckBox { | 167 | Controls.CheckBox { | ||
189 | id: leftHanded | 168 | id: leftHanded | ||
190 | text: i18n("Left handed mode") | 169 | text: i18n("Left handed mode") | ||
191 | 170 | | |||
192 | function load() { | 171 | function load() { | ||
193 | if (!maincol.enabled) { | 172 | if (!formLayout.enabled) { | ||
194 | checked = false | 173 | checked = false | ||
195 | return | 174 | return | ||
196 | } | 175 | } | ||
197 | enabled = touchpad.supportsLeftHanded | 176 | enabled = touchpad.supportsLeftHanded | ||
198 | checked = enabled && touchpad.leftHanded | 177 | checked = enabled && touchpad.leftHanded | ||
199 | } | 178 | } | ||
200 | 179 | | |||
201 | onCheckedChanged: { | 180 | onCheckedChanged: { | ||
202 | if (enabled && !root.loading) { | 181 | if (enabled && !root.loading) { | ||
203 | touchpad.leftHanded = checked | 182 | touchpad.leftHanded = checked | ||
204 | root.changeSignal() | 183 | root.changeSignal() | ||
205 | } | 184 | } | ||
206 | } | 185 | } | ||
207 | 186 | | |||
208 | ToolTip { | 187 | ToolTip { | ||
209 | text: i18n("Swap left and right buttons.") | 188 | text: i18n("Swap left and right buttons.") | ||
210 | } | 189 | } | ||
211 | } | 190 | } | ||
212 | 191 | | |||
213 | Controls.CheckBox { | 192 | Controls.CheckBox { | ||
214 | id: middleEmulation | 193 | id: middleEmulation | ||
215 | text: i18n("Emulate middle button") | 194 | text: i18n("Emulate middle button") | ||
ngraham: "Press left and right buttons for middle click" | |||||
216 | 195 | | |||
217 | function load() { | 196 | function load() { | ||
218 | if (!maincol.enabled) { | 197 | if (!formLayout.enabled) { | ||
219 | checked = false | 198 | checked = false | ||
220 | return | 199 | return | ||
221 | } | 200 | } | ||
222 | enabled = touchpad.supportsMiddleEmulation | 201 | enabled = touchpad.supportsMiddleEmulation | ||
223 | checked = enabled && touchpad.middleEmulation | 202 | checked = enabled && touchpad.middleEmulation | ||
224 | } | 203 | } | ||
225 | 204 | | |||
226 | onCheckedChanged: { | 205 | onCheckedChanged: { | ||
227 | if (enabled && !root.loading) { | 206 | if (enabled && !root.loading) { | ||
228 | touchpad.middleEmulation = checked | 207 | touchpad.middleEmulation = checked | ||
229 | root.changeSignal() | 208 | root.changeSignal() | ||
230 | } | 209 | } | ||
231 | } | 210 | } | ||
232 | 211 | | |||
233 | ToolTip { | 212 | ToolTip { | ||
234 | text: i18n("Clicking left and right button simultaneously sends middle button click.") | 213 | text: i18n("Clicking left and right button simultaneously sends middle button click.") | ||
235 | } | 214 | } | ||
236 | } | 215 | } | ||
237 | } | | |||
238 | } | | |||
239 | } | | |||
240 | } | | |||
241 | 216 | | |||
242 | Column { | 217 | Kirigami.Separator { | ||
243 | leftPadding: units.smallSpacing | | |||
244 | Column { | | |||
245 | spacing: units.smallSpacing | | |||
246 | Controls.Label { | | |||
247 | text: i18n("Acceleration:") | | |||
248 | } | 218 | } | ||
249 | 219 | | |||
250 | Column { | 220 | // Acceleration | ||
251 | leftPadding: units.smallSpacing | | |||
252 | Column { | | |||
253 | spacing: units.smallSpacing * 2 | | |||
254 | | ||||
255 | Row { | | |||
256 | Controls.Slider { | 221 | Controls.Slider { | ||
222 | Kirigami.FormData.label: i18n("Acceleration:") | ||||
257 | id: accelSpeed | 223 | id: accelSpeed | ||
258 | anchors.verticalCenter: parent.verticalCenter | | |||
259 | 224 | | |||
260 | tickmarksEnabled: true | 225 | tickmarksEnabled: true | ||
261 | 226 | | |||
262 | minimumValue: 1 | 227 | minimumValue: 1 | ||
263 | maximumValue: 10 | 228 | maximumValue: 10 | ||
264 | stepSize: 1 | 229 | stepSize: 1 | ||
265 | 230 | | |||
266 | implicitWidth: units.gridUnit * 9 | 231 | implicitWidth: units.gridUnit * 9 | ||
Show All 11 Lines | |||||
278 | onValueChanged: { | 243 | onValueChanged: { | ||
279 | if (touchpad != undefined && enabled && !root.loading) { | 244 | if (touchpad != undefined && enabled && !root.loading) { | ||
280 | // transform slider range [1, 10] to libinput's pointer acceleration range [-1, 1] | 245 | // 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 | 246 | touchpad.pointerAcceleration = Math.round( (value - 5.5) / 4.5 * 100 ) / 100 | ||
282 | root.changeSignal() | 247 | root.changeSignal() | ||
283 | } | 248 | } | ||
284 | } | 249 | } | ||
285 | } | 250 | } | ||
286 | } | | |||
287 | 251 | | |||
288 | ExclGroupBox { | 252 | ExclGroupBox { | ||
253 | Kirigami.FormData.label: i18n("Acceleration Profile:") | ||||
289 | id: accelProfile | 254 | id: accelProfile | ||
290 | label: i18n("Acceleration Profile:") | | |||
291 | model: [i18n("Flat"), i18n("Adaptive")] | 255 | model: [i18n("Flat"), i18n("Adaptive")] | ||
292 | 256 | | |||
293 | function load() { | 257 | function load() { | ||
294 | enabled = touchpad.supportsPointerAccelerationProfileAdaptive | 258 | enabled = touchpad.supportsPointerAccelerationProfileAdaptive | ||
295 | 259 | | |||
296 | if (!enabled) { | 260 | if (!enabled) { | ||
297 | itemAt(0).checked = false | 261 | itemAt(0).checked = false | ||
298 | itemAt(1).checked = false | 262 | itemAt(1).checked = false | ||
Show All 10 Lines | |||||
309 | onCurrentChanged: { | 273 | onCurrentChanged: { | ||
310 | if (enabled && !root.loading) { | 274 | if (enabled && !root.loading) { | ||
311 | touchpad.pointerAccelerationProfileFlat = itemAt(0).checked | 275 | touchpad.pointerAccelerationProfileFlat = itemAt(0).checked | ||
312 | touchpad.pointerAccelerationProfileAdaptive = itemAt(1).checked | 276 | touchpad.pointerAccelerationProfileAdaptive = itemAt(1).checked | ||
313 | root.changeSignal() | 277 | root.changeSignal() | ||
314 | } | 278 | } | ||
315 | } | 279 | } | ||
316 | } | 280 | } | ||
317 | } | | |||
318 | } | | |||
319 | } | | |||
320 | } | | |||
321 | 281 | | |||
322 | Column { | 282 | Kirigami.Separator { | ||
323 | leftPadding: units.smallSpacing | | |||
324 | Column { | | |||
325 | spacing: units.smallSpacing | | |||
326 | Controls.Label { | | |||
327 | text: i18n("Tapping:") | | |||
328 | } | 283 | } | ||
329 | 284 | | |||
330 | Column { | 285 | // Tapping | ||
331 | leftPadding: units.smallSpacing | | |||
332 | Column { | | |||
333 | spacing: units.smallSpacing | | |||
334 | Controls.CheckBox { | 286 | Controls.CheckBox { | ||
287 | Kirigami.FormData.label: i18n("Tapping:") | ||||
335 | id: tapToClick | 288 | id: tapToClick | ||
336 | text: i18n("Tap-to-click") | 289 | text: i18n("Tap-to-click") | ||
337 | 290 | | |||
338 | function load() { | 291 | function load() { | ||
339 | enabled = touchpad.tapFingerCount > 0 | 292 | enabled = touchpad.tapFingerCount > 0 | ||
340 | checked = enabled && touchpad.tapToClick | 293 | checked = enabled && touchpad.tapToClick | ||
341 | } | 294 | } | ||
342 | 295 | | |||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Line(s) | 355 | if (enabled && !root.loading) { | |||
404 | root.changeSignal() | 357 | root.changeSignal() | ||
405 | } | 358 | } | ||
406 | } | 359 | } | ||
407 | 360 | | |||
408 | ToolTip { | 361 | ToolTip { | ||
409 | text: i18n("Dragging continues after a short finger lift.") | 362 | text: i18n("Dragging continues after a short finger lift.") | ||
410 | } | 363 | } | ||
411 | } | 364 | } | ||
412 | } | | |||
413 | } | | |||
414 | } | | |||
415 | } | | |||
416 | } | | |||
417 | 365 | | |||
418 | Column { | | |||
419 | spacing: units.smallSpacing * 2 | | |||
420 | | ||||
421 | Column { | | |||
422 | leftPadding: units.smallSpacing | | |||
423 | Column { | | |||
424 | leftPadding: units.smallSpacing | | |||
425 | ExclGroupBox { | 366 | ExclGroupBox { | ||
367 | Kirigami.FormData.label: i18n("Multi tapping:") | ||||
426 | id: multiTap | 368 | id: multiTap | ||
427 | label: i18n("Multi tapping:") | | |||
428 | 369 | | |||
429 | function load() { | 370 | function load() { | ||
430 | enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked | 371 | enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked | ||
431 | if (touchpad.tapFingerCount > 2) { | 372 | if (touchpad.tapFingerCount > 2) { | ||
432 | model = [i18n("Two-tap right, three middle"), i18n("Two-tap middle, three right")] | 373 | model = [i18n("Two-tap right, three middle"), i18n("Two-tap middle, three right")] | ||
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.") | 374 | itemAt(0).tooltiptext = i18n("Tap with two fingers triggers a right click, tap with three fingers a middle 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.") | 375 | itemAt(1).tooltiptext = i18n("Tap with two fingers triggers a middle click, tap with three fingers a right click.") | ||
435 | } else { | 376 | } else { | ||
436 | model = [i18n("Two-tap right click"), i18n("Two-tap middle click")] | 377 | model = [i18n("Two-tap right click"), i18n("Two-tap middle click")] | ||
437 | itemAt(0).tooltiptext = i18n("Tap with two fingers triggers a right click.") | 378 | itemAt(0).tooltiptext = i18n("Tap with two fingers triggers a right click.") | ||
438 | itemAt(1).tooltiptext = i18n("Tap with two fingers triggers a middle click.") | 379 | itemAt(1).tooltiptext = i18n("Tap with two fingers triggers a middle click.") | ||
439 | } | 380 | } | ||
440 | 381 | | |||
441 | if (!enabled) { | 382 | if (!enabled) { | ||
442 | itemAt(0).checked = false | 383 | itemAt(0).checked = false | ||
443 | itemAt(1).checked = false | 384 | itemAt(1).checked = false | ||
444 | return | 385 | return | ||
445 | } | 386 | } | ||
446 | var toCheck = touchpad.lmrTapButtonMap ? 1 : 0 | 387 | var toCheck = touchpad.lmrTapButtonMap ? 1 : 0 | ||
447 | itemAt(toCheck).checked = true | 388 | itemAt(toCheck).checked = true | ||
448 | } | 389 | } | ||
449 | 390 | | |||
450 | onCurrentChanged: { | 391 | onCurrentChanged: { | ||
451 | if (enabled && !root.loading) { | 392 | if (enabled && !root.loading) { | ||
452 | touchpad.lmrTapButtonMap = itemAt(1).checked | 393 | touchpad.lmrTapButtonMap = itemAt(1).checked | ||
453 | root.changeSignal() | 394 | root.changeSignal() | ||
454 | } | 395 | } | ||
455 | } | 396 | } | ||
456 | } | 397 | } | ||
457 | } | | |||
458 | } | | |||
459 | 398 | | |||
460 | Column { | 399 | Kirigami.Separator { | ||
461 | leftPadding: units.smallSpacing | | |||
462 | Column { | | |||
463 | spacing: units.smallSpacing | | |||
464 | Controls.Label { | | |||
465 | text: i18n("Scrolling:") | | |||
466 | } | 400 | } | ||
467 | 401 | | |||
468 | Column { | 402 | // Scrolling | ||
469 | leftPadding: units.smallSpacing | | |||
470 | Column { | | |||
471 | spacing: units.smallSpacing | | |||
472 | ExclGroupBox { | 403 | ExclGroupBox { | ||
404 | Kirigami.FormData.label: i18n("Scroll method:") | ||||
473 | id: scrollmethod | 405 | id: scrollmethod | ||
474 | label: i18n("Scroll method:") | | |||
475 | model: [i18n("Two fingers"), i18n("Touchpad edges"), /*i18n("On Button down"),*/ i18n("No scroll")] | 406 | model: [i18n("Two fingers"), i18n("Touchpad edges"), /*i18n("On Button down"),*/ i18n("No scroll")] | ||
476 | 407 | | |||
477 | property bool isNoScroll: true | 408 | property bool isNoScroll: true | ||
478 | 409 | | |||
479 | function load() { | 410 | function load() { | ||
480 | itemAt(0).enabled = touchpad.supportsScrollTwoFinger | 411 | itemAt(0).enabled = touchpad.supportsScrollTwoFinger | ||
481 | itemAt(1).enabled = touchpad.supportsScrollEdge | 412 | itemAt(1).enabled = touchpad.supportsScrollEdge | ||
482 | // TODO: | 413 | // TODO: | ||
483 | // itemAt(2).enabled = touchpad.supportsScrollOnButtonDown | 414 | // itemAt(2).enabled = touchpad.supportsScrollOnButtonDown | ||
484 | 415 | | |||
485 | var toCheck = 2 | 416 | var toCheck = 2 | ||
486 | if (itemAt(0).enabled && touchpad.scrollTwoFinger) { | 417 | if (itemAt(0).enabled && touchpad.scrollTwoFinger) { | ||
487 | toCheck = 0 | 418 | toCheck = 0 | ||
488 | } else if (itemAt(1).enabled && touchpad.scrollEdge) { | 419 | } else if (itemAt(1).enabled && touchpad.scrollEdge) { | ||
489 | toCheck = 1 | 420 | toCheck = 1 | ||
490 | // } else if (itemAt(2).enabled && touchpad.scrollOnButtonDown) { | 421 | // } else if (itemAt(2).enabled && touchpad.scrollOnButtonDown) { | ||
491 | // toCheck = 2 | 422 | // toCheck = 2 | ||
492 | } | 423 | } | ||
493 | itemAt(0).tooltiptext = i18n("Slide with two fingers scrolls.") | 424 | itemAt(0).tooltiptext = i18n("Slide with two fingers scrolls.") | ||
494 | itemAt(1).tooltiptext = i18n("Slide on the touchpad edges scrolls.") | 425 | itemAt(1).tooltiptext = i18n("Slide on the touchpad edges scrolls.") | ||
495 | itemAt(2).tooltiptext = i18n("All forms of touchpad scrolling are deactivated.") | 426 | itemAt(2).tooltiptext = i18n("All forms of touchpad scrolling are deactivated.") | ||
496 | 427 | | |||
497 | isNoScroll = (toCheck == 2) | 428 | isNoScroll = (toCheck == 2) | ||
498 | itemAt(toCheck).checked = maincol.enabled | 429 | itemAt(toCheck).checked = formLayout.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 | 436 | // touchpad.scrollOnButtonDown = itemAt(2).checked | ||
506 | root.changeSignal() | 437 | root.changeSignal() | ||
507 | } | 438 | } | ||
508 | isNoScroll = itemAt(2).checked | 439 | isNoScroll = itemAt(2).checked | ||
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… | |||||
509 | loading = true | 440 | loading = true | ||
510 | naturalScroll.load() | 441 | naturalScroll.load() | ||
511 | loading = false | 442 | loading = false | ||
512 | } | 443 | } | ||
513 | } | 444 | } | ||
514 | 445 | | |||
515 | Controls.CheckBox { | 446 | Controls.CheckBox { | ||
516 | id: naturalScroll | 447 | id: naturalScroll | ||
Show All 10 Lines | 456 | if (enabled && !root.loading) { | |||
527 | root.changeSignal() | 458 | root.changeSignal() | ||
528 | } | 459 | } | ||
529 | } | 460 | } | ||
530 | 461 | | |||
531 | ToolTip { | 462 | ToolTip { | ||
532 | text: i18n("Touchscreen like scrolling.") | 463 | text: i18n("Touchscreen like scrolling.") | ||
533 | } | 464 | } | ||
534 | } | 465 | } | ||
535 | } | 466 | } // END Kirigami.FormLayout | ||
536 | } | 467 | } // 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.