Merge lp:~mzanetti/unity8/launcher-own-quicklist into lp:unity8
- launcher-own-quicklist
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Albert Astals Cid |
Approved revision: | 467 |
Merged at revision: | 487 |
Proposed branch: | lp:~mzanetti/unity8/launcher-own-quicklist |
Merge into: | lp:unity8 |
Diff against target: |
342 lines (+144/-90) 3 files modified
Launcher/LauncherPanel.qml (+95/-54) Launcher/QuicklistForegroundStyle.qml (+0/-23) tests/qmltests/Launcher/tst_Launcher.qml (+49/-13) |
To merge this branch: | bzr merge lp:~mzanetti/unity8/launcher-own-quicklist |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Albert Astals Cid (community) | Approve | ||
Review via email: mp+191398@code.launchpad.net |
Commit message
replace the launcher quicklist's Popover with an own quicklist implementation
The Popover probably won't ever support what the launcher needs.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:466
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Albert Astals Cid (aacid) wrote : | # |
Code looks good, works good. Ok :-)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:467
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'Launcher/LauncherPanel.qml' |
2 | --- Launcher/LauncherPanel.qml 2013-09-11 15:33:02 +0000 |
3 | +++ Launcher/LauncherPanel.qml 2013-10-21 09:02:46 +0000 |
4 | @@ -21,6 +21,7 @@ |
5 | import Unity.Launcher 0.1 |
6 | import Ubuntu.Components.Popups 0.1 |
7 | import "../Components/ListItems" |
8 | +import "../Components/" |
9 | |
10 | Item { |
11 | id: root |
12 | @@ -31,7 +32,7 @@ |
13 | property bool inverted: true |
14 | property bool dragging: false |
15 | property bool moving: launcherListView.moving || launcherListView.flicking |
16 | - property bool preventHiding: moving || dndArea.draggedIndex >= 0 || dndArea.quickListPopover !== null || dndArea.pressed |
17 | + property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed |
18 | property int highlightIndex: -1 |
19 | |
20 | signal applicationSelected(string appId) |
21 | @@ -278,7 +279,6 @@ |
22 | property bool postDragging: false |
23 | property int startX |
24 | property int startY |
25 | - property var quickListPopover: null |
26 | |
27 | onPressed: { |
28 | selectedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY) |
29 | @@ -357,11 +357,10 @@ |
30 | draggedIndex = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight); |
31 | |
32 | // Opening QuickList |
33 | - var quickListModel = launcherListView.model.get(draggedIndex).quickList |
34 | - var quickListAppId = launcherListView.model.get(draggedIndex).appId |
35 | - |
36 | - quickListPopover = PopupUtils.open(popoverComponent, selectedItem, |
37 | - {model: quickListModel, appId: quickListAppId}) |
38 | + quickList.item = selectedItem; |
39 | + quickList.model = launcherListView.model.get(draggedIndex).quickList; |
40 | + quickList.appId = launcherListView.model.get(draggedIndex).appId; |
41 | + quickList.state = "open"; |
42 | |
43 | launcherListView.interactive = false |
44 | |
45 | @@ -387,7 +386,7 @@ |
46 | var distance = Math.max(Math.abs(mouseX - startX), Math.abs(mouseY - startY)) |
47 | if (!preDragging && distance > units.gu(1.5)) { |
48 | preDragging = true; |
49 | - PopupUtils.close(quickListPopover) |
50 | + quickList.state = ""; |
51 | } |
52 | if (distance > launcherListView.itemHeight) { |
53 | selectedItem.dragging = true |
54 | @@ -482,53 +481,95 @@ |
55 | } |
56 | } |
57 | |
58 | - Component { |
59 | - id: popoverComponent |
60 | - |
61 | - Popover { |
62 | - id: popover |
63 | - property var model |
64 | - property string appId |
65 | - contentWidth: quickListColumn.width |
66 | - foregroundStyle: QuicklistForegroundStyle {} |
67 | - |
68 | - // FIXME: There's a bug in the Popover positioning that it covers the item in case it is rotated. |
69 | - // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1204470 |
70 | - // For now, let's move the Popover around with callerMargin. |
71 | - // Remove popupMargin once the bug is fixed. |
72 | - property int popupMargin: root.inverted ? launcherListView.itemHeight : 0; |
73 | - |
74 | - callerMargin: units.gu(1) + popupMargin |
75 | - |
76 | - Column { |
77 | - id: quickListColumn |
78 | - width: units.gu(30) |
79 | - height: childrenRect.height |
80 | - |
81 | - Repeater { |
82 | - id: popoverRepeater |
83 | - model: popover.model |
84 | - |
85 | - ListItems.Standard { |
86 | - objectName: "quickListEntry" + index |
87 | - text: (model.clickable ? "" : "<b>") + model.label + (model.clickable ? "" : "</b>") |
88 | - highlightWhenPressed: model.clickable |
89 | - |
90 | - // FIXME: This is a workaround for the theme not being context sensitive. I.e. the |
91 | - // ListItems don't know that they are sitting in a themed Popover where the color |
92 | - // needs to be inverted. |
93 | - __foregroundColor: Theme.palette.selected.backgroundText |
94 | - |
95 | - onClicked: { |
96 | - if (!model.clickable) { |
97 | - return; |
98 | - } |
99 | - PopupUtils.close(popover); |
100 | - // Unsetting model to prevent showing changing entries during fading out |
101 | - // that may happen because of triggering an action. |
102 | - LauncherModel.quickListActionInvoked(appId, index); |
103 | - popoverRepeater.model = undefined; |
104 | + UbuntuShapeForItem { |
105 | + id: quickListShape |
106 | + objectName: "quickListShape" |
107 | + anchors.fill: quickList |
108 | + opacity: quickList.state === "open" ? 0.8 : 0 |
109 | + visible: opacity > 0 |
110 | + rotation: root.rotation |
111 | + |
112 | + Behavior on opacity { |
113 | + UbuntuNumberAnimation {} |
114 | + } |
115 | + |
116 | + image: quickList |
117 | + |
118 | + Image { |
119 | + anchors { |
120 | + right: parent.left |
121 | + rightMargin: -units.dp(4) |
122 | + verticalCenter: parent.verticalCenter |
123 | + verticalCenterOffset: -quickList.offset |
124 | + } |
125 | + height: units.gu(1) |
126 | + width: units.gu(2) |
127 | + source: "graphics/quicklist_tooltip.png" |
128 | + rotation: 90 |
129 | + } |
130 | + |
131 | + InverseMouseArea { |
132 | + anchors.fill: parent |
133 | + enabled: quickList.state == "open" |
134 | + onClicked: { |
135 | + quickList.state = "" |
136 | + } |
137 | + } |
138 | + |
139 | + } |
140 | + |
141 | + Rectangle { |
142 | + id: quickList |
143 | + objectName: "quickList" |
144 | + color: "#221e1c" |
145 | + width: units.gu(30) |
146 | + height: quickListColumn.height |
147 | + anchors { |
148 | + left: root.inverted ? undefined : parent.right |
149 | + right: root.inverted ? parent.left : undefined |
150 | + margins: units.gu(1) |
151 | + |
152 | + } |
153 | + y: itemCenter - (height / 2) + offset |
154 | + rotation: root.rotation |
155 | + |
156 | + property var model |
157 | + property string appId |
158 | + property var item |
159 | + |
160 | + // internal |
161 | + property int itemCenter: item ? root.mapFromItem(quickList.item).y + (item.height / 2) : units.gu(1) |
162 | + property int offset: itemCenter + (height/2) + units.gu(1) > parent.height ? -itemCenter - (height/2) - units.gu(1) + parent.height : |
163 | + itemCenter - (height/2) < units.gu(1) ? (height/2) - itemCenter + units.gu(1) : 0 |
164 | + |
165 | + Column { |
166 | + id: quickListColumn |
167 | + width: parent.width |
168 | + height: childrenRect.height |
169 | + |
170 | + Repeater { |
171 | + id: popoverRepeater |
172 | + model: quickList.model |
173 | + |
174 | + ListItems.Standard { |
175 | + objectName: "quickListEntry" + index |
176 | + text: (model.clickable ? "" : "<b>") + model.label + (model.clickable ? "" : "</b>") |
177 | + highlightWhenPressed: model.clickable |
178 | + |
179 | + // FIXME: This is a workaround for the theme not being context sensitive. I.e. the |
180 | + // ListItems don't know that they are sitting in a themed Popover where the color |
181 | + // needs to be inverted. |
182 | + __foregroundColor: Theme.palette.selected.backgroundText |
183 | + |
184 | + onClicked: { |
185 | + if (!model.clickable) { |
186 | + return; |
187 | } |
188 | + quickList.state = ""; |
189 | + // Unsetting model to prevent showing changing entries during fading out |
190 | + // that may happen because of triggering an action. |
191 | + LauncherModel.quickListActionInvoked(quickList.appId, index); |
192 | + quickList.model = undefined; |
193 | } |
194 | } |
195 | } |
196 | |
197 | === removed file 'Launcher/QuicklistForegroundStyle.qml' |
198 | --- Launcher/QuicklistForegroundStyle.qml 2013-08-22 11:18:11 +0000 |
199 | +++ Launcher/QuicklistForegroundStyle.qml 1970-01-01 00:00:00 +0000 |
200 | @@ -1,23 +0,0 @@ |
201 | -/* |
202 | - * Copyright (C) 2013 Canonical, Ltd. |
203 | - * |
204 | - * This program is free software; you can redistribute it and/or modify |
205 | - * it under the terms of the GNU General Public License as published by |
206 | - * the Free Software Foundation; version 3. |
207 | - * |
208 | - * This program is distributed in the hope that it will be useful, |
209 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
210 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
211 | - * GNU General Public License for more details. |
212 | - * |
213 | - * You should have received a copy of the GNU General Public License |
214 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
215 | - */ |
216 | - |
217 | -import Ubuntu.Components.Themes.Ambiance 0.1 |
218 | - |
219 | -PopoverForegroundStyle { |
220 | - bubbleColor: "#221e1c" |
221 | - bubbleOpacity: 0.9 |
222 | - arrowSource: "graphics/quicklist_tooltip.png" |
223 | -} |
224 | |
225 | === modified file 'tests/qmltests/Launcher/tst_Launcher.qml' |
226 | --- tests/qmltests/Launcher/tst_Launcher.qml 2013-09-11 21:33:14 +0000 |
227 | +++ tests/qmltests/Launcher/tst_Launcher.qml 2013-10-21 09:02:46 +0000 |
228 | @@ -363,23 +363,58 @@ |
229 | var draggedItem = findChild(launcher, "launcherDelegate5") |
230 | var item0 = findChild(launcher, "launcherDelegate0") |
231 | var fakeDragItem = findChild(launcher, "fakeDragItem") |
232 | - var dndArea = findChild(launcher, "dndArea") |
233 | + var quickListShape = findChild(launcher, "quickListShape") |
234 | |
235 | // Initial state |
236 | - compare(dndArea.quickListPopover, null) |
237 | + compare(quickListShape.visible, false) |
238 | |
239 | // Doing longpress |
240 | mousePress(draggedItem, draggedItem.width / 2, draggedItem.height / 2) |
241 | tryCompare(fakeDragItem, "visible", true) // Wait longpress happening |
242 | - verify(dndArea.quickListPopover != null) |
243 | + tryCompare(quickListShape, "visible", true) |
244 | |
245 | // Dragging a bit (> 1.5 gu) |
246 | mouseMove(draggedItem, -units.gu(2), draggedItem.height / 2) |
247 | |
248 | // QuickList needs to be closed when a drag operation starts |
249 | - tryCompare(dndArea, "quickListPopover", null) |
250 | - |
251 | - mouseRelease(draggedItem); |
252 | + tryCompare(quickListShape, "visible", false) |
253 | + |
254 | + mouseRelease(draggedItem); |
255 | + } |
256 | + |
257 | + function test_quicklist_positioning_data() { |
258 | + return [ |
259 | + {tag: "top", flickTo: "top", itemIndex: 0}, |
260 | + {tag: "bottom", flickTo: "bottom", itemIndex: 9} |
261 | + ]; |
262 | + } |
263 | + |
264 | + function test_quicklist_positioning(data) { |
265 | + revealer.dragLauncherIntoView(); |
266 | + var quickList = findChild(launcher, "quickList") |
267 | + var draggedItem = findChild(launcher, "launcherDelegate" + data.itemIndex) |
268 | + var quickListShape = findChild(launcher, "quickListShape") |
269 | + |
270 | + // Position launcher to where we need it |
271 | + var listView = findChild(launcher, "launcherListView"); |
272 | + listView.flick(0, units.gu(200) * (data.flickTo === "top" ? 1 : -1)); |
273 | + tryCompare(listView, "flicking", false); |
274 | + |
275 | + // Doing longpress |
276 | + mousePress(draggedItem, draggedItem.width / 2, draggedItem.height / 2) |
277 | + tryCompare(quickListShape, "opacity", 0.8) |
278 | + mouseRelease(draggedItem); |
279 | + |
280 | + verify(quickList.y >= units.gu(1)) |
281 | + verify(quickList.y + quickList.height + units.gu(1) <= launcher.height) |
282 | + |
283 | + // Click somewhere in the empty space to dismiss the quicklist |
284 | + mouseClick(launcher, launcher.width - units.gu(1), units.gu(1)); |
285 | + tryCompare(quickListShape, "visible", false) |
286 | + |
287 | + // Click somewhere in the empty space to dismiss the launcher |
288 | + mouseClick(launcher, launcher.width - units.gu(1), units.gu(1)); |
289 | + revealer.waitUntilLauncherDisappears() |
290 | } |
291 | |
292 | function test_quicklist_click_data() { |
293 | @@ -392,19 +427,20 @@ |
294 | function test_quicklist_click(data) { |
295 | revealer.dragLauncherIntoView(); |
296 | var clickedItem = findChild(launcher, "launcherDelegate5") |
297 | - var dndArea = findChild(launcher, "dndArea") |
298 | + var quickList = findChild(launcher, "quickList") |
299 | + var quickListShape = findChild(launcher, "quickListShape") |
300 | |
301 | // Initial state |
302 | - compare(dndArea.quickListPopover, null) |
303 | + tryCompare(quickListShape, "visible", false) |
304 | |
305 | // Doing longpress |
306 | mousePress(clickedItem, clickedItem.width / 2, clickedItem.height / 2) |
307 | tryCompare(clickedItem, "itemOpacity", 0) // Wait for longpress to happen |
308 | - verify(dndArea.quickListPopover != null) |
309 | + verify(quickListShape.visible, "QuickList must be visible") |
310 | |
311 | mouseRelease(clickedItem); |
312 | |
313 | - var quickListEntry = findChild(dndArea.quickListPopover, "quickListEntry" + data.index) |
314 | + var quickListEntry = findChild(quickList, "quickListEntry" + data.index) |
315 | |
316 | signalSpy.clear(); |
317 | signalSpy.signalName = "quickListTriggered" |
318 | @@ -413,7 +449,7 @@ |
319 | |
320 | if (data.clickable) { |
321 | // QuickList needs to be closed when some clickable item is clicked |
322 | - tryCompare(dndArea, "quickListPopover", null) |
323 | + tryCompare(quickListShape, "visible", false) |
324 | |
325 | compare(signalSpy.count, 1, "Quicklist signal wasn't triggered") |
326 | compare(signalSpy.signalArguments[0][0], LauncherModel.get(5).appId) |
327 | @@ -422,13 +458,13 @@ |
328 | } else { |
329 | |
330 | // QuickList must not be closed when a non-clickable item is clicked |
331 | - verify(dndArea.quickListPopover != null) |
332 | + verify(quickListShape.visible, "QuickList must be visible") |
333 | |
334 | compare(signalSpy.count, 0, "Quicklist signal must NOT be triggered when clicking a non-clickable item") |
335 | |
336 | // Click somewhere in the empty space to dismiss the quicklist |
337 | mouseClick(launcher, launcher.width - units.gu(1), units.gu(1)); |
338 | - tryCompare(dndArea, "quickListPopover", null) |
339 | + tryCompare(quickListShape, "visible", false) |
340 | } |
341 | } |
342 | } |
FAILED: Continuous integration, rev:465 jenkins. qa.ubuntu. com/job/ unity8- ci/1426/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/5053 jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/2992 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- saucy/2294 jenkins. qa.ubuntu. com/job/ unity8- saucy-amd64- ci/449 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/1426 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/1426/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity8- saucy-i386- ci/1425 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-saucy/ 1223 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-amd64/ 928 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-amd64/ 928/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 2994 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 2994/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- maguro/ 2500 jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/2544 10.97.0. 26:8080/ job/touch- flash-device/ 8 10.97.0. 26:8080/ job/touch- flash-device/ 9
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 10.97.0. 26:8080/ job/unity8- ci/1426/ rebuild
http://