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 | | |||
24 | 23 | | |||
davidedmundson: this is either unused or wrong | |||||
mart: he's using qqc1 tooltips, they should be ported as well. | |||||
25 | import org.kde.kcm 1.1 as KCM | 24 | import org.kde.kcm 1.1 as KCM | ||
26 | import org.kde.kirigami 2.4 as Kirigami | 25 | import org.kde.kirigami 2.4 as Kirigami | ||
27 | import org.kde.plasma.core 2.0 as PlasmaCore | | |||
28 | 26 | | |||
29 | import "components" | 27 | // TODO: Change ScrollablePage as KCM.SimpleKCM | ||
30 | 28 | // after rewrite the KCM in KConfigModule. | |||
31 | Kirigami.Page { | 29 | Kirigami.ScrollablePage { | ||
32 | id: root | 30 | id: root | ||
33 | 31 | | |||
32 | spacing: Kirigami.Units.smallSpacing | ||||
33 | | ||||
34 | property size minimumSizeHint: Qt.size(formLayout.width/2, deviceSelector.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… | |||||
35 | | ||||
34 | property alias deviceIndex: deviceSelector.currentIndex | 36 | property alias deviceIndex: deviceSelector.currentIndex | ||
35 | signal changeSignal() | 37 | signal changeSignal() | ||
36 | 38 | | |||
37 | property QtObject touchpad | 39 | property QtObject touchpad | ||
38 | property int touchpadCount: backend.touchpadCount | 40 | property int touchpadCount: backend.touchpadCount | ||
39 | 41 | | |||
40 | property bool loading: false | 42 | property bool loading: false | ||
41 | 43 | | |||
Show All 19 Lines | |||||
61 | function syncValuesFromBackend() { | 63 | function syncValuesFromBackend() { | ||
62 | loading = true | 64 | loading = true | ||
63 | 65 | | |||
64 | deviceEnabled.load() | 66 | deviceEnabled.load() | ||
65 | dwt.load() | 67 | dwt.load() | ||
66 | leftHanded.load() | 68 | leftHanded.load() | ||
67 | accelSpeed.load() | 69 | accelSpeed.load() | ||
68 | accelProfile.load() | 70 | accelProfile.load() | ||
69 | | ||||
70 | tapToClick.load() | 71 | tapToClick.load() | ||
71 | tapAndDrag.load() | 72 | tapAndDrag.load() | ||
72 | tapAndDragLock.load() | 73 | tapAndDragLock.load() | ||
73 | multiTap.load() | 74 | multiTap.load() | ||
74 | 75 | scrollMethod.load() | |||
75 | scrollmethod.load() | | |||
76 | naturalScroll.load() | 76 | naturalScroll.load() | ||
77 | // TODO: | | |||
78 | // scrollbutton.load() | | |||
79 | 77 | | |||
80 | loading = false | 78 | loading = false | ||
81 | } | 79 | } | ||
82 | 80 | | |||
83 | Kirigami.FormLayout { | 81 | Kirigami.FormLayout { | ||
84 | id: formLayout | 82 | id: formLayout | ||
85 | 83 | | |||
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 | 84 | // Device | ||
97 | Controls.ComboBox { | 85 | Controls.ComboBox { | ||
98 | Kirigami.FormData.label: i18n("Device:") | 86 | Kirigami.FormData.label: i18n("Device:") | ||
99 | id: deviceSelector | 87 | id: deviceSelector | ||
88 | | ||||
100 | enabled: touchpadCount > 1 | 89 | enabled: touchpadCount > 1 | ||
101 | implicitWidth: units.gridUnit * 16 | | |||
102 | Layouts.Layout.fillWidth: true | 90 | Layouts.Layout.fillWidth: true | ||
103 | model: deviceModel | 91 | model: deviceModel | ||
104 | textRole: "name" | 92 | textRole: "name" | ||
105 | 93 | | |||
106 | onCurrentIndexChanged: { | 94 | onCurrentIndexChanged: { | ||
107 | if (touchpadCount) { | 95 | if (touchpadCount) { | ||
108 | touchpad = deviceModel[currentIndex] | 96 | touchpad = deviceModel[currentIndex] | ||
109 | if (!loading) { | 97 | if (!loading) { | ||
Show All 10 Lines | |||||
120 | } | 108 | } | ||
121 | 109 | | |||
122 | // General settings | 110 | // General settings | ||
123 | Controls.CheckBox { | 111 | Controls.CheckBox { | ||
124 | Kirigami.FormData.label: i18n("General:") | 112 | Kirigami.FormData.label: i18n("General:") | ||
125 | id: deviceEnabled | 113 | id: deviceEnabled | ||
126 | text: i18n("Device enabled") | 114 | text: i18n("Device enabled") | ||
127 | 115 | | |||
116 | hoverEnabled: true | ||||
117 | Controls.ToolTip { | ||||
118 | text: i18n("Accept input through this device.") | ||||
119 | visible: parent.hovered | ||||
120 | delay: 1000 | ||||
121 | } | ||||
122 | | ||||
128 | function load() { | 123 | function load() { | ||
129 | if (!formLayout.enabled) { | 124 | if (!formLayout.enabled) { | ||
130 | checked = false | 125 | checked = false | ||
131 | return | 126 | return | ||
132 | } | 127 | } | ||
133 | enabled = touchpad.supportsDisableEvents | 128 | enabled = touchpad.supportsDisableEvents | ||
134 | checked = enabled && touchpad.enabled | 129 | checked = enabled && touchpad.enabled | ||
135 | } | 130 | } | ||
136 | 131 | | |||
137 | onCheckedChanged: { | 132 | onCheckedChanged: { | ||
138 | if (enabled && !root.loading) { | 133 | if (enabled && !root.loading) { | ||
139 | touchpad.enabled = checked | 134 | touchpad.enabled = checked | ||
140 | root.changeSignal() | 135 | root.changeSignal() | ||
141 | } | 136 | } | ||
142 | } | 137 | } | ||
143 | | ||||
144 | ToolTip { | | |||
145 | text: i18n("Accept input through this device.") | | |||
146 | } | | |||
147 | } | 138 | } | ||
148 | 139 | | |||
149 | Controls.CheckBox { | 140 | Controls.CheckBox { | ||
150 | id: dwt | 141 | id: dwt | ||
151 | text: i18n("Disable while typing") | 142 | text: i18n("Disable while typing") | ||
152 | 143 | | |||
144 | hoverEnabled: true | ||||
145 | Controls.ToolTip { | ||||
146 | text: i18n("Disable touchpad while typing to prevent accidental inputs.") | ||||
147 | visible: parent.hovered | ||||
148 | delay: 1000 | ||||
149 | } | ||||
150 | | ||||
153 | function load() { | 151 | function load() { | ||
154 | if (!formLayout.enabled) { | 152 | if (!formLayout.enabled) { | ||
155 | checked = false | 153 | checked = false | ||
156 | return | 154 | return | ||
157 | } | 155 | } | ||
158 | enabled = touchpad.supportsDisableWhileTyping | 156 | enabled = touchpad.supportsDisableWhileTyping | ||
159 | checked = enabled && touchpad.disableWhileTyping | 157 | checked = enabled && touchpad.disableWhileTyping | ||
160 | } | 158 | } | ||
161 | 159 | | |||
162 | onCheckedChanged: { | 160 | onCheckedChanged: { | ||
163 | if (enabled && !root.loading) { | 161 | if (enabled && !root.loading) { | ||
164 | touchpad.disableWhileTyping = checked | 162 | touchpad.disableWhileTyping = checked | ||
165 | root.changeSignal() | 163 | root.changeSignal() | ||
166 | } | 164 | } | ||
167 | } | 165 | } | ||
168 | | ||||
169 | ToolTip { | | |||
170 | text: i18n("Disable touchpad while typing to prevent accidental inputs.") | | |||
171 | } | | |||
172 | } | 166 | } | ||
173 | 167 | | |||
174 | Controls.CheckBox { | 168 | Controls.CheckBox { | ||
175 | id: leftHanded | 169 | id: leftHanded | ||
176 | text: i18n("Left handed mode") | 170 | text: i18n("Left handed mode") | ||
177 | 171 | | |||
172 | hoverEnabled: true | ||||
173 | Controls.ToolTip { | ||||
174 | text: i18n("Swap left and right buttons.") | ||||
175 | visible: parent.hovered | ||||
176 | delay: 1000 | ||||
177 | } | ||||
178 | | ||||
178 | function load() { | 179 | function load() { | ||
179 | if (!formLayout.enabled) { | 180 | if (!formLayout.enabled) { | ||
180 | checked = false | 181 | checked = false | ||
181 | return | 182 | return | ||
182 | } | 183 | } | ||
183 | enabled = touchpad.supportsLeftHanded | 184 | enabled = touchpad.supportsLeftHanded | ||
184 | checked = enabled && touchpad.leftHanded | 185 | checked = enabled && touchpad.leftHanded | ||
185 | } | 186 | } | ||
186 | 187 | | |||
187 | onCheckedChanged: { | 188 | onCheckedChanged: { | ||
188 | if (enabled && !root.loading) { | 189 | if (enabled && !root.loading) { | ||
189 | touchpad.leftHanded = checked | 190 | touchpad.leftHanded = checked | ||
190 | root.changeSignal() | 191 | root.changeSignal() | ||
191 | } | 192 | } | ||
192 | } | 193 | } | ||
193 | | ||||
194 | ToolTip { | | |||
195 | text: i18n("Swap left and right buttons.") | | |||
196 | } | | |||
197 | } | 194 | } | ||
198 | 195 | | |||
199 | Controls.CheckBox { | 196 | Controls.CheckBox { | ||
200 | id: middleEmulation | 197 | id: middleEmulation | ||
201 | text: i18n("Press left and right buttons for middle click") | 198 | text: i18n("Press left and right buttons for middle click") | ||
202 | 199 | | |||
200 | hoverEnabled: true | ||||
201 | Controls.ToolTip { | ||||
202 | text: i18n("Clicking left and right button simultaneously sends middle button click.") | ||||
romangg: typo | |||||
203 | visible: parent.hovered | ||||
204 | delay: 1000 | ||||
205 | } | ||||
206 | | ||||
203 | function load() { | 207 | function load() { | ||
204 | if (!formLayout.enabled) { | 208 | if (!formLayout.enabled) { | ||
205 | checked = false | 209 | checked = false | ||
206 | return | 210 | return | ||
207 | } | 211 | } | ||
208 | enabled = touchpad.supportsMiddleEmulation | 212 | enabled = touchpad.supportsMiddleEmulation | ||
209 | checked = enabled && touchpad.middleEmulation | 213 | checked = enabled && touchpad.middleEmulation | ||
210 | } | 214 | } | ||
211 | 215 | | |||
212 | onCheckedChanged: { | 216 | onCheckedChanged: { | ||
213 | if (enabled && !root.loading) { | 217 | if (enabled && !root.loading) { | ||
214 | touchpad.middleEmulation = checked | 218 | touchpad.middleEmulation = checked | ||
215 | root.changeSignal() | 219 | root.changeSignal() | ||
216 | } | 220 | } | ||
217 | } | 221 | } | ||
218 | | ||||
219 | ToolTip { | | |||
220 | text: i18n("Clicking left and right button simultaneously sends middle button click.") | | |||
221 | } | | |||
222 | } | 222 | } | ||
223 | 223 | | |||
224 | Kirigami.Separator { | 224 | Kirigami.Separator { | ||
225 | } | 225 | } | ||
226 | 226 | | |||
227 | // Acceleration | 227 | // Acceleration | ||
228 | Controls.Slider { | 228 | Controls.Slider { | ||
229 | Kirigami.FormData.label: i18n("Pointer speed:") | 229 | Kirigami.FormData.label: i18n("Pointer speed:") | ||
230 | id: accelSpeed | 230 | id: accelSpeed | ||
231 | 231 | | |||
232 | tickmarksEnabled: true | 232 | from: 1 | ||
233 | 233 | to: 10 | |||
234 | minimumValue: 1 | | |||
235 | maximumValue: 10 | | |||
236 | stepSize: 1 | 234 | stepSize: 1 | ||
237 | 235 | | |||
238 | implicitWidth: units.gridUnit * 9 | | |||
239 | | ||||
240 | function load() { | 236 | function load() { | ||
241 | enabled = touchpad.supportsPointerAcceleration | 237 | enabled = touchpad.supportsPointerAcceleration | ||
242 | if (!enabled) { | 238 | if (!enabled) { | ||
243 | value = 0.1 | 239 | value = 0.1 | ||
244 | return | 240 | return | ||
245 | } | 241 | } | ||
246 | // transform libinput's pointer acceleration range [-1, 1] to slider range [1, 10] | 242 | // transform libinput's pointer acceleration range [-1, 1] to slider range [1, 10] | ||
247 | value = 4.5 * touchpad.pointerAcceleration + 5.5 | 243 | value = 4.5 * touchpad.pointerAcceleration + 5.5 | ||
248 | } | 244 | } | ||
249 | 245 | | |||
250 | onValueChanged: { | 246 | onValueChanged: { | ||
251 | if (touchpad != undefined && enabled && !root.loading) { | 247 | if (touchpad != undefined && enabled && !root.loading) { | ||
252 | // transform slider range [1, 10] to libinput's pointer acceleration range [-1, 1] | 248 | // 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 | 249 | touchpad.pointerAcceleration = Math.round( (value - 5.5) / 4.5 * 100 ) / 100 | ||
254 | root.changeSignal() | 250 | root.changeSignal() | ||
255 | } | 251 | } | ||
256 | } | 252 | } | ||
257 | } | 253 | } | ||
258 | 254 | | |||
259 | ExclGroupBox { | 255 | Layouts.ColumnLayout { | ||
260 | Kirigami.FormData.label: i18n("Acceleration profile:") | 256 | Kirigami.FormData.label: i18n("Acceleration profile:") | ||
257 | Kirigami.FormData.buddyFor: accelProfileFlat | ||||
261 | id: accelProfile | 258 | id: accelProfile | ||
262 | model: [i18n("Flat"), i18n("Adaptive")] | 259 | spacing: Kirigami.Units.smallSpacing | ||
263 | 260 | | |||
264 | function load() { | 261 | function load() { | ||
265 | enabled = touchpad.supportsPointerAccelerationProfileAdaptive | 262 | enabled = touchpad.supportsPointerAccelerationProfileAdaptive | ||
266 | 263 | | |||
267 | if (!enabled) { | 264 | if (!enabled) { | ||
268 | itemAt(0).checked = false | 265 | accelProfileFlat.checked = false | ||
269 | itemAt(1).checked = false | 266 | accelProfileAdaptive.checked = false | ||
270 | return | 267 | return | ||
271 | } | 268 | } | ||
272 | 269 | | |||
273 | itemAt(0).tooltiptext = i18n("Cursor moves the same distance as finger.") | 270 | if(touchpad.pointerAccelerationProfileAdaptive) { | ||
274 | itemAt(1).tooltiptext = i18n("Cursor travel distance depends on movement speed of finger.") | 271 | accelProfileAdaptive.checked = true | ||
275 | 272 | } else { | |||
276 | var toCheck = touchpad.pointerAccelerationProfileAdaptive ? 1 : 0 | 273 | accelProfileFlat.checked = true | ||
277 | itemAt(toCheck).checked = true | 274 | } | ||
278 | } | 275 | } | ||
279 | 276 | | |||
280 | onCurrentChanged: { | 277 | function syncCurrent() { | ||
281 | if (enabled && !root.loading) { | 278 | if (enabled && !root.loading) { | ||
282 | touchpad.pointerAccelerationProfileFlat = itemAt(0).checked | 279 | touchpad.pointerAccelerationProfileFlat = accelProfileFlat.checked | ||
283 | touchpad.pointerAccelerationProfileAdaptive = itemAt(1).checked | 280 | touchpad.pointerAccelerationProfileAdaptive = accelProfileAdaptive.checked | ||
284 | root.changeSignal() | 281 | root.changeSignal() | ||
285 | } | 282 | } | ||
286 | } | 283 | } | ||
284 | | ||||
285 | Controls.RadioButton { | ||||
286 | id: accelProfileFlat | ||||
287 | text: i18n("Flat") | ||||
288 | | ||||
289 | hoverEnabled: true | ||||
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… | |||||
290 | Controls.ToolTip { | ||||
291 | text: i18n("Cursor moves the same distance as finger.") | ||||
292 | visible: parent.hovered | ||||
293 | delay: 1000 | ||||
294 | } | ||||
295 | onCheckedChanged: accelProfile.syncCurrent() | ||||
296 | } | ||||
297 | | ||||
298 | Controls.RadioButton { | ||||
299 | id: accelProfileAdaptive | ||||
300 | text: i18n("Adaptive") | ||||
301 | | ||||
302 | hoverEnabled: true | ||||
303 | Controls.ToolTip { | ||||
304 | text: i18n("Cursor travel distance depends on movement speed of finger.") | ||||
305 | visible: parent.hovered | ||||
306 | delay: 1000 | ||||
307 | } | ||||
308 | onCheckedChanged: accelProfile.syncCurrent() | ||||
309 | } | ||||
287 | } | 310 | } | ||
288 | 311 | | |||
289 | Kirigami.Separator { | 312 | Kirigami.Separator { | ||
290 | } | 313 | } | ||
291 | 314 | | |||
292 | // Tapping | 315 | // Tapping | ||
293 | Controls.CheckBox { | 316 | Controls.CheckBox { | ||
294 | Kirigami.FormData.label: i18n("Tapping:") | 317 | Kirigami.FormData.label: i18n("Tapping:") | ||
295 | id: tapToClick | 318 | id: tapToClick | ||
296 | text: i18n("Tap-to-click") | 319 | text: i18n("Tap-to-click") | ||
297 | 320 | | |||
321 | hoverEnabled: true | ||||
322 | Controls.ToolTip { | ||||
323 | text: i18n("Single tap is left button click.") | ||||
324 | visible: parent.hovered | ||||
325 | delay: 1000 | ||||
326 | } | ||||
327 | | ||||
298 | function load() { | 328 | function load() { | ||
299 | enabled = touchpad.tapFingerCount > 0 | 329 | enabled = touchpad.tapFingerCount > 0 | ||
300 | checked = enabled && touchpad.tapToClick | 330 | checked = enabled && touchpad.tapToClick | ||
301 | } | 331 | } | ||
302 | 332 | | |||
303 | function updateDependents() { | 333 | function updateDependents() { | ||
304 | loading = true | 334 | loading = true | ||
305 | tapAndDrag.load() | 335 | tapAndDrag.load() | ||
306 | tapAndDragLock.load() | 336 | tapAndDragLock.load() | ||
307 | multiTap.load() | 337 | multiTap.load() | ||
308 | loading = false | 338 | loading = false | ||
309 | } | 339 | } | ||
310 | 340 | | |||
311 | onCheckedChanged: { | 341 | onCheckedChanged: { | ||
312 | if (enabled && !root.loading) { | 342 | if (enabled && !root.loading) { | ||
313 | touchpad.tapToClick = checked | 343 | touchpad.tapToClick = checked | ||
314 | updateDependents() | 344 | updateDependents() | ||
315 | root.changeSignal() | 345 | root.changeSignal() | ||
316 | } | 346 | } | ||
317 | } | 347 | } | ||
318 | | ||||
319 | ToolTip { | | |||
320 | text: i18n("Single tap is left button click.") | | |||
321 | } | | |||
322 | } | 348 | } | ||
323 | 349 | | |||
324 | Controls.CheckBox { | 350 | Controls.CheckBox { | ||
325 | id: tapAndDrag | 351 | id: tapAndDrag | ||
326 | text: i18n("Tap-and-drag") | 352 | text: i18n("Tap-and-drag") | ||
327 | 353 | | |||
354 | hoverEnabled: true | ||||
355 | Controls.ToolTip { | ||||
356 | text: i18n("Sliding over touchpad directly after tap drags.") | ||||
357 | visible: parent.hovered | ||||
358 | delay: 1000 | ||||
359 | } | ||||
360 | | ||||
328 | function load() { | 361 | function load() { | ||
329 | enabled = touchpad.tapFingerCount > 0 && tapToClick.checked | 362 | enabled = touchpad.tapFingerCount > 0 && tapToClick.checked | ||
330 | checked = enabled && touchpad.tapAndDrag | 363 | checked = enabled && touchpad.tapAndDrag | ||
331 | } | 364 | } | ||
332 | 365 | | |||
333 | function updateDependents() { | 366 | function updateDependents() { | ||
334 | loading = true | 367 | loading = true | ||
335 | tapAndDragLock.load() | 368 | tapAndDragLock.load() | ||
336 | loading = false | 369 | loading = false | ||
337 | } | 370 | } | ||
338 | 371 | | |||
339 | onCheckedChanged: { | 372 | onCheckedChanged: { | ||
340 | if (enabled && !root.loading) { | 373 | if (enabled && !root.loading) { | ||
341 | touchpad.tapAndDrag = checked | 374 | touchpad.tapAndDrag = checked | ||
342 | updateDependents() | 375 | updateDependents() | ||
343 | root.changeSignal() | 376 | root.changeSignal() | ||
344 | } | 377 | } | ||
345 | } | 378 | } | ||
346 | | ||||
347 | ToolTip { | | |||
348 | text: i18n("Sliding over touchpad directly after tap drags.") | | |||
349 | } | | |||
350 | } | 379 | } | ||
351 | 380 | | |||
352 | Controls.CheckBox { | 381 | Controls.CheckBox { | ||
353 | id: tapAndDragLock | 382 | id: tapAndDragLock | ||
354 | text: i18n("Tap-and-drag lock") | 383 | text: i18n("Tap-and-drag lock") | ||
355 | 384 | | |||
385 | hoverEnabled: true | ||||
386 | Controls.ToolTip { | ||||
387 | text: i18n("Dragging continues after a short finger lift.") | ||||
388 | visible: parent.hovered | ||||
389 | delay: 1000 | ||||
390 | } | ||||
391 | | ||||
356 | function load() { | 392 | function load() { | ||
357 | enabled = touchpad.tapFingerCount > 0 && tapAndDrag.checked | 393 | enabled = touchpad.tapFingerCount > 0 && tapAndDrag.checked | ||
358 | checked = enabled && touchpad.tapDragLock | 394 | checked = enabled && touchpad.tapDragLock | ||
359 | } | 395 | } | ||
360 | 396 | | |||
361 | onCheckedChanged: { | 397 | onCheckedChanged: { | ||
362 | if (enabled && !root.loading) { | 398 | if (enabled && !root.loading) { | ||
363 | touchpad.tapDragLock = checked | 399 | touchpad.tapDragLock = checked | ||
364 | root.changeSignal() | 400 | root.changeSignal() | ||
365 | } | 401 | } | ||
366 | } | 402 | } | ||
367 | | ||||
368 | ToolTip { | | |||
369 | text: i18n("Dragging continues after a short finger lift.") | | |||
370 | } | | |||
371 | } | 403 | } | ||
372 | 404 | | |||
373 | ExclGroupBox { | 405 | Layouts.ColumnLayout { | ||
374 | Kirigami.FormData.label: i18n("Two-finger tap:") | 406 | Kirigami.FormData.label: i18n("Two-finger tap:") | ||
407 | Kirigami.FormData.buddyFor: multiTapRightClick | ||||
375 | id: multiTap | 408 | id: multiTap | ||
376 | 409 | | |||
410 | spacing: Kirigami.Units.smallSpacing | ||||
411 | | ||||
377 | function load() { | 412 | function load() { | ||
378 | enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked | 413 | enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked | ||
379 | if (touchpad.tapFingerCount > 2) { | 414 | if (touchpad.tapFingerCount > 2) { | ||
380 | model = [i18n("Right-click (three-finger tap to middle-click)"), | 415 | multiTapRightClick.text = i18n("Right-click (three-finger tap to middle-click)") | ||
381 | i18n("Middle-click (three-finger tap right-click)")] | 416 | multiTapRightClickToolTip.text = 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.") | 417 | | ||
383 | itemAt(1).tooltiptext = i18n("Tap with two fingers to middle-click, tap with three fingers to right-click.") | 418 | multiTapMiddleClick.text = i18n("Middle-click (three-finger tap right-click)") | ||
419 | multiTapMiddleClickToolTip.text = i18n("Tap with two fingers to middle-click, tap with three fingers to right-click.") | ||||
384 | } else { | 420 | } else { | ||
385 | model = [i18n("Righ-click"), i18n("Middle-click")] | 421 | multiTapRightClick.text = i18n("Righ-click") | ||
386 | itemAt(0).tooltiptext = i18n("Tap with two fingers to right-click.") | 422 | multiTapRightClickToolTip.text = i18n("Tap with two fingers to right-click.") | ||
387 | itemAt(1).tooltiptext = i18n("Tap with two fingers to middle-click.") | 423 | | ||
424 | multiTapMiddleClick.text = i18n("Middle-click") | ||||
425 | multiTapMiddleClickToolTip.text = i18n("Tap with two fingers to middle-click.") | ||||
388 | } | 426 | } | ||
389 | 427 | | |||
390 | if (!enabled) { | 428 | if (!enabled) { | ||
391 | itemAt(0).checked = false | 429 | multiTapRightClick.checked = false | ||
392 | itemAt(1).checked = false | 430 | multiTapMiddleClick.checked = false | ||
393 | return | 431 | return | ||
394 | } | 432 | } | ||
395 | var toCheck = touchpad.lmrTapButtonMap ? 1 : 0 | 433 | | ||
396 | itemAt(toCheck).checked = true | 434 | if(touchpad.lmrTapButtonMap) { | ||
435 | multiTapMiddleClick.checked = true | ||||
436 | } else { | ||||
437 | multiTapRightClick.checked = true | ||||
438 | } | ||||
397 | } | 439 | } | ||
398 | 440 | | |||
399 | onCurrentChanged: { | 441 | function syncCurrent() { | ||
400 | if (enabled && !root.loading) { | 442 | if (enabled && !root.loading) { | ||
401 | touchpad.lmrTapButtonMap = itemAt(1).checked | 443 | touchpad.lmrTapButtonMap = multiTapMiddleClick.checked | ||
402 | root.changeSignal() | 444 | root.changeSignal() | ||
403 | } | 445 | } | ||
404 | } | 446 | } | ||
447 | | ||||
448 | Controls.RadioButton { | ||||
449 | id: multiTapRightClick | ||||
450 | // text: is handled dynamically on load. | ||||
451 | | ||||
452 | hoverEnabled: true | ||||
453 | Controls.ToolTip { | ||||
454 | id: multiTapRightClickToolTip | ||||
455 | visible: parent.hovered | ||||
456 | delay: 1000 | ||||
457 | // text: is handled dynamically on load. | ||||
458 | } | ||||
459 | onCheckedChanged: multiTap.syncCurrent() | ||||
460 | } | ||||
461 | | ||||
462 | Controls.RadioButton { | ||||
463 | id: multiTapMiddleClick | ||||
464 | // text: is handled dynamically on load. | ||||
465 | | ||||
466 | hoverEnabled: true | ||||
467 | Controls.ToolTip { | ||||
468 | id: multiTapMiddleClickToolTip | ||||
469 | visible: parent.hovered | ||||
470 | delay: 1000 | ||||
471 | // text: is handled dynamically on load. | ||||
472 | } | ||||
473 | onCheckedChanged: multiTap.syncCurrent() | ||||
474 | } | ||||
405 | } | 475 | } | ||
406 | 476 | | |||
407 | Kirigami.Separator { | 477 | Kirigami.Separator { | ||
408 | } | 478 | } | ||
409 | 479 | | |||
410 | // Scrolling | 480 | // Scrolling | ||
411 | ExclGroupBox { | 481 | Layouts.ColumnLayout { | ||
412 | Kirigami.FormData.label: i18n("Scrolling:") | 482 | Kirigami.FormData.label: i18n("Scrolling:") | ||
413 | id: scrollmethod | 483 | Kirigami.FormData.buddyFor: scrollMethodTwoFingers | ||
414 | model: [i18n("Two fingers"), i18n("Touchpad edges")] | 484 | id: scrollMethod | ||
485 | | ||||
486 | spacing: Kirigami.Units.smallSpacing | ||||
415 | 487 | | |||
416 | function load() { | 488 | function load() { | ||
417 | itemAt(0).enabled = touchpad.supportsScrollTwoFinger | 489 | scrollMethodTwoFingers.enabled = touchpad.supportsScrollTwoFinger | ||
418 | itemAt(1).enabled = touchpad.supportsScrollEdge | 490 | scrollMethodTouchpadEdges.enabled = touchpad.supportsScrollEdge | ||
419 | 491 | | |||
420 | var toCheck = 0 | 492 | if(scrollMethodTouchpadEdges.enabled && touchpad.scrollEdge) { | ||
421 | if (itemAt(0).enabled && touchpad.scrollTwoFinger) { | 493 | scrollMethodTouchpadEdges.checked = formLayout.enabled | ||
422 | toCheck = 0 | 494 | } else { | ||
423 | } else if (itemAt(1).enabled && touchpad.scrollEdge) { | 495 | scrollMethodTwoFingers.checked = formLayout.enabled | ||
424 | toCheck = 1 | | |||
425 | } | 496 | } | ||
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 | } | 497 | } | ||
431 | 498 | | |||
432 | onCurrentChanged: { | 499 | function syncCurrent() { | ||
433 | if (enabled && !root.loading) { | 500 | if (enabled && !root.loading) { | ||
434 | touchpad.scrollTwoFinger = itemAt(0).checked | 501 | touchpad.scrollTwoFinger = scrollMethodTwoFingers.checked | ||
435 | touchpad.scrollEdge = itemAt(1).checked | 502 | touchpad.scrollEdge = scrollMethodTouchpadEdges.checked | ||
436 | root.changeSignal() | 503 | root.changeSignal() | ||
437 | } | 504 | } | ||
438 | loading = true | 505 | loading = true | ||
439 | naturalScroll.load() | 506 | naturalScroll.load() | ||
440 | loading = false | 507 | loading = false | ||
441 | } | 508 | } | ||
509 | | ||||
510 | Controls.RadioButton { | ||||
511 | id: scrollMethodTwoFingers | ||||
512 | text: i18n("Two fingers") | ||||
513 | | ||||
514 | hoverEnabled: true | ||||
515 | Controls.ToolTip { | ||||
516 | text: i18n("Slide with two fingers scrolls.") | ||||
517 | visible: parent.hovered | ||||
518 | delay: 1000 | ||||
519 | } | ||||
520 | } | ||||
521 | | ||||
522 | Controls.RadioButton { | ||||
523 | id: scrollMethodTouchpadEdges | ||||
524 | text: i18n("Touchpad edges") | ||||
525 | | ||||
526 | hoverEnabled: true | ||||
527 | Controls.ToolTip { | ||||
528 | text: i18n("Slide on the touchpad edges scrolls.") | ||||
529 | visible: parent.hovered | ||||
530 | delay: 1000 | ||||
531 | } | ||||
532 | onCheckedChanged: scrollMethod.syncCurrent() | ||||
533 | } | ||||
442 | } | 534 | } | ||
443 | 535 | | |||
444 | Controls.CheckBox { | 536 | Controls.CheckBox { | ||
445 | id: naturalScroll | 537 | id: naturalScroll | ||
446 | text: i18n("Invert scroll direction (Natural scrolling)") | 538 | text: i18n("Invert scroll direction (Natural scrolling)") | ||
447 | 539 | | |||
448 | function load() { | 540 | function load() { | ||
449 | enabled = touchpad.supportsNaturalScroll | 541 | enabled = touchpad.supportsNaturalScroll | ||
450 | checked = enabled && touchpad.naturalScroll | 542 | checked = enabled && touchpad.naturalScroll | ||
451 | } | 543 | } | ||
452 | 544 | | |||
453 | onCheckedChanged: { | 545 | onCheckedChanged: { | ||
454 | if (enabled && !root.loading) { | 546 | if (enabled && !root.loading) { | ||
455 | touchpad.naturalScroll = checked | 547 | touchpad.naturalScroll = checked | ||
456 | root.changeSignal() | 548 | root.changeSignal() | ||
457 | } | 549 | } | ||
458 | } | 550 | } | ||
459 | 551 | | |||
460 | ToolTip { | 552 | hoverEnabled: true | ||
553 | Controls.ToolTip { | ||||
461 | text: i18n("Touchscreen like scrolling.") | 554 | text: i18n("Touchscreen like scrolling.") | ||
555 | visible: parent.hovered | ||||
556 | delay: 1000 | ||||
462 | } | 557 | } | ||
463 | } | 558 | } | ||
464 | } // END Kirigami.FormLayout | 559 | } // END Kirigami.FormLayout | ||
465 | } // END Kirigami.ScrollablePage | 560 | } // END Kirigami.ScrollablePage |
this is either unused or wrong