on xenial help sign in
Add top edge tutorial, though it displays immediately currently
commit5cf8e081320424ab8e12d6cb51088150ebab637a authorMichael Terry <michael.terry@canonical.com> dateWed 23 Sep 2015, 16:49 (11 years ago) parentc87338b
10 files changed+134−34
plugins/AccountsService/AccountsService.qmltypes+5 qml/Tutorial/Tutorial.qml+2−2 qml/Tutorial/TutorialContent.qml+43−19 qml/Tutorial/TutorialLeft.qml+13−3 qml/Tutorial/TutorialPage.qml+12−10 qml/Tutorial/TutorialTop.qml+54 qml/Tutorial/graphics/background.png qml/Tutorial/graphics/background1.png qml/Tutorial/graphics/background2.png tests/mocks/AccountsService/AccountsService.qmltypes+5
plugins/AccountsService/AccountsService.qmltypes+5
@@ -23,6 +23,7 @@ Module {
2323 }
2424 Property { name: "user"; type: "string" }
2525 Property { name: "demoEdges"; type: "bool" }
26+ Property { name: "demoEdgesCompleted"; type: "QStringList"; isReadonly: true }
2627 Property { name: "enableLauncherWhileLocked"; type: "bool"; isReadonly: true }
2728 Property { name: "enableIndicatorsWhileLocked"; type: "bool"; isReadonly: true }
2829 Property { name: "backgroundFile"; type: "string"; isReadonly: true }
@@ -32,5 +33,9 @@ Module {
3233 Property { name: "hereEnabled"; type: "bool" }
3334 Property { name: "hereLicensePath"; type: "string"; isReadonly: true }
3435 Property { name: "hereLicensePathValid"; type: "bool"; isReadonly: true }
36+ Method {
37+ name: "markDemoEdgeCompleted"
38+ Parameter { name: "edge"; type: "string" }
39+ }
3540 }
3641}
qml/Tutorial/Tutorial.qml+2−2
@@ -14,8 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.3
18−import Ubuntu.Components 1.1
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
1919
2020Item {
2121 id: root
qml/Tutorial/TutorialContent.qml+43−19
@@ -14,8 +14,9 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.3
18−import Ubuntu.Components 1.1
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
19+import AccountsService 0.1
1920
2021Item {
2122 id: root
@@ -25,36 +26,22 @@ Item {
2526
2627 readonly property bool launcherEnabled: !running || tutorialLeft.shown
2728 readonly property bool spreadEnabled: !running
28− readonly property bool panelEnabled: !running
29+ readonly property bool panelEnabled: !running || tutorialTop.shown
2930 readonly property bool panelContentEnabled: !running
3031 readonly property alias running: d.running
3132
3233 signal finished()
3334
3435 function finish() {
35− d.stop();
3636 finished();
3737 }
3838
3939 ////
4040
41− Component.onCompleted: {
42− d.start();
43− }
44−
4541 QtObject {
4642 id: d
4743
48− property bool running
49−
50− function stop() {
51− running = false;
52− }
53−
54− function start() {
55− running = true;
56− tutorialLeft.show();
57− }
44+ property bool running: tutorialLeft.shown || tutorialTop.shown
5845 }
5946
6047 TutorialLeft {
@@ -64,6 +51,43 @@ Item {
6451 anchors.fill: parent
6552 launcher: root.launcher
6653
67− onFinished: root.finish()
54+ Component.onCompleted: {
55+ if (AccountsService.demoEdgesCompleted.indexOf("left") == -1) {
56+ show();
57+ }
58+ }
59+
60+ onFinished: {
61+ AccountsService.markDemoEdgeCompleted("left");
62+ }
63+ }
64+
65+ TutorialTop {
66+ id: tutorialTop
67+ objectName: "tutorialTop"
68+ parent: root.panel
69+ anchors.fill: parent
70+ panel: root.panel
71+
72+ Connections {
73+ target: AccountsService
74+ onDemoEdgesCompletedChanged: {
75+ if (AccountsService.demoEdgesCompleted.indexOf("left") != -1 &&
76+ AccountsService.demoEdgesCompleted.indexOf("top") == -1) {
77+ tutorialTopTimer.start();
78+ }
79+ }
80+ }
81+
82+ Timer {
83+ id: tutorialTopTimer
84+ interval: 1
85+ onTriggered: tutorialTop.show()
86+ }
87+
88+ onFinished: {
89+ AccountsService.markDemoEdgeCompleted("top");
90+ root.finish();
91+ }
6892 }
6993}
qml/Tutorial/TutorialLeft.qml+13−3
@@ -14,8 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.3
18−import Ubuntu.Components 1.1
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
1919import "." as LocalComponents
2020
2121TutorialPage {
@@ -33,15 +33,25 @@ TutorialPage {
3333 }
3434 }
3535
36+ background {
37+ sourceSize.height: 1080
38+ sourceSize.width: 1916
39+ source: Qt.resolvedUrl("graphics/background1.png")
40+ mirror: true
41+ }
42+
3643 arrow {
3744 anchors.left: root.left
45+ anchors.leftMargin: units.gu(2)
3846 anchors.verticalCenter: root.verticalCenter
3947 }
4048
4149 label {
42− text: i18n.tr("Short swipe from the left edge to open the launcher")
50+ text: i18n.tr("Swipe from the left edge to open the launcher")
4351 anchors.left: arrow.right
52+ anchors.leftMargin: units.gu(3)
4453 anchors.right: root.right
54+ anchors.rightMargin: units.gu(4)
4555 anchors.verticalCenter: arrow.verticalCenter
4656 }
4757}
qml/Tutorial/TutorialPage.qml+12−10
@@ -14,8 +14,8 @@
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616
17−import QtQuick 2.3
18−import Ubuntu.Components 1.1
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
1919import "../Components"
2020
2121Showable {
@@ -23,7 +23,9 @@ Showable {
2323
2424 property alias arrow: arrow
2525 property alias label: label
26− readonly property real margin: units.gu(2)
26+ property alias background: background
27+ property alias mouseArea: mouseArea
28+ property real opacityOverride: 1
2729
2830 signal finished()
2931
@@ -31,9 +33,12 @@ Showable {
3133
3234 visible: false
3335 shown: false
36+ opacity: Math.min(_showOpacity, opacityOverride)
37+
38+ property real _showOpacity: 0
3439
3540 showAnimation: StandardAnimation {
36− property: "opacity"
41+ property: "_showOpacity"
3742 from: 0
3843 to: 1
3944 duration: UbuntuAnimation.SleepyDuration
@@ -41,7 +46,7 @@ Showable {
4146 }
4247
4348 hideAnimation: StandardAnimation {
44− property: "opacity"
49+ property: "_showOpacity"
4550 to: 0
4651 duration: UbuntuAnimation.BriskDuration
4752 onStopped: {
@@ -53,24 +58,22 @@ Showable {
5358 MouseArea { // eat any errant presses
5459 id: mouseArea
5560 anchors.fill: parent
61+ onClicked: root.hide()
5662 }
5763
5864 Image {
65+ id: background
5966 // Use x/y/height/width instead of anchors so that we don't adjust
6067 // the image if the OSK appears.
6168 x: 0
6269 y: 0
6370 height: root.height
6471 width: root.width
65− sourceSize.height: 1080
66− sourceSize.width: 1916
67− source: Qt.resolvedUrl("graphics/background.png")
6872 fillMode: Image.PreserveAspectCrop
6973 }
7074
7175 Image {
7276 id: arrow
73− anchors.margins: root.margin
7477 width: units.gu(1)
7578 sourceSize.height: 106
7679 sourceSize.width: 34
@@ -80,7 +83,6 @@ Showable {
8083
8184 Label {
8285 id: label
83− anchors.margins: root.margin
8486 fontSize: "large"
8587 font.weight: Font.Light
8688 color: "#333333"
qml/Tutorial/TutorialTop.qmlnew file+54
@@ -0,0 +1,54 @@
1+/*
2+ * Copyright (C) 2014,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.4
18+import Ubuntu.Components 1.3
19+import "." as LocalComponents
20+
21+TutorialPage {
22+ id: root
23+
24+ property var panel
25+
26+ opacityOverride: 1 - panel.indicators.unitProgress
27+ onOpacityOverrideChanged: if (opacityOverride === 0) hide()
28+
29+ mouseArea {
30+ anchors.topMargin: panel.indicators.minimizedPanelHeight
31+ }
32+
33+ background {
34+ sourceSize.height: 1080
35+ sourceSize.width: 1916
36+ source: Qt.resolvedUrl("graphics/background2.png")
37+ }
38+
39+ arrow {
40+ anchors.top: root.top
41+ anchors.topMargin: units.gu(4)
42+ anchors.horizontalCenter: root.horizontalCenter
43+ rotation: 90
44+ }
45+
46+ label {
47+ text: i18n.tr("Swipe from the top edge to open the notification bar")
48+ anchors.top: arrow.bottom
49+ anchors.topMargin: units.gu(3)
50+ anchors.horizontalCenter: root.horizontalCenter
51+ anchors.horizontalCenterOffset: (label.width - label.contentWidth) / 2
52+ width: root.width - units.gu(8)
53+ }
54+}
qml/Tutorial/graphics/background.pngdeleted

Binary file not shown.

qml/Tutorial/graphics/background1.pngnew file

Binary file not shown.

qml/Tutorial/graphics/background2.pngnew file

Binary file not shown.

tests/mocks/AccountsService/AccountsService.qmltypes+5
@@ -23,6 +23,7 @@ Module {
2323 }
2424 Property { name: "user"; type: "string" }
2525 Property { name: "demoEdges"; type: "bool" }
26+ Property { name: "demoEdgesCompleted"; type: "QStringList" }
2627 Property { name: "enableLauncherWhileLocked"; type: "bool" }
2728 Property { name: "enableIndicatorsWhileLocked"; type: "bool" }
2829 Property { name: "backgroundFile"; type: "string" }
@@ -32,5 +33,9 @@ Module {
3233 Property { name: "hereEnabled"; type: "bool" }
3334 Property { name: "hereLicensePath"; type: "string" }
3435 Property { name: "hereLicensePathValid"; type: "bool"; isReadonly: true }
36+ Method {
37+ name: "markDemoEdgeCompleted"
38+ Parameter { name: "edge"; type: "string" }
39+ }
3540 }
3641}