Merge lp:~dandrader/unity/8_bottomBarDDA into lp:unity/8.0

Proposed by Daniel d'Andrada
Status: Merged
Approved by: Albert Astals Cid
Approved revision: no longer in the source branch.
Merged at revision: 34
Proposed branch: lp:~dandrader/unity/8_bottomBarDDA
Merge into: lp:unity/8.0
Diff against target: 219 lines (+58/-87)
4 files modified
Bottombar/Bottombar.qml (+50/-84)
Bottombar/HudButton.qml (+3/-2)
Shell.qml (+3/-0)
tests/autopilot/unity8/tests/helpers.py (+2/-1)
To merge this branch: bzr merge lp:~dandrader/unity/8_bottomBarDDA
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Approve
Unity Team Pending
Review via email: mp+170296@code.launchpad.net

Commit message

Bottombar: s/Revealer/DirectionalDragArea + refactoring

Description of the change

Bottombar: s/Revealer/DirectionalDragArea + refactoring

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Silly typo anpplication -> application

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Silly typo anpplication -> application

Fixed.

Revision history for this message
Albert Astals Cid (aacid) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Bottombar/Bottombar.qml'
2--- Bottombar/Bottombar.qml 2013-06-05 22:03:08 +0000
3+++ Bottombar/Bottombar.qml 2013-06-20 14:09:28 +0000
4@@ -18,37 +18,41 @@
5 import "../Components"
6 import "../Components/Math.js" as MathLocal
7 import Unity 0.1
8+import Ubuntu.Gestures 0.1
9
10 Item {
11 id: bottombar
12- width: shell.width
13- height: shell.height
14+
15+ // Whether there's an application on foreground (as opposed to have shell's Dash on foreground)
16+ property bool applicationIsOnForeground
17
18 property variant theHud
19 property bool enabled: false
20 readonly property real bottomEdgeButtonCenterDistance: units.gu(34)
21- readonly property real bottomEdgeShowButtonDistance: units.gu(2)
22-
23- property bool __applicationInFocus: false
24-
25- state: "hidden"
26+
27+ state: dragArea.status === DirectionalDragArea.Recognized ? "shown" : "hidden"
28
29 HudButton {
30 id: hudButton
31
32- x: MathLocal.clamp(hudButtonRevealer.pressedX - width / 2, 0, bottombar.width - width)
33- y: bottombar.height - bottomEdgeButtonCenterDistance - height / 2 - bottomMargin
34+ x: MathLocal.clamp(dragArea.touchStartX - (width / 2), 0, bottombar.width - width)
35+ y: bottombar.height - bottomEdgeButtonCenterDistance - (height / 2) - bottomMargin
36+
37+ mouseOver: {
38+ if (dragArea.status === DirectionalDragArea.Recognized) {
39+ var touchLocal = mapFromItem(dragArea, dragArea.touchX, dragArea.touchY)
40+ return touchLocal.x > 0 && touchLocal.x < width
41+ && touchLocal.y > 0 && touchLocal.y < height
42+ } else {
43+ return false
44+ }
45+ }
46+
47+ onClicked: theHud.show()
48+
49 Behavior on bottomMargin {
50 NumberAnimation{duration: hudButton.opacity < 0.01 ? 200 : 70; easing.type: Easing.OutQuart}
51 }
52- mouse: {
53- if (hudButtonRevealer.draggingArea.pressed) {
54- var mapped = mapFromItem(hudButtonRevealer.draggingArea, hudButtonRevealer.draggingArea.mouseX, hudButtonRevealer.draggingArea.mouseY)
55- return Qt.point(mapped.x, mapped.y)
56- } else {
57- return mouse
58- }
59- }
60
61 Behavior on opacity {
62 NumberAnimation{ duration: 200; easing.type: Easing.OutCubic}
63@@ -60,74 +64,36 @@
64 onShownChanged: bottomBarVisibilityCommunicatorShell.forceHidden = theHud.shown
65 }
66
67- function updateApplicationInFocus() {
68- if (shell.applicationManager.mainStageFocusedApplication || shell.applicationManager.sideStageFocusedApplication) {
69- __applicationInFocus = true
70- } else {
71- __applicationInFocus = false
72- }
73- }
74-
75- Connections {
76- target: shell.applicationManager
77- ignoreUnknownSignals: true
78- onMainStageFocusedApplicationChanged: updateApplicationInFocus()
79- onSideStageFocusedApplicationChanged: updateApplicationInFocus()
80- }
81-
82- Showable {
83- id: hudButtonShowable
84-
85- opacity: 1.0
86+ DirectionalDragArea {
87+ id: dragArea
88 width: parent.width
89- height: bottomEdgeShowButtonDistance
90- shown: false
91- showAnimation: StandardAnimation { property: "y"; duration: 350; to: hudButtonRevealer.openedValue; easing.type: Easing.OutCubic }
92- hideAnimation: StandardAnimation { property: "y"; duration: 350; to: hudButtonRevealer.closedValue; easing.type: Easing.OutCubic }
93- onYChanged: {
94- if (y == hudButtonRevealer.openedValue)
95- bottombar.state = "shown"
96- }
97-
98- // eater
99- MouseArea {
100- anchors.fill: parent
101- }
102- }
103-
104- Revealer {
105- id: hudButtonRevealer
106-
107- property double pressedX
108-
109- enabled: !theHud.shown && bottombar.enabled && __applicationInFocus
110- direction: Qt.RightToLeft
111- openedValue: bottombar.height - height
112- closedValue: bottombar.height
113- target: hudButtonShowable
114- width: hudButtonShowable.width
115- height: hudButtonShowable.height
116- anchors.bottom: bottombar.bottom
117- onOpenPressed: {
118- pressedX = mouseX
119- }
120-
121- onOpenReleased: {
122- if (hudButton.opacity != 0 && hudButton.mouseOver) {
123- hudButtonShowable.hide()
124- theHud.show()
125- } else {
126- hudButtonShowable.hide()
127- }
128- }
129- }
130-
131- Connections {
132- target: hudButtonShowable.hideAnimation
133- onRunningChanged: {
134- if (hudButtonShowable.hideAnimation.running) {
135- bottombar.state = "hidden"
136- }
137+ height: distanceThreshold
138+ anchors.bottom: parent.bottom
139+
140+ enabled: !theHud.shown && bottombar.enabled && applicationIsOnForeground
141+ direction: Direction.Upwards
142+
143+ // values to be tweaked and later removed from here and set in stone as defaults
144+ // once we are confident it's all good.
145+ maxDeviation: units.gu(1)
146+ wideningAngle: 30
147+ distanceThreshold: units.gu(3)
148+ minSpeed: units.gu(5)
149+
150+ property int previousStatus: -1
151+ property real touchStartX: -1
152+
153+ onStatusChanged: {
154+ if (status === DirectionalDragArea.WaitingForTouch) {
155+ if (previousStatus == DirectionalDragArea.Recognized) {
156+ if (hudButton.mouseOver) {
157+ hudButton.clicked()
158+ }
159+ }
160+ } else if (status === DirectionalDragArea.Undecided) {
161+ touchStartX = touchX
162+ }
163+ previousStatus = status
164 }
165 }
166
167
168=== modified file 'Bottombar/HudButton.qml'
169--- Bottombar/HudButton.qml 2013-06-05 22:03:08 +0000
170+++ Bottombar/HudButton.qml 2013-06-20 14:09:28 +0000
171@@ -20,10 +20,11 @@
172 Item {
173 id: item
174
175+ property bool mouseOver
176+
177 property int bottomMargin: units.gu(2)
178- property bool mouseOver: contains(mouse)
179
180- property point mouse: Qt.point(-1,-1)
181+ signal clicked()
182
183 readonly property real scaleOnMouseOver: 1.2
184
185
186=== modified file 'Shell.qml'
187--- Shell.qml 2013-06-20 00:01:16 +0000
188+++ Shell.qml 2013-06-20 14:09:28 +0000
189@@ -188,6 +188,7 @@
190
191 property bool fullyShown: shown && stages[stagesRevealer.boundProperty] == stagesRevealer.openedValue
192 && parent.x == 0
193+
194 property bool fullyHidden: !shown && stages[stagesRevealer.boundProperty] == stagesRevealer.closedValue
195 available: !greeter.shown
196 hides: [launcher, panel.indicators]
197@@ -515,6 +516,8 @@
198 theHud: hud
199 anchors.fill: parent
200 enabled: !panel.indicators.shown
201+ applicationIsOnForeground: applicationManager.mainStageFocusedApplication
202+ || applicationManager.sideStageFocusedApplication
203 }
204
205 InputFilterArea {
206
207=== modified file 'tests/autopilot/unity8/tests/helpers.py'
208--- tests/autopilot/unity8/tests/helpers.py 2013-06-12 14:15:00 +0000
209+++ tests/autopilot/unity8/tests/helpers.py 2013-06-20 14:09:28 +0000
210@@ -98,7 +98,8 @@
211 # go to the void for the first time because there's no real way to know what the display has
212 # painted already. Give it another (max retries) chance.
213 try:
214- self.assertThat(lambda: getattr(bottombar, "__applicationInFocus"), Eventually(Equals(True)))
215+ self.assertThat(lambda: getattr(bottombar, "applicationIsOnForeground"),
216+ Eventually(Equals(True)))
217 except:
218 if retries > 0:
219 logger.warning("Failed to launch app. Retrying...")

Subscribers

People subscribed via source and target branches

to all changes: