Merge lp:~paulliu/unity8/addrenderer into lp:unity8
- addrenderer
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Daniel d'Andrada |
Approved revision: | 116 |
Merged at revision: | 121 |
Proposed branch: | lp:~paulliu/unity8/addrenderer |
Merge into: | lp:unity8 |
Diff against target: |
336 lines (+231/-42) 5 files modified
Components/Carousel.qml (+38/-1) Dash/Generic/GenericCarousel.qml (+58/-0) Dash/Generic/GenericFilterGrid.qml (+59/-0) Dash/Generic/GenericFilterGridPotrait.qml (+30/-0) Dash/GenericScopeView.qml (+46/-41) |
To merge this branch: | bzr merge lp:~paulliu/unity8/addrenderer |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel d'Andrada (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+175028@code.launchpad.net |
Commit message
Let GenericScope support loading different renderers.
Description of the change
Let GenericScope supports loading different renderers.
- 112. By Ying-Chun Liu
-
Modify Filter grid to rectangle.
Add Potrait filter grid for videos. - 113. By Ying-Chun Liu
-
rename video -> generic
PS Jenkins bot (ps-jenkins) wrote : | # |
- 114. By Ying-Chun Liu
-
Use IconUtil for Carousel.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:114
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Daniel d'Andrada (dandrader) wrote : | # |
Some minor stuff
================
According to our coding guidelines, in javascript code you should end statements with ";". Even though that file doesn't follow the guidelines, I think we must start rectifying it by making new code comply.
-------
+++ Components/
@@ -52,6 +52,12 @@ Item {
/// @param itemY is y of the clicked delegate
signal clicked(int index, var delegateItem, real itemY)
+ /// Emitted when the user pressAndHold on an item
+ /// @param index is the index of the clicked item
+ /// @param delegateItem is the clicked component/delegate itself
+ /// @param itemY is y of the clicked delegate
The documentation of the parameters tell about a "clicked item". But the item wasn't clicked (it's a long press).
-------
+ /* We're pressAndHold the selected item and
Syntax is not right. Looks like you just copy-pasted and then s/click*
Will continue the review tomorrow.
- 115. By Ying-Chun Liu
-
fix comments
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:115
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Daniel d'Andrada (dandrader) wrote : | # |
apart from that, code looks ok.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:115
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 116. By Ying-Chun Liu
-
Add semi-colon to javascript code.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:116
http://
Executed test runs:
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:116
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:116
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Daniel d'Andrada (dandrader) : | # |
Daniel d'Andrada (dandrader) : | # |
Preview Diff
1 | === modified file 'Components/Carousel.qml' | |||
2 | --- Components/Carousel.qml 2013-06-12 08:28:15 +0000 | |||
3 | +++ Components/Carousel.qml 2013-07-17 16:28:25 +0000 | |||
4 | @@ -52,6 +52,12 @@ | |||
5 | 52 | /// @param itemY is y of the clicked delegate | 52 | /// @param itemY is y of the clicked delegate |
6 | 53 | signal clicked(int index, var delegateItem, real itemY) | 53 | signal clicked(int index, var delegateItem, real itemY) |
7 | 54 | 54 | ||
8 | 55 | /// Emitted when the user pressed and held on an item | ||
9 | 56 | /// @param index is the index of the held item | ||
10 | 57 | /// @param delegateItem is the held component/delegate itself | ||
11 | 58 | /// @param itemY is y of the held delegate | ||
12 | 59 | signal pressAndHold(int index, var delegateItem, real itemY) | ||
13 | 60 | |||
14 | 55 | implicitHeight: listView.tileHeight * selectedItemScaleFactor | 61 | implicitHeight: listView.tileHeight * selectedItemScaleFactor |
15 | 56 | 62 | ||
16 | 57 | /* Basic idea behind the carousel effect is to move the items of the delegates (compacting /stuffing them). | 63 | /* Basic idea behind the carousel effect is to move the items of the delegates (compacting /stuffing them). |
17 | @@ -159,6 +165,30 @@ | |||
18 | 159 | newContentXAnimation.start() | 165 | newContentXAnimation.start() |
19 | 160 | } | 166 | } |
20 | 161 | 167 | ||
21 | 168 | function itemPressAndHold(index, delegateItem) { | ||
22 | 169 | var x = CarouselJS.getXFromContinuousIndex(index, | ||
23 | 170 | realWidth, | ||
24 | 171 | realContentWidth, | ||
25 | 172 | tileWidth, | ||
26 | 173 | gapToMiddlePhase, | ||
27 | 174 | gapToEndPhase, | ||
28 | 175 | carousel.drawBuffer); | ||
29 | 176 | |||
30 | 177 | if (Math.abs(x - contentX) < 1) { | ||
31 | 178 | /* We're pressAndHold the selected item and | ||
32 | 179 | we're in the neighbourhood of radius 1 pixel from it. | ||
33 | 180 | Let's emit the pressAndHold signal. */ | ||
34 | 181 | carousel.pressAndHold(index, delegateItem, delegateItem.y); | ||
35 | 182 | return; | ||
36 | 183 | } | ||
37 | 184 | |||
38 | 185 | stepAnimation.stop(); | ||
39 | 186 | newContentXAnimation.stop(); | ||
40 | 187 | |||
41 | 188 | newContentX = x; | ||
42 | 189 | newContentXAnimation.start(); | ||
43 | 190 | } | ||
44 | 191 | |||
45 | 162 | onMovementStarted: { | 192 | onMovementStarted: { |
46 | 163 | stepAnimation.stop() | 193 | stepAnimation.stop() |
47 | 164 | newContentXAnimation.stop() | 194 | newContentXAnimation.stop() |
48 | @@ -279,7 +309,14 @@ | |||
49 | 279 | 309 | ||
50 | 280 | anchors.fill: parent | 310 | anchors.fill: parent |
51 | 281 | 311 | ||
53 | 282 | onClicked: listView.itemClicked(index, item) | 312 | onClicked: { |
54 | 313 | listView.itemClicked(index, item) | ||
55 | 314 | } | ||
56 | 315 | |||
57 | 316 | onPressAndHold: { | ||
58 | 317 | listView.itemPressAndHold(index, item) | ||
59 | 318 | } | ||
60 | 319 | |||
61 | 283 | } | 320 | } |
62 | 284 | } | 321 | } |
63 | 285 | } | 322 | } |
64 | 286 | 323 | ||
65 | === added file 'Dash/Generic/GenericCarousel.qml' | |||
66 | --- Dash/Generic/GenericCarousel.qml 1970-01-01 00:00:00 +0000 | |||
67 | +++ Dash/Generic/GenericCarousel.qml 2013-07-17 16:28:25 +0000 | |||
68 | @@ -0,0 +1,58 @@ | |||
69 | 1 | /* | ||
70 | 2 | * Copyright (C) 2013 Canonical, Ltd. | ||
71 | 3 | * | ||
72 | 4 | * This program is free software; you can redistribute it and/or modify | ||
73 | 5 | * it under the terms of the GNU General Public License as published by | ||
74 | 6 | * the Free Software Foundation; version 3. | ||
75 | 7 | * | ||
76 | 8 | * This program is distributed in the hope that it will be useful, | ||
77 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
78 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
79 | 11 | * GNU General Public License for more details. | ||
80 | 12 | * | ||
81 | 13 | * You should have received a copy of the GNU General Public License | ||
82 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
83 | 15 | */ | ||
84 | 16 | |||
85 | 17 | import QtQuick 2.0 | ||
86 | 18 | import Ubuntu.Components 0.1 | ||
87 | 19 | import "../../Components" | ||
88 | 20 | import "../../Components/IconUtil.js" as IconUtil | ||
89 | 21 | |||
90 | 22 | Carousel { | ||
91 | 23 | id: genericCarousel | ||
92 | 24 | |||
93 | 25 | tileAspectRatio: 198 / 288 | ||
94 | 26 | minimumTileWidth: units.gu(13) | ||
95 | 27 | itemComponent: carouselDelegateGeneric | ||
96 | 28 | selectedItemScaleFactor: 1.14 | ||
97 | 29 | cacheBuffer: 1404 // 18px * 13gu * 6 | ||
98 | 30 | height: implicitHeight + units.gu(6) | ||
99 | 31 | |||
100 | 32 | Component { | ||
101 | 33 | id: carouselDelegateGeneric | ||
102 | 34 | |||
103 | 35 | BaseCarouselDelegate { | ||
104 | 36 | id: item | ||
105 | 37 | |||
106 | 38 | UbuntuShape { | ||
107 | 39 | anchors.fill: parent | ||
108 | 40 | radius: "medium" | ||
109 | 41 | borderSource: "" | ||
110 | 42 | image: Image { | ||
111 | 43 | asynchronous: true | ||
112 | 44 | sourceSize { width: item.width; height: item.height } | ||
113 | 45 | source: model ? IconUtil.from_gicon(model.icon) : "" | ||
114 | 46 | } | ||
115 | 47 | } | ||
116 | 48 | |||
117 | 49 | BorderImage { | ||
118 | 50 | anchors.centerIn: parent | ||
119 | 51 | opacity: 0.6 | ||
120 | 52 | source: "../../Components/graphics/non-selected.sci" | ||
121 | 53 | width: parent.width + units.gu(1.5) | ||
122 | 54 | height: parent.height + units.gu(1.5) | ||
123 | 55 | } | ||
124 | 56 | } | ||
125 | 57 | } | ||
126 | 58 | } | ||
127 | 0 | 59 | ||
128 | === added file 'Dash/Generic/GenericFilterGrid.qml' | |||
129 | --- Dash/Generic/GenericFilterGrid.qml 1970-01-01 00:00:00 +0000 | |||
130 | +++ Dash/Generic/GenericFilterGrid.qml 2013-07-17 16:28:25 +0000 | |||
131 | @@ -0,0 +1,59 @@ | |||
132 | 1 | /* | ||
133 | 2 | * Copyright (C) 2013 Canonical, Ltd. | ||
134 | 3 | * | ||
135 | 4 | * This program is free software; you can redistribute it and/or modify | ||
136 | 5 | * it under the terms of the GNU General Public License as published by | ||
137 | 6 | * the Free Software Foundation; version 3. | ||
138 | 7 | * | ||
139 | 8 | * This program is distributed in the hope that it will be useful, | ||
140 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
141 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
142 | 11 | * GNU General Public License for more details. | ||
143 | 12 | * | ||
144 | 13 | * You should have received a copy of the GNU General Public License | ||
145 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
146 | 15 | */ | ||
147 | 16 | |||
148 | 17 | import QtQuick 2.0 | ||
149 | 18 | import "../../Components" | ||
150 | 19 | import "../../Components/IconUtil.js" as IconUtil | ||
151 | 20 | |||
152 | 21 | FilterGrid { | ||
153 | 22 | id: filtergrid | ||
154 | 23 | |||
155 | 24 | filter: false | ||
156 | 25 | minimumHorizontalSpacing: units.gu(0.5) | ||
157 | 26 | delegateWidth: units.gu(11) | ||
158 | 27 | delegateHeight: units.gu(9.5) | ||
159 | 28 | verticalSpacing: units.gu(2) | ||
160 | 29 | |||
161 | 30 | property int iconWidth: units.gu(8) | ||
162 | 31 | property int iconHeight: units.gu(7.5) | ||
163 | 32 | |||
164 | 33 | signal clicked(int index, var delegateItem, real itemY) | ||
165 | 34 | signal pressAndHold(int index, var delegateItem, real itemY) | ||
166 | 35 | |||
167 | 36 | delegate: Tile { | ||
168 | 37 | id: tile | ||
169 | 38 | objectName: "delegate" + index | ||
170 | 39 | width: filtergrid.cellWidth | ||
171 | 40 | height: filtergrid.cellHeight | ||
172 | 41 | text: model.title | ||
173 | 42 | imageWidth: filtergrid.iconWidth | ||
174 | 43 | imageHeight: filtergrid.iconHeight | ||
175 | 44 | |||
176 | 45 | source: IconUtil.from_gicon(model.icon) | ||
177 | 46 | |||
178 | 47 | fillMode: Image.PreserveAspectCrop | ||
179 | 48 | |||
180 | 49 | onClicked: { | ||
181 | 50 | var data = { model: model } | ||
182 | 51 | filtergrid.clicked(index, data, tile.y) | ||
183 | 52 | } | ||
184 | 53 | |||
185 | 54 | onPressAndHold: { | ||
186 | 55 | var data = { model: model } | ||
187 | 56 | filtergrid.pressAndHold(index, data, tile.y) | ||
188 | 57 | } | ||
189 | 58 | } | ||
190 | 59 | } | ||
191 | 0 | 60 | ||
192 | === added file 'Dash/Generic/GenericFilterGridPotrait.qml' | |||
193 | --- Dash/Generic/GenericFilterGridPotrait.qml 1970-01-01 00:00:00 +0000 | |||
194 | +++ Dash/Generic/GenericFilterGridPotrait.qml 2013-07-17 16:28:25 +0000 | |||
195 | @@ -0,0 +1,30 @@ | |||
196 | 1 | /* | ||
197 | 2 | * Copyright (C) 2013 Canonical, Ltd. | ||
198 | 3 | * | ||
199 | 4 | * This program is free software; you can redistribute it and/or modify | ||
200 | 5 | * it under the terms of the GNU General Public License as published by | ||
201 | 6 | * the Free Software Foundation; version 3. | ||
202 | 7 | * | ||
203 | 8 | * This program is distributed in the hope that it will be useful, | ||
204 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
205 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
206 | 11 | * GNU General Public License for more details. | ||
207 | 12 | * | ||
208 | 13 | * You should have received a copy of the GNU General Public License | ||
209 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
210 | 15 | */ | ||
211 | 16 | |||
212 | 17 | import QtQuick 2.0 | ||
213 | 18 | import "../../Components" | ||
214 | 19 | |||
215 | 20 | GenericFilterGrid { | ||
216 | 21 | id: filtergrid | ||
217 | 22 | |||
218 | 23 | minimumHorizontalSpacing: units.gu(0.5) | ||
219 | 24 | delegateWidth: units.gu(11) | ||
220 | 25 | delegateHeight: units.gu(18) | ||
221 | 26 | verticalSpacing: units.gu(2) | ||
222 | 27 | |||
223 | 28 | iconWidth: (width / columns) * 0.8 | ||
224 | 29 | iconHeight: iconWidth * 16 / 11 | ||
225 | 30 | } | ||
226 | 0 | 31 | ||
227 | === modified file 'Dash/GenericScopeView.qml' | |||
228 | --- Dash/GenericScopeView.qml 2013-07-10 12:58:58 +0000 | |||
229 | +++ Dash/GenericScopeView.qml 2013-07-17 16:28:25 +0000 | |||
230 | @@ -56,53 +56,45 @@ | |||
231 | 56 | delegate: ListItems.Base { | 56 | delegate: ListItems.Base { |
232 | 57 | highlightWhenPressed: false | 57 | highlightWhenPressed: false |
233 | 58 | 58 | ||
238 | 59 | FilterGrid { | 59 | Loader { |
239 | 60 | id: filtergrid | 60 | id: rendererLoader |
236 | 61 | model: results | ||
237 | 62 | |||
240 | 63 | anchors { | 61 | anchors { |
241 | 64 | top: parent.top | 62 | top: parent.top |
242 | 65 | left: parent.left | 63 | left: parent.left |
243 | 66 | right: parent.right | 64 | right: parent.right |
244 | 67 | } | 65 | } |
245 | 68 | 66 | ||
283 | 69 | filter: false | 67 | source: getRenderer(model.renderer, model.contentType) |
284 | 70 | minimumHorizontalSpacing: units.gu(0.5) | 68 | |
285 | 71 | delegateWidth: units.gu(11) | 69 | onLoaded: { |
286 | 72 | delegateHeight: units.gu(18) | 70 | item.model = results |
287 | 73 | verticalSpacing: units.gu(2) | 71 | } |
288 | 74 | 72 | ||
289 | 75 | delegate: Tile { | 73 | Connections { |
290 | 76 | width: filtergrid.cellWidth | 74 | target: rendererLoader.item |
291 | 77 | height: filtergrid.cellHeight | 75 | onClicked: { |
292 | 78 | text: title | 76 | effect.positionPx = mapToItem(categoryView, 0, itemY).y |
293 | 79 | imageWidth: units.gu(11) | 77 | scopeView.scope.activate(delegateItem.model.uri, |
294 | 80 | imageHeight: units.gu(16) | 78 | delegateItem.model.icon, |
295 | 81 | 79 | delegateItem.model.category, | |
296 | 82 | source: IconUtil.from_gicon(icon) | 80 | 0, |
297 | 83 | 81 | delegateItem.model.mimetype, | |
298 | 84 | MouseArea { | 82 | delegateItem.model.title, |
299 | 85 | anchors { | 83 | delegateItem.model.comment, |
300 | 86 | fill: parent | 84 | delegateItem.model.dndUri, |
301 | 87 | } | 85 | delegateItem.model.metadata) |
302 | 88 | onClicked: { | 86 | } |
303 | 89 | mouse.accepted = true | 87 | onPressAndHold: { |
304 | 90 | effect.positionPx = mapToItem(categoryView, 0, 0).y | 88 | effect.positionPx = mapToItem(categoryView, 0, itemY).y |
305 | 91 | scopeView.scope.activate(uri, icon, | 89 | scopeView.scope.preview( delegateItem.model.uri, |
306 | 92 | category, 0, | 90 | delegateItem.model.icon, |
307 | 93 | mimetype, title, | 91 | delegateItem.model.category, |
308 | 94 | comment, dndUri, | 92 | 0, |
309 | 95 | metadata) | 93 | delegateItem.model.mimetype, |
310 | 96 | } | 94 | delegateItem.model.title, |
311 | 97 | onPressAndHold: { | 95 | delegateItem.model.comment, |
312 | 98 | mouse.accepted = true | 96 | delegateItem.model.dndUri, |
313 | 99 | effect.positionPx = mapToItem(categoryView, 0, 0).y | 97 | delegateItem.model.metadata) |
277 | 100 | scopeView.scope.preview(uri, icon, | ||
278 | 101 | category, 0, | ||
279 | 102 | mimetype, title, | ||
280 | 103 | comment, dndUri, | ||
281 | 104 | metadata) | ||
282 | 105 | } | ||
314 | 106 | } | 98 | } |
315 | 107 | } | 99 | } |
316 | 108 | } | 100 | } |
317 | @@ -122,6 +114,19 @@ | |||
318 | 122 | } | 114 | } |
319 | 123 | } | 115 | } |
320 | 124 | 116 | ||
321 | 117 | function getRenderer(rendererId, contentType) { | ||
322 | 118 | switch (rendererId) { | ||
323 | 119 | case "grid": { | ||
324 | 120 | switch (contentType) { | ||
325 | 121 | case "video": return "Generic/GenericFilterGridPotrait.qml"; | ||
326 | 122 | default: return "Generic/GenericFilterGrid.qml"; | ||
327 | 123 | } | ||
328 | 124 | } | ||
329 | 125 | case "carousel": return "Generic/GenericCarousel.qml"; | ||
330 | 126 | default: return "Generic/GenericFilterGrid.qml"; | ||
331 | 127 | } | ||
332 | 128 | } | ||
333 | 129 | |||
334 | 125 | OpenEffect { | 130 | OpenEffect { |
335 | 126 | id: effect | 131 | id: effect |
336 | 127 | anchors { | 132 | anchors { |
FAILED: Continuous integration, rev:111 jenkins. qa.ubuntu. com/job/ unity8- ci/276/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/1137 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- saucy/625 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/276/ console jenkins. qa.ubuntu. com/job/ unity8- saucy-i386- ci/276 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy/1141 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy/1141/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- saucy/969
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity8- ci/276/ rebuild
http://