on xenial help sign in
Add new right-edge and bottom-edge screens to the first-boot edge tutorial Fixes: #1383297

Approved by: Michael Zanetti

commitd71e55bde4e429f4590aa42c9417ce98fe537529 authorMichael Terry <michael.terry@canonical.com> dateWed 11 Feb 2015, 17:12 (12 years ago) parent2422d6d4114c79
20 files changed+748−205
qml/Shell.qml+7−3 qml/Stages/ApplicationWindow.qml+14−1 qml/Stages/PhoneStage.qml+62−34 qml/Stages/TransformedSpreadDelegate.qml+27−21 qml/Tutorial/Slider.qml+8−2 qml/Tutorial/Tick.qml+29 qml/Tutorial/Tutorial.qml+8−1 qml/Tutorial/TutorialBottom.qml+104 qml/Tutorial/TutorialBottomFinish.qml+41 qml/Tutorial/TutorialContent.qml+55−61 qml/Tutorial/TutorialLeftFinish.qml+4−10 qml/Tutorial/TutorialPage.qml+72−67 qml/Tutorial/TutorialRight.qml+223 qml/Tutorial/graphics/camera.png qml/Tutorial/graphics/dialer.png qml/Tutorial/graphics/facebook.png qml/Tutorial/graphics/gallery.png tests/autopilot/unity8/shell/emulators/tutorial.py+24−4 tests/autopilot/unity8/shell/tests/test_tutorial.py+7 tests/qmltests/Tutorial/tst_Tutorial.qml+63−1
qml/Shell.qml+7−3
@@ -290,7 +290,7 @@ Item {
290290 source: usageModeSettings.usageMode === "Windowed" ? "Stages/DesktopStage.qml"
291291 : tabletMode ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
292292
293− property bool interactive: tutorial.stagesEnabled
293+ property bool interactive: tutorial.spreadEnabled
294294 && !greeter.shown
295295 && !lockscreen.shown
296296 && panel.indicators.fullyClosed
@@ -323,7 +323,7 @@ Item {
323323 Binding {
324324 target: applicationsDisplayLoader.item
325325 property: "spreadEnabled"
326− value: tutorial.stagesEnabled && !greeter.hasLockedApp
326+ value: tutorial.spreadEnabled && !greeter.hasLockedApp
327327 }
328328 Binding {
329329 target: applicationsDisplayLoader.item
@@ -889,8 +889,12 @@ Item {
889889 panel: panel
890890 stages: stages
891891 overlay: overlay
892+ edgeSize: shell.edgeSize
892893
893− onFinished: AccountsService.demoEdges = false
894+ onFinished: {
895+ AccountsService.demoEdges = false;
896+ active = false; // for immediate response / if AS is having problems
897+ }
894898 }
895899
896900 Connections {
qml/Stages/ApplicationWindow.qml+14−1
@@ -43,6 +43,7 @@ FocusScope {
4343 readonly property color splashColor: root.application ? root.application.splashColor : "#00000000"
4444 readonly property color splashColorHeader: root.application ? root.application.splashColorHeader : "#00000000"
4545 readonly property color splashColorFooter: root.application ? root.application.splashColorFooter : "#00000000"
46+ readonly property url defaultScreenshot: root.application ? root.application.defaultScreenshot : ""
4647
4748 // Whether the Application had a surface before but lost it.
4849 property bool hadSurface: sessionContainer.surfaceContainer.hadSurface
@@ -72,7 +73,7 @@ FocusScope {
7273 Image {
7374 id: screenshotImage
7475 objectName: "screenshotImage"
75− source: ""
76+ source: d.defaultScreenshot
7677 anchors.fill: parent
7778 antialiasing: !root.interactive
7879
@@ -125,6 +126,7 @@ FocusScope {
125126 }
126127
127128 StateGroup {
129+ id: stateGroup
128130 objectName: "applicationWindowStateGroup"
129131 states: [
130132 State {
@@ -217,6 +219,17 @@ FocusScope {
217219 PropertyAction { target: screenshotImage; property: "source"; value: "" }
218220 }
219221 },
222+ Transition {
223+ from: "splashScreen"; to: "screenshot"
224+ SequentialAnimation {
225+ PropertyAction { target: screenshotImage
226+ property: "visible"; value: true }
227+ UbuntuNumberAnimation { target: screenshotImage; property: "opacity";
228+ from: 0.0; to: 1.0
229+ duration: UbuntuAnimation.BriskDuration }
230+ PropertyAction { target: splashLoader; property: "active"; value: false }
231+ }
232+ },
220233 Transition {
221234 from: "surface"; to: "void"
222235 SequentialAnimation {
qml/Stages/PhoneStage.qml+62−34
@@ -32,6 +32,21 @@ Rectangle {
3232 property bool spreadEnabled: true // If false, animations and right edge will be disabled
3333 property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
3434 property int orientation: Qt.PortraitOrientation
35+ property QtObject applicationManager: ApplicationManager
36+ property bool focusFirstApp: true // If false, focused app will appear on right edge like other apps
37+ property bool altTabEnabled: true
38+ property real startScale: 1.1
39+ property real endScale: 0.7
40+
41+ // How far left the stage has been dragged
42+ readonly property real dragProgress: spreadRepeater.count > 0 ? -spreadRepeater.itemAt(0).xTranslate : 0
43+
44+ readonly property alias dragging: spreadDragArea.dragging
45+
46+ // Only used by the tutorial right now, when it is teasing the right edge
47+ property real dragAreaOverlap
48+
49+ signal opened()
3550
3651 color: "#111111"
3752
@@ -52,30 +67,30 @@ Rectangle {
5267 if (inverseProgress == 0 && priv.oldInverseProgress > 0) {
5368 // left edge drag released. Minimum distance is given by design.
5469 if (priv.oldInverseProgress > units.gu(22)) {
55− ApplicationManager.requestFocusApplication("unity8-dash");
70+ applicationManager.requestFocusApplication("unity8-dash");
5671 }
5772 }
5873 priv.oldInverseProgress = inverseProgress;
5974 }
6075
6176 Connections {
62− target: ApplicationManager
77+ target: applicationManager
6378
6479 onFocusRequested: {
6580 if (spreadView.phase > 0) {
6681 spreadView.snapTo(priv.indexOf(appId));
6782 } else {
68− ApplicationManager.focusApplication(appId);
83+ applicationManager.focusApplication(appId);
6984 }
7085 }
7186
7287 onApplicationAdded: {
7388 if (spreadView.phase == 2) {
74− spreadView.snapTo(ApplicationManager.count - 1);
89+ spreadView.snapTo(applicationManager.count - 1);
7590 } else {
7691 spreadView.phase = 0;
7792 spreadView.contentX = -spreadView.shift;
78− ApplicationManager.focusApplication(appId);
93+ applicationManager.focusApplication(appId);
7994 }
8095 }
8196
@@ -90,9 +105,9 @@ Rectangle {
90105 }
91106
92107 function focusTopMostApp() {
93− if (ApplicationManager.count > 0) {
94− var topmostApp = ApplicationManager.get(0);
95− ApplicationManager.focusApplication(topmostApp.appId);
108+ if (applicationManager.count > 0) {
109+ var topmostApp = applicationManager.get(0);
110+ applicationManager.focusApplication(topmostApp.appId);
96111 }
97112 }
98113 }
@@ -100,20 +115,21 @@ Rectangle {
100115 QtObject {
101116 id: priv
102117
103− property string focusedAppId: ApplicationManager.focusedApplicationId
104− property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
118+ readonly property int firstSpreadIndex: root.focusFirstApp ? 1 : 0
119+ property string focusedAppId: applicationManager.focusedApplicationId
120+ property var focusedApplication: applicationManager.findApplication(focusedAppId)
105121 property var focusedAppDelegate: null
106122
107123 property real oldInverseProgress: 0
108− property bool animateX: true
124+ property bool animateX: false
109125
110126 onFocusedAppIdChanged: focusedAppDelegate = spreadRepeater.itemAt(0);
111127
112128 onFocusedAppDelegateChanged: focusedAppDelegate.focus = true;
113129
114130 function indexOf(appId) {
115− for (var i = 0; i < ApplicationManager.count; i++) {
116− if (ApplicationManager.get(i).appId == appId) {
131+ for (var i = 0; i < applicationManager.count; i++) {
132+ if (applicationManager.get(i).appId == appId) {
117133 return i;
118134 }
119135 }
@@ -133,7 +149,7 @@ Rectangle {
133149
134150 // This indicates when the spreadView is active. That means, all the animations
135151 // are activated and tiles need to line up for the spread.
136− readonly property bool active: shiftedContentX > 0 || spreadDragArea.status === DirectionalDragArea.Recognized
152+ readonly property bool active: shiftedContentX > 0 || spreadDragArea.status === DirectionalDragArea.Recognized || !root.focusFirstApp
137153
138154 // The flickable needs to fill the screen in order to get touch events all over.
139155 // However, we don't want to the user to be able to scroll back all the way. For
@@ -199,10 +215,17 @@ Rectangle {
199215 // Add 1 pixel to make sure we definitely hit positionMarker4 even with rounding errors of the animation.
200216 snapAnimation.targetContentX = width * positionMarker4 + 1 - shift;
201217 snapAnimation.start();
218+ root.opened();
202219 }
203220 }
204221 function snapTo(index) {
205− if (ApplicationManager.count <= index) {
222+ if (!root.altTabEnabled) {
223+ // Reset to start instead
224+ snapAnimation.targetContentX = -shift;
225+ snapAnimation.start();
226+ return;
227+ }
228+ if (applicationManager.count <= index) {
206229 // In case we're trying to snap to some non existing app, lets snap back to the first one
207230 index = 0;
208231 }
@@ -217,10 +240,12 @@ Rectangle {
217240 snapAnimation.start();
218241 }
219242
220− // In case the ApplicationManager already holds an app when starting up we're missing animations
243+ // In case the applicationManager already holds an app when starting up we're missing animations
221244 // Make sure we end up in the same state
222245 Component.onCompleted: {
223246 spreadView.contentX = -spreadView.shift
247+ priv.animateX = true;
248+ snapAnimation.complete();
224249 }
225250
226251 SequentialAnimation {
@@ -237,7 +262,7 @@ Rectangle {
237262 ScriptAction {
238263 script: {
239264 if (spreadView.selectedIndex >= 0) {
240− ApplicationManager.focusApplication(ApplicationManager.get(spreadView.selectedIndex).appId);
265+ applicationManager.focusApplication(applicationManager.get(spreadView.selectedIndex).appId);
241266
242267 spreadView.selectedIndex = -1;
243268 spreadView.phase = 0;
@@ -252,7 +277,7 @@ Rectangle {
252277 // This width controls how much the spread can be flicked left/right. It's composed of:
253278 // tileDistance * app count (with a minimum of 3 apps, in order to also allow moving 1 and 2 apps a bit)
254279 // + some constant value (still scales with the screen width) which looks good and somewhat fills the screen
255− width: Math.max(3, ApplicationManager.count) * spreadView.tileDistance + (spreadView.width - spreadView.tileDistance) * 1.5
280+ width: Math.max(3, applicationManager.count) * spreadView.tileDistance + (spreadView.width - spreadView.tileDistance) * 1.5
256281 height: parent.height
257282 Behavior on width {
258283 enabled: spreadView.closingIndex >= 0
@@ -267,20 +292,22 @@ Rectangle {
267292 x: spreadView.contentX
268293
269294 onClicked: {
270− spreadView.snapTo(0);
295+ if (root.altTabEnabled) {
296+ spreadView.snapTo(0);
297+ }
271298 }
272299
273300 Repeater {
274301 id: spreadRepeater
275302 objectName: "spreadRepeater"
276− model: ApplicationManager
303+ model: applicationManager
277304 delegate: TransformedSpreadDelegate {
278305 id: appDelegate
279306 objectName: "appDelegate" + index
280307 startAngle: 45
281308 endAngle: 5
282− startScale: 1.1
283− endScale: 0.7
309+ startScale: root.startScale
310+ endScale: root.endScale
284311 startDistance: spreadView.tileDistance
285312 endDistance: units.gu(.5)
286313 width: spreadView.width
@@ -288,11 +315,12 @@ Rectangle {
288315 selected: spreadView.selectedIndex == index
289316 otherSelected: spreadView.selectedIndex >= 0 && !selected
290317 interactive: !spreadView.interactive && spreadView.phase === 0
291− && spreadView.shiftedContentX === 0 && root.interactive && index === 0
292− swipeToCloseEnabled: spreadView.interactive && !snapAnimation.running
318+ && spreadView.shiftedContentX === 0 && root.interactive && isFocused
319+ swipeToCloseEnabled: spreadView.interactive && root.interactive && !snapAnimation.running
293320 maximizedAppTopMargin: root.maximizedAppTopMargin
294321 dropShadow: spreadView.active ||
295322 (priv.focusedAppDelegate && priv.focusedAppDelegate.x !== 0)
323+ focusFirstApp: root.focusFirstApp
296324
297325 readonly property bool isDash: model.appId == "unity8-dash"
298326
@@ -300,7 +328,7 @@ Rectangle {
300328
301329 x: {
302330 // focused app is always positioned at 0 except when following left edge drag
303− if (index == 0) {
331+ if (isFocused) {
304332 if (!isDash && root.inverseProgress > 0 && spreadView.phase === 0) {
305333 return root.inverseProgress;
306334 }
@@ -311,10 +339,10 @@ Rectangle {
311339 }
312340
313341 // Otherwise line up for the spread
314− return spreadView.width + (index - 1) * spreadView.tileDistance;
342+ return spreadView.width + spreadIndex * spreadView.tileDistance;
315343 }
316344
317− application: ApplicationManager.get(index)
345+ application: applicationManager.get(index)
318346 closeable: !isDash
319347
320348 property real behavioredIndex: index
@@ -352,7 +380,7 @@ Rectangle {
352380 progress: {
353381 var tileProgress = (spreadView.shiftedContentX - behavioredIndex * spreadView.tileDistance) / spreadView.width;
354382 // Tile 1 needs to move directly from the beginning...
355− if (behavioredIndex == 1 && spreadView.phase < 2) {
383+ if (root.focusFirstApp && behavioredIndex == 1 && spreadView.phase < 2) {
356384 tileProgress += spreadView.tileDistance / spreadView.width;
357385 }
358386 // Limiting progress to ~0 and 1.7 to avoid binding calculations when tiles are not
@@ -367,7 +395,7 @@ Rectangle {
367395
368396 // This mostly is the same as progress, just adds the snapping to phase 1 for tiles 0 and 1
369397 animatedProgress: {
370− if (spreadView.phase == 0 && index < 2) {
398+ if (spreadView.phase == 0 && index <= priv.firstSpreadIndex) {
371399 if (progress < spreadView.positionMarker1) {
372400 return progress;
373401 } else if (progress < spreadView.positionMarker1 + 0.05){
@@ -392,11 +420,11 @@ Rectangle {
392420 }
393421
394422 onClicked: {
395− if (spreadView.phase == 2) {
396− if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
423+ if (root.altTabEnabled && spreadView.phase == 2) {
424+ if (applicationManager.focusedApplicationId == applicationManager.get(index).appId) {
397425 spreadView.snapTo(index);
398426 } else {
399− ApplicationManager.requestFocusApplication(ApplicationManager.get(index).appId);
427+ applicationManager.requestFocusApplication(applicationManager.get(index).appId);
400428 }
401429 }
402430 }
@@ -411,7 +439,7 @@ Rectangle {
411439
412440 onClosed: {
413441 spreadView.closingIndex = index;
414− ApplicationManager.stopApplication(ApplicationManager.get(index).appId);
442+ applicationManager.stopApplication(applicationManager.get(index).appId);
415443 }
416444 }
417445 }
@@ -424,7 +452,7 @@ Rectangle {
424452 direction: Direction.Leftwards
425453 enabled: (spreadView.phase != 2 && root.spreadEnabled) || dragging
426454
427− anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
455+ anchors { top: parent.top; right: parent.right; bottom: parent.bottom; rightMargin: -root.dragAreaOverlap }
428456 width: root.dragAreaWidth
429457
430458 property var gesturePoints: new Array()
qml/Stages/TransformedSpreadDelegate.qml+27−21
@@ -46,6 +46,18 @@ SpreadDelegate {
4646 property real startDistance: units.gu(5)
4747 property real endDistance: units.gu(.5)
4848
49+ // Whether first app is displayed entirely vs just on the spread edge
50+ property bool focusFirstApp: true
51+
52+ // Whether this delegate is displayed to the user outside of the spread
53+ readonly property bool isFocused: focusFirstApp && index === 0
54+
55+ // Adjusted index for any spread animation calculations
56+ readonly property int spreadIndex: index - (focusFirstApp ? 1 : 0)
57+
58+ // How far left this delegate has been translated
59+ readonly property alias xTranslate: priv.xTranslate
60+
4961 onSelectedChanged: {
5062 if (selected) {
5163 priv.snapshot();
@@ -63,8 +75,8 @@ SpreadDelegate {
6375 Connections {
6476 target: spreadView
6577 onPhaseChanged: {
66− if (spreadView.phase == 1) {
67− if (index == 0) {
78+ if (root.focusFirstApp && spreadView.phase == 1) {
79+ if (index === 0) {
6880 priv.phase2startTranslate = priv.easingAnimation(0, spreadView.positionMarker4, 0, -spreadView.width, spreadView.positionMarker4) + spreadView.width;
6981 priv.phase2startAngle = priv.easingAnimation(0, spreadView.positionMarker4, root.startAngle, root.endAngle, spreadView.positionMarker4);
7082 priv.phase2startScale = priv.easingAnimation(0, spreadView.positionMarker4, root.startScale, root.endScale, spreadView.positionMarker4);
@@ -134,7 +146,7 @@ SpreadDelegate {
134146 }
135147
136148 if (otherSelected) {
137− if (spreadView.phase < 2 && index == 0) {
149+ if (spreadView.phase < 2 && root.isFocused) {
138150 return linearAnimation(selectedProgress, 0, selectedXTranslate,
139151 selectedXTranslate - spreadView.tileDistance, root.progress);
140152 }
@@ -142,8 +154,7 @@ SpreadDelegate {
142154 return selectedXTranslate;
143155 }
144156
145− switch (index) {
146− case 0:
157+ if (root.focusFirstApp && index === 0) {
147158 if (spreadView.phase == 0) {
148159 return Math.min(0, linearAnimation(0, spreadView.positionMarker2,
149160 0, -spreadView.width * .25, root.animatedProgress));
@@ -153,11 +164,10 @@ SpreadDelegate {
153164 } else if (!priv.isSelected){ // phase 2
154165 // Apply the same animation as with the rest but add spreadView.width to align it with the others.
155166 return -easingCurve.value * spreadView.width + spreadView.width;
156− } else if (priv.isSelected) {
167+ } else {
157168 return linearAnimation(selectedProgress, 0, selectedXTranslate, 0, root.progress);
158169 }
159−
160− case 1:
170+ } else if (root.focusFirstApp && index === 1) {
161171 if (spreadView.phase == 0 && !priv.isSelected) {
162172 return linearAnimation(0, spreadView.positionMarker2,
163173 0, -spreadView.width * spreadView.snapPosition, root.animatedProgress);
@@ -170,13 +180,13 @@ SpreadDelegate {
170180
171181 if (priv.isSelected) {
172182 // Distance to left edge
173− var targetTranslate = -spreadView.width - ((index - 1) * root.startDistance);
183+ var targetTranslate = -spreadView.width - (root.spreadIndex * root.startDistance);
174184 return linearAnimation(selectedProgress, 0,
175185 selectedXTranslate, targetTranslate, root.progress);
176186 }
177187
178188 // Fix it at the right edge...
179− var rightEdgeOffset = -((index - 1) * root.startDistance);
189+ var rightEdgeOffset = -(root.spreadIndex * root.startDistance);
180190 // ...and use our easing to move them to the left. Stop a bit earlier for each tile
181191 var animatedEndDistance = linearAnimation(0, 2, root.endDistance, 0, root.progress);
182192 return -easingCurve.value * spreadView.width + (index * animatedEndDistance) + rightEdgeOffset;
@@ -194,8 +204,7 @@ SpreadDelegate {
194204 if (priv.isSelected) {
195205 return linearAnimation(selectedProgress, 0, selectedAngle, 0, root.progress);
196206 }
197− switch (index) {
198− case 0:
207+ if (root.focusFirstApp && index === 0) {
199208 if (spreadView.phase == 0) {
200209 return Math.max(0, linearAnimation(0, spreadView.positionMarker2,
201210 0, root.tile0SnapAngle, root.animatedProgress));
@@ -203,7 +212,7 @@ SpreadDelegate {
203212 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
204213 root.tile0SnapAngle, phase2startAngle, root.progress);
205214 }
206− case 1:
215+ } else if (root.focusFirstApp && index === 1) {
207216 if (spreadView.phase == 0) {
208217 return linearAnimation(0, spreadView.positionMarker2, root.startAngle,
209218 root.startAngle * (1-spreadView.snapPosition), root.animatedProgress);
@@ -227,15 +236,14 @@ SpreadDelegate {
227236 return linearAnimation(selectedProgress, 0, selectedScale, 1, root.progress);
228237 }
229238
230− switch (index) {
231− case 0:
239+ if (root.focusFirstApp && index === 0) {
232240 if (spreadView.phase == 0) {
233241 return 1;
234242 } else if (spreadView.phase == 1) {
235243 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
236244 1, phase2startScale, root.progress);
237245 }
238− case 1:
246+ } else if (root.focusFirstApp && index === 1) {
239247 if (spreadView.phase == 0) {
240248 var targetScale = tile1StartScale - ((tile1StartScale - 1) * spreadView.snapPosition);
241249 return linearAnimation(0, spreadView.positionMarker2,
@@ -254,7 +262,7 @@ SpreadDelegate {
254262 return linearAnimation (selectedProgress, Math.max(0, selectedProgress - .5),
255263 selectedOpacity, 0, root.progress);
256264 }
257− if (index == 0) {
265+ if (root.isFocused) {
258266 switch (spreadView.phase) {
259267 case 0:
260268 return linearAnimation(0, spreadView.positionMarker2, 1, .7, root.animatedProgress);
@@ -272,16 +280,14 @@ SpreadDelegate {
272280 return linearAnimation(selectedProgress, 0, selectedTopMarginProgress, 0, root.progress);
273281 }
274282
275− switch (index) {
276− case 0:
283+ if (root.focusFirstApp && index === 0) {
277284 if (spreadView.phase == 0) {
278285 return 0;
279286 } else if (spreadView.phase == 1) {
280287 return linearAnimation(spreadView.positionMarker2, spreadView.positionMarker4,
281288 0, priv.phase2startTopMarginProgress, root.progress);
282289 }
283− break;
284− case 1:
290+ } else if (root.focusFirstApp && index === 1) {
285291 if (spreadView.phase == 0) {
286292 return 0;
287293 } else if (spreadView.phase == 1) {
qml/Tutorial/Slider.qml+8−2
@@ -38,7 +38,7 @@ Item {
3838 readonly property real margin: units.gu(0.5)
3939 readonly property real arrowSize: root.height - margin * 2
4040 readonly property real dotSize: units.dp(1)
41− readonly property real slideOffset: Math.min(root.offset - offscreenOffset, target.x)
41+ readonly property real slideOffset: MathUtils.clamp(root.offset - offscreenOffset, -offscreenOffset, target.x)
4242 readonly property real offscreenOffset: units.gu(2)
4343 }
4444
@@ -111,7 +111,13 @@ Item {
111111 color: UbuntuColors.orange
112112 darkenBy: root.active ? 0.5 : 0
113113 anchors.left: parent.left
114− anchors.leftMargin: d.slideOffset
114+ // We use a Translate transform rather than anchors.leftMargin because
115+ // the latter has weird performance problems on the TutorialRight page.
116+ transform: [
117+ Translate {
118+ x: d.slideOffset
119+ }
120+ ]
115121 anchors.verticalCenter: parent.verticalCenter
116122 }
117123}
qml/Tutorial/Tick.qmlnew file+29
@@ -0,0 +1,29 @@
1+/*
2+ * Copyright (C) 2015 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+import Ubuntu.Components 1.1
19+
20+MouseArea {
21+ implicitHeight: tick.height
22+ implicitWidth: tick.width
23+ Image {
24+ id: tick
25+ source: Qt.resolvedUrl("graphics/tick.png")
26+ height: units.gu(6.5)
27+ width: units.gu(6.5)
28+ }
29+}
qml/Tutorial/Tutorial.qml+8−1
@@ -22,6 +22,7 @@ Item {
2222
2323 property alias active: loader.active
2424 property bool paused
25+ property real edgeSize
2526
2627 property Item launcher
2728 property Item panel
@@ -29,7 +30,7 @@ Item {
2930 property Item overlay
3031
3132 readonly property bool launcherEnabled: loader.item ? loader.item.launcherEnabled : true
32− readonly property bool stagesEnabled: loader.item ? loader.item.stagesEnabled : true
33+ readonly property bool spreadEnabled: loader.item ? loader.item.spreadEnabled : true
3334 readonly property bool panelEnabled: loader.item ? loader.item.panelEnabled : true
3435 readonly property bool panelContentEnabled: loader.item ? loader.item.panelContentEnabled : true
3536 readonly property bool running: loader.item ? loader.item.running : false
@@ -53,6 +54,12 @@ Item {
5354 value: root.paused
5455 }
5556
57+ Binding {
58+ target: loader.item
59+ property: "edgeSize"
60+ value: root.edgeSize
61+ }
62+
5663 Binding {
5764 target: loader.item
5865 property: "launcher"
qml/Tutorial/TutorialBottom.qmlnew file+104
@@ -0,0 +1,104 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+import Ubuntu.Components 1.1
19+import Ubuntu.Gestures 0.1
20+import "../Components"
21+import "." as LocalComponents
22+
23+TutorialPage {
24+ id: root
25+
26+ property alias edgeSize: dragArea.height
27+
28+ title: i18n.tr("Open special menus")
29+ text: i18n.tr("Swipe up from the bottom edge.")
30+ fullTextWidth: true
31+
32+ SequentialAnimation {
33+ id: teaseAnimation
34+ paused: running && root.paused
35+ running: !dragArea.useTouchY && slider.dragOffset === 0
36+ loops: Animation.Infinite
37+
38+ UbuntuNumberAnimation {
39+ target: slider
40+ property: "teaseOffset"
41+ to: units.gu(1)
42+ duration: UbuntuAnimation.SleepyDuration
43+ }
44+ UbuntuNumberAnimation {
45+ target: slider
46+ property: "teaseOffset"
47+ to: 0
48+ duration: UbuntuAnimation.SleepyDuration
49+ }
50+ }
51+
52+ foreground {
53+ children: [
54+ LocalComponents.Slider {
55+ id: slider
56+ anchors {
57+ bottom: parent.bottom
58+ bottomMargin: width / 2 - height / 2
59+ horizontalCenter: parent.horizontalCenter
60+ }
61+ rotation: -90
62+ offset: teaseOffset + dragOffset
63+ active: dragArea.dragging
64+
65+ property real teaseOffset
66+ property real dragOffset: dragArea.useTouchY ? -dragArea.touchY : 0
67+
68+ Behavior on dragOffset {
69+ id: offsetAnimation
70+ UbuntuNumberAnimation {}
71+ }
72+ }
73+ ]
74+ }
75+
76+ EdgeDragArea {
77+ id: dragArea
78+ direction: Direction.Upwards
79+ anchors {
80+ bottom: parent.bottom
81+ left: parent.left
82+ right: parent.right
83+ }
84+
85+ property bool useTouchY
86+
87+ onDraggingChanged: {
88+ if (!dragging) {
89+ if (slider.percent >= 0.85) {
90+ root.hide();
91+ } else if (slider.percent >= 0.15) {
92+ root.showError();
93+ }
94+ }
95+
96+ // We use a separate vars here rather than just directly looking at
97+ // 'dragging' because we want to preserve our 'slider.offset'
98+ // value during the above percent check. Now that we made it,
99+ // we can have 'slider.offset' go back to zero.
100+ offsetAnimation.enabled = !dragging;
101+ useTouchY = dragging;
102+ }
103+ }
104+}
qml/Tutorial/TutorialBottomFinish.qmlnew file+41
@@ -0,0 +1,41 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+import Ubuntu.Components 1.1
19+import "." as LocalComponents
20+
21+TutorialPage {
22+ id: root
23+
24+ title: i18n.tr("This action does different things for different apps")
25+ text: i18n.tr("Tap here to finish.")
26+ fullTextWidth: true
27+
28+ foreground {
29+ children: [
30+ LocalComponents.Tick {
31+ objectName: "tick"
32+ anchors {
33+ horizontalCenter: parent.horizontalCenter
34+ top: parent.top
35+ topMargin: root.textBottom + units.gu(3)
36+ }
37+ onClicked: root.hide()
38+ }
39+ ]
40+ }
41+}
qml/Tutorial/TutorialContent.qml+55−61
@@ -26,13 +26,14 @@ Item {
2626 property Item overlay
2727
2828 readonly property bool launcherEnabled: !running ||
29− (!paused && loader.target === leftComponent)
30− readonly property bool stagesEnabled: !running
29+ (!paused && tutorialLeft.shown)
30+ readonly property bool spreadEnabled: !running
3131 readonly property bool panelEnabled: !running
3232 readonly property bool panelContentEnabled: !running
33− readonly property bool running: loader.sourceComponent !== null
33+ readonly property alias running: d.running
3434
3535 property bool paused: false
36+ property real edgeSize
3637
3738 signal finished()
3839
@@ -50,81 +51,74 @@ Item {
5051 QtObject {
5152 id: d
5253
54+ property bool running
55+
5356 function stop() {
54− loader.sourceComponent = null;
57+ running = false;
5558 }
5659
5760 function start() {
58− loader.load(leftComponent);
61+ running = true;
62+ tutorialLeft.show();
5963 }
6064 }
6165
62− Loader {
63− id: loader
64− objectName: "tutorialLoader"
65−
66− property Component target: {
67− if (next) {
68− return next;
69− } else if (loader.item && loader.item.shown) {
70− return sourceComponent;
71− } else {
72− return null;
73− }
74− }
66+ TutorialLeft {
67+ id: tutorialLeft
68+ objectName: "tutorialLeft"
69+ parent: root.stages
70+ anchors.fill: parent
71+ launcher: root.launcher
72+ paused: !shown || root.paused
7573
76− property Component next: null
74+ onFinished: tutorialLeftFinish.show()
75+ }
7776
78− function load(comp) {
79− if (loader.item) {
80− next = comp;
81− loader.item.hide();
82− } else {
83− loader.sourceComponent = comp;
84− }
77+ TutorialLeftFinish {
78+ id: tutorialLeftFinish
79+ objectName: "tutorialLeftFinish"
80+ parent: root.stages
81+ anchors.fill: parent
82+ textXOffset: root.launcher.panelWidth
83+ paused: !shown || root.paused
84+
85+ onFinished: {
86+ root.launcher.hide();
87+ tutorialRight.show();
8588 }
89+ }
8690
87− Connections {
88− target: loader.item
89− onFinished: {
90− loader.sourceComponent = loader.next;
91− if (loader.next != null) {
92− loader.next = null;
93− } else {
94− root.finished();
95− }
96− }
97− }
91+ TutorialRight {
92+ id: tutorialRight
93+ objectName: "tutorialRight"
94+ parent: root.stages
95+ anchors.fill: parent
96+ edgeSize: root.edgeSize
97+ panel: root.panel
98+ paused: !shown || root.paused
9899
99− Binding {
100− target: loader.item
101− property: "paused"
102− value: root.paused
103− }
100+ onFinished: tutorialBottom.show()
104101 }
105102
106− Component {
107− id: leftComponent
108− TutorialLeft {
109− objectName: "tutorialLeft"
110− parent: root.stages
111− anchors.fill: parent
112− launcher: root.launcher
103+ TutorialBottom {
104+ id: tutorialBottom
105+ objectName: "tutorialBottom"
106+ parent: root.stages
107+ anchors.fill: parent
108+ edgeSize: root.edgeSize
109+ paused: !shown || root.paused
113110
114− onFinished: loader.load(leftFinishComponent)
115− }
111+ onFinished: tutorialBottomFinish.show()
116112 }
117113
118− Component {
119− id: leftFinishComponent
120− TutorialLeftFinish {
121− objectName: "tutorialLeftFinish"
122− parent: root.stages
123− anchors.fill: parent
124− textXOffset: root.launcher.panelWidth
125− backgroundFadesOut: true
114+ TutorialBottomFinish {
115+ id: tutorialBottomFinish
116+ objectName: "tutorialBottomFinish"
117+ parent: root.stages
118+ anchors.fill: parent
119+ backgroundFadesOut: true
120+ paused: !shown || root.paused
126121
127− onFinished: root.launcher.hide()
128− }
122+ onFinished: root.finish()
129123 }
130124}
qml/Tutorial/TutorialLeftFinish.qml+4−10
@@ -16,31 +16,25 @@
1616
1717import QtQuick 2.3
1818import Ubuntu.Components 1.1
19+import "." as LocalComponents
1920
2021TutorialPage {
2122 id: root
2223
2324 title: i18n.tr("These are the shortcuts to favorite apps")
24− text: i18n.tr("Tap here to finish.")
25+ text: i18n.tr("Tap here to continue.")
2526 fullTextWidth: true
2627
2728 foreground {
2829 children: [
29− Image {
30+ LocalComponents.Tick {
3031 objectName: "tick"
3132 anchors {
3233 horizontalCenter: parent.horizontalCenter
3334 top: parent.top
3435 topMargin: root.textBottom + units.gu(3)
3536 }
36− source: Qt.resolvedUrl("graphics/tick.png")
37− height: units.gu(6.5)
38− width: units.gu(6.5)
39−
40− MouseArea {
41− anchors.fill: parent
42− onClicked: root.hide()
43− }
37+ onClicked: root.hide()
4438 }
4539 ]
4640 }
qml/Tutorial/TutorialPage.qml+72−67
@@ -52,8 +52,8 @@ Showable {
5252 property real textXOffset: 0
5353 property real textYOffset: 0
5454
55− // Foreground opacity
56− property real foregroundOpacity: 1
55+ // Foreground text opacity
56+ property real textOpacity: 1
5757
5858 signal finished()
5959
@@ -63,8 +63,8 @@ Showable {
6363
6464 ////
6565
66+ visible: false
6667 shown: false
67− Component.onCompleted: show()
6868
6969 property real _foregroundHideOpacity
7070
@@ -73,16 +73,16 @@ Showable {
7373 from: 0
7474 to: 1
7575 duration: root.backgroundFadesIn ? UbuntuAnimation.SleepyDuration : UbuntuAnimation.BriskDuration
76+ onStarted: root.visible = true
7677 }
7778
7879 hideAnimation: StandardAnimation {
7980 property: root.backgroundFadesOut ? "opacity" : "_foregroundHideOpacity"
8081 to: 0
8182 duration: UbuntuAnimation.BriskDuration
82− onRunningChanged: {
83− if (!running) {
84− root.finished();
85− }
83+ onStopped: {
84+ root.visible = false;
85+ root.finished();
8686 }
8787 }
8888
@@ -122,73 +122,78 @@ Showable {
122122 Item {
123123 id: foreground
124124 anchors.fill: parent
125− opacity: root.foregroundOpacity < 1 ? root.foregroundOpacity : root._foregroundHideOpacity
126−
127− Label {
128− id: titleLabel
129− anchors {
130− top: parent.verticalCenter
131− topMargin: d.verticalOffset + root.textYOffset
132− left: parent.left
133− leftMargin: d.sideMargin + d.textXOffset
125+ opacity: root._foregroundHideOpacity
126+
127+ Item {
128+ anchors.fill: parent
129+ opacity: root.textOpacity
130+
131+ Label {
132+ id: titleLabel
133+ anchors {
134+ top: parent.verticalCenter
135+ topMargin: d.verticalOffset + root.textYOffset
136+ left: parent.left
137+ leftMargin: d.sideMargin + d.textXOffset
138+ }
139+ width: parent.width - d.sideMargin * 2
140+ horizontalAlignment: Text.AlignLeft
141+ wrapMode: Text.Wrap
142+ font.weight: Font.Light
143+ font.pixelSize: units.gu(3.5)
134144 }
135− width: parent.width - d.sideMargin * 2
136− horizontalAlignment: Text.AlignLeft
137− wrapMode: Text.Wrap
138− font.weight: Font.Light
139− font.pixelSize: units.gu(3.5)
140− }
141145
142− Label {
143− id: textLabel
144− anchors {
145− top: titleLabel.bottom
146− topMargin: units.gu(2)
147− left: parent.left
148− leftMargin: d.sideMargin + d.textXOffset
146+ Label {
147+ id: textLabel
148+ anchors {
149+ top: titleLabel.bottom
150+ topMargin: units.gu(2)
151+ left: parent.left
152+ leftMargin: d.sideMargin + d.textXOffset
153+ }
154+ width: (parent.width - d.sideMargin * 2) * (fullTextWidth ? 1 : 0.66)
155+ horizontalAlignment: Text.AlignLeft
156+ wrapMode: Text.Wrap
157+ font.weight: Font.Light
158+ font.pixelSize: units.gu(2.5)
149159 }
150− width: (parent.width - d.sideMargin * 2) * (fullTextWidth ? 1 : 0.66)
151− horizontalAlignment: Text.AlignLeft
152− wrapMode: Text.Wrap
153− font.weight: Font.Light
154− font.pixelSize: units.gu(2.5)
155− }
156160
157− // We use two separate labels like this rather than just changing
158− // the text of the above labels because we want to know where to place
159− // sliders (via root.textBottom) without having that place change
160− // as the text changes length.
161− Label {
162− id: errorTitleLabel
163− objectName: "errorTitleLabel"
164− anchors {
165− top: titleLabel.top
166− left: titleLabel.left
161+ // We use two separate labels like this rather than just changing
162+ // the text of the above labels because we want to know where to place
163+ // sliders (via root.textBottom) without having that place change
164+ // as the text changes length.
165+ Label {
166+ id: errorTitleLabel
167+ objectName: "errorTitleLabel"
168+ anchors {
169+ top: titleLabel.top
170+ left: titleLabel.left
171+ }
172+ width: titleLabel.width
173+ horizontalAlignment: titleLabel.horizontalAlignment
174+ wrapMode: titleLabel.wrapMode
175+ font.weight: titleLabel.font.weight
176+ font.pixelSize: titleLabel.font.pixelSize
177+ opacity: 0
178+ text: i18n.tr("You almost got it!")
167179 }
168− width: titleLabel.width
169− horizontalAlignment: titleLabel.horizontalAlignment
170− wrapMode: titleLabel.wrapMode
171− font.weight: titleLabel.font.weight
172− font.pixelSize: titleLabel.font.pixelSize
173− opacity: 0
174− text: i18n.tr("You almost got it!")
175− }
176180
177− Label {
178− id: errorTextLabel
179− objectName: "errorTextLabel"
180− anchors {
181− top: errorTitleLabel.bottom
182− topMargin: textLabel.anchors.topMargin
183− left: textLabel.left
181+ Label {
182+ id: errorTextLabel
183+ objectName: "errorTextLabel"
184+ anchors {
185+ top: errorTitleLabel.bottom
186+ topMargin: textLabel.anchors.topMargin
187+ left: textLabel.left
188+ }
189+ width: textLabel.width
190+ horizontalAlignment: textLabel.horizontalAlignment
191+ wrapMode: textLabel.wrapMode
192+ font.weight: textLabel.font.weight
193+ font.pixelSize: textLabel.font.pixelSize
194+ opacity: 0
195+ text: i18n.tr("Try again.")
184196 }
185− width: textLabel.width
186− horizontalAlignment: textLabel.horizontalAlignment
187− wrapMode: textLabel.wrapMode
188− font.weight: textLabel.font.weight
189− font.pixelSize: textLabel.font.pixelSize
190− opacity: 0
191− text: i18n.tr("Try again.")
192197 }
193198
194199 // A place for subclasses to add extra widgets
qml/Tutorial/TutorialRight.qmlnew file+223
@@ -0,0 +1,223 @@
1+/*
2+ * Copyright (C) 2014 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+import Ubuntu.Components 1.1
19+import Ubuntu.Gestures 0.1
20+import Unity.Application 0.1
21+import "../Components"
22+import "../Stages"
23+import "." as LocalComponents
24+
25+TutorialPage {
26+ id: root
27+
28+ property var panel
29+ property alias edgeSize: stage.dragAreaWidth
30+
31+ title: i18n.tr("To view open apps")
32+ text: i18n.tr("Long swipe from the right edge.")
33+
34+ textOpacity: 1 - slider.percent
35+
36+ SequentialAnimation {
37+ id: teaseAnimation
38+ paused: running && root.paused
39+ running: !stage.dragging && stage.dragProgress === 0
40+ loops: Animation.Infinite
41+
42+ UbuntuNumberAnimation {
43+ target: stage
44+ property: "x"
45+ to: -stage.dragAreaOverlap
46+ duration: UbuntuAnimation.SleepyDuration
47+ }
48+ UbuntuNumberAnimation {
49+ target: stage
50+ property: "x"
51+ to: 0
52+ duration: UbuntuAnimation.SleepyDuration
53+ }
54+ }
55+
56+ foreground {
57+ children: [
58+ LocalComponents.Slider {
59+ id: slider
60+ anchors {
61+ right: parent.right
62+ top: parent.top
63+ topMargin: root.textBottom + units.gu(3)
64+ }
65+ rotation: 180
66+ offset: stage.dragProgress - stage.x
67+ active: stage.dragging
68+ },
69+
70+ // Just assume PhoneStage for now. The tablet version of the right-edge
71+ // tutorial is still being spec'd by the design team.
72+ PhoneStage {
73+ id: stage
74+ objectName: "stage"
75+ anchors.top: parent.top
76+ width: parent.width
77+ height: parent.height
78+ applicationManager: fakeAppManager
79+ color: "transparent"
80+ interactive: false
81+ altTabEnabled: false
82+ focusFirstApp: false
83+ startScale: 0.8
84+ endScale: 0.6
85+ dragAreaOverlap: units.gu(2)
86+
87+ onOpened: {
88+ overlay.show();
89+ root.textOpacity = 0;
90+ slider.visible = false;
91+ }
92+
93+ onDraggingChanged: {
94+ if (!dragging) {
95+ if (!overlay.shown) {
96+ root.showError();
97+ }
98+ teaseAnimation.complete();
99+ }
100+ }
101+ },
102+
103+ Showable {
104+ id: overlay
105+ objectName: "overlay"
106+ anchors.fill: parent
107+
108+ opacity: 0
109+ shown: false
110+ showAnimation: UbuntuNumberAnimation { property: "opacity"; to: 1 }
111+
112+ Label {
113+ anchors.top: parent.top
114+ anchors.topMargin: root.panel.panelHeight + units.gu(2)
115+ anchors.left: parent.left
116+ anchors.leftMargin: units.gu(2)
117+ anchors.right: parent.right
118+ anchors.rightMargin: units.gu(2)
119+ wrapMode: Text.Wrap
120+ horizontalAlignment: Text.AlignHCenter
121+ fontSize: "large"
122+ text: i18n.tr("View all your running tasks.")
123+ }
124+
125+ LocalComponents.Tick {
126+ objectName: "tick"
127+ anchors.bottom: bottomOverlayText.top
128+ anchors.bottomMargin: units.gu(1)
129+ anchors.horizontalCenter: bottomOverlayText.horizontalCenter
130+ onClicked: root.hide()
131+ }
132+
133+ Label {
134+ id: bottomOverlayText
135+ anchors.bottom: parent.bottom
136+ anchors.bottomMargin: units.gu(2)
137+ anchors.left: parent.left
138+ anchors.leftMargin: units.gu(2)
139+ anchors.right: parent.right
140+ anchors.rightMargin: units.gu(2)
141+ wrapMode: Text.Wrap
142+ horizontalAlignment: Text.AlignHCenter
143+ fontSize: "small"
144+ text: i18n.tr("Tap here to continue.")
145+ }
146+ }
147+ ]
148+ }
149+
150+ ListModel {
151+ id: fakeAppManager
152+
153+ readonly property string focusedApplicationId: "facebook"
154+
155+ function focusApplication(appId) {}
156+ function requestFocusApplication(appId) {}
157+ function findApplication(appId) {return null;}
158+
159+ signal applicationAdded(string appId)
160+ signal applicationRemoved(string appId)
161+ signal focusRequested(string appId)
162+
163+ ListElement {
164+ appId: "facebook"
165+ fullscreen: false
166+ name: ""
167+ icon: ""
168+ state: ApplicationInfoInterface.Stopped
169+ splashTitle: ""
170+ splashImage: ""
171+ splashShowHeader: false
172+ splashColor: "transparent"
173+ splashColorHeader: "transparent"
174+ splashColorFooter: "transparent"
175+ defaultScreenshot: "../Tutorial/graphics/facebook.png"
176+ }
177+
178+ ListElement {
179+ appId: "camera"
180+ fullscreen: false
181+ name: ""
182+ icon: ""
183+ state: ApplicationInfoInterface.Stopped
184+ splashTitle: ""
185+ splashImage: ""
186+ splashShowHeader: false
187+ splashColor: "transparent"
188+ splashColorHeader: "transparent"
189+ splashColorFooter: "transparent"
190+ defaultScreenshot: "../Tutorial/graphics/camera.png"
191+ }
192+
193+ ListElement {
194+ appId: "gallery"
195+ fullscreen: false
196+ name: ""
197+ icon: ""
198+ state: ApplicationInfoInterface.Stopped
199+ splashTitle: ""
200+ splashImage: ""
201+ splashShowHeader: false
202+ splashColor: "transparent"
203+ splashColorHeader: "transparent"
204+ splashColorFooter: "transparent"
205+ defaultScreenshot: "../Tutorial/graphics/gallery.png"
206+ }
207+
208+ ListElement {
209+ appId: "dialer"
210+ fullscreen: false
211+ name: ""
212+ icon: ""
213+ state: ApplicationInfoInterface.Stopped
214+ splashTitle: ""
215+ splashImage: ""
216+ splashShowHeader: false
217+ splashColor: "transparent"
218+ splashColorHeader: "transparent"
219+ splashColorFooter: "transparent"
220+ defaultScreenshot: "../Tutorial/graphics/dialer.png"
221+ }
222+ }
223+}
qml/Tutorial/graphics/camera.pngnew file

Binary file not shown.

qml/Tutorial/graphics/dialer.pngnew file

Binary file not shown.

qml/Tutorial/graphics/facebook.pngnew file

Binary file not shown.

qml/Tutorial/graphics/gallery.pngnew file

Binary file not shown.

tests/autopilot/unity8/shell/emulators/tutorial.py+24−4
@@ -35,20 +35,40 @@ class TutorialPage(
3535 @classmethod
3636 def validate_dbus_object(cls, path, state):
3737 name = introspection.get_classname_from_path(path)
38− return name == b'TutorialPage' or name == b'TutorialLeft'
38+ return name in (b'TutorialPage', b'TutorialLeft',
39+ b'TutorialLeftFinish', b'TutorialRight',
40+ b'TutorialBottom', b'TutorialBottomFinish')
3941
4042 @autopilot.logging.log_action(logger.info)
4143 def short_swipe_right(self):
44+ self.shown.wait_for(True)
4245 x, y, width, height = self.globalRect
4346 start_x = x
4447 stop_x = x + width // 3
4548 start_y = stop_y = y + height // 2
4649 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
47− self.shown.wait_for(False)
50+
51+ @autopilot.logging.log_action(logger.info)
52+ def swipe_left(self):
53+ self.shown.wait_for(True)
54+ x, y, width, height = self.globalRect
55+ start_x = width
56+ stop_x = x
57+ start_y = stop_y = y + height // 2
58+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
59+
60+ @autopilot.logging.log_action(logger.info)
61+ def swipe_up(self):
62+ self.shown.wait_for(True)
63+ x, y, width, height = self.globalRect
64+ start_y = height
65+ stop_y = y
66+ start_x = stop_x = x + width // 2
67+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
4868
4969 @autopilot.logging.log_action(logger.info)
5070 def tap(self):
5171 """Tap the tick button to complete this step."""
52− button = self.select_single(objectName="tick")
72+ self.shown.wait_for(True)
73+ button = self.wait_select_single(objectName="tick")
5374 self.pointing_device.click_object(button)
54− self.shown.wait_for(False)
tests/autopilot/unity8/shell/tests/test_tutorial.py+7
@@ -47,4 +47,11 @@ class TutorialTestCase(tests.UnityTestCase):
4747 page.short_swipe_right()
4848 page = self.unity.wait_select_single(objectName='tutorialLeftFinish')
4949 page.tap()
50+ page = self.unity.wait_select_single(objectName='tutorialRight')
51+ page.swipe_left()
52+ page.tap()
53+ page = self.unity.wait_select_single(objectName='tutorialBottom')
54+ page.swipe_up()
55+ page = self.unity.wait_select_single(objectName='tutorialBottomFinish')
56+ page.tap()
5057 self.assertThat(tutorial.running, Eventually(Equals(False)))
tests/qmltests/Tutorial/tst_Tutorial.qml+63−1
@@ -162,7 +162,6 @@ Item {
162162 }
163163
164164 function waitForPage(name) {
165− tryCompareFunction(function() { return findChild(shell, name) !== null; }, true);
166165 waitForRendering(findChild(shell, name));
167166 var page = findChild(shell, name);
168167 tryCompare(page, "shown", true);
@@ -221,6 +220,33 @@ Item {
221220 var tick = findChild(page, "tick");
222221 tap(tick);
223222
223+ page = waitForPage("tutorialRight");
224+ checkTopEdge();
225+ checkLeftEdge();
226+ checkBottomEdge();
227+ if (name === "tutorialRight") return page;
228+ touchFlick(shell, shell.width, halfHeight, halfWidth, halfHeight);
229+ var overlay = findChild(page, "overlay");
230+ tryCompare(overlay, "shown", true);
231+ var tick = findChild(page, "tick");
232+ tap(tick);
233+
234+ var page = waitForPage("tutorialBottom");
235+ checkTopEdge();
236+ checkLeftEdge();
237+ checkRightEdge();
238+ if (name === "tutorialBottom") return page;
239+ touchFlick(shell, halfWidth, shell.height, halfWidth, halfHeight);
240+
241+ var page = waitForPage("tutorialBottomFinish");
242+ checkTopEdge();
243+ checkLeftEdge();
244+ checkRightEdge();
245+ checkBottomEdge();
246+ if (name === "tutorialBottomFinish") return page;
247+ var tick = findChild(page, "tick");
248+ tap(tick);
249+
224250 checkFinished();
225251 return null;
226252 }
@@ -277,6 +303,42 @@ Item {
277303 tryCompare(left, "shown", true); // and we should still be on left
278304 }
279305
306+ function test_spread() {
307+ // Unfortunately, most of what we want to test of the spread is
308+ // "did it render correctly?" but that's hard to test. So instead,
309+ // just poke and prod it a little bit to see if some of the values
310+ // we'd expect to be correct, are so.
311+
312+ var right = goToPage("tutorialRight");
313+ var stage = findChild(right, "stage");
314+ var delegate0 = findChild(right, "appDelegate0");
315+
316+ tryCompare(stage, "dragProgress", 0);
317+ touchFlick(shell, shell.width, halfHeight, shell.width * 0.8, halfHeight, true, false);
318+ verify(stage.dragProgress > 0);
319+ compare(stage.dragProgress, -delegate0.xTranslate);
320+ touchFlick(shell, shell.width * 0.8, halfHeight, shell.width, halfHeight, false, true);
321+ tryCompare(stage, "dragProgress", 0);
322+
323+ tryCompare(delegate0, "x", shell.width);
324+
325+ var screenshotImage = findChild(right, "screenshotImage");
326+ tryCompare(screenshotImage, "source", Qt.resolvedUrl("../../../qml/Tutorial/graphics/facebook.png"));
327+ tryCompare(screenshotImage, "visible", true);
328+ }
329+
330+ function test_bottomShortDrag() {
331+ var bottom = goToPage("tutorialBottom");
332+
333+ touchFlick(shell, halfWidth, shell.height, halfWidth, shell.height * 0.8);
334+
335+ var errorTextLabel = findChild(bottom, "errorTextLabel");
336+ var errorTitleLabel = findChild(bottom, "errorTitleLabel");
337+ tryCompare(bottom, "shown", true); // still on bottom page
338+ tryCompare(errorTextLabel, "opacity", 1); // show error
339+ tryCompare(errorTitleLabel, "opacity", 1); // show error
340+ }
341+
280342 function test_interrupted() {
281343 goToPage("tutorialLeft");
282344 ApplicationManager.startApplication("dialer-app");