@@ -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"
@@ -29,13 +32,26 @@ Item {
29 function runTutorial() {
32 function runTutorial() {
30 tutorial.start()
33 tutorial.start()
32− signal tutorialDone();
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
40+ objectName: "inputMethodState"
41+ property bool touchpadTutorialHasRun: false
42+ property bool oskEnabled: true
45+ Component.onCompleted: {
46+ if (!inputMethodState.touchpadTutorialHasRun) {
36 MultiPointTouchArea {
51 MultiPointTouchArea {
37 objectName: "touchPadArea"
52 objectName: "touchPadArea"
38 anchors.fill: parent
53 anchors.fill: parent
54+ enabled: !tutorial.running || tutorial.paused
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
46 onPressed: {
62 onPressed: {
63+ print("pressed, tutorial state", tutorial.paused, tutorial.running)
64+ if (tutorial.paused) {
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 {
204+ anchors { right: parent.right; top: parent.top; margins: internalGu * 2 }
205+ height: internalGu * 6
209+ inputMethodState.oskEnabled = !inputMethodState.oskEnabled
213+ anchors.fill: parent
215+ color: UbuntuColors.inkstone
219+ anchors.fill: parent
220+ anchors.margins: internalGu * 1.5
221+ name: "input-keyboard-symbolic"
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
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
248+ height: internalGu * 8
250+ name: "input-touchpad-symbolic"
253+ anchors { top: tutorialLabel.bottom; horizontalCenter: parent.horizontalCenter; margins: internalGu * 2 }
190 id: tutorialFinger1
257 id: tutorialFinger1
191 width: internalGu * 5
258 width: internalGu * 5
@@ -218,6 +285,19 @@ Item {
219 SequentialAnimation {
286 SequentialAnimation {
220 id: tutorial
287 id: tutorial
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 }
297+ PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
298+ UbuntuNumberAnimation { target: leftButton; property: "opacity"; to: 1 }
299+ UbuntuNumberAnimation { target: rightButton; property: "opacity"; to: 1 }
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 }
379+ PropertyAction { target: inputMethodState; property: "touchpadTutorialHasRun"; value: true }