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.3
18 import Ubuntu.Components 1.1
19 
20 Item {
21  id: root
22 
23  property Item launcher
24  property Item panel
25  property Item stages
26  property Item overlay
27 
28  readonly property bool launcherEnabled: !running ||
29  (!paused && tutorialLeft.shown)
30  readonly property bool spreadEnabled: !running
31  readonly property bool panelEnabled: !running
32  readonly property bool panelContentEnabled: !running
33  readonly property alias running: d.running
34 
35  property bool paused: false
36  property real edgeSize
37 
38  signal finished()
39 
40  function finish() {
41  d.stop();
42  finished();
43  }
44 
45  ////
46 
47  Component.onCompleted: {
48  d.start();
49  }
50 
51  QtObject {
52  id: d
53 
54  property bool running
55 
56  function stop() {
57  running = false;
58  }
59 
60  function start() {
61  running = true;
62  tutorialLeft.show();
63  }
64  }
65 
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
73 
74  onFinished: tutorialLeftFinish.show()
75  }
76 
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();
88  }
89  }
90 
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
99 
100  onFinished: tutorialBottom.show()
101  }
102 
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
110 
111  onFinished: tutorialBottomFinish.show()
112  }
113 
114  TutorialBottomFinish {
115  id: tutorialBottomFinish
116  objectName: "tutorialBottomFinish"
117  parent: root.stages
118  anchors.fill: parent
119  backgroundFadesOut: true
120  paused: !shown || root.paused
121 
122  onFinished: root.finish()
123  }
124 }