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