Merge lp:~aacid/unity8/noFixedArtShapeSizeForCardToolCard into lp:unity8
- noFixedArtShapeSizeForCardToolCard
- Merge into trunk
Proposed by
Albert Astals Cid
Status: | Superseded |
---|---|
Proposed branch: | lp:~aacid/unity8/noFixedArtShapeSizeForCardToolCard |
Merge into: | lp:unity8 |
Diff against target: |
2043 lines (+346/-601) 46 files modified
plugins/Dash/CardAttributes.qml (+26/-18) plugins/Dash/CardCreator.js (+123/-60) 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 (+12/-30) tests/plugins/Dash/cardcreator/1.res.cardcreator (+13/-42) tests/plugins/Dash/cardcreator/1.tst (+1/-0) tests/plugins/Dash/cardcreator/10.res (+4/-13) tests/plugins/Dash/cardcreator/10.res.cardcreator (+0/-10) tests/plugins/Dash/cardcreator/10.tst (+1/-0) tests/plugins/Dash/cardcreator/11.res (+15/-33) tests/plugins/Dash/cardcreator/11.res.cardcreator (+15/-44) tests/plugins/Dash/cardcreator/11.tst (+1/-0) tests/plugins/Dash/cardcreator/12.res (+12/-30) tests/plugins/Dash/cardcreator/12.res.cardcreator (+16/-45) tests/plugins/Dash/cardcreator/12.tst (+1/-0) tests/plugins/Dash/cardcreator/2.res (+4/-13) tests/plugins/Dash/cardcreator/2.res.cardcreator (+0/-10) tests/plugins/Dash/cardcreator/2.tst (+1/-0) tests/plugins/Dash/cardcreator/3.res (+9/-37) tests/plugins/Dash/cardcreator/3.res.cardcreator (+11/-50) tests/plugins/Dash/cardcreator/3.tst (+1/-0) tests/plugins/Dash/cardcreator/4.res (+5/-6) tests/plugins/Dash/cardcreator/4.res.cardcreator (+1/-3) tests/plugins/Dash/cardcreator/4.tst (+1/-0) tests/plugins/Dash/cardcreator/5.res (+6/-39) tests/plugins/Dash/cardcreator/5.res.cardcreator (+7/-51) tests/plugins/Dash/cardcreator/5.tst (+1/-0) tests/plugins/Dash/cardcreator/6.res (+3/-4) tests/plugins/Dash/cardcreator/6.res.cardcreator (+1/-3) tests/plugins/Dash/cardcreator/6.tst (+1/-0) tests/plugins/Dash/cardcreator/7.res (+4/-13) tests/plugins/Dash/cardcreator/7.res.cardcreator (+0/-10) tests/plugins/Dash/cardcreator/7.tst (+1/-0) tests/plugins/Dash/cardcreator/8.res (+5/-6) tests/plugins/Dash/cardcreator/8.res.cardcreator (+1/-3) tests/plugins/Dash/cardcreator/8.tst (+1/-0) tests/plugins/Dash/cardcreator/9.res (+5/-6) tests/plugins/Dash/cardcreator/9.res.cardcreator (+1/-3) 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/noFixedArtShapeSizeForCardToolCard |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email: mp+295337@code.launchpad.net |
This proposal has been superseded by a proposal from 2016-05-20.
Commit message
Split artShape code for cardTool card and regular card
The cardTool card never has a fixedArtShapeSize so it does not need all the code to take it into account
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?
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.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'plugins/Dash/CardAttributes.qml' |
2 | --- plugins/Dash/CardAttributes.qml 2015-07-15 15:13:18 +0000 |
3 | +++ plugins/Dash/CardAttributes.qml 2016-05-20 15:34:28 +0000 |
4 | @@ -43,28 +43,36 @@ |
5 | Layout.column: index % grid.columns |
6 | Layout.row: index / grid.columns |
7 | Layout.columnSpan: index == repeater.count - 1 && grid.columns == 3 && column == 1 ? 2 : 1 |
8 | - Layout.maximumWidth: Math.max(icon.width, label.x + label.implicitWidth) |
9 | + Layout.maximumWidth: Math.max(iconLoader.width, labelLoader.x + labelLoader.implicitWidth) |
10 | Layout.fillWidth: true |
11 | height: units.gu(2) |
12 | - Icon { |
13 | - id: icon |
14 | - height: units.gu(2) |
15 | - // FIXME Workaround for bug https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1421293 |
16 | - width: implicitWidth > 0 && implicitHeight > 0 ? (implicitWidth / implicitHeight * height) : implicitWidth |
17 | - source: "icon" in modelData && modelData["icon"] || "" |
18 | - color: grid.color |
19 | + Loader { |
20 | + id: iconLoader |
21 | + readonly property string source: "icon" in modelData && modelData["icon"] || "" |
22 | + active: source !== "" |
23 | + sourceComponent: Icon { |
24 | + height: units.gu(2) |
25 | + // FIXME Workaround for bug https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1421293 |
26 | + width: implicitWidth > 0 && implicitHeight > 0 ? (implicitWidth / implicitHeight * height) : implicitWidth |
27 | + source: parent.source |
28 | + color: grid.color |
29 | + } |
30 | } |
31 | - Label { |
32 | - id: label |
33 | + Loader { |
34 | + id: labelLoader |
35 | width: parent.width - x |
36 | - anchors.verticalCenter: parent.verticalCenter |
37 | - text: "value" in modelData && modelData["value"] || ""; |
38 | - elide: Text.ElideRight |
39 | - maximumLineCount: 1 |
40 | - font.weight: "style" in modelData && modelData["style"] === "highlighted" ? Font.Bold : Font.Light |
41 | - fontSize: "small" |
42 | - font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale) |
43 | - color: grid.color |
44 | + readonly property string value: "value" in modelData && modelData["value"] || "" |
45 | + active: value !== "" |
46 | + sourceComponent: Label { |
47 | + anchors.verticalCenter: parent.verticalCenter |
48 | + text: parent.value |
49 | + elide: Text.ElideRight |
50 | + maximumLineCount: 1 |
51 | + font.weight: "style" in modelData && modelData["style"] === "highlighted" ? Font.Bold : Font.Light |
52 | + fontSize: "small" |
53 | + font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale) |
54 | + color: grid.color |
55 | + } |
56 | } |
57 | } |
58 | } |
59 | |
60 | === modified file 'plugins/Dash/CardCreator.js' |
61 | --- plugins/Dash/CardCreator.js 2016-05-04 14:09:00 +0000 |
62 | +++ plugins/Dash/CardCreator.js 2016-05-20 15:34:28 +0000 |
63 | @@ -59,14 +59,30 @@ |
64 | } \n\ |
65 | }\n'; |
66 | |
67 | +// %1 is the aspect of the UbuntuShape |
68 | +var kArtUbuntuShapeCode = 'UbuntuShape { \n\ |
69 | + anchors.fill: parent; \n\ |
70 | + source: artImage; \n\ |
71 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\ |
72 | + radius: "medium"; \n\ |
73 | + aspect: %1; \n\ |
74 | + }'; |
75 | + |
76 | +var kArtProportionalShapeCode = 'ProportionalShape { \n\ |
77 | + anchors.fill: parent; \n\ |
78 | + source: artImage; \n\ |
79 | + aspect: UbuntuShape.DropShadow; \n\ |
80 | + }'; |
81 | + |
82 | // %1 is used as anchors of artShapeHolder |
83 | // %2 is used as image width |
84 | // %3 is used as image height |
85 | -// %4 is whether the image or the Loader with the UbuntuShape/ProportionalShape should be visible |
86 | +// %4 is whether the image should be visible |
87 | // %5 is used as aspect ratio fallback |
88 | // %6 is whether the loader should be asynchronous or not |
89 | -// %7 is injected as code to artImage |
90 | -// %8 is used as image fallback |
91 | +// %7 is the shape code we want to use |
92 | +// %8 is injected as code to artImage |
93 | +// %9 is used as image fallback |
94 | var kArtShapeHolderCode = 'Item { \n\ |
95 | id: artShapeHolder; \n\ |
96 | height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\ |
97 | @@ -75,7 +91,8 @@ |
98 | Loader { \n\ |
99 | id: artShapeLoader; \n\ |
100 | objectName: "artShapeLoader"; \n\ |
101 | - readonly property string cardArt: cardData && cardData["art"] || %8; \n\ |
102 | + readonly property string cardArt: cardData && cardData["art"] || %9; \n\ |
103 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\ |
104 | active: cardArt != ""; \n\ |
105 | asynchronous: %6; \n\ |
106 | visible: status == Loader.Ready; \n\ |
107 | @@ -84,31 +101,7 @@ |
108 | objectName: "artShape"; \n\ |
109 | visible: image.status == Image.Ready; \n\ |
110 | readonly property alias image: artImage; \n\ |
111 | - Loader { \n\ |
112 | - anchors.fill: parent; \n\ |
113 | - visible: %4; \n\ |
114 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\ |
115 | - Component { \n\ |
116 | - id: artShapeShapeComponent; \n\ |
117 | - UbuntuShape { \n\ |
118 | - source: artImage; \n\ |
119 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\ |
120 | - radius: "medium"; \n\ |
121 | - aspect: { \n\ |
122 | - switch (root.artShapeStyle) { \n\ |
123 | - case "inset": return UbuntuShape.Inset; \n\ |
124 | - case "shadow": return UbuntuShape.DropShadow; \n\ |
125 | - default: \n\ |
126 | - case "flat": return UbuntuShape.Flat; \n\ |
127 | - } \n\ |
128 | - } \n\ |
129 | - } \n\ |
130 | - } \n\ |
131 | - Component { \n\ |
132 | - id: artShapeIconComponent; \n\ |
133 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } \n\ |
134 | - } \n\ |
135 | - } \n\ |
136 | + %7 \n\ |
137 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\ |
138 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\ |
139 | Component.onCompleted: { updateWidthHeightBindings(); } \n\ |
140 | @@ -127,10 +120,55 @@ |
141 | objectName: "artImage"; \n\ |
142 | source: artShapeLoader.cardArt; \n\ |
143 | asynchronous: %6; \n\ |
144 | - visible: !%4; \n\ |
145 | - width: %2; \n\ |
146 | - height: %3; \n\ |
147 | - %7 \n\ |
148 | + visible: %4; \n\ |
149 | + width: %2; \n\ |
150 | + height: %3; \n\ |
151 | + %8 \n\ |
152 | + } \n\ |
153 | + } \n\ |
154 | + } \n\ |
155 | + }\n'; |
156 | + |
157 | +// %1 is used as anchors of artShapeHolder |
158 | +// %2 is used as image width |
159 | +// %3 is used as image height |
160 | +// %4 is whether the image should be visible |
161 | +// %5 is used as aspect ratio |
162 | +// %6 is whether the loader should be asynchronous or not |
163 | +// %7 is the shape code we want to use |
164 | +// %8 is injected as code to artImage |
165 | +// %9 is used as image fallback |
166 | +var kArtShapeHolderCodeCardToolCard = 'Item { \n\ |
167 | + id: artShapeHolder; \n\ |
168 | + height: artShapeLoader.height; \n\ |
169 | + width: artShapeLoader.width; \n\ |
170 | + anchors { %1 } \n\ |
171 | + Loader { \n\ |
172 | + id: artShapeLoader; \n\ |
173 | + objectName: "artShapeLoader"; \n\ |
174 | + readonly property string cardArt: cardData && cardData["art"] || %9; \n\ |
175 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\ |
176 | + active: cardArt != ""; \n\ |
177 | + asynchronous: %6; \n\ |
178 | + visible: status == Loader.Ready; \n\ |
179 | + sourceComponent: Item { \n\ |
180 | + id: artShape; \n\ |
181 | + objectName: "artShape"; \n\ |
182 | + visible: image.status == Image.Ready; \n\ |
183 | + readonly property alias image: artImage; \n\ |
184 | + %7 \n\ |
185 | + readonly property real aspect: %5; \n\ |
186 | + width: image.status !== Image.Ready ? 0 : image.width; \n\ |
187 | + height: image.status !== Image.Ready ? 0 : image.height; \n\ |
188 | + CroppedImageMinimumSourceSize { \n\ |
189 | + id: artImage; \n\ |
190 | + objectName: "artImage"; \n\ |
191 | + source: artShapeLoader.cardArt; \n\ |
192 | + asynchronous: %6; \n\ |
193 | + visible: %4; \n\ |
194 | + width: %2; \n\ |
195 | + height: %3; \n\ |
196 | + %8 \n\ |
197 | } \n\ |
198 | } \n\ |
199 | } \n\ |
200 | @@ -318,7 +356,7 @@ |
201 | id: touchdown; \n\ |
202 | objectName: "touchdown"; \n\ |
203 | anchors { %1 } \n\ |
204 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; \n\ |
205 | + visible: root.pressed; \n\ |
206 | radius: "medium"; \n\ |
207 | borderSource: "radius_pressed.sci" \n\ |
208 | }\n'; |
209 | @@ -412,7 +450,7 @@ |
210 | return colorString; |
211 | } |
212 | |
213 | -function cardString(template, components, isCardTool) { |
214 | +function cardString(template, components, isCardTool, artShapeStyle) { |
215 | var code; |
216 | |
217 | var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false"; |
218 | @@ -420,19 +458,19 @@ |
219 | code = 'AbstractButton { \n\ |
220 | id: root; \n\ |
221 | property var cardData; \n\ |
222 | - property string artShapeStyle: "inset"; \n\ |
223 | property string backgroundShapeStyle: "inset"; \n\ |
224 | property real fontScale: 1.0; \n\ |
225 | property var scopeStyle: null; \n\ |
226 | - %2\ |
227 | - property size fixedArtShapeSize: Qt.size(-1, -1); \n\ |
228 | readonly property string title: cardData && cardData["title"] || ""; \n\ |
229 | property bool showHeader: true; \n\ |
230 | implicitWidth: childrenRect.width; \n\ |
231 | enabled: %1; \n\ |
232 | \n'.arg(templateInteractive); |
233 | |
234 | - code = code.arg(isCardTool ? "" : "property int fixedHeaderHeight: -1; \n"); |
235 | + if (!isCardTool) { |
236 | + code += "property int fixedHeaderHeight: -1; \n\ |
237 | + property size fixedArtShapeSize: Qt.size(-1, -1); \n"; |
238 | + } |
239 | |
240 | var hasArt = components["art"] && components["art"]["field"] || false; |
241 | var hasSummary = components["summary"] || false; |
242 | @@ -519,19 +557,38 @@ |
243 | var fallbackStatusCode = ""; |
244 | var fallbackURICode = '""'; |
245 | if (fallback !== "") { |
246 | - // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode |
247 | - // which in kArtShapeHolderCode is %8 |
248 | - fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %8;'; |
249 | + // fallbackStatusCode has %9 in it because we want to substitute it for fallbackURICode |
250 | + // which in kArtShapeHolderCode is %9 |
251 | + fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %9;'; |
252 | fallbackURICode = 'decodeURI("%1")'.arg(fallback); |
253 | } |
254 | - code += kArtShapeHolderCode.arg(artAnchors) |
255 | - .arg(widthCode) |
256 | - .arg(heightCode) |
257 | - .arg(isConciergeMode ? "false" : "true") |
258 | - .arg(aspectRatio) |
259 | - .arg(asynchronous) |
260 | - .arg(fallbackStatusCode) |
261 | - .arg(fallbackURICode); |
262 | + var artShapeHolderShapeCode; |
263 | + if (!isConciergeMode) { |
264 | + if (artShapeStyle === "icon") { |
265 | + artShapeHolderShapeCode = kArtProportionalShapeCode; |
266 | + } else { |
267 | + var artShapeHolderShapeAspect; |
268 | + switch (artShapeStyle) { |
269 | + case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break; |
270 | + case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break; |
271 | + default: |
272 | + case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break; |
273 | + } |
274 | + artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(artShapeHolderShapeAspect); |
275 | + } |
276 | + } else { |
277 | + artShapeHolderShapeCode = ""; |
278 | + } |
279 | + var artShapeHolderCode = isCardTool ? kArtShapeHolderCodeCardToolCard : kArtShapeHolderCode; |
280 | + code += artShapeHolderCode.arg(artAnchors) |
281 | + .arg(widthCode) |
282 | + .arg(heightCode) |
283 | + .arg(isConciergeMode ? "true" : "false") |
284 | + .arg(aspectRatio) |
285 | + .arg(asynchronous) |
286 | + .arg(artShapeHolderShapeCode) |
287 | + .arg(fallbackStatusCode) |
288 | + .arg(fallbackURICode); |
289 | } else { |
290 | code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n' |
291 | } |
292 | @@ -854,6 +911,10 @@ |
293 | code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor); |
294 | } |
295 | |
296 | +// <<<<<<< TREE |
297 | +// if (artShapeStyle != "shadow" && artShapeStyle != "icon") { |
298 | +// var touchdownAnchors; |
299 | +// ======= |
300 | if (hasSocialActions) { |
301 | var socialAnchors; |
302 | var socialTopAnchor; |
303 | @@ -882,15 +943,17 @@ |
304 | code += kSocialActionsRowCode.arg(socialAnchors).arg(socialColor); |
305 | } |
306 | |
307 | - var touchdownAnchors; |
308 | - if (hasBackground) { |
309 | - touchdownAnchors = 'fill: backgroundLoader'; |
310 | - } else if (touchdownOnArtShape) { |
311 | - touchdownAnchors = 'fill: artShapeHolder'; |
312 | - } else { |
313 | - touchdownAnchors = 'fill: root' |
314 | + if (artShapeStyle != "shadow" && artShapeStyle != "icon") { |
315 | + var touchdownAnchors; |
316 | + if (hasBackground) { |
317 | + touchdownAnchors = 'fill: backgroundLoader'; |
318 | + } else if (touchdownOnArtShape) { |
319 | + touchdownAnchors = 'fill: artShapeHolder'; |
320 | + } else { |
321 | + touchdownAnchors = 'fill: root' |
322 | + } |
323 | + code += kTouchdownCode.arg(touchdownAnchors); |
324 | } |
325 | - code += kTouchdownCode.arg(touchdownAnchors); |
326 | |
327 | var implicitHeight = 'implicitHeight: '; |
328 | if (hasSocialActions) { |
329 | @@ -925,13 +988,13 @@ |
330 | return code; |
331 | } |
332 | |
333 | -function createCardComponent(parent, template, components, isCardTool, identifier) { |
334 | +function createCardComponent(parent, template, components, isCardTool, artShapeStyle, identifier) { |
335 | var imports = 'import QtQuick 2.4; \n\ |
336 | import Ubuntu.Components 1.3; \n\ |
337 | import Ubuntu.Settings.Components 0.1; \n\ |
338 | import Dash 0.1;\n\ |
339 | import Utils 0.1;\n'; |
340 | - var card = cardString(template, components, isCardTool); |
341 | + var card = cardString(template, components, isCardTool, artShapeStyle); |
342 | var code = imports + 'Component {\n' + card + '}\n'; |
343 | |
344 | try { |
345 | |
346 | === modified file 'plugins/Dash/CardCreatorCache.qml' |
347 | --- plugins/Dash/CardCreatorCache.qml 2016-02-16 14:26:58 +0000 |
348 | +++ plugins/Dash/CardCreatorCache.qml 2016-05-20 15:34:28 +0000 |
349 | @@ -23,7 +23,7 @@ |
350 | |
351 | property var cache: new Object(); |
352 | |
353 | - function getCardComponent(template, components, isCardTool) { |
354 | + function getCardComponent(template, components, isCardTool, artShapeStyle) { |
355 | if (template === undefined || components === undefined) |
356 | return undefined; |
357 | |
358 | @@ -32,7 +32,7 @@ |
359 | var allString = tString + cString + isCardTool; |
360 | var component = cache[allString]; |
361 | if (component === undefined) { |
362 | - component = CardCreator.createCardComponent(root, template, components, isCardTool, allString); |
363 | + component = CardCreator.createCardComponent(root, template, components, isCardTool, artShapeStyle, allString); |
364 | cache[allString] = component; |
365 | } |
366 | return component; |
367 | |
368 | === modified file 'qml/Dash/CardCarousel.qml' |
369 | --- qml/Dash/CardCarousel.qml 2016-02-16 15:09:55 +0000 |
370 | +++ qml/Dash/CardCarousel.qml 2016-05-20 15:34:28 +0000 |
371 | @@ -66,7 +66,6 @@ |
372 | item.cardData = Qt.binding(function() { return model; }); |
373 | item.fontScale = Qt.binding(function() { return carousel.fontScale; }); |
374 | item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; }); |
375 | - item.artShapeStyle = "shadow"; |
376 | item.scopeStyle = cardCarousel.scopeStyle; |
377 | } |
378 | } |
379 | |
380 | === modified file 'qml/Dash/CardGrid.qml' |
381 | --- qml/Dash/CardGrid.qml 2016-03-07 12:39:23 +0000 |
382 | +++ qml/Dash/CardGrid.qml 2016-05-20 15:34:28 +0000 |
383 | @@ -25,7 +25,6 @@ |
384 | if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2; |
385 | return cardTool.template["collapsed-rows"]; |
386 | } |
387 | - property string artShapeStyle: "inset"; |
388 | property string backgroundShapeStyle: "inset"; |
389 | property alias minimumHorizontalSpacing: grid.minimumHorizontalSpacing |
390 | |
391 | @@ -71,7 +70,6 @@ |
392 | item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; }); |
393 | item.cardData = Qt.binding(function() { return model; }); |
394 | item.scopeStyle = root.scopeStyle; |
395 | - item.artShapeStyle = root.artShapeStyle; |
396 | item.backgroundShapeStyle = root.backgroundShapeStyle; |
397 | } |
398 | Connections { |
399 | |
400 | === modified file 'qml/Dash/CardTool.qml' |
401 | --- qml/Dash/CardTool.qml 2016-04-06 16:19:57 +0000 |
402 | +++ qml/Dash/CardTool.qml 2016-05-20 15:34:28 +0000 |
403 | @@ -66,7 +66,11 @@ |
404 | return layout; |
405 | } |
406 | |
407 | - property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false); |
408 | + |
409 | + // Not readonly because gets overwritten from GenericScopeView in some cases |
410 | + property string artShapeStyle: categoryLayout === "carousel" ? "shadow" : "inset" |
411 | + |
412 | + property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false, artShapeStyle); |
413 | |
414 | // FIXME: Saviq |
415 | // Only way for the card below to actually be laid out completely. |
416 | @@ -208,7 +212,7 @@ |
417 | "attributes": attributesModel.model, |
418 | "socialActions": socialActionsModel.model |
419 | } |
420 | - sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true); |
421 | + sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true, artShapeStyle); |
422 | onLoaded: { |
423 | item.objectName = "cardToolCard"; |
424 | item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; }); |
425 | |
426 | === modified file 'qml/Dash/GenericScopeView.qml' |
427 | --- qml/Dash/GenericScopeView.qml 2016-05-04 18:08:35 +0000 |
428 | +++ qml/Dash/GenericScopeView.qml 2016-05-20 15:34:28 +0000 |
429 | @@ -345,10 +345,10 @@ |
430 | if (scope && scope.id === "clickscope") { |
431 | if (categoryId === "predefined" || categoryId === "local") { |
432 | cardTool.artShapeSize = Qt.binding(function() { return Qt.size(units.gu(8), units.gu(7.5)) }); |
433 | - item.artShapeStyle = "icon"; |
434 | + cardTool.artShapeStyle = "icon"; |
435 | } else { |
436 | // Should be ubuntu store icon |
437 | - item.artShapeStyle = "flat"; |
438 | + cardTool.artShapeStyle = "flat"; |
439 | item.backgroundShapeStyle = "shadow"; |
440 | } |
441 | } |
442 | |
443 | === modified file 'tests/plugins/Dash/cardcreator/1.res' |
444 | --- tests/plugins/Dash/cardcreator/1.res 2016-05-04 14:09:00 +0000 |
445 | +++ tests/plugins/Dash/cardcreator/1.res 2016-05-20 15:34:28 +0000 |
446 | @@ -1,16 +1,15 @@ |
447 | AbstractButton { |
448 | id: root; |
449 | property var cardData; |
450 | - property string artShapeStyle: "inset"; |
451 | property string backgroundShapeStyle: "inset"; |
452 | property real fontScale: 1.0; |
453 | property var scopeStyle: null; |
454 | + readonly property string title: cardData && cardData["title"] || ""; |
455 | + property bool showHeader: true; |
456 | + implicitWidth: childrenRect.width; |
457 | + enabled: true; |
458 | property int fixedHeaderHeight: -1; |
459 | property size fixedArtShapeSize: Qt.size(-1, -1); |
460 | - readonly property string title: cardData && cardData["title"] || ""; |
461 | - property bool showHeader: true; |
462 | - implicitWidth: childrenRect.width; |
463 | - enabled: true; |
464 | signal action(var actionId); |
465 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
466 | Item { |
467 | @@ -22,6 +21,7 @@ |
468 | id: artShapeLoader; |
469 | objectName: "artShapeLoader"; |
470 | readonly property string cardArt: cardData && cardData["art"] || ""; |
471 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
472 | active: cardArt != ""; |
473 | asynchronous: true; |
474 | visible: status == Loader.Ready; |
475 | @@ -30,30 +30,12 @@ |
476 | objectName: "artShape"; |
477 | visible: image.status == Image.Ready; |
478 | readonly property alias image: artImage; |
479 | - Loader { |
480 | + UbuntuShape { |
481 | anchors.fill: parent; |
482 | - visible: true; |
483 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
484 | - Component { |
485 | - id: artShapeShapeComponent; |
486 | - UbuntuShape { |
487 | - source: artImage; |
488 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
489 | - radius: "medium"; |
490 | - aspect: { |
491 | - switch (root.artShapeStyle) { |
492 | - case "inset": return UbuntuShape.Inset; |
493 | - case "shadow": return UbuntuShape.DropShadow; |
494 | - default: |
495 | - case "flat": return UbuntuShape.Flat; |
496 | - } |
497 | - } |
498 | - } |
499 | - } |
500 | - Component { |
501 | - id: artShapeIconComponent; |
502 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
503 | - } |
504 | + source: artImage; |
505 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
506 | + radius: "medium"; |
507 | + aspect: UbuntuShape.Inset; |
508 | } |
509 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
510 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6; |
511 | @@ -73,7 +55,7 @@ |
512 | objectName: "artImage"; |
513 | source: artShapeLoader.cardArt; |
514 | asynchronous: true; |
515 | - visible: !true; |
516 | + visible: false; |
517 | width: root.width; |
518 | height: width / artShape.aspect; |
519 | } |
520 | @@ -105,7 +87,7 @@ |
521 | id: touchdown; |
522 | objectName: "touchdown"; |
523 | anchors { fill: artShapeHolder } |
524 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
525 | + visible: root.pressed; |
526 | radius: "medium"; |
527 | borderSource: "radius_pressed.sci" |
528 | } |
529 | |
530 | === modified file 'tests/plugins/Dash/cardcreator/1.res.cardcreator' |
531 | --- tests/plugins/Dash/cardcreator/1.res.cardcreator 2016-05-04 14:09:00 +0000 |
532 | +++ tests/plugins/Dash/cardcreator/1.res.cardcreator 2016-05-20 15:34:28 +0000 |
533 | @@ -1,11 +1,9 @@ |
534 | AbstractButton { |
535 | id: root; |
536 | property var cardData; |
537 | - property string artShapeStyle: "inset"; |
538 | property string backgroundShapeStyle: "inset"; |
539 | property real fontScale: 1.0; |
540 | property var scopeStyle: null; |
541 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
542 | readonly property string title: cardData && cardData["title"] || ""; |
543 | property bool showHeader: true; |
544 | implicitWidth: childrenRect.width; |
545 | @@ -14,13 +12,14 @@ |
546 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
547 | Item { |
548 | id: artShapeHolder; |
549 | - height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; |
550 | - width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; |
551 | + height: artShapeLoader.height; |
552 | + width: artShapeLoader.width; |
553 | anchors { horizontalCenter: parent.horizontalCenter; } |
554 | Loader { |
555 | id: artShapeLoader; |
556 | objectName: "artShapeLoader"; |
557 | readonly property string cardArt: cardData && cardData["art"] || ""; |
558 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
559 | active: cardArt != ""; |
560 | asynchronous: false; |
561 | visible: status == Loader.Ready; |
562 | @@ -29,50 +28,22 @@ |
563 | objectName: "artShape"; |
564 | visible: image.status == Image.Ready; |
565 | readonly property alias image: artImage; |
566 | - Loader { |
567 | + UbuntuShape { |
568 | anchors.fill: parent; |
569 | - visible: true; |
570 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
571 | - Component { |
572 | - id: artShapeShapeComponent; |
573 | - UbuntuShape { |
574 | - source: artImage; |
575 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
576 | - radius: "medium"; |
577 | - aspect: { |
578 | - switch (root.artShapeStyle) { |
579 | - case "inset": return UbuntuShape.Inset; |
580 | - case "shadow": return UbuntuShape.DropShadow; |
581 | - default: |
582 | - case "flat": return UbuntuShape.Flat; |
583 | - } |
584 | - } |
585 | - } |
586 | - } |
587 | - Component { |
588 | - id: artShapeIconComponent; |
589 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
590 | - } |
591 | + source: artImage; |
592 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
593 | + radius: "medium"; |
594 | + aspect: UbuntuShape.Inset; |
595 | } |
596 | - readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
597 | - readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6; |
598 | - Component.onCompleted: { updateWidthHeightBindings(); } |
599 | - Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } |
600 | - function updateWidthHeightBindings() { |
601 | - if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { |
602 | - width = root.fixedArtShapeSize.width; |
603 | - height = root.fixedArtShapeSize.height; |
604 | - } else { |
605 | - width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width }); |
606 | - height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height }); |
607 | - } |
608 | - } |
609 | + readonly property real aspect: 1.6; |
610 | + width: image.status !== Image.Ready ? 0 : image.width; |
611 | + height: image.status !== Image.Ready ? 0 : image.height; |
612 | CroppedImageMinimumSourceSize { |
613 | id: artImage; |
614 | objectName: "artImage"; |
615 | source: artShapeLoader.cardArt; |
616 | asynchronous: false; |
617 | - visible: !true; |
618 | + visible: false; |
619 | width: root.width; |
620 | height: width / artShape.aspect; |
621 | } |
622 | @@ -104,7 +75,7 @@ |
623 | id: touchdown; |
624 | objectName: "touchdown"; |
625 | anchors { fill: artShapeHolder } |
626 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
627 | + visible: root.pressed; |
628 | radius: "medium"; |
629 | borderSource: "radius_pressed.sci" |
630 | } |
631 | |
632 | === modified file 'tests/plugins/Dash/cardcreator/1.tst' |
633 | --- tests/plugins/Dash/cardcreator/1.tst 2014-08-08 08:54:12 +0000 |
634 | +++ tests/plugins/Dash/cardcreator/1.tst 2016-05-20 15:34:28 +0000 |
635 | @@ -1,3 +1,4 @@ |
636 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} |
637 | components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"},"attributes":{}} |
638 | +artShapeStyle: inset |
639 | result: 1.res |
640 | |
641 | === modified file 'tests/plugins/Dash/cardcreator/10.res' |
642 | --- tests/plugins/Dash/cardcreator/10.res 2016-03-07 12:39:23 +0000 |
643 | +++ tests/plugins/Dash/cardcreator/10.res 2016-05-20 15:34:28 +0000 |
644 | @@ -1,16 +1,15 @@ |
645 | AbstractButton { |
646 | id: root; |
647 | property var cardData; |
648 | - property string artShapeStyle: "inset"; |
649 | property string backgroundShapeStyle: "inset"; |
650 | property real fontScale: 1.0; |
651 | property var scopeStyle: null; |
652 | + readonly property string title: cardData && cardData["title"] || ""; |
653 | + property bool showHeader: true; |
654 | + implicitWidth: childrenRect.width; |
655 | + enabled: true; |
656 | property int fixedHeaderHeight: -1; |
657 | property size fixedArtShapeSize: Qt.size(-1, -1); |
658 | - readonly property string title: cardData && cardData["title"] || ""; |
659 | - property bool showHeader: true; |
660 | - implicitWidth: childrenRect.width; |
661 | - enabled: true; |
662 | signal action(var actionId); |
663 | Loader { |
664 | id: backgroundLoader; |
665 | @@ -127,13 +126,5 @@ |
666 | |
667 | ] |
668 | } |
669 | -UbuntuShape { |
670 | - id: touchdown; |
671 | - objectName: "touchdown"; |
672 | - anchors { fill: backgroundLoader } |
673 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
674 | - radius: "medium"; |
675 | - borderSource: "radius_pressed.sci" |
676 | - } |
677 | implicitHeight: row.y + row.height + units.gu(1); |
678 | } |
679 | |
680 | === modified file 'tests/plugins/Dash/cardcreator/10.res.cardcreator' |
681 | --- tests/plugins/Dash/cardcreator/10.res.cardcreator 2016-03-07 12:39:23 +0000 |
682 | +++ tests/plugins/Dash/cardcreator/10.res.cardcreator 2016-05-20 15:34:28 +0000 |
683 | @@ -1,11 +1,9 @@ |
684 | AbstractButton { |
685 | id: root; |
686 | property var cardData; |
687 | - property string artShapeStyle: "inset"; |
688 | property string backgroundShapeStyle: "inset"; |
689 | property real fontScale: 1.0; |
690 | property var scopeStyle: null; |
691 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
692 | readonly property string title: cardData && cardData["title"] || ""; |
693 | property bool showHeader: true; |
694 | implicitWidth: childrenRect.width; |
695 | @@ -125,13 +123,5 @@ |
696 | |
697 | ] |
698 | } |
699 | -UbuntuShape { |
700 | - id: touchdown; |
701 | - objectName: "touchdown"; |
702 | - anchors { fill: backgroundLoader } |
703 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
704 | - radius: "medium"; |
705 | - borderSource: "radius_pressed.sci" |
706 | - } |
707 | implicitHeight: row.y + row.height + units.gu(1); |
708 | } |
709 | |
710 | === modified file 'tests/plugins/Dash/cardcreator/10.tst' |
711 | --- tests/plugins/Dash/cardcreator/10.tst 2016-01-25 16:49:26 +0000 |
712 | +++ tests/plugins/Dash/cardcreator/10.tst 2016-05-20 15:34:28 +0000 |
713 | @@ -1,3 +1,4 @@ |
714 | 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 () { \"" ] } } |
715 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}} |
716 | +artShapeStyle: shadow |
717 | result: 10.res |
718 | \ No newline at end of file |
719 | |
720 | === modified file 'tests/plugins/Dash/cardcreator/11.res' |
721 | --- tests/plugins/Dash/cardcreator/11.res 2016-05-04 14:09:00 +0000 |
722 | +++ tests/plugins/Dash/cardcreator/11.res 2016-05-20 15:34:28 +0000 |
723 | @@ -1,16 +1,15 @@ |
724 | AbstractButton { |
725 | id: root; |
726 | property var cardData; |
727 | - property string artShapeStyle: "inset"; |
728 | property string backgroundShapeStyle: "inset"; |
729 | property real fontScale: 1.0; |
730 | property var scopeStyle: null; |
731 | + readonly property string title: cardData && cardData["title"] || ""; |
732 | + property bool showHeader: true; |
733 | + implicitWidth: childrenRect.width; |
734 | + enabled: true; |
735 | property int fixedHeaderHeight: -1; |
736 | property size fixedArtShapeSize: Qt.size(-1, -1); |
737 | - readonly property string title: cardData && cardData["title"] || ""; |
738 | - property bool showHeader: true; |
739 | - implicitWidth: childrenRect.width; |
740 | - enabled: true; |
741 | signal action(var actionId); |
742 | Loader { |
743 | id: backgroundLoader; |
744 | @@ -60,6 +59,7 @@ |
745 | id: artShapeLoader; |
746 | objectName: "artShapeLoader"; |
747 | readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C"); |
748 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
749 | active: cardArt != ""; |
750 | asynchronous: true; |
751 | visible: status == Loader.Ready; |
752 | @@ -68,32 +68,14 @@ |
753 | objectName: "artShape"; |
754 | visible: image.status == Image.Ready; |
755 | readonly property alias image: artImage; |
756 | - Loader { |
757 | - anchors.fill: parent; |
758 | - visible: true; |
759 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
760 | - Component { |
761 | - id: artShapeShapeComponent; |
762 | - UbuntuShape { |
763 | - source: artImage; |
764 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
765 | - radius: "medium"; |
766 | - aspect: { |
767 | - switch (root.artShapeStyle) { |
768 | - case "inset": return UbuntuShape.Inset; |
769 | - case "shadow": return UbuntuShape.DropShadow; |
770 | - default: |
771 | - case "flat": return UbuntuShape.Flat; |
772 | - } |
773 | - } |
774 | - } |
775 | - } |
776 | - Component { |
777 | - id: artShapeIconComponent; |
778 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
779 | - } |
780 | - } |
781 | - readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
782 | + UbuntuShape { |
783 | + anchors.fill: parent; |
784 | + source: artImage; |
785 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
786 | + radius: "medium"; |
787 | + aspect: UbuntuShape.Flat; |
788 | + } |
789 | + readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
790 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1; |
791 | Component.onCompleted: { updateWidthHeightBindings(); } |
792 | Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } |
793 | @@ -111,7 +93,7 @@ |
794 | objectName: "artImage"; |
795 | source: artShapeLoader.cardArt; |
796 | asynchronous: true; |
797 | - visible: !true; |
798 | + visible: false; |
799 | width: root.width; |
800 | height: width / artShape.aspect; |
801 | onStatusChanged: if (status === Image.Error) source = decodeURI("%5C"); |
802 | @@ -199,7 +181,7 @@ |
803 | id: touchdown; |
804 | objectName: "touchdown"; |
805 | anchors { fill: backgroundLoader } |
806 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
807 | + visible: root.pressed; |
808 | radius: "medium"; |
809 | borderSource: "radius_pressed.sci" |
810 | } |
811 | |
812 | === modified file 'tests/plugins/Dash/cardcreator/11.res.cardcreator' |
813 | --- tests/plugins/Dash/cardcreator/11.res.cardcreator 2016-05-04 14:09:00 +0000 |
814 | +++ tests/plugins/Dash/cardcreator/11.res.cardcreator 2016-05-20 15:34:28 +0000 |
815 | @@ -1,11 +1,9 @@ |
816 | AbstractButton { |
817 | id: root; |
818 | property var cardData; |
819 | - property string artShapeStyle: "inset"; |
820 | property string backgroundShapeStyle: "inset"; |
821 | property real fontScale: 1.0; |
822 | property var scopeStyle: null; |
823 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
824 | readonly property string title: cardData && cardData["title"] || ""; |
825 | property bool showHeader: true; |
826 | implicitWidth: childrenRect.width; |
827 | @@ -52,13 +50,14 @@ |
828 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
829 | Item { |
830 | id: artShapeHolder; |
831 | - height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; |
832 | - width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; |
833 | + height: artShapeLoader.height; |
834 | + width: artShapeLoader.width; |
835 | anchors { horizontalCenter: parent.horizontalCenter; } |
836 | Loader { |
837 | id: artShapeLoader; |
838 | objectName: "artShapeLoader"; |
839 | readonly property string cardArt: cardData && cardData["art"] || ""; |
840 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
841 | active: cardArt != ""; |
842 | asynchronous: false; |
843 | visible: status == Loader.Ready; |
844 | @@ -67,50 +66,22 @@ |
845 | objectName: "artShape"; |
846 | visible: image.status == Image.Ready; |
847 | readonly property alias image: artImage; |
848 | - Loader { |
849 | - anchors.fill: parent; |
850 | - visible: true; |
851 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
852 | - Component { |
853 | - id: artShapeShapeComponent; |
854 | - UbuntuShape { |
855 | - source: artImage; |
856 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
857 | - radius: "medium"; |
858 | - aspect: { |
859 | - switch (root.artShapeStyle) { |
860 | - case "inset": return UbuntuShape.Inset; |
861 | - case "shadow": return UbuntuShape.DropShadow; |
862 | - default: |
863 | - case "flat": return UbuntuShape.Flat; |
864 | - } |
865 | - } |
866 | - } |
867 | - } |
868 | - Component { |
869 | - id: artShapeIconComponent; |
870 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
871 | - } |
872 | - } |
873 | - readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
874 | - readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1; |
875 | - Component.onCompleted: { updateWidthHeightBindings(); } |
876 | - Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } |
877 | - function updateWidthHeightBindings() { |
878 | - if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { |
879 | - width = root.fixedArtShapeSize.width; |
880 | - height = root.fixedArtShapeSize.height; |
881 | - } else { |
882 | - width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width }); |
883 | - height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height }); |
884 | - } |
885 | - } |
886 | + UbuntuShape { |
887 | + anchors.fill: parent; |
888 | + source: artImage; |
889 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
890 | + radius: "medium"; |
891 | + aspect: UbuntuShape.Flat; |
892 | + } |
893 | + readonly property real aspect: 1; |
894 | + width: image.status !== Image.Ready ? 0 : image.width; |
895 | + height: image.status !== Image.Ready ? 0 : image.height; |
896 | CroppedImageMinimumSourceSize { |
897 | id: artImage; |
898 | objectName: "artImage"; |
899 | source: artShapeLoader.cardArt; |
900 | asynchronous: false; |
901 | - visible: !true; |
902 | + visible: false; |
903 | width: root.width; |
904 | height: width / artShape.aspect; |
905 | } |
906 | @@ -195,7 +166,7 @@ |
907 | id: touchdown; |
908 | objectName: "touchdown"; |
909 | anchors { fill: backgroundLoader } |
910 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
911 | + visible: root.pressed; |
912 | radius: "medium"; |
913 | borderSource: "radius_pressed.sci" |
914 | } |
915 | |
916 | === modified file 'tests/plugins/Dash/cardcreator/11.tst' |
917 | --- tests/plugins/Dash/cardcreator/11.tst 2016-01-25 16:49:26 +0000 |
918 | +++ tests/plugins/Dash/cardcreator/11.tst 2016-05-20 15:34:28 +0000 |
919 | @@ -1,3 +1,4 @@ |
920 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2 } |
921 | components: {"art":{"aspect-ratio":1,"field":"art","fallback":"\\"},"background":{"field":"background"},"mascot":{"field":"icon","fallback":"\""},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}} |
922 | +artShapeStyle: flat |
923 | result: 11.res |
924 | \ No newline at end of file |
925 | |
926 | === modified file 'tests/plugins/Dash/cardcreator/12.res' |
927 | --- tests/plugins/Dash/cardcreator/12.res 2016-05-04 14:25:02 +0000 |
928 | +++ tests/plugins/Dash/cardcreator/12.res 2016-05-20 15:34:28 +0000 |
929 | @@ -1,16 +1,15 @@ |
930 | AbstractButton { |
931 | id: root; |
932 | property var cardData; |
933 | - property string artShapeStyle: "inset"; |
934 | property string backgroundShapeStyle: "inset"; |
935 | property real fontScale: 1.0; |
936 | property var scopeStyle: null; |
937 | + readonly property string title: cardData && cardData["title"] || ""; |
938 | + property bool showHeader: true; |
939 | + implicitWidth: childrenRect.width; |
940 | + enabled: true; |
941 | property int fixedHeaderHeight: -1; |
942 | property size fixedArtShapeSize: Qt.size(-1, -1); |
943 | - readonly property string title: cardData && cardData["title"] || ""; |
944 | - property bool showHeader: true; |
945 | - implicitWidth: childrenRect.width; |
946 | - enabled: true; |
947 | signal action(var actionId); |
948 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
949 | Item { |
950 | @@ -22,6 +21,7 @@ |
951 | id: artShapeLoader; |
952 | objectName: "artShapeLoader"; |
953 | readonly property string cardArt: cardData && cardData["art"] || ""; |
954 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
955 | active: cardArt != ""; |
956 | asynchronous: true; |
957 | visible: status == Loader.Ready; |
958 | @@ -30,30 +30,12 @@ |
959 | objectName: "artShape"; |
960 | visible: image.status == Image.Ready; |
961 | readonly property alias image: artImage; |
962 | - Loader { |
963 | + UbuntuShape { |
964 | anchors.fill: parent; |
965 | - visible: true; |
966 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
967 | - Component { |
968 | - id: artShapeShapeComponent; |
969 | - UbuntuShape { |
970 | - source: artImage; |
971 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
972 | - radius: "medium"; |
973 | - aspect: { |
974 | - switch (root.artShapeStyle) { |
975 | - case "inset": return UbuntuShape.Inset; |
976 | - case "shadow": return UbuntuShape.DropShadow; |
977 | - default: |
978 | - case "flat": return UbuntuShape.Flat; |
979 | - } |
980 | - } |
981 | - } |
982 | - } |
983 | - Component { |
984 | - id: artShapeIconComponent; |
985 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
986 | - } |
987 | + source: artImage; |
988 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
989 | + radius: "medium"; |
990 | + aspect: UbuntuShape.Flat; |
991 | } |
992 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
993 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75; |
994 | @@ -73,7 +55,7 @@ |
995 | objectName: "artImage"; |
996 | source: artShapeLoader.cardArt; |
997 | asynchronous: true; |
998 | - visible: !true; |
999 | + visible: false; |
1000 | width: root.width; |
1001 | height: width / artShape.aspect; |
1002 | } |
1003 | @@ -131,7 +113,7 @@ |
1004 | id: touchdown; |
1005 | objectName: "touchdown"; |
1006 | anchors { fill: artShapeHolder } |
1007 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1008 | + visible: root.pressed; |
1009 | radius: "medium"; |
1010 | borderSource: "radius_pressed.sci" |
1011 | } |
1012 | |
1013 | === modified file 'tests/plugins/Dash/cardcreator/12.res.cardcreator' |
1014 | --- tests/plugins/Dash/cardcreator/12.res.cardcreator 2016-05-04 14:25:02 +0000 |
1015 | +++ tests/plugins/Dash/cardcreator/12.res.cardcreator 2016-05-20 15:34:28 +0000 |
1016 | @@ -1,11 +1,9 @@ |
1017 | -AbstractButton { |
1018 | +AbstractButton { |
1019 | id: root; |
1020 | property var cardData; |
1021 | - property string artShapeStyle: "inset"; |
1022 | property string backgroundShapeStyle: "inset"; |
1023 | property real fontScale: 1.0; |
1024 | property var scopeStyle: null; |
1025 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1026 | readonly property string title: cardData && cardData["title"] || ""; |
1027 | property bool showHeader: true; |
1028 | implicitWidth: childrenRect.width; |
1029 | @@ -14,13 +12,14 @@ |
1030 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
1031 | Item { |
1032 | id: artShapeHolder; |
1033 | - height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; |
1034 | - width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; |
1035 | + height: artShapeLoader.height; |
1036 | + width: artShapeLoader.width; |
1037 | anchors { horizontalCenter: parent.horizontalCenter; } |
1038 | - Loader { |
1039 | + Loader { |
1040 | id: artShapeLoader; |
1041 | objectName: "artShapeLoader"; |
1042 | readonly property string cardArt: cardData && cardData["art"] || ""; |
1043 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
1044 | active: cardArt != ""; |
1045 | asynchronous: false; |
1046 | visible: status == Loader.Ready; |
1047 | @@ -29,50 +28,22 @@ |
1048 | objectName: "artShape"; |
1049 | visible: image.status == Image.Ready; |
1050 | readonly property alias image: artImage; |
1051 | - Loader { |
1052 | + UbuntuShape { |
1053 | anchors.fill: parent; |
1054 | - visible: true; |
1055 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
1056 | - Component { |
1057 | - id: artShapeShapeComponent; |
1058 | - UbuntuShape { |
1059 | - source: artImage; |
1060 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
1061 | - radius: "medium"; |
1062 | - aspect: { |
1063 | - switch (root.artShapeStyle) { |
1064 | - case "inset": return UbuntuShape.Inset; |
1065 | - case "shadow": return UbuntuShape.DropShadow; |
1066 | - default: |
1067 | - case "flat": return UbuntuShape.Flat; |
1068 | - } |
1069 | - } |
1070 | - } |
1071 | - } |
1072 | - Component { |
1073 | - id: artShapeIconComponent; |
1074 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
1075 | - } |
1076 | - } |
1077 | - readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
1078 | - readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75; |
1079 | - Component.onCompleted: { updateWidthHeightBindings(); } |
1080 | - Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } |
1081 | - function updateWidthHeightBindings() { |
1082 | - if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { |
1083 | - width = root.fixedArtShapeSize.width; |
1084 | - height = root.fixedArtShapeSize.height; |
1085 | - } else { |
1086 | - width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width }); |
1087 | - height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height }); |
1088 | - } |
1089 | - } |
1090 | + source: artImage; |
1091 | + sourceFillMode: UbuntuShape.PreserveAspectCrop; |
1092 | + radius: "medium"; |
1093 | + aspect: UbuntuShape.Flat; |
1094 | + } |
1095 | + readonly property real aspect: 0.75; |
1096 | + width: image.status !== Image.Ready ? 0 : image.width; |
1097 | + height: image.status !== Image.Ready ? 0 : image.height; |
1098 | CroppedImageMinimumSourceSize { |
1099 | id: artImage; |
1100 | objectName: "artImage"; |
1101 | source: artShapeLoader.cardArt; |
1102 | asynchronous: false; |
1103 | - visible: !true; |
1104 | + visible: false; |
1105 | width: root.width; |
1106 | height: width / artShape.aspect; |
1107 | } |
1108 | @@ -130,7 +101,7 @@ |
1109 | id: touchdown; |
1110 | objectName: "touchdown"; |
1111 | anchors { fill: artShapeHolder } |
1112 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1113 | + visible: root.pressed; |
1114 | radius: "medium"; |
1115 | borderSource: "radius_pressed.sci" |
1116 | } |
1117 | |
1118 | === modified file 'tests/plugins/Dash/cardcreator/12.tst' |
1119 | --- tests/plugins/Dash/cardcreator/12.tst 2016-03-21 16:06:10 +0000 |
1120 | +++ tests/plugins/Dash/cardcreator/12.tst 2016-05-20 15:34:28 +0000 |
1121 | @@ -1,3 +1,4 @@ |
1122 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} |
1123 | components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{},"social-actions":{}} |
1124 | +artShapeStyle: flat |
1125 | result: 12.res |
1126 | |
1127 | === modified file 'tests/plugins/Dash/cardcreator/2.res' |
1128 | --- tests/plugins/Dash/cardcreator/2.res 2016-03-07 12:39:23 +0000 |
1129 | +++ tests/plugins/Dash/cardcreator/2.res 2016-05-20 15:34:28 +0000 |
1130 | @@ -1,16 +1,15 @@ |
1131 | AbstractButton { |
1132 | id: root; |
1133 | property var cardData; |
1134 | - property string artShapeStyle: "inset"; |
1135 | property string backgroundShapeStyle: "inset"; |
1136 | property real fontScale: 1.0; |
1137 | property var scopeStyle: null; |
1138 | + readonly property string title: cardData && cardData["title"] || ""; |
1139 | + property bool showHeader: true; |
1140 | + implicitWidth: childrenRect.width; |
1141 | + enabled: true; |
1142 | property int fixedHeaderHeight: -1; |
1143 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1144 | - readonly property string title: cardData && cardData["title"] || ""; |
1145 | - property bool showHeader: true; |
1146 | - implicitWidth: childrenRect.width; |
1147 | - enabled: true; |
1148 | signal action(var actionId); |
1149 | Loader { |
1150 | id: backgroundLoader; |
1151 | @@ -126,13 +125,5 @@ |
1152 | |
1153 | ] |
1154 | } |
1155 | -UbuntuShape { |
1156 | - id: touchdown; |
1157 | - objectName: "touchdown"; |
1158 | - anchors { fill: backgroundLoader } |
1159 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1160 | - radius: "medium"; |
1161 | - borderSource: "radius_pressed.sci" |
1162 | -} |
1163 | implicitHeight: row.y + row.height + units.gu(1); |
1164 | } |
1165 | |
1166 | === modified file 'tests/plugins/Dash/cardcreator/2.res.cardcreator' |
1167 | --- tests/plugins/Dash/cardcreator/2.res.cardcreator 2016-03-07 12:39:23 +0000 |
1168 | +++ tests/plugins/Dash/cardcreator/2.res.cardcreator 2016-05-20 15:34:28 +0000 |
1169 | @@ -1,11 +1,9 @@ |
1170 | AbstractButton { |
1171 | id: root; |
1172 | property var cardData; |
1173 | - property string artShapeStyle: "inset"; |
1174 | property string backgroundShapeStyle: "inset"; |
1175 | property real fontScale: 1.0; |
1176 | property var scopeStyle: null; |
1177 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1178 | readonly property string title: cardData && cardData["title"] || ""; |
1179 | property bool showHeader: true; |
1180 | implicitWidth: childrenRect.width; |
1181 | @@ -124,13 +122,5 @@ |
1182 | |
1183 | ] |
1184 | } |
1185 | -UbuntuShape { |
1186 | - id: touchdown; |
1187 | - objectName: "touchdown"; |
1188 | - anchors { fill: backgroundLoader } |
1189 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1190 | - radius: "medium"; |
1191 | - borderSource: "radius_pressed.sci" |
1192 | -} |
1193 | implicitHeight: row.y + row.height + units.gu(1); |
1194 | } |
1195 | |
1196 | === modified file 'tests/plugins/Dash/cardcreator/2.tst' |
1197 | --- tests/plugins/Dash/cardcreator/2.tst 2014-08-08 08:54:12 +0000 |
1198 | +++ tests/plugins/Dash/cardcreator/2.tst 2016-05-20 15:34:28 +0000 |
1199 | @@ -1,3 +1,4 @@ |
1200 | template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
1201 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}} |
1202 | +artShapeStyle: icon |
1203 | result: 2.res |
1204 | |
1205 | === modified file 'tests/plugins/Dash/cardcreator/3.res' |
1206 | --- tests/plugins/Dash/cardcreator/3.res 2016-05-04 14:09:00 +0000 |
1207 | +++ tests/plugins/Dash/cardcreator/3.res 2016-05-20 15:34:28 +0000 |
1208 | @@ -1,16 +1,15 @@ |
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 | + readonly property string title: cardData && cardData["title"] || ""; |
1217 | + property bool showHeader: true; |
1218 | + implicitWidth: childrenRect.width; |
1219 | + enabled: true; |
1220 | property int fixedHeaderHeight: -1; |
1221 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1222 | - readonly property string title: cardData && cardData["title"] || ""; |
1223 | - property bool showHeader: true; |
1224 | - implicitWidth: childrenRect.width; |
1225 | - enabled: true; |
1226 | signal action(var actionId); |
1227 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
1228 | Item { |
1229 | @@ -22,6 +21,7 @@ |
1230 | id: artShapeLoader; |
1231 | objectName: "artShapeLoader"; |
1232 | readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22"); |
1233 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
1234 | active: cardArt != ""; |
1235 | asynchronous: true; |
1236 | visible: status == Loader.Ready; |
1237 | @@ -30,30 +30,10 @@ |
1238 | objectName: "artShape"; |
1239 | visible: image.status == Image.Ready; |
1240 | readonly property alias image: artImage; |
1241 | - Loader { |
1242 | + ProportionalShape { |
1243 | anchors.fill: parent; |
1244 | - visible: true; |
1245 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
1246 | - Component { |
1247 | - id: artShapeShapeComponent; |
1248 | - UbuntuShape { |
1249 | - source: artImage; |
1250 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
1251 | - radius: "medium"; |
1252 | - aspect: { |
1253 | - switch (root.artShapeStyle) { |
1254 | - case "inset": return UbuntuShape.Inset; |
1255 | - case "shadow": return UbuntuShape.DropShadow; |
1256 | - default: |
1257 | - case "flat": return UbuntuShape.Flat; |
1258 | - } |
1259 | - } |
1260 | - } |
1261 | - } |
1262 | - Component { |
1263 | - id: artShapeIconComponent; |
1264 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
1265 | - } |
1266 | + source: artImage; |
1267 | + aspect: UbuntuShape.DropShadow; |
1268 | } |
1269 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
1270 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75; |
1271 | @@ -73,7 +53,7 @@ |
1272 | objectName: "artImage"; |
1273 | source: artShapeLoader.cardArt; |
1274 | asynchronous: true; |
1275 | - visible: !true; |
1276 | + visible: false; |
1277 | width: root.width; |
1278 | height: width / artShape.aspect; |
1279 | onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22"); |
1280 | @@ -120,13 +100,5 @@ |
1281 | text: cardData && cardData["subtitle"] || ""; |
1282 | font.weight: Font.Light; |
1283 | } |
1284 | -UbuntuShape { |
1285 | - id: touchdown; |
1286 | - objectName: "touchdown"; |
1287 | - anchors { fill: artShapeHolder } |
1288 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1289 | - radius: "medium"; |
1290 | - borderSource: "radius_pressed.sci" |
1291 | -} |
1292 | implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1); |
1293 | } |
1294 | |
1295 | === modified file 'tests/plugins/Dash/cardcreator/3.res.cardcreator' |
1296 | --- tests/plugins/Dash/cardcreator/3.res.cardcreator 2016-05-04 14:09:00 +0000 |
1297 | +++ tests/plugins/Dash/cardcreator/3.res.cardcreator 2016-05-20 15:34:28 +0000 |
1298 | @@ -1,11 +1,9 @@ |
1299 | AbstractButton { |
1300 | id: root; |
1301 | property var cardData; |
1302 | - property string artShapeStyle: "inset"; |
1303 | property string backgroundShapeStyle: "inset"; |
1304 | property real fontScale: 1.0; |
1305 | property var scopeStyle: null; |
1306 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1307 | readonly property string title: cardData && cardData["title"] || ""; |
1308 | property bool showHeader: true; |
1309 | implicitWidth: childrenRect.width; |
1310 | @@ -14,13 +12,14 @@ |
1311 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
1312 | Item { |
1313 | id: artShapeHolder; |
1314 | - height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; |
1315 | - width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; |
1316 | + height: artShapeLoader.height; |
1317 | + width: artShapeLoader.width; |
1318 | anchors { horizontalCenter: parent.horizontalCenter; } |
1319 | Loader { |
1320 | id: artShapeLoader; |
1321 | objectName: "artShapeLoader"; |
1322 | readonly property string cardArt: cardData && cardData["art"] || ""; |
1323 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
1324 | active: cardArt != ""; |
1325 | asynchronous: false; |
1326 | visible: status == Loader.Ready; |
1327 | @@ -29,50 +28,20 @@ |
1328 | objectName: "artShape"; |
1329 | visible: image.status == Image.Ready; |
1330 | readonly property alias image: artImage; |
1331 | - Loader { |
1332 | + ProportionalShape { |
1333 | anchors.fill: parent; |
1334 | - visible: true; |
1335 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
1336 | - Component { |
1337 | - id: artShapeShapeComponent; |
1338 | - UbuntuShape { |
1339 | - source: artImage; |
1340 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
1341 | - radius: "medium"; |
1342 | - aspect: { |
1343 | - switch (root.artShapeStyle) { |
1344 | - case "inset": return UbuntuShape.Inset; |
1345 | - case "shadow": return UbuntuShape.DropShadow; |
1346 | - default: |
1347 | - case "flat": return UbuntuShape.Flat; |
1348 | - } |
1349 | - } |
1350 | - } |
1351 | - } |
1352 | - Component { |
1353 | - id: artShapeIconComponent; |
1354 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
1355 | - } |
1356 | - } |
1357 | - readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
1358 | - readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75; |
1359 | - Component.onCompleted: { updateWidthHeightBindings(); } |
1360 | - Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } |
1361 | - function updateWidthHeightBindings() { |
1362 | - if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { |
1363 | - width = root.fixedArtShapeSize.width; |
1364 | - height = root.fixedArtShapeSize.height; |
1365 | - } else { |
1366 | - width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width }); |
1367 | - height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height }); |
1368 | - } |
1369 | - } |
1370 | + source: artImage; |
1371 | + aspect: UbuntuShape.DropShadow; |
1372 | + } |
1373 | + readonly property real aspect: 0.75; |
1374 | + width: image.status !== Image.Ready ? 0 : image.width; |
1375 | + height: image.status !== Image.Ready ? 0 : image.height; |
1376 | CroppedImageMinimumSourceSize { |
1377 | id: artImage; |
1378 | objectName: "artImage"; |
1379 | source: artShapeLoader.cardArt; |
1380 | asynchronous: false; |
1381 | - visible: !true; |
1382 | + visible: false; |
1383 | width: root.width; |
1384 | height: width / artShape.aspect; |
1385 | } |
1386 | @@ -118,13 +87,5 @@ |
1387 | text: cardData && cardData["subtitle"] || ""; |
1388 | font.weight: Font.Light; |
1389 | } |
1390 | -UbuntuShape { |
1391 | - id: touchdown; |
1392 | - objectName: "touchdown"; |
1393 | - anchors { fill: artShapeHolder } |
1394 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1395 | - radius: "medium"; |
1396 | - borderSource: "radius_pressed.sci" |
1397 | -} |
1398 | implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1); |
1399 | } |
1400 | |
1401 | === modified file 'tests/plugins/Dash/cardcreator/3.tst' |
1402 | --- tests/plugins/Dash/cardcreator/3.tst 2016-01-21 22:44:41 +0000 |
1403 | +++ tests/plugins/Dash/cardcreator/3.tst 2016-05-20 15:34:28 +0000 |
1404 | @@ -1,3 +1,4 @@ |
1405 | template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2} |
1406 | components: {"art":{"aspect-ratio":0.75,"field":"art","fallback":"IHAVE\\\"ESCAPED\\\"QUOTES\\\""},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{}} |
1407 | +artShapeStyle: icon |
1408 | result: 3.res |
1409 | |
1410 | === modified file 'tests/plugins/Dash/cardcreator/4.res' |
1411 | --- tests/plugins/Dash/cardcreator/4.res 2016-03-07 12:39:23 +0000 |
1412 | +++ tests/plugins/Dash/cardcreator/4.res 2016-05-20 15:34:28 +0000 |
1413 | @@ -1,16 +1,15 @@ |
1414 | AbstractButton { |
1415 | id: root; |
1416 | property var cardData; |
1417 | - property string artShapeStyle: "inset"; |
1418 | property string backgroundShapeStyle: "inset"; |
1419 | property real fontScale: 1.0; |
1420 | property var scopeStyle: null; |
1421 | + readonly property string title: cardData && cardData["title"] || ""; |
1422 | + property bool showHeader: true; |
1423 | + implicitWidth: childrenRect.width; |
1424 | + enabled: true; |
1425 | property int fixedHeaderHeight: -1; |
1426 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1427 | - readonly property string title: cardData && cardData["title"] || ""; |
1428 | - property bool showHeader: true; |
1429 | - implicitWidth: childrenRect.width; |
1430 | - enabled: true; |
1431 | signal action(var actionId); |
1432 | readonly property size artShapeSize: Qt.size(-1, -1); |
1433 | readonly property int headerHeight: row.height; |
1434 | @@ -103,7 +102,7 @@ |
1435 | id: touchdown; |
1436 | objectName: "touchdown"; |
1437 | anchors { fill: root } |
1438 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1439 | + visible: root.pressed; |
1440 | radius: "medium"; |
1441 | borderSource: "radius_pressed.sci" |
1442 | } |
1443 | |
1444 | === modified file 'tests/plugins/Dash/cardcreator/4.res.cardcreator' |
1445 | --- tests/plugins/Dash/cardcreator/4.res.cardcreator 2016-03-07 12:39:23 +0000 |
1446 | +++ tests/plugins/Dash/cardcreator/4.res.cardcreator 2016-05-20 15:34:28 +0000 |
1447 | @@ -1,11 +1,9 @@ |
1448 | AbstractButton { |
1449 | id: root; |
1450 | property var cardData; |
1451 | - property string artShapeStyle: "inset"; |
1452 | property string backgroundShapeStyle: "inset"; |
1453 | property real fontScale: 1.0; |
1454 | property var scopeStyle: null; |
1455 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1456 | readonly property string title: cardData && cardData["title"] || ""; |
1457 | property bool showHeader: true; |
1458 | implicitWidth: childrenRect.width; |
1459 | @@ -101,7 +99,7 @@ |
1460 | id: touchdown; |
1461 | objectName: "touchdown"; |
1462 | anchors { fill: root } |
1463 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1464 | + visible: root.pressed; |
1465 | radius: "medium"; |
1466 | borderSource: "radius_pressed.sci" |
1467 | } |
1468 | |
1469 | === modified file 'tests/plugins/Dash/cardcreator/4.tst' |
1470 | --- tests/plugins/Dash/cardcreator/4.tst 2014-08-08 08:54:12 +0000 |
1471 | +++ tests/plugins/Dash/cardcreator/4.tst 2016-05-20 15:34:28 +0000 |
1472 | @@ -1,3 +1,4 @@ |
1473 | template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2} |
1474 | components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"attributes":{}} |
1475 | +artShapeStyle: flat |
1476 | result: 4.res |
1477 | |
1478 | === modified file 'tests/plugins/Dash/cardcreator/5.res' |
1479 | --- tests/plugins/Dash/cardcreator/5.res 2016-05-04 14:09:00 +0000 |
1480 | +++ tests/plugins/Dash/cardcreator/5.res 2016-05-20 15:34:28 +0000 |
1481 | @@ -1,16 +1,15 @@ |
1482 | AbstractButton { |
1483 | id: root; |
1484 | property var cardData; |
1485 | - property string artShapeStyle: "inset"; |
1486 | property string backgroundShapeStyle: "inset"; |
1487 | property real fontScale: 1.0; |
1488 | property var scopeStyle: null; |
1489 | + readonly property string title: cardData && cardData["title"] || ""; |
1490 | + property bool showHeader: true; |
1491 | + implicitWidth: childrenRect.width; |
1492 | + enabled: false; |
1493 | property int fixedHeaderHeight: -1; |
1494 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1495 | - readonly property string title: cardData && cardData["title"] || ""; |
1496 | - property bool showHeader: true; |
1497 | - implicitWidth: childrenRect.width; |
1498 | - enabled: false; |
1499 | signal action(var actionId); |
1500 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
1501 | Item { |
1502 | @@ -22,6 +21,7 @@ |
1503 | id: artShapeLoader; |
1504 | objectName: "artShapeLoader"; |
1505 | readonly property string cardArt: cardData && cardData["art"] || ""; |
1506 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
1507 | active: cardArt != ""; |
1508 | asynchronous: true; |
1509 | visible: status == Loader.Ready; |
1510 | @@ -30,31 +30,6 @@ |
1511 | objectName: "artShape"; |
1512 | visible: image.status == Image.Ready; |
1513 | readonly property alias image: artImage; |
1514 | - Loader { |
1515 | - anchors.fill: parent; |
1516 | - visible: false; |
1517 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
1518 | - Component { |
1519 | - id: artShapeShapeComponent; |
1520 | - UbuntuShape { |
1521 | - source: artImage; |
1522 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
1523 | - radius: "medium"; |
1524 | - aspect: { |
1525 | - switch (root.artShapeStyle) { |
1526 | - case "inset": return UbuntuShape.Inset; |
1527 | - case "shadow": return UbuntuShape.DropShadow; |
1528 | - default: |
1529 | - case "flat": return UbuntuShape.Flat; |
1530 | - } |
1531 | - } |
1532 | - } |
1533 | - } |
1534 | - Component { |
1535 | - id: artShapeIconComponent; |
1536 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
1537 | - } |
1538 | - } |
1539 | readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
1540 | readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1; |
1541 | Component.onCompleted: { updateWidthHeightBindings(); } |
1542 | @@ -73,7 +48,7 @@ |
1543 | objectName: "artImage"; |
1544 | source: artShapeLoader.cardArt; |
1545 | asynchronous: true; |
1546 | - visible: !false; |
1547 | + visible: true; |
1548 | width: root.width; |
1549 | height: width / artShape.aspect; |
1550 | } |
1551 | @@ -138,13 +113,5 @@ |
1552 | text: cardData && cardData["subtitle"] || ""; |
1553 | font.weight: Font.Light; |
1554 | } |
1555 | -UbuntuShape { |
1556 | - id: touchdown; |
1557 | - objectName: "touchdown"; |
1558 | - anchors { fill: artShapeHolder } |
1559 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1560 | - radius: "medium"; |
1561 | - borderSource: "radius_pressed.sci" |
1562 | -} |
1563 | implicitHeight: artShapeHolder.height; |
1564 | } |
1565 | |
1566 | === modified file 'tests/plugins/Dash/cardcreator/5.res.cardcreator' |
1567 | --- tests/plugins/Dash/cardcreator/5.res.cardcreator 2016-05-04 14:09:00 +0000 |
1568 | +++ tests/plugins/Dash/cardcreator/5.res.cardcreator 2016-05-20 15:34:28 +0000 |
1569 | @@ -1,11 +1,9 @@ |
1570 | AbstractButton { |
1571 | id: root; |
1572 | property var cardData; |
1573 | - property string artShapeStyle: "inset"; |
1574 | property string backgroundShapeStyle: "inset"; |
1575 | property real fontScale: 1.0; |
1576 | property var scopeStyle: null; |
1577 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1578 | readonly property string title: cardData && cardData["title"] || ""; |
1579 | property bool showHeader: true; |
1580 | implicitWidth: childrenRect.width; |
1581 | @@ -14,13 +12,14 @@ |
1582 | readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1); |
1583 | Item { |
1584 | id: artShapeHolder; |
1585 | - height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; |
1586 | - width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; |
1587 | + height: artShapeLoader.height; |
1588 | + width: artShapeLoader.width; |
1589 | anchors { horizontalCenter: parent.horizontalCenter; } |
1590 | Loader { |
1591 | id: artShapeLoader; |
1592 | objectName: "artShapeLoader"; |
1593 | readonly property string cardArt: cardData && cardData["art"] || ""; |
1594 | + onCardArtChanged: { if (item) { item.image.source = cardArt; } } |
1595 | active: cardArt != ""; |
1596 | asynchronous: false; |
1597 | visible: status == Loader.Ready; |
1598 | @@ -29,50 +28,15 @@ |
1599 | objectName: "artShape"; |
1600 | visible: image.status == Image.Ready; |
1601 | readonly property alias image: artImage; |
1602 | - Loader { |
1603 | - anchors.fill: parent; |
1604 | - visible: false; |
1605 | - sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; |
1606 | - Component { |
1607 | - id: artShapeShapeComponent; |
1608 | - UbuntuShape { |
1609 | - source: artImage; |
1610 | - sourceFillMode: UbuntuShape.PreserveAspectCrop; |
1611 | - radius: "medium"; |
1612 | - aspect: { |
1613 | - switch (root.artShapeStyle) { |
1614 | - case "inset": return UbuntuShape.Inset; |
1615 | - case "shadow": return UbuntuShape.DropShadow; |
1616 | - default: |
1617 | - case "flat": return UbuntuShape.Flat; |
1618 | - } |
1619 | - } |
1620 | - } |
1621 | - } |
1622 | - Component { |
1623 | - id: artShapeIconComponent; |
1624 | - ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } |
1625 | - } |
1626 | - } |
1627 | - readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; |
1628 | - readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1; |
1629 | - Component.onCompleted: { updateWidthHeightBindings(); } |
1630 | - Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } |
1631 | - function updateWidthHeightBindings() { |
1632 | - if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { |
1633 | - width = root.fixedArtShapeSize.width; |
1634 | - height = root.fixedArtShapeSize.height; |
1635 | - } else { |
1636 | - width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width }); |
1637 | - height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height }); |
1638 | - } |
1639 | - } |
1640 | + readonly property real aspect: 1; |
1641 | + width: image.status !== Image.Ready ? 0 : image.width; |
1642 | + height: image.status !== Image.Ready ? 0 : image.height; |
1643 | CroppedImageMinimumSourceSize { |
1644 | id: artImage; |
1645 | objectName: "artImage"; |
1646 | source: artShapeLoader.cardArt; |
1647 | asynchronous: false; |
1648 | - visible: !false; |
1649 | + visible: true; |
1650 | width: root.width; |
1651 | height: width / artShape.aspect; |
1652 | } |
1653 | @@ -137,13 +101,5 @@ |
1654 | text: cardData && cardData["subtitle"] || ""; |
1655 | font.weight: Font.Light; |
1656 | } |
1657 | -UbuntuShape { |
1658 | - id: touchdown; |
1659 | - objectName: "touchdown"; |
1660 | - anchors { fill: artShapeHolder } |
1661 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1662 | - radius: "medium"; |
1663 | - borderSource: "radius_pressed.sci" |
1664 | -} |
1665 | implicitHeight: artShapeHolder.height; |
1666 | } |
1667 | |
1668 | === modified file 'tests/plugins/Dash/cardcreator/5.tst' |
1669 | --- tests/plugins/Dash/cardcreator/5.tst 2016-01-28 14:11:14 +0000 |
1670 | +++ tests/plugins/Dash/cardcreator/5.tst 2016-05-20 15:34:28 +0000 |
1671 | @@ -1,3 +1,4 @@ |
1672 | template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true} |
1673 | components: {"art":{"aspect-ratio":1,"field":"art","conciergeMode":true},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}} |
1674 | +artShapeStyle: shadow |
1675 | result: 5.res |
1676 | |
1677 | === modified file 'tests/plugins/Dash/cardcreator/6.res' |
1678 | --- tests/plugins/Dash/cardcreator/6.res 2016-03-07 12:39:23 +0000 |
1679 | +++ tests/plugins/Dash/cardcreator/6.res 2016-05-20 15:34:28 +0000 |
1680 | @@ -1,16 +1,15 @@ |
1681 | AbstractButton { |
1682 | id: root; |
1683 | property var cardData; |
1684 | - property string artShapeStyle: "inset"; |
1685 | property string backgroundShapeStyle: "inset"; |
1686 | property real fontScale: 1.0; |
1687 | property var scopeStyle: null; |
1688 | - property int fixedHeaderHeight: -1; |
1689 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1690 | readonly property string title: cardData && cardData["title"] || ""; |
1691 | property bool showHeader: true; |
1692 | implicitWidth: childrenRect.width; |
1693 | enabled: true; |
1694 | + property int fixedHeaderHeight: -1; |
1695 | + property size fixedArtShapeSize: Qt.size(-1, -1); |
1696 | signal action(var actionId); |
1697 | Loader { |
1698 | id: backgroundLoader; |
1699 | @@ -119,7 +118,7 @@ |
1700 | id: touchdown; |
1701 | objectName: "touchdown"; |
1702 | anchors { fill: backgroundLoader } |
1703 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1704 | + visible: root.pressed; |
1705 | radius: "medium"; |
1706 | borderSource: "radius_pressed.sci" |
1707 | } |
1708 | |
1709 | === modified file 'tests/plugins/Dash/cardcreator/6.res.cardcreator' |
1710 | --- tests/plugins/Dash/cardcreator/6.res.cardcreator 2016-03-07 12:39:23 +0000 |
1711 | +++ tests/plugins/Dash/cardcreator/6.res.cardcreator 2016-05-20 15:34:28 +0000 |
1712 | @@ -1,11 +1,9 @@ |
1713 | AbstractButton { |
1714 | id: root; |
1715 | property var cardData; |
1716 | - property string artShapeStyle: "inset"; |
1717 | property string backgroundShapeStyle: "inset"; |
1718 | property real fontScale: 1.0; |
1719 | property var scopeStyle: null; |
1720 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1721 | readonly property string title: cardData && cardData["title"] || ""; |
1722 | property bool showHeader: true; |
1723 | implicitWidth: childrenRect.width; |
1724 | @@ -118,7 +116,7 @@ |
1725 | id: touchdown; |
1726 | objectName: "touchdown"; |
1727 | anchors { fill: backgroundLoader } |
1728 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1729 | + visible: root.pressed; |
1730 | radius: "medium"; |
1731 | borderSource: "radius_pressed.sci" |
1732 | } |
1733 | |
1734 | === modified file 'tests/plugins/Dash/cardcreator/6.tst' |
1735 | --- tests/plugins/Dash/cardcreator/6.tst 2015-05-13 10:21:18 +0000 |
1736 | +++ tests/plugins/Dash/cardcreator/6.tst 2016-05-20 15:34:28 +0000 |
1737 | @@ -1,3 +1,4 @@ |
1738 | 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} |
1739 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"subtitle":{"field":"author"},"title":{"field":"title"},"emblem":{"field":"source"},"attributes":{}} |
1740 | +artShapeStyle: inset |
1741 | result: 6.res |
1742 | |
1743 | === modified file 'tests/plugins/Dash/cardcreator/7.res' |
1744 | --- tests/plugins/Dash/cardcreator/7.res 2016-03-07 12:39:23 +0000 |
1745 | +++ tests/plugins/Dash/cardcreator/7.res 2016-05-20 15:34:28 +0000 |
1746 | @@ -1,16 +1,15 @@ |
1747 | AbstractButton { |
1748 | id: root; |
1749 | property var cardData; |
1750 | - property string artShapeStyle: "inset"; |
1751 | property string backgroundShapeStyle: "inset"; |
1752 | property real fontScale: 1.0; |
1753 | property var scopeStyle: null; |
1754 | + readonly property string title: cardData && cardData["title"] || ""; |
1755 | + property bool showHeader: true; |
1756 | + implicitWidth: childrenRect.width; |
1757 | + enabled: true; |
1758 | property int fixedHeaderHeight: -1; |
1759 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1760 | - readonly property string title: cardData && cardData["title"] || ""; |
1761 | - property bool showHeader: true; |
1762 | - implicitWidth: childrenRect.width; |
1763 | - enabled: true; |
1764 | signal action(var actionId); |
1765 | Loader { |
1766 | id: backgroundLoader; |
1767 | @@ -139,13 +138,5 @@ |
1768 | |
1769 | ] |
1770 | } |
1771 | -UbuntuShape { |
1772 | - id: touchdown; |
1773 | - objectName: "touchdown"; |
1774 | - anchors { fill: backgroundLoader } |
1775 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1776 | - radius: "medium"; |
1777 | - borderSource: "radius_pressed.sci" |
1778 | -} |
1779 | implicitHeight: row.y + row.height + units.gu(1); |
1780 | } |
1781 | |
1782 | === modified file 'tests/plugins/Dash/cardcreator/7.res.cardcreator' |
1783 | --- tests/plugins/Dash/cardcreator/7.res.cardcreator 2016-03-07 12:39:23 +0000 |
1784 | +++ tests/plugins/Dash/cardcreator/7.res.cardcreator 2016-05-20 15:34:28 +0000 |
1785 | @@ -1,11 +1,9 @@ |
1786 | AbstractButton { |
1787 | id: root; |
1788 | property var cardData; |
1789 | - property string artShapeStyle: "inset"; |
1790 | property string backgroundShapeStyle: "inset"; |
1791 | property real fontScale: 1.0; |
1792 | property var scopeStyle: null; |
1793 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1794 | readonly property string title: cardData && cardData["title"] || ""; |
1795 | property bool showHeader: true; |
1796 | implicitWidth: childrenRect.width; |
1797 | @@ -137,13 +135,5 @@ |
1798 | |
1799 | ] |
1800 | } |
1801 | -UbuntuShape { |
1802 | - id: touchdown; |
1803 | - objectName: "touchdown"; |
1804 | - anchors { fill: backgroundLoader } |
1805 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1806 | - radius: "medium"; |
1807 | - borderSource: "radius_pressed.sci" |
1808 | -} |
1809 | implicitHeight: row.y + row.height + units.gu(1); |
1810 | } |
1811 | |
1812 | === modified file 'tests/plugins/Dash/cardcreator/7.tst' |
1813 | --- tests/plugins/Dash/cardcreator/7.tst 2015-05-13 10:21:18 +0000 |
1814 | +++ tests/plugins/Dash/cardcreator/7.tst 2016-05-20 15:34:28 +0000 |
1815 | @@ -1,3 +1,4 @@ |
1816 | template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
1817 | components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}} |
1818 | +artShapeStyle: icon |
1819 | result: 7.res |
1820 | |
1821 | === modified file 'tests/plugins/Dash/cardcreator/8.res' |
1822 | --- tests/plugins/Dash/cardcreator/8.res 2016-03-07 12:39:23 +0000 |
1823 | +++ tests/plugins/Dash/cardcreator/8.res 2016-05-20 15:34:28 +0000 |
1824 | @@ -1,16 +1,15 @@ |
1825 | AbstractButton { |
1826 | id: root; |
1827 | property var cardData; |
1828 | - property string artShapeStyle: "inset"; |
1829 | property string backgroundShapeStyle: "inset"; |
1830 | property real fontScale: 1.0; |
1831 | property var scopeStyle: null; |
1832 | + readonly property string title: cardData && cardData["title"] || ""; |
1833 | + property bool showHeader: true; |
1834 | + implicitWidth: childrenRect.width; |
1835 | + enabled: true; |
1836 | property int fixedHeaderHeight: -1; |
1837 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1838 | - readonly property string title: cardData && cardData["title"] || ""; |
1839 | - property bool showHeader: true; |
1840 | - implicitWidth: childrenRect.width; |
1841 | - enabled: true; |
1842 | signal action(var actionId); |
1843 | Loader { |
1844 | id: backgroundLoader; |
1845 | @@ -101,7 +100,7 @@ |
1846 | id: touchdown; |
1847 | objectName: "touchdown"; |
1848 | anchors { fill: backgroundLoader } |
1849 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1850 | + visible: root.pressed; |
1851 | radius: "medium"; |
1852 | borderSource: "radius_pressed.sci" |
1853 | } |
1854 | |
1855 | === modified file 'tests/plugins/Dash/cardcreator/8.res.cardcreator' |
1856 | --- tests/plugins/Dash/cardcreator/8.res.cardcreator 2016-03-07 12:39:23 +0000 |
1857 | +++ tests/plugins/Dash/cardcreator/8.res.cardcreator 2016-05-20 15:34:28 +0000 |
1858 | @@ -1,11 +1,9 @@ |
1859 | AbstractButton { |
1860 | id: root; |
1861 | property var cardData; |
1862 | - property string artShapeStyle: "inset"; |
1863 | property string backgroundShapeStyle: "inset"; |
1864 | property real fontScale: 1.0; |
1865 | property var scopeStyle: null; |
1866 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1867 | readonly property string title: cardData && cardData["title"] || ""; |
1868 | property bool showHeader: true; |
1869 | implicitWidth: childrenRect.width; |
1870 | @@ -99,7 +97,7 @@ |
1871 | id: touchdown; |
1872 | objectName: "touchdown"; |
1873 | anchors { fill: backgroundLoader } |
1874 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1875 | + visible: root.pressed; |
1876 | radius: "medium"; |
1877 | borderSource: "radius_pressed.sci" |
1878 | } |
1879 | |
1880 | === modified file 'tests/plugins/Dash/cardcreator/8.tst' |
1881 | --- tests/plugins/Dash/cardcreator/8.tst 2015-06-22 08:29:55 +0000 |
1882 | +++ tests/plugins/Dash/cardcreator/8.tst 2016-05-20 15:34:28 +0000 |
1883 | @@ -1,3 +1,4 @@ |
1884 | template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2} |
1885 | components: {"background":{"field":"background"},"mascot":{"field":"icon"},"title":{"field":"title"},"attributes":{}} |
1886 | +artShapeStyle: inset |
1887 | result: 8.res |
1888 | |
1889 | === modified file 'tests/plugins/Dash/cardcreator/9.res' |
1890 | --- tests/plugins/Dash/cardcreator/9.res 2016-03-14 17:00:28 +0000 |
1891 | +++ tests/plugins/Dash/cardcreator/9.res 2016-05-20 15:34:28 +0000 |
1892 | @@ -1,16 +1,15 @@ |
1893 | AbstractButton { |
1894 | id: root; |
1895 | property var cardData; |
1896 | - property string artShapeStyle: "inset"; |
1897 | property string backgroundShapeStyle: "inset"; |
1898 | property real fontScale: 1.0; |
1899 | property var scopeStyle: null; |
1900 | + readonly property string title: cardData && cardData["title"] || ""; |
1901 | + property bool showHeader: true; |
1902 | + implicitWidth: childrenRect.width; |
1903 | + enabled: true; |
1904 | property int fixedHeaderHeight: -1; |
1905 | property size fixedArtShapeSize: Qt.size(-1, -1); |
1906 | - readonly property string title: cardData && cardData["title"] || ""; |
1907 | - property bool showHeader: true; |
1908 | - implicitWidth: childrenRect.width; |
1909 | - enabled: true; |
1910 | signal action(var actionId); |
1911 | readonly property size artShapeSize: Qt.size(-1, -1); |
1912 | readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin + audioProgressBar.height + audioProgressBar.anchors.topMargin; |
1913 | @@ -112,7 +111,7 @@ |
1914 | id: touchdown; |
1915 | objectName: "touchdown"; |
1916 | anchors { fill: root } |
1917 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1918 | + visible: root.pressed; |
1919 | radius: "medium"; |
1920 | borderSource: "radius_pressed.sci" |
1921 | } |
1922 | |
1923 | === modified file 'tests/plugins/Dash/cardcreator/9.res.cardcreator' |
1924 | --- tests/plugins/Dash/cardcreator/9.res.cardcreator 2016-03-21 16:06:10 +0000 |
1925 | +++ tests/plugins/Dash/cardcreator/9.res.cardcreator 2016-05-20 15:34:28 +0000 |
1926 | @@ -1,11 +1,9 @@ |
1927 | AbstractButton { |
1928 | id: root; |
1929 | property var cardData; |
1930 | - property string artShapeStyle: "inset"; |
1931 | property string backgroundShapeStyle: "inset"; |
1932 | property real fontScale: 1.0; |
1933 | property var scopeStyle: null; |
1934 | - property size fixedArtShapeSize: Qt.size(-1, -1); |
1935 | readonly property string title: cardData && cardData["title"] || ""; |
1936 | property bool showHeader: true; |
1937 | implicitWidth: childrenRect.width; |
1938 | @@ -111,7 +109,7 @@ |
1939 | id: touchdown; |
1940 | objectName: "touchdown"; |
1941 | anchors { fill: root } |
1942 | - visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; |
1943 | + visible: root.pressed; |
1944 | radius: "medium"; |
1945 | borderSource: "radius_pressed.sci" |
1946 | } |
1947 | |
1948 | === modified file 'tests/plugins/Dash/cardcreator/9.tst' |
1949 | --- tests/plugins/Dash/cardcreator/9.tst 2015-07-06 07:52:35 +0000 |
1950 | +++ tests/plugins/Dash/cardcreator/9.tst 2016-05-20 15:34:28 +0000 |
1951 | @@ -1,3 +1,4 @@ |
1952 | template: {"card-layout":"horizontal","card-size":"medium","category-layout":"grid","collapsed-rows":2,"quick-preview-type": "audio"} |
1953 | components: {"art":{"aspect-ratio":1},"subtitle":{"field":"author"},"title":{"field":"title"}, "quickPreviewData": "quickPreviewData"} |
1954 | +artShapeStyle: inset |
1955 | result: 9.res |
1956 | |
1957 | === modified file 'tests/plugins/Dash/cardcreatortest.cpp' |
1958 | --- tests/plugins/Dash/cardcreatortest.cpp 2016-02-16 13:34:54 +0000 |
1959 | +++ tests/plugins/Dash/cardcreatortest.cpp 2016-05-20 15:34:28 +0000 |
1960 | @@ -73,6 +73,7 @@ |
1961 | { |
1962 | const QString templateString("template: "); |
1963 | const QString componentsString("components: "); |
1964 | + const QString artShapeStyleString("artShapeStyle: "); |
1965 | const QString resultString("result: "); |
1966 | |
1967 | const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/"; |
1968 | @@ -87,24 +88,26 @@ |
1969 | |
1970 | QVERIFY(lines[0].startsWith(templateString)); |
1971 | QVERIFY(lines[1].startsWith(componentsString)); |
1972 | - QVERIFY(lines[2].startsWith(resultString)); |
1973 | + QVERIFY(lines[2].startsWith(artShapeStyleString)); |
1974 | + QVERIFY(lines[3].startsWith(resultString)); |
1975 | |
1976 | const QString templateJSON = lines[0].mid(templateString.length()); |
1977 | const QString componentsJSON = lines[1].mid(componentsString.length()); |
1978 | - const QString resultFileName = lines[2].mid(resultString.length()); |
1979 | + const QString artShapeStyle = lines[2].mid(artShapeStyleString.length()); |
1980 | + const QString resultFileName = lines[3].mid(resultString.length()); |
1981 | QVariant cardStringResult; |
1982 | QVariant createCardComponentResult; |
1983 | |
1984 | - QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false)); |
1985 | + 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)); |
1986 | compareFileContents(testDirPath + resultFileName, cardStringResult.toString()); |
1987 | |
1988 | - QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true)); |
1989 | + 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)); |
1990 | compareFileContents(testDirPath + resultFileName + ".cardcreator", cardStringResult.toString()); |
1991 | |
1992 | - QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false)); |
1993 | + 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)); |
1994 | QVERIFY(createCardComponentResult.toBool()); |
1995 | |
1996 | - QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true)); |
1997 | + 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)); |
1998 | QVERIFY(createCardComponentResult.toBool()); |
1999 | } |
2000 | } |
2001 | |
2002 | === modified file 'tests/plugins/Dash/cardcreatortest.qml' |
2003 | --- tests/plugins/Dash/cardcreatortest.qml 2016-02-16 13:34:54 +0000 |
2004 | +++ tests/plugins/Dash/cardcreatortest.qml 2016-05-20 15:34:28 +0000 |
2005 | @@ -19,11 +19,11 @@ |
2006 | |
2007 | Item { |
2008 | id: root |
2009 | - function cardString(template, components, isCardCreator) { |
2010 | - return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator); |
2011 | + function cardString(template, components, isCardCreator, artShapeStyle) { |
2012 | + return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator, artShapeStyle); |
2013 | } |
2014 | |
2015 | - function createCardComponent(template, components, isCardCreator) { |
2016 | - return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator) !== null; |
2017 | + function createCardComponent(template, components, isCardCreator, artShapeStyle) { |
2018 | + return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator, artShapeStyle) !== null; |
2019 | } |
2020 | } |
2021 | |
2022 | === modified file 'tests/qmltests/Dash/tst_Card.qml' |
2023 | --- tests/qmltests/Dash/tst_Card.qml 2016-05-04 14:09:00 +0000 |
2024 | +++ tests/qmltests/Dash/tst_Card.qml 2016-05-20 15:34:28 +0000 |
2025 | @@ -496,6 +496,18 @@ |
2026 | tryCompare(art, "visible", true); |
2027 | compare(artImage.source, Qt.resolvedUrl("artwork/checkers.png")); |
2028 | |
2029 | + card.cardData["art"] = "somethingbroken"; |
2030 | + card.cardDataChanged(); |
2031 | + waitForRendering(card); |
2032 | + tryCompare(art, "visible", true); |
2033 | + compare(artImage.source, Qt.resolvedUrl("artwork/checkers.png")); |
2034 | + |
2035 | + card.cardData["art"] = Qt.resolvedUrl("artwork/music-player-design.png"); |
2036 | + card.cardDataChanged(); |
2037 | + waitForRendering(card); |
2038 | + tryCompare(art, "visible", true); |
2039 | + compare(artImage.source, Qt.resolvedUrl("artwork/music-player-design.png")); |
2040 | + |
2041 | card.cardData["mascot"] = "somethingbroken2"; |
2042 | card.cardDataChanged(); |
2043 | compare(mascotImage.status, Image.Error); |