@@ -20,7 +20,6 @@ import Ubuntu.Application 0.1
2020import Ubuntu.Components 0.1
2121import Ubuntu.Gestures 0.1
2222import LightDM 0.1 as LightDM
23−import AccountsService 0.1
2423import Powerd 0.1
2524import "Dash"
2625import "Greeter"
@@ -60,20 +59,6 @@ FocusScope {
6059 }
6160 }
6261
63− property bool showEdgeDemo: false
64− property bool showEdgeDemoInGreeter: showEdgeDemo // TODO: AccountsService.getUserProperty("lightdm", "demo-edges")
65−
66− function hideEdgeDemo() {
67− var user = LightDM.Users.data(greeter.currentIndex, LightDM.UserRoles.NameRole);
68− AccountsService.setUserProperty(user, "demo-edges", false);
69− shell.showEdgeDemo = false;
70− }
71−
72− function hideEdgeDemoInGreeter() {
73− // TODO: AccountsService.setUserProperty("lightdm", "demo-edges", false);
74− shell.showEdgeDemoInGreeter = false;
75− }
76−
7762 property ListModel searchHistory: SearchHistoryModel {}
7863
7964 property var applicationManager: ApplicationManagerWrapper {}
@@ -206,7 +191,7 @@ FocusScope {
206191 available: !greeter.shown && !lockscreen.shown
207192 hides: [stages, launcher, panel.indicators]
208193 shown: disappearingAnimationProgress !== 1.0
209− enabled: disappearingAnimationProgress === 0.0 && !leftEdgeDemo.active && !topEdgeDemo.active && !finalEdgeDemo.active
194+ enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
210195 // FIXME: unfocus all applications when going back to the dash
211196 onEnabledChanged: {
212197 if (enabled) {
@@ -233,50 +218,6 @@ FocusScope {
233218 // greeterRevealer.animatedProgress are not animated
234219 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
235220 }
236−
237− DemoOverlay {
238− id: topEdgeDemo
239−
240− edge: "top"
241− title: i18n.tr("Top edge")
242− text: i18n.tr("Try swiping from the top edge to access the indicators")
243− anchors.fill: dash
244− visible: false
245− available: shell.showEdgeDemo
246− onSkip: shell.hideEdgeDemo()
247−
248− Connections {
249− target: greeter
250− onShownChanged: if (!greeter.shown) topEdgeDemo.show()
251− }
252−
253− Connections {
254− target: panel.indicators
255− onFullyOpenedChanged: if (panel.indicators.fullyOpened) topEdgeDemo.hideNow()
256− }
257− }
258−
259− DemoOverlay {
260− id: leftEdgeDemo
261−
262− edge: "left"
263− title: i18n.tr("Left edge")
264− text: i18n.tr("Swipe from the left to reveal the launcher for quick access to apps")
265− anchors.fill: dash
266− visible: false
267− available: shell.showEdgeDemo
268− onSkip: shell.hideEdgeDemo()
269−
270− Connections {
271− target: bottomEdgeDemo
272− onActiveChanged: if (!bottomEdgeDemo.active) leftEdgeDemo.show()
273− }
274−
275− Connections {
276− target: launcher
277− onStateChanged: if (launcher.state == "visible") leftEdgeDemo.hide()
278− }
279− }
280221 }
281222
282223 Item {
@@ -519,45 +460,12 @@ FocusScope {
519460 }
520461
521462 onUnlocked: greeter.hide()
522− onSelected: {
523− // Update edge demo hint
524− var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
525− shell.showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
526− }
527463
528464 onLeftTeaserPressedChanged: {
529465 if (leftTeaserPressed) {
530466 launcher.tease();
531467 }
532468 }
533−
534− DemoOverlay {
535− id: rightEdgeDemo
536−
537− edge: "right"
538− title: i18n.tr("Right edge")
539− text: i18n.tr("Try swiping from the right edge to unlock the phone")
540− anchors.fill: parent
541− visible: shell.showEdgeDemoInGreeter
542− onSkip: {
543− shell.hideEdgeDemoInGreeter()
544− shell.hideEdgeDemo()
545− }
546−
547− Connections {
548− target: greeter
549−
550− function hide() {
551− if (rightEdgeDemo.active) {
552− rightEdgeDemo.hide()
553− shell.hideEdgeDemoInGreeter()
554− }
555− }
556−
557− onUnlocked: hide()
558− onShownChanged: if (!greeter.shown) hide()
559− }
560− }
561469 }
562470
563471 InputFilterArea {
@@ -614,7 +522,7 @@ FocusScope {
614522 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
615523 indicators {
616524 hides: [launcher]
617− available: !rightEdgeDemo.active && !leftEdgeDemo.active && !finalEdgeDemo.active
525+ available: edgeDemo.panelEnabled
618526 }
619527 fullscreenMode: shell.fullscreenMode
620528 searchVisible: !greeter.shown && !lockscreen.shown
@@ -623,24 +531,6 @@ FocusScope {
623531 anchors.fill: parent
624532 blockInput: panel.indicators.shown
625533 }
626−
627− DemoOverlay {
628− id: bottomEdgeDemo
629−
630− edge: "bottom"
631− title: i18n.tr("Close")
632− text: i18n.tr("Swipe up again to close the settings screen")
633− anchors.fill: panel.indicators
634− visible: false
635− available: shell.showEdgeDemo
636− onSkip: shell.hideEdgeDemo()
637−
638− Connections {
639− target: panel.indicators
640− onFullyOpenedChanged: if (panel.indicators.fullyOpened) bottomEdgeDemo.show()
641− onPartiallyOpenedChanged: if (!panel.indicators.partiallyOpened && !panel.indicators.fullyOpened) bottomEdgeDemo.hideNow()
642− }
643− }
644534 }
645535
646536 Hud {
@@ -649,7 +539,7 @@ FocusScope {
649539 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
650540 height: parent.height
651541
652− available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && !topEdgeDemo.active
542+ available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
653543 shown: false
654544 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
655545 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
@@ -707,7 +597,7 @@ FocusScope {
707597 anchors.bottom: parent.bottom
708598 width: parent.width
709599 dragAreaWidth: shell.edgeSize
710− available: (!greeter.shown || greeter.narrowMode) && !rightEdgeDemo.active && !topEdgeDemo.active && !bottomEdgeDemo.active && !finalEdgeDemo.active
600+ available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
711601 onDashItemSelected: {
712602 greeter.hide()
713603 // Animate if moving between application and dash
@@ -765,29 +655,6 @@ FocusScope {
765655 }
766656 }
767657
768− DemoOverlay {
769− id: finalEdgeDemo
770−
771− edge: "none"
772− title: i18n.tr("Well done")
773− text: i18n.tr("You have now mastered the edge gestures and can start using the phone")
774− skipText: i18n.tr("Finish")
775− anchors.fill: overlay
776− visible: false
777− available: shell.showEdgeDemo
778− onSkip: shell.hideEdgeDemo()
779−
780− Connections {
781− target: leftEdgeDemo
782− onShownChanged: {
783− if (leftEdgeDemo.active && !leftEdgeDemo.shown) {
784− finalEdgeDemo.show();
785− launcher.hide();
786− }
787− }
788− }
789− }
790−
791658 focus: true
792659
793660 InputFilterArea {
@@ -839,4 +706,13 @@ FocusScope {
839706 rotation: -45
840707 scale: Math.min(parent.width, parent.height) / width
841708 }
709+
710+ EdgeDemo {
711+ id: edgeDemo
712+ greeter: greeter
713+ launcher: launcher
714+ dash: dash
715+ indicators: panel.indicators
716+ overlay: overlay
717+ }
842718}