Merge lp:~aacid/unity8/new-scopes-show-dash-app-running into lp:~unity-team/unity8/new-scopes

Proposed by Albert Astals Cid
Status: Merged
Merged at revision: 678
Proposed branch: lp:~aacid/unity8/new-scopes-show-dash-app-running
Merge into: lp:~unity-team/unity8/new-scopes
Diff against target: 285 lines (+119/-66)
2 files modified
qml/Components/Showable.qml (+8/-0)
qml/Shell.qml (+111/-66)
To merge this branch: bzr merge lp:~aacid/unity8/new-scopes-show-dash-app-running
Reviewer Review Type Date Requested Status
Unity Team Pending
Review via email: mp+207446@code.launchpad.net

Commit message

Show the Dash when only a sidestage app is running

To post a comment you must log in.
659. By Albert Astals Cid

logs-=3

660. By Albert Astals Cid

Saviq suggested darkening instead of half scaling/opacity

Works well too

661. By Albert Astals Cid

Enable the sidestage handle to close the sidestage even if there's no main stage app

662. By Albert Astals Cid

Merge

663. By Albert Astals Cid

Merge

664. By Albert Astals Cid

hide/show improvements for sidestage+dash

665. By Albert Astals Cid

Merge

666. By Albert Astals Cid

Better

667. By Albert Astals Cid

don't show hud button when on dash+hidden sidestage app scenario

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Components/Showable.qml'
2--- qml/Components/Showable.qml 2013-10-01 18:18:52 +0000
3+++ qml/Components/Showable.qml 2014-02-21 13:57:05 +0000
4@@ -107,6 +107,9 @@
5 if (!hideAnimation.running) {
6 hideAnimation.restart()
7 }
8+ if (__skipShowAnimation) {
9+ hideAnimation.complete();
10+ }
11 } else {
12 visible = false
13 required = false
14@@ -115,6 +118,11 @@
15 shown = false
16 }
17
18+ function hideNow() {
19+ __skipShowAnimation = true;
20+ hide();
21+ }
22+
23 Connections {
24 target: hideAnimation ? hideAnimation: null
25 onRunningChanged: {
26
27=== modified file 'qml/Shell.qml'
28--- qml/Shell.qml 2014-02-20 20:38:07 +0000
29+++ qml/Shell.qml 2014-02-21 13:57:05 +0000
30@@ -83,8 +83,6 @@
31 applicationManager.setSideStageAppRect(sideStageAppRect);
32 }
33
34- readonly property bool applicationFocused: !!applicationManager.mainStageFocusedApplication
35- || !!applicationManager.sideStageFocusedApplication
36 // Used for autopilot testing.
37 readonly property string currentFocusedAppId: ApplicationManager.focusedApplicationId
38
39@@ -149,66 +147,94 @@
40 // Whether the underlay is fully covered by opaque UI elements.
41 property bool fullyCovered: panel.indicators.fullyOpened && shell.width <= panel.indicatorsMenuWidth
42
43- readonly property bool applicationRunning: ((mainStage.applications && mainStage.applications.count > 0)
44- || (sideStage.applications && sideStage.applications.count > 0))
45+ readonly property bool mainStageApplicationRunning: mainStage.applications && mainStage.applications.count > 0
46+ readonly property bool sideStageApplicationRunning: sideStage.applications && sideStage.applications.count > 0
47
48 // Whether the user should see the topmost application surface (if there's one at all).
49- readonly property bool applicationSurfaceShouldBeSeen: applicationRunning && !stages.fullyHidden
50+ readonly property bool mainStageApplicationShown: mainStageApplicationRunning && !stages.fullyHidden
51 && !mainStage.usingScreenshots // but want sideStage animating over app surface
52
53
54
55 // NB! Application surfaces are stacked behing the shell one. So they can only be seen by the user
56 // through the translucent parts of the shell surface.
57- visible: !fullyCovered && !applicationSurfaceShouldBeSeen
58-
59- Rectangle {
60- anchors.fill: parent
61- color: "black"
62- opacity: dash.disappearingAnimationProgress
63- }
64-
65- Image {
66- anchors.fill: dash
67- source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
68- fillMode: Image.PreserveAspectCrop
69- horizontalAlignment: Image.AlignRight
70- verticalAlignment: Image.AlignTop
71- }
72-
73- Dash {
74- id: dash
75- objectName: "dash"
76-
77- available: !greeter.shown && !lockscreen.shown
78- hides: [stages, launcher, panel.indicators]
79- shown: disappearingAnimationProgress !== 1.0
80- enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
81- // FIXME: unfocus all applications when going back to the dash
82- onEnabledChanged: {
83- if (enabled) {
84- shell.applicationManager.unfocusCurrentApplication()
85- }
86- }
87-
88- anchors {
89- fill: parent
90- topMargin: panel.panelHeight
91- }
92-
93- contentScale: 1.0 - 0.2 * disappearingAnimationProgress
94- opacity: 1.0 - disappearingAnimationProgress
95- property real disappearingAnimationProgress: {
96- if (greeter.shown) {
97- return greeter.showProgress;
98+ visible: !fullyCovered && !mainStageApplicationShown
99+
100+ Item {
101+ id: underlayClipper
102+ clip: !parent.mainStageApplicationShown && parent.sideStageApplicationRunning && stagesOuterContainer.showProgress > 0
103+ width: {
104+ if (clip) {
105+ var w = parent.width - sideStage.width
106+ w += stagesOuterContainer.x + stages.x + (sideStage.x - sideStageRevealer.openedValue)
107+ return Math.min(w, parent.width);
108 } else {
109- return stagesOuterContainer.showProgress;
110- }
111- }
112-
113- // FIXME: only necessary because stagesOuterContainer.showProgress and
114- // greeterRevealer.animatedProgress are not animated
115- Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
116+ return parent.width;
117+ }
118+ }
119+ height: parent.height
120+
121+ Image {
122+ anchors.fill: dash
123+ source: shell.width > shell.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
124+ fillMode: Image.PreserveAspectCrop
125+ horizontalAlignment: Image.AlignRight
126+ verticalAlignment: Image.AlignTop
127+ }
128+
129+ Dash {
130+ id: dash
131+ objectName: "dash"
132+
133+ available: !greeter.shown && !lockscreen.shown
134+ hides: [stages, launcher, panel.indicators]
135+ shown: disappearingAnimationProgress !== 1.0
136+ enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
137+ // FIXME: unfocus all applications when going back to the dash
138+ onEnabledChanged: {
139+ if (enabled) {
140+ shell.applicationManager.unfocusCurrentApplication()
141+ }
142+ }
143+
144+ width: underlay.width
145+ height: underlay.height - y
146+ y: panel.panelHeight
147+
148+ contentScale: 1.0 - 0.2 * disappearingAnimationProgress
149+ opacity: 1.0 - disappearingAnimationProgress
150+ property real disappearingAnimationProgress: {
151+ if (greeter.shown) {
152+ return greeter.showProgress;
153+ } else {
154+ if (underlayClipper.clip)
155+ return 0;
156+ else
157+ return stagesOuterContainer.showProgress;
158+ }
159+ }
160+
161+ // FIXME: only necessary because stagesOuterContainer.showProgress and
162+ // greeterRevealer.animatedProgress are not animated
163+ Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
164+ }
165+
166+ Rectangle {
167+ width: underlay.width
168+ height: underlay.height
169+ color: "black"
170+ opacity: 0.5 * ((sideStage.x - sideStageRevealer.closedValue) / (sideStageRevealer.openedValue - sideStageRevealer.closedValue))
171+ visible: sideStageHideButton.enabled
172+ }
173+
174+ AbstractButton {
175+ id: sideStageHideButton
176+ enabled: mainStage.applications.count == 0 && sideStage.shown
177+ anchors.fill: parent
178+ onClicked: {
179+ sideStage.hide();
180+ }
181+ }
182 }
183 }
184
185@@ -217,7 +243,7 @@
186
187 width: parent.width
188 height: parent.height
189- x: launcher.progress
190+ x: mainStage.applications.count > 0 ? launcher.progress : 0
191 Behavior on x {SmoothedAnimation{velocity: 600}}
192
193 property real showProgress:
194@@ -229,6 +255,16 @@
195
196 x: width
197
198+ function doLauncherHide() {
199+ if (mainStage.applications.count > 0) {
200+ hide();
201+ } else {
202+ if (sideStage.shown) {
203+ sideStage.hide();
204+ }
205+ }
206+ }
207+
208 property bool fullyShown: shown && x == 0 && parent.x == 0
209 property bool fullyHidden: !shown && x == width
210 available: !greeter.shown
211@@ -313,11 +349,6 @@
212 rightEdgeDraggingAreaWidth: shell.edgeSize
213 normalApplicationY: shell.panelHeight
214
215- onShownChanged: {
216- if (!shown && mainStage.applications.count == 0) {
217- stages.hide();
218- }
219- }
220 // FIXME: when hiding the side stage, refocus the main stage
221 // application so that it goes in front of the side stage
222 // application and hides it
223@@ -346,8 +377,16 @@
224 Connections {
225 target: sideStage.applications
226 onCountChanged: {
227- if (sideStage.applications.count == 0 && sideStage.shown) { // if all SS app closed, hide side stage
228- sideStage.hide();
229+ if (sideStage.applications.count == 0) {
230+ if (sideStage.shown) { // if all SS app closed, hide side stage
231+ sideStage.hide();
232+ } else {
233+ // Sidestage is hidden and there is no main app, make sure the
234+ // stages is totally hidden too
235+ if (mainStage.applications.count == 0) {
236+ stages.hideNow();
237+ }
238+ }
239 }
240 }
241 }
242@@ -356,7 +395,7 @@
243 Revealer {
244 id: sideStageRevealer
245
246- enabled: mainStage.applications.count > 0 && sideStage.applications.count > 0
247+ enabled: sideStage.applications.count > 0
248 && sideStage.available
249 direction: Qt.RightToLeft
250 openedValue: parent.width - sideStage.width
251@@ -561,8 +600,14 @@
252 }
253
254 InputFilterArea {
255- anchors.fill: parent
256- blockInput: !applicationFocused || greeter.shown || lockscreen.shown || launcher.shown
257+ width: {
258+ if (applicationManager.sideStageFocusedApplication && sideStage.shown)
259+ return parent.width - sideStage.width;
260+ else
261+ return parent.width;
262+ }
263+ height: parent.height
264+ blockInput: !applicationManager.mainStageFocusedApplication || greeter.shown || lockscreen.shown || launcher.shown
265 || panel.indicators.shown || hud.shown
266 }
267
268@@ -664,7 +709,7 @@
269 theHud: hud
270 anchors.fill: parent
271 enabled: hud.available
272- applicationIsOnForeground: applicationFocused
273+ applicationIsOnForeground: (stages.shown && mainStage.applications.count > 0) || (stages.shown && sideStage.shown)
274 }
275
276 InputFilterArea {
277@@ -696,7 +741,7 @@
278 }
279 onDash: {
280 if (stages.shown) {
281- stages.hide();
282+ stages.doLauncherHide();
283 launcher.hide();
284 }
285 }

Subscribers

People subscribed via source and target branches

to all changes: