Merge lp:~unity-team/unity8/carouselTool-new-dash into lp:~unity-team/unity8/new-scopes-clean-to-trunk

Proposed by Andrea Cimitan
Status: Merged
Merged at revision: 713
Proposed branch: lp:~unity-team/unity8/carouselTool-new-dash
Merge into: lp:~unity-team/unity8/new-scopes-clean-to-trunk
Prerequisite: lp:~unity-team/unity8/carouselTool
Diff against target: 193 lines (+28/-66)
5 files modified
qml/Dash/CardCarousel.qml (+3/-11)
qml/Dash/CardFilterGrid.qml (+2/-12)
qml/Dash/DashRenderer.qml (+5/-6)
qml/Dash/GenericScopeView.qml (+18/-22)
tests/qmltests/Dash/tst_GenericScopeView.qml (+0/-15)
To merge this branch: bzr merge lp:~unity-team/unity8/carouselTool-new-dash
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Review via email: mp+209746@code.launchpad.net

Commit message

Adds carousel dynamic switch

Description of the change

Adds carousel dynamic switch

 * Are there any related MPs required for this MP to build/function as expected? Please list.
No
 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
No
 * If you changed the UI, has there been a design review?
No

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

file:///home/tsdgeos_work/phablet/unity8/carouselTool-new-dash/qml/Shell.qml:170:9: Type Dash unavailable
             Dash {
             ^
file:///home/tsdgeos_work/phablet/unity8/carouselTool-new-dash/qml/Dash/Dash.qml:100:5: Type ScopeItem unavailable
         ScopeItem {
         ^
file:///home/tsdgeos_work/phablet/unity8/carouselTool-new-dash/qml/Dash/ScopeItem.qml:42:9: Type GenericScopeView unavailable
             GenericScopeView {
             ^
file:///home/tsdgeos_work/phablet/unity8/carouselTool-new-dash/qml/Dash/GenericScopeView.qml:141:13: Type CardTool unavailable
                 CardTool {
                 ^
file:///home/tsdgeos_work/phablet/unity8/carouselTool-new-dash/qml/Dash/CardTool.qml:71:21: Duplicate property name
         property string categoryLayout: template ? template["category-layout"] : ""
                         ^

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

Loooks good :)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/Dash/CardCarousel.qml'
--- qml/Dash/CardCarousel.qml 2014-02-07 16:23:09 +0000
+++ qml/Dash/CardCarousel.qml 2014-03-06 18:07:09 +0000
@@ -32,14 +32,6 @@
32 height: carousel.implicitHeight + units.gu(6)32 height: carousel.implicitHeight + units.gu(6)
33 verticalSpacing: units.gu(3)33 verticalSpacing: units.gu(3)
3434
35 CardTool {
36 id: cardTool
37
38 template: cardCarousel.template
39 components: cardCarousel.components
40 viewWidth: cardCarousel.width
41 }
42
43 Carousel {35 Carousel {
44 id: carousel36 id: carousel
45 anchors.fill: parent37 anchors.fill: parent
@@ -47,7 +39,7 @@
47 // FIXME we need to "reverse" the carousel to make the selected item the size39 // FIXME we need to "reverse" the carousel to make the selected item the size
48 // and push others back.40 // and push others back.
49 minimumTileWidth: cardTool.cardWidth / selectedItemScaleFactor41 minimumTileWidth: cardTool.cardWidth / selectedItemScaleFactor
50 selectedItemScaleFactor: 1.3842 selectedItemScaleFactor: cardTool.carouselSelectedItemScaleFactor
51 cacheBuffer: 1404 // 18px * 13gu * 643 cacheBuffer: 1404 // 18px * 13gu * 6
52 model: cardCarousel.model44 model: cardCarousel.model
53 highlightIndex: cardCarousel.highlightIndex45 highlightIndex: cardCarousel.highlightIndex
@@ -63,8 +55,8 @@
63 objectName: "delegate" + index55 objectName: "delegate" + index
64 headerHeight: carousel.headerHeight56 headerHeight: carousel.headerHeight
65 cardData: model57 cardData: model
66 template: cardCarousel.template58 template: cardTool.template
67 components: cardCarousel.components59 components: cardTool.components
6860
69 property bool explicitlyScaled61 property bool explicitlyScaled
70 property var model62 property var model
7163
=== modified file 'qml/Dash/CardFilterGrid.qml'
--- qml/Dash/CardFilterGrid.qml 2014-02-20 10:58:13 +0000
+++ qml/Dash/CardFilterGrid.qml 2014-03-06 18:07:09 +0000
@@ -26,16 +26,6 @@
26 verticalSpacing: units.gu(1)26 verticalSpacing: units.gu(1)
27 collapsedRowCount: Math.min(2, template && template["collapsed-rows"] || 2)27 collapsedRowCount: Math.min(2, template && template["collapsed-rows"] || 2)
2828
29 CardTool {
30 id: cardTool
31
32 template: genericFilterGrid.template
33 // We can't trust the template since it may happen it is carousel
34 // that is being should as a grid because of the lack of elements
35 categoryLayout: "grid"
36 components: genericFilterGrid.components
37 }
38
39 delegate: Item {29 delegate: Item {
40 width: genericFilterGrid.cellWidth30 width: genericFilterGrid.cellWidth
41 height: genericFilterGrid.cellHeight31 height: genericFilterGrid.cellHeight
@@ -47,8 +37,8 @@
47 anchors.horizontalCenter: parent.horizontalCenter37 anchors.horizontalCenter: parent.horizontalCenter
48 objectName: "delegate" + index38 objectName: "delegate" + index
49 cardData: model39 cardData: model
50 template: genericFilterGrid.template40 template: cardTool.template
51 components: genericFilterGrid.components41 components: cardTool.components
5242
53 headerAlignment: cardTool.headerAlignment43 headerAlignment: cardTool.headerAlignment
5444
5545
=== modified file 'qml/Dash/DashRenderer.qml'
--- qml/Dash/DashRenderer.qml 2014-02-26 11:04:54 +0000
+++ qml/Dash/DashRenderer.qml 2014-03-06 18:07:09 +0000
@@ -50,6 +50,11 @@
50 // The model to renderer50 // The model to renderer
51 property var model51 property var model
5252
53 /*!
54 \brief CardTool component.
55 */
56 property var cardTool
57
53 /// Emitted when the user clicked on an item58 /// Emitted when the user clicked on an item
54 /// @param index is the index of the clicked item59 /// @param index is the index of the clicked item
55 /// @param itemY is y of the clicked delegate60 /// @param itemY is y of the clicked delegate
@@ -62,10 +67,4 @@
6267
63 function startFilterAnimation(filter) {68 function startFilterAnimation(filter) {
64 }69 }
65
66 /// Category template definition from the scope
67 property var template
68
69 /// Component mapping and configuration from the scope
70 property var components
71}70}
7271
=== modified file 'qml/Dash/GenericScopeView.qml'
--- qml/Dash/GenericScopeView.qml 2014-03-06 11:06:07 +0000
+++ qml/Dash/GenericScopeView.qml 2014-03-06 18:07:09 +0000
@@ -138,6 +138,15 @@
138 readonly property string category: categoryId138 readonly property string category: categoryId
139 readonly property var item: rendererLoader.item139 readonly property var item: rendererLoader.item
140140
141 CardTool {
142 id: cardTool
143
144 count: results.count
145 template: model.renderer
146 components: model.components
147 viewWidth: parent.width
148 }
149
141 Loader {150 Loader {
142 id: rendererLoader151 id: rendererLoader
143 anchors {152 anchors {
@@ -146,7 +155,14 @@
146 right: parent.right155 right: parent.right
147 }156 }
148157
149 source: getRenderer(model.renderer, results)158 source: {
159 switch (cardTool.categoryLayout) {
160 case "carousel": return "CardCarousel.qml";
161 case "running-apps": return "Apps/RunningApplicationsGrid.qml";
162 case "grid":
163 default: return "CardFilterGrid.qml";
164 }
165 }
150166
151 onLoaded: {167 onLoaded: {
152 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {168 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
@@ -170,9 +186,7 @@
170 }186 }
171 }187 }
172 updateDelegateCreationRange();188 updateDelegateCreationRange();
173 // FIXME: should be "template", not "renderer"189 item.cardTool = cardTool;
174 item.template = Qt.binding(function() { return model.renderer });
175 item.components = Qt.binding(function() { return model.components });
176 }190 }
177191
178 Component.onDestruction: {192 Component.onDestruction: {
@@ -325,22 +339,4 @@
325 }339 }
326 }340 }
327 }341 }
328
329 function getRenderer(template, results) {
330 var layout = template["category-layout"];
331
332 if (layout == "running-apps") {
333 return "Apps/RunningApplicationsGrid.qml";
334 }
335
336 if (layout === "carousel") {
337 // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
338 if (results.count <= 4) layout = "grid";
339 }
340 switch (layout) {
341 case "carousel": return "CardCarousel.qml";
342 case "grid":
343 default: return "CardFilterGrid.qml";
344 }
345 }
346}342}
347343
=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-02-12 23:25:47 +0000
+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-03-06 18:07:09 +0000
@@ -300,21 +300,6 @@
300 tryCompare(category, "filtered", true);300 tryCompare(category, "filtered", true);
301 }301 }
302302
303 function test_getRendererCarouselGridFallback() {
304 var template = new Object()
305 template["category-layout"] = "carousel"
306 var results = new Object()
307 var renderer
308
309 results.count = 5
310 renderer = genericScopeView.getRenderer(template, results)
311 compare(renderer, "CardCarousel.qml")
312
313 results.count = 4
314 renderer = genericScopeView.getRenderer(template, results)
315 compare(renderer, "CardFilterGrid.qml")
316 }
317
318 function test_showPreviewCarousel() {303 function test_showPreviewCarousel() {
319 tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != null; }, true);304 tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != null; }, true);
320 var tile = findChild(genericScopeView, "carouselDelegate");305 var tile = findChild(genericScopeView, "carouselDelegate");

Subscribers

People subscribed via source and target branches

to all changes: