Merge lp:~ken-vandine/ubuntu-system-settings/mouse_panel into lp:ubuntu-system-settings

Proposed by Ken VanDine on 2015-08-17
Status: Merged
Merged at revision: 1582
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/mouse_panel
Merge into: lp:ubuntu-system-settings
Prerequisite: lp:~ken-vandine/ubuntu-system-settings/touchpad
Diff against target: 2595 lines (+2358/-2)
35 files modified
debian/control (+5/-1)
plugins/CMakeLists.txt (+1/-1)
plugins/mouse/CMakeLists.txt (+23/-0)
plugins/mouse/Components/CMakeLists.txt (+1/-0)
plugins/mouse/Components/UnityInputInfo/CMakeLists.txt (+11/-0)
plugins/mouse/Components/UnityInputInfo/UnityInputInfo.qml (+107/-0)
plugins/mouse/Components/UnityInputInfo/qmldir (+1/-0)
plugins/mouse/Connected.qml (+462/-0)
plugins/mouse/InputInfo/CMakeLists.txt (+41/-0)
plugins/mouse/InputInfo/linux/qinputdeviceinfo_linux.cpp (+249/-0)
plugins/mouse/InputInfo/linux/qinputdeviceinfo_linux_p.h (+91/-0)
plugins/mouse/InputInfo/plugin.cpp (+32/-0)
plugins/mouse/InputInfo/plugin.h (+30/-0)
plugins/mouse/InputInfo/qdeclarativeinputdeviceinfo.cpp (+143/-0)
plugins/mouse/InputInfo/qdeclarativeinputdeviceinfo_p.h (+86/-0)
plugins/mouse/InputInfo/qinputinfo.cpp (+159/-0)
plugins/mouse/InputInfo/qinputinfo.h (+143/-0)
plugins/mouse/InputInfo/qmldir (+3/-0)
plugins/mouse/ItemTitle.qml (+39/-0)
plugins/mouse/None.qml (+39/-0)
plugins/mouse/PageComponent.qml (+74/-0)
plugins/mouse/PrimaryButtonSelector.qml (+95/-0)
plugins/mouse/SectionHeader.qml (+78/-0)
plugins/mouse/TapArea.qml (+96/-0)
plugins/mouse/mouse.settings (+21/-0)
plugins/mouse/plugin/CMakeLists.txt (+8/-0)
plugins/mouse/plugin/mouse-plugin.cpp (+65/-0)
plugins/mouse/plugin/mouse-plugin.h (+38/-0)
plugins/mouse/settings-mouse.svg (+39/-0)
schema/com.ubuntu.touch.system-settings.gschema.xml (+65/-0)
tests/plugins/CMakeLists.txt (+1/-0)
tests/plugins/mouse/CMakeLists.txt (+29/-0)
tests/plugins/mouse/Source/qmldir (+2/-0)
tests/plugins/mouse/tst_mouse.cpp (+22/-0)
tests/plugins/mouse/tst_mouse.qml (+59/-0)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/mouse_panel
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration 2015-08-17 Needs Fixing on 2016-01-05
Ubuntu Touch System Settings 2015-08-17 Pending
Review via email: mp+268248@code.launchpad.net

This proposal supersedes a proposal from 2015-08-03.

Commit Message

Initial UI and stub backend for the mouse and touchpad panel

Description of the Change

Initial UI and stub backend for the mouse and touchpad panel

To post a comment you must log in.
1485. By Ken VanDine on 2015-08-19

Added PrimaryButtonSelector

1486. By Ken VanDine on 2015-08-19

improved alignment

1487. By Ken VanDine on 2015-08-19

improved alignment

1488. By Ken VanDine on 2015-08-19

improved spacing

1489. By Ken VanDine on 2015-08-25

Added test for TapArea

1490. By Ken VanDine on 2015-08-25

merged trunk

1491. By Ken VanDine on 2015-08-25

added missing files for tests

1492. By Ken VanDine on 2015-08-26

more tests

1493. By Ken VanDine on 2015-08-26

Fixed exclusive group

1494. By Ken VanDine on 2015-08-26

Added build depends needed to run tests

1495. By Ken VanDine on 2015-08-26

Use the default timeout for tryCompare

1496. By Ken VanDine on 2015-08-26

Improved alignment

1497. By Ken VanDine on 2015-08-27

visual tweaks based on feedback from design

1498. By Ken VanDine on 2015-08-27

Fixed margins

1499. By Ken VanDine on 2015-08-27

removed logging

1500. By Ken VanDine on 2015-08-28

Added fake target to show the QML files in qtcreator

1501. By Ken VanDine on 2015-08-31

merged trunk

1502. By Ken VanDine on 2015-10-19

merged trunk

1503. By Ken VanDine on 2015-11-20

Merged trunk

1504. By Ken VanDine on 2015-11-30

merged trunk

1505. By Ken VanDine on 2015-12-04

merged trunk

1506. By Ken VanDine on 2015-12-04

use 1.3 imports of the sdk

1507. By Ken VanDine on 2015-12-04

The pressed property has been removed from AbstractButton

1508. By Ken VanDine on 2015-12-04

added build depends for qtdeclarative5-ubuntu-ui-toolkit-plugin

1509. By Ken VanDine on 2016-01-05

merged trunk

1510. By Ken VanDine on 2016-01-05

merged trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2015-11-10 15:24:27 +0000
3+++ debian/control 2016-01-05 14:44:19 +0000
4@@ -14,12 +14,14 @@
5 libandroid-properties-dev [amd64 armhf i386],
6 libclick-0.4-dev,
7 libglib2.0-dev (>= 2.37.92),
8+ libevdev-dev,
9 libicu-dev,
10 libnm-glib-dev,
11 libpolkit-agent-1-dev,
12 libqmenumodel-dev,
13 libtimezonemap1-dev (>= 0.4.1),
14 libtrust-store-dev,
15+ libudev-dev,
16 libunity-api-dev,
17 libupower-glib-dev,
18 pkg-config,
19@@ -29,7 +31,9 @@
20 qtdeclarative5-dev,
21 libapt-pkg-dev,
22 # test-deps
23+ qml-module-qttest,
24 qml-module-qtquick2,
25+ qtdeclarative5-ubuntu-ui-toolkit-plugin,
26 libubuntuoneauth-2.0-dev,
27 libubuntu-download-manager-client-dev,
28 libubuntu-download-manager-common-dev,
29@@ -60,7 +64,7 @@
30 ${shlibs:Depends},
31 accountsservice,
32 accountsservice-ubuntu-schemas (>= 0.0.3+14.10.20140829~),
33- bluez (>= 5.23),
34+ bluez (>= 4.36),
35 click | ubuntu-snappy-cli,
36 dbus-property-service [amd64 armhf i386],
37 gsettings-desktop-schemas,
38
39=== modified file 'plugins/CMakeLists.txt'
40--- plugins/CMakeLists.txt 2015-08-06 15:12:39 +0000
41+++ plugins/CMakeLists.txt 2016-01-05 14:44:19 +0000
42@@ -11,6 +11,7 @@
43 add_subdirectory(flight-mode)
44 add_subdirectory(hotspot)
45 add_subdirectory(language)
46+add_subdirectory(mouse)
47 add_subdirectory(notifications)
48 add_subdirectory(orientation-lock)
49 add_subdirectory(phone)
50@@ -20,4 +21,3 @@
51 add_subdirectory(system-update)
52 add_subdirectory(time-date)
53 add_subdirectory(wifi)
54-
55
56=== added directory 'plugins/mouse'
57=== added file 'plugins/mouse/CMakeLists.txt'
58--- plugins/mouse/CMakeLists.txt 1970-01-01 00:00:00 +0000
59+++ plugins/mouse/CMakeLists.txt 2016-01-05 14:44:19 +0000
60@@ -0,0 +1,23 @@
61+add_subdirectory(plugin)
62+add_subdirectory(InputInfo)
63+add_subdirectory(Components)
64+
65+set(QML_SOURCES
66+ PageComponent.qml
67+ None.qml
68+ Connected.qml
69+ ItemTitle.qml
70+ TapArea.qml
71+ PrimaryButtonSelector.qml
72+ SectionHeader.qml
73+)
74+
75+# We need a dummy target so the QML files show up in Qt Creator
76+# If this plugin gets some C++ sources, remove this.
77+add_custom_target(mouse-holder
78+COMMAND echo This is just a dummy.
79+SOURCES ${QML_SOURCES})
80+
81+install(FILES mouse.settings DESTINATION ${PLUGIN_MANIFEST_DIR})
82+install(FILES settings-mouse.svg DESTINATION ${PLUGIN_MANIFEST_DIR}/icons)
83+install(FILES ${QML_SOURCES} DESTINATION ${PLUGIN_QML_DIR}/mouse)
84
85=== added directory 'plugins/mouse/Components'
86=== added file 'plugins/mouse/Components/CMakeLists.txt'
87--- plugins/mouse/Components/CMakeLists.txt 1970-01-01 00:00:00 +0000
88+++ plugins/mouse/Components/CMakeLists.txt 2016-01-05 14:44:19 +0000
89@@ -0,0 +1,1 @@
90+add_subdirectory(UnityInputInfo)
91
92=== added directory 'plugins/mouse/Components/UnityInputInfo'
93=== added file 'plugins/mouse/Components/UnityInputInfo/CMakeLists.txt'
94--- plugins/mouse/Components/UnityInputInfo/CMakeLists.txt 1970-01-01 00:00:00 +0000
95+++ plugins/mouse/Components/UnityInputInfo/CMakeLists.txt 2016-01-05 14:44:19 +0000
96@@ -0,0 +1,11 @@
97+set(QML_SOURCES
98+ UnityInputInfo.qml
99+ qmldir
100+)
101+install(FILES ${QML_SOURCES} DESTINATION ${PLUGIN_QML_DIR}/mouse/Components/UnityInputInfo/)
102+
103+# add a phony target to get the files visible in Qt Creator.
104+add_custom_target(
105+ plugins_mouse_components_sources
106+ SOURCES ${QML_SOURCES}
107+)
108
109=== added file 'plugins/mouse/Components/UnityInputInfo/UnityInputInfo.qml'
110--- plugins/mouse/Components/UnityInputInfo/UnityInputInfo.qml 1970-01-01 00:00:00 +0000
111+++ plugins/mouse/Components/UnityInputInfo/UnityInputInfo.qml 2016-01-05 14:44:19 +0000
112@@ -0,0 +1,107 @@
113+/*
114+ * Copyright 2015 Canonical Ltd.
115+ *
116+ * This program is free software; you can redistribute it and/or modify
117+ * it under the terms of the GNU Lesser General Public License as published by
118+ * the Free Software Foundation; version 3.
119+ *
120+ * This program is distributed in the hope that it will be useful,
121+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
122+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
123+ * GNU Lesser General Public License for more details.
124+ *
125+ * You should have received a copy of the GNU Lesser General Public License
126+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
127+ */
128+
129+pragma Singleton
130+
131+import QtQuick 2.4
132+import Ubuntu.SystemSettings.Mouse.InputInfo 0.1
133+
134+Item {
135+ id: root
136+ readonly property alias mice: priv.miceCount
137+ readonly property alias touchpads: priv.touchpadCount
138+ readonly property alias keyboards: priv.keyboardCount
139+
140+ property alias inputInfo: inputInfo
141+
142+ QtObject {
143+ id: priv
144+
145+ property var mice: []
146+ property var touchpads: []
147+ property var keyboards: []
148+
149+ property int miceCount: 0
150+ property int touchpadCount: 0
151+ property int keyboardCount: 0
152+
153+ function addMouse(devicePath) {
154+ mice.push(devicePath);
155+ miceCount++;
156+ }
157+
158+ function addTouchPad(devicePath) {
159+ touchpads.push(devicePath);
160+ touchpadCount++;
161+ }
162+
163+ function addKeyboard(devicePath) {
164+ keyboards.push(devicePath);
165+ keyboardCount++;
166+ }
167+
168+ function removeDevice(devicePath) {
169+ for (var i = 0; i < priv.mice.length; i++) {
170+ if (priv.mice[i] == devicePath) {
171+ priv.mice.splice(i, 1);
172+ priv.miceCount--;
173+ }
174+ }
175+ for (var i = 0; i < priv.touchpads.length; i++) {
176+ if (priv.touchpads[i] == devicePath) {
177+ priv.touchpads.splice(i, 1);
178+ priv.touchpadCount--;
179+ }
180+ }
181+ for (var i = 0; i < priv.keyboards.length; i++) {
182+ if (priv.keyboards[i] == devicePath) {
183+ priv.keyboards.splice(i, 1);
184+ priv.keyboardCount--;
185+ }
186+ }
187+ }
188+ }
189+
190+ InputDeviceInfo {
191+ id: inputInfo
192+ objectName: "inputDeviceInfo"
193+
194+ onNewDevice: {
195+ var device = inputInfo.get(inputInfo.indexOf(devicePath));
196+ if (device === null) {
197+ return;
198+ }
199+
200+ var hasMouse = (device.types & InputInfo.Mouse) == InputInfo.Mouse
201+ var hasTouchpad = (device.types & InputInfo.TouchPad) == InputInfo.TouchPad
202+ var hasKeyboard = (device.types & InputInfo.Keyboard) == InputInfo.Keyboard
203+
204+ if (hasMouse) {
205+ priv.addMouse(devicePath);
206+ } else if (hasTouchpad) {
207+ priv.addTouchPad(devicePath);
208+ } else if (hasKeyboard) {
209+ // Only accepting keyboards that do not claim to be a mouse too
210+ // This will be a bit buggy for real hybrid devices, but doesn't
211+ // fall for Microsoft mice that claim to be Keyboards too.
212+ priv.addKeyboard(devicePath)
213+ }
214+ }
215+ onDeviceRemoved: {
216+ priv.removeDevice(devicePath)
217+ }
218+ }
219+}
220
221=== added file 'plugins/mouse/Components/UnityInputInfo/qmldir'
222--- plugins/mouse/Components/UnityInputInfo/qmldir 1970-01-01 00:00:00 +0000
223+++ plugins/mouse/Components/UnityInputInfo/qmldir 2016-01-05 14:44:19 +0000
224@@ -0,0 +1,1 @@
225+singleton UnityInputInfo 1.0 UnityInputInfo.qml
226
227=== added file 'plugins/mouse/Connected.qml'
228--- plugins/mouse/Connected.qml 1970-01-01 00:00:00 +0000
229+++ plugins/mouse/Connected.qml 2016-01-05 14:44:19 +0000
230@@ -0,0 +1,462 @@
231+/*
232+ * This file is part of system-settings
233+ *
234+ * Copyright (C) 2015 Canonical Ltd.
235+ *
236+ * Contact: Ken VanDine <ken.vandine@canonical.com>
237+ *
238+ * This program is free software: you can redistribute it and/or modify it
239+ * under the terms of the GNU General Public License version 3, as published
240+ * by the Free Software Foundation.
241+ *
242+ * This program is distributed in the hope that it will be useful, but
243+ * WITHOUT ANY WARRANTY; without even the implied warranties of
244+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
245+ * PURPOSE. See the GNU General Public License for more details.
246+ *
247+ * You should have received a copy of the GNU General Public License along
248+ * with this program. If not, see <http://www.gnu.org/licenses/>.
249+ */
250+
251+import GSettings 1.0
252+import QtQuick 2.0
253+import SystemSettings 1.0
254+import Ubuntu.Components 1.3
255+import Ubuntu.Components.ListItems 1.3 as ListItem
256+import Ubuntu.Settings.Menus 0.1 as Menus
257+import Ubuntu.Settings.Components 0.1 as USC
258+import "Components/UnityInputInfo"
259+
260+Column {
261+ anchors {
262+ left: parent.left
263+ right: parent.right
264+ }
265+ height: childrenRect.height
266+
267+ GSettings {
268+ id: settings
269+ schema.id: "com.ubuntu.touch.system-settings"
270+ }
271+
272+ Column {
273+ anchors {
274+ left: parent.left
275+ right: parent.right
276+ }
277+ visible: UnityInputInfo.mice > 0
278+
279+ SectionHeader {
280+ text: i18n.tr("Mouse")
281+ }
282+
283+ Column {
284+ anchors {
285+ left: parent.left
286+ right: parent.right
287+ }
288+ spacing: 0
289+ height: childrenRect.height
290+ ItemTitle {
291+ text: i18n.tr("Move:")
292+ showDivider: false
293+ }
294+
295+ Menus.SliderMenu {
296+ anchors {
297+ left: parent.left
298+ right: parent.right
299+ }
300+ id: mouseMoveSpeed
301+ objectName: "mouseMoveSpeed"
302+ showDivider: false
303+ function formatValue(v) { return v.toFixed(2) }
304+ minimumValue: 0.0
305+ maximumValue: 1.0
306+ value: settings.mouseCursorSpeed
307+ live: true
308+ property real serverValue: enabled ? settings.mouseCursorSpeed : 0.0
309+ USC.ServerPropertySynchroniser {
310+ userTarget: mouseMoveSpeed
311+ userProperty: "value"
312+ serverTarget: mouseMoveSpeed
313+ serverProperty: "serverValue"
314+ maximumWaitBufferInterval: 16
315+
316+ onSyncTriggered: settings.mouseCursorSpeed = value
317+ }
318+ }
319+ }
320+
321+ Column {
322+ anchors {
323+ left: parent.left
324+ right: parent.right
325+ }
326+ spacing: 0
327+ height: childrenRect.height
328+
329+ ItemTitle {
330+ text: i18n.tr("Scroll:")
331+ showDivider: false
332+ }
333+
334+ Menus.SliderMenu {
335+ anchors {
336+ left: parent.left
337+ right: parent.right
338+ }
339+ id: mouseScrollSpeed
340+ objectName: "mouseMoveSpeed"
341+ showDivider: false
342+ function formatValue(v) { return v.toFixed(2) }
343+ minimumValue: 0.0
344+ maximumValue: 1.0
345+ value: settings.mouseScrollSpeed
346+ live: true
347+ property real serverValue: enabled ? settings.mouseScrollSpeed : 0.0
348+ USC.ServerPropertySynchroniser {
349+ userTarget: mouseScrollSpeed
350+ userProperty: "value"
351+ serverTarget: mouseScrollSpeed
352+ serverProperty: "serverValue"
353+ maximumWaitBufferInterval: 16
354+
355+ onSyncTriggered: settings.mouseScrollSpeed = value
356+ }
357+ }
358+ }
359+ Column {
360+ anchors {
361+ left: parent.left
362+ right: parent.right
363+ }
364+ spacing: 0
365+ height: childrenRect.height
366+ ItemTitle {
367+ text: i18n.tr("Double-click:")
368+ showDivider: false
369+ }
370+
371+ Menus.SliderMenu {
372+ anchors {
373+ left: parent.left
374+ right: parent.right
375+ }
376+ id: mouseDoubleClickSpeed
377+ objectName: "mouseDoubleClickSpeed"
378+ showDivider: false
379+ function formatValue(v) { return v.toFixed(2) }
380+ minimumValue: 100
381+ maximumValue: 1000
382+ value: settings.mouseDoubleClickSpeed
383+ live: true
384+ property real serverValue: enabled ? settings.mouseDoubleClickSpeed : 0.0
385+ USC.ServerPropertySynchroniser {
386+ userTarget: mouseDoubleClickSpeed
387+ userProperty: "value"
388+ serverTarget: mouseDoubleClickSpeed
389+ serverProperty: "serverValue"
390+ maximumWaitBufferInterval: 16
391+
392+ onSyncTriggered: settings.mouseDoubleClickSpeed = value
393+ }
394+ }
395+ }
396+ Column {
397+ anchors {
398+ left: parent.left
399+ right: parent.right
400+ }
401+ spacing: units.gu(3)
402+ height: childrenRect.height
403+
404+ ItemTitle {
405+ text: i18n.tr("Test double-click:")
406+ showDivider: false
407+ }
408+
409+ TapArea {
410+ anchors {
411+ left: parent.left
412+ right: parent.right
413+ leftMargin: units.gu(2)
414+ rightMargin: units.gu(2)
415+ topMargin: units.gu(2)
416+ }
417+ height: units.gu(5)
418+ doubleTapSpeed: settings.mouseDoubleClickSpeed
419+ }
420+ }
421+
422+ PrimaryButtonSelector {
423+ id: mousePrimarySelector
424+ anchors {
425+ left: parent.left
426+ right: parent.right
427+ }
428+ height: childrenRect.height + units.gu(2)
429+ buttonEnum: settings.mousePrimaryButton
430+ onButtonEnumChanged: {
431+ settings.mousePrimaryButton = buttonEnum;
432+ }
433+ Binding {
434+ target: mousePrimarySelector
435+ property: "buttonEnum"
436+ value: settings.mousePrimaryButton
437+ }
438+ }
439+ }
440+
441+ Column {
442+ anchors {
443+ left: parent.left
444+ right: parent.right
445+ topMargin: units.gu(2)
446+ }
447+ visible: UnityInputInfo.touchpads > 0
448+ spacing: units.gu(0.1)
449+
450+ SectionHeader {
451+ text: i18n.tr("Touchpad")
452+ }
453+
454+ Column {
455+ anchors {
456+ left: parent.left
457+ right: parent.right
458+ }
459+ spacing: 0
460+ height: childrenRect.height
461+ ItemTitle {
462+ text: i18n.tr("Move:")
463+ showDivider: false
464+ }
465+
466+ Menus.SliderMenu {
467+ anchors {
468+ left: parent.left
469+ right: parent.right
470+ }
471+ id: touchMoveSpeed
472+ objectName: "touchMoveSpeed"
473+ showDivider: false
474+ function formatValue(v) { return v.toFixed(2) }
475+ minimumValue: 0.0
476+ maximumValue: 1.0
477+ value: settings.touchpadCursorSpeed
478+ live: true
479+ property real serverValue: enabled ? settings.touchpadCursorSpeed : 0.0
480+ USC.ServerPropertySynchroniser {
481+ userTarget: touchMoveSpeed
482+ userProperty: "value"
483+ serverTarget: touchMoveSpeed
484+ serverProperty: "serverValue"
485+ maximumWaitBufferInterval: 16
486+
487+ onSyncTriggered: settings.touchpadCursorSpeed = value
488+ }
489+ }
490+ }
491+
492+ Column {
493+ anchors {
494+ left: parent.left
495+ right: parent.right
496+ }
497+ spacing: 0
498+ height: childrenRect.height
499+ ItemTitle {
500+ text: i18n.tr("Scroll:")
501+ showDivider: false
502+ }
503+
504+ Menus.SliderMenu {
505+ anchors {
506+ left: parent.left
507+ right: parent.right
508+ }
509+ id: touchScrollSpeed
510+ objectName: "touchScrollSpeed"
511+ showDivider: false
512+ function formatValue(v) { return v.toFixed(2) }
513+ minimumValue: 0.0
514+ maximumValue: 1.0
515+ value: settings.touchpadScrollSpeed
516+ live: true
517+ property real serverValue: enabled ? settings.touchpadScrollSpeed : 0.0
518+ USC.ServerPropertySynchroniser {
519+ userTarget: touchScrollSpeed
520+ userProperty: "value"
521+ serverTarget: touchScrollSpeed
522+ serverProperty: "serverValue"
523+ maximumWaitBufferInterval: 16
524+
525+ onSyncTriggered: settings.touchpadScrollSpeed = value
526+ }
527+ }
528+ }
529+
530+ Column {
531+ anchors {
532+ left: parent.left
533+ right: parent.right
534+ }
535+ spacing: 0
536+ height: childrenRect.height
537+ ItemTitle {
538+ text: i18n.tr("Double-click:")
539+ showDivider: false
540+ }
541+
542+ Menus.SliderMenu {
543+ anchors {
544+ left: parent.left
545+ right: parent.right
546+ }
547+ id: touchClickSpeed
548+ objectName: "touchClickSpeed"
549+ showDivider: false
550+ function formatValue(v) { return v.toFixed(2) }
551+ minimumValue: 100
552+ maximumValue: 1000
553+ value: settings.touchpadDoubleClickSpeed
554+ live: true
555+ property real serverValue: enabled ? settings.touchpadDoubleClickSpeed : 0.0
556+ USC.ServerPropertySynchroniser {
557+ userTarget: touchClickSpeed
558+ userProperty: "value"
559+ serverTarget: touchClickSpeed
560+ serverProperty: "serverValue"
561+ maximumWaitBufferInterval: 16
562+
563+ onSyncTriggered: settings.touchpadDoubleClickSpeed = value
564+ }
565+ }
566+ }
567+
568+ Column {
569+ anchors {
570+ left: parent.left
571+ right: parent.right
572+ }
573+ spacing: units.gu(3)
574+ height: childrenRect.height
575+ ItemTitle {
576+ text: i18n.tr("Test double-click:")
577+ showDivider: false
578+ }
579+
580+ TapArea {
581+ anchors {
582+ left: parent.left
583+ right: parent.right
584+ leftMargin: units.gu(2)
585+ rightMargin: units.gu(2)
586+ }
587+ height: units.gu(5)
588+ doubleTapSpeed: settings.touchpadDoubleClickSpeed
589+ }
590+ }
591+
592+ PrimaryButtonSelector {
593+ id: touchpadPrimarySelector
594+ anchors {
595+ left: parent.left
596+ right: parent.right
597+ }
598+ height: childrenRect.height + units.gu(1)
599+ buttonEnum: settings.touchpadPrimaryButton
600+ onButtonEnumChanged: {
601+ settings.touchpadPrimaryButton = buttonEnum;
602+ }
603+ Binding {
604+ target: touchpadPrimarySelector
605+ property: "buttonEnum"
606+ value: settings.touchpadPrimaryButton
607+ }
608+ }
609+
610+ Column {
611+ anchors {
612+ left: parent.left
613+ right: parent.right
614+ leftMargin: units.gu(2)
615+ rightMargin: units.gu(2)
616+ topMargin: units.gu(2)
617+ }
618+ spacing: units.gu(1)
619+ Row {
620+ spacing: units.gu(1)
621+ CheckBox {
622+ property bool serverChecked: settings.touchpadTapToClick
623+ onServerCheckedChanged: checked = serverChecked
624+ Component.onCompleted: checked = serverChecked
625+ onTriggered: settings.touchpadTapToClick = checked
626+ }
627+ Label {
628+ height: parent.height
629+ verticalAlignment: Text.AlignVCenter
630+ text: i18n.tr("Tap to click")
631+ }
632+ }
633+ Row {
634+ spacing: units.gu(1)
635+ CheckBox {
636+ property bool serverChecked: settings.touchpadTwoFingerScroll
637+ onServerCheckedChanged: checked = serverChecked
638+ Component.onCompleted: checked = serverChecked
639+ onTriggered: settings.touchpadTwoFingerScroll = checked
640+ }
641+ Label {
642+ height: parent.height
643+ verticalAlignment: Text.AlignVCenter
644+ text: i18n.tr("Scroll with two fingers")
645+ }
646+ }
647+ }
648+
649+ ListItem.Header {
650+ anchors.topMargin: units.gu(2)
651+ text: i18n.tr("Ignore touchpad when:")
652+ }
653+ Column {
654+ anchors {
655+ left: parent.left
656+ right: parent.right
657+ leftMargin: units.gu(2)
658+ rightMargin: units.gu(2)
659+ topMargin: units.gu(2)
660+ }
661+ spacing: units.gu(1)
662+ Row {
663+ spacing: units.gu(1)
664+ CheckBox {
665+ property bool serverChecked: settings.touchpadDisableWhileTyping
666+ onServerCheckedChanged: checked = serverChecked
667+ Component.onCompleted: checked = serverChecked
668+ onTriggered: settings.touchpadDisableWhileTyping = checked
669+ }
670+ Label {
671+ height: parent.height
672+ verticalAlignment: Text.AlignVCenter
673+ text: i18n.tr("Typing")
674+ }
675+ }
676+ Row {
677+ spacing: units.gu(1)
678+ CheckBox {
679+ property bool serverChecked: settings.touchpadDisableWithMouse
680+ onServerCheckedChanged: checked = serverChecked
681+ Component.onCompleted: checked = serverChecked
682+ onTriggered: settings.touchpadDisableWithMouse = checked
683+ }
684+ Label {
685+ height: parent.height
686+ verticalAlignment: Text.AlignVCenter
687+ text: i18n.tr("A mouse is connected")
688+ }
689+ }
690+ }
691+ }
692+}
693
694=== added directory 'plugins/mouse/InputInfo'
695=== added file 'plugins/mouse/InputInfo/CMakeLists.txt'
696--- plugins/mouse/InputInfo/CMakeLists.txt 1970-01-01 00:00:00 +0000
697+++ plugins/mouse/InputInfo/CMakeLists.txt 2016-01-05 14:44:19 +0000
698@@ -0,0 +1,41 @@
699+# This is a temporary snapshot of the WIP QInputInfo API as we
700+# require this in unity now but upstream isn't finished yet.
701+# Eventually this should be dropped in favor of the upstream
702+# QInputInfo API.
703+
704+project(InputInfo)
705+
706+find_package(Qt5Core REQUIRED)
707+find_package(Qt5Quick REQUIRED)
708+
709+pkg_check_modules(LIBUDEV REQUIRED libudev)
710+pkg_check_modules(LIBEVDEV REQUIRED libevdev)
711+
712+include_directories(
713+ ${CMAKE_CURRENT_SOURCE_DIR}
714+ ${CMAKE_CURRENT_BINARY_DIR}
715+ ${LIBUDEV_INCLUDE_DIRS}
716+ ${LIBEVDEV_INCLUDE_DIRS}
717+)
718+
719+set(InputInfo_SOURCES
720+ plugin.cpp
721+ qinputinfo.cpp
722+ qdeclarativeinputdeviceinfo.cpp
723+ linux/qinputdeviceinfo_linux.cpp
724+)
725+
726+add_library(InputInfo SHARED
727+ ${InputInfo_SOURCES}
728+)
729+
730+target_link_libraries(InputInfo
731+ ${LIBUDEV_LDFLAGS}
732+ ${LIBEVDEV_LDFLAGS}
733+)
734+
735+qt5_use_modules(InputInfo Core Qml Quick)
736+
737+set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Mouse/InputInfo)
738+install(TARGETS InputInfo DESTINATION ${PLUG_DIR})
739+install(FILES qmldir DESTINATION ${PLUG_DIR})
740
741=== added directory 'plugins/mouse/InputInfo/linux'
742=== added file 'plugins/mouse/InputInfo/linux/qinputdeviceinfo_linux.cpp'
743--- plugins/mouse/InputInfo/linux/qinputdeviceinfo_linux.cpp 1970-01-01 00:00:00 +0000
744+++ plugins/mouse/InputInfo/linux/qinputdeviceinfo_linux.cpp 2016-01-05 14:44:19 +0000
745@@ -0,0 +1,249 @@
746+/****************************************************************************
747+**
748+** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies).
749+** Contact: http://www.qt-project.org/legal
750+**
751+** This file is part of the QtSystems module of the Qt Toolkit.
752+**
753+** $QT_BEGIN_LICENSE:LGPL$
754+** Commercial License Usage
755+** Licensees holding valid commercial Qt licenses may use this file in
756+** accordance with the commercial license agreement provided with the
757+** Software or, alternatively, in accordance with the terms contained in
758+** a written agreement between you and Digia. For licensing terms and
759+** conditions see http://qt.digia.com/licensing. For further information
760+** use the contact form at http://qt.digia.com/contact-us.
761+**
762+** GNU Lesser General Public License Usage
763+** Alternatively, this file may be used under the terms of the GNU Lesser
764+** General Public License version 2.1 as published by the Free Software
765+** Foundation and appearing in the file LICENSE.LGPL included in the
766+** packaging of this file. Please review the following information to
767+** ensure the GNU Lesser General Public License version 2.1 requirements
768+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
769+**
770+** In addition, as a special exception, Digia gives you certain additional
771+** rights. These rights are described in the Digia Qt LGPL Exception
772+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
773+**
774+** GNU General Public License Usage
775+** Alternatively, this file may be used under the terms of the GNU
776+** General Public License version 3.0 as published by the Free Software
777+** Foundation and appearing in the file LICENSE.GPL included in the
778+** packaging of this file. Please review the following information to
779+** ensure the GNU General Public License version 3.0 requirements will be
780+** met: http://www.gnu.org/copyleft/gpl.html.
781+**
782+**
783+** $QT_END_LICENSE$
784+**
785+****************************************************************************/
786+
787+#include "qinputdeviceinfo_linux_p.h"
788+
789+#include <libudev.h>
790+#include <libevdev/libevdev.h>
791+#include <fcntl.h>
792+#include <QDebug>
793+#include <QSocketNotifier>
794+#include <QTimer>
795+
796+QInputDeviceInfoPrivate::QInputDeviceInfoPrivate(QObject *parent) :
797+ QObject(parent)
798+ , udev(0)
799+{
800+ QTimer::singleShot(250,this,SLOT(init()));
801+}
802+
803+void QInputDeviceInfoPrivate::init()
804+{
805+ if (!udev)
806+ udev = udev_new();
807+
808+ struct udev_list_entry *devices, *dev_list_entry;
809+ struct udev_device *dev;
810+
811+ QString subsystem = QStringLiteral("input");
812+ struct udev_enumerate *enumerate = 0;
813+
814+ if (udev) {
815+
816+ udevMonitor = udev_monitor_new_from_netlink(udev, "udev");
817+ udev_monitor_filter_add_match_subsystem_devtype(udevMonitor, subsystem.toLatin1(), NULL);
818+ enumerate = udev_enumerate_new(udev);
819+ udev_enumerate_add_match_subsystem(enumerate, subsystem.toLatin1());
820+
821+
822+ udev_monitor_enable_receiving(udevMonitor);
823+ notifierFd = udev_monitor_get_fd(udevMonitor);
824+
825+ notifier = new QSocketNotifier(notifierFd, QSocketNotifier::Read, this);
826+ connect(notifier, SIGNAL(activated(int)), this, SLOT(onUDevChanges()));
827+
828+
829+ udev_enumerate_scan_devices(enumerate);
830+ devices = udev_enumerate_get_list_entry(enumerate);
831+
832+ udev_list_entry_foreach(dev_list_entry, devices) {
833+ const char *path;
834+ path = udev_list_entry_get_name(dev_list_entry);
835+
836+ dev = udev_device_new_from_syspath(udev, path);
837+
838+ QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev));
839+
840+ if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) {
841+
842+ if (eventPath.contains(QStringLiteral("event"))) {
843+ eventPath.prepend(QStringLiteral("/dev/input/"));
844+
845+ QInputDevice *iDevice = addDevice(eventPath);
846+ if (!iDevice)
847+ continue;
848+
849+ qDebug() << "*** ADDING DEVICE" << eventPath;
850+
851+ iDevice->setTypes(getInputTypes(dev));
852+
853+ if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0)
854+ iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Switch);
855+
856+ if (iDevice->buttons().count() > 0 && iDevice->types() == QInputDeviceInfo::Unknown)
857+ iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Button);
858+
859+ deviceList.append(iDevice);
860+ deviceMap.insert(eventPath,iDevice);
861+ Q_EMIT newDevice(eventPath);
862+
863+ }
864+ }
865+ }
866+ udev_enumerate_unref(enumerate);
867+ }
868+ Q_EMIT ready();
869+}
870+
871+QInputDeviceInfo::InputTypes QInputDeviceInfoPrivate::getInputTypes( struct udev_device *dev)
872+{
873+ qDebug() << "******* have input type Keyboard" << udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD");
874+ qDebug() << "******* have input type Mouse" << udev_device_get_property_value(dev, "ID_INPUT_MOUSE");
875+ qDebug() << "******* have input type Touchpad" << udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD");
876+ qDebug() << "******* have input type Touchscreen" << udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN");
877+ qDebug() << "******* have input type Tablet" << udev_device_get_property_value(dev, "ID_INPUT_TABLET");
878+ qDebug() << "******* have input type joystick" << udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK");
879+ QInputDeviceInfo::InputTypes types = QInputDeviceInfo::Unknown;
880+ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD"), "1") == 0 )
881+ types |= QInputDeviceInfo::Keyboard;
882+
883+ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_MOUSE"), "1") == 0)
884+ types |= QInputDeviceInfo::Mouse;
885+
886+ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHPAD"), "1") == 0)
887+ types |= QInputDeviceInfo::TouchPad;
888+
889+ if (qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"), "1") == 0
890+ || qstrcmp(udev_device_get_property_value(dev, "ID_INPUT_TABLET"), "1") == 0)
891+ types |= QInputDeviceInfo::TouchScreen;
892+
893+ return types;
894+}
895+
896+QInputDevice *QInputDeviceInfoPrivate::addDevice(const QString &path)
897+{
898+ QInputDevice *inputDevice = new QInputDevice(this);
899+
900+ struct libevdev *dev = NULL;
901+ int fd;
902+ int rc = 1;
903+ fd = open(path.toLatin1(), O_RDONLY|O_NONBLOCK);
904+
905+ if (fd == -1) {
906+ qDebug() << "Failed to open";
907+ return inputDevice;
908+ }
909+ rc = libevdev_new_from_fd(fd, &dev);
910+ if (rc < 0) {
911+ qDebug() << "Failed to init libevdev ("<< strerror(-rc) << ")";
912+ return inputDevice;
913+ }
914+
915+ inputDevice->setName(QString::fromLatin1(libevdev_get_name(dev)));
916+ inputDevice->setDevicePath(path);
917+ for (int i = 0; i < EV_MAX; i++) {
918+ if (i == EV_KEY || i == EV_SW || i == EV_REL
919+ || i == EV_REL || i == EV_ABS) {
920+ for (int j = 0; j < libevdev_event_type_get_max(i); j++) {
921+ if (libevdev_has_event_code(dev, i, j)) {
922+ switch (i) {
923+ case EV_KEY:
924+ inputDevice->addButton(j);
925+ break;
926+ case EV_SW:
927+ inputDevice->addSwitch(j);
928+ break;
929+ case EV_REL:
930+ inputDevice->addRelativeAxis(j);
931+ break;
932+ case EV_ABS:
933+ inputDevice->addAbsoluteAxis(j);
934+ break;
935+ };
936+ }
937+ }
938+ }
939+ }
940+ return inputDevice;
941+}
942+
943+void QInputDeviceInfoPrivate::removeDevice(const QString &path)
944+{
945+ for (int i = 0; i < deviceList.size(); ++i) {
946+ if (deviceList.at(i)->devicePath() == path) {
947+ delete deviceList.takeAt(i);
948+ deviceMap.remove(path);
949+ Q_EMIT deviceRemoved(path);
950+ }
951+ }
952+}
953+
954+void QInputDeviceInfoPrivate::onUDevChanges()
955+{
956+ struct udev_device *dev = udev_monitor_receive_device(udevMonitor);
957+ if (dev) {
958+ if (qstrcmp(udev_device_get_subsystem(dev), "input") == 0 ) {
959+ QString eventPath = QString::fromLatin1(udev_device_get_sysname(dev));
960+
961+ if (eventPath.contains(QStringLiteral("input")))
962+ return;
963+
964+ QString action = QString::fromStdString(udev_device_get_action(dev));
965+
966+ if (!eventPath.contains(QStringLiteral("/dev/input/")))
967+ eventPath.prepend(QStringLiteral("/dev/input/"));
968+
969+ if (action == QStringLiteral("add")) {
970+
971+ QInputDevice *iDevice = addDevice(eventPath);
972+ if (!iDevice)
973+ return;
974+
975+ iDevice->setTypes(getInputTypes(dev));
976+ udev_device_unref(dev);
977+
978+ if (iDevice->switches().count() > 0 && iDevice->buttons().count() == 0)
979+ iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Switch);
980+
981+ if (iDevice->buttons().count() > 0 && iDevice->types() == QInputDeviceInfo::Unknown)
982+ iDevice->setTypes(iDevice->types() | QInputDeviceInfo::Button);
983+
984+ deviceList.append(iDevice);
985+ deviceMap.insert(eventPath,iDevice);
986+
987+ Q_EMIT newDevice(eventPath);
988+
989+ } else if (action == QStringLiteral("remove")) {
990+ removeDevice(eventPath);
991+ }
992+ }
993+ }
994+}
995
996=== added file 'plugins/mouse/InputInfo/linux/qinputdeviceinfo_linux_p.h'
997--- plugins/mouse/InputInfo/linux/qinputdeviceinfo_linux_p.h 1970-01-01 00:00:00 +0000
998+++ plugins/mouse/InputInfo/linux/qinputdeviceinfo_linux_p.h 2016-01-05 14:44:19 +0000
999@@ -0,0 +1,91 @@
1000+/****************************************************************************
1001+**
1002+** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies).
1003+** Contact: http://www.qt-project.org/legal
1004+**
1005+** This file is part of the QtSystems module of the Qt Toolkit.
1006+**
1007+** $QT_BEGIN_LICENSE:LGPL$
1008+** Commercial License Usage
1009+** Licensees holding valid commercial Qt licenses may use this file in
1010+** accordance with the commercial license agreement provided with the
1011+** Software or, alternatively, in accordance with the terms contained in
1012+** a written agreement between you and Digia. For licensing terms and
1013+** conditions see http://qt.digia.com/licensing. For further information
1014+** use the contact form at http://qt.digia.com/contact-us.
1015+**
1016+** GNU Lesser General Public License Usage
1017+** Alternatively, this file may be used under the terms of the GNU Lesser
1018+** General Public License version 2.1 as published by the Free Software
1019+** Foundation and appearing in the file LICENSE.LGPL included in the
1020+** packaging of this file. Please review the following information to
1021+** ensure the GNU Lesser General Public License version 2.1 requirements
1022+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
1023+**
1024+** In addition, as a special exception, Digia gives you certain additional
1025+** rights. These rights are described in the Digia Qt LGPL Exception
1026+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
1027+**
1028+** GNU General Public License Usage
1029+** Alternatively, this file may be used under the terms of the GNU
1030+** General Public License version 3.0 as published by the Free Software
1031+** Foundation and appearing in the file LICENSE.GPL included in the
1032+** packaging of this file. Please review the following information to
1033+** ensure the GNU General Public License version 3.0 requirements will be
1034+** met: http://www.gnu.org/copyleft/gpl.html.
1035+**
1036+**
1037+** $QT_END_LICENSE$
1038+**
1039+****************************************************************************/
1040+
1041+#ifndef QINPUTDEVICEINFO_LINUX_P_H
1042+#define QINPUTDEVICEINFO_LINUX_P_H
1043+
1044+#include <QObject>
1045+#include "qinputinfo.h"
1046+#include <libudev.h>
1047+
1048+class QInputDevicePrivate : public QObject
1049+{
1050+ Q_OBJECT
1051+public:
1052+ explicit QInputDevicePrivate(QObject *parent = 0);
1053+
1054+ QString name;
1055+ QString devicePath;
1056+ QList <int> buttons; //keys
1057+ QList <int> switches;
1058+ QList <int> relativeAxis;
1059+ QList <int> absoluteAxis;
1060+ QInputDeviceInfo::InputTypes types;
1061+};
1062+
1063+class QInputDeviceInfoPrivate : public QObject
1064+{
1065+ Q_OBJECT
1066+public:
1067+ explicit QInputDeviceInfoPrivate(QObject *parent = 0);
1068+ QVector <QInputDevice *> deviceList;
1069+ QMap <QString, QInputDevice *> deviceMap;
1070+
1071+Q_SIGNALS:
1072+ void newDevice(const QString &);
1073+ void deviceRemoved(const QString &);
1074+ void ready();
1075+
1076+private:
1077+ struct udev *udev;
1078+ QInputDevice *addDevice(const QString &path);
1079+ void removeDevice(const QString &path);
1080+ QSocketNotifier *notifier;
1081+ int notifierFd;
1082+ struct udev_monitor *udevMonitor;
1083+ QInputDeviceInfo::InputTypes getInputTypes( struct udev_device *);
1084+
1085+private Q_SLOTS:
1086+ void onUDevChanges();
1087+ void init();
1088+};
1089+
1090+#endif // QINPUTDEVICEINFO_LINUX_P_H
1091
1092=== added file 'plugins/mouse/InputInfo/plugin.cpp'
1093--- plugins/mouse/InputInfo/plugin.cpp 1970-01-01 00:00:00 +0000
1094+++ plugins/mouse/InputInfo/plugin.cpp 2016-01-05 14:44:19 +0000
1095@@ -0,0 +1,32 @@
1096+/*
1097+ * Copyright 2015 Canonical Ltd.
1098+ *
1099+ * This program is free software; you can redistribute it and/or modify
1100+ * it under the terms of the GNU Lesser General Public License as published by
1101+ * the Free Software Foundation; version 3.
1102+ *
1103+ * This program is distributed in the hope that it will be useful,
1104+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1105+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1106+ * GNU Lesser General Public License for more details.
1107+ *
1108+ * You should have received a copy of the GNU Lesser General Public License
1109+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1110+ */
1111+
1112+// Qt
1113+#include <QtQml/qqml.h>
1114+
1115+// self
1116+#include "plugin.h"
1117+
1118+// local
1119+#include "qdeclarativeinputdeviceinfo_p.h"
1120+
1121+void InputInfoPlugin::registerTypes(const char *uri)
1122+{
1123+ int major = 0;
1124+ int minor = 1;
1125+ qmlRegisterType<QDeclarativeInputDeviceInfo>(uri, major, minor, "InputDeviceInfo");
1126+ qmlRegisterType<QInputDevice>(uri, major, minor, "InputInfo");
1127+}
1128
1129=== added file 'plugins/mouse/InputInfo/plugin.h'
1130--- plugins/mouse/InputInfo/plugin.h 1970-01-01 00:00:00 +0000
1131+++ plugins/mouse/InputInfo/plugin.h 2016-01-05 14:44:19 +0000
1132@@ -0,0 +1,30 @@
1133+/*
1134+ * Copyright 2015 Canonical Ltd.
1135+ *
1136+ * This program is free software; you can redistribute it and/or modify
1137+ * it under the terms of the GNU Lesser General Public License as published by
1138+ * the Free Software Foundation; version 3.
1139+ *
1140+ * This program is distributed in the hope that it will be useful,
1141+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1142+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1143+ * GNU Lesser General Public License for more details.
1144+ *
1145+ * You should have received a copy of the GNU Lesser General Public License
1146+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1147+ */
1148+
1149+#ifndef INPUTINFO_PLUGIN_H
1150+#define INPUTINFO_PLUGIN_H
1151+
1152+#include <QtQml/QQmlExtensionPlugin>
1153+
1154+class InputInfoPlugin : public QQmlExtensionPlugin
1155+{
1156+ Q_OBJECT
1157+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
1158+public:
1159+ void registerTypes(const char *uri);
1160+};
1161+
1162+#endif // INPUTINFO_PLUGIN_H
1163
1164=== added file 'plugins/mouse/InputInfo/qdeclarativeinputdeviceinfo.cpp'
1165--- plugins/mouse/InputInfo/qdeclarativeinputdeviceinfo.cpp 1970-01-01 00:00:00 +0000
1166+++ plugins/mouse/InputInfo/qdeclarativeinputdeviceinfo.cpp 2016-01-05 14:44:19 +0000
1167@@ -0,0 +1,143 @@
1168+/****************************************************************************
1169+**
1170+** Copyright (C) 2015 Jolla.
1171+** Contact: http://www.qt-project.org/legal
1172+**
1173+** This file is part of the QtSystems module of the Qt Toolkit.
1174+**
1175+** $QT_BEGIN_LICENSE:LGPL$
1176+** Commercial License Usage
1177+** Licensees holding valid commercial Qt licenses may use this file in
1178+** accordance with the commercial license agreement provided with the
1179+** Software or, alternatively, in accordance with the terms contained in
1180+** a written agreement between you and Digia. For licensing terms and
1181+** conditions see http://qt.digia.com/licensing. For further information
1182+** use the contact form at http://qt.digia.com/contact-us.
1183+**
1184+** GNU Lesser General Public License Usage
1185+** Alternatively, this file may be used under the terms of the GNU Lesser
1186+** General Public License version 2.1 as published by the Free Software
1187+** Foundation and appearing in the file LICENSE.LGPL included in the
1188+** packaging of this file. Please review the following information to
1189+** ensure the GNU Lesser General Public License version 2.1 requirements
1190+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
1191+**
1192+** In addition, as a special exception, Digia gives you certain additional
1193+** rights. These rights are described in the Digia Qt LGPL Exception
1194+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
1195+**
1196+** GNU General Public License Usage
1197+** Alternatively, this file may be used under the terms of the GNU
1198+** General Public License version 3.0 as published by the Free Software
1199+** Foundation and appearing in the file LICENSE.GPL included in the
1200+** packaging of this file. Please review the following information to
1201+** ensure the GNU General Public License version 3.0 requirements will be
1202+** met: http://www.gnu.org/copyleft/gpl.html.
1203+**
1204+**
1205+** $QT_END_LICENSE$
1206+**
1207+****************************************************************************/
1208+#include "qdeclarativeinputdeviceinfo_p.h"
1209+
1210+QDeclarativeInputDeviceInfo::QDeclarativeInputDeviceInfo(QObject *parent) :
1211+ QAbstractListModel(parent),
1212+ deviceInfo(new QInputDeviceInfo)
1213+{
1214+ connect(deviceInfo,SIGNAL(ready()),this,SLOT(updateDeviceList()));
1215+ connect(deviceInfo, &QInputDeviceInfo::deviceAdded,this,&QDeclarativeInputDeviceInfo::addedDevice);
1216+ connect(deviceInfo, &QInputDeviceInfo::deviceRemoved,this,&QDeclarativeInputDeviceInfo::removedDevice);
1217+}
1218+
1219+QDeclarativeInputDeviceInfo::~QDeclarativeInputDeviceInfo()
1220+{
1221+ delete deviceInfo;
1222+}
1223+
1224+QVariant QDeclarativeInputDeviceInfo::data(const QModelIndex &index, int role) const
1225+{
1226+ switch (role) {
1227+ case ServiceRole:
1228+ return QVariant::fromValue(static_cast<QObject *>(inputDevices.value(index.row())));
1229+ }
1230+
1231+ return QVariant();
1232+}
1233+
1234+int QDeclarativeInputDeviceInfo::rowCount(const QModelIndex &parent) const
1235+{
1236+ Q_UNUSED(parent);
1237+
1238+ return inputDevices.count();
1239+}
1240+
1241+int QDeclarativeInputDeviceInfo::indexOf(const QString &devicePath) const
1242+{
1243+ int idx(-1);
1244+ Q_FOREACH (QInputDevice *device, inputDevices) {
1245+ idx++;
1246+ if (device->devicePath() == devicePath) return idx;
1247+ }
1248+
1249+ return -1;
1250+}
1251+
1252+QInputDevice *QDeclarativeInputDeviceInfo::get(int index) const
1253+{
1254+ if (index < 0 || index > inputDevices.count())
1255+ return 0;
1256+ return inputDevices.value(index);
1257+}
1258+
1259+void QDeclarativeInputDeviceInfo::updateDeviceList()
1260+{
1261+ QVector <QInputDevice *> newDevices = deviceInfo->deviceList();
1262+
1263+ int numNew = newDevices.count();
1264+
1265+ for (int i = 0; i < numNew; i++) {
1266+ int j = inputDevices.indexOf(newDevices.value(i));
1267+ if (j == -1) {
1268+ // not found -> remove from list
1269+ beginInsertRows(QModelIndex(), i, i);
1270+ inputDevices.insert(i, newDevices.value(i));
1271+ endInsertRows();
1272+ } else if (i != j) {
1273+ // changed its position -> move it
1274+ QInputDevice* device = inputDevices.value(j);
1275+ beginMoveRows(QModelIndex(), j, j, QModelIndex(), i);
1276+ inputDevices.remove(j);
1277+ inputDevices.insert(i, device);
1278+ endMoveRows();
1279+ } else {
1280+ QModelIndex changedIndex(this->index(j, 0, QModelIndex()));
1281+ Q_EMIT dataChanged(changedIndex, changedIndex);
1282+ }
1283+ }
1284+
1285+ int numOld = inputDevices.count();
1286+ if (numOld > numNew) {
1287+ beginRemoveRows(QModelIndex(), numNew, numOld - 1);
1288+ inputDevices.remove(numNew, numOld - numNew);
1289+ endRemoveRows();
1290+ }
1291+}
1292+
1293+void QDeclarativeInputDeviceInfo::addedDevice(const QString &devicePath)
1294+{
1295+ updateDeviceList();
1296+ Q_EMIT newDevice(devicePath);
1297+}
1298+
1299+void QDeclarativeInputDeviceInfo::removedDevice(const QString &devicePath)
1300+{
1301+ updateDeviceList();
1302+ Q_EMIT deviceRemoved(devicePath);
1303+}
1304+
1305+QHash<int, QByteArray> QDeclarativeInputDeviceInfo::roleNames() const
1306+{
1307+ QHash<int, QByteArray> roles;
1308+ roles.insert(ServiceRole, "service");
1309+ return roles;
1310+}
1311
1312=== added file 'plugins/mouse/InputInfo/qdeclarativeinputdeviceinfo_p.h'
1313--- plugins/mouse/InputInfo/qdeclarativeinputdeviceinfo_p.h 1970-01-01 00:00:00 +0000
1314+++ plugins/mouse/InputInfo/qdeclarativeinputdeviceinfo_p.h 2016-01-05 14:44:19 +0000
1315@@ -0,0 +1,86 @@
1316+/****************************************************************************
1317+**
1318+** Copyright (C) 2015 Jolla.
1319+** Contact: http://www.qt-project.org/legal
1320+**
1321+** This file is part of the QtSystems module of the Qt Toolkit.
1322+**
1323+** $QT_BEGIN_LICENSE:LGPL$
1324+** Commercial License Usage
1325+** Licensees holding valid commercial Qt licenses may use this file in
1326+** accordance with the commercial license agreement provided with the
1327+** Software or, alternatively, in accordance with the terms contained in
1328+** a written agreement between you and Digia. For licensing terms and
1329+** conditions see http://qt.digia.com/licensing. For further information
1330+** use the contact form at http://qt.digia.com/contact-us.
1331+**
1332+** GNU Lesser General Public License Usage
1333+** Alternatively, this file may be used under the terms of the GNU Lesser
1334+** General Public License version 2.1 as published by the Free Software
1335+** Foundation and appearing in the file LICENSE.LGPL included in the
1336+** packaging of this file. Please review the following information to
1337+** ensure the GNU Lesser General Public License version 2.1 requirements
1338+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
1339+**
1340+** In addition, as a special exception, Digia gives you certain additional
1341+** rights. These rights are described in the Digia Qt LGPL Exception
1342+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
1343+**
1344+** GNU General Public License Usage
1345+** Alternatively, this file may be used under the terms of the GNU
1346+** General Public License version 3.0 as published by the Free Software
1347+** Foundation and appearing in the file LICENSE.GPL included in the
1348+** packaging of this file. Please review the following information to
1349+** ensure the GNU General Public License version 3.0 requirements will be
1350+** met: http://www.gnu.org/copyleft/gpl.html.
1351+**
1352+**
1353+** $QT_END_LICENSE$
1354+**
1355+****************************************************************************/
1356+
1357+#ifndef QDECLARATIVEINPUTDEVICEINFO_H
1358+#define QDECLARATIVEINPUTDEVICEINFO_H
1359+
1360+#include <QObject>
1361+#include <QAbstractListModel>
1362+#include "qinputinfo.h"
1363+
1364+class QDeclarativeInputDeviceInfo : public QAbstractListModel
1365+{
1366+ Q_OBJECT
1367+ Q_DISABLE_COPY(QDeclarativeInputDeviceInfo)
1368+
1369+public:
1370+ enum ItemRoles {
1371+ ServiceRole = Qt::UserRole + 1
1372+ };
1373+
1374+ explicit QDeclarativeInputDeviceInfo(QObject *parent = 0);
1375+ virtual ~QDeclarativeInputDeviceInfo();
1376+
1377+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
1378+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
1379+
1380+ QHash<int, QByteArray> roleNames() const;
1381+
1382+ Q_INVOKABLE int indexOf(const QString &devicePath) const;
1383+
1384+ Q_INVOKABLE QInputDevice *get(int index) const;
1385+
1386+Q_SIGNALS:
1387+ void newDevice(const QString &devicePath);
1388+ void deviceRemoved(const QString &devicePath);
1389+
1390+public Q_SLOTS:
1391+ void updateDeviceList();
1392+private:
1393+ QInputDeviceInfo *deviceInfo;
1394+ QVector<QInputDevice *> inputDevices;
1395+private Q_SLOTS:
1396+ void addedDevice(const QString &);
1397+ void removedDevice(const QString &path);
1398+
1399+};
1400+
1401+#endif // QDECLARATIVEINPUTDEVICEINFO_H
1402
1403=== added file 'plugins/mouse/InputInfo/qinputinfo.cpp'
1404--- plugins/mouse/InputInfo/qinputinfo.cpp 1970-01-01 00:00:00 +0000
1405+++ plugins/mouse/InputInfo/qinputinfo.cpp 2016-01-05 14:44:19 +0000
1406@@ -0,0 +1,159 @@
1407+/****************************************************************************
1408+**
1409+** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies).
1410+** Contact: http://www.qt-project.org/legal
1411+**
1412+** This file is part of the QtSystems module of the Qt Toolkit.
1413+**
1414+** $QT_BEGIN_LICENSE:LGPL$
1415+** Commercial License Usage
1416+** Licensees holding valid commercial Qt licenses may use this file in
1417+** accordance with the commercial license agreement provided with the
1418+** Software or, alternatively, in accordance with the terms contained in
1419+** a written agreement between you and Digia. For licensing terms and
1420+** conditions see http://qt.digia.com/licensing. For further information
1421+** use the contact form at http://qt.digia.com/contact-us.
1422+**
1423+** GNU Lesser General Public License Usage
1424+** Alternatively, this file may be used under the terms of the GNU Lesser
1425+** General Public License version 2.1 as published by the Free Software
1426+** Foundation and appearing in the file LICENSE.LGPL included in the
1427+** packaging of this file. Please review the following information to
1428+** ensure the GNU Lesser General Public License version 2.1 requirements
1429+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
1430+**
1431+** In addition, as a special exception, Digia gives you certain additional
1432+** rights. These rights are described in the Digia Qt LGPL Exception
1433+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
1434+**
1435+** GNU General Public License Usage
1436+** Alternatively, this file may be used under the terms of the GNU
1437+** General Public License version 3.0 as published by the Free Software
1438+** Foundation and appearing in the file LICENSE.GPL included in the
1439+** packaging of this file. Please review the following information to
1440+** ensure the GNU General Public License version 3.0 requirements will be
1441+** met: http://www.gnu.org/copyleft/gpl.html.
1442+**
1443+**
1444+** $QT_END_LICENSE$
1445+**
1446+****************************************************************************/
1447+
1448+#include "qinputinfo.h"
1449+
1450+#if defined(Q_OS_LINUX)
1451+#include "linux/qinputdeviceinfo_linux_p.h"
1452+#endif
1453+
1454+QT_BEGIN_NAMESPACE
1455+
1456+
1457+QInputDevicePrivate::QInputDevicePrivate(QObject *parent) :
1458+ QObject(parent),
1459+ types(QInputDeviceInfo::Unknown)
1460+{
1461+}
1462+
1463+QInputDevice::QInputDevice(QObject *parent) :
1464+ QObject(parent),
1465+ d_ptr(new QInputDevicePrivate(this))
1466+{
1467+}
1468+
1469+QString QInputDevice::name() const
1470+{
1471+ return d_ptr->name;
1472+}
1473+
1474+void QInputDevice::setName(const QString &name)
1475+{
1476+ d_ptr->name = name;
1477+}
1478+
1479+QString QInputDevice::devicePath() const
1480+{
1481+ return d_ptr->devicePath;
1482+}
1483+
1484+void QInputDevice::setDevicePath(const QString &path)
1485+{
1486+ d_ptr->devicePath = path;
1487+}
1488+
1489+QList <int> QInputDevice::buttons() const
1490+{
1491+ return d_ptr->buttons;
1492+}
1493+
1494+void QInputDevice::addButton(int buttonCode)
1495+{
1496+ d_ptr->buttons.append(buttonCode);
1497+}
1498+
1499+QList <int> QInputDevice::switches() const
1500+{
1501+ return d_ptr->switches;
1502+}
1503+
1504+void QInputDevice::addSwitch(int switchCode)
1505+{
1506+ d_ptr->switches.append(switchCode);
1507+}
1508+
1509+QList <int> QInputDevice::relativeAxis() const
1510+{
1511+ return d_ptr->relativeAxis;
1512+}
1513+
1514+void QInputDevice::addRelativeAxis(int axisCode)
1515+{
1516+ d_ptr->relativeAxis.append(axisCode);
1517+}
1518+
1519+QList <int> QInputDevice::absoluteAxis() const
1520+{
1521+ return d_ptr->absoluteAxis;
1522+}
1523+
1524+void QInputDevice::addAbsoluteAxis(int axisCode)
1525+{
1526+ d_ptr->absoluteAxis.append(axisCode);
1527+}
1528+
1529+QInputDeviceInfo::InputTypes QInputDevice::types()
1530+{
1531+ return d_ptr->types;
1532+}
1533+
1534+void QInputDevice::setTypes(QInputDeviceInfo::InputTypes types)
1535+{
1536+ d_ptr->types = types;
1537+}
1538+
1539+
1540+QInputDeviceInfo::QInputDeviceInfo(QObject *parent) :
1541+ QObject(parent),
1542+ d_ptr(new QInputDeviceInfoPrivate(this))
1543+{
1544+ connect(d_ptr, &QInputDeviceInfoPrivate::newDevice,this,&QInputDeviceInfo::addedDevice);
1545+ connect(d_ptr, &QInputDeviceInfoPrivate::deviceRemoved,this,&QInputDeviceInfo::deviceRemoved);
1546+
1547+ connect(d_ptr,SIGNAL(ready()),this,SIGNAL(ready()));
1548+}
1549+
1550+QVector <QInputDevice *> QInputDeviceInfo::deviceList()
1551+{
1552+ return d_ptr->deviceList;
1553+}
1554+
1555+QMap <QString, QInputDevice *> QInputDeviceInfo::deviceMap()
1556+{
1557+ return d_ptr->deviceMap;
1558+}
1559+
1560+void QInputDeviceInfo::addedDevice(const QString & devicePath)
1561+{
1562+ Q_EMIT deviceAdded(devicePath);
1563+}
1564+
1565+QT_END_NAMESPACE
1566
1567=== added file 'plugins/mouse/InputInfo/qinputinfo.h'
1568--- plugins/mouse/InputInfo/qinputinfo.h 1970-01-01 00:00:00 +0000
1569+++ plugins/mouse/InputInfo/qinputinfo.h 2016-01-05 14:44:19 +0000
1570@@ -0,0 +1,143 @@
1571+/****************************************************************************
1572+**
1573+** Copyright (C) 2014 Canonical, Ltd. and/or its subsidiary(-ies).
1574+** Contact: http://www.qt-project.org/legal
1575+**
1576+** This file is part of the QtSystems module of the Qt Toolkit.
1577+**
1578+** $QT_BEGIN_LICENSE:LGPL$
1579+** Commercial License Usage
1580+** Licensees holding valid commercial Qt licenses may use this file in
1581+** accordance with the commercial license agreement provided with the
1582+** Software or, alternatively, in accordance with the terms contained in
1583+** a written agreement between you and Digia. For licensing terms and
1584+** conditions see http://qt.digia.com/licensing. For further information
1585+** use the contact form at http://qt.digia.com/contact-us.
1586+**
1587+** GNU Lesser General Public License Usage
1588+** Alternatively, this file may be used under the terms of the GNU Lesser
1589+** General Public License version 2.1 as published by the Free Software
1590+** Foundation and appearing in the file LICENSE.LGPL included in the
1591+** packaging of this file. Please review the following information to
1592+** ensure the GNU Lesser General Public License version 2.1 requirements
1593+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
1594+**
1595+** In addition, as a special exception, Digia gives you certain additional
1596+** rights. These rights are described in the Digia Qt LGPL Exception
1597+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
1598+**
1599+** GNU General Public License Usage
1600+** Alternatively, this file may be used under the terms of the GNU
1601+** General Public License version 3.0 as published by the Free Software
1602+** Foundation and appearing in the file LICENSE.GPL included in the
1603+** packaging of this file. Please review the following information to
1604+** ensure the GNU General Public License version 3.0 requirements will be
1605+** met: http://www.gnu.org/copyleft/gpl.html.
1606+**
1607+**
1608+** $QT_END_LICENSE$
1609+**
1610+****************************************************************************/
1611+
1612+#ifndef QINPUTINFO_H
1613+#define QINPUTINFO_H
1614+
1615+#include <QObject>
1616+#include <QVector>
1617+#include <QMap>
1618+#include <QSocketNotifier>
1619+#include <QDebug>
1620+
1621+class QInputDeviceInfoPrivate;
1622+class QInputDevicePrivate;
1623+class QInputDevice;
1624+
1625+class QInputDeviceInfoPrivate;
1626+class QInputDeviceInfo : public QObject
1627+{
1628+ Q_OBJECT
1629+ Q_PROPERTY(int deviceCount READ deviceCount)
1630+public:
1631+
1632+ enum InputType {
1633+ Unknown = 0,
1634+ Button = 1,
1635+ Mouse = 2,
1636+ TouchPad = 4,
1637+ TouchScreen = 8,
1638+ Keyboard = 16,
1639+ Switch = 32
1640+ };
1641+ Q_ENUMS(InputType)
1642+ Q_FLAGS(InputTypes)
1643+ Q_DECLARE_FLAGS(InputTypes, InputType)
1644+
1645+ explicit QInputDeviceInfo(QObject *parent = 0);
1646+
1647+ Q_INVOKABLE QVector <QInputDevice *> deviceList();
1648+
1649+ Q_INVOKABLE QMap <QString, QInputDevice *> deviceMap();
1650+ int deviceCount() { return deviceList().count(); }
1651+Q_SIGNALS:
1652+
1653+ void deviceAdded(const QString & devicePath);
1654+ void deviceRemoved(const QString & devicePath);
1655+
1656+ void ready();
1657+
1658+public Q_SLOTS:
1659+ void addedDevice(const QString & devicePath);
1660+
1661+private:
1662+ Q_DISABLE_COPY(QInputDeviceInfo)
1663+#if !defined(QT_SIMULATOR)
1664+ QInputDeviceInfoPrivate *const d_ptr;
1665+ Q_DECLARE_PRIVATE(QInputDeviceInfo)
1666+#endif
1667+};
1668+
1669+class QInputDevice : public QObject
1670+{
1671+ friend class QInputDeviceInfoPrivate;
1672+ Q_OBJECT
1673+ Q_ENUMS(InputType)
1674+ Q_FLAGS(InputTypes)
1675+ Q_PROPERTY(QString name READ name NOTIFY nameChanged)
1676+ Q_PROPERTY(QString devicePath READ devicePath NOTIFY devicePathChanged)
1677+ Q_PROPERTY(QList <int> buttons READ buttons NOTIFY buttonsChanged)
1678+ Q_PROPERTY(QList <int> switches READ switches NOTIFY switchesChanged)
1679+ Q_PROPERTY(QList <int> relativeAxis READ relativeAxis NOTIFY relativeAxisChanged)
1680+ Q_PROPERTY(QList <int> absoluteAxis READ absoluteAxis NOTIFY absoluteAxisChanged)
1681+ Q_PROPERTY(QInputDeviceInfo::InputTypes types READ types NOTIFY typesChanged)
1682+
1683+public:
1684+ explicit QInputDevice(QObject *parent = 0);
1685+
1686+ QString name() const;
1687+ QString devicePath() const;
1688+ QList <int> buttons() const; //keys event code
1689+ QList <int> switches() const;
1690+ QList <int> relativeAxis() const;
1691+ QList <int> absoluteAxis() const;
1692+
1693+ QInputDeviceInfo::InputTypes types();
1694+Q_SIGNALS:
1695+ void nameChanged();
1696+ void devicePathChanged();
1697+ void buttonsChanged();
1698+ void switchesChanged();
1699+ void relativeAxisChanged();
1700+ void absoluteAxisChanged();
1701+ void typesChanged();
1702+private:
1703+ QInputDevicePrivate *d_ptr;
1704+ void setName(const QString &);
1705+ void setDevicePath(const QString &);
1706+ void addButton(int);
1707+ void addSwitch(int);
1708+ void addRelativeAxis(int);
1709+ void addAbsoluteAxis(int);
1710+ void setTypes(QInputDeviceInfo::InputTypes);
1711+};
1712+
1713+#endif // QINPUTINFO_H
1714
1715=== added file 'plugins/mouse/InputInfo/qmldir'
1716--- plugins/mouse/InputInfo/qmldir 1970-01-01 00:00:00 +0000
1717+++ plugins/mouse/InputInfo/qmldir 2016-01-05 14:44:19 +0000
1718@@ -0,0 +1,3 @@
1719+module Ubuntu.SystemSettings.Mouse.InputInfo
1720+plugin InputInfo
1721+typeinfo InputInfo.qmltypes
1722
1723=== added file 'plugins/mouse/ItemTitle.qml'
1724--- plugins/mouse/ItemTitle.qml 1970-01-01 00:00:00 +0000
1725+++ plugins/mouse/ItemTitle.qml 2016-01-05 14:44:19 +0000
1726@@ -0,0 +1,39 @@
1727+/*
1728+ * This file is part of system-settings
1729+ *
1730+ * Copyright (C) 2015 Canonical Ltd.
1731+ *
1732+ * This program is free software: you can redistribute it and/or modify it
1733+ * under the terms of the GNU General Public License version 3, as published
1734+ * by the Free Software Foundation.
1735+ *
1736+ * This program is distributed in the hope that it will be useful, but
1737+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1738+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1739+ * PURPOSE. See the GNU General Public License for more details.
1740+ *
1741+ * You should have received a copy of the GNU General Public License along
1742+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1743+ */
1744+
1745+import QtQuick 2.4
1746+import Ubuntu.Components 1.3
1747+import Ubuntu.Components.ListItems 1.3 as ListItem
1748+
1749+ListItem.Standard {
1750+ id: itemEmpty
1751+ property string text
1752+ height: label.height - units.gu(2)
1753+ Label {
1754+ id: label
1755+ anchors {
1756+ left: parent.left
1757+ leftMargin: units.gu(2)
1758+ right: parent.right
1759+ rightMargin: units.gu(2)
1760+ top: parent.top
1761+ }
1762+ text: itemEmpty.text
1763+ }
1764+ highlightWhenPressed: false
1765+}
1766
1767=== added file 'plugins/mouse/None.qml'
1768--- plugins/mouse/None.qml 1970-01-01 00:00:00 +0000
1769+++ plugins/mouse/None.qml 2016-01-05 14:44:19 +0000
1770@@ -0,0 +1,39 @@
1771+/*
1772+ * This file is part of system-settings
1773+ *
1774+ * Copyright (C) 2015 Canonical Ltd.
1775+ *
1776+ * Contact: Ken VanDine <ken.vandine@canonical.com>
1777+ *
1778+ * This program is free software: you can redistribute it and/or modify it
1779+ * under the terms of the GNU General Public License version 3, as published
1780+ * by the Free Software Foundation.
1781+ *
1782+ * This program is distributed in the hope that it will be useful, but
1783+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1784+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1785+ * PURPOSE. See the GNU General Public License for more details.
1786+ *
1787+ * You should have received a copy of the GNU General Public License along
1788+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1789+ */
1790+
1791+import QtQuick 2.0
1792+import SystemSettings 1.0
1793+import Ubuntu.Components 1.3
1794+import Ubuntu.Components.ListItems 1.3 as ListItem
1795+
1796+Column {
1797+ anchors.left: parent.left
1798+ anchors.right: parent.right
1799+ property bool pocketPC: false
1800+
1801+ ListItem.Caption {
1802+ text: {
1803+ if (pocketPC)
1804+ return i18n.tr("Connect a mouse or touchpad via USB, or use a Bluetooth device. If a Bluetooth device isn’t detected, make sure it is turned on and its batteries are charged.")
1805+ else
1806+ return i18n.tr("You need to use a Bluetooth mouse or touchpad with this display. Make sure it is close to the phone and its batteries are charged.")
1807+ }
1808+ }
1809+}
1810
1811=== added file 'plugins/mouse/PageComponent.qml'
1812--- plugins/mouse/PageComponent.qml 1970-01-01 00:00:00 +0000
1813+++ plugins/mouse/PageComponent.qml 2016-01-05 14:44:19 +0000
1814@@ -0,0 +1,74 @@
1815+/*
1816+ * This file is part of system-settings
1817+ *
1818+ * Copyright (C) 2015 Canonical Ltd.
1819+ *
1820+ * Contact: Ken VanDine <ken.vandine@canonical.com>
1821+ *
1822+ * This program is free software: you can redistribute it and/or modify it
1823+ * under the terms of the GNU General Public License version 3, as published
1824+ * by the Free Software Foundation.
1825+ *
1826+ * This program is distributed in the hope that it will be useful, but
1827+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1828+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1829+ * PURPOSE. See the GNU General Public License for more details.
1830+ *
1831+ * You should have received a copy of the GNU General Public License along
1832+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1833+ */
1834+
1835+import QtQuick 2.0
1836+import SystemSettings 1.0
1837+import Ubuntu.Components 1.3
1838+import Ubuntu.Components.ListItems 1.3 as ListItem
1839+import "Components/UnityInputInfo"
1840+
1841+ItemPage {
1842+ id: root
1843+ title: i18n.tr("Mouse & Touchpad")
1844+ objectName: "mousePage"
1845+ flickable: scrollWidget
1846+ property bool connected: UnityInputInfo.mice > 0 || UnityInputInfo.touchpads > 0
1847+
1848+ Component.onCompleted: {
1849+ console.warn("MICE: " + UnityInputInfo.mice);
1850+ console.warn("TOUCHPADS: " + UnityInputInfo.touchpads);
1851+ }
1852+
1853+ states: [
1854+ State {
1855+ name: "none"
1856+ when: !connected
1857+ StateChangeScript {
1858+ script: loader.source = "None.qml"
1859+ }
1860+ },
1861+ State {
1862+ name: "mouseConnected"
1863+ StateChangeScript {
1864+ script: loader.setSource("Connected.qml", {})
1865+ }
1866+ when: connected
1867+ }
1868+ ]
1869+
1870+ Flickable {
1871+ id: scrollWidget
1872+ anchors {
1873+ fill: parent
1874+ topMargin: units.gu(1)
1875+ bottomMargin: units.gu(1)
1876+ }
1877+ contentHeight: contentItem.childrenRect.height
1878+ boundsBehavior: (contentHeight > root.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
1879+
1880+ Column {
1881+ anchors { left: parent.left; right: parent.right }
1882+ Loader {
1883+ id: loader
1884+ anchors { left: parent.left; right: parent.right }
1885+ }
1886+ }
1887+ }
1888+}
1889
1890=== added file 'plugins/mouse/PrimaryButtonSelector.qml'
1891--- plugins/mouse/PrimaryButtonSelector.qml 1970-01-01 00:00:00 +0000
1892+++ plugins/mouse/PrimaryButtonSelector.qml 2016-01-05 14:44:19 +0000
1893@@ -0,0 +1,95 @@
1894+/*
1895+ * This file is part of system-settings
1896+ *
1897+ * Copyright (C) 2015 Canonical Ltd.
1898+ *
1899+ * Contact: Ken VanDine <ken.vandine@canonical.com>
1900+ *
1901+ * This program is free software: you can redistribute it and/or modify it
1902+ * under the terms of the GNU General Public License version 3, as published
1903+ * by the Free Software Foundation.
1904+ *
1905+ * This program is distributed in the hope that it will be useful, but
1906+ * WITHOUT ANY WARRANTY; without even the implied warranties of
1907+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
1908+ * PURPOSE. See the GNU General Public License for more details.
1909+ *
1910+ * You should have received a copy of the GNU General Public License along
1911+ * with this program. If not, see <http://www.gnu.org/licenses/>.
1912+ */
1913+
1914+import QtQuick 2.0
1915+import SystemSettings 1.0
1916+import Ubuntu.Components 1.3
1917+import Ubuntu.Components.ListItems 1.3 as ListItem
1918+
1919+Column {
1920+ property var buttonEnum
1921+
1922+ Binding {
1923+ target: primaryLeftCheck
1924+ property: "checked"
1925+ value: (buttonEnum === "Left") ? true : false
1926+ }
1927+
1928+ Binding {
1929+ target: primaryRightCheck
1930+ property: "checked"
1931+ value: (buttonEnum === "Right") ? true : false
1932+ }
1933+
1934+ SettingsItemTitle {
1935+ text: i18n.tr("Primary button:")
1936+ showDivider: false
1937+ }
1938+
1939+ ListItem.Empty {
1940+ anchors {
1941+ left: parent.left
1942+ right: parent.right
1943+ leftMargin: units.gu(2)
1944+ rightMargin: units.gu(2)
1945+ }
1946+ showDivider: false
1947+ highlightWhenPressed: false
1948+ height: itemRow.height
1949+ Row {
1950+ id: itemRow
1951+ spacing: units.gu(2)
1952+ Row {
1953+ spacing: units.gu(1)
1954+ CheckBox {
1955+ id: primaryLeftCheck
1956+ onTriggered: {
1957+ if (checked)
1958+ buttonEnum = "Left"
1959+ else
1960+ checked = true;
1961+ }
1962+ }
1963+ Label {
1964+ height: primaryLeftCheck.height
1965+ verticalAlignment: Text.AlignVCenter
1966+ text: i18n.tr("Left")
1967+ }
1968+ }
1969+ Row {
1970+ spacing: units.gu(1)
1971+ CheckBox {
1972+ id: primaryRightCheck
1973+ onTriggered: {
1974+ if (checked)
1975+ buttonEnum = "Right"
1976+ else
1977+ checked = true;
1978+ }
1979+ }
1980+ Label {
1981+ height: primaryRightCheck.height
1982+ verticalAlignment: Text.AlignVCenter
1983+ text: i18n.tr("Right")
1984+ }
1985+ }
1986+ }
1987+ }
1988+}
1989
1990=== added file 'plugins/mouse/SectionHeader.qml'
1991--- plugins/mouse/SectionHeader.qml 1970-01-01 00:00:00 +0000
1992+++ plugins/mouse/SectionHeader.qml 2016-01-05 14:44:19 +0000
1993@@ -0,0 +1,78 @@
1994+/*
1995+ * This file is part of system-settings
1996+ *
1997+ * Copyright (C) 2015 Canonical Ltd.
1998+ *
1999+ * Contact: Ken VanDine <ken.vandine@canonical.com>
2000+ *
2001+ * This program is free software: you can redistribute it and/or modify it
2002+ * under the terms of the GNU General Public License version 3, as published
2003+ * by the Free Software Foundation.
2004+ *
2005+ * This program is distributed in the hope that it will be useful, but
2006+ * WITHOUT ANY WARRANTY; without even the implied warranties of
2007+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2008+ * PURPOSE. See the GNU General Public License for more details.
2009+ *
2010+ * You should have received a copy of the GNU General Public License along
2011+ * with this program. If not, see <http://www.gnu.org/licenses/>.
2012+ */
2013+
2014+import GSettings 1.0
2015+import QtQuick 2.4
2016+import Ubuntu.Components 1.3
2017+import Ubuntu.Components.ListItems 1.3 as ListItem
2018+
2019+Column {
2020+ id: root
2021+ anchors {
2022+ left: parent.left
2023+ right: parent.right
2024+ leftMargin: units.gu(2)
2025+ rightMargin: units.gu(2)
2026+ }
2027+ spacing: units.gu(1)
2028+ height: childrenRect.height
2029+ property string text
2030+ ListItem.Standard {
2031+ height: mouseLabel.height + units.gu(1)
2032+ Label {
2033+ id: mouseLabel
2034+ anchors {
2035+ left: parent.left
2036+ right: parent.right
2037+ top: parent.top
2038+ }
2039+ text: root.text
2040+ fontSize: "medium"
2041+ elide: Text.ElideRight
2042+ color: Theme.palette.selected.backgroundText
2043+ font.weight: Text.Normal
2044+ }
2045+ highlightWhenPressed: false
2046+ showDivider: false
2047+ }
2048+ Item {
2049+ anchors {
2050+ left: parent.left
2051+ right: parent.right
2052+ }
2053+ height: childrenRect.height + units.gu(1)
2054+ Label {
2055+ anchors {
2056+ left: parent.left
2057+ top: parent.top
2058+ }
2059+ text: i18n.tr("Slow")
2060+ fontSize: "small"
2061+ }
2062+ Label {
2063+ anchors {
2064+ right: parent.right
2065+ top: parent.top
2066+ }
2067+ text: i18n.tr("Fast")
2068+ fontSize: "small"
2069+ }
2070+ }
2071+}
2072
2073=== added file 'plugins/mouse/TapArea.qml'
2074--- plugins/mouse/TapArea.qml 1970-01-01 00:00:00 +0000
2075+++ plugins/mouse/TapArea.qml 2016-01-05 14:44:19 +0000
2076@@ -0,0 +1,96 @@
2077+/*
2078+ * This file is part of system-settings
2079+ *
2080+ * Copyright (C) 2015 Canonical Ltd.
2081+ *
2082+ * Contact: Ken VanDine <ken.vandine@canonical.com>
2083+ *
2084+ * This program is free software: you can redistribute it and/or modify it
2085+ * under the terms of the GNU General Public License version 3, as published
2086+ * by the Free Software Foundation.
2087+ *
2088+ * This program is distributed in the hope that it will be useful, but
2089+ * WITHOUT ANY WARRANTY; without even the implied warranties of
2090+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2091+ * PURPOSE. See the GNU General Public License for more details.
2092+ *
2093+ * You should have received a copy of the GNU General Public License along
2094+ * with this program. If not, see <http://www.gnu.org/licenses/>.
2095+ */
2096+
2097+import QtQuick 2.0
2098+import Ubuntu.Components 1.3
2099+
2100+Item {
2101+ /* this property will come from Mir */
2102+ property int doubleTapSpeed: 1000
2103+ property var message
2104+ property bool lastStatus
2105+ property var button: doubleTapButton
2106+
2107+ Timer {
2108+ id: clickTimer
2109+ triggeredOnStart: false
2110+ repeat: false
2111+ interval: doubleTapSpeed
2112+ onTriggered: {
2113+ message = i18n.tr("Not fast enough")
2114+ lastStatus = false;
2115+ doubleTapButton.text = "😌";
2116+ safetyDelayTimer.start();
2117+ }
2118+ }
2119+
2120+ Timer {
2121+ id: safetyDelayTimer
2122+ triggeredOnStart: false
2123+ repeat: false
2124+ interval: 2000
2125+ onTriggered: {
2126+ doubleTapButton.text = "😴";
2127+ }
2128+ }
2129+
2130+ AbstractButton {
2131+ id: doubleTapButton
2132+ objectName: "doubleTapButton"
2133+ text: "😴"
2134+ height: parent.height
2135+ width: height
2136+ enabled: !safetyDelayTimer.running
2137+ UbuntuShape {
2138+ anchors.fill: parent
2139+ color: "lightgray"
2140+
2141+ Label {
2142+ anchors.centerIn: parent
2143+ text: doubleTapButton.text
2144+ }
2145+ }
2146+
2147+ onClicked: {
2148+ if (clickTimer.running) {
2149+ clickTimer.stop();
2150+ safetyDelayTimer.start();
2151+ text = "😀";
2152+ message = i18n.tr("Double-clicked");
2153+ lastStatus = true;
2154+ return;
2155+ } else {
2156+ clickTimer.start()
2157+ }
2158+ }
2159+ }
2160+
2161+ Label {
2162+ id: label
2163+ objectName: "label"
2164+ anchors {
2165+ left: doubleTapButton.right
2166+ leftMargin: units.gu(2)
2167+ verticalCenter: parent.verticalCenter
2168+ }
2169+ visible: safetyDelayTimer.running
2170+ text: message
2171+ }
2172+}
2173
2174=== added file 'plugins/mouse/mouse.settings'
2175--- plugins/mouse/mouse.settings 1970-01-01 00:00:00 +0000
2176+++ plugins/mouse/mouse.settings 2016-01-05 14:44:19 +0000
2177@@ -0,0 +1,21 @@
2178+{
2179+ "icon": "input-mouse-symbolic",
2180+ "name": "Mouse & Touchpad",
2181+ "translations": "ubuntu-system-settings",
2182+ "category": "system",
2183+ "form-factors": [
2184+ "phone",
2185+ "tablet"
2186+ ],
2187+ "keywords": [
2188+ "mouse",
2189+ "touchpad",
2190+ "tap",
2191+ "touch",
2192+ "click",
2193+ "input"
2194+ ],
2195+ "has-dynamic-keywords": false,
2196+ "has-dynamic-visibility": false,
2197+ "page-component": "PageComponent.qml"
2198+}
2199
2200=== added directory 'plugins/mouse/plugin'
2201=== added file 'plugins/mouse/plugin/CMakeLists.txt'
2202--- plugins/mouse/plugin/CMakeLists.txt 1970-01-01 00:00:00 +0000
2203+++ plugins/mouse/plugin/CMakeLists.txt 2016-01-05 14:44:19 +0000
2204@@ -0,0 +1,8 @@
2205+include_directories(${CMAKE_CURRENT_BINARY_DIR})
2206+
2207+add_definitions(-DQT_NO_KEYWORDS)
2208+
2209+add_library(mouse-plugin SHARED mouse-plugin.h mouse-plugin.cpp)
2210+qt5_use_modules(mouse-plugin Core Qml DBus)
2211+target_link_libraries(mouse-plugin SystemSettings)
2212+install(TARGETS mouse-plugin DESTINATION ${PLUGIN_MODULE_DIR})
2213
2214=== added file 'plugins/mouse/plugin/mouse-plugin.cpp'
2215--- plugins/mouse/plugin/mouse-plugin.cpp 1970-01-01 00:00:00 +0000
2216+++ plugins/mouse/plugin/mouse-plugin.cpp 2016-01-05 14:44:19 +0000
2217@@ -0,0 +1,65 @@
2218+/*
2219+ * This file is part of system-settings
2220+ *
2221+ * Copyright (C) 2015 Canonical Ltd
2222+ *
2223+ * Contact: Ken VanDine <ken.vandine@canonical.com>
2224+ *
2225+ * This program is free software: you can redistribute it and/or modify it
2226+ * under the terms of the GNU General Public License version 3, as published
2227+ * by the Free Software Foundation.
2228+ *
2229+ * This program is distributed in the hope that it will be useful, but
2230+ * WITHOUT ANY WARRANTY; without even the implied warranties of
2231+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2232+ * PURPOSE. See the GNU General Public License for more details.
2233+ *
2234+ * You should have received a copy of the GNU General Public License along
2235+ * with this program. If not, see <http://www.gnu.org/licenses/>.
2236+ */
2237+
2238+#include "mouse-plugin.h"
2239+
2240+#include <QDebug>
2241+#include <QDBusInterface>
2242+#include <QStringList>
2243+#include <SystemSettings/ItemBase>
2244+
2245+using namespace SystemSettings;
2246+
2247+class MouseItem: public ItemBase
2248+{
2249+ Q_OBJECT
2250+
2251+public:
2252+ explicit MouseItem(const QVariantMap &staticData, QObject *parent = 0);
2253+ void setVisibility(bool visible);
2254+
2255+};
2256+
2257+
2258+MouseItem::MouseItem(const QVariantMap &staticData, QObject *parent):
2259+ ItemBase(staticData, parent)
2260+{
2261+ QDBusConnection m_systemBusConnection (QDBusConnection::systemBus());
2262+ QDBusInterface m_unityInterface ("com.canonical.unity",
2263+ "/com/canonical/unity",
2264+ "com.canonical.unity",
2265+ m_systemBusConnection);
2266+
2267+ /* FIXME: Determine visibility based on connection of mouse or touchpad */
2268+ setVisibility(true);
2269+}
2270+
2271+void MouseItem::setVisibility(bool visible)
2272+{
2273+ setVisible(visible);
2274+}
2275+
2276+ItemBase *MousePlugin::createItem(const QVariantMap &staticData,
2277+ QObject *parent)
2278+{
2279+ return new MouseItem(staticData, parent);
2280+}
2281+
2282+#include "mouse-plugin.moc"
2283
2284=== added file 'plugins/mouse/plugin/mouse-plugin.h'
2285--- plugins/mouse/plugin/mouse-plugin.h 1970-01-01 00:00:00 +0000
2286+++ plugins/mouse/plugin/mouse-plugin.h 2016-01-05 14:44:19 +0000
2287@@ -0,0 +1,38 @@
2288+/*
2289+ * This file is part of system-settings
2290+ *
2291+ * Copyright (C) 2015 Canonical Ltd
2292+ *
2293+ * Contact: Ken VanDine <ken.vandine@canonical.com>
2294+ *
2295+ * This program is free software: you can redistribute it and/or modify it
2296+ * under the terms of the GNU General Public License version 3, as published
2297+ * by the Free Software Foundation.
2298+ *
2299+ * This program is distributed in the hope that it will be useful, but
2300+ * WITHOUT ANY WARRANTY; without even the implied warranties of
2301+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2302+ * PURPOSE. See the GNU General Public License for more details.
2303+ *
2304+ * You should have received a copy of the GNU General Public License along
2305+ * with this program. If not, see <http://www.gnu.org/licenses/>.
2306+ */
2307+
2308+#ifndef SYSTEM_SETTINGS_MOUSE_PLUGIN_H
2309+#define SYSTEM_SETTINGS_MOUSE_PLUGIN_H
2310+
2311+#include <QObject>
2312+#include <SystemSettings/PluginInterface>
2313+
2314+class MousePlugin: public QObject, public SystemSettings::PluginInterface2
2315+{
2316+ Q_OBJECT
2317+ Q_PLUGIN_METADATA(IID "com.ubuntu.SystemSettings.PluginInterface/2.0")
2318+ Q_INTERFACES(SystemSettings::PluginInterface2)
2319+
2320+public:
2321+ SystemSettings::ItemBase *createItem(const QVariantMap &staticData,
2322+ QObject *parent = 0);
2323+};
2324+
2325+#endif // SYSTEM_SETTINGS_MOUSE_PLUGIN_H
2326
2327=== added file 'plugins/mouse/settings-mouse.svg'
2328--- plugins/mouse/settings-mouse.svg 1970-01-01 00:00:00 +0000
2329+++ plugins/mouse/settings-mouse.svg 2016-01-05 14:44:19 +0000
2330@@ -0,0 +1,39 @@
2331+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2332+<!-- Created with Inkscape (http://www.inkscape.org/) -->
2333+<svg id="svg2" xmlns="http://www.w3.org/2000/svg" height="48" width="48" version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
2334+ <defs id="defs4">
2335+ <linearGradient id="linearGradient4190">
2336+ <stop id="stop4192" offset="0"/>
2337+ <stop id="stop4194" style="stop-opacity:0" offset="1"/>
2338+ </linearGradient>
2339+ <linearGradient id="linearGradient7603">
2340+ <stop id="stop7605" style="stop-color:#afafaf" offset="0"/>
2341+ <stop id="stop7607" style="stop-color:#5a5a5a" offset="1"/>
2342+ </linearGradient>
2343+ <linearGradient id="linearGradient4135" y2="44.5" xlink:href="#linearGradient7603" gradientUnits="userSpaceOnUse" x2="24.5" y1="3" x1="24.5"/>
2344+ <radialGradient id="radialGradient4143" gradientUnits="userSpaceOnUse" cy="10.895" cx="23.528" gradientTransform="matrix(1.3889 -2.8719e-7 4.4279e-7 2.1414 -9.1501 -13.541)" r="2.5">
2345+ <stop id="stop4576" style="stop-color:#828282" offset="0"/>
2346+ <stop id="stop4578" style="stop-color:#646662" offset="1"/>
2347+ </radialGradient>
2348+ <radialGradient id="radialGradient4172" gradientUnits="userSpaceOnUse" cy="16.539" cx="16.184" gradientTransform="matrix(4.3195 -.085864 .060478 3.0424 -54.725 -36.555)" r="13.477">
2349+ <stop id="stop6546" style="stop-color:#fafafa" offset="0"/>
2350+ <stop id="stop6548" style="stop-color:#c8c8c8" offset="1"/>
2351+ </radialGradient>
2352+ <linearGradient id="linearGradient4174" y2="45" xlink:href="#linearGradient7603" gradientUnits="userSpaceOnUse" x2="24.5" y1="3" x1="24.559"/>
2353+ <linearGradient id="linearGradient4188" y2="44" gradientUnits="userSpaceOnUse" x2="24.559" y1="4.1102" x1="23.823">
2354+ <stop id="stop6969" style="stop-color:#fff" offset="0"/>
2355+ <stop id="stop6971" style="stop-color:#fff;stop-opacity:0" offset="1"/>
2356+ </linearGradient>
2357+ <linearGradient id="linearGradient4198" y2="34" xlink:href="#linearGradient4190" gradientUnits="userSpaceOnUse" x2="13" y1="33" x1="16"/>
2358+ <linearGradient id="linearGradient4206" y2="34" xlink:href="#linearGradient4190" gradientUnits="userSpaceOnUse" x2="36" y1="33.05" x1="32.99"/>
2359+ <radialGradient id="radialGradient3626" xlink:href="#linearGradient4190" gradientUnits="userSpaceOnUse" cy="34.157" cx="4.6022" gradientTransform="matrix(1 0 0 .74569 0 8.6866)" r="8.3415"/>
2360+ </defs>
2361+ <path id="path3616" style="opacity:.5;fill:url(#radialGradient3626)" d="m12.944 34.157a8.3415 6.2201 0 1 1 -16.683 0 8.3415 6.2201 0 1 1 16.683 0z" transform="matrix(1.7383 0 0 1.045 16.5 4.8057)"/>
2362+ <path id="path3068" style="stroke:url(#linearGradient4174);fill:url(#radialGradient4172)" d="m24.594 3.5c-4.369 0-8.757 0.9973-10.813 2.9688-3.12 6.5812-2.395 12.749-1.031 19.031-0.17356 4.5886-0.48988 4.5 0 9h0.03125c0.4244 5.5842 5.5348 10 11.75 10s11.294-4.4158 11.719-10c0.50992-4.4085 0.10564-4.5483 0.03125-8.7812 1.4-6.358 2.25-12.592-0.906-19.25-2.056-1.9717-6.412-2.969-10.781-2.969z"/>
2363+ <rect id="rect4176" style="opacity:.6;fill:#fff" height="20.5" width="2" y="4" x="23.5"/>
2364+ <path id="path4184" style="opacity:.7;stroke:url(#linearGradient4188);fill:none" d="m24.594 4.5c-4.1229 0-8.2249 1.0522-9.9688 2.5938-2.8896 6.2401-2.244 12.029-0.90625 18.188a0.98841 0.98841 0 0 1 0.03125 0.25c-0.17154 4.5353-0.47291 4.5188-0.03125 8.6875a0.98841 0.98841 0 0 1 0 0.03125 0.98841 0.98841 0 0 1 0.0625 0.1875c0.38196 5.0257 5.0029 9.0625 10.75 9.0625s10.337-4.0331 10.719-9.0625a0.98841 0.98841 0 0 1 0.03125 -0.0625c0.50279-4.3469 0.07549-4.3295 0-8.625a0.98841 0.98841 0 0 1 0.03 -0.251c1.376-6.245 2.139-12.098-0.781-18.406-1.745-1.5448-5.814-2.594-9.937-2.594z"/>
2365+ <rect id="rect3847" style="fill:url(#linearGradient4135)" height="21" width="1" y="3" x="24"/>
2366+ <rect id="rect3845" style="stroke-linejoin:round;stroke:#5a5a5a;stroke-linecap:round;fill:url(#radialGradient4143)" rx="2" ry="2" height="9" width="4" y="7.5" x="22.5"/>
2367+ <path id="path4161" style="opacity:.5;fill:url(#linearGradient4206)" d="m35.8 25.6c-1.031 4.459-2.8 9.4-2.8 14.9 0.978-1.191 3.155-2.5 3-10.5l-0.2-4.4z"/>
2368+ <path id="path4164" style="opacity:.5;fill:url(#linearGradient4198)" d="m13.198 25.3c1.0312 4.4592 2.8025 9.7 2.8 15.2-0.9779-1.1906-3.1547-2.5-3-10.5l0.2-4.7z"/>
2369+</svg>
2370
2371=== modified file 'schema/com.ubuntu.touch.system-settings.gschema.xml'
2372--- schema/com.ubuntu.touch.system-settings.gschema.xml 2015-11-09 12:37:42 +0000
2373+++ schema/com.ubuntu.touch.system-settings.gschema.xml 2016-01-05 14:44:19 +0000
2374@@ -8,6 +8,12 @@
2375 <value nick="passcode" value="2" />
2376 <value nick="password" value="3" />
2377 </enum>
2378+ <enum id="primary-button-enum">
2379+ <value nick="Left" value="0" />
2380+ <value nick="Middle" value="1" />
2381+ <value nick="Right" value="2" />
2382+ </enum>
2383+
2384 <schema id="com.ubuntu.touch.system-settings" path="/com/ubuntu/touch/system-settings/">
2385 <key name="background-duplicate" type="b">
2386 <default>true</default>
2387@@ -27,6 +33,65 @@
2388 <summary>Whether the applications should be sorted by name.</summary>
2389 <description>If true the applications are sorted by name, otherwise by disk size.</description>
2390 </key>
2391+ <key enum="primary-button-enum" name="mouse-primary-button">
2392+ <default>"Left"</default>
2393+ <summary>Primary Mouse Button.</summary>
2394+ <description>The primary mouse button.</description>
2395+ </key>
2396+ <key name="mouse-cursor-speed" type="d">
2397+ <default>0.5</default>
2398+ <summary>Mouse cursor speed.</summary>
2399+ <description>Mouse cursor speed.</description>
2400+ </key>
2401+ <key name="mouse-double-click-speed" type="i">
2402+ <default>100</default>
2403+ <summary>Mouse double click speed.</summary>
2404+ <description>Mouse double click speed in milliseconds.</description>
2405+ </key>
2406+ <key name="mouse-scroll-speed" type="d">
2407+ <default>0.5</default>
2408+ <summary>Mouse scroll speed.</summary>
2409+ <description>Mouse scroll speed.</description>
2410+ </key>
2411+ <key enum="primary-button-enum" name="touchpad-primary-button">
2412+ <default>"Left"</default>
2413+ <summary>Primary Touchpad Button.</summary>
2414+ <description>The primary touchpad button.</description>
2415+ </key>
2416+ <key name="touchpad-cursor-speed" type="d">
2417+ <default>0.5</default>
2418+ <summary>Touchpad cursor speed.</summary>
2419+ <description>Touchpad cursor speed.</description>
2420+ </key>
2421+ <key name="touchpad-double-click-speed" type="i">
2422+ <default>100</default>
2423+ <summary>Touchpad double click speed.</summary>
2424+ <description>Touchpad double click speed in milliseconds.</description>
2425+ </key>
2426+ <key name="touchpad-scroll-speed" type="d">
2427+ <default>0.5</default>
2428+ <summary>Touchpad scroll speed.</summary>
2429+ <description>Touchpad scroll speed.</description>
2430+ </key>
2431+ <key name="touchpad-disable-while-typing" type="b">
2432+ <default>false</default>
2433+ <summary>Ignore Touchpad while typing.</summary>
2434+ <description>Disable touchpad while typing.</description>
2435+ </key>
2436+ <key name="touchpad-tap-to-click" type="b">
2437+ <default>false</default>
2438+ <summary>Tap to click.</summary>
2439+ <description>Touchpad tap to click.</description>
2440+ </key>
2441+ <key name="touchpad-two-finger-scroll" type="b">
2442+ <default>false</default>
2443+ <summary>Two finger scrolling.</summary>
2444+ <description>Touchpad two finger scrolling.</description>
2445+ </key>
2446+ <key name="touchpad-disable-with-mouse" type="b">
2447+ <default>true</default>
2448+ <summary>Ignore touchpad when a mouse is connected.</summary>
2449+ <description>Disable touchpad when a mouse is connected.</description>
2450 <key name="callforwarding-summaries" type="a{ss}">
2451 <summary>Call forwarding summaries</summary>
2452 <default>{}</default>
2453
2454=== modified file 'tests/plugins/CMakeLists.txt'
2455--- tests/plugins/CMakeLists.txt 2015-09-18 07:13:56 +0000
2456+++ tests/plugins/CMakeLists.txt 2016-01-05 14:44:19 +0000
2457@@ -1,3 +1,4 @@
2458 add_subdirectory(security-privacy)
2459 add_subdirectory(system-update)
2460 add_subdirectory(bluetooth)
2461+add_subdirectory(mouse)
2462
2463=== added directory 'tests/plugins/mouse'
2464=== added file 'tests/plugins/mouse/CMakeLists.txt'
2465--- tests/plugins/mouse/CMakeLists.txt 1970-01-01 00:00:00 +0000
2466+++ tests/plugins/mouse/CMakeLists.txt 2016-01-05 14:44:19 +0000
2467@@ -0,0 +1,29 @@
2468+find_package(Qt5Core REQUIRED)
2469+find_package(Qt5Gui REQUIRED)
2470+find_package(Qt5Network REQUIRED)
2471+find_package(Qt5Qml REQUIRED)
2472+find_package(Qt5Quick REQUIRED)
2473+find_package(Qt5QuickTest REQUIRED)
2474+add_definitions(-DTESTS)
2475+
2476+set(XVFB_CMD xvfb-run -a -s "-screen 0 640x480x24")
2477+
2478+set(QML_SOURCES tst_mouse.qml)
2479+
2480+add_executable(tst-mouse tst_mouse.cpp)
2481+
2482+target_link_libraries(tst-mouse
2483+ Qt5::Core
2484+ Qt5::Gui
2485+ Qt5::Network
2486+ Qt5::Qml
2487+ Qt5::Quick
2488+ Qt5::QuickTest
2489+)
2490+
2491+add_test(NAME tst-mouse COMMAND ${XVFB_CMD} ${CMAKE_CURRENT_BINARY_DIR}/tst-mouse
2492+ -input ${CMAKE_SOURCE_DIR}/tests/plugins/mouse/
2493+ -import ${PLUGIN_QML_DIR}
2494+ -import ${PLUGIN_PRIVATE_MODULE_DIR}
2495+ -import ${CMAKE_SOURCE_DIR}/tests/plugins/mouse
2496+)
2497
2498=== added directory 'tests/plugins/mouse/Source'
2499=== added file 'tests/plugins/mouse/Source/qmldir'
2500--- tests/plugins/mouse/Source/qmldir 1970-01-01 00:00:00 +0000
2501+++ tests/plugins/mouse/Source/qmldir 2016-01-05 14:44:19 +0000
2502@@ -0,0 +1,2 @@
2503+module Source
2504+TapArea 1.0 ../../../../plugins/mouse/TapArea.qml
2505
2506=== added file 'tests/plugins/mouse/tst_mouse.cpp'
2507--- tests/plugins/mouse/tst_mouse.cpp 1970-01-01 00:00:00 +0000
2508+++ tests/plugins/mouse/tst_mouse.cpp 2016-01-05 14:44:19 +0000
2509@@ -0,0 +1,22 @@
2510+/*
2511+ * This file is part of system-settings
2512+ *
2513+ * Copyright (C) 2015 Canonical Ltd.
2514+ *
2515+ * Contact: Ken VanDine <ken.vandine@canonical.com>
2516+ *
2517+ * This program is free software: you can redistribute it and/or modify it
2518+ * under the terms of the GNU General Public License version 3, as published
2519+ * by the Free Software Foundation.
2520+ *
2521+ * This program is distributed in the hope that it will be useful, but
2522+ * WITHOUT ANY WARRANTY; without even the implied warranties of
2523+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2524+ * PURPOSE. See the GNU General Public License for more details.
2525+ *
2526+ * You should have received a copy of the GNU General Public License along
2527+ * with this program. If not, see <http://www.gnu.org/licenses/>.
2528+ */
2529+#include <QtQuickTest/QtQuickTest>
2530+
2531+QUICK_TEST_MAIN(tst-mouse)
2532
2533=== added file 'tests/plugins/mouse/tst_mouse.qml'
2534--- tests/plugins/mouse/tst_mouse.qml 1970-01-01 00:00:00 +0000
2535+++ tests/plugins/mouse/tst_mouse.qml 2016-01-05 14:44:19 +0000
2536@@ -0,0 +1,59 @@
2537+/*
2538+ * This file is part of system-settings
2539+ *
2540+ * Copyright (C) 2015 Canonical Ltd.
2541+ *
2542+ * Contact: Ken VanDine <ken.vandine@canonical.com>
2543+ *
2544+ * This program is free software: you can redistribute it and/or modify it
2545+ * under the terms of the GNU General Public License version 3, as published
2546+ * by the Free Software Foundation.
2547+ *
2548+ * This program is distributed in the hope that it will be useful, but
2549+ * WITHOUT ANY WARRANTY; without even the implied warranties of
2550+ * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
2551+ * PURPOSE. See the GNU General Public License for more details.
2552+ *
2553+ * You should have received a copy of the GNU General Public License along
2554+ * with this program. If not, see <http://www.gnu.org/licenses/>.
2555+ */
2556+import QtQuick 2.4
2557+import QtTest 1.0
2558+import Ubuntu.Components 1.3
2559+
2560+import Source 1.0
2561+
2562+TapArea {
2563+ id: area
2564+ height: 48
2565+ width: height
2566+ doubleTapSpeed: 200
2567+
2568+ TestCase {
2569+ name: "ItemTests"
2570+ id: test1
2571+ when: windowShown
2572+
2573+ function init() {
2574+ tryCompare(area.button, "enabled", true);
2575+ }
2576+ function test_double_click_success() {
2577+ mouseClick(area);
2578+ wait(10);
2579+ mouseClick(area);
2580+ compare(area.message, i18n.tr("Double-clicked"));
2581+ }
2582+ function test_double_click_fail() {
2583+ mouseClick(area);
2584+ wait(210);
2585+ mouseClick(area);
2586+ compare(area.message, i18n.tr("Not fast enough"));
2587+ }
2588+ function test_double_click_safety() {
2589+ mouseClick(area);
2590+ wait(210);
2591+ mouseClick(area);
2592+ verify(!area.button.enabled);
2593+ }
2594+ }
2595+}

Subscribers

People subscribed via source and target branches