@@ -59,14 +59,30 @@ var kBackgroundLoaderCode = 'Loader {\n\
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\
71+var kArtProportionalShapeCode = 'ProportionalShape { \n\
72+ anchors.fill: parent; \n\
73+ source: artImage; \n\
74+ aspect: UbuntuShape.DropShadow; \n\
62// %1 is used as anchors of artShapeHolder
77// %1 is used as anchors of artShapeHolder
63// %2 is used as image width
78// %2 is used as image width
64// %3 is used as image height
79// %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
66// %5 is used as aspect ratio fallback
81// %5 is used as aspect ratio fallback
67// %6 is whether the loader should be asynchronous or not
82// %6 is whether the loader should be asynchronous or not
83+// %7 is the shape code we want to use
68−// %7 is injected as code to artImage
84+// %8 is injected as code to artImage
69−// %8 is used as image fallback
85+// %9 is used as image fallback
70var kArtShapeHolderCode = 'Item { \n\
86var kArtShapeHolderCode = 'Item { \n\
71 id: artShapeHolder; \n\
87 id: artShapeHolder; \n\
72 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
88 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
@@ -75,7 +91,8 @@ var kArtShapeHolderCode = 'Item { \n\
75 Loader { \n\
91 Loader { \n\
76 id: artShapeLoader; \n\
92 id: artShapeLoader; \n\
77 objectName: "artShapeLoader"; \n\
93 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\
79 active: cardArt != ""; \n\
96 active: cardArt != ""; \n\
80 asynchronous: %6; \n\
97 asynchronous: %6; \n\
81 visible: status == Loader.Ready; \n\
98 visible: status == Loader.Ready; \n\
@@ -84,31 +101,7 @@ var kArtShapeHolderCode = 'Item { \n\
84 objectName: "artShape"; \n\
101 objectName: "artShape"; \n\
85 visible: image.status == Image.Ready; \n\
102 visible: image.status == Image.Ready; \n\
86 readonly property alias image: artImage; \n\
103 readonly property alias image: artImage; \n\
88− anchors.fill: parent; \n\
90− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; \n\
92− id: artShapeShapeComponent; \n\
94− source: artImage; \n\
95− sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\
96− radius: "medium"; \n\
98− switch (root.artShapeStyle) { \n\
99− case "inset": return UbuntuShape.Inset; \n\
100− case "shadow": return UbuntuShape.DropShadow; \n\
102− case "flat": return UbuntuShape.Flat; \n\
108− id: artShapeIconComponent; \n\
109− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; } \n\
112 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
105 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
113 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
106 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : %5; \n\
114 Component.onCompleted: { updateWidthHeightBindings(); } \n\
107 Component.onCompleted: { updateWidthHeightBindings(); } \n\
@@ -127,10 +120,10 @@ var kArtShapeHolderCode = 'Item { \n\
127 objectName: "artImage"; \n\
120 objectName: "artImage"; \n\
128 source: artShapeLoader.cardArt; \n\
121 source: artShapeLoader.cardArt; \n\
129 asynchronous: %6; \n\
122 asynchronous: %6; \n\
130− visible: !%4; \n\
123+ visible: %4; \n\
131 width: %2; \n\
124 width: %2; \n\
132 height: %3; \n\
125 height: %3; \n\
@@ -318,7 +311,7 @@ var kTouchdownCode = 'UbuntuShape { \n\
318 id: touchdown; \n\
311 id: touchdown; \n\
319 objectName: "touchdown"; \n\
312 objectName: "touchdown"; \n\
320 anchors { %1 } \n\
313 anchors { %1 } \n\
321− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; \n\
314+ visible: root.pressed; \n\
322 radius: "medium"; \n\
315 radius: "medium"; \n\
323 borderSource: "radius_pressed.sci" \n\
316 borderSource: "radius_pressed.sci" \n\
@@ -412,7 +405,7 @@ function sanitizeColor(colorString) {
412 return colorString;
405 return colorString;
415−function cardString(template, components, isCardTool) {
408+function cardString(template, components, isCardTool, artShapeStyle) {
416 var code;
409 var code;
418 var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false";
411 var templateInteractive = (template == null ? true : (template["non-interactive"] !== undefined ? !template["non-interactive"] : true)) ? "true" : "false";
@@ -420,7 +413,6 @@ function cardString(template, components, isCardTool) {
420 code = 'AbstractButton { \n\
413 code = 'AbstractButton { \n\
421 id: root; \n\
414 id: root; \n\
422 property var cardData; \n\
415 property var cardData; \n\
423− property string artShapeStyle: "inset"; \n\
424 property string backgroundShapeStyle: "inset"; \n\
416 property string backgroundShapeStyle: "inset"; \n\
425 property real fontScale: 1.0; \n\
417 property real fontScale: 1.0; \n\
426 property var scopeStyle: null; \n\
418 property var scopeStyle: null; \n\
@@ -519,17 +511,35 @@ function cardString(template, components, isCardTool) {
519 var fallbackStatusCode = "";
511 var fallbackStatusCode = "";
520 var fallbackURICode = '""';
512 var fallbackURICode = '""';
521 if (fallback !== "") {
513 if (fallback !== "") {
522− // fallbackStatusCode has %6 in it because we want to substitute it for fallbackURICode
514+ // fallbackStatusCode has %9 in it because we want to substitute it for fallbackURICode
523− // which in kArtShapeHolderCode is %8
515+ // which in kArtShapeHolderCode is %9
524− fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %8;';
516+ fallbackStatusCode += 'onStatusChanged: if (status === Image.Error) source = %9;';
525 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
517 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
519+ var artShapeHolderShapeCode;
520+ if (!isConciergeMode) {
521+ if (artShapeStyle === "icon") {
522+ artShapeHolderShapeCode = kArtProportionalShapeCode;
524+ var artShapeHolderShapeAspect;
525+ switch (artShapeStyle) {
526+ case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break;
527+ case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break;
529+ case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break;
531+ artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(artShapeHolderShapeAspect);
534+ artShapeHolderShapeCode = "";
527 code += kArtShapeHolderCode.arg(artAnchors)
536 code += kArtShapeHolderCode.arg(artAnchors)
528 .arg(widthCode)
537 .arg(widthCode)
529 .arg(heightCode)
538 .arg(heightCode)
530− .arg(isConciergeMode ? "false" : "true")
539+ .arg(isConciergeMode ? "true" : "false")
531 .arg(aspectRatio)
540 .arg(aspectRatio)
532 .arg(asynchronous)
541 .arg(asynchronous)
542+ .arg(artShapeHolderShapeCode)
533 .arg(fallbackStatusCode)
543 .arg(fallbackStatusCode)
534 .arg(fallbackURICode);
544 .arg(fallbackURICode);
@@ -854,6 +864,10 @@ function cardString(template, components, isCardTool) {
854 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
864 code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
868+// if (artShapeStyle != "shadow" && artShapeStyle != "icon") {
869+// var touchdownAnchors;
857 if (hasSocialActions) {
871 if (hasSocialActions) {
858 var socialAnchors;
872 var socialAnchors;
859 var socialTopAnchor;
873 var socialTopAnchor;
@@ -882,15 +896,17 @@ function cardString(template, components, isCardTool) {
882 code += kSocialActionsRowCode.arg(socialAnchors).arg(socialColor);
896 code += kSocialActionsRowCode.arg(socialAnchors).arg(socialColor);
899+ if (artShapeStyle != "shadow" && artShapeStyle != "icon") {
885− var touchdownAnchors;
900+ var touchdownAnchors;
886− if (hasBackground) {
901+ if (hasBackground) {
887− touchdownAnchors = 'fill: backgroundLoader';
902+ touchdownAnchors = 'fill: backgroundLoader';
888− } else if (touchdownOnArtShape) {
903+ } else if (touchdownOnArtShape) {
889− touchdownAnchors = 'fill: artShapeHolder';
904+ touchdownAnchors = 'fill: artShapeHolder';
890− } else {
905+ } else {
891− touchdownAnchors = 'fill: root'
906+ touchdownAnchors = 'fill: root'
908+ code += kTouchdownCode.arg(touchdownAnchors);
893− code += kTouchdownCode.arg(touchdownAnchors);
895 var implicitHeight = 'implicitHeight: ';
911 var implicitHeight = 'implicitHeight: ';
896 if (hasSocialActions) {
912 if (hasSocialActions) {
@@ -925,13 +941,13 @@ function cardString(template, components, isCardTool) {
925 return code;
941 return code;
928−function createCardComponent(parent, template, components, isCardTool, identifier) {
944+function createCardComponent(parent, template, components, isCardTool, artShapeStyle, identifier) {
929 var imports = 'import QtQuick 2.4; \n\
945 var imports = 'import QtQuick 2.4; \n\
930 import Ubuntu.Components 1.3; \n\
946 import Ubuntu.Components 1.3; \n\
931 import Ubuntu.Settings.Components 0.1; \n\
947 import Ubuntu.Settings.Components 0.1; \n\
932 import Dash 0.1;\n\
948 import Dash 0.1;\n\
933 import Utils 0.1;\n';
949 import Utils 0.1;\n';
934− var card = cardString(template, components, isCardTool);
950+ var card = cardString(template, components, isCardTool, artShapeStyle);
935 var code = imports + 'Component {\n' + card + '}\n';
951 var code = imports + 'Component {\n' + card + '}\n';