on xenial help sign in
more work based on the latest design feedback

* move the welcome message into the wizard * don't accept acutual input while the tutorial is running * add OSK button

commit79a05fbd5e93667092163b646e3636c1b8b53761 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 1 Aug 2016, 19:43 (10 years ago) parent3ee0405
2 files changed+86−68
qml/Components/VirtualTouchPad.qml+86−2 qml/DisabledScreenNotice.qml−66
qml/Components/VirtualTouchPad.qml+86−2
@@ -17,7 +17,10 @@
1717import QtQuick 2.4
1818import QtQuick.Layouts 1.1
1919import Ubuntu.Components 1.3
20+import Qt.labs.settings 1.0
21+import Unity.Screens 0.1
2022import UInput 0.1
23+import "../Components"
2124
2225Item {
2326 id: root
@@ -29,13 +32,26 @@ Item {
2932 function runTutorial() {
3033 tutorial.start()
3134 }
32− signal tutorialDone();
3335
3436 readonly property bool pressed: point1.pressed || point2.pressed || leftButton.pressed || rightButton.pressed
3537
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+
3651 MultiPointTouchArea {
3752 objectName: "touchPadArea"
3853 anchors.fill: parent
54+ enabled: !tutorial.running || tutorial.paused
3955
4056 // FIXME: Once we have Qt DPR support, this should be Qt.styleHints.startDragDistance
4157 readonly property int clickThreshold: internalGu * 1.5
@@ -44,6 +60,12 @@ Item {
4460 property bool isDrag: false
4561
4662 onPressed: {
63+ print("pressed, tutorial state", tutorial.paused, tutorial.running)
64+ if (tutorial.paused) {
65+ tutorial.resume();
66+ return;
67+ }
68+
4769 // If double-tapping *really* fast, it could happen that we end up having only point2 pressed
4870 // Make sure we check for both combos, only point1 or only point2
4971 if (((point1.pressed && !point2.pressed) || (!point1.pressed && point2.pressed))
@@ -177,6 +199,41 @@ Item {
177199 }
178200 }
179201
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+
180237 Label {
181238 id: tutorialLabel
182239 anchors { left: parent.left; top: parent.top; right: parent.right; margins: internalGu * 4; topMargin: internalGu * 10 }
@@ -186,6 +243,16 @@ Item {
186243 wrapMode: Text.WordWrap
187244 }
188245
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+
189256 Item {
190257 id: tutorialFinger1
191258 width: internalGu * 5
@@ -218,6 +285,19 @@ Item {
218285
219286 SequentialAnimation {
220287 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+
221301 PauseAnimation { duration: UbuntuAnimation.SleepyDuration }
222302 PropertyAction { target: tutorialLabel; property: "text"; value: i18n.tr("Tap left button to click.") }
223303 UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
@@ -292,6 +372,10 @@ Item {
292372 UbuntuNumberAnimation { target: tutorialLabel; property: "opacity"; to: 1; duration: UbuntuAnimation.FastDuration }
293373 PauseAnimation { duration: 2000 }
294374 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 }
296380 }
297381}
qml/DisabledScreenNotice.qml−66
@@ -18,16 +18,12 @@ import QtQuick 2.4
1818import QtQuick.Layouts 1.1
1919import Ubuntu.Components 1.3
2020import Unity.Session 0.1
21−import Unity.Screens 0.1
2221import QtQuick.Window 2.2
23−import Qt.labs.settings 1.0
2422import "Components"
2523
2624Item {
2725 id: root
2826
29− property bool infoNoteDisplayed: true
30−
3127 // For testing
3228 property var screen: Screen
3329 property var orientationLock: OrientationLock
@@ -37,10 +33,6 @@ Item {
3733 name: applicationArguments.deviceName
3834 }
3935
40− Screens {
41− id: screens
42− }
43−
4436 Item {
4537 id: contentContainer
4638 objectName: "contentContainer"
@@ -84,64 +76,6 @@ Item {
8476 VirtualTouchPad {
8577 objectName: "virtualTouchPad"
8678 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− }
13179 }
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
14680 }
14781}