2 * Copyright (C) 2013,2014 Canonical, Ltd.
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.
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.
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/>.
18import Ubuntu.Components 1.3
19import AccountsService 0.1
20import Unity.Application 0.1
25 property Item launcher
28 property string usageScenario
30 property bool keyboardVisible
31 property var lastInputTimestamp
33 readonly property bool launcherEnabled: !running || tutorialLeftLoader.shown
34 readonly property bool spreadEnabled: !running || tutorialRightLoader.shown
35 readonly property bool panelEnabled: !running || tutorialTopLoader.shown
36 readonly property bool running: tutorialLeftLoader.shown
37 || tutorialTopLoader.shown
38 || tutorialRightLoader.shown
39 || tutorialBottomLoader.shown
52 // We allow "" because it is briefly empty on startup, and we don't
53 // want to improperly skip any mobile tutorials.
54 property bool mobileScenario: root.usageScenario === "" ||
55 root.usageScenario === "phone" ||
56 root.usageScenario === "tablet"
58 property var focusedApp: ApplicationManager.focusedApplicationId
59 ? ApplicationManager.findApplication(ApplicationManager.focusedApplicationId)
62 function haveShown(tutorialId) {
63 return AccountsService.demoEdgesCompleted.indexOf(tutorialId) != -1;
66 property bool endPointsFinished: tutorialRightLoader.skipped &&
67 tutorialBottomLoader.skipped
68 onEndPointsFinishedChanged: if (endPointsFinished) root.finish()
72 id: tutorialLeftLoader
73 objectName: "tutorialLeftLoader"
76 readonly property bool skipped: !d.mobileScenario || d.haveShown("left")
77 readonly property bool shown: item && item.shown
78 active: !skipped || (item && item.visible)
79 onSkippedChanged: if (skipped && shown) item.hide()
81 sourceComponent: TutorialLeft {
83 objectName: "tutorialLeft"
85 launcher: root.launcher
86 hides: [launcher, panel.indicators]
89 isReady: !tutorialLeftLoader.skipped && !paused && !keyboardVisible
91 // Use an idle timer here, because when constructed, all our isReady variables will be false.
92 // Qml needs a moment to copy their values from Tutorial.qml. So we idle it and recheck.
96 onTriggered: if (tutorialLeft.isReady && !tutorialLeft.shown) tutorialLeft.show()
99 onIsReadyChanged: if (isReady && !shown) tutorialLeftTimer.start()
100 onFinished: AccountsService.markDemoEdgeCompleted("left")
105 id: tutorialTopLoader
106 objectName: "tutorialTopLoader"
109 readonly property bool skipped: !d.mobileScenario || d.haveShown("top")
110 readonly property bool shown: item && item.shown
111 active: !skipped || (item && item.visible)
112 onSkippedChanged: if (skipped && shown) item.hide()
114 sourceComponent: TutorialTop {
116 objectName: "tutorialTop"
119 hides: [launcher, panel.indicators]
122 isReady: tutorialLeftLoader.skipped && !tutorialTopLoader.skipped &&
123 !paused && !keyboardVisible &&
124 !tutorialBottomLoader.shown && !tutorialBottomLoader.mightShow
126 // We fire 30s after left edge tutorial, with at least 3s of inactivity
129 id: tutorialTopInactivityTimer
130 lastInputTimestamp: root.lastInputTimestamp
136 objectName: "tutorialTopTimer"
138 onTriggered: tutorialTopInactivityTimer.start()
141 onIsReadyChanged: if (isReady && !shown) tutorialTopTimer.start()
142 onFinished: AccountsService.markDemoEdgeCompleted("top")
147 id: tutorialRightLoader
148 objectName: "tutorialRightLoader"
151 readonly property bool skipped: d.haveShown("right")
152 readonly property bool shown: item && item.shown
153 active: !skipped || (item && item.visible)
154 onSkippedChanged: if (skipped && shown) item.hide()
156 sourceComponent: TutorialRight {
158 objectName: "tutorialRight"
161 usageScenario: root.usageScenario
162 hides: [launcher, panel.indicators]
165 isReady: tutorialTopLoader.skipped && !tutorialRightLoader.skipped &&
166 !paused && !keyboardVisible &&
167 !tutorialBottomLoader.shown && !tutorialBottomLoader.mightShow &&
168 ApplicationManager.count >= 3
171 id: tutorialRightInactivityTimer
172 objectName: "tutorialRightInactivityTimer"
173 lastInputTimestamp: root.lastInputTimestamp
179 onFocusedAppChanged: {
180 if (tutorialRight.isReady && !tutorialRight.shown && d.focusedApp
181 && d.focusedApp.state === ApplicationInfoInterface.Starting) {
182 tutorialRight.show();
187 onIsReadyChanged: if (isReady && !shown) tutorialRightInactivityTimer.start()
188 onFinished: AccountsService.markDemoEdgeCompleted("right")
193 id: tutorialBottomLoader
194 objectName: "tutorialBottomLoader"
197 // See TutorialBottom.qml for an explanation of why we only support
199 readonly property var supportedApps: ["address-book-app",
200 "com.ubuntu.calculator_calculator",
203 readonly property bool skipped: {
204 if (!d.mobileScenario) {
207 for (var i = 0; i < supportedApps.length; i++) {
208 if (!d.haveShown("bottom-" + supportedApps[i])) {
214 readonly property bool shown: item && item.shown
215 readonly property bool haveShownFocusedApp: d.focusedApp &&
216 d.haveShown("bottom-" + d.focusedApp.appId)
217 readonly property bool mightShow: !skipped && d.focusedApp &&
218 supportedApps.indexOf(d.focusedApp.appId) !== -1 &&
220 active: !skipped || (item && item.visible)
221 onHaveShownFocusedAppChanged: if (haveShownFocusedApp && shown) hide()
222 onSkippedChanged: if (skipped && shown) item.hide()
224 sourceComponent: TutorialBottom {
226 objectName: "tutorialBottom"
228 hides: [launcher, panel.indicators]
230 usageScenario: root.usageScenario
232 application: d.focusedApp
234 isReady: !tutorialBottomLoader.skipped && !paused && !keyboardVisible &&
235 !tutorialTopLoader.shown && !tutorialRightLoader.shown &&
236 tutorialBottomLoader.mightShow &&
237 d.focusedApp.state === ApplicationInfoInterface.Running
239 onIsReadyChanged: if (isReady && !shown) show()
240 onFinished: AccountsService.markDemoEdgeCompleted("bottom-" + d.focusedApp.appId)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list