@@ -61,7 +61,9 @@ 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 injected as code to artImage
66+// %6 is injected as code to artImage
65var kArtShapeHolderCode = 'Item { \n\
67var kArtShapeHolderCode = 'Item { \n\
66 id: artShapeHolder; \n\
68 id: artShapeHolder; \n\
67 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
69 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
@@ -76,7 +78,6 @@ var kArtShapeHolderCode = 'Item { \n\
76 sourceComponent: Item { \n\
78 sourceComponent: Item { \n\
77 id: artShape; \n\
79 id: artShape; \n\
78 objectName: "artShape"; \n\
80 objectName: "artShape"; \n\
79− readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true; \n\
80 visible: image.status == Image.Ready; \n\
81 visible: image.status == Image.Ready; \n\
81 readonly property alias image: artImage; \n\
82 readonly property alias image: artImage; \n\
82 ShaderEffectSource { \n\
83 ShaderEffectSource { \n\
@@ -85,11 +86,11 @@ var kArtShapeHolderCode = 'Item { \n\
85 anchors.centerIn: parent; \n\
86 anchors.centerIn: parent; \n\
86 width: 1; \n\
87 width: 1; \n\
87 height: 1; \n\
88 height: 1; \n\
88− hideSource: doShapeItem; \n\
89+ hideSource: %5; \n\
90 Loader { \n\
91 Loader { \n\
91 anchors.fill: parent; \n\
92 anchors.fill: parent; \n\
92− visible: artShape.doShapeItem; \n\
93+ visible: %5; \n\
93 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
94 sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
94 Component { \n\
95 Component { \n\
95 id: artShapeShapeComponent; \n\
96 id: artShapeShapeComponent; \n\
@@ -113,7 +114,7 @@ var kArtShapeHolderCode = 'Item { \n\
115 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
116 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
116− readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
117+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %4; \n\
117 Component.onCompleted: { updateWidthHeightBindings(); } \n\
118 Component.onCompleted: { updateWidthHeightBindings(); } \n\
118 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
119 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
119 function updateWidthHeightBindings() { \n\
120 function updateWidthHeightBindings() { \n\
@@ -132,7 +133,7 @@ var kArtShapeHolderCode = 'Item { \n\
132 asynchronous: root.asynchronous; \n\
133 asynchronous: root.asynchronous; \n\
133 width: %2; \n\
134 width: %2; \n\
134 height: %3; \n\
135 height: %3; \n\
@@ -398,7 +399,6 @@ function cardString(template, components) {
399 code = 'AbstractButton { \n\
400 code = 'AbstractButton { \n\
400 id: root; \n\
401 id: root; \n\
401− property var components; \n\
402 property var cardData; \n\
402 property var cardData; \n\
403 property string artShapeStyle: "inset"; \n\
403 property string artShapeStyle: "inset"; \n\
404 property string backgroundShapeStyle: "inset"; \n\
404 property string backgroundShapeStyle: "inset"; \n\
@@ -416,7 +416,8 @@ function cardString(template, components) {
417 var hasArt = components["art"] && components["art"]["field"] || false;
417 var hasArt = components["art"] && components["art"]["field"] || false;
418 var hasSummary = components["summary"] || false;
418 var hasSummary = components["summary"] || false;
419+ var isConciergeMode = components["art"] && components["art"]["conciergeMode"] || false;
419− var artAndSummary = hasArt && hasSummary && components["art"]["conciergeMode"] !== true;
420+ var artAndSummary = hasArt && hasSummary && !isConciergeMode;
420 var isHorizontal = template["card-layout"] === "horizontal";
421 var isHorizontal = template["card-layout"] === "horizontal";
421 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
422 var hasBackground = (!isHorizontal && (template["card-background"] || components["background"] || artAndSummary)) ||
422 (hasSummary && (template["card-background"] || components["background"]));
423 (hasSummary && (template["card-background"] || components["background"]));
@@ -478,12 +479,16 @@ function cardString(template, components) {
478 heightCode = 'width / artShape.aspect';
479 heightCode = 'width / artShape.aspect';
482+ var aspectRatio = components["art"] && components["art"]["aspect-ratio"] || 1;
483+ if (typeof aspectRatio !== "number") {
481 var fallback = components["art"] && components["art"]["fallback"] || "";
486 var fallback = components["art"] && components["art"]["fallback"] || "";
482 var fallbackCode = "";
487 var fallbackCode = "";
483 if (fallback !== "") {
488 if (fallback !== "") {
484 fallbackCode += 'onStatusChanged: if (status === Image.Error) source = "%1";'.arg(fallback);
489 fallbackCode += 'onStatusChanged: if (status === Image.Error) source = "%1";'.arg(fallback);
486− code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(fallbackCode);
491+ code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode).arg(aspectRatio).arg(isConciergeMode ? "false" : "true").arg(fallbackCode);
488 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
493 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'