@@ -129,6 +129,51 @@ var kArtShapeHolderCode = 'Item { \n\
132+// %1 is used as anchors of artShapeHolder
133+// %2 is used as image width
134+// %3 is used as image height
135+// %4 is whether the image should be visible
136+// %5 is used as aspect ratio
137+// %6 is whether the loader should be asynchronous or not
138+// %7 is the shape code we want to use
139+// %8 is injected as code to artImage
140+// %9 is used as image fallback
141+var kArtShapeHolderCodeCardToolCard = 'Item { \n\
142+ id: artShapeHolder; \n\
143+ height: artShapeLoader.height; \n\
144+ width: artShapeLoader.width; \n\
147+ id: artShapeLoader; \n\
148+ objectName: "artShapeLoader"; \n\
149+ readonly property string cardArt: cardData && cardData["art"] || %9; \n\
150+ onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
151+ active: cardArt != ""; \n\
152+ asynchronous: %6; \n\
153+ visible: status == Loader.Ready; \n\
154+ sourceComponent: Item { \n\
156+ objectName: "artShape"; \n\
157+ visible: image.status == Image.Ready; \n\
158+ readonly property alias image: artImage; \n\
160+ readonly property real aspect: %5; \n\
161+ width: image.status !== Image.Ready ? 0 : image.width; \n\
162+ height: image.status !== Image.Ready ? 0 : image.height; \n\
163+ CroppedImageMinimumSourceSize { \n\
165+ objectName: "artImage"; \n\
166+ source: artShapeLoader.cardArt; \n\
167+ asynchronous: %6; \n\
132// %1 is anchors.fill
177// %1 is anchors.fill
133// %2 is width
178// %2 is width
134// %3 is height
179// %3 is height
@@ -416,15 +461,16 @@ function cardString(template, components, isCardTool, artShapeStyle) {
416 property string backgroundShapeStyle: "inset"; \n\
461 property string backgroundShapeStyle: "inset"; \n\
417 property real fontScale: 1.0; \n\
462 property real fontScale: 1.0; \n\
418 property var scopeStyle: null; \n\
463 property var scopeStyle: null; \n\
420− property size fixedArtShapeSize: Qt.size(-1, -1); \n\
421 readonly property string title: cardData && cardData["title"] || ""; \n\
464 readonly property string title: cardData && cardData["title"] || ""; \n\
422 property bool showHeader: true; \n\
465 property bool showHeader: true; \n\
423 implicitWidth: childrenRect.width; \n\
466 implicitWidth: childrenRect.width; \n\
424 enabled: %1; \n\
467 enabled: %1; \n\
425 \n'.arg(templateInteractive);
468 \n'.arg(templateInteractive);
427− code = code.arg(isCardTool ? "" : "property int fixedHeaderHeight: -1; \n");
471+ code += "property int fixedHeaderHeight: -1; \n\
472+ property size fixedArtShapeSize: Qt.size(-1, -1); \n";
429 var hasArt = components["art"] && components["art"]["field"] || false;
475 var hasArt = components["art"] && components["art"]["field"] || false;
430 var hasSummary = components["summary"] || false;
476 var hasSummary = components["summary"] || false;
@@ -533,15 +579,16 @@ function cardString(template, components, isCardTool, artShapeStyle) {
534 artShapeHolderShapeCode = "";
580 artShapeHolderShapeCode = "";
582+ var artShapeHolderCode = isCardTool ? kArtShapeHolderCodeCardToolCard : kArtShapeHolderCode;
536− code += kArtShapeHolderCode.arg(artAnchors)
583+ code += artShapeHolderCode.arg(artAnchors)
537− .arg(widthCode)
584+ .arg(widthCode)
538− .arg(heightCode)
585+ .arg(heightCode)
539− .arg(isConciergeMode ? "true" : "false")
586+ .arg(isConciergeMode ? "true" : "false")
540− .arg(aspectRatio)
587+ .arg(aspectRatio)
541− .arg(asynchronous)
588+ .arg(asynchronous)
542− .arg(artShapeHolderShapeCode)
589+ .arg(artShapeHolderShapeCode)
543− .arg(fallbackStatusCode)
590+ .arg(fallbackStatusCode)
544− .arg(fallbackURICode);
591+ .arg(fallbackURICode);
546 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
593 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'