Merge lp:~aacid/unity8/recoverArtIfChanges into lp:unity8
- recoverArtIfChanges
- Merge into trunk
Proposed by
Albert Astals Cid
Status: | Superseded |
---|---|
Proposed branch: | lp:~aacid/unity8/recoverArtIfChanges |
Merge into: | lp:unity8 |
Diff against target: |
1484 lines (+166/-446) 42 files modified
plugins/Dash/CardCreator.js (+60/-55) plugins/Dash/CardCreatorCache.qml (+2/-2) qml/Dash/CardCarousel.qml (+0/-1) qml/Dash/CardGrid.qml (+0/-2) qml/Dash/CardTool.qml (+6/-2) qml/Dash/GenericScopeView.qml (+2/-2) tests/plugins/Dash/cardcreator/1.res (+9/-34) tests/plugins/Dash/cardcreator/1.res.cardcreator (+8/-33) tests/plugins/Dash/cardcreator/1.tst (+1/-0) tests/plugins/Dash/cardcreator/10.res (+0/-9) tests/plugins/Dash/cardcreator/10.res.cardcreator (+0/-9) tests/plugins/Dash/cardcreator/10.tst (+1/-0) tests/plugins/Dash/cardcreator/11.res (+11/-36) tests/plugins/Dash/cardcreator/11.res.cardcreator (+10/-35) tests/plugins/Dash/cardcreator/11.tst (+1/-0) tests/plugins/Dash/cardcreator/2.res (+0/-9) tests/plugins/Dash/cardcreator/2.res.cardcreator (+0/-9) tests/plugins/Dash/cardcreator/2.tst (+1/-0) tests/plugins/Dash/cardcreator/3.res (+5/-40) tests/plugins/Dash/cardcreator/3.res.cardcreator (+5/-40) tests/plugins/Dash/cardcreator/3.tst (+1/-0) tests/plugins/Dash/cardcreator/4.res (+1/-2) tests/plugins/Dash/cardcreator/4.res.cardcreator (+1/-2) tests/plugins/Dash/cardcreator/4.tst (+1/-0) tests/plugins/Dash/cardcreator/5.res (+2/-42) tests/plugins/Dash/cardcreator/5.res.cardcreator (+2/-42) tests/plugins/Dash/cardcreator/5.tst (+1/-0) tests/plugins/Dash/cardcreator/6.res (+1/-2) tests/plugins/Dash/cardcreator/6.res.cardcreator (+1/-2) tests/plugins/Dash/cardcreator/6.tst (+1/-0) tests/plugins/Dash/cardcreator/7.res (+0/-9) tests/plugins/Dash/cardcreator/7.res.cardcreator (+0/-9) tests/plugins/Dash/cardcreator/7.tst (+1/-0) tests/plugins/Dash/cardcreator/8.res (+1/-2) tests/plugins/Dash/cardcreator/8.res.cardcreator (+1/-2) tests/plugins/Dash/cardcreator/8.tst (+1/-0) tests/plugins/Dash/cardcreator/9.res (+1/-2) tests/plugins/Dash/cardcreator/9.res.cardcreator (+1/-2) tests/plugins/Dash/cardcreator/9.tst (+1/-0) tests/plugins/Dash/cardcreatortest.cpp (+9/-6) tests/plugins/Dash/cardcreatortest.qml (+4/-4) tests/qmltests/Dash/tst_Card.qml (+12/-0) |
To merge this branch: | bzr merge lp:~aacid/unity8/recoverArtIfChanges |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2016-03-18.
Commit message
Change the art back to the cardData value if it changes from broken to valid image
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
Prereq
* Did you perform an exploratory manual test run of your code change and any related functionality?
No since as far as i know there's no scope doing this
* Did you make sure that your branch does not contain spurious tags?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
N/A
To post a comment you must log in.
- 2216. By Albert Astals Cid
-
Merge
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'plugins/Dash/CardCreator.js' |
2 | --- plugins/Dash/CardCreator.js 2016-03-10 16:53:04 +0000 |
3 | +++ plugins/Dash/CardCreator.js 2016-03-18 11:31:31 +0000 |
4 | @@ -59,14 +59,30 @@ |
5 | } \n\ |
6 | }\n'; |
7 | |
8 | +// %1 is the aspect of the UbuntuShape |
9 | +var kArtUbuntuShapeCode = 'UbuntuShape { \n\ |
10 | + anchors.fill: parent; \n\ |
11 | + source: artImage; \n\ |
12 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\ |
13 | + radius: "medium"; \n\ |
14 | + aspect: %1; \n\ |
15 | + }'; |
16 | + |
17 | +var kArtProportionalShapeCode = 'ProportionalShape { \n\ |
18 | + anchors.fill: parent; \n\ |
19 | + source: artImage; \n\ |
20 | + aspect: UbuntuShape.DropShadow; \n\ |
21 | + }'; |
22 | + |
23 | // %1 is used as anchors of artShapeHolder |
24 | // %2 is used as image width |
25 | // %3 is used as image height |
26 | -// %4 is used for artShapeSource.hideSource and inner Loader visible |
27 | +// %4 is whether the image should be visible |
28 | // %5 is used as aspect ratio fallback |
29 | // %6 is whether the loader should be asynchronous or not |
30 | -// %7 is injected as code to artImage |
31 | -// %8 is used as image fallback |
32 | +// %7 is the shape code we want to use |
33 | +// %8 is injected as code to artImage |
34 | +// %9 is used as image fallback |
35 | var kArtShapeHolderCode = 'Item { \n\ |
36 | id: artShapeHolder; \n\ |
37 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\ |
38 | @@ -75,7 +91,8 @@ |
39 | Loader { \n\ |
40 | id: artShapeLoader; \n\ |
41 | objectName: "artShapeLoader"; \n\ |
42 | - readonly property string cardArt: cardData && cardData["art"] || %8; \n\ |
43 | + readonly property string cardArt: cardData && cardData["art"] || %9; \n\ |
44 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\ |
45 | active: cardArt != ""; \n\ |
46 | asynchronous: %6; \n\ |
47 | visible: status == Loader.Ready; \n\ |
48 | @@ -84,39 +101,7 @@ |
49 | objectName: "artShape"; \n\ |
50 | visible: image.status == Image.Ready; \n\ |
51 | readonly property alias image: artImage; \n\ |
52 | - ShaderEffectSource { \n\ |
53 | - id: artShapeSource; \n\ |
54 | - sourceItem: artImage; \n\ |
55 | - anchors.centerIn: parent; \n\ |
56 | - width: 1; \n\ |
57 | - height: 1; \n\ |
58 | - hideSource: %4; \n\ |
59 | - } \n\ |
60 | - Loader { \n\ |
61 | - anchors.fill: parent; \n\ |
62 | - visible: %4; \n\ |
63 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\ |
64 | - Component { \n\ |
65 | - id: artShapeShapeComponent; \n\ |
66 | - UbuntuShape { \n\ |
67 | - source: artShapeSource; \n\ |
68 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\ |
69 | - radius: "medium"; \n\ |
70 | - aspect: { \n\ |
71 | - switch (root.artShapeStyle) { \n\ |
72 | - case "inset": return UbuntuShape.Inset; \n\ |
73 | - case "shadow": return UbuntuShape.DropShadow; \n\ |
74 | - default: \n\ |
75 | - case "flat": return UbuntuShape.Flat; \n\ |
76 | - } \n\ |
77 | - } \n\ |
78 | - } \n\ |
79 | - } \n\ |
80 | - Component { \n\ |
81 | - id: artShapeIconComponent; \n\ |
82 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } \n\ |
83 | - } \n\ |
84 | - } \n\ |
85 | + %7 \n\ |
86 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\ |
87 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\ |
88 | Component.onCompleted: { updateWidthHeightBindings(); } \n\ |
89 | @@ -135,9 +120,10 @@ |
90 | objectName: "artImage"; \n\ |
91 | source: artShapeLoader.cardArt; \n\ |
92 | asynchronous: %6; \n\ |
93 | + visible: %4; \n\ |
94 | width: %2; \n\ |
95 | height: %3; \n\ |
96 | - %7 \n\ |
97 | + %8 \n\ |
98 | } \n\ |
99 | } \n\ |
100 | } \n\ |
101 | @@ -325,7 +311,7 @@ |
102 | id: touchdown; \n\ |
103 | objectName: "touchdown"; \n\ |
104 | anchors { %1 } \n\ |
105 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; \n\ |
106 | + visible: root.pressed; \n\ |
107 | radius: "medium"; \n\ |
108 | borderSource: "radius_pressed.sci" \n\ |
109 | }\n'; |
110 | @@ -408,7 +394,7 @@ |
111 | return colorString; |
112 | } |
113 | |
114 | -function cardString(template, components, isCardTool) { |
115 | +function cardString(template, components, isCardTool, artShapeStyle) { |
116 | var code; |
117 | |
118 | var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false"; |
119 | @@ -416,7 +402,6 @@ |
120 | code = 'AbstractButton { \n\ |
121 | id: root; \n\ |
122 | property var cardData; \n\ |
123 | - property string artShapeStyle: "inset"; \n\ |
124 | property string backgroundShapeStyle: "inset"; \n\ |
125 | property real fontScale: 1.0; \n\ |
126 | property var scopeStyle: null; \n\ |
127 | @@ -513,17 +498,35 @@ |
128 | var fallbackStatusCode = ""; |
129 | var fallbackURICode = '""'; |
130 | if (fallback !== "") { |
131 | - // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode |
132 | - // which in kArtShapeHolderCode is %8 |
133 | - fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %8;'; |
134 | + // fallbackStatusCode has %9 in it because we want to substitute it for fallbackURICode |
135 | + // which in kArtShapeHolderCode is %9 |
136 | + fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %9;'; |
137 | fallbackURICode = 'decodeURI("%1")'.arg(fallback); |
138 | } |
139 | + var artShapeHolderShapeCode; |
140 | + if (!isConciergeMode) { |
141 | + if (artShapeStyle === "icon") { |
142 | + artShapeHolderShapeCode = kArtProportionalShapeCode; |
143 | + } else { |
144 | + var artShapeHolderShapeAspect; |
145 | + switch (artShapeStyle) { |
146 | + case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break; |
147 | + case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break; |
148 | + default: |
149 | + case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break; |
150 | + } |
151 | + artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(artShapeHolderShapeAspect); |
152 | + } |
153 | + } else { |
154 | + artShapeHolderShapeCode = ""; |
155 | + } |
156 | code += kArtShapeHolderCode.arg(artAnchors) |
157 | .arg(widthCode) |
158 | .arg(heightCode) |
159 | - .arg(isConciergeMode ? "false" : "true") |
160 | + .arg(isConciergeMode ? "true" : "false") |
161 | .arg(aspectRatio) |
162 | .arg(asynchronous) |
163 | + .arg(artShapeHolderShapeCode) |
164 | .arg(fallbackStatusCode) |
165 | .arg(fallbackURICode); |
166 | } else { |
167 | @@ -848,15 +851,17 @@ |
168 | code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor); |
169 | } |
170 | |
171 | - var touchdownAnchors; |
172 | - if (hasBackground) { |
173 | - touchdownAnchors = 'fill: backgroundLoader'; |
174 | - } else if (touchdownOnArtShape) { |
175 | - touchdownAnchors = 'fill: artShapeHolder'; |
176 | - } else { |
177 | - touchdownAnchors = 'fill: root' |
178 | + if (artShapeStyle != "shadow" && artShapeStyle != "icon") { |
179 | + var touchdownAnchors; |
180 | + if (hasBackground) { |
181 | + touchdownAnchors = 'fill: backgroundLoader'; |
182 | + } else if (touchdownOnArtShape) { |
183 | + touchdownAnchors = 'fill: artShapeHolder'; |
184 | + } else { |
185 | + touchdownAnchors = 'fill: root' |
186 | + } |
187 | + code += kTouchdownCode.arg(touchdownAnchors); |
188 | } |
189 | - code += kTouchdownCode.arg(touchdownAnchors); |
190 | |
191 | var implicitHeight = 'implicitHeight: '; |
192 | if (hasSummary) { |
193 | @@ -889,13 +894,13 @@ |
194 | return code; |
195 | } |
196 | |
197 | -function createCardComponent(parent, template, components, isCardTool, identifier) { |
198 | +function createCardComponent(parent, template, components, isCardTool, artShapeStyle, identifier) { |
199 | var imports = 'import QtQuick 2.4; \n\ |
200 | import Ubuntu.Components 1.3; \n\ |
201 | import Ubuntu.Settings.Components 0.1; \n\ |
202 | import Dash 0.1;\n\ |
203 | import Utils 0.1;\n'; |
204 | - var card = cardString(template, components, isCardTool); |
205 | + var card = cardString(template, components, isCardTool, artShapeStyle); |
206 | var code = imports + 'Component {\n' + card + '}\n'; |
207 | |
208 | try { |
209 | |
210 | === modified file 'plugins/Dash/CardCreatorCache.qml' |
211 | --- plugins/Dash/CardCreatorCache.qml 2016-02-16 14:26:58 +0000 |
212 | +++ plugins/Dash/CardCreatorCache.qml 2016-03-18 11:31:31 +0000 |
213 | @@ -23,7 +23,7 @@ |
214 | |
215 | property var cache: new Object(); |
216 | |
217 | - function getCardComponent(template, components, isCardTool) { |
218 | + function getCardComponent(template, components, isCardTool, artShapeStyle) { |
219 | if (template === undefined || components === undefined) |
220 | return undefined; |
221 | |
222 | @@ -32,7 +32,7 @@ |
223 | var allString = tString + cString + isCardTool; |
224 | var component = cache[allString]; |
225 | if (component === undefined) { |
226 | - component = CardCreator.createCardComponent(root, template, components, isCardTool, allString); |
227 | + component = CardCreator.createCardComponent(root, template, components, isCardTool, artShapeStyle, allString); |
228 | cache[allString] = component; |
229 | } |
230 | return component; |
231 | |
232 | === modified file 'qml/Dash/CardCarousel.qml' |
233 | --- qml/Dash/CardCarousel.qml 2016-02-16 15:09:55 +0000 |
234 | +++ qml/Dash/CardCarousel.qml 2016-03-18 11:31:31 +0000 |
235 | @@ -66,7 +66,6 @@ |
236 | item.cardData = Qt.binding(function() { return model; }); |
237 | item.fontScale = Qt.binding(function() { return carousel.fontScale; }); |
238 | item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; }); |
239 | - item.artShapeStyle = "shadow"; |
240 | item.scopeStyle = cardCarousel.scopeStyle; |
241 | } |
242 | } |
243 | |
244 | === modified file 'qml/Dash/CardGrid.qml' |
245 | --- qml/Dash/CardGrid.qml 2016-02-16 15:09:55 +0000 |
246 | +++ qml/Dash/CardGrid.qml 2016-03-18 11:31:31 +0000 |
247 | @@ -25,7 +25,6 @@ |
248 | if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2; |
249 | return cardTool.template["collapsed-rows"]; |
250 | } |
251 | - property string artShapeStyle: "inset"; |
252 | property string backgroundShapeStyle: "inset"; |
253 | property alias minimumHorizontalSpacing: grid.minimumHorizontalSpacing |
254 | |
255 | @@ -71,7 +70,6 @@ |
256 | item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; }); |
257 | item.cardData = Qt.binding(function() { return model; }); |
258 | item.scopeStyle = root.scopeStyle; |
259 | - item.artShapeStyle = root.artShapeStyle; |
260 | item.backgroundShapeStyle = root.backgroundShapeStyle; |
261 | } |
262 | Connections { |
263 | |
264 | === modified file 'qml/Dash/CardTool.qml' |
265 | --- qml/Dash/CardTool.qml 2016-02-17 10:51:17 +0000 |
266 | +++ qml/Dash/CardTool.qml 2016-03-18 11:31:31 +0000 |
267 | @@ -66,7 +66,11 @@ |
268 | return layout; |
269 | } |
270 | |
271 | - property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false); |
272 | + |
273 | + // Not readonly because gets overwritten from GenericScopeView in some cases |
274 | + property string artShapeStyle: categoryLayout === "carousel" ? "shadow" : "inset" |
275 | + |
276 | + property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false, artShapeStyle); |
277 | |
278 | // FIXME: Saviq |
279 | // Only way for the card below to actually be laid out completely. |
280 | @@ -193,7 +197,7 @@ |
281 | "summary": "—\n—\n—\n—\n—", |
282 | "attributes": attributesModel.model |
283 | } |
284 | - sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true); |
285 | + sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true, artShapeStyle); |
286 | onLoaded: { |
287 | item.objectName = "cardToolCard"; |
288 | item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; }); |
289 | |
290 | === modified file 'qml/Dash/GenericScopeView.qml' |
291 | --- qml/Dash/GenericScopeView.qml 2016-03-10 22:39:17 +0000 |
292 | +++ qml/Dash/GenericScopeView.qml 2016-03-18 11:31:31 +0000 |
293 | @@ -342,10 +342,10 @@ |
294 | if (scope && scope.id === "clickscope") { |
295 | if (categoryId === "predefined" || categoryId === "local") { |
296 | cardTool.artShapeSize = Qt.binding(function() { return Qt.size(units.gu(8), units.gu(7.5)) }); |
297 | - item.artShapeStyle = "icon"; |
298 | + cardTool.artShapeStyle = "icon"; |
299 | } else { |
300 | // Should be ubuntu store icon |
301 | - item.artShapeStyle = "flat"; |
302 | + cardTool.artShapeStyle = "flat"; |
303 | item.backgroundShapeStyle = "shadow"; |
304 | } |
305 | } |
306 | |
307 | === modified file 'tests/plugins/Dash/cardcreator/1.res' |
308 | --- tests/plugins/Dash/cardcreator/1.res 2016-02-17 10:51:17 +0000 |
309 | +++ tests/plugins/Dash/cardcreator/1.res 2016-03-18 11:31:31 +0000 |
310 | @@ -1,7 +1,6 @@ |
311 | AbstractButton { |
312 | id: root; |
313 | property var cardData; |
314 | - property string artShapeStyle: "inset"; |
315 | property string backgroundShapeStyle: "inset"; |
316 | property real fontScale: 1.0; |
317 | property var scopeStyle: null; |
318 | @@ -22,6 +21,7 @@ |
319 | id: artShapeLoader; |
320 | objectName: "artShapeLoader"; |
321 | readonly property string cardArt: cardData && cardData["art"] || ""; |
322 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
323 | active: cardArt != ""; |
324 | asynchronous: true; |
325 | visible: status == Loader.Ready; |
326 | @@ -30,38 +30,12 @@ |
327 | objectName: "artShape"; |
328 | visible: image.status == Image.Ready; |
329 | readonly property alias image: artImage; |
330 | - ShaderEffectSource { |
331 | - id: artShapeSource; |
332 | - sourceItem: artImage; |
333 | - anchors.centerIn: parent; |
334 | - width: 1; |
335 | - height: 1; |
336 | - hideSource: true; |
337 | - } |
338 | - Loader { |
339 | + UbuntuShape { |
340 | anchors.fill: parent; |
341 | - visible: true; |
342 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
343 | - Component { |
344 | - id: artShapeShapeComponent; |
345 | - UbuntuShape { |
346 | - source: artShapeSource; |
347 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
348 | - radius: "medium"; |
349 | - aspect: { |
350 | - switch (root.artShapeStyle) { |
351 | - case "inset": return UbuntuShape.Inset; |
352 | - case "shadow": return UbuntuShape.DropShadow; |
353 | - default: |
354 | - case "flat": return UbuntuShape.Flat; |
355 | - } |
356 | - } |
357 | - } |
358 | - } |
359 | - Component { |
360 | - id: artShapeIconComponent; |
361 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } |
362 | - } |
363 | + source: artImage; |
364 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
365 | + radius: "medium"; |
366 | + aspect: UbuntuShape.Inset; |
367 | } |
368 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
369 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6; |
370 | @@ -81,7 +55,8 @@ |
371 | objectName: "artImage"; |
372 | source: artShapeLoader.cardArt; |
373 | asynchronous: true; |
374 | - width: root.width; |
375 | + visible: false; |
376 | + width: root.width; |
377 | height: width / artShape.aspect; |
378 | } |
379 | } |
380 | @@ -112,7 +87,7 @@ |
381 | id: touchdown; |
382 | objectName: "touchdown"; |
383 | anchors { fill: artShapeHolder } |
384 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
385 | + visible: root.pressed; |
386 | radius: "medium"; |
387 | borderSource: "radius_pressed.sci" |
388 | } |
389 | |
390 | === modified file 'tests/plugins/Dash/cardcreator/1.res.cardcreator' |
391 | --- tests/plugins/Dash/cardcreator/1.res.cardcreator 2016-02-17 10:51:17 +0000 |
392 | +++ tests/plugins/Dash/cardcreator/1.res.cardcreator 2016-03-18 11:31:31 +0000 |
393 | @@ -1,7 +1,6 @@ |
394 | AbstractButton { |
395 | id: root; |
396 | property var cardData; |
397 | - property string artShapeStyle: "inset"; |
398 | property string backgroundShapeStyle: "inset"; |
399 | property real fontScale: 1.0; |
400 | property var scopeStyle: null; |
401 | @@ -21,6 +20,7 @@ |
402 | id: artShapeLoader; |
403 | objectName: "artShapeLoader"; |
404 | readonly property string cardArt: cardData && cardData["art"] || ""; |
405 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
406 | active: cardArt != ""; |
407 | asynchronous: false; |
408 | visible: status == Loader.Ready; |
409 | @@ -29,38 +29,12 @@ |
410 | objectName: "artShape"; |
411 | visible: image.status == Image.Ready; |
412 | readonly property alias image: artImage; |
413 | - ShaderEffectSource { |
414 | - id: artShapeSource; |
415 | - sourceItem: artImage; |
416 | - anchors.centerIn: parent; |
417 | - width: 1; |
418 | - height: 1; |
419 | - hideSource: true; |
420 | - } |
421 | - Loader { |
422 | + UbuntuShape { |
423 | anchors.fill: parent; |
424 | - visible: true; |
425 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
426 | - Component { |
427 | - id: artShapeShapeComponent; |
428 | - UbuntuShape { |
429 | - source: artShapeSource; |
430 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
431 | - radius: "medium"; |
432 | - aspect: { |
433 | - switch (root.artShapeStyle) { |
434 | - case "inset": return UbuntuShape.Inset; |
435 | - case "shadow": return UbuntuShape.DropShadow; |
436 | - default: |
437 | - case "flat": return UbuntuShape.Flat; |
438 | - } |
439 | - } |
440 | - } |
441 | - } |
442 | - Component { |
443 | - id: artShapeIconComponent; |
444 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } |
445 | - } |
446 | + source: artImage; |
447 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
448 | + radius: "medium"; |
449 | + aspect: UbuntuShape.Inset; |
450 | } |
451 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
452 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6; |
453 | @@ -80,6 +54,7 @@ |
454 | objectName: "artImage"; |
455 | source: artShapeLoader.cardArt; |
456 | asynchronous: false; |
457 | + visible: false; |
458 | width: root.width; |
459 | height: width / artShape.aspect; |
460 | } |
461 | @@ -111,7 +86,7 @@ |
462 | id: touchdown; |
463 | objectName: "touchdown"; |
464 | anchors { fill: artShapeHolder } |
465 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
466 | + visible: root.pressed; |
467 | radius: "medium"; |
468 | borderSource: "radius_pressed.sci" |
469 | } |
470 | |
471 | === modified file 'tests/plugins/Dash/cardcreator/1.tst' |
472 | --- tests/plugins/Dash/cardcreator/1.tst 2014-08-08 08:54:12 +0000 |
473 | +++ tests/plugins/Dash/cardcreator/1.tst 2016-03-18 11:31:31 +0000 |
474 | @@ -1,3 +1,4 @@ |
475 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} |
476 | components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"},"attributes":{}} |
477 | +artShapeStyle: inset |
478 | result: 1.res |
479 | |
480 | === modified file 'tests/plugins/Dash/cardcreator/10.res' |
481 | --- tests/plugins/Dash/cardcreator/10.res 2016-02-17 10:51:17 +0000 |
482 | +++ tests/plugins/Dash/cardcreator/10.res 2016-03-18 11:31:31 +0000 |
483 | @@ -1,7 +1,6 @@ |
484 | AbstractButton { |
485 | id: root; |
486 | property var cardData; |
487 | - property string artShapeStyle: "inset"; |
488 | property string backgroundShapeStyle: "inset"; |
489 | property real fontScale: 1.0; |
490 | property var scopeStyle: null; |
491 | @@ -127,13 +126,5 @@ |
492 | |
493 | ] |
494 | } |
495 | -UbuntuShape { |
496 | - id: touchdown; |
497 | - objectName: "touchdown"; |
498 | - anchors { fill: backgroundLoader } |
499 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
500 | - radius: "medium"; |
501 | - borderSource: "radius_pressed.sci" |
502 | - } |
503 | implicitHeight: row.y + row.height + units.gu(1); |
504 | } |
505 | |
506 | === modified file 'tests/plugins/Dash/cardcreator/10.res.cardcreator' |
507 | --- tests/plugins/Dash/cardcreator/10.res.cardcreator 2016-02-17 10:51:17 +0000 |
508 | +++ tests/plugins/Dash/cardcreator/10.res.cardcreator 2016-03-18 11:31:31 +0000 |
509 | @@ -1,7 +1,6 @@ |
510 | AbstractButton { |
511 | id: root; |
512 | property var cardData; |
513 | - property string artShapeStyle: "inset"; |
514 | property string backgroundShapeStyle: "inset"; |
515 | property real fontScale: 1.0; |
516 | property var scopeStyle: null; |
517 | @@ -125,13 +124,5 @@ |
518 | |
519 | ] |
520 | } |
521 | -UbuntuShape { |
522 | - id: touchdown; |
523 | - objectName: "touchdown"; |
524 | - anchors { fill: backgroundLoader } |
525 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
526 | - radius: "medium"; |
527 | - borderSource: "radius_pressed.sci" |
528 | - } |
529 | implicitHeight: row.y + row.height + units.gu(1); |
530 | } |
531 | |
532 | === modified file 'tests/plugins/Dash/cardcreator/10.tst' |
533 | --- tests/plugins/Dash/cardcreator/10.tst 2016-01-25 16:49:26 +0000 |
534 | +++ tests/plugins/Dash/cardcreator/10.tst 2016-03-18 11:31:31 +0000 |
535 | @@ -1,3 +1,4 @@ |
536 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2, "card-background": { "type": "color", "elements": [ "\\", ": 3; } Item { } function moo () { \"" ] } } |
537 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}} |
538 | +artShapeStyle: shadow |
539 | result: 10.res |
540 | \ No newline at end of file |
541 | |
542 | === modified file 'tests/plugins/Dash/cardcreator/11.res' |
543 | --- tests/plugins/Dash/cardcreator/11.res 2016-02-17 10:51:17 +0000 |
544 | +++ tests/plugins/Dash/cardcreator/11.res 2016-03-18 11:31:31 +0000 |
545 | @@ -1,7 +1,6 @@ |
546 | AbstractButton { |
547 | id: root; |
548 | property var cardData; |
549 | - property string artShapeStyle: "inset"; |
550 | property string backgroundShapeStyle: "inset"; |
551 | property real fontScale: 1.0; |
552 | property var scopeStyle: null; |
553 | @@ -60,6 +59,7 @@ |
554 | id: artShapeLoader; |
555 | objectName: "artShapeLoader"; |
556 | readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C"); |
557 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
558 | active: cardArt != ""; |
559 | asynchronous: true; |
560 | visible: status == Loader.Ready; |
561 | @@ -68,40 +68,14 @@ |
562 | objectName: "artShape"; |
563 | visible: image.status == Image.Ready; |
564 | readonly property alias image: artImage; |
565 | - ShaderEffectSource { |
566 | - id: artShapeSource; |
567 | - sourceItem: artImage; |
568 | - anchors.centerIn: parent; |
569 | - width: 1; |
570 | - height: 1; |
571 | - hideSource: true; |
572 | - } |
573 | - Loader { |
574 | - anchors.fill: parent; |
575 | - visible: true; |
576 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
577 | - Component { |
578 | - id: artShapeShapeComponent; |
579 | - UbuntuShape { |
580 | - source: artShapeSource; |
581 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
582 | - radius: "medium"; |
583 | - aspect: { |
584 | - switch (root.artShapeStyle) { |
585 | - case "inset": return UbuntuShape.Inset; |
586 | - case "shadow": return UbuntuShape.DropShadow; |
587 | - default: |
588 | - case "flat": return UbuntuShape.Flat; |
589 | - } |
590 | - } |
591 | - } |
592 | - } |
593 | - Component { |
594 | - id: artShapeIconComponent; |
595 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } |
596 | - } |
597 | - } |
598 | - readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
599 | + UbuntuShape { |
600 | + anchors.fill: parent; |
601 | + source: artImage; |
602 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
603 | + radius: "medium"; |
604 | + aspect: UbuntuShape.Flat; |
605 | + } |
606 | + readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
607 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1; |
608 | Component.onCompleted: { updateWidthHeightBindings(); } |
609 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } |
610 | @@ -119,6 +93,7 @@ |
611 | objectName: "artImage"; |
612 | source: artShapeLoader.cardArt; |
613 | asynchronous: true; |
614 | + visible: false; |
615 | width: root.width; |
616 | height: width / artShape.aspect; |
617 | onStatusChanged: if (status === Image.Error) source = decodeURI("%5C"); |
618 | @@ -206,7 +181,7 @@ |
619 | id: touchdown; |
620 | objectName: "touchdown"; |
621 | anchors { fill: backgroundLoader } |
622 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
623 | + visible: root.pressed; |
624 | radius: "medium"; |
625 | borderSource: "radius_pressed.sci" |
626 | } |
627 | |
628 | === modified file 'tests/plugins/Dash/cardcreator/11.res.cardcreator' |
629 | --- tests/plugins/Dash/cardcreator/11.res.cardcreator 2016-02-17 10:51:17 +0000 |
630 | +++ tests/plugins/Dash/cardcreator/11.res.cardcreator 2016-03-18 11:31:31 +0000 |
631 | @@ -1,7 +1,6 @@ |
632 | AbstractButton { |
633 | id: root; |
634 | property var cardData; |
635 | - property string artShapeStyle: "inset"; |
636 | property string backgroundShapeStyle: "inset"; |
637 | property real fontScale: 1.0; |
638 | property var scopeStyle: null; |
639 | @@ -59,6 +58,7 @@ |
640 | id: artShapeLoader; |
641 | objectName: "artShapeLoader"; |
642 | readonly property string cardArt: cardData && cardData["art"] || ""; |
643 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
644 | active: cardArt != ""; |
645 | asynchronous: false; |
646 | visible: status == Loader.Ready; |
647 | @@ -67,39 +67,13 @@ |
648 | objectName: "artShape"; |
649 | visible: image.status == Image.Ready; |
650 | readonly property alias image: artImage; |
651 | - ShaderEffectSource { |
652 | - id: artShapeSource; |
653 | - sourceItem: artImage; |
654 | - anchors.centerIn: parent; |
655 | - width: 1; |
656 | - height: 1; |
657 | - hideSource: true; |
658 | - } |
659 | - Loader { |
660 | - anchors.fill: parent; |
661 | - visible: true; |
662 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
663 | - Component { |
664 | - id: artShapeShapeComponent; |
665 | - UbuntuShape { |
666 | - source: artShapeSource; |
667 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
668 | - radius: "medium"; |
669 | - aspect: { |
670 | - switch (root.artShapeStyle) { |
671 | - case "inset": return UbuntuShape.Inset; |
672 | - case "shadow": return UbuntuShape.DropShadow; |
673 | - default: |
674 | - case "flat": return UbuntuShape.Flat; |
675 | - } |
676 | - } |
677 | - } |
678 | - } |
679 | - Component { |
680 | - id: artShapeIconComponent; |
681 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } |
682 | - } |
683 | - } |
684 | + UbuntuShape { |
685 | + anchors.fill: parent; |
686 | + source: artImage; |
687 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
688 | + radius: "medium"; |
689 | + aspect: UbuntuShape.Flat; |
690 | + } |
691 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
692 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1; |
693 | Component.onCompleted: { updateWidthHeightBindings(); } |
694 | @@ -118,6 +92,7 @@ |
695 | objectName: "artImage"; |
696 | source: artShapeLoader.cardArt; |
697 | asynchronous: false; |
698 | + visible: false; |
699 | width: root.width; |
700 | height: width / artShape.aspect; |
701 | } |
702 | @@ -202,7 +177,7 @@ |
703 | id: touchdown; |
704 | objectName: "touchdown"; |
705 | anchors { fill: backgroundLoader } |
706 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
707 | + visible: root.pressed; |
708 | radius: "medium"; |
709 | borderSource: "radius_pressed.sci" |
710 | } |
711 | |
712 | === modified file 'tests/plugins/Dash/cardcreator/11.tst' |
713 | --- tests/plugins/Dash/cardcreator/11.tst 2016-01-25 16:49:26 +0000 |
714 | +++ tests/plugins/Dash/cardcreator/11.tst 2016-03-18 11:31:31 +0000 |
715 | @@ -1,3 +1,4 @@ |
716 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2 } |
717 | components: {"art":{"aspect-ratio":1,"field":"art","fallback":"\\"},"background":{"field":"background"},"mascot":{"field":"icon","fallback":"\""},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}} |
718 | +artShapeStyle: flat |
719 | result: 11.res |
720 | \ No newline at end of file |
721 | |
722 | === modified file 'tests/plugins/Dash/cardcreator/2.res' |
723 | --- tests/plugins/Dash/cardcreator/2.res 2016-02-17 10:51:17 +0000 |
724 | +++ tests/plugins/Dash/cardcreator/2.res 2016-03-18 11:31:31 +0000 |
725 | @@ -1,7 +1,6 @@ |
726 | AbstractButton { |
727 | id: root; |
728 | property var cardData; |
729 | - property string artShapeStyle: "inset"; |
730 | property string backgroundShapeStyle: "inset"; |
731 | property real fontScale: 1.0; |
732 | property var scopeStyle: null; |
733 | @@ -126,13 +125,5 @@ |
734 | |
735 | ] |
736 | } |
737 | -UbuntuShape { |
738 | - id: touchdown; |
739 | - objectName: "touchdown"; |
740 | - anchors { fill: backgroundLoader } |
741 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
742 | - radius: "medium"; |
743 | - borderSource: "radius_pressed.sci" |
744 | -} |
745 | implicitHeight: row.y + row.height + units.gu(1); |
746 | } |
747 | |
748 | === modified file 'tests/plugins/Dash/cardcreator/2.res.cardcreator' |
749 | --- tests/plugins/Dash/cardcreator/2.res.cardcreator 2016-02-17 10:51:17 +0000 |
750 | +++ tests/plugins/Dash/cardcreator/2.res.cardcreator 2016-03-18 11:31:31 +0000 |
751 | @@ -1,7 +1,6 @@ |
752 | AbstractButton { |
753 | id: root; |
754 | property var cardData; |
755 | - property string artShapeStyle: "inset"; |
756 | property string backgroundShapeStyle: "inset"; |
757 | property real fontScale: 1.0; |
758 | property var scopeStyle: null; |
759 | @@ -124,13 +123,5 @@ |
760 | |
761 | ] |
762 | } |
763 | -UbuntuShape { |
764 | - id: touchdown; |
765 | - objectName: "touchdown"; |
766 | - anchors { fill: backgroundLoader } |
767 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
768 | - radius: "medium"; |
769 | - borderSource: "radius_pressed.sci" |
770 | -} |
771 | implicitHeight: row.y + row.height + units.gu(1); |
772 | } |
773 | |
774 | === modified file 'tests/plugins/Dash/cardcreator/2.tst' |
775 | --- tests/plugins/Dash/cardcreator/2.tst 2014-08-08 08:54:12 +0000 |
776 | +++ tests/plugins/Dash/cardcreator/2.tst 2016-03-18 11:31:31 +0000 |
777 | @@ -1,3 +1,4 @@ |
778 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
779 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}} |
780 | +artShapeStyle: icon |
781 | result: 2.res |
782 | |
783 | === modified file 'tests/plugins/Dash/cardcreator/3.res' |
784 | --- tests/plugins/Dash/cardcreator/3.res 2016-02-17 10:51:17 +0000 |
785 | +++ tests/plugins/Dash/cardcreator/3.res 2016-03-18 11:31:31 +0000 |
786 | @@ -1,7 +1,6 @@ |
787 | AbstractButton { |
788 | id: root; |
789 | property var cardData; |
790 | - property string artShapeStyle: "inset"; |
791 | property string backgroundShapeStyle: "inset"; |
792 | property real fontScale: 1.0; |
793 | property var scopeStyle: null; |
794 | @@ -22,6 +21,7 @@ |
795 | id: artShapeLoader; |
796 | objectName: "artShapeLoader"; |
797 | readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22"); |
798 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
799 | active: cardArt != ""; |
800 | asynchronous: true; |
801 | visible: status == Loader.Ready; |
802 | @@ -30,38 +30,10 @@ |
803 | objectName: "artShape"; |
804 | visible: image.status == Image.Ready; |
805 | readonly property alias image: artImage; |
806 | - ShaderEffectSource { |
807 | - id: artShapeSource; |
808 | - sourceItem: artImage; |
809 | - anchors.centerIn: parent; |
810 | - width: 1; |
811 | - height: 1; |
812 | - hideSource: true; |
813 | - } |
814 | - Loader { |
815 | + ProportionalShape { |
816 | anchors.fill: parent; |
817 | - visible: true; |
818 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
819 | - Component { |
820 | - id: artShapeShapeComponent; |
821 | - UbuntuShape { |
822 | - source: artShapeSource; |
823 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
824 | - radius: "medium"; |
825 | - aspect: { |
826 | - switch (root.artShapeStyle) { |
827 | - case "inset": return UbuntuShape.Inset; |
828 | - case "shadow": return UbuntuShape.DropShadow; |
829 | - default: |
830 | - case "flat": return UbuntuShape.Flat; |
831 | - } |
832 | - } |
833 | - } |
834 | - } |
835 | - Component { |
836 | - id: artShapeIconComponent; |
837 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } |
838 | - } |
839 | + source: artImage; |
840 | + aspect: UbuntuShape.DropShadow; |
841 | } |
842 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
843 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75; |
844 | @@ -81,6 +53,7 @@ |
845 | objectName: "artImage"; |
846 | source: artShapeLoader.cardArt; |
847 | asynchronous: true; |
848 | + visible: false; |
849 | width: root.width; |
850 | height: width / artShape.aspect; |
851 | onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22"); |
852 | @@ -127,13 +100,5 @@ |
853 | text: cardData && cardData["subtitle"] || ""; |
854 | font.weight: Font.Light; |
855 | } |
856 | -UbuntuShape { |
857 | - id: touchdown; |
858 | - objectName: "touchdown"; |
859 | - anchors { fill: artShapeHolder } |
860 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
861 | - radius: "medium"; |
862 | - borderSource: "radius_pressed.sci" |
863 | -} |
864 | implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1); |
865 | } |
866 | |
867 | === modified file 'tests/plugins/Dash/cardcreator/3.res.cardcreator' |
868 | --- tests/plugins/Dash/cardcreator/3.res.cardcreator 2016-02-17 10:51:17 +0000 |
869 | +++ tests/plugins/Dash/cardcreator/3.res.cardcreator 2016-03-18 11:31:31 +0000 |
870 | @@ -1,7 +1,6 @@ |
871 | AbstractButton { |
872 | id: root; |
873 | property var cardData; |
874 | - property string artShapeStyle: "inset"; |
875 | property string backgroundShapeStyle: "inset"; |
876 | property real fontScale: 1.0; |
877 | property var scopeStyle: null; |
878 | @@ -21,6 +20,7 @@ |
879 | id: artShapeLoader; |
880 | objectName: "artShapeLoader"; |
881 | readonly property string cardArt: cardData && cardData["art"] || ""; |
882 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
883 | active: cardArt != ""; |
884 | asynchronous: false; |
885 | visible: status == Loader.Ready; |
886 | @@ -29,38 +29,10 @@ |
887 | objectName: "artShape"; |
888 | visible: image.status == Image.Ready; |
889 | readonly property alias image: artImage; |
890 | - ShaderEffectSource { |
891 | - id: artShapeSource; |
892 | - sourceItem: artImage; |
893 | - anchors.centerIn: parent; |
894 | - width: 1; |
895 | - height: 1; |
896 | - hideSource: true; |
897 | - } |
898 | - Loader { |
899 | + ProportionalShape { |
900 | anchors.fill: parent; |
901 | - visible: true; |
902 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
903 | - Component { |
904 | - id: artShapeShapeComponent; |
905 | - UbuntuShape { |
906 | - source: artShapeSource; |
907 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
908 | - radius: "medium"; |
909 | - aspect: { |
910 | - switch (root.artShapeStyle) { |
911 | - case "inset": return UbuntuShape.Inset; |
912 | - case "shadow": return UbuntuShape.DropShadow; |
913 | - default: |
914 | - case "flat": return UbuntuShape.Flat; |
915 | - } |
916 | - } |
917 | - } |
918 | - } |
919 | - Component { |
920 | - id: artShapeIconComponent; |
921 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } |
922 | - } |
923 | + source: artImage; |
924 | + aspect: UbuntuShape.DropShadow; |
925 | } |
926 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
927 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75; |
928 | @@ -80,6 +52,7 @@ |
929 | objectName: "artImage"; |
930 | source: artShapeLoader.cardArt; |
931 | asynchronous: false; |
932 | + visible: false; |
933 | width: root.width; |
934 | height: width / artShape.aspect; |
935 | } |
936 | @@ -125,13 +98,5 @@ |
937 | text: cardData && cardData["subtitle"] || ""; |
938 | font.weight: Font.Light; |
939 | } |
940 | -UbuntuShape { |
941 | - id: touchdown; |
942 | - objectName: "touchdown"; |
943 | - anchors { fill: artShapeHolder } |
944 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
945 | - radius: "medium"; |
946 | - borderSource: "radius_pressed.sci" |
947 | -} |
948 | implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1); |
949 | } |
950 | |
951 | === modified file 'tests/plugins/Dash/cardcreator/3.tst' |
952 | --- tests/plugins/Dash/cardcreator/3.tst 2016-01-21 22:44:41 +0000 |
953 | +++ tests/plugins/Dash/cardcreator/3.tst 2016-03-18 11:31:31 +0000 |
954 | @@ -1,3 +1,4 @@ |
955 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} |
956 | components: {"art":{"aspect-ratio":0.75,"field":"art","fallback":"IHAVE\\\"ESCAPED\\\"QUOTES\\\""},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{}} |
957 | +artShapeStyle: icon |
958 | result: 3.res |
959 | |
960 | === modified file 'tests/plugins/Dash/cardcreator/4.res' |
961 | --- tests/plugins/Dash/cardcreator/4.res 2016-02-17 10:51:17 +0000 |
962 | +++ tests/plugins/Dash/cardcreator/4.res 2016-03-18 11:31:31 +0000 |
963 | @@ -1,7 +1,6 @@ |
964 | AbstractButton { |
965 | id: root; |
966 | property var cardData; |
967 | - property string artShapeStyle: "inset"; |
968 | property string backgroundShapeStyle: "inset"; |
969 | property real fontScale: 1.0; |
970 | property var scopeStyle: null; |
971 | @@ -103,7 +102,7 @@ |
972 | id: touchdown; |
973 | objectName: "touchdown"; |
974 | anchors { fill: root } |
975 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
976 | + visible: root.pressed; |
977 | radius: "medium"; |
978 | borderSource: "radius_pressed.sci" |
979 | } |
980 | |
981 | === modified file 'tests/plugins/Dash/cardcreator/4.res.cardcreator' |
982 | --- tests/plugins/Dash/cardcreator/4.res.cardcreator 2016-02-17 10:51:17 +0000 |
983 | +++ tests/plugins/Dash/cardcreator/4.res.cardcreator 2016-03-18 11:31:31 +0000 |
984 | @@ -1,7 +1,6 @@ |
985 | AbstractButton { |
986 | id: root; |
987 | property var cardData; |
988 | - property string artShapeStyle: "inset"; |
989 | property string backgroundShapeStyle: "inset"; |
990 | property real fontScale: 1.0; |
991 | property var scopeStyle: null; |
992 | @@ -101,7 +100,7 @@ |
993 | id: touchdown; |
994 | objectName: "touchdown"; |
995 | anchors { fill: root } |
996 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
997 | + visible: root.pressed; |
998 | radius: "medium"; |
999 | borderSource: "radius_pressed.sci" |
1000 | } |
1001 | |
1002 | === modified file 'tests/plugins/Dash/cardcreator/4.tst' |
1003 | --- tests/plugins/Dash/cardcreator/4.tst 2014-08-08 08:54:12 +0000 |
1004 | +++ tests/plugins/Dash/cardcreator/4.tst 2016-03-18 11:31:31 +0000 |
1005 | @@ -1,3 +1,4 @@ |
1006 | template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2} |
1007 | components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"attributes":{}} |
1008 | +artShapeStyle: flat |
1009 | result: 4.res |
1010 | |
1011 | === modified file 'tests/plugins/Dash/cardcreator/5.res' |
1012 | --- tests/plugins/Dash/cardcreator/5.res 2016-02-17 10:51:17 +0000 |
1013 | +++ tests/plugins/Dash/cardcreator/5.res 2016-03-18 11:31:31 +0000 |
1014 | @@ -1,7 +1,6 @@ |
1015 | AbstractButton { |
1016 | id: root; |
1017 | property var cardData; |
1018 | - property string artShapeStyle: "inset"; |
1019 | property string backgroundShapeStyle: "inset"; |
1020 | property real fontScale: 1.0; |
1021 | property var scopeStyle: null; |
1022 | @@ -22,6 +21,7 @@ |
1023 | id: artShapeLoader; |
1024 | objectName: "artShapeLoader"; |
1025 | readonly property string cardArt: cardData && cardData["art"] || ""; |
1026 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
1027 | active: cardArt != ""; |
1028 | asynchronous: true; |
1029 | visible: status == Loader.Ready; |
1030 | @@ -30,39 +30,6 @@ |
1031 | objectName: "artShape"; |
1032 | visible: image.status == Image.Ready; |
1033 | readonly property alias image: artImage; |
1034 | - ShaderEffectSource { |
1035 | - id: artShapeSource; |
1036 | - sourceItem: artImage; |
1037 | - anchors.centerIn: parent; |
1038 | - width: 1; |
1039 | - height: 1; |
1040 | - hideSource: false; |
1041 | - } |
1042 | - Loader { |
1043 | - anchors.fill: parent; |
1044 | - visible: false; |
1045 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
1046 | - Component { |
1047 | - id: artShapeShapeComponent; |
1048 | - UbuntuShape { |
1049 | - source: artShapeSource; |
1050 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
1051 | - radius: "medium"; |
1052 | - aspect: { |
1053 | - switch (root.artShapeStyle) { |
1054 | - case "inset": return UbuntuShape.Inset; |
1055 | - case "shadow": return UbuntuShape.DropShadow; |
1056 | - default: |
1057 | - case "flat": return UbuntuShape.Flat; |
1058 | - } |
1059 | - } |
1060 | - } |
1061 | - } |
1062 | - Component { |
1063 | - id: artShapeIconComponent; |
1064 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } |
1065 | - } |
1066 | - } |
1067 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
1068 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1; |
1069 | Component.onCompleted: { updateWidthHeightBindings(); } |
1070 | @@ -81,6 +48,7 @@ |
1071 | objectName: "artImage"; |
1072 | source: artShapeLoader.cardArt; |
1073 | asynchronous: true; |
1074 | + visible: true; |
1075 | width: root.width; |
1076 | height: width / artShape.aspect; |
1077 | } |
1078 | @@ -145,13 +113,5 @@ |
1079 | text: cardData && cardData["subtitle"] || ""; |
1080 | font.weight: Font.Light; |
1081 | } |
1082 | -UbuntuShape { |
1083 | - id: touchdown; |
1084 | - objectName: "touchdown"; |
1085 | - anchors { fill: artShapeHolder } |
1086 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1087 | - radius: "medium"; |
1088 | - borderSource: "radius_pressed.sci" |
1089 | -} |
1090 | implicitHeight: artShapeHolder.height; |
1091 | } |
1092 | |
1093 | === modified file 'tests/plugins/Dash/cardcreator/5.res.cardcreator' |
1094 | --- tests/plugins/Dash/cardcreator/5.res.cardcreator 2016-02-17 10:51:17 +0000 |
1095 | +++ tests/plugins/Dash/cardcreator/5.res.cardcreator 2016-03-18 11:31:31 +0000 |
1096 | @@ -1,7 +1,6 @@ |
1097 | AbstractButton { |
1098 | id: root; |
1099 | property var cardData; |
1100 | - property string artShapeStyle: "inset"; |
1101 | property string backgroundShapeStyle: "inset"; |
1102 | property real fontScale: 1.0; |
1103 | property var scopeStyle: null; |
1104 | @@ -21,6 +20,7 @@ |
1105 | id: artShapeLoader; |
1106 | objectName: "artShapeLoader"; |
1107 | readonly property string cardArt: cardData && cardData["art"] || ""; |
1108 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
1109 | active: cardArt != ""; |
1110 | asynchronous: false; |
1111 | visible: status == Loader.Ready; |
1112 | @@ -29,39 +29,6 @@ |
1113 | objectName: "artShape"; |
1114 | visible: image.status == Image.Ready; |
1115 | readonly property alias image: artImage; |
1116 | - ShaderEffectSource { |
1117 | - id: artShapeSource; |
1118 | - sourceItem: artImage; |
1119 | - anchors.centerIn: parent; |
1120 | - width: 1; |
1121 | - height: 1; |
1122 | - hideSource: false; |
1123 | - } |
1124 | - Loader { |
1125 | - anchors.fill: parent; |
1126 | - visible: false; |
1127 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
1128 | - Component { |
1129 | - id: artShapeShapeComponent; |
1130 | - UbuntuShape { |
1131 | - source: artShapeSource; |
1132 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
1133 | - radius: "medium"; |
1134 | - aspect: { |
1135 | - switch (root.artShapeStyle) { |
1136 | - case "inset": return UbuntuShape.Inset; |
1137 | - case "shadow": return UbuntuShape.DropShadow; |
1138 | - default: |
1139 | - case "flat": return UbuntuShape.Flat; |
1140 | - } |
1141 | - } |
1142 | - } |
1143 | - } |
1144 | - Component { |
1145 | - id: artShapeIconComponent; |
1146 | - ProportionalShape { source: artShapeSource; aspect: UbuntuShape.DropShadow; } |
1147 | - } |
1148 | - } |
1149 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
1150 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1; |
1151 | Component.onCompleted: { updateWidthHeightBindings(); } |
1152 | @@ -80,6 +47,7 @@ |
1153 | objectName: "artImage"; |
1154 | source: artShapeLoader.cardArt; |
1155 | asynchronous: false; |
1156 | + visible: true; |
1157 | width: root.width; |
1158 | height: width / artShape.aspect; |
1159 | } |
1160 | @@ -144,13 +112,5 @@ |
1161 | text: cardData && cardData["subtitle"] || ""; |
1162 | font.weight: Font.Light; |
1163 | } |
1164 | -UbuntuShape { |
1165 | - id: touchdown; |
1166 | - objectName: "touchdown"; |
1167 | - anchors { fill: artShapeHolder } |
1168 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1169 | - radius: "medium"; |
1170 | - borderSource: "radius_pressed.sci" |
1171 | -} |
1172 | implicitHeight: artShapeHolder.height; |
1173 | } |
1174 | |
1175 | === modified file 'tests/plugins/Dash/cardcreator/5.tst' |
1176 | --- tests/plugins/Dash/cardcreator/5.tst 2016-01-28 14:11:14 +0000 |
1177 | +++ tests/plugins/Dash/cardcreator/5.tst 2016-03-18 11:31:31 +0000 |
1178 | @@ -1,3 +1,4 @@ |
1179 | template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true} |
1180 | components: {"art":{"aspect-ratio":1,"field":"art","conciergeMode":true},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}} |
1181 | +artShapeStyle: shadow |
1182 | result: 5.res |
1183 | |
1184 | === modified file 'tests/plugins/Dash/cardcreator/6.res' |
1185 | --- tests/plugins/Dash/cardcreator/6.res 2016-02-17 10:51:17 +0000 |
1186 | +++ tests/plugins/Dash/cardcreator/6.res 2016-03-18 11:31:31 +0000 |
1187 | @@ -1,7 +1,6 @@ |
1188 | AbstractButton { |
1189 | id: root; |
1190 | property var cardData; |
1191 | - property string artShapeStyle: "inset"; |
1192 | property string backgroundShapeStyle: "inset"; |
1193 | property real fontScale: 1.0; |
1194 | property var scopeStyle: null; |
1195 | @@ -119,7 +118,7 @@ |
1196 | id: touchdown; |
1197 | objectName: "touchdown"; |
1198 | anchors { fill: backgroundLoader } |
1199 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1200 | + visible: root.pressed; |
1201 | radius: "medium"; |
1202 | borderSource: "radius_pressed.sci" |
1203 | } |
1204 | |
1205 | === modified file 'tests/plugins/Dash/cardcreator/6.res.cardcreator' |
1206 | --- tests/plugins/Dash/cardcreator/6.res.cardcreator 2016-02-17 10:51:17 +0000 |
1207 | +++ tests/plugins/Dash/cardcreator/6.res.cardcreator 2016-03-18 11:31:31 +0000 |
1208 | @@ -1,7 +1,6 @@ |
1209 | AbstractButton { |
1210 | id: root; |
1211 | property var cardData; |
1212 | - property string artShapeStyle: "inset"; |
1213 | property string backgroundShapeStyle: "inset"; |
1214 | property real fontScale: 1.0; |
1215 | property var scopeStyle: null; |
1216 | @@ -118,7 +117,7 @@ |
1217 | id: touchdown; |
1218 | objectName: "touchdown"; |
1219 | anchors { fill: backgroundLoader } |
1220 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1221 | + visible: root.pressed; |
1222 | radius: "medium"; |
1223 | borderSource: "radius_pressed.sci" |
1224 | } |
1225 | |
1226 | === modified file 'tests/plugins/Dash/cardcreator/6.tst' |
1227 | --- tests/plugins/Dash/cardcreator/6.tst 2015-05-13 10:21:18 +0000 |
1228 | +++ tests/plugins/Dash/cardcreator/6.tst 2016-03-18 11:31:31 +0000 |
1229 | @@ -1,3 +1,4 @@ |
1230 | template: {"card-background":"http://assets.ubuntu.com/sites/ubuntu/latest/u/img/logos/logo-ubuntu-grey.png","card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
1231 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"subtitle":{"field":"author"},"title":{"field":"title"},"emblem":{"field":"source"},"attributes":{}} |
1232 | +artShapeStyle: inset |
1233 | result: 6.res |
1234 | |
1235 | === modified file 'tests/plugins/Dash/cardcreator/7.res' |
1236 | --- tests/plugins/Dash/cardcreator/7.res 2016-02-17 10:51:17 +0000 |
1237 | +++ tests/plugins/Dash/cardcreator/7.res 2016-03-18 11:31:31 +0000 |
1238 | @@ -1,7 +1,6 @@ |
1239 | AbstractButton { |
1240 | id: root; |
1241 | property var cardData; |
1242 | - property string artShapeStyle: "inset"; |
1243 | property string backgroundShapeStyle: "inset"; |
1244 | property real fontScale: 1.0; |
1245 | property var scopeStyle: null; |
1246 | @@ -139,13 +138,5 @@ |
1247 | |
1248 | ] |
1249 | } |
1250 | -UbuntuShape { |
1251 | - id: touchdown; |
1252 | - objectName: "touchdown"; |
1253 | - anchors { fill: backgroundLoader } |
1254 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1255 | - radius: "medium"; |
1256 | - borderSource: "radius_pressed.sci" |
1257 | -} |
1258 | implicitHeight: row.y + row.height + units.gu(1); |
1259 | } |
1260 | |
1261 | === modified file 'tests/plugins/Dash/cardcreator/7.res.cardcreator' |
1262 | --- tests/plugins/Dash/cardcreator/7.res.cardcreator 2016-02-17 10:51:17 +0000 |
1263 | +++ tests/plugins/Dash/cardcreator/7.res.cardcreator 2016-03-18 11:31:31 +0000 |
1264 | @@ -1,7 +1,6 @@ |
1265 | AbstractButton { |
1266 | id: root; |
1267 | property var cardData; |
1268 | - property string artShapeStyle: "inset"; |
1269 | property string backgroundShapeStyle: "inset"; |
1270 | property real fontScale: 1.0; |
1271 | property var scopeStyle: null; |
1272 | @@ -137,13 +136,5 @@ |
1273 | |
1274 | ] |
1275 | } |
1276 | -UbuntuShape { |
1277 | - id: touchdown; |
1278 | - objectName: "touchdown"; |
1279 | - anchors { fill: backgroundLoader } |
1280 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1281 | - radius: "medium"; |
1282 | - borderSource: "radius_pressed.sci" |
1283 | -} |
1284 | implicitHeight: row.y + row.height + units.gu(1); |
1285 | } |
1286 | |
1287 | === modified file 'tests/plugins/Dash/cardcreator/7.tst' |
1288 | --- tests/plugins/Dash/cardcreator/7.tst 2015-05-13 10:21:18 +0000 |
1289 | +++ tests/plugins/Dash/cardcreator/7.tst 2016-03-18 11:31:31 +0000 |
1290 | @@ -1,3 +1,4 @@ |
1291 | template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
1292 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}} |
1293 | +artShapeStyle: icon |
1294 | result: 7.res |
1295 | |
1296 | === modified file 'tests/plugins/Dash/cardcreator/8.res' |
1297 | --- tests/plugins/Dash/cardcreator/8.res 2016-02-17 10:51:17 +0000 |
1298 | +++ tests/plugins/Dash/cardcreator/8.res 2016-03-18 11:31:31 +0000 |
1299 | @@ -1,7 +1,6 @@ |
1300 | AbstractButton { |
1301 | id: root; |
1302 | property var cardData; |
1303 | - property string artShapeStyle: "inset"; |
1304 | property string backgroundShapeStyle: "inset"; |
1305 | property real fontScale: 1.0; |
1306 | property var scopeStyle: null; |
1307 | @@ -101,7 +100,7 @@ |
1308 | id: touchdown; |
1309 | objectName: "touchdown"; |
1310 | anchors { fill: backgroundLoader } |
1311 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1312 | + visible: root.pressed; |
1313 | radius: "medium"; |
1314 | borderSource: "radius_pressed.sci" |
1315 | } |
1316 | |
1317 | === modified file 'tests/plugins/Dash/cardcreator/8.res.cardcreator' |
1318 | --- tests/plugins/Dash/cardcreator/8.res.cardcreator 2016-02-17 10:51:17 +0000 |
1319 | +++ tests/plugins/Dash/cardcreator/8.res.cardcreator 2016-03-18 11:31:31 +0000 |
1320 | @@ -1,7 +1,6 @@ |
1321 | AbstractButton { |
1322 | id: root; |
1323 | property var cardData; |
1324 | - property string artShapeStyle: "inset"; |
1325 | property string backgroundShapeStyle: "inset"; |
1326 | property real fontScale: 1.0; |
1327 | property var scopeStyle: null; |
1328 | @@ -99,7 +98,7 @@ |
1329 | id: touchdown; |
1330 | objectName: "touchdown"; |
1331 | anchors { fill: backgroundLoader } |
1332 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1333 | + visible: root.pressed; |
1334 | radius: "medium"; |
1335 | borderSource: "radius_pressed.sci" |
1336 | } |
1337 | |
1338 | === modified file 'tests/plugins/Dash/cardcreator/8.tst' |
1339 | --- tests/plugins/Dash/cardcreator/8.tst 2015-06-22 08:29:55 +0000 |
1340 | +++ tests/plugins/Dash/cardcreator/8.tst 2016-03-18 11:31:31 +0000 |
1341 | @@ -1,3 +1,4 @@ |
1342 | template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
1343 | components: {"background":{"field":"background"},"mascot":{"field":"icon"},"title":{"field":"title"},"attributes":{}} |
1344 | +artShapeStyle: inset |
1345 | result: 8.res |
1346 | |
1347 | === modified file 'tests/plugins/Dash/cardcreator/9.res' |
1348 | --- tests/plugins/Dash/cardcreator/9.res 2016-03-10 16:53:04 +0000 |
1349 | +++ tests/plugins/Dash/cardcreator/9.res 2016-03-18 11:31:31 +0000 |
1350 | @@ -1,7 +1,6 @@ |
1351 | AbstractButton { |
1352 | id: root; |
1353 | property var cardData; |
1354 | - property string artShapeStyle: "inset"; |
1355 | property string backgroundShapeStyle: "inset"; |
1356 | property real fontScale: 1.0; |
1357 | property var scopeStyle: null; |
1358 | @@ -112,7 +111,7 @@ |
1359 | id: touchdown; |
1360 | objectName: "touchdown"; |
1361 | anchors { fill: root } |
1362 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1363 | + visible: root.pressed; |
1364 | radius: "medium"; |
1365 | borderSource: "radius_pressed.sci" |
1366 | } |
1367 | |
1368 | === modified file 'tests/plugins/Dash/cardcreator/9.res.cardcreator' |
1369 | --- tests/plugins/Dash/cardcreator/9.res.cardcreator 2016-03-10 16:53:04 +0000 |
1370 | +++ tests/plugins/Dash/cardcreator/9.res.cardcreator 2016-03-18 11:31:31 +0000 |
1371 | @@ -1,7 +1,6 @@ |
1372 | AbstractButton { |
1373 | id: root; |
1374 | property var cardData; |
1375 | - property string artShapeStyle: "inset"; |
1376 | property string backgroundShapeStyle: "inset"; |
1377 | property real fontScale: 1.0; |
1378 | property var scopeStyle: null; |
1379 | @@ -111,7 +110,7 @@ |
1380 | id: touchdown; |
1381 | objectName: "touchdown"; |
1382 | anchors { fill: root } |
1383 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1384 | + visible: root.pressed; |
1385 | radius: "medium"; |
1386 | borderSource: "radius_pressed.sci" |
1387 | } |
1388 | |
1389 | === modified file 'tests/plugins/Dash/cardcreator/9.tst' |
1390 | --- tests/plugins/Dash/cardcreator/9.tst 2015-07-06 07:52:35 +0000 |
1391 | +++ tests/plugins/Dash/cardcreator/9.tst 2016-03-18 11:31:31 +0000 |
1392 | @@ -1,3 +1,4 @@ |
1393 | template: {"card-layout":"horizontal","card-size":"medium","category-layout":"grid","collapsed-rows":2,"quick-preview-type": "audio"} |
1394 | components: {"art":{"aspect-ratio":1},"subtitle":{"field":"author"},"title":{"field":"title"}, "quickPreviewData": "quickPreviewData"} |
1395 | +artShapeStyle: inset |
1396 | result: 9.res |
1397 | |
1398 | === modified file 'tests/plugins/Dash/cardcreatortest.cpp' |
1399 | --- tests/plugins/Dash/cardcreatortest.cpp 2016-02-16 13:34:54 +0000 |
1400 | +++ tests/plugins/Dash/cardcreatortest.cpp 2016-03-18 11:31:31 +0000 |
1401 | @@ -73,6 +73,7 @@ |
1402 | { |
1403 | const QString templateString("template: "); |
1404 | const QString componentsString("components: "); |
1405 | + const QString artShapeStyleString("artShapeStyle: "); |
1406 | const QString resultString("result: "); |
1407 | |
1408 | const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/"; |
1409 | @@ -87,24 +88,26 @@ |
1410 | |
1411 | QVERIFY(lines[0].startsWith(templateString)); |
1412 | QVERIFY(lines[1].startsWith(componentsString)); |
1413 | - QVERIFY(lines[2].startsWith(resultString)); |
1414 | + QVERIFY(lines[2].startsWith(artShapeStyleString)); |
1415 | + QVERIFY(lines[3].startsWith(resultString)); |
1416 | |
1417 | const QString templateJSON = lines[0].mid(templateString.length()); |
1418 | const QString componentsJSON = lines[1].mid(componentsString.length()); |
1419 | - const QString resultFileName = lines[2].mid(resultString.length()); |
1420 | + const QString artShapeStyle = lines[2].mid(artShapeStyleString.length()); |
1421 | + const QString resultFileName = lines[3].mid(resultString.length()); |
1422 | QVariant cardStringResult; |
1423 | QVariant createCardComponentResult; |
1424 | |
1425 | - QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false)); |
1426 | + QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false), Q_ARG(QVariant, artShapeStyle)); |
1427 | compareFileContents(testDirPath + resultFileName, cardStringResult.toString()); |
1428 | |
1429 | - QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true)); |
1430 | + QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true), Q_ARG(QVariant, artShapeStyle)); |
1431 | compareFileContents(testDirPath + resultFileName + ".cardcreator", cardStringResult.toString()); |
1432 | |
1433 | - QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false)); |
1434 | + QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false), Q_ARG(QVariant, artShapeStyle)); |
1435 | QVERIFY(createCardComponentResult.toBool()); |
1436 | |
1437 | - QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true)); |
1438 | + QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true), Q_ARG(QVariant, artShapeStyle)); |
1439 | QVERIFY(createCardComponentResult.toBool()); |
1440 | } |
1441 | } |
1442 | |
1443 | === modified file 'tests/plugins/Dash/cardcreatortest.qml' |
1444 | --- tests/plugins/Dash/cardcreatortest.qml 2016-02-16 13:34:54 +0000 |
1445 | +++ tests/plugins/Dash/cardcreatortest.qml 2016-03-18 11:31:31 +0000 |
1446 | @@ -19,11 +19,11 @@ |
1447 | |
1448 | Item { |
1449 | id: root |
1450 | - function cardString(template, components, isCardCreator) { |
1451 | - return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator); |
1452 | + function cardString(template, components, isCardCreator, artShapeStyle) { |
1453 | + return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator, artShapeStyle); |
1454 | } |
1455 | |
1456 | - function createCardComponent(template, components, isCardCreator) { |
1457 | - return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator) !== null; |
1458 | + function createCardComponent(template, components, isCardCreator, artShapeStyle) { |
1459 | + return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator, artShapeStyle) !== null; |
1460 | } |
1461 | } |
1462 | |
1463 | === modified file 'tests/qmltests/Dash/tst_Card.qml' |
1464 | --- tests/qmltests/Dash/tst_Card.qml 2016-02-11 13:13:31 +0000 |
1465 | +++ tests/qmltests/Dash/tst_Card.qml 2016-03-18 11:31:31 +0000 |
1466 | @@ -485,6 +485,18 @@ |
1467 | tryCompare(art, "visible", true); |
1468 | compare(artImage.source, Qt.resolvedUrl("artwork/checkers.png")); |
1469 | |
1470 | + card.cardData["art"] = "somethingbroken"; |
1471 | + card.cardDataChanged(); |
1472 | + waitForRendering(card); |
1473 | + tryCompare(art, "visible", true); |
1474 | + compare(artImage.source, Qt.resolvedUrl("artwork/checkers.png")); |
1475 | + |
1476 | + card.cardData["art"] = Qt.resolvedUrl("artwork/music-player-design.png"); |
1477 | + card.cardDataChanged(); |
1478 | + waitForRendering(card); |
1479 | + tryCompare(art, "visible", true); |
1480 | + compare(artImage.source, Qt.resolvedUrl("artwork/music-player-design.png")); |
1481 | + |
1482 | card.cardData["mascot"] = "somethingbroken2"; |
1483 | card.cardDataChanged(); |
1484 | compare(mascotImage.status, Image.Error); |