on 2cbfe46 help sign in
unity8/qml/Tutorial/TutorialContent.qml
125 lines 3.2 kB history raw
1/*
2 * Copyright (C) 2013,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 */
17import QtQuick 2.3
18import Ubuntu.Components 1.1
20Item {
21 id: root
23 property Item launcher
24 property Item panel
26 readonly property bool launcherEnabled: !running ||
27 (!paused && tutorialLeft.shown)
28 readonly property bool spreadEnabled: !running
29 readonly property bool panelEnabled: !running
30 readonly property bool panelContentEnabled: !running
31 readonly property alias running: d.running
33 property bool paused: false
34 property real edgeSize
35 property bool useEdgeDragArea
37 signal finished()
39 function finish() {
40 d.stop();
41 finished();
42 }
44 ////
46 Component.onCompleted: {
47 d.start();
48 }
50 QtObject {
51 id: d
53 property bool running
55 function stop() {
56 running = false;
57 }
59 function start() {
60 running = true;
61 tutorialLeft.show();
62 }
63 }
65 TutorialLeft {
66 id: tutorialLeft
67 objectName: "tutorialLeft"
68 anchors.fill: parent
69 launcher: root.launcher
70 paused: !shown || root.paused
72 onFinished: tutorialLeftFinish.show()
73 }
75 TutorialLeftFinish {
76 id: tutorialLeftFinish
77 objectName: "tutorialLeftFinish"
78 anchors.fill: parent
79 textXOffset: root.launcher.panelWidth
80 paused: !shown || root.paused
81 text: root.useEdgeDragArea ? i18n.tr("Tap here to continue.") : i18n.tr("Click here to finish.")
83 onFinished: {
84 root.launcher.hide();
85 if (root.useEdgeDragArea) {
86 tutorialRight.show();
87 } else {
88 // Last two screens use EdgeDragArea (right edge spread and
89 // bottom edge). So just end tutorial here.
90 root.finish();
91 }
92 }
93 }
95 TutorialRight {
96 id: tutorialRight
97 objectName: "tutorialRight"
98 anchors.fill: parent
99 edgeSize: root.edgeSize
100 panel: root.panel
101 paused: !shown || root.paused
103 onFinished: tutorialBottom.show()
104 }
106 TutorialBottom {
107 id: tutorialBottom
108 objectName: "tutorialBottom"
109 anchors.fill: parent
110 edgeSize: root.edgeSize
111 paused: !shown || root.paused
113 onFinished: tutorialBottomFinish.show()
114 }
116 TutorialBottomFinish {
117 id: tutorialBottomFinish
118 objectName: "tutorialBottomFinish"
119 anchors.fill: parent
120 backgroundFadesOut: true
121 paused: !shown || root.paused
123 onFinished: root.finish()
124 }