@@ -61,8 +61,10 @@ var kBackgroundLoaderCode = 'Loader {\n\
61// %1 is used as anchors of artShapeHolder
61// %1 is used as anchors of artShapeHolder
62// %2 is used as image width
62// %2 is used as image width
63// %3 is used as image height
63// %3 is used as image height
64+// %4 is used for artShapeSource.hideSource and inner Loader visible
65+// %5 is used as aspect ratio fallback
64−// %4 is injected as code to artImage
66+// %6 is injected as code to artImage
65−// %5 is used as image fallback
67+// %7 is used as image fallback
66var kArtShapeHolderCode = 'Item { \n\
68var kArtShapeHolderCode = 'Item { \n\
67 id: artShapeHolder; \n\
69 id: artShapeHolder; \n\
68 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
70 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
@@ -71,14 +73,13 @@ var kArtShapeHolderCode = 'Item { \n\
71 Loader { \n\
73 Loader { \n\
72 id: artShapeLoader; \n\
74 id: artShapeLoader; \n\
73 objectName: "artShapeLoader"; \n\
75 objectName: "artShapeLoader"; \n\
74− readonly property string cardArt: cardData && cardData["art"] || %5; \n\
76+ readonly property string cardArt: cardData && cardData["art"] || %7; \n\
75 active: cardArt != ""; \n\
77 active: cardArt != ""; \n\
76 asynchronous: root.asynchronous; \n\
78 asynchronous: root.asynchronous; \n\
77 visible: status == Loader.Ready; \n\
79 visible: status == Loader.Ready; \n\
78 sourceComponent: Item { \n\
80 sourceComponent: Item { \n\
79 id: artShape; \n\
81 id: artShape; \n\
80 objectName: "artShape"; \n\
82 objectName: "artShape"; \n\
81− readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true; \n\
82 visible: image.status == Image.Ready; \n\
83 visible: image.status == Image.Ready; \n\
83 readonly property alias image: artImage; \n\
84 readonly property alias image: artImage; \n\
84 ShaderEffectSource { \n\
85 ShaderEffectSource { \n\
@@ -87,11 +88,11 @@ var kArtShapeHolderCode = 'Item { \n\
87 anchors.centerIn: parent; \n\
88 anchors.centerIn: parent; \n\
88 width: 1; \n\
89 width: 1; \n\
89 height: 1; \n\
90 height: 1; \n\
90− hideSource: doShapeItem; \n\
91+ hideSource: %4; \n\
92 Loader { \n\
93 Loader { \n\
93 anchors.fill: parent; \n\
94 anchors.fill: parent; \n\
94− visible: artShape.doShapeItem; \n\
95+ visible: %4; \n\
95 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
96 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
96 Component { \n\
97 Component { \n\
97 id: artShapeShapeComponent; \n\
98 id: artShapeShapeComponent; \n\
@@ -115,7 +116,7 @@ var kArtShapeHolderCode = 'Item { \n\
117 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
118 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
118− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
119+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
119 Component.onCompleted: { updateWidthHeightBindings(); } \n\
120 Component.onCompleted: { updateWidthHeightBindings(); } \n\
120 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
121 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
121 function updateWidthHeightBindings() { \n\
122 function updateWidthHeightBindings() { \n\
@@ -134,7 +135,7 @@ var kArtShapeHolderCode = 'Item { \n\
134 asynchronous: root.asynchronous; \n\
135 asynchronous: root.asynchronous; \n\
135 width: %2; \n\
136 width: %2; \n\
136 height: %3; \n\
137 height: %3; \n\
@@ -395,7 +396,6 @@ function cardString(template, components) {
396 code = 'AbstractButton { \n\
397 code = 'AbstractButton { \n\
397 id: root; \n\
398 id: root; \n\
398− property var components; \n\
399 property var cardData; \n\
399 property var cardData; \n\
400 property string artShapeStyle: "inset"; \n\
400 property string artShapeStyle: "inset"; \n\
401 property string backgroundShapeStyle: "inset"; \n\
401 property string backgroundShapeStyle: "inset"; \n\
@@ -413,7 +413,8 @@ function cardString(template, components) {
414 var hasArt = components["art"] && components["art"]["field"] || false;
414 var hasArt = components["art"] && components["art"]["field"] || false;
415 var hasSummary = components["summary"] || false;
415 var hasSummary = components["summary"] || false;
416+ var isConciergeMode = components["art"] && components["art"]["conciergeMode"] || false;
416− var artAndSummary = hasArt && hasSummary && components["art"]["conciergeMode"] !== true;
417+ var artAndSummary = hasArt && hasSummary && !isConciergeMode;
417 var isHorizontal = template["card-layout"] === "horizontal";
418 var isHorizontal = template["card-layout"] === "horizontal";
418 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
419 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
419 (hasSummary && (template["card-background"] || components["background"]));
420 (hasSummary && (template["card-background"] || components["background"]));
@@ -483,17 +484,21 @@ function cardString(template, components) {
483 heightCode = 'width / artShape.aspect';
484 heightCode = 'width / artShape.aspect';
487+ var aspectRatio = components["art"] && components["art"]["aspect-ratio"] || 1;
488+ if (isNaN(aspectRatio)) {
486 var fallback = components["art"] && components["art"]["fallback"] || "";
491 var fallback = components["art"] && components["art"]["fallback"] || "";
487 fallback = encodeURI(fallback);
492 fallback = encodeURI(fallback);
488 var fallbackStatusCode = "";
493 var fallbackStatusCode = "";
489 var fallbackURICode = '""';
494 var fallbackURICode = '""';
490 if (fallback !== "") {
495 if (fallback !== "") {
491− // fallbackStatusCode has %5 in it because we want to substitute it for fallbackURICode
496+ // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode
492− // which in kArtShapeHolderCode is %5
497+ // which in kArtShapeHolderCode is %7
493− fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %5;';
498+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %7;';
494 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
499 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
496− code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(fallbackStatusCode).arg(fallbackURICode);
501+ code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(isConciergeMode ? "false" : "true").arg(aspectRatio).arg(fallbackStatusCode).arg(fallbackURICode);
498 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
503 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'