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
1=== modified file 'qml/Dash/CardCarousel.qml'
2--- qml/Dash/CardCarousel.qml 2014-02-07 16:23:09 +0000
3+++ qml/Dash/CardCarousel.qml 2014-03-06 18:07:09 +0000
4@@ -32,14 +32,6 @@
5 height: carousel.implicitHeight + units.gu(6)
6 verticalSpacing: units.gu(3)
7
8- CardTool {
9- id: cardTool
10-
11- template: cardCarousel.template
12- components: cardCarousel.components
13- viewWidth: cardCarousel.width
14- }
15-
16 Carousel {
17 id: carousel
18 anchors.fill: parent
19@@ -47,7 +39,7 @@
20 // FIXME we need to "reverse" the carousel to make the selected item the size
21 // and push others back.
22 minimumTileWidth: cardTool.cardWidth / selectedItemScaleFactor
23- selectedItemScaleFactor: 1.38
24+ selectedItemScaleFactor: cardTool.carouselSelectedItemScaleFactor
25 cacheBuffer: 1404 // 18px * 13gu * 6
26 model: cardCarousel.model
27 highlightIndex: cardCarousel.highlightIndex
28@@ -63,8 +55,8 @@
29 objectName: "delegate" + index
30 headerHeight: carousel.headerHeight
31 cardData: model
32- template: cardCarousel.template
33- components: cardCarousel.components
34+ template: cardTool.template
35+ components: cardTool.components
36
37 property bool explicitlyScaled
38 property var model
39
40=== modified file 'qml/Dash/CardFilterGrid.qml'
41--- qml/Dash/CardFilterGrid.qml 2014-02-20 10:58:13 +0000
42+++ qml/Dash/CardFilterGrid.qml 2014-03-06 18:07:09 +0000
43@@ -26,16 +26,6 @@
44 verticalSpacing: units.gu(1)
45 collapsedRowCount: Math.min(2, template && template["collapsed-rows"] || 2)
46
47- CardTool {
48- id: cardTool
49-
50- template: genericFilterGrid.template
51- // We can't trust the template since it may happen it is carousel
52- // that is being should as a grid because of the lack of elements
53- categoryLayout: "grid"
54- components: genericFilterGrid.components
55- }
56-
57 delegate: Item {
58 width: genericFilterGrid.cellWidth
59 height: genericFilterGrid.cellHeight
60@@ -47,8 +37,8 @@
61 anchors.horizontalCenter: parent.horizontalCenter
62 objectName: "delegate" + index
63 cardData: model
64- template: genericFilterGrid.template
65- components: genericFilterGrid.components
66+ template: cardTool.template
67+ components: cardTool.components
68
69 headerAlignment: cardTool.headerAlignment
70
71
72=== modified file 'qml/Dash/DashRenderer.qml'
73--- qml/Dash/DashRenderer.qml 2014-02-26 11:04:54 +0000
74+++ qml/Dash/DashRenderer.qml 2014-03-06 18:07:09 +0000
75@@ -50,6 +50,11 @@
76 // The model to renderer
77 property var model
78
79+ /*!
80+ \brief CardTool component.
81+ */
82+ property var cardTool
83+
84 /// Emitted when the user clicked on an item
85 /// @param index is the index of the clicked item
86 /// @param itemY is y of the clicked delegate
87@@ -62,10 +67,4 @@
88
89 function startFilterAnimation(filter) {
90 }
91-
92- /// Category template definition from the scope
93- property var template
94-
95- /// Component mapping and configuration from the scope
96- property var components
97 }
98
99=== modified file 'qml/Dash/GenericScopeView.qml'
100--- qml/Dash/GenericScopeView.qml 2014-03-06 11:06:07 +0000
101+++ qml/Dash/GenericScopeView.qml 2014-03-06 18:07:09 +0000
102@@ -138,6 +138,15 @@
103 readonly property string category: categoryId
104 readonly property var item: rendererLoader.item
105
106+ CardTool {
107+ id: cardTool
108+
109+ count: results.count
110+ template: model.renderer
111+ components: model.components
112+ viewWidth: parent.width
113+ }
114+
115 Loader {
116 id: rendererLoader
117 anchors {
118@@ -146,7 +155,14 @@
119 right: parent.right
120 }
121
122- source: getRenderer(model.renderer, results)
123+ source: {
124+ switch (cardTool.categoryLayout) {
125+ case "carousel": return "CardCarousel.qml";
126+ case "running-apps": return "Apps/RunningApplicationsGrid.qml";
127+ case "grid":
128+ default: return "CardFilterGrid.qml";
129+ }
130+ }
131
132 onLoaded: {
133 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
134@@ -170,9 +186,7 @@
135 }
136 }
137 updateDelegateCreationRange();
138- // FIXME: should be "template", not "renderer"
139- item.template = Qt.binding(function() { return model.renderer });
140- item.components = Qt.binding(function() { return model.components });
141+ item.cardTool = cardTool;
142 }
143
144 Component.onDestruction: {
145@@ -325,22 +339,4 @@
146 }
147 }
148 }
149-
150- function getRenderer(template, results) {
151- var layout = template["category-layout"];
152-
153- if (layout == "running-apps") {
154- return "Apps/RunningApplicationsGrid.qml";
155- }
156-
157- if (layout === "carousel") {
158- // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
159- if (results.count <= 4) layout = "grid";
160- }
161- switch (layout) {
162- case "carousel": return "CardCarousel.qml";
163- case "grid":
164- default: return "CardFilterGrid.qml";
165- }
166- }
167 }
168
169=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
170--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-02-12 23:25:47 +0000
171+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-03-06 18:07:09 +0000
172@@ -300,21 +300,6 @@
173 tryCompare(category, "filtered", true);
174 }
175
176- function test_getRendererCarouselGridFallback() {
177- var template = new Object()
178- template["category-layout"] = "carousel"
179- var results = new Object()
180- var renderer
181-
182- results.count = 5
183- renderer = genericScopeView.getRenderer(template, results)
184- compare(renderer, "CardCarousel.qml")
185-
186- results.count = 4
187- renderer = genericScopeView.getRenderer(template, results)
188- compare(renderer, "CardFilterGrid.qml")
189- }
190-
191 function test_showPreviewCarousel() {
192 tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != null; }, true);
193 var tile = findChild(genericScopeView, "carouselDelegate");

Subscribers

People subscribed via source and target branches

to all changes: