on 0144005 help sign in
unity8/tests/mocks/Unity/InputInfo/InputWindow.qml
68 lines 1.7 kB history raw
1import QtQuick 2.4
2import Ubuntu.Components 1.3
3import Unity.InputInfo 0.1
5Rectangle {
6 id: rect
7 color: "white"
8 width: parent.width
9 height: parent.height
11 Action {
12 id: mouseAction
13 text: checked ? "Remove Mouse" : "Add Mouse"
14 onTriggered: {
15 if (checked) {
16 console.log("ADD")
17 MockInputDeviceBackend.addMockDevice("/mouse0", InputInfo.Mouse);
18 } else {
19 console.log("REMOVE")
20 MockInputDeviceBackend.removeDevice("/mouse0");
21 }
22 }
23 iconName: "input-mouse-symbolic"
24 checkable: true
25 checked: false
26 }
28 Action {
29 id: kbAction
30 text: checked ? "Remove Keyboard" : "Add Keyboard"
31 onTriggered: {
32 if (checked) {
33 MockInputDeviceBackend.addMockDevice("/kbd0", InputInfo.Keyboard);
34 } else {
35 MockInputDeviceBackend.removeDevice("/kbd0");
36 }
37 }
38 iconName: "input-keyboard-symbolic"
39 checkable: true
40 checked: false
41 }
43 Column {
44 anchors {
45 fill: parent
46 margins: units.gu(1)
47 }
48 spacing: units.gu(1)
50 Button {
51 anchors {
52 left: parent.left
53 right: parent.right
54 }
55 action: mouseAction
56 color: mouseAction.checked ? UbuntuColors.red : UbuntuColors.green
57 }
59 Button {
60 anchors {
61 left: parent.left
62 right: parent.right
63 }
64 action: kbAction
65 color: kbAction.checked ? UbuntuColors.red : UbuntuColors.green
66 }
67 }