on xenial help sign in
Streamline visible/enable handling by introducing readonly active property of DemoOverlay
commit4a11c1f329c14a11e75d72c97fb4f4c921f0c53f authorMichael Terry <michael.terry@canonical.com> dateFri 2 Aug 2013, 16:28 (13 years ago) parentd08666f
2 files changed+24−20
Components/DemoOverlay.qml+9−4 Shell.qml+15−16
Components/DemoOverlay.qml+9−4
@@ -38,10 +38,15 @@ Item {
3838 property string text
3939
4040 /*
41− * Whether this demo is even enabled at all.
41+ * Whether this demo is allowed to run.
4242 */
4343 property bool enabled: true
4444
45+ /*
46+ * Whether this demo is running currently.
47+ */
48+ readonly property bool active: enabled && visible
49+
4550 property color __orange: Qt.hsla(16.0/360.0, 0.83, 0.47, 1.0)
4651 property color __orange_transparent: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4)
4752 property int __edge_margin: units.gu(4)
@@ -55,7 +60,7 @@ Item {
5560 anchors.fill: parent
5661 color: "black"
5762 opacity: 0.8
58− visible: overlay.enabled
63+ visible: overlay.active
5964 }
6065
6166 Item {
@@ -64,7 +69,7 @@ Item {
6469 y: 0
6570 width: parent.width
6671 height: parent.height
67− visible: overlay.enabled
72+ visible: overlay.active
6873
6974 Column {
7075 id: labelGroup
@@ -153,7 +158,7 @@ Item {
153158
154159 SequentialAnimation {
155160 id: wholeAnimation
156− running: overlay.visible && overlay.enabled
161+ running: overlay.active
157162
158163 ParallelAnimation {
159164 id: fadeInAnimation
Shell.qml+15−16
@@ -179,7 +179,7 @@ FocusScope {
179179 available: !greeter.shown && !lockscreen.shown
180180 hides: [stages, launcher, panel.indicators]
181181 shown: disappearingAnimationProgress !== 1.0
182− enabled: disappearingAnimationProgress === 0.0 && !leftEdgeDemo.visible && !topEdgeDemo.visible
182+ enabled: disappearingAnimationProgress === 0.0 && !leftEdgeDemo.active && !topEdgeDemo.active
183183 // FIXME: unfocus all applications when going back to the dash
184184 onEnabledChanged: {
185185 if (enabled) {
@@ -220,12 +220,12 @@ FocusScope {
220220
221221 Connections {
222222 target: greeter
223− onShownChanged: if (topEdgeDemo.enabled && !greeter.shown) topEdgeDemo.visible = true
223+ onShownChanged: if (!greeter.shown) topEdgeDemo.visible = true
224224 }
225225
226226 Connections {
227227 target: panel.indicators
228− onFullyOpenedChanged: if (topEdgeDemo.enabled && panel.indicators.fullyOpened) topEdgeDemo.visible = false
228+ onFullyOpenedChanged: if (panel.indicators.fullyOpened) topEdgeDemo.enabled = false
229229 }
230230 }
231231
@@ -242,14 +242,14 @@ FocusScope {
242242
243243 Connections {
244244 target: bottomEdgeDemo
245− onVisibleChanged: if (leftEdgeDemo.enabled && !bottomEdgeDemo.visible) leftEdgeDemo.visible = true
245+ onActiveChanged: if (!bottomEdgeDemo.active) leftEdgeDemo.visible = true
246246 }
247247
248248 Connections {
249249 target: launcher
250250 onProgressChanged: {
251− if (leftEdgeDemo.enabled && launcher.progress >= 1.0) {
252− leftEdgeDemo.visible = false;
251+ if (leftEdgeDemo.active && launcher.progress >= 1.0) {
252+ leftEdgeDemo.enabled = false;
253253 shell.hideEdgeDemo();
254254 }
255255 }
@@ -521,7 +521,7 @@ FocusScope {
521521 shell.background = bgPath ? bgPath : default_background
522522 // Update edge demo hint
523523 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")
525525 }
526526
527527 onLeftTeaserPressedChanged: {
@@ -538,7 +538,6 @@ FocusScope {
538538 text: i18n.tr("Try swiping from the right edge to unlock the phone")
539539 anchors.fill: parent
540540 visible: shell.showEdgeDemoInGreeter
541− enabled: shell.showEdgeDemoInGreeter
542541 onSkip: {
543542 shell.hideEdgeDemoInGreeter()
544543 shell.hideEdgeDemo()
@@ -546,10 +545,10 @@ FocusScope {
546545
547546 Connections {
548547 target: greeter
549− onUnlocked: if (rightEdgeDemo.enabled) rightEdgeDemo.visible = false
548+ onUnlocked: rightEdgeDemo.visible = false
550549 onShownChanged: {
551− if (rightEdgeDemo.enabled && !greeter.shown) {
552− rightEdgeDemo.visible = false
550+ if (rightEdgeDemo.active && !greeter.shown) {
551+ rightEdgeDemo.enabled = false
553552 shell.hideEdgeDemoInGreeter()
554553 }
555554 }
@@ -573,7 +572,7 @@ FocusScope {
573572 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
574573 indicators {
575574 hides: [launcher]
576− available: !rightEdgeDemo.visible && !leftEdgeDemo.visible
575+ available: !rightEdgeDemo.active && !leftEdgeDemo.active
577576 }
578577 fullscreenMode: shell.fullscreenMode
579578 searchVisible: !greeter.shown && !lockscreen.shown
@@ -596,8 +595,8 @@ FocusScope {
596595
597596 Connections {
598597 target: panel.indicators
599− onFullyOpenedChanged: if (bottomEdgeDemo.enabled && panel.indicators.fullyOpened) bottomEdgeDemo.visible = true
600− onPartiallyOpenedChanged: if (bottomEdgeDemo.enabled && !panel.indicators.partiallyOpened && !panel.indicators.fullyOpened) bottomEdgeDemo.visible = false
598+ onFullyOpenedChanged: if (panel.indicators.fullyOpened) bottomEdgeDemo.visible = true
599+ onPartiallyOpenedChanged: if (!panel.indicators.partiallyOpened && !panel.indicators.fullyOpened) bottomEdgeDemo.enabled = false
601600 }
602601 }
603602 }
@@ -608,7 +607,7 @@ FocusScope {
608607 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
609608 height: parent.height
610609
611− available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && !topEdgeDemo.visible
610+ available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && !topEdgeDemo.active
612611 shown: false
613612 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
614613 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
@@ -666,7 +665,7 @@ FocusScope {
666665 anchors.bottom: parent.bottom
667666 width: parent.width
668667 dragAreaWidth: shell.edgeSize
669− available: !greeter.locked && !rightEdgeDemo.visible && !topEdgeDemo.visible && !bottomEdgeDemo.visible
668+ available: !greeter.locked && !rightEdgeDemo.active && !topEdgeDemo.active && !bottomEdgeDemo.active
670669 onDashItemSelected: {
671670 greeter.hide()
672671 // Animate if moving between application and dash