Unity 8
Tutorial.qml
1 /*
2  * Copyright (C) 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 import AccountsService 0.1
20 
21 /**
22  * This object is always present, so it should be lean and mean. It will
23  * use a Loader to create the heavier tutorial pages if needed.
24  */
25 
26 Item {
27  id: root
28 
29  property alias active: loader.active
30 
31  property Item launcher
32  property Item panel
33  property Item stage
34  property string usageScenario
35  property bool paused
36  property bool keyboardVisible
37  property int lastInputTimestamp
38 
39  readonly property bool launcherEnabled: loader.item ? loader.item.launcherEnabled : true
40  readonly property bool spreadEnabled: loader.item ? loader.item.spreadEnabled : true
41  readonly property bool panelEnabled: loader.item ? loader.item.panelEnabled : true
42  readonly property bool running: loader.item ? loader.item.running : false
43 
44  function finish() {
45  if (loader.item) {
46  loader.item.finish();
47  }
48  }
49 
50  Loader {
51  id: loader
52  anchors.fill: parent
53  source: "TutorialContent.qml"
54  active: AccountsService.demoEdges
55 
56  Binding {
57  target: loader.item
58  property: "launcher"
59  value: root.launcher
60  }
61 
62  Binding {
63  target: loader.item
64  property: "panel"
65  value: root.panel
66  }
67 
68  Binding {
69  target: loader.item
70  property: "stage"
71  value: root.stage
72  }
73 
74  Binding {
75  target: loader.item
76  property: "usageScenario"
77  value: root.usageScenario
78  }
79 
80  Binding {
81  target: loader.item
82  property: "paused"
83  value: root.paused
84  }
85 
86  Binding {
87  target: loader.item
88  property: "keyboardVisible"
89  value: root.keyboardVisible
90  }
91 
92  Binding {
93  target: loader.item
94  property: "lastInputTimestamp"
95  value: root.lastInputTimestamp
96  }
97 
98  Connections {
99  target: loader.item
100  onFinished: AccountsService.demoEdges = false
101  }
102  }
103 }