Lomiri
Loading...
Searching...
No Matches
Tutorial.qml
1/*
2 * Copyright (C) 2014-2016 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
17import QtQuick 2.12
18import Lomiri.Components 1.3
19import 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
26Item {
27 id: root
28
29 readonly 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 // hide any existing tutorial and don't show new ones
36 property bool delayed // don't show new tutorials
37 property int lastInputTimestamp
38
39 readonly property bool demonstrateLauncher: loader.item ? loader.item.demonstrateLauncher : false
40 readonly property bool launcherEnabled: loader.item ? loader.item.launcherEnabled : true
41 readonly property bool launcherLongSwipeEnabled: loader.item ? loader.item.launcherLongSwipeEnabled : true
42 readonly property bool spreadEnabled: loader.item ? loader.item.spreadEnabled : true
43 readonly property bool panelEnabled: loader.item ? loader.item.panelEnabled : true
44 readonly property bool running: loader.item ? loader.item.running : false
45
46 function finish() {
47 if (loader.item) {
48 loader.item.finish();
49 }
50 }
51
52 Loader {
53 id: loader
54 anchors.fill: parent
55 source: "TutorialContent.qml"
56 active: AccountsService.demoEdges
57
58 Binding {
59 target: loader.item
60 property: "launcher"
61 value: root.launcher
62 }
63
64 Binding {
65 target: loader.item
66 property: "panel"
67 value: root.panel
68 }
69
70 Binding {
71 target: loader.item
72 property: "stage"
73 value: root.stage
74 }
75
76 Binding {
77 target: loader.item
78 property: "usageScenario"
79 value: root.usageScenario
80 }
81
82 Binding {
83 target: loader.item
84 property: "paused"
85 value: root.paused
86 }
87
88 Binding {
89 target: loader.item
90 property: "delayed"
91 value: root.delayed
92 }
93
94 Binding {
95 target: loader.item
96 property: "lastInputTimestamp"
97 value: root.lastInputTimestamp
98 }
99
100 Connections {
101 target: loader.item
102 onFinished: AccountsService.demoEdges = false
103 }
104 }
105}