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 
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  property bool useEdgeDragArea
36 
37  signal finished()
38 
39  function finish() {
40  d.stop();
41  finished();
42  }
43 
44  ////
45 
46  Component.onCompleted: {
47  d.start();
48  }
49 
50  QtObject {
51  id: d
52 
53  property bool running
54 
55  function stop() {
56  running = false;
57  }
58 
59  function start() {
60  running = true;
61  tutorialLeft.show();
62  }
63  }
64 
65  TutorialLeft {
66  id: tutorialLeft
67  objectName: "tutorialLeft"
68  anchors.fill: parent
69  launcher: root.launcher
70  paused: !shown || root.paused
71 
72  onFinished: tutorialLeftFinish.show()
73  }
74 
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.")
82 
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  }
94 
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
102 
103  onFinished: tutorialBottom.show()
104  }
105 
106  TutorialBottom {
107  id: tutorialBottom
108  objectName: "tutorialBottom"
109  anchors.fill: parent
110  edgeSize: root.edgeSize
111  paused: !shown || root.paused
112 
113  onFinished: tutorialBottomFinish.show()
114  }
115 
116  TutorialBottomFinish {
117  id: tutorialBottomFinish
118  objectName: "tutorialBottomFinish"
119  anchors.fill: parent
120  backgroundFadesOut: true
121  paused: !shown || root.paused
122 
123  onFinished: root.finish()
124  }
125 }