on xenial help sign in
more work based on the latest design feedback
79a05fbMichael Zanetti
qml/Components/VirtualTouchPad.qml+86−2
@@ -17,7 +17,10 @@
17import QtQuick 2.4
17import QtQuick 2.4
18import QtQuick.Layouts 1.1
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20+import Qt.labs.settings 1.0
21+import Unity.Screens 0.1
20import UInput 0.1
22import UInput 0.1
23+import "../Components"
21
24
22Item {
25Item {
23 id: root
26 id: root
@@ -29,13 +32,26 @@ Item {
29 function runTutorial() {
32 function runTutorial() {
30 tutorial.start()
33 tutorial.start()
31 }
34 }
32− signal tutorialDone();
33
35
34 readonly property bool pressed: point1.pressed || point2.pressed || leftButton.pressed || rightButton.pressed
36 readonly property bool pressed: point1.pressed || point2.pressed || leftButton.pressed || rightButton.pressed
35
37
38+ Settings {
39+ id: inputMethodState
40+ objectName: "inputMethodState"
41+ property bool touchpadTutorialHasRun: false
42+ property bool oskEnabled: true
43+ }
44+
45+ Component.onCompleted: {
46+ if (!inputMethodState.touchpadTutorialHasRun) {
47+ tutorial.start();
48+ }
49+ }
50+
36 MultiPointTouchArea {
51 MultiPointTouchArea {
37 objectName: "touchPadArea"
52 objectName: "touchPadArea"
38 anchors.fill: parent
53 anchors.fill: parent
54+ enabled: !tutorial.running || tutorial.paused
39
55
40 // FIXME: Once we have Qt DPR support, this should be Qt.styleHints.startDragDistance
56 // FIXME: Once we have Qt DPR support, this should be Qt.styleHints.startDragDistance
41 readonly property int clickThreshold: internalGu * 1.5
57 readonly property int clickThreshold: internalGu * 1.5
@@ -44,6 +60,12 @@ Item {
44 property bool isDrag: false
60 property bool isDrag: false
45
61
46 onPressed: {
62 onPressed: {
63+ print("pressed, tutorial state", tutorial.paused, tutorial.running)
64+ if (tutorial.paused) {
65+ tutorial.resume();
66+ return;
67+ }
68+
47 // If double-tapping *really* fast, it could happen that we end up having only point2 pressed
69 // If double-tapping *really* fast, it could happen that we end up having only point2 pressed
48 // Make sure we check for both combos, only point1 or only point2
70 // Make sure we check for both combos, only point1 or only point2
49 if (((point1.pressed && !point2.pressed) || (!point1.pressed && point2.pressed))
71 if (((point1.pressed && !point2.pressed) || (!point1.pressed && point2.pressed))
@@ -177,6 +199,41 @@ Item {
177 }
199 }
178 }
200 }
179
201
202+ AbstractButton {
203+ id: oskButton
204+ anchors { right: parent.right; top: parent.top; margins: internalGu * 2 }
205+ height: internalGu * 6
206+ width: height
207+
208+ onClicked: {
209+ inputMethodState.oskEnabled = !inputMethodState.oskEnabled
210+ }
211+
212+ Rectangle {
213+ anchors.fill: parent
214+ radius: width / 2
215+ color: UbuntuColors.inkstone
216+ }
217+
218+ Icon {
219+ anchors.fill: parent
220+ anchors.margins: internalGu * 1.5
221+ name: "input-keyboard-symbolic"
222+ }
223+ }
224+
225+ Screens {
226+ id: screens
227+ }
228+
229+ InputMethod {
230+ id: inputMethod
231+ // Don't resize when there is only one screen to avoid resize clashing with the InputMethod in the Shell.
232+ enabled: screens.count > 1 && inputMethodState.oskEnabled
233+ objectName: "inputMethod"
234+ anchors.fill: parent
235+ }
236+
180 Label {
237 Label {
181 id: tutorialLabel
238 id: tutorialLabel
182 anchors { left: parent.left; top: parent.top; right: parent.right; margins: internalGu * 4; topMargin: internalGu * 10 }
239 anchors { left: parent.left; top: parent.top; right: parent.right; margins: internalGu * 4; topMargin: internalGu * 10 }
@@ -186,6 +243,16 @@ Item {
186 wrapMode: Text.WordWrap
243 wrapMode: Text.WordWrap
187 }
244 }
188
245
246+ Icon {
247+ id: tutorialImage
248+ height: internalGu * 8
249+ width: height
250+ name: "input-touchpad-symbolic"
251+ color: "white"
252+ opacity: 0
253+ anchors { top: tutorialLabel.bottom; horizontalCenter: parent.horizontalCenter; margins: internalGu * 2 }
254+ }
255+
189 Item {
256 Item {
190 id: tutorialFinger1
257 id: tutorialFinger1
191 width: internalGu * 5
258 width: internalGu * 5
@@ -218,6 +285,19 @@ Item {
218
285
219 SequentialAnimation {
286 SequentialAnimation {
220 id: tutorial
287 id: tutorial
288+
289+ PropertyAction { targets: [leftButton, rightButton, oskButton]; property: "enabled"; value: false }
290+ PropertyAction { targets: [leftButton, rightButton, oskButton]; property: "opacity"; value: 0 }
291+ PropertyAction { target: tutorialLabel; property: "text"; value: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the pointer.") }
292+ UbuntuNumberAnimation { targets: [tutorialLabel, tutorialImage]; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
293+ PropertyAction { target: tutorial; property: "paused"; value: true }
294+ PauseAnimation { duration: 100 } // it takes a bit until pausing actually takes effect
295+ UbuntuNumberAnimation { targets: [tutorialLabel, tutorialImage]; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
296+
297+ PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
298+ UbuntuNumberAnimation { target: leftButton; property: "opacity"; to: 1 }
299+ UbuntuNumberAnimation { target: rightButton; property: "opacity"; to: 1 }
300+
221 PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
301 PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
222 PropertyAction { target: tutorialLabel; property: "text"; value: i18n.tr("Tap left button to click.") }
302 PropertyAction { target: tutorialLabel; property: "text"; value: i18n.tr("Tap left button to click.") }
223 UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
303 UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
@@ -292,6 +372,10 @@ Item {
292 UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
372 UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
293 PauseAnimation { duration: 2000 }
373 PauseAnimation { duration: 2000 }
294 UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
374 UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 0; duration: UbuntuAnimation.FastDuration }
295− ScriptAction { script: root.tutorialDone(); }
375+
376+ UbuntuNumberAnimation { target: oskButton; property: "opacity"; to: 1 }
377+ PropertyAction { targets: [leftButton, rightButton, oskButton]; property: "enabled"; value: true }
378+
379+ PropertyAction { target: inputMethodState; property: "touchpadTutorialHasRun"; value: true }
296 }
380 }
297}
381}
qml/DisabledScreenNotice.qml−66
@@ -18,16 +18,12 @@ import QtQuick 2.4
18import QtQuick.Layouts 1.1
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20import Unity.Session 0.1
20import Unity.Session 0.1
21−import Unity.Screens 0.1
22import QtQuick.Window 2.2
21import QtQuick.Window 2.2
23−import Qt.labs.settings 1.0
24import "Components"
22import "Components"
25
23
26Item {
24Item {
27 id: root
25 id: root
28
26
29− property bool infoNoteDisplayed: true
30−
31 // For testing
27 // For testing
32 property var screen: Screen
28 property var screen: Screen
33 property var orientationLock: OrientationLock
29 property var orientationLock: OrientationLock
@@ -37,10 +33,6 @@ Item {
37 name: applicationArguments.deviceName
33 name: applicationArguments.deviceName
38 }
34 }
39
35
40− Screens {
41− id: screens
42− }
43−
44 Item {
36 Item {
45 id: contentContainer
37 id: contentContainer
46 objectName: "contentContainer"
38 objectName: "contentContainer"
@@ -84,64 +76,6 @@ Item {
84 VirtualTouchPad {
76 VirtualTouchPad {
85 objectName: "virtualTouchPad"
77 objectName: "virtualTouchPad"
86 anchors.fill: parent
78 anchors.fill: parent
87−
88− onPressedChanged: {
89− if (pressed && infoNoteDisplayed) {
90− infoNoteDisplayed = false;
91− if (!firstRunSettings.tutorialHasRun) {
92− runTutorial();
93− }
94− }
95− }
96− onTutorialDone: {
97− firstRunSettings.tutorialHasRun = true;
98− }
99− }
100−
101− Item {
102− objectName: "infoNoticeArea"
103− anchors.fill: parent
104− opacity: infoNoteDisplayed ? 1 : 0
105− visible: opacity > 0
106− Behavior on opacity {
107− UbuntuNumberAnimation { }
108− }
109−
110− Column {
111− anchors.centerIn: parent
112− width: parent.width - (internalGu * 8)
113− spacing: internalGu * 4
114−
115− Label {
116− id: text
117− text: i18n.tr("Your device is now connected to an external display. Use this screen as a touch pad to interact with the pointer.")
118− color: "white"
119− width: parent.width
120− font.pixelSize: 2.5 * internalGu
121− wrapMode: Text.Wrap
122− }
123− Icon {
124− height: internalGu * 8
125− width: height
126− name: "input-touchpad-symbolic"
127− color: "white"
128− anchors.horizontalCenter: parent.horizontalCenter
129− }
130− }
131 }
79 }
132−
133− InputMethod {
134− id: inputMethod
135− // Don't resize when there is only one screen to avoid resize clashing with the InputMethod in the Shell.
136− enabled: screens.count > 1
137− objectName: "inputMethod"
138− anchors.fill: parent
139− }
140− }
141−
142− Settings {
143− id: firstRunSettings
144− objectName: "firstRunSettings"
145− property bool tutorialHasRun: false
146 }
80 }
147}
81}