2
* Copyright (C) 2013 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/>.
17
import AccountsService 0.1
18
import LightDM 0.1 as LightDM
26
property Item launcher
27
property Item indicators
30
property bool launcherEnabled: true
31
property bool dashEnabled: true
32
property bool panelEnabled: true
34
property bool showEdgeDemo: false
35
property bool showEdgeDemoInGreeter: showEdgeDemo // TODO: AccountsService.getUserProperty("lightdm", "demo-edges")
37
function hideEdgeDemoInShell() {
38
var user = LightDM.Users.data(greeter.currentIndex, LightDM.UserRoles.NameRole);
39
AccountsService.setUserProperty(user, "demo-edges", false);
40
demo.showEdgeDemo = false;
44
function hideEdgeDemoInGreeter() {
45
// TODO: AccountsService.setUserProperty("lightdm", "demo-edges", false);
46
demo.showEdgeDemoInGreeter = false;
49
function hideEdgeDemos() {
50
hideEdgeDemoInGreeter();
51
hideEdgeDemoInShell();
55
launcherEnabled = true;
58
if (d.rightEdgeDemo) d.rightEdgeDemo.destroy()
59
if (d.topEdgeDemo) d.topEdgeDemo.destroy()
60
if (d.bottomEdgeDemo) d.bottomEdgeDemo.destroy()
61
if (d.leftEdgeDemo) d.leftEdgeDemo.destroy()
62
if (d.finalEdgeDemo) d.finalEdgeDemo.destroy()
67
property Component overlay
68
property QtObject rightEdgeDemo
69
property QtObject topEdgeDemo
70
property QtObject bottomEdgeDemo
71
property QtObject leftEdgeDemo
72
property QtObject finalEdgeDemo
75
onShowEdgeDemoInGreeterChanged: {
76
if (!d.overlay && showEdgeDemoInGreeter) {
77
d.overlay = Qt.createComponent("EdgeDemoOverlay.qml")
82
function startRightEdgeDemo() {
83
launcherEnabled = false;
84
demo.dashEnabled = false;
85
demo.panelEnabled = false;
87
d.rightEdgeDemo = d.overlay.createObject(demo.greeter, {
89
"title": i18n.tr("Right edge"),
90
"text": i18n.tr("Try swiping from the right edge to unlock the phone"),
91
"anchors.fill": demo.greeter,
93
d.rightEdgeDemo.onSkip.connect(demo.hideEdgeDemos)
103
if (d.rightEdgeDemo) {
104
d.rightEdgeDemo.hide()
105
hideEdgeDemoInGreeter()
111
onShownChanged: if (!greeter.shown) hide()
114
var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
115
showEdgeDemo = true;///AccountsService.getUserProperty(user, "demo-edges")
119
function startTopEdgeDemo() {
120
demo.panelEnabled = true;
122
d.topEdgeDemo = d.overlay.createObject(demo.dash, {
124
"title": i18n.tr("Top edge"),
125
"text": i18n.tr("Try swiping from the top edge to access the indicators"),
126
"anchors.fill": demo.dash,
128
d.topEdgeDemo.onSkip.connect(demo.hideEdgeDemoInShell)
135
target: demo.indicators
136
onFullyOpenedChanged: {
137
if (d.topEdgeDemo && demo.indicators.fullyOpened) {
138
d.topEdgeDemo.hideNow()
139
startBottomEdgeDemo()
144
function startBottomEdgeDemo() {
145
if (demo.indicators) {
146
d.bottomEdgeDemo = d.overlay.createObject(demo.indicators, {
148
"title": i18n.tr("Close"),
149
"text": i18n.tr("Swipe up again to close the settings screen"),
150
"anchors.fill": demo.indicators,
152
d.bottomEdgeDemo.onSkip.connect(demo.hideEdgeDemoInShell)
159
target: demo.indicators
160
onPartiallyOpenedChanged: {
161
if (d.bottomEdgeDemo && !demo.indicators.partiallyOpened && !demo.indicators.fullyOpened) {
162
d.bottomEdgeDemo.hideNow()
168
function startLeftEdgeDemo() {
169
demo.panelEnabled = false;
170
demo.launcherEnabled = true;
172
d.leftEdgeDemo = d.overlay.createObject(demo.dash, {
174
"title": i18n.tr("Left edge"),
175
"text": i18n.tr("Swipe from the left to reveal the launcher for quick access to apps"),
176
"anchors.fill": demo.dash,
178
d.leftEdgeDemo.onSkip.connect(demo.hideEdgeDemoInShell)
185
target: demo.launcher
187
if (d.leftEdgeDemo && launcher.state == "visible") {
188
d.leftEdgeDemo.hide()
194
function startFinalEdgeDemo() {
195
demo.launcherEnabled = false;
197
d.finalEdgeDemo = d.overlay.createObject(demo.overlay, {
199
"title": i18n.tr("Well done"),
200
"text": i18n.tr("You have now mastered the edge gestures and can start using the phone"),
201
"anchors.fill": demo.overlay,
203
d.finalEdgeDemo.onSkip.connect(demo.hideEdgeDemoInShell)