@@ -59,14 +59,30 @@ var kBackgroundLoaderCode = 'Loader {\n\
5959 } \n\
6060 }\n';
6161
62+// %1 is the aspect of the UbuntuShape
63+var kArtUbuntuShapeCode = 'UbuntuShape { \n\
64+ anchors.fill: parent; \n\
65+ source: artImage; \n\
66+ sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\
67+ radius: "medium"; \n\
68+ aspect: %1; \n\
69+ }';
70+
71+var kArtProportionalShapeCode = 'ProportionalShape { \n\
72+ anchors.fill: parent; \n\
73+ source: artImage; \n\
74+ aspect: UbuntuShape.DropShadow; \n\
75+ }';
76+
6277// %1 is used as anchors of artShapeHolder
6378// %2 is used as image width
6479// %3 is used as image height
65−// %4 is whether the image or the Loader with the UbuntuShape/ProportionalShape should be visible
80+// %4 is whether the image should be visible
6681// %5 is used as aspect ratio fallback
6782// %6 is whether the loader should be asynchronous or not
68−// %7 is injected as code to artImage
69−// %8 is used as image fallback
83+// %7 is the shape code we want to use
84+// %8 is injected as code to artImage
85+// %9 is used as image fallback
7086var kArtShapeHolderCode = 'Item { \n\
7187 id: artShapeHolder; \n\
7288 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
@@ -75,7 +91,8 @@ var kArtShapeHolderCode = 'Item { \n\
7591 Loader { \n\
7692 id: artShapeLoader; \n\
7793 objectName: "artShapeLoader"; \n\
78− readonly property string cardArt: cardData && cardData["art"] || %8; \n\
94+ readonly property string cardArt: cardData && cardData["art"] || %9; \n\
95+ onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
7996 active: cardArt != ""; \n\
8097 asynchronous: %6; \n\
8198 visible: status == Loader.Ready; \n\
@@ -84,31 +101,7 @@ var kArtShapeHolderCode = 'Item { \n\
84101 objectName: "artShape"; \n\
85102 visible: image.status == Image.Ready; \n\
86103 readonly property alias image: artImage; \n\
87− Loader { \n\
88− anchors.fill: parent; \n\
89− visible: %4; \n\
90− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
91− Component { \n\
92− id: artShapeShapeComponent; \n\
93− UbuntuShape { \n\
94− source: artImage; \n\
95− sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\
96− radius: "medium"; \n\
97− aspect: { \n\
98− switch (root.artShapeStyle) { \n\
99− case "inset": return UbuntuShape.Inset; \n\
100− case "shadow": return UbuntuShape.DropShadow; \n\
101− default: \n\
102− case "flat": return UbuntuShape.Flat; \n\
103− } \n\
104− } \n\
105− } \n\
106− } \n\
107− Component { \n\
108− id: artShapeIconComponent; \n\
109− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } \n\
110− } \n\
111− } \n\
104+ %7 \n\
112105 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
113106 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
114107 Component.onCompleted: { updateWidthHeightBindings(); } \n\
@@ -127,10 +120,10 @@ var kArtShapeHolderCode = 'Item { \n\
127120 objectName: "artImage"; \n\
128121 source: artShapeLoader.cardArt; \n\
129122 asynchronous: %6; \n\
130− visible: !%4; \n\
123+ visible: %4; \n\
131124 width: %2; \n\
132125 height: %3; \n\
133− %7 \n\
126+ %8 \n\
134127 } \n\
135128 } \n\
136129 } \n\
@@ -318,7 +311,7 @@ var kTouchdownCode = 'UbuntuShape { \n\
318311 id: touchdown; \n\
319312 objectName: "touchdown"; \n\
320313 anchors { %1 } \n\
321− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; \n\
314+ visible: root.pressed; \n\
322315 radius: "medium"; \n\
323316 borderSource: "radius_pressed.sci" \n\
324317 }\n';
@@ -412,7 +405,7 @@ function sanitizeColor(colorString) {
412405 return colorString;
413406}
414407
415−function cardString(template, components, isCardTool) {
408+function cardString(template, components, isCardTool, artShapeStyle) {
416409 var code;
417410
418411 var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false";
@@ -420,7 +413,6 @@ function cardString(template, components, isCardTool) {
420413 code = 'AbstractButton { \n\
421414 id: root; \n\
422415 property var cardData; \n\
423− property string artShapeStyle: "inset"; \n\
424416 property string backgroundShapeStyle: "inset"; \n\
425417 property real fontScale: 1.0; \n\
426418 property var scopeStyle: null; \n\
@@ -519,17 +511,35 @@ function cardString(template, components, isCardTool) {
519511 var fallbackStatusCode = "";
520512 var fallbackURICode = '""';
521513 if (fallback !== "") {
522− // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode
523− // which in kArtShapeHolderCode is %8
524− fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %8;';
514+ // fallbackStatusCode has %9 in it because we want to substitute it for fallbackURICode
515+ // which in kArtShapeHolderCode is %9
516+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %9;';
525517 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
526518 }
519+ var artShapeHolderShapeCode;
520+ if (!isConciergeMode) {
521+ if (artShapeStyle === "icon") {
522+ artShapeHolderShapeCode = kArtProportionalShapeCode;
523+ } else {
524+ var artShapeHolderShapeAspect;
525+ switch (artShapeStyle) {
526+ case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break;
527+ case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break;
528+ default:
529+ case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break;
530+ }
531+ artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(artShapeHolderShapeAspect);
532+ }
533+ } else {
534+ artShapeHolderShapeCode = "";
535+ }
527536 code += kArtShapeHolderCode.arg(artAnchors)
528537 .arg(widthCode)
529538 .arg(heightCode)
530− .arg(isConciergeMode ? "false" : "true")
539+ .arg(isConciergeMode ? "true" : "false")
531540 .arg(aspectRatio)
532541 .arg(asynchronous)
542+ .arg(artShapeHolderShapeCode)
533543 .arg(fallbackStatusCode)
534544 .arg(fallbackURICode);
535545 } else {
@@ -854,6 +864,10 @@ function cardString(template, components, isCardTool) {
854864 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
855865 }
856866
867+// <<<<<<< TREE
868+// if (artShapeStyle != "shadow" && artShapeStyle != "icon") {
869+// var touchdownAnchors;
870+// =======
857871 if (hasSocialActions) {
858872 var socialAnchors;
859873 var socialTopAnchor;
@@ -882,15 +896,17 @@ function cardString(template, components, isCardTool) {
882896 code += kSocialActionsRowCode.arg(socialAnchors).arg(socialColor);
883897 }
884898
885− var touchdownAnchors;
886− if (hasBackground) {
887− touchdownAnchors = 'fill: backgroundLoader';
888− } else if (touchdownOnArtShape) {
889− touchdownAnchors = 'fill: artShapeHolder';
890− } else {
891− touchdownAnchors = 'fill: root'
899+ if (artShapeStyle != "shadow" && artShapeStyle != "icon") {
900+ var touchdownAnchors;
901+ if (hasBackground) {
902+ touchdownAnchors = 'fill: backgroundLoader';
903+ } else if (touchdownOnArtShape) {
904+ touchdownAnchors = 'fill: artShapeHolder';
905+ } else {
906+ touchdownAnchors = 'fill: root'
907+ }
908+ code += kTouchdownCode.arg(touchdownAnchors);
892909 }
893− code += kTouchdownCode.arg(touchdownAnchors);
894910
895911 var implicitHeight = 'implicitHeight: ';
896912 if (hasSocialActions) {
@@ -925,13 +941,13 @@ function cardString(template, components, isCardTool) {
925941 return code;
926942}
927943
928−function createCardComponent(parent, template, components, isCardTool, identifier) {
944+function createCardComponent(parent, template, components, isCardTool, artShapeStyle, identifier) {
929945 var imports = 'import QtQuick 2.4; \n\
930946 import Ubuntu.Components 1.3; \n\
931947 import Ubuntu.Settings.Components 0.1; \n\
932948 import Dash 0.1;\n\
933949 import Utils 0.1;\n';
934− var card = cardString(template, components, isCardTool);
950+ var card = cardString(template, components, isCardTool, artShapeStyle);
935951 var code = imports + 'Component {\n' + card + '}\n';
936952
937953 try {