Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpad/src/kcm/libinput/main.qml
Show All 12 Lines | |||||
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. | ||
14 | * | 14 | * | ||
15 | * 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 | ||
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software | ||
17 | * 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. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.7 | 20 | import QtQuick 2.7 | ||
21 | import QtQuick.Controls 1.4 as Controls | 21 | import QtQuick.Controls 2.0 as Controls | ||
22 | import QtQuick.Layouts 1.3 as Layouts | 22 | import QtQuick.Layouts 1.3 as Layouts | ||
23 | import QtQuick.Controls.Styles 1.4 as Styles | 23 | import QtQuick.Controls.Styles 1.4 as Styles | ||
davidedmundson: this is either unused or wrong | |||||
mart: he's using qqc1 tooltips, they should be ported as well. | |||||
24 | 24 | | |||
25 | import org.kde.kcm 1.1 as KCM | 25 | import org.kde.kcm 1.1 as KCM | ||
26 | import org.kde.kirigami 2.4 as Kirigami | 26 | import org.kde.kirigami 2.4 as Kirigami | ||
27 | import org.kde.plasma.core 2.0 as PlasmaCore | | |||
28 | 27 | | |||
29 | import "components" | 28 | import "components" | ||
30 | 29 | | |||
31 | Kirigami.Page { | 30 | // TODO: Change ScrollablePage as KCM.SimpleKCM | ||
31 | // after rewrite the KCM in KConfigModule. | ||||
32 | Kirigami.ScrollablePage { | ||||
32 | id: root | 33 | id: root | ||
33 | 34 | | |||
35 | spacing: Kirigami.Units.smallSpacing | ||||
36 | | ||||
37 | property size sizeHint: Qt.size(formLayout.width, formLayout.height) | ||||
Saying the size hint is the size it currently is looks wrong generally speaking: width propagates from parent to child davidedmundson: Saying the size hint is the size it currently is looks wrong
generally speaking:
width… | |||||
and what those sizehint properties are used for at all? they look wrong, mart: and what those sizehint properties are used for at all? they look wrong,
you either have… | |||||
38 | property size minimumSizeHint: Qt.size(formLayout.width/2, deviceSelector.height) | ||||
39 | | ||||
34 | property alias deviceIndex: deviceSelector.currentIndex | 40 | property alias deviceIndex: deviceSelector.currentIndex | ||
35 | signal changeSignal() | 41 | signal changeSignal() | ||
36 | 42 | | |||
37 | property QtObject touchpad | 43 | property QtObject touchpad | ||
38 | property int touchpadCount: backend.touchpadCount | 44 | property int touchpadCount: backend.touchpadCount | ||
39 | 45 | | |||
40 | property bool loading: false | 46 | property bool loading: false | ||
41 | 47 | | |||
Show All 36 Lines | |||||
78 | // scrollbutton.load() | 84 | // scrollbutton.load() | ||
79 | 85 | | |||
80 | loading = false | 86 | loading = false | ||
81 | } | 87 | } | ||
82 | 88 | | |||
83 | Kirigami.FormLayout { | 89 | Kirigami.FormLayout { | ||
84 | id: formLayout | 90 | id: formLayout | ||
85 | 91 | | |||
86 | topPadding: root.topPadding | | |||
87 | leftPadding: root.leftPadding | | |||
88 | rightPadding: root.rightPadding | | |||
89 | bottomPadding: root.bottomPadding | | |||
90 | anchors { | | |||
91 | fill: parent | | |||
92 | topMargin: root.header ? root.header.height : 0 | | |||
93 | bottomMargin: root.footer ? root.footer.height : 0 | | |||
94 | } | | |||
95 | | ||||
96 | // Device | 92 | // Device | ||
97 | Controls.ComboBox { | 93 | Controls.ComboBox { | ||
98 | Kirigami.FormData.label: i18n("Device:") | 94 | Kirigami.FormData.label: i18n("Device:") | ||
99 | id: deviceSelector | 95 | id: deviceSelector | ||
100 | enabled: touchpadCount > 1 | 96 | enabled: touchpadCount > 1 | ||
101 | implicitWidth: units.gridUnit * 16 | 97 | implicitWidth: units.gridUnit * 16 | ||
102 | Layouts.Layout.fillWidth: true | 98 | Layouts.Layout.fillWidth: true | ||
103 | model: deviceModel | 99 | model: deviceModel | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | |||||
197 | } | 193 | } | ||
198 | 194 | | |||
199 | Controls.CheckBox { | 195 | Controls.CheckBox { | ||
200 | id: middleEmulation | 196 | id: middleEmulation | ||
201 | text: i18n("Press left and right buttons for middle click") | 197 | text: i18n("Press left and right buttons for middle click") | ||
202 | 198 | | |||
203 | function load() { | 199 | function load() { | ||
204 | if (!formLayout.enabled) { | 200 | if (!formLayout.enabled) { | ||
205 | checked = false | 201 | checked = false | ||
romangg: typo | |||||
206 | return | 202 | return | ||
207 | } | 203 | } | ||
208 | enabled = touchpad.supportsMiddleEmulation | 204 | enabled = touchpad.supportsMiddleEmulation | ||
209 | checked = enabled && touchpad.middleEmulation | 205 | checked = enabled && touchpad.middleEmulation | ||
210 | } | 206 | } | ||
211 | 207 | | |||
212 | onCheckedChanged: { | 208 | onCheckedChanged: { | ||
213 | if (enabled && !root.loading) { | 209 | if (enabled && !root.loading) { | ||
Show All 10 Lines | |||||
224 | Kirigami.Separator { | 220 | Kirigami.Separator { | ||
225 | } | 221 | } | ||
226 | 222 | | |||
227 | // Acceleration | 223 | // Acceleration | ||
228 | Controls.Slider { | 224 | Controls.Slider { | ||
229 | Kirigami.FormData.label: i18n("Pointer speed:") | 225 | Kirigami.FormData.label: i18n("Pointer speed:") | ||
230 | id: accelSpeed | 226 | id: accelSpeed | ||
231 | 227 | | |||
232 | tickmarksEnabled: true | 228 | from: 1 | ||
233 | 229 | to: 10 | |||
234 | minimumValue: 1 | | |||
235 | maximumValue: 10 | | |||
236 | stepSize: 1 | 230 | stepSize: 1 | ||
237 | 231 | | |||
238 | implicitWidth: units.gridUnit * 9 | | |||
239 | | ||||
240 | function load() { | 232 | function load() { | ||
241 | enabled = touchpad.supportsPointerAcceleration | 233 | enabled = touchpad.supportsPointerAcceleration | ||
242 | if (!enabled) { | 234 | if (!enabled) { | ||
243 | value = 0.1 | 235 | value = 0.1 | ||
244 | return | 236 | return | ||
245 | } | 237 | } | ||
246 | // transform libinput's pointer acceleration range [-1, 1] to slider range [1, 10] | 238 | // transform libinput's pointer acceleration range [-1, 1] to slider range [1, 10] | ||
247 | value = 4.5 * touchpad.pointerAcceleration + 5.5 | 239 | value = 4.5 * touchpad.pointerAcceleration + 5.5 | ||
248 | } | 240 | } | ||
249 | 241 | | |||
250 | onValueChanged: { | 242 | onValueChanged: { | ||
251 | if (touchpad != undefined && enabled && !root.loading) { | 243 | if (touchpad != undefined && enabled && !root.loading) { | ||
252 | // transform slider range [1, 10] to libinput's pointer acceleration range [-1, 1] | 244 | // transform slider range [1, 10] to libinput's pointer acceleration range [-1, 1] | ||
253 | touchpad.pointerAcceleration = Math.round( (value - 5.5) / 4.5 * 100 ) / 100 | 245 | touchpad.pointerAcceleration = Math.round( (value - 5.5) / 4.5 * 100 ) / 100 | ||
254 | root.changeSignal() | 246 | root.changeSignal() | ||
255 | } | 247 | } | ||
256 | } | 248 | } | ||
257 | } | 249 | } | ||
258 | 250 | | |||
259 | ExclGroupBox { | 251 | Layouts.ColumnLayout { | ||
260 | Kirigami.FormData.label: i18n("Acceleration profile:") | | |||
261 | id: accelProfile | 252 | id: accelProfile | ||
262 | model: [i18n("Flat"), i18n("Adaptive")] | 253 | Kirigami.FormData.label: i18n("Acceleration profile:") | ||
254 | Kirigami.FormData.buddyFor: accelProfileFlat | ||||
255 | spacing: Kirigami.Units.smallSpacing | ||||
263 | 256 | | |||
264 | function load() { | 257 | function load() { | ||
265 | enabled = touchpad.supportsPointerAccelerationProfileAdaptive | 258 | enabled = touchpad.supportsPointerAccelerationProfileAdaptive | ||
266 | 259 | | |||
267 | if (!enabled) { | 260 | if (!enabled) { | ||
268 | itemAt(0).checked = false | 261 | accelProfileFlat.checked = false | ||
269 | itemAt(1).checked = false | 262 | accelProfileAdaptive.checked = false | ||
270 | return | 263 | return | ||
271 | } | 264 | } | ||
272 | 265 | | |||
273 | itemAt(0).tooltiptext = i18n("Cursor moves the same distance as finger.") | 266 | if(touchpad.pointerAccelerationProfileAdaptive) { | ||
274 | itemAt(1).tooltiptext = i18n("Cursor travel distance depends on movement speed of finger.") | 267 | accelProfileAdaptive.checked = true | ||
275 | 268 | } else { | |||
276 | var toCheck = touchpad.pointerAccelerationProfileAdaptive ? 1 : 0 | 269 | accelProfileFlat.checked = true | ||
277 | itemAt(toCheck).checked = true | 270 | } | ||
278 | } | 271 | } | ||
279 | 272 | | |||
280 | onCurrentChanged: { | 273 | function syncCurrent() { | ||
281 | if (enabled && !root.loading) { | 274 | if (enabled && !root.loading) { | ||
282 | touchpad.pointerAccelerationProfileFlat = itemAt(0).checked | 275 | touchpad.pointerAccelerationProfileFlat = accelProfileFlat.checked | ||
283 | touchpad.pointerAccelerationProfileAdaptive = itemAt(1).checked | 276 | touchpad.pointerAccelerationProfileAdaptive = accelProfileAdaptive.checked | ||
284 | root.changeSignal() | 277 | root.changeSignal() | ||
285 | } | 278 | } | ||
286 | } | 279 | } | ||
280 | | ||||
281 | Controls.RadioButton { | ||||
282 | id: accelProfileFlat | ||||
283 | text: i18n("Flat") | ||||
284 | | ||||
285 | ToolTip { | ||||
i guess this is the thing that comes from styles 1.4 mart: i guess this is the thing that comes from styles 1.4
there is also a qqc2 ToolTip element… | |||||
286 | text: i18n("Cursor moves the same distance as finger.") | ||||
287 | } | ||||
288 | onCheckedChanged: accelProfile.syncCurrent() | ||||
289 | } | ||||
290 | | ||||
291 | Controls.RadioButton { | ||||
292 | id: accelProfileAdaptive | ||||
293 | text: i18n("Adaptive") | ||||
294 | | ||||
295 | ToolTip { | ||||
296 | text: i18n("Cursor travel distance depends on movement speed of finger.") | ||||
297 | } | ||||
298 | onCheckedChanged: accelProfile.syncCurrent() | ||||
299 | } | ||||
287 | } | 300 | } | ||
288 | 301 | | |||
289 | Kirigami.Separator { | 302 | Kirigami.Separator { | ||
290 | } | 303 | } | ||
291 | 304 | | |||
292 | // Tapping | 305 | // Tapping | ||
293 | Controls.CheckBox { | 306 | Controls.CheckBox { | ||
294 | Kirigami.FormData.label: i18n("Tapping:") | 307 | Kirigami.FormData.label: i18n("Tapping:") | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 374 | onCheckedChanged: { | |||
365 | } | 378 | } | ||
366 | } | 379 | } | ||
367 | 380 | | |||
368 | ToolTip { | 381 | ToolTip { | ||
369 | text: i18n("Dragging continues after a short finger lift.") | 382 | text: i18n("Dragging continues after a short finger lift.") | ||
370 | } | 383 | } | ||
371 | } | 384 | } | ||
372 | 385 | | |||
373 | ExclGroupBox { | 386 | Layouts.ColumnLayout { | ||
374 | Kirigami.FormData.label: i18n("Two-finger tap:") | | |||
375 | id: multiTap | 387 | id: multiTap | ||
388 | Kirigami.FormData.label: i18n("Two-finger tap:") | ||||
389 | Kirigami.FormData.buddyFor: multiTapRightClick | ||||
390 | spacing: Kirigami.Units.smallSpacing | ||||
376 | 391 | | |||
377 | function load() { | 392 | function load() { | ||
378 | enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked | 393 | enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked | ||
379 | if (touchpad.tapFingerCount > 2) { | 394 | if (touchpad.tapFingerCount > 2) { | ||
380 | model = [i18n("Right-click (three-finger tap to middle-click)"), | 395 | multiTapRightClick.text = i18n("Right-click (three-finger tap to middle-click)") | ||
381 | i18n("Middle-click (three-finger tap right-click)")] | 396 | multiTapRightClick.tooltiptext = i18n("Tap with two fingers to right-click, tap with three fingers to middle-click.") | ||
382 | itemAt(0).tooltiptext = i18n("Tap with two fingers to right-click, tap with three fingers to middle-click.") | 397 | | ||
383 | itemAt(1).tooltiptext = i18n("Tap with two fingers to middle-click, tap with three fingers to right-click.") | 398 | multiTapMiddleClick.text = i18n("Middle-click (three-finger tap right-click)") | ||
399 | multiTapMiddleClick.tooltiptext = i18n("Tap with two fingers to middle-click, tap with three fingers to right-click.") | ||||
384 | } else { | 400 | } else { | ||
385 | model = [i18n("Righ-click"), i18n("Middle-click")] | 401 | multiTapRightClick.text = i18n("Righ-click") | ||
386 | itemAt(0).tooltiptext = i18n("Tap with two fingers to right-click.") | 402 | multiTapRightClick.tooltiptext = i18n("Tap with two fingers to right-click.") | ||
387 | itemAt(1).tooltiptext = i18n("Tap with two fingers to middle-click.") | 403 | | ||
404 | multiTapMiddleClick.text = i18n("Middle-click") | ||||
405 | multiTapMiddleClick.tooltiptext = i18n("Tap with two fingers to middle-click.") | ||||
388 | } | 406 | } | ||
389 | 407 | | |||
390 | if (!enabled) { | 408 | if (!enabled) { | ||
391 | itemAt(0).checked = false | 409 | multiTapRightClick.checked = false | ||
392 | itemAt(1).checked = false | 410 | multiTapMiddleClick.checked = false | ||
393 | return | 411 | return | ||
394 | } | 412 | } | ||
395 | var toCheck = touchpad.lmrTapButtonMap ? 1 : 0 | 413 | | ||
396 | itemAt(toCheck).checked = true | 414 | if(touchpad.lmrTapButtonMap) { | ||
415 | multiTapMiddleClick.checked = true | ||||
416 | } else { | ||||
417 | multiTapRightClick.checked = true | ||||
418 | } | ||||
397 | } | 419 | } | ||
398 | 420 | | |||
399 | onCurrentChanged: { | 421 | function syncCurrent() { | ||
400 | if (enabled && !root.loading) { | 422 | if (enabled && !root.loading) { | ||
401 | touchpad.lmrTapButtonMap = itemAt(1).checked | 423 | touchpad.lmrTapButtonMap = multiTapMiddleClick.checked | ||
402 | root.changeSignal() | 424 | root.changeSignal() | ||
403 | } | 425 | } | ||
404 | } | 426 | } | ||
427 | | ||||
428 | Controls.RadioButton { | ||||
429 | id: multiTapRightClick | ||||
430 | property alias tooltiptext: multiTapRightClickTooltip.text | ||||
431 | // Text of this is handled dynamically on load. | ||||
432 | | ||||
433 | ToolTip { | ||||
434 | id: multiTapRightClickTooltip | ||||
435 | // Tooltip of this is handled dynamically on load. | ||||
436 | } | ||||
437 | onCheckedChanged: multiTap.syncCurrent() | ||||
438 | } | ||||
439 | | ||||
440 | Controls.RadioButton { | ||||
441 | id: multiTapMiddleClick | ||||
442 | property alias tooltiptext: multiTapMiddleClickTooltip.text | ||||
443 | // Text of this is handled dynamically on load. | ||||
444 | | ||||
445 | ToolTip { | ||||
446 | id: multiTapMiddleClickTooltip | ||||
447 | // Tooltip of this is handled dynamically on load. | ||||
448 | } | ||||
449 | onCheckedChanged: multiTap.syncCurrent() | ||||
450 | } | ||||
405 | } | 451 | } | ||
406 | 452 | | |||
407 | Kirigami.Separator { | 453 | Kirigami.Separator { | ||
408 | } | 454 | } | ||
409 | 455 | | |||
410 | // Scrolling | 456 | // Scrolling | ||
411 | ExclGroupBox { | 457 | Layouts.ColumnLayout { | ||
412 | Kirigami.FormData.label: i18n("Scrolling:") | | |||
413 | id: scrollmethod | 458 | id: scrollmethod | ||
414 | model: [i18n("Two fingers"), i18n("Touchpad edges")] | 459 | Kirigami.FormData.label: i18n("Scrolling:") | ||
460 | Kirigami.FormData.buddyFor: scrollmethodTwoFingers | ||||
461 | spacing: Kirigami.Units.smallSpacing | ||||
415 | 462 | | |||
416 | function load() { | 463 | function load() { | ||
417 | itemAt(0).enabled = touchpad.supportsScrollTwoFinger | 464 | scrollmethodTwoFingers.enabled = touchpad.supportsScrollTwoFinger | ||
418 | itemAt(1).enabled = touchpad.supportsScrollEdge | 465 | scrollmethodTouchpadEdges.enabled = touchpad.supportsScrollEdge | ||
419 | 466 | | |||
420 | var toCheck = 0 | 467 | if(scrollmethodTouchpadEdges.enabled && touchpad.scrollEdge) { | ||
421 | if (itemAt(0).enabled && touchpad.scrollTwoFinger) { | 468 | scrollmethodTouchpadEdges.checked = formLayout.enabled | ||
422 | toCheck = 0 | 469 | } else { | ||
423 | } else if (itemAt(1).enabled && touchpad.scrollEdge) { | 470 | scrollmethodTwoFingers.checked = formLayout.enabled | ||
424 | toCheck = 1 | | |||
425 | } | 471 | } | ||
426 | itemAt(0).tooltiptext = i18n("Slide with two fingers scrolls.") | | |||
427 | itemAt(1).tooltiptext = i18n("Slide on the touchpad edges scrolls.") | | |||
428 | | ||||
429 | itemAt(toCheck).checked = formLayout.enabled | | |||
430 | } | 472 | } | ||
431 | 473 | | |||
432 | onCurrentChanged: { | 474 | function syncCurrent() { | ||
433 | if (enabled && !root.loading) { | 475 | if (enabled && !root.loading) { | ||
434 | touchpad.scrollTwoFinger = itemAt(0).checked | 476 | touchpad.scrollTwoFinger = scrollmethodTwoFingers.checked | ||
435 | touchpad.scrollEdge = itemAt(1).checked | 477 | touchpad.scrollEdge = scrollmethodTouchpadEdges.checked | ||
436 | root.changeSignal() | 478 | root.changeSignal() | ||
437 | } | 479 | } | ||
438 | loading = true | 480 | loading = true | ||
439 | naturalScroll.load() | 481 | naturalScroll.load() | ||
440 | loading = false | 482 | loading = false | ||
441 | } | 483 | } | ||
484 | | ||||
485 | Controls.RadioButton { | ||||
486 | id: scrollmethodTwoFingers | ||||
487 | text: i18n("Two fingers") | ||||
488 | | ||||
489 | ToolTip { | ||||
490 | text: i18n("Slide with two fingers scrolls.") | ||||
491 | } | ||||
492 | onCheckedChanged: scrollmethod.syncCurrent() | ||||
493 | } | ||||
494 | | ||||
495 | Controls.RadioButton { | ||||
496 | id: scrollmethodTouchpadEdges | ||||
497 | text: i18n("Touchpad edges") | ||||
498 | | ||||
499 | ToolTip { | ||||
500 | text: i18n("Slide on the touchpad edges scrolls.") | ||||
501 | } | ||||
502 | onCheckedChanged: scrollmethod.syncCurrent() | ||||
503 | } | ||||
442 | } | 504 | } | ||
443 | 505 | | |||
444 | Controls.CheckBox { | 506 | Controls.CheckBox { | ||
445 | id: naturalScroll | 507 | id: naturalScroll | ||
446 | text: i18n("Invert scroll direction (Natural scrolling)") | 508 | text: i18n("Invert scroll direction (Natural scrolling)") | ||
447 | 509 | | |||
448 | function load() { | 510 | function load() { | ||
449 | enabled = touchpad.supportsNaturalScroll | 511 | enabled = touchpad.supportsNaturalScroll | ||
Show All 16 Lines |
this is either unused or wrong