@@ -61,9 +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 as aspect ratio fallback
65−// %5 is used for artShapeSource.hideSource and inner Loader visible
64+// %4 is used for artShapeSource.hideSource and inner Loader visible
65+// %5 is used as aspect ratio fallback
66// %6 is injected as code to artImage
66// %6 is injected as code to artImage
67+// %7 is used as image fallback
67var kArtShapeHolderCode = 'Item { \n\
68var kArtShapeHolderCode = 'Item { \n\
68 id: artShapeHolder; \n\
69 id: artShapeHolder; \n\
69 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
70 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
@@ -72,7 +73,8 @@ var kArtShapeHolderCode = 'Item { \n\
72 Loader { \n\
73 Loader { \n\
73 id: artShapeLoader; \n\
74 id: artShapeLoader; \n\
74 objectName: "artShapeLoader"; \n\
75 objectName: "artShapeLoader"; \n\
75− active: cardData && cardData["art"] || false; \n\
76+ readonly property string cardArt: cardData && cardData["art"] || %7; \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\
@@ -86,11 +88,11 @@ var kArtShapeHolderCode = 'Item { \n\
86 anchors.centerIn: parent; \n\
88 anchors.centerIn: parent; \n\
87 width: 1; \n\
89 width: 1; \n\
88 height: 1; \n\
90 height: 1; \n\
89− hideSource: %5; \n\
91+ hideSource: %4; \n\
91 Loader { \n\
93 Loader { \n\
92 anchors.fill: parent; \n\
94 anchors.fill: parent; \n\
93− visible: %5; \n\
95+ visible: %4; \n\
94 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
96 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
95 Component { \n\
97 Component { \n\
96 id: artShapeShapeComponent; \n\
98 id: artShapeShapeComponent; \n\
@@ -114,7 +116,7 @@ var kArtShapeHolderCode = 'Item { \n\
116 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\
117− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %4; \n\
119+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
118 Component.onCompleted: { updateWidthHeightBindings(); } \n\
120 Component.onCompleted: { updateWidthHeightBindings(); } \n\
119 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
121 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
120 function updateWidthHeightBindings() { \n\
122 function updateWidthHeightBindings() { \n\
@@ -129,7 +131,7 @@ var kArtShapeHolderCode = 'Item { \n\
129 CroppedImageMinimumSourceSize { \n\
131 CroppedImageMinimumSourceSize { \n\
130 id: artImage; \n\
132 id: artImage; \n\
131 objectName: "artImage"; \n\
133 objectName: "artImage"; \n\
132− source: cardData && cardData["art"] || ""; \n\
134+ source: artShapeLoader.cardArt; \n\
133 asynchronous: root.asynchronous; \n\
135 asynchronous: root.asynchronous; \n\
134 width: %2; \n\
136 width: %2; \n\
135 height: %3; \n\
137 height: %3; \n\
@@ -246,11 +248,12 @@ var kMascotShapeLoaderCode = 'Loader { \n\
246// %1 is used as anchors of mascotImage
248// %1 is used as anchors of mascotImage
247// %2 is used as visible of mascotImage
249// %2 is used as visible of mascotImage
248// %3 is injected as code to mascotImage
250// %3 is injected as code to mascotImage
251+// %4 is used as fallback image
249var kMascotImageCode = 'CroppedImageMinimumSourceSize { \n\
252var kMascotImageCode = 'CroppedImageMinimumSourceSize { \n\
250 id: mascotImage; \n\
253 id: mascotImage; \n\
251 objectName: "mascotImage"; \n\
254 objectName: "mascotImage"; \n\
252 anchors { %1 } \n\
255 anchors { %1 } \n\
253− source: cardData && cardData["mascot"] || ""; \n\
256+ source: cardData && cardData["mascot"] || %4; \n\
254 width: units.gu(6); \n\
257 width: units.gu(6); \n\
255 height: units.gu(5.625); \n\
258 height: units.gu(5.625); \n\
256 horizontalAlignment: Image.AlignHCenter; \n\
259 horizontalAlignment: Image.AlignHCenter; \n\
@@ -487,11 +490,15 @@ function cardString(template, components) {
488 var fallback = components["art"] && components["art"]["fallback"] || "";
491 var fallback = components["art"] && components["art"]["fallback"] || "";
489 fallback = encodeURI(fallback);
492 fallback = encodeURI(fallback);
490− var fallbackCode = "";
493+ var fallbackStatusCode = "";
494+ var fallbackURICode = '""';
491 if (fallback !== "") {
495 if (fallback !== "") {
496+ // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode
497+ // which in kArtShapeHolderCode is %7
492− fallbackCode += 'onStatusChanged: if (status === Image.Error) source = decodeURI("%1");'.arg(fallback);
498+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %7;';
499+ fallbackURICode = 'decodeURI("%1")'.arg(fallback);
494− code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(aspectRatio).arg(isConciergeMode ? "false" : "true").arg(fallbackCode);
501+ code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(isConciergeMode ? "false" : "true").arg(aspectRatio).arg(fallbackStatusCode).arg(fallbackURICode);
496 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
503 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
@@ -585,11 +592,15 @@ function cardString(template, components) {
585 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
592 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
586 var fallback = components["mascot"] && components["mascot"]["fallback"] || "";
593 var fallback = components["mascot"] && components["mascot"]["fallback"] || "";
587 fallback = encodeURI(fallback);
594 fallback = encodeURI(fallback);
588− var fallbackCode = "";
595+ var fallbackStatusCode = "";
596+ var fallbackURICode = '""';
589 if (fallback !== "") {
597 if (fallback !== "") {
598+ // fallbackStatusCode has %4 in it because we want to substitute it for fallbackURICode
599+ // which in kMascotImageCode is %4
590− fallbackCode += 'onStatusChanged: if (status === Image.Error) source = decodeURI("%1");'.arg(fallback);
600+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %4;';
601+ fallbackURICode = 'decodeURI("%1")'.arg(fallback);
592− mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible).arg(fallbackCode);
603+ mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible).arg(fallbackStatusCode).arg(fallbackURICode);
595 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white")';
606 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? theme.palette.normal.baseText : "white")';