on xenial help sign in
Add top edge tutorial, though it displays immediately currently
5cf8e08Michael Terry
plugins/AccountsService/AccountsService.qmltypes+5
@@ -23,6 +23,7 @@ Module {
23 }
23 }
24 Property { name: "user"; type: "string" }
24 Property { name: "user"; type: "string" }
25 Property { name: "demoEdges"; type: "bool" }
25 Property { name: "demoEdges"; type: "bool" }
26+ Property { name: "demoEdgesCompleted"; type: "QStringList"; isReadonly: true }
26 Property { name: "enableLauncherWhileLocked"; type: "bool"; isReadonly: true }
27 Property { name: "enableLauncherWhileLocked"; type: "bool"; isReadonly: true }
27 Property { name: "enableIndicatorsWhileLocked"; type: "bool"; isReadonly: true }
28 Property { name: "enableIndicatorsWhileLocked"; type: "bool"; isReadonly: true }
28 Property { name: "backgroundFile"; type: "string"; isReadonly: true }
29 Property { name: "backgroundFile"; type: "string"; isReadonly: true }
@@ -32,5 +33,9 @@ Module {
32 Property { name: "hereEnabled"; type: "bool" }
33 Property { name: "hereEnabled"; type: "bool" }
33 Property { name: "hereLicensePath"; type: "string"; isReadonly: true }
34 Property { name: "hereLicensePath"; type: "string"; isReadonly: true }
34 Property { name: "hereLicensePathValid"; type: "bool"; isReadonly: true }
35 Property { name: "hereLicensePathValid"; type: "bool"; isReadonly: true }
36+ Method {
37+ name: "markDemoEdgeCompleted"
38+ Parameter { name: "edge"; type: "string" }
39+ }
35 }
40 }
36}
41}
qml/Tutorial/Tutorial.qml+2−2
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.3
17+import QtQuick 2.4
18−import Ubuntu.Components 1.1
18+import Ubuntu.Components 1.3
19
19
20Item {
20Item {
21 id: root
21 id: root
qml/Tutorial/TutorialContent.qml+43−19
@@ -14,8 +14,9 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.3
17+import QtQuick 2.4
18−import Ubuntu.Components 1.1
18+import Ubuntu.Components 1.3
19+import AccountsService 0.1
19
20
20Item {
21Item {
21 id: root
22 id: root
@@ -25,36 +26,22 @@ Item {
25
26
26 readonly property bool launcherEnabled: !running || tutorialLeft.shown
27 readonly property bool launcherEnabled: !running || tutorialLeft.shown
27 readonly property bool spreadEnabled: !running
28 readonly property bool spreadEnabled: !running
28− readonly property bool panelEnabled: !running
29+ readonly property bool panelEnabled: !running || tutorialTop.shown
29 readonly property bool panelContentEnabled: !running
30 readonly property bool panelContentEnabled: !running
30 readonly property alias running: d.running
31 readonly property alias running: d.running
31
32
32 signal finished()
33 signal finished()
33
34
34 function finish() {
35 function finish() {
35− d.stop();
36 finished();
36 finished();
37 }
37 }
38
38
39 ////
39 ////
40
40
41− Component.onCompleted: {
42− d.start();
43− }
44−
45 QtObject {
41 QtObject {
46 id: d
42 id: d
47
43
48− property bool running
44+ property bool running: tutorialLeft.shown || tutorialTop.shown
49−
50− function stop() {
51− running = false;
52− }
53−
54− function start() {
55− running = true;
56− tutorialLeft.show();
57− }
58 }
45 }
59
46
60 TutorialLeft {
47 TutorialLeft {
@@ -64,6 +51,43 @@ Item {
64 anchors.fill: parent
51 anchors.fill: parent
65 launcher: root.launcher
52 launcher: root.launcher
66
53
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+
67− onFinished: root.finish()
88+ onFinished: {
89+ AccountsService.markDemoEdgeCompleted("top");
90+ root.finish();
91+ }
68 }
92 }
69}
93}
qml/Tutorial/TutorialLeft.qml+13−3
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.3
17+import QtQuick 2.4
18−import Ubuntu.Components 1.1
18+import Ubuntu.Components 1.3
19import "." as LocalComponents
19import "." as LocalComponents
20
20
21TutorialPage {
21TutorialPage {
@@ -33,15 +33,25 @@ TutorialPage {
33 }
33 }
34 }
34 }
35
35
36+ background {
37+ sourceSize.height: 1080
38+ sourceSize.width: 1916
39+ source: Qt.resolvedUrl("graphics/background1.png")
40+ mirror: true
41+ }
42+
36 arrow {
43 arrow {
37 anchors.left: root.left
44 anchors.left: root.left
45+ anchors.leftMargin: units.gu(2)
38 anchors.verticalCenter: root.verticalCenter
46 anchors.verticalCenter: root.verticalCenter
39 }
47 }
40
48
41 label {
49 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")
43 anchors.left: arrow.right
51 anchors.left: arrow.right
52+ anchors.leftMargin: units.gu(3)
44 anchors.right: root.right
53 anchors.right: root.right
54+ anchors.rightMargin: units.gu(4)
45 anchors.verticalCenter: arrow.verticalCenter
55 anchors.verticalCenter: arrow.verticalCenter
46 }
56 }
47}
57}
qml/Tutorial/TutorialPage.qml+12−10
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.3
17+import QtQuick 2.4
18−import Ubuntu.Components 1.1
18+import Ubuntu.Components 1.3
19import "../Components"
19import "../Components"
20
20
21Showable {
21Showable {
@@ -23,7 +23,9 @@ Showable {
23
23
24 property alias arrow: arrow
24 property alias arrow: arrow
25 property alias label: label
25 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
27
29
28 signal finished()
30 signal finished()
29
31
@@ -31,9 +33,12 @@ Showable {
31
33
32 visible: false
34 visible: false
33 shown: false
35 shown: false
36+ opacity: Math.min(_showOpacity, opacityOverride)
37+
38+ property real _showOpacity: 0
34
39
35 showAnimation: StandardAnimation {
40 showAnimation: StandardAnimation {
36− property: "opacity"
41+ property: "_showOpacity"
37 from: 0
42 from: 0
38 to: 1
43 to: 1
39 duration: UbuntuAnimation.SleepyDuration
44 duration: UbuntuAnimation.SleepyDuration
@@ -41,7 +46,7 @@ Showable {
41 }
46 }
42
47
43 hideAnimation: StandardAnimation {
48 hideAnimation: StandardAnimation {
44− property: "opacity"
49+ property: "_showOpacity"
45 to: 0
50 to: 0
46 duration: UbuntuAnimation.BriskDuration
51 duration: UbuntuAnimation.BriskDuration
47 onStopped: {
52 onStopped: {
@@ -53,24 +58,22 @@ Showable {
53 MouseArea { // eat any errant presses
58 MouseArea { // eat any errant presses
54 id: mouseArea
59 id: mouseArea
55 anchors.fill: parent
60 anchors.fill: parent
61+ onClicked: root.hide()
56 }
62 }
57
63
58 Image {
64 Image {
65+ id: background
59 // Use x/y/height/width instead of anchors so that we don't adjust
66 // Use x/y/height/width instead of anchors so that we don't adjust
60 // the image if the OSK appears.
67 // the image if the OSK appears.
61 x: 0
68 x: 0
62 y: 0
69 y: 0
63 height: root.height
70 height: root.height
64 width: root.width
71 width: root.width
65− sourceSize.height: 1080
66− sourceSize.width: 1916
67− source: Qt.resolvedUrl("graphics/background.png")
68 fillMode: Image.PreserveAspectCrop
72 fillMode: Image.PreserveAspectCrop
69 }
73 }
70
74
71 Image {
75 Image {
72 id: arrow
76 id: arrow
73− anchors.margins: root.margin
74 width: units.gu(1)
77 width: units.gu(1)
75 sourceSize.height: 106
78 sourceSize.height: 106
76 sourceSize.width: 34
79 sourceSize.width: 34
@@ -80,7 +83,6 @@ Showable {
80
83
81 Label {
84 Label {
82 id: label
85 id: label
83− anchors.margins: root.margin
84 fontSize: "large"
86 fontSize: "large"
85 font.weight: Font.Light
87 font.weight: Font.Light
86 color: "#333333"
88 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 {
23 }
23 }
24 Property { name: "user"; type: "string" }
24 Property { name: "user"; type: "string" }
25 Property { name: "demoEdges"; type: "bool" }
25 Property { name: "demoEdges"; type: "bool" }
26+ Property { name: "demoEdgesCompleted"; type: "QStringList" }
26 Property { name: "enableLauncherWhileLocked"; type: "bool" }
27 Property { name: "enableLauncherWhileLocked"; type: "bool" }
27 Property { name: "enableIndicatorsWhileLocked"; type: "bool" }
28 Property { name: "enableIndicatorsWhileLocked"; type: "bool" }
28 Property { name: "backgroundFile"; type: "string" }
29 Property { name: "backgroundFile"; type: "string" }
@@ -32,5 +33,9 @@ Module {
32 Property { name: "hereEnabled"; type: "bool" }
33 Property { name: "hereEnabled"; type: "bool" }
33 Property { name: "hereLicensePath"; type: "string" }
34 Property { name: "hereLicensePath"; type: "string" }
34 Property { name: "hereLicensePathValid"; type: "bool"; isReadonly: true }
35 Property { name: "hereLicensePathValid"; type: "bool"; isReadonly: true }
36+ Method {
37+ name: "markDemoEdgeCompleted"
38+ Parameter { name: "edge"; type: "string" }
39+ }
35 }
40 }
36}
41}