@@ -16,6 +16,9 @@
1616
1717.pragma library
1818
19+// %1 is the template["card-background"] string
20+// %2 is the template["card-background"]["elements"][0]
21+// %3 is the template["card-background"]["elements"][1]
1922var kBackgroundLoaderCode = 'Loader {\n\
2023 id: backgroundLoader; \n\
2124 objectName: "backgroundLoader"; \n\
@@ -34,18 +37,14 @@ var kBackgroundLoaderCode = 'Loader {\n\
3437 objectName: "backgroundImage"; \n\
3538 source: { \n\
3639 if (cardData && typeof cardData["background"] === "string") return cardData["background"]; \n\
37− else if (template && typeof template["card-background"] === "string") return template["card-background"]; \n\
38− else return ""; \n\
40+ else return "%1"; \n\
3941 } \n\
4042 } \n\
4143 function getColor(index) { \n\
4244 if (cardData && typeof cardData["background"] === "object" \n\
4345 && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) { \n\
4446 return cardData["background"]["elements"][index]; \n\
45− } else if (template && typeof template["card-background"] === "object" \n\
46− && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) { \n\
47− return template["card-background"]["elements"][index]; \n\
48− } else return undefined; \n\
47+ } else return index === 0 ? %2 : %3; \n\
4948 } \n\
5049 } \n\
5150 }\n';
@@ -70,6 +69,7 @@ var kArtShapeHolderCode = 'Item { \n\
7069 property bool doShapeItem: components["art"]["conciergeMode"] !== true; \n\
7170 visible: image.status == Image.Ready; \n\
7271 readonly property alias image: artImage.image; \n\
72+ property alias borderSource: artShapeShape.borderSource; \n\
7373 ShaderEffectSource { \n\
7474 id: artShapeSource; \n\
7575 sourceItem: artImage; \n\
@@ -79,6 +79,7 @@ var kArtShapeHolderCode = 'Item { \n\
7979 hideSource: doShapeItem; \n\
8080 } \n\
8181 Shape { \n\
82+ id: artShapeShape; \n\
8283 image: artShapeSource; \n\
8384 anchors.fill: parent; \n\
8485 visible: doShapeItem; \n\
@@ -315,9 +316,11 @@ var kSummaryLabelCode = 'Label { \n\
315316
316317function cardString(template, components) {
317318 var code;
319+
320+ var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false";
321+
318322 code = 'AbstractButton { \n\
319323 id: root; \n\
320− property var template; \n\
321324 property var components; \n\
322325 property var cardData; \n\
323326 property var artShapeBorderSource: undefined; \n\
@@ -330,8 +333,8 @@ function cardString(template, components) {
330333 property bool asynchronous: true; \n\
331334 property bool showHeader: true; \n\
332335 implicitWidth: childrenRect.width; \n\
333− enabled: root.template == null ? true : (root.template["non-interactive"] !== undefined ? !root.template["non-interactive"] : true); \n\
334− \n';
336+ enabled: %1; \n\
337+ \n'.arg(templateInteractive);
335338
336339 var hasArt = components["art"] && components["art"]["field"] || false;
337340 var hasSummary = components["summary"] || false;
@@ -348,7 +351,18 @@ function cardString(template, components) {
348351 var hasAttributes = hasTitle && components["attributes"]["field"] || false;
349352
350353 if (hasBackground) {
351− code += kBackgroundLoaderCode;
354+ var templateCardBackground = (template && typeof template["card-background"] === "string") ? template["card-background"] : "";
355+ var backgroundElements0;
356+ var backgroundElements1;
357+ if (template && typeof template["card-background"] === "object" && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
358+ if (template["card-background"]["elements"][0] !== undefined) {
359+ backgroundElements0 = '"%1"'.arg(template["card-background"]["elements"][0]);
360+ }
361+ if (template["card-background"]["elements"][1] !== undefined) {
362+ backgroundElements1 = '"%1"'.arg(template["card-background"]["elements"][1]);
363+ }
364+ }
365+ code += kBackgroundLoaderCode.arg(templateCardBackground).arg(backgroundElements0).arg(backgroundElements1);
352366 }
353367
354368 if (hasArt) {