Unity 8
TutorialContent.qml
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  */
16 
17 import QtQuick 2.4
18 import Ubuntu.Components 1.3
19 
20 Item {
21  id: root
22 
23  property Item launcher
24  property Item panel
25 
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
32 
33  property bool paused: false
34  property real edgeSize
35 
36  signal finished()
37 
38  function finish() {
39  d.stop();
40  finished();
41  }
42 
43  ////
44 
45  Component.onCompleted: {
46  d.start();
47  }
48 
49  QtObject {
50  id: d
51 
52  property bool running
53 
54  function stop() {
55  running = false;
56  }
57 
58  function start() {
59  running = true;
60  tutorialLeft.show();
61  }
62  }
63 
64  TutorialLeft {
65  id: tutorialLeft
66  objectName: "tutorialLeft"
67  anchors.fill: parent
68  launcher: root.launcher
69  paused: !shown || root.paused
70 
71  onFinished: tutorialLeftFinish.show()
72  }
73 
74  TutorialLeftFinish {
75  id: tutorialLeftFinish
76  objectName: "tutorialLeftFinish"
77  anchors.fill: parent
78  textXOffset: root.launcher.panelWidth
79  paused: !shown || root.paused
80  text: i18n.tr("Tap here to continue.")
81 
82  onFinished: {
83  root.launcher.hide();
84  tutorialRight.show();
85  }
86  }
87 
88  TutorialRight {
89  id: tutorialRight
90  objectName: "tutorialRight"
91  anchors.fill: parent
92  edgeSize: root.edgeSize
93  panel: root.panel
94  paused: !shown || root.paused
95 
96  onFinished: tutorialBottom.show()
97  }
98 
99  TutorialBottom {
100  id: tutorialBottom
101  objectName: "tutorialBottom"
102  anchors.fill: parent
103  edgeSize: root.edgeSize
104  paused: !shown || root.paused
105 
106  onFinished: tutorialBottomFinish.show()
107  }
108 
109  TutorialBottomFinish {
110  id: tutorialBottomFinish
111  objectName: "tutorialBottomFinish"
112  anchors.fill: parent
113  backgroundFadesOut: true
114  paused: !shown || root.paused
115 
116  onFinished: root.finish()
117  }
118 }