on xenial help sign in
Streamline visible/enable handling by introducing readonly active property of DemoOverlay
4a11c1fMichael Terry
Components/DemoOverlay.qml+9−4
@@ -38,10 +38,15 @@ Item {
38 property string text
38 property string text
39
39
40 /*
40 /*
41− * Whether this demo is even enabled at all.
41+ * Whether this demo is allowed to run.
42 */
42 */
43 property bool enabled: true
43 property bool enabled: true
44
44
45+ /*
46+ * Whether this demo is running currently.
47+ */
48+ readonly property bool active: enabled && visible
49+
45 property color __orange: Qt.hsla(16.0/360.0, 0.83, 0.47, 1.0)
50 property color __orange: Qt.hsla(16.0/360.0, 0.83, 0.47, 1.0)
46 property color __orange_transparent: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4)
51 property color __orange_transparent: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4)
47 property int __edge_margin: units.gu(4)
52 property int __edge_margin: units.gu(4)
@@ -55,7 +60,7 @@ Item {
55 anchors.fill: parent
60 anchors.fill: parent
56 color: "black"
61 color: "black"
57 opacity: 0.8
62 opacity: 0.8
58− visible: overlay.enabled
63+ visible: overlay.active
59 }
64 }
60
65
61 Item {
66 Item {
@@ -64,7 +69,7 @@ Item {
64 y: 0
69 y: 0
65 width: parent.width
70 width: parent.width
66 height: parent.height
71 height: parent.height
67− visible: overlay.enabled
72+ visible: overlay.active
68
73
69 Column {
74 Column {
70 id: labelGroup
75 id: labelGroup
@@ -153,7 +158,7 @@ Item {
153
158
154 SequentialAnimation {
159 SequentialAnimation {
155 id: wholeAnimation
160 id: wholeAnimation
156− running: overlay.visible && overlay.enabled
161+ running: overlay.active
157
162
158 ParallelAnimation {
163 ParallelAnimation {
159 id: fadeInAnimation
164 id: fadeInAnimation
Shell.qml+15−16
@@ -179,7 +179,7 @@ FocusScope {
179 available: !greeter.shown && !lockscreen.shown
179 available: !greeter.shown && !lockscreen.shown
180 hides: [stages, launcher, panel.indicators]
180 hides: [stages, launcher, panel.indicators]
181 shown: disappearingAnimationProgress !== 1.0
181 shown: disappearingAnimationProgress !== 1.0
182− enabled: disappearingAnimationProgress === 0.0 && !leftEdgeDemo.visible && !topEdgeDemo.visible
182+ enabled: disappearingAnimationProgress === 0.0 && !leftEdgeDemo.active && !topEdgeDemo.active
183 // FIXME: unfocus all applications when going back to the dash
183 // FIXME: unfocus all applications when going back to the dash
184 onEnabledChanged: {
184 onEnabledChanged: {
185 if (enabled) {
185 if (enabled) {
@@ -220,12 +220,12 @@ FocusScope {
220
220
221 Connections {
221 Connections {
222 target: greeter
222 target: greeter
223− onShownChanged: if (topEdgeDemo.enabled && !greeter.shown) topEdgeDemo.visible = true
223+ onShownChanged: if (!greeter.shown) topEdgeDemo.visible = true
224 }
224 }
225
225
226 Connections {
226 Connections {
227 target: panel.indicators
227 target: panel.indicators
228− onFullyOpenedChanged: if (topEdgeDemo.enabled && panel.indicators.fullyOpened) topEdgeDemo.visible = false
228+ onFullyOpenedChanged: if (panel.indicators.fullyOpened) topEdgeDemo.enabled = false
229 }
229 }
230 }
230 }
231
231
@@ -242,14 +242,14 @@ FocusScope {
242
242
243 Connections {
243 Connections {
244 target: bottomEdgeDemo
244 target: bottomEdgeDemo
245− onVisibleChanged: if (leftEdgeDemo.enabled && !bottomEdgeDemo.visible) leftEdgeDemo.visible = true
245+ onActiveChanged: if (!bottomEdgeDemo.active) leftEdgeDemo.visible = true
246 }
246 }
247
247
248 Connections {
248 Connections {
249 target: launcher
249 target: launcher
250 onProgressChanged: {
250 onProgressChanged: {
251− if (leftEdgeDemo.enabled && launcher.progress >= 1.0) {
251+ if (leftEdgeDemo.active && launcher.progress >= 1.0) {
252− leftEdgeDemo.visible = false;
252+ leftEdgeDemo.enabled = false;
253 shell.hideEdgeDemo();
253 shell.hideEdgeDemo();
254 }
254 }
255 }
255 }
@@ -521,7 +521,7 @@ FocusScope {
521 shell.background = bgPath ? bgPath : default_background
521 shell.background = bgPath ? bgPath : default_background
522 // Update edge demo hint
522 // Update edge demo hint
523 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
523 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
524− shell.showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
524+ //shell.showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
525 }
525 }
526
526
527 onLeftTeaserPressedChanged: {
527 onLeftTeaserPressedChanged: {
@@ -538,7 +538,6 @@ FocusScope {
538 text: i18n.tr("Try swiping from the right edge to unlock the phone")
538 text: i18n.tr("Try swiping from the right edge to unlock the phone")
539 anchors.fill: parent
539 anchors.fill: parent
540 visible: shell.showEdgeDemoInGreeter
540 visible: shell.showEdgeDemoInGreeter
541− enabled: shell.showEdgeDemoInGreeter
542 onSkip: {
541 onSkip: {
543 shell.hideEdgeDemoInGreeter()
542 shell.hideEdgeDemoInGreeter()
544 shell.hideEdgeDemo()
543 shell.hideEdgeDemo()
@@ -546,10 +545,10 @@ FocusScope {
546
545
547 Connections {
546 Connections {
548 target: greeter
547 target: greeter
549− onUnlocked: if (rightEdgeDemo.enabled) rightEdgeDemo.visible = false
548+ onUnlocked: rightEdgeDemo.visible = false
550 onShownChanged: {
549 onShownChanged: {
551− if (rightEdgeDemo.enabled && !greeter.shown) {
550+ if (rightEdgeDemo.active && !greeter.shown) {
552− rightEdgeDemo.visible = false
551+ rightEdgeDemo.enabled = false
553 shell.hideEdgeDemoInGreeter()
552 shell.hideEdgeDemoInGreeter()
554 }
553 }
555 }
554 }
@@ -573,7 +572,7 @@ FocusScope {
573 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
572 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
574 indicators {
573 indicators {
575 hides: [launcher]
574 hides: [launcher]
576− available: !rightEdgeDemo.visible && !leftEdgeDemo.visible
575+ available: !rightEdgeDemo.active && !leftEdgeDemo.active
577 }
576 }
578 fullscreenMode: shell.fullscreenMode
577 fullscreenMode: shell.fullscreenMode
579 searchVisible: !greeter.shown && !lockscreen.shown
578 searchVisible: !greeter.shown && !lockscreen.shown
@@ -596,8 +595,8 @@ FocusScope {
596
595
597 Connections {
596 Connections {
598 target: panel.indicators
597 target: panel.indicators
599− onFullyOpenedChanged: if (bottomEdgeDemo.enabled && panel.indicators.fullyOpened) bottomEdgeDemo.visible = true
598+ onFullyOpenedChanged: if (panel.indicators.fullyOpened) bottomEdgeDemo.visible = true
600− onPartiallyOpenedChanged: if (bottomEdgeDemo.enabled && !panel.indicators.partiallyOpened && !panel.indicators.fullyOpened) bottomEdgeDemo.visible = false
599+ onPartiallyOpenedChanged: if (!panel.indicators.partiallyOpened && !panel.indicators.fullyOpened) bottomEdgeDemo.enabled = false
601 }
600 }
602 }
601 }
603 }
602 }
@@ -608,7 +607,7 @@ FocusScope {
608 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
607 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
609 height: parent.height
608 height: parent.height
610
609
611− available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && !topEdgeDemo.visible
610+ available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && !topEdgeDemo.active
612 shown: false
611 shown: false
613 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
612 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
614 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
613 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
@@ -666,7 +665,7 @@ FocusScope {
666 anchors.bottom: parent.bottom
665 anchors.bottom: parent.bottom
667 width: parent.width
666 width: parent.width
668 dragAreaWidth: shell.edgeSize
667 dragAreaWidth: shell.edgeSize
669− available: !greeter.locked && !rightEdgeDemo.visible && !topEdgeDemo.visible && !bottomEdgeDemo.visible
668+ available: !greeter.locked && !rightEdgeDemo.active && !topEdgeDemo.active && !bottomEdgeDemo.active
670 onDashItemSelected: {
669 onDashItemSelected: {
671 greeter.hide()
670 greeter.hide()
672 // Animate if moving between application and dash
671 // Animate if moving between application and dash