on xenial help sign in
Merge lp:~aacid/unity8/recoverArtIfChanges
43c9818Albert Astals Cid
plugins/Dash/CardCreator.js+64−48
@@ -59,14 +59,30 @@ var kBackgroundLoaderCode = 'Loader {\n\
59 } \n\
59 } \n\
60 }\n';
60 }\n';
61
61
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+
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\
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\
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\
133− %7 \n\
126+ %8 \n\
134 } \n\
127 } \n\
135 } \n\
128 } \n\
136 } \n\
129 } \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\
324 }\n';
317 }\n';
@@ -412,7 +405,7 @@ function sanitizeColor(colorString) {
412 return colorString;
405 return colorString;
413}
406}
414
407
415−function cardString(template, components, isCardTool) {
408+function cardString(template, components, isCardTool, artShapeStyle) {
416 var code;
409 var code;
417
410
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);
526 }
518 }
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+ }
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);
535 } else {
545 } else {
@@ -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);
855 }
865 }
856
866
867+// <<<<<<< TREE
868+// if (artShapeStyle != "shadow" && artShapeStyle != "icon") {
869+// var touchdownAnchors;
870+// =======
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);
883 }
897 }
884
898
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'
907+ }
908+ code += kTouchdownCode.arg(touchdownAnchors);
892 }
909 }
893− code += kTouchdownCode.arg(touchdownAnchors);
894
910
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;
926}
942}
927
943
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';
936
952
937 try {
953 try {
plugins/Dash/CardCreatorCache.qml+2−2
@@ -23,7 +23,7 @@ QtObject {
23
23
24 property var cache: new Object();
24 property var cache: new Object();
25
25
26− function getCardComponent(template, components, isCardTool) {
26+ function getCardComponent(template, components, isCardTool, artShapeStyle) {
27 if (template === undefined || components === undefined)
27 if (template === undefined || components === undefined)
28 return undefined;
28 return undefined;
29
29
@@ -32,7 +32,7 @@ QtObject {
32 var allString = tString + cString + isCardTool;
32 var allString = tString + cString + isCardTool;
33 var component = cache[allString];
33 var component = cache[allString];
34 if (component === undefined) {
34 if (component === undefined) {
35− component = CardCreator.createCardComponent(root, template, components, isCardTool, allString);
35+ component = CardCreator.createCardComponent(root, template, components, isCardTool, artShapeStyle, allString);
36 cache[allString] = component;
36 cache[allString] = component;
37 }
37 }
38 return component;
38 return component;
qml/Dash/CardCarousel.qml−1
@@ -66,7 +66,6 @@ DashRenderer {
66 item.cardData = Qt.binding(function() { return model; });
66 item.cardData = Qt.binding(function() { return model; });
67 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
67 item.fontScale = Qt.binding(function() { return carousel.fontScale; });
68 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
68 item.showHeader = Qt.binding(function() { return loader.explicitlyScaled; });
69− item.artShapeStyle = "shadow";
70 item.scopeStyle = cardCarousel.scopeStyle;
69 item.scopeStyle = cardCarousel.scopeStyle;
71 }
70 }
72 }
71 }
qml/Dash/CardGrid.qml−2
@@ -25,7 +25,6 @@ DashRenderer {
25 if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2;
25 if (!cardTool || !cardTool.template || typeof cardTool.template["collapsed-rows"] != "number") return 2;
26 return cardTool.template["collapsed-rows"];
26 return cardTool.template["collapsed-rows"];
27 }
27 }
28− property string artShapeStyle: "inset";
29 property string backgroundShapeStyle: "inset";
28 property string backgroundShapeStyle: "inset";
30 property alias minimumHorizontalSpacing: grid.minimumHorizontalSpacing
29 property alias minimumHorizontalSpacing: grid.minimumHorizontalSpacing
31
30
@@ -71,7 +70,6 @@ DashRenderer {
71 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
70 item.fixedArtShapeSize = Qt.binding(function() { return cardTool.artShapeSize; });
72 item.cardData = Qt.binding(function() { return model; });
71 item.cardData = Qt.binding(function() { return model; });
73 item.scopeStyle = root.scopeStyle;
72 item.scopeStyle = root.scopeStyle;
74− item.artShapeStyle = root.artShapeStyle;
75 item.backgroundShapeStyle = root.backgroundShapeStyle;
73 item.backgroundShapeStyle = root.backgroundShapeStyle;
76 }
74 }
77 Connections {
75 Connections {
qml/Dash/CardTool.qml+6−2
@@ -66,7 +66,11 @@ Item {
66 return layout;
66 return layout;
67 }
67 }
68
68
69+
70+ // Not readonly because gets overwritten from GenericScopeView in some cases
71+ property string artShapeStyle: categoryLayout === "carousel" ? "shadow" : "inset"
72+
69− property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false);
73+ property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false, artShapeStyle);
70
74
71 // FIXME: Saviq
75 // FIXME: Saviq
72 // Only way for the card below to actually be laid out completely.
76 // Only way for the card below to actually be laid out completely.
@@ -208,7 +212,7 @@ Item {
208 "attributes": attributesModel.model,
212 "attributes": attributesModel.model,
209 "socialActions": socialActionsModel.model
213 "socialActions": socialActionsModel.model
210 }
214 }
211− sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true);
215+ sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true, artShapeStyle);
212 onLoaded: {
216 onLoaded: {
213 item.objectName = "cardToolCard";
217 item.objectName = "cardToolCard";
214 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
218 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
qml/Dash/GenericScopeView.qml+2−2
@@ -345,10 +345,10 @@ FocusScope {
345 if (scope && scope.id === "clickscope") {
345 if (scope && scope.id === "clickscope") {
346 if (categoryId === "predefined" || categoryId === "local") {
346 if (categoryId === "predefined" || categoryId === "local") {
347 cardTool.artShapeSize = Qt.binding(function() { return Qt.size(units.gu(8), units.gu(7.5)) });
347 cardTool.artShapeSize = Qt.binding(function() { return Qt.size(units.gu(8), units.gu(7.5)) });
348− item.artShapeStyle = "icon";
348+ cardTool.artShapeStyle = "icon";
349 } else {
349 } else {
350 // Should be ubuntu store icon
350 // Should be ubuntu store icon
351− item.artShapeStyle = "flat";
351+ cardTool.artShapeStyle = "flat";
352 item.backgroundShapeStyle = "shadow";
352 item.backgroundShapeStyle = "shadow";
353 }
353 }
354 }
354 }
tests/plugins/Dash/cardcreator/1.res+8−26
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -22,6 +21,7 @@ Item {
22 id: artShapeLoader;
21 id: artShapeLoader;
23 objectName: "artShapeLoader";
22 objectName: "artShapeLoader";
24 readonly property string cardArt: cardData && cardData["art"] || "";
23 readonly property string cardArt: cardData && cardData["art"] || "";
24+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
25 active: cardArt != "";
25 active: cardArt != "";
26 asynchronous: true;
26 asynchronous: true;
27 visible: status == Loader.Ready;
27 visible: status == Loader.Ready;
@@ -30,30 +30,12 @@ Item {
30 objectName: "artShape";
30 objectName: "artShape";
31 visible: image.status == Image.Ready;
31 visible: image.status == Image.Ready;
32 readonly property alias image: artImage;
32 readonly property alias image: artImage;
33− Loader {
33+ UbuntuShape {
34 anchors.fill: parent;
34 anchors.fill: parent;
35− visible: true;
36− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
37− Component {
38− id: artShapeShapeComponent;
39− UbuntuShape {
40− source: artImage;
35+ source: artImage;
41− sourceFillMode: UbuntuShape.PreserveAspectCrop;
36+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
42− radius: "medium";
37+ radius: "medium";
43− aspect: {
44− switch (root.artShapeStyle) {
45− case "inset": return UbuntuShape.Inset;
38+ aspect: UbuntuShape.Inset;
46− case "shadow": return UbuntuShape.DropShadow;
47− default:
48− case "flat": return UbuntuShape.Flat;
49− }
50− }
51− }
52− }
53− Component {
54− id: artShapeIconComponent;
55− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
56− }
57 }
39 }
58 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
40 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
59 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
41 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
@@ -73,7 +55,7 @@ Item {
73 objectName: "artImage";
55 objectName: "artImage";
74 source: artShapeLoader.cardArt;
56 source: artShapeLoader.cardArt;
75 asynchronous: true;
57 asynchronous: true;
76− visible: !true;
58+ visible: false;
77 width: root.width;
59 width: root.width;
78 height: width / artShape.aspect;
60 height: width / artShape.aspect;
79 }
61 }
@@ -105,7 +87,7 @@ UbuntuShape {
105 id: touchdown;
87 id: touchdown;
106 objectName: "touchdown";
88 objectName: "touchdown";
107 anchors { fill: artShapeHolder }
89 anchors { fill: artShapeHolder }
108− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
90+ visible: root.pressed;
109 radius: "medium";
91 radius: "medium";
110 borderSource: "radius_pressed.sci"
92 borderSource: "radius_pressed.sci"
111}
93}
tests/plugins/Dash/cardcreator/1.res.cardcreator+8−26
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -21,6 +20,7 @@ Item {
21 id: artShapeLoader;
20 id: artShapeLoader;
22 objectName: "artShapeLoader";
21 objectName: "artShapeLoader";
23 readonly property string cardArt: cardData && cardData["art"] || "";
22 readonly property string cardArt: cardData && cardData["art"] || "";
23+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
24 active: cardArt != "";
24 active: cardArt != "";
25 asynchronous: false;
25 asynchronous: false;
26 visible: status == Loader.Ready;
26 visible: status == Loader.Ready;
@@ -29,30 +29,12 @@ Item {
29 objectName: "artShape";
29 objectName: "artShape";
30 visible: image.status == Image.Ready;
30 visible: image.status == Image.Ready;
31 readonly property alias image: artImage;
31 readonly property alias image: artImage;
32− Loader {
32+ UbuntuShape {
33 anchors.fill: parent;
33 anchors.fill: parent;
34− visible: true;
35− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
36− Component {
37− id: artShapeShapeComponent;
38− UbuntuShape {
39− source: artImage;
34+ source: artImage;
40− sourceFillMode: UbuntuShape.PreserveAspectCrop;
35+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
41− radius: "medium";
36+ radius: "medium";
42− aspect: {
43− switch (root.artShapeStyle) {
44− case "inset": return UbuntuShape.Inset;
37+ aspect: UbuntuShape.Inset;
45− case "shadow": return UbuntuShape.DropShadow;
46− default:
47− case "flat": return UbuntuShape.Flat;
48− }
49− }
50− }
51− }
52− Component {
53− id: artShapeIconComponent;
54− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
55− }
56 }
38 }
57 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
39 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
58 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
40 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1.6;
@@ -72,7 +54,7 @@ Item {
72 objectName: "artImage";
54 objectName: "artImage";
73 source: artShapeLoader.cardArt;
55 source: artShapeLoader.cardArt;
74 asynchronous: false;
56 asynchronous: false;
75− visible: !true;
57+ visible: false;
76 width: root.width;
58 width: root.width;
77 height: width / artShape.aspect;
59 height: width / artShape.aspect;
78 }
60 }
@@ -104,7 +86,7 @@ UbuntuShape {
104 id: touchdown;
86 id: touchdown;
105 objectName: "touchdown";
87 objectName: "touchdown";
106 anchors { fill: artShapeHolder }
88 anchors { fill: artShapeHolder }
107− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
89+ visible: root.pressed;
108 radius: "medium";
90 radius: "medium";
109 borderSource: "radius_pressed.sci"
91 borderSource: "radius_pressed.sci"
110}
92}
tests/plugins/Dash/cardcreator/1.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1.6,"field":"art"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: inset
3result: 1.res
4result: 1.res
tests/plugins/Dash/cardcreator/10.res−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -127,13 +126,5 @@ top: titleLabel.bottom;
127
126
128 ]
127 ]
129 }
128 }
130−UbuntuShape {
131− id: touchdown;
132− objectName: "touchdown";
133− anchors { fill: backgroundLoader }
134− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
135− radius: "medium";
136− borderSource: "radius_pressed.sci"
137− }
138implicitHeight: row.y + row.height + units.gu(1);
129implicitHeight: row.y + row.height + units.gu(1);
139}
130}
tests/plugins/Dash/cardcreator/10.res.cardcreator−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -125,13 +124,5 @@ top: titleLabel.bottom;
125
124
126 ]
125 ]
127 }
126 }
128−UbuntuShape {
129− id: touchdown;
130− objectName: "touchdown";
131− anchors { fill: backgroundLoader }
132− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
133− radius: "medium";
134− borderSource: "radius_pressed.sci"
135− }
136implicitHeight: row.y + row.height + units.gu(1);
127implicitHeight: row.y + row.height + units.gu(1);
137}
128}
tests/plugins/Dash/cardcreator/10.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2, "card-background": { "type": "color", "elements": [ "\\", ": 3; } Item { } function moo () { \"" ] } }
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2, "card-background": { "type": "color", "elements": [ "\\", ": 3; } Item { } function moo () { \"" ] } }
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: shadow
3result: 10.res
4result: 10.res
tests/plugins/Dash/cardcreator/11.res+11−29
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -60,6 +59,7 @@ Item {
60 id: artShapeLoader;
59 id: artShapeLoader;
61 objectName: "artShapeLoader";
60 objectName: "artShapeLoader";
62 readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C");
61 readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C");
62+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
63 active: cardArt != "";
63 active: cardArt != "";
64 asynchronous: true;
64 asynchronous: true;
65 visible: status == Loader.Ready;
65 visible: status == Loader.Ready;
@@ -68,32 +68,14 @@ Item {
68 objectName: "artShape";
68 objectName: "artShape";
69 visible: image.status == Image.Ready;
69 visible: image.status == Image.Ready;
70 readonly property alias image: artImage;
70 readonly property alias image: artImage;
71− Loader {
71+ UbuntuShape {
72− anchors.fill: parent;
72+ anchors.fill: parent;
73− visible: true;
74− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
75− Component {
76− id: artShapeShapeComponent;
77− UbuntuShape {
78− source: artImage;
73+ source: artImage;
79− sourceFillMode: UbuntuShape.PreserveAspectCrop;
74+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
80− radius: "medium";
75+ radius: "medium";
81− aspect: {
82− switch (root.artShapeStyle) {
83− case "inset": return UbuntuShape.Inset;
84− case "shadow": return UbuntuShape.DropShadow;
85− default:
86− case "flat": return UbuntuShape.Flat;
76+ aspect: UbuntuShape.Flat;
87− }
88− }
89− }
90− }
91− Component {
92− id: artShapeIconComponent;
93− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
94− }
95− }
77+ }
96− readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
78+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
97 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
79 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
98 Component.onCompleted: { updateWidthHeightBindings(); }
80 Component.onCompleted: { updateWidthHeightBindings(); }
99 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
81 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
@@ -111,7 +93,7 @@ Item {
111 objectName: "artImage";
93 objectName: "artImage";
112 source: artShapeLoader.cardArt;
94 source: artShapeLoader.cardArt;
113 asynchronous: true;
95 asynchronous: true;
114− visible: !true;
96+ visible: false;
115 width: root.width;
97 width: root.width;
116 height: width / artShape.aspect;
98 height: width / artShape.aspect;
117 onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
99 onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
@@ -199,7 +181,7 @@ UbuntuShape {
199 id: touchdown;
181 id: touchdown;
200 objectName: "touchdown";
182 objectName: "touchdown";
201 anchors { fill: backgroundLoader }
183 anchors { fill: backgroundLoader }
202− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
184+ visible: root.pressed;
203 radius: "medium";
185 radius: "medium";
204 borderSource: "radius_pressed.sci"
186 borderSource: "radius_pressed.sci"
205 }
187 }
tests/plugins/Dash/cardcreator/11.res.cardcreator+10−28
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -59,6 +58,7 @@ Item {
59 id: artShapeLoader;
58 id: artShapeLoader;
60 objectName: "artShapeLoader";
59 objectName: "artShapeLoader";
61 readonly property string cardArt: cardData && cardData["art"] || "";
60 readonly property string cardArt: cardData && cardData["art"] || "";
61+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
62 active: cardArt != "";
62 active: cardArt != "";
63 asynchronous: false;
63 asynchronous: false;
64 visible: status == Loader.Ready;
64 visible: status == Loader.Ready;
@@ -67,31 +67,13 @@ Item {
67 objectName: "artShape";
67 objectName: "artShape";
68 visible: image.status == Image.Ready;
68 visible: image.status == Image.Ready;
69 readonly property alias image: artImage;
69 readonly property alias image: artImage;
70− Loader {
70+ UbuntuShape {
71− anchors.fill: parent;
71+ anchors.fill: parent;
72− visible: true;
73− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
74− Component {
75− id: artShapeShapeComponent;
76− UbuntuShape {
77− source: artImage;
72+ source: artImage;
78− sourceFillMode: UbuntuShape.PreserveAspectCrop;
73+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
79− radius: "medium";
74+ radius: "medium";
80− aspect: {
81− switch (root.artShapeStyle) {
82− case "inset": return UbuntuShape.Inset;
83− case "shadow": return UbuntuShape.DropShadow;
84− default:
85− case "flat": return UbuntuShape.Flat;
75+ aspect: UbuntuShape.Flat;
86− }
87− }
88− }
89− }
90− Component {
91− id: artShapeIconComponent;
92− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
93− }
94− }
76+ }
95 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
77 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
96 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
78 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
97 Component.onCompleted: { updateWidthHeightBindings(); }
79 Component.onCompleted: { updateWidthHeightBindings(); }
@@ -110,7 +92,7 @@ Item {
110 objectName: "artImage";
92 objectName: "artImage";
111 source: artShapeLoader.cardArt;
93 source: artShapeLoader.cardArt;
112 asynchronous: false;
94 asynchronous: false;
113− visible: !true;
95+ visible: false;
114 width: root.width;
96 width: root.width;
115 height: width / artShape.aspect;
97 height: width / artShape.aspect;
116 }
98 }
@@ -195,7 +177,7 @@ UbuntuShape {
195 id: touchdown;
177 id: touchdown;
196 objectName: "touchdown";
178 objectName: "touchdown";
197 anchors { fill: backgroundLoader }
179 anchors { fill: backgroundLoader }
198− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
180+ visible: root.pressed;
199 radius: "medium";
181 radius: "medium";
200 borderSource: "radius_pressed.sci"
182 borderSource: "radius_pressed.sci"
201 }
183 }
tests/plugins/Dash/cardcreator/11.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2 }
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2 }
2components: {"art":{"aspect-ratio":1,"field":"art","fallback":"\\"},"background":{"field":"background"},"mascot":{"field":"icon","fallback":"\""},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1,"field":"art","fallback":"\\"},"background":{"field":"background"},"mascot":{"field":"icon","fallback":"\""},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: flat
3result: 11.res
4result: 11.res
tests/plugins/Dash/cardcreator/12.res+8−26
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -22,6 +21,7 @@ Item {
22 id: artShapeLoader;
21 id: artShapeLoader;
23 objectName: "artShapeLoader";
22 objectName: "artShapeLoader";
24 readonly property string cardArt: cardData && cardData["art"] || "";
23 readonly property string cardArt: cardData && cardData["art"] || "";
24+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
25 active: cardArt != "";
25 active: cardArt != "";
26 asynchronous: true;
26 asynchronous: true;
27 visible: status == Loader.Ready;
27 visible: status == Loader.Ready;
@@ -30,30 +30,12 @@ Item {
30 objectName: "artShape";
30 objectName: "artShape";
31 visible: image.status == Image.Ready;
31 visible: image.status == Image.Ready;
32 readonly property alias image: artImage;
32 readonly property alias image: artImage;
33− Loader {
33+ UbuntuShape {
34 anchors.fill: parent;
34 anchors.fill: parent;
35− visible: true;
36− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
37− Component {
38− id: artShapeShapeComponent;
39− UbuntuShape {
40− source: artImage;
35+ source: artImage;
41− sourceFillMode: UbuntuShape.PreserveAspectCrop;
36+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
42− radius: "medium";
37+ radius: "medium";
43− aspect: {
44− switch (root.artShapeStyle) {
45− case "inset": return UbuntuShape.Inset;
46− case "shadow": return UbuntuShape.DropShadow;
47− default:
48− case "flat": return UbuntuShape.Flat;
38+ aspect: UbuntuShape.Flat;
49− }
50− }
51− }
52− }
53− Component {
54− id: artShapeIconComponent;
55− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
56− }
57 }
39 }
58 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
40 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
59 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
41 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
@@ -73,7 +55,7 @@ Item {
73 objectName: "artImage";
55 objectName: "artImage";
74 source: artShapeLoader.cardArt;
56 source: artShapeLoader.cardArt;
75 asynchronous: true;
57 asynchronous: true;
76− visible: !true;
58+ visible: false;
77 width: root.width;
59 width: root.width;
78 height: width / artShape.aspect;
60 height: width / artShape.aspect;
79 }
61 }
@@ -131,7 +113,7 @@ UbuntuShape {
131 id: touchdown;
113 id: touchdown;
132 objectName: "touchdown";
114 objectName: "touchdown";
133 anchors { fill: artShapeHolder }
115 anchors { fill: artShapeHolder }
134− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
116+ visible: root.pressed;
135 radius: "medium";
117 radius: "medium";
136 borderSource: "radius_pressed.sci"
118 borderSource: "radius_pressed.sci"
137}
119}
tests/plugins/Dash/cardcreator/12.res.cardcreator+10−28
@@ -1,7 +1,6 @@
1−AbstractButton {
1+AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -17,10 +16,11 @@ Item {
17 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
16 height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
18 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
17 width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
19 anchors { horizontalCenter: parent.horizontalCenter; }
18 anchors { horizontalCenter: parent.horizontalCenter; }
20− Loader {
19+ Loader {
21 id: artShapeLoader;
20 id: artShapeLoader;
22 objectName: "artShapeLoader";
21 objectName: "artShapeLoader";
23 readonly property string cardArt: cardData && cardData["art"] || "";
22 readonly property string cardArt: cardData && cardData["art"] || "";
23+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
24 active: cardArt != "";
24 active: cardArt != "";
25 asynchronous: false;
25 asynchronous: false;
26 visible: status == Loader.Ready;
26 visible: status == Loader.Ready;
@@ -29,30 +29,12 @@ Item {
29 objectName: "artShape";
29 objectName: "artShape";
30 visible: image.status == Image.Ready;
30 visible: image.status == Image.Ready;
31 readonly property alias image: artImage;
31 readonly property alias image: artImage;
32− Loader {
32+ UbuntuShape {
33 anchors.fill: parent;
33 anchors.fill: parent;
34− visible: true;
35− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
36− Component {
37− id: artShapeShapeComponent;
38− UbuntuShape {
39− source: artImage;
34+ source: artImage;
40− sourceFillMode: UbuntuShape.PreserveAspectCrop;
35+ sourceFillMode: UbuntuShape.PreserveAspectCrop;
41− radius: "medium";
36+ radius: "medium";
42− aspect: {
43− switch (root.artShapeStyle) {
44− case "inset": return UbuntuShape.Inset;
45− case "shadow": return UbuntuShape.DropShadow;
46− default:
47− case "flat": return UbuntuShape.Flat;
37+ aspect: UbuntuShape.Flat;
48− }
49− }
50− }
51− }
52− Component {
53− id: artShapeIconComponent;
54− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
55− }
56 }
38 }
57 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
39 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
58 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
40 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
@@ -72,7 +54,7 @@ Item {
72 objectName: "artImage";
54 objectName: "artImage";
73 source: artShapeLoader.cardArt;
55 source: artShapeLoader.cardArt;
74 asynchronous: false;
56 asynchronous: false;
75− visible: !true;
57+ visible: false;
76 width: root.width;
58 width: root.width;
77 height: width / artShape.aspect;
59 height: width / artShape.aspect;
78 }
60 }
@@ -130,7 +112,7 @@ UbuntuShape {
130 id: touchdown;
112 id: touchdown;
131 objectName: "touchdown";
113 objectName: "touchdown";
132 anchors { fill: artShapeHolder }
114 anchors { fill: artShapeHolder }
133− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
115+ visible: root.pressed;
134 radius: "medium";
116 radius: "medium";
135 borderSource: "radius_pressed.sci"
117 borderSource: "radius_pressed.sci"
136}
118}
tests/plugins/Dash/cardcreator/12.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{},"social-actions":{}}
2components: {"art":{"aspect-ratio":0.75,"field":"art"},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{},"social-actions":{}}
3+artShapeStyle: flat
3result: 12.res
4result: 12.res
tests/plugins/Dash/cardcreator/2.res−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -126,13 +125,5 @@ CroppedImageMinimumSourceSize {
126
125
127 ]
126 ]
128 }
127 }
129−UbuntuShape {
130− id: touchdown;
131− objectName: "touchdown";
132− anchors { fill: backgroundLoader }
133− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
134− radius: "medium";
135− borderSource: "radius_pressed.sci"
136−}
137implicitHeight: row.y + row.height + units.gu(1);
128implicitHeight: row.y + row.height + units.gu(1);
138}
129}
tests/plugins/Dash/cardcreator/2.res.cardcreator−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -124,13 +123,5 @@ CroppedImageMinimumSourceSize {
124
123
125 ]
124 ]
126 }
125 }
127−UbuntuShape {
128− id: touchdown;
129− objectName: "touchdown";
130− anchors { fill: backgroundLoader }
131− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
132− radius: "medium";
133− borderSource: "radius_pressed.sci"
134−}
135implicitHeight: row.y + row.height + units.gu(1);
126implicitHeight: row.y + row.height + units.gu(1);
136}
127}
tests/plugins/Dash/cardcreator/2.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
1template: {"card-background":{"elements":["#E9E9E9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: icon
3result: 2.res
4result: 2.res
tests/plugins/Dash/cardcreator/3.res+5−33
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -22,6 +21,7 @@ Item {
22 id: artShapeLoader;
21 id: artShapeLoader;
23 objectName: "artShapeLoader";
22 objectName: "artShapeLoader";
24 readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
23 readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
24+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
25 active: cardArt != "";
25 active: cardArt != "";
26 asynchronous: true;
26 asynchronous: true;
27 visible: status == Loader.Ready;
27 visible: status == Loader.Ready;
@@ -30,30 +30,10 @@ Item {
30 objectName: "artShape";
30 objectName: "artShape";
31 visible: image.status == Image.Ready;
31 visible: image.status == Image.Ready;
32 readonly property alias image: artImage;
32 readonly property alias image: artImage;
33− Loader {
33+ ProportionalShape {
34 anchors.fill: parent;
34 anchors.fill: parent;
35− visible: true;
36− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
37− Component {
38− id: artShapeShapeComponent;
39− UbuntuShape {
40− source: artImage;
35+ source: artImage;
41− sourceFillMode: UbuntuShape.PreserveAspectCrop;
42− radius: "medium";
43− aspect: {
44− switch (root.artShapeStyle) {
45− case "inset": return UbuntuShape.Inset;
46− case "shadow": return UbuntuShape.DropShadow;
47− default:
48− case "flat": return UbuntuShape.Flat;
49− }
50− }
51− }
52− }
53− Component {
54− id: artShapeIconComponent;
55− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
36+ aspect: UbuntuShape.DropShadow;
56− }
57 }
37 }
58 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
38 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
59 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
39 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
@@ -73,7 +53,7 @@ Item {
73 objectName: "artImage";
53 objectName: "artImage";
74 source: artShapeLoader.cardArt;
54 source: artShapeLoader.cardArt;
75 asynchronous: true;
55 asynchronous: true;
76− visible: !true;
56+ visible: false;
77 width: root.width;
57 width: root.width;
78 height: width / artShape.aspect;
58 height: width / artShape.aspect;
79 onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
59 onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
@@ -120,13 +100,5 @@ Label {
120 text: cardData && cardData["subtitle"] || "";
100 text: cardData && cardData["subtitle"] || "";
121 font.weight: Font.Light;
101 font.weight: Font.Light;
122 }
102 }
123−UbuntuShape {
124− id: touchdown;
125− objectName: "touchdown";
126− anchors { fill: artShapeHolder }
127− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
128− radius: "medium";
129− borderSource: "radius_pressed.sci"
130−}
131implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
103implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
132}
104}
tests/plugins/Dash/cardcreator/3.res.cardcreator+5−33
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -21,6 +20,7 @@ Item {
21 id: artShapeLoader;
20 id: artShapeLoader;
22 objectName: "artShapeLoader";
21 objectName: "artShapeLoader";
23 readonly property string cardArt: cardData && cardData["art"] || "";
22 readonly property string cardArt: cardData && cardData["art"] || "";
23+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
24 active: cardArt != "";
24 active: cardArt != "";
25 asynchronous: false;
25 asynchronous: false;
26 visible: status == Loader.Ready;
26 visible: status == Loader.Ready;
@@ -29,30 +29,10 @@ Item {
29 objectName: "artShape";
29 objectName: "artShape";
30 visible: image.status == Image.Ready;
30 visible: image.status == Image.Ready;
31 readonly property alias image: artImage;
31 readonly property alias image: artImage;
32− Loader {
32+ ProportionalShape {
33 anchors.fill: parent;
33 anchors.fill: parent;
34− visible: true;
35− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
36− Component {
37− id: artShapeShapeComponent;
38− UbuntuShape {
39− source: artImage;
34+ source: artImage;
40− sourceFillMode: UbuntuShape.PreserveAspectCrop;
41− radius: "medium";
42− aspect: {
43− switch (root.artShapeStyle) {
44− case "inset": return UbuntuShape.Inset;
45− case "shadow": return UbuntuShape.DropShadow;
46− default:
47− case "flat": return UbuntuShape.Flat;
48− }
49− }
50− }
51− }
52− Component {
53− id: artShapeIconComponent;
54− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
35+ aspect: UbuntuShape.DropShadow;
55− }
56 }
36 }
57 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
37 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
58 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
38 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 0.75;
@@ -72,7 +52,7 @@ Item {
72 objectName: "artImage";
52 objectName: "artImage";
73 source: artShapeLoader.cardArt;
53 source: artShapeLoader.cardArt;
74 asynchronous: false;
54 asynchronous: false;
75− visible: !true;
55+ visible: false;
76 width: root.width;
56 width: root.width;
77 height: width / artShape.aspect;
57 height: width / artShape.aspect;
78 }
58 }
@@ -118,13 +98,5 @@ Label {
118 text: cardData && cardData["subtitle"] || "";
98 text: cardData && cardData["subtitle"] || "";
119 font.weight: Font.Light;
99 font.weight: Font.Light;
120 }
100 }
121−UbuntuShape {
122− id: touchdown;
123− objectName: "touchdown";
124− anchors { fill: artShapeHolder }
125− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
126− radius: "medium";
127− borderSource: "radius_pressed.sci"
128−}
129implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
101implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
130}
102}
tests/plugins/Dash/cardcreator/3.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
1template: {"card-layout":"vertical","card-size":"small","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":0.75,"field":"art","fallback":"IHAVE\\\"ESCAPED\\\"QUOTES\\\""},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":0.75,"field":"art","fallback":"IHAVE\\\"ESCAPED\\\"QUOTES\\\""},"subtitle":{"field":"price"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: icon
3result: 3.res
4result: 3.res
tests/plugins/Dash/cardcreator/4.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -103,7 +102,7 @@ UbuntuShape {
103 id: touchdown;
102 id: touchdown;
104 objectName: "touchdown";
103 objectName: "touchdown";
105 anchors { fill: root }
104 anchors { fill: root }
106− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
105+ visible: root.pressed;
107 radius: "medium";
106 radius: "medium";
108 borderSource: "radius_pressed.sci"
107 borderSource: "radius_pressed.sci"
109}
108}
tests/plugins/Dash/cardcreator/4.res.cardcreator+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -101,7 +100,7 @@ UbuntuShape {
101 id: touchdown;
100 id: touchdown;
102 objectName: "touchdown";
101 objectName: "touchdown";
103 anchors { fill: root }
102 anchors { fill: root }
104− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
103+ visible: root.pressed;
105 radius: "medium";
104 radius: "medium";
106 borderSource: "radius_pressed.sci"
105 borderSource: "radius_pressed.sci"
107}
106}
tests/plugins/Dash/cardcreator/4.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}
1template: {"card-layout":"horizontal","card-size":"large","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1},"mascot":{"field":"mascot"},"subtitle":{"field":"domain"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: flat
3result: 4.res
4result: 4.res
tests/plugins/Dash/cardcreator/5.res+2−35
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -22,6 +21,7 @@ Item {
22 id: artShapeLoader;
21 id: artShapeLoader;
23 objectName: "artShapeLoader";
22 objectName: "artShapeLoader";
24 readonly property string cardArt: cardData && cardData["art"] || "";
23 readonly property string cardArt: cardData && cardData["art"] || "";
24+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
25 active: cardArt != "";
25 active: cardArt != "";
26 asynchronous: true;
26 asynchronous: true;
27 visible: status == Loader.Ready;
27 visible: status == Loader.Ready;
@@ -30,31 +30,6 @@ Item {
30 objectName: "artShape";
30 objectName: "artShape";
31 visible: image.status == Image.Ready;
31 visible: image.status == Image.Ready;
32 readonly property alias image: artImage;
32 readonly property alias image: artImage;
33− Loader {
34− anchors.fill: parent;
35− visible: false;
36− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
37− Component {
38− id: artShapeShapeComponent;
39− UbuntuShape {
40− source: artImage;
41− sourceFillMode: UbuntuShape.PreserveAspectCrop;
42− radius: "medium";
43− aspect: {
44− switch (root.artShapeStyle) {
45− case "inset": return UbuntuShape.Inset;
46− case "shadow": return UbuntuShape.DropShadow;
47− default:
48− case "flat": return UbuntuShape.Flat;
49− }
50− }
51− }
52− }
53− Component {
54− id: artShapeIconComponent;
55− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
56− }
57− }
58 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
33 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
59 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
34 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
60 Component.onCompleted: { updateWidthHeightBindings(); }
35 Component.onCompleted: { updateWidthHeightBindings(); }
@@ -73,7 +48,7 @@ Item {
73 objectName: "artImage";
48 objectName: "artImage";
74 source: artShapeLoader.cardArt;
49 source: artShapeLoader.cardArt;
75 asynchronous: true;
50 asynchronous: true;
76− visible: !false;
51+ visible: true;
77 width: root.width;
52 width: root.width;
78 height: width / artShape.aspect;
53 height: width / artShape.aspect;
79 }
54 }
@@ -138,13 +113,5 @@ Label {
138 text: cardData && cardData["subtitle"] || "";
113 text: cardData && cardData["subtitle"] || "";
139 font.weight: Font.Light;
114 font.weight: Font.Light;
140 }
115 }
141−UbuntuShape {
142− id: touchdown;
143− objectName: "touchdown";
144− anchors { fill: artShapeHolder }
145− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
146− radius: "medium";
147− borderSource: "radius_pressed.sci"
148−}
149implicitHeight: artShapeHolder.height;
116implicitHeight: artShapeHolder.height;
150}
117}
tests/plugins/Dash/cardcreator/5.res.cardcreator+2−35
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -21,6 +20,7 @@ Item {
21 id: artShapeLoader;
20 id: artShapeLoader;
22 objectName: "artShapeLoader";
21 objectName: "artShapeLoader";
23 readonly property string cardArt: cardData && cardData["art"] || "";
22 readonly property string cardArt: cardData && cardData["art"] || "";
23+ onCardArtChanged: { if (item) { item.image.source = cardArt; } }
24 active: cardArt != "";
24 active: cardArt != "";
25 asynchronous: false;
25 asynchronous: false;
26 visible: status == Loader.Ready;
26 visible: status == Loader.Ready;
@@ -29,31 +29,6 @@ Item {
29 objectName: "artShape";
29 objectName: "artShape";
30 visible: image.status == Image.Ready;
30 visible: image.status == Image.Ready;
31 readonly property alias image: artImage;
31 readonly property alias image: artImage;
32− Loader {
33− anchors.fill: parent;
34− visible: false;
35− sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent;
36− Component {
37− id: artShapeShapeComponent;
38− UbuntuShape {
39− source: artImage;
40− sourceFillMode: UbuntuShape.PreserveAspectCrop;
41− radius: "medium";
42− aspect: {
43− switch (root.artShapeStyle) {
44− case "inset": return UbuntuShape.Inset;
45− case "shadow": return UbuntuShape.DropShadow;
46− default:
47− case "flat": return UbuntuShape.Flat;
48− }
49− }
50− }
51− }
52− Component {
53− id: artShapeIconComponent;
54− ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
55− }
56− }
57 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
32 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
58 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
33 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
59 Component.onCompleted: { updateWidthHeightBindings(); }
34 Component.onCompleted: { updateWidthHeightBindings(); }
@@ -72,7 +47,7 @@ Item {
72 objectName: "artImage";
47 objectName: "artImage";
73 source: artShapeLoader.cardArt;
48 source: artShapeLoader.cardArt;
74 asynchronous: false;
49 asynchronous: false;
75− visible: !false;
50+ visible: true;
76 width: root.width;
51 width: root.width;
77 height: width / artShape.aspect;
52 height: width / artShape.aspect;
78 }
53 }
@@ -137,13 +112,5 @@ Label {
137 text: cardData && cardData["subtitle"] || "";
112 text: cardData && cardData["subtitle"] || "";
138 font.weight: Font.Light;
113 font.weight: Font.Light;
139 }
114 }
140−UbuntuShape {
141− id: touchdown;
142− objectName: "touchdown";
143− anchors { fill: artShapeHolder }
144− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
145− radius: "medium";
146− borderSource: "radius_pressed.sci"
147−}
148implicitHeight: artShapeHolder.height;
115implicitHeight: artShapeHolder.height;
149}
116}
tests/plugins/Dash/cardcreator/5.tst+1
@@ -1,3 +1,4 @@
1template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
1template: {"non-interactive":true,"card-layout":"vertical","card-size":"medium","category-layout":"carousel","collapsed-rows":2,"overlay":true}
2components: {"art":{"aspect-ratio":1,"field":"art","conciergeMode":true},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
2components: {"art":{"aspect-ratio":1,"field":"art","conciergeMode":true},"subtitle":{"field":"artist"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: shadow
3result: 5.res
4result: 5.res
tests/plugins/Dash/cardcreator/6.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -119,7 +118,7 @@ UbuntuShape {
119 id: touchdown;
118 id: touchdown;
120 objectName: "touchdown";
119 objectName: "touchdown";
121 anchors { fill: backgroundLoader }
120 anchors { fill: backgroundLoader }
122− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
121+ visible: root.pressed;
123 radius: "medium";
122 radius: "medium";
124 borderSource: "radius_pressed.sci"
123 borderSource: "radius_pressed.sci"
125}
124}
tests/plugins/Dash/cardcreator/6.res.cardcreator+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -118,7 +117,7 @@ UbuntuShape {
118 id: touchdown;
117 id: touchdown;
119 objectName: "touchdown";
118 objectName: "touchdown";
120 anchors { fill: backgroundLoader }
119 anchors { fill: backgroundLoader }
121− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
120+ visible: root.pressed;
122 radius: "medium";
121 radius: "medium";
123 borderSource: "radius_pressed.sci"
122 borderSource: "radius_pressed.sci"
124}
123}
tests/plugins/Dash/cardcreator/6.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":"http://assets.ubuntu.com/sites/ubuntu/latest/u/img/logos/logo-ubuntu-grey.png","card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
1template: {"card-background":"http://assets.ubuntu.com/sites/ubuntu/latest/u/img/logos/logo-ubuntu-grey.png","card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"subtitle":{"field":"author"},"title":{"field":"title"},"emblem":{"field":"source"},"attributes":{}}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"subtitle":{"field":"author"},"title":{"field":"title"},"emblem":{"field":"source"},"attributes":{}}
3+artShapeStyle: inset
3result: 6.res
4result: 6.res
tests/plugins/Dash/cardcreator/7.res−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -139,13 +138,5 @@ CroppedImageMinimumSourceSize {
139
138
140 ]
139 ]
141 }
140 }
142−UbuntuShape {
143− id: touchdown;
144− objectName: "touchdown";
145− anchors { fill: backgroundLoader }
146− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
147− radius: "medium";
148− borderSource: "radius_pressed.sci"
149−}
150implicitHeight: row.y + row.height + units.gu(1);
141implicitHeight: row.y + row.height + units.gu(1);
151}
142}
tests/plugins/Dash/cardcreator/7.res.cardcreator−9
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -137,13 +136,5 @@ CroppedImageMinimumSourceSize {
137
136
138 ]
137 ]
139 }
138 }
140−UbuntuShape {
141− id: touchdown;
142− objectName: "touchdown";
143− anchors { fill: backgroundLoader }
144− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
145− radius: "medium";
146− borderSource: "radius_pressed.sci"
147−}
148implicitHeight: row.y + row.height + units.gu(1);
139implicitHeight: row.y + row.height + units.gu(1);
149}
140}
tests/plugins/Dash/cardcreator/7.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
1template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}}
2components: {"art":{"aspect-ratio":1},"background":{"field":"background"},"mascot":{"field":"icon"},"subtitle":{"field":"author"},"title":{"field":"title"},"attributes":{"field":"attributes","max-count":2}}
3+artShapeStyle: icon
3result: 7.res
4result: 7.res
tests/plugins/Dash/cardcreator/8.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -101,7 +100,7 @@ UbuntuShape {
101 id: touchdown;
100 id: touchdown;
102 objectName: "touchdown";
101 objectName: "touchdown";
103 anchors { fill: backgroundLoader }
102 anchors { fill: backgroundLoader }
104− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
103+ visible: root.pressed;
105 radius: "medium";
104 radius: "medium";
106 borderSource: "radius_pressed.sci"
105 borderSource: "radius_pressed.sci"
107}
106}
tests/plugins/Dash/cardcreator/8.res.cardcreator+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -99,7 +98,7 @@ UbuntuShape {
99 id: touchdown;
98 id: touchdown;
100 objectName: "touchdown";
99 objectName: "touchdown";
101 anchors { fill: backgroundLoader }
100 anchors { fill: backgroundLoader }
102− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
101+ visible: root.pressed;
103 radius: "medium";
102 radius: "medium";
104 borderSource: "radius_pressed.sci"
103 borderSource: "radius_pressed.sci"
105}
104}
tests/plugins/Dash/cardcreator/8.tst+1
@@ -1,3 +1,4 @@
1template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
1template: {"card-background":{"elements":["#E9E9E9","#E9AAE9"],"type":"color"},"card-layout":"vertical","card-size":"medium","category-layout":"grid","collapsed-rows":2}
2components: {"background":{"field":"background"},"mascot":{"field":"icon"},"title":{"field":"title"},"attributes":{}}
2components: {"background":{"field":"background"},"mascot":{"field":"icon"},"title":{"field":"title"},"attributes":{}}
3+artShapeStyle: inset
3result: 8.res
4result: 8.res
tests/plugins/Dash/cardcreator/9.res+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -112,7 +111,7 @@ CardAudioProgress {
112 id: touchdown;
111 id: touchdown;
113 objectName: "touchdown";
112 objectName: "touchdown";
114 anchors { fill: root }
113 anchors { fill: root }
115− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
114+ visible: root.pressed;
116 radius: "medium";
115 radius: "medium";
117 borderSource: "radius_pressed.sci"
116 borderSource: "radius_pressed.sci"
118 }
117 }
tests/plugins/Dash/cardcreator/9.res.cardcreator+1−2
@@ -1,7 +1,6 @@
1AbstractButton {
1AbstractButton {
2 id: root;
2 id: root;
3 property var cardData;
3 property var cardData;
4− property string artShapeStyle: "inset";
5 property string backgroundShapeStyle: "inset";
4 property string backgroundShapeStyle: "inset";
6 property real fontScale: 1.0;
5 property real fontScale: 1.0;
7 property var scopeStyle: null;
6 property var scopeStyle: null;
@@ -111,7 +110,7 @@ CardAudioProgress {
111 id: touchdown;
110 id: touchdown;
112 objectName: "touchdown";
111 objectName: "touchdown";
113 anchors { fill: root }
112 anchors { fill: root }
114− visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed;
113+ visible: root.pressed;
115 radius: "medium";
114 radius: "medium";
116 borderSource: "radius_pressed.sci"
115 borderSource: "radius_pressed.sci"
117 }
116 }
tests/plugins/Dash/cardcreator/9.tst+1
@@ -1,3 +1,4 @@
1template: {"card-layout":"horizontal","card-size":"medium","category-layout":"grid","collapsed-rows":2,"quick-preview-type": "audio"}
1template: {"card-layout":"horizontal","card-size":"medium","category-layout":"grid","collapsed-rows":2,"quick-preview-type": "audio"}
2components: {"art":{"aspect-ratio":1},"subtitle":{"field":"author"},"title":{"field":"title"}, "quickPreviewData": "quickPreviewData"}
2components: {"art":{"aspect-ratio":1},"subtitle":{"field":"author"},"title":{"field":"title"}, "quickPreviewData": "quickPreviewData"}
3+artShapeStyle: inset
3result: 9.res
4result: 9.res
tests/plugins/Dash/cardcreatortest.cpp+9−6
@@ -73,6 +73,7 @@ private Q_SLOTS:
73 {
73 {
74 const QString templateString("template: ");
74 const QString templateString("template: ");
75 const QString componentsString("components: ");
75 const QString componentsString("components: ");
76+ const QString artShapeStyleString("artShapeStyle: ");
76 const QString resultString("result: ");
77 const QString resultString("result: ");
77
78
78 const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/";
79 const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/";
@@ -87,24 +88,26 @@ private Q_SLOTS:
87
88
88 QVERIFY(lines[0].startsWith(templateString));
89 QVERIFY(lines[0].startsWith(templateString));
89 QVERIFY(lines[1].startsWith(componentsString));
90 QVERIFY(lines[1].startsWith(componentsString));
90− QVERIFY(lines[2].startsWith(resultString));
91+ QVERIFY(lines[2].startsWith(artShapeStyleString));
92+ QVERIFY(lines[3].startsWith(resultString));
91
93
92 const QString templateJSON = lines[0].mid(templateString.length());
94 const QString templateJSON = lines[0].mid(templateString.length());
93 const QString componentsJSON = lines[1].mid(componentsString.length());
95 const QString componentsJSON = lines[1].mid(componentsString.length());
96+ const QString artShapeStyle = lines[2].mid(artShapeStyleString.length());
94− const QString resultFileName = lines[2].mid(resultString.length());
97+ const QString resultFileName = lines[3].mid(resultString.length());
95 QVariant cardStringResult;
98 QVariant cardStringResult;
96 QVariant createCardComponentResult;
99 QVariant createCardComponentResult;
97
100
98− QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false));
101+ QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false), Q_ARG(QVariant, artShapeStyle));
99 compareFileContents(testDirPath + resultFileName, cardStringResult.toString());
102 compareFileContents(testDirPath + resultFileName, cardStringResult.toString());
100
103
101− QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true));
104+ QMetaObject::invokeMethod(view->rootObject(), "cardString", Q_RETURN_ARG(QVariant, cardStringResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true), Q_ARG(QVariant, artShapeStyle));
102 compareFileContents(testDirPath + resultFileName + ".cardcreator", cardStringResult.toString());
105 compareFileContents(testDirPath + resultFileName + ".cardcreator", cardStringResult.toString());
103
106
104− QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false));
107+ QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, false), Q_ARG(QVariant, artShapeStyle));
105 QVERIFY(createCardComponentResult.toBool());
108 QVERIFY(createCardComponentResult.toBool());
106
109
107− QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true));
110+ QMetaObject::invokeMethod(view->rootObject(), "createCardComponent", Q_RETURN_ARG(QVariant, createCardComponentResult), Q_ARG(QVariant, templateJSON), Q_ARG(QVariant, componentsJSON), Q_ARG(QVariant, true), Q_ARG(QVariant, artShapeStyle));
108 QVERIFY(createCardComponentResult.toBool());
111 QVERIFY(createCardComponentResult.toBool());
109 }
112 }
110 }
113 }
tests/plugins/Dash/cardcreatortest.qml+4−4
@@ -19,11 +19,11 @@ import "../../../plugins/Dash/CardCreator.js" as CardCreator
19
19
20Item {
20Item {
21 id: root
21 id: root
22− function cardString(template, components, isCardCreator) {
22+ function cardString(template, components, isCardCreator, artShapeStyle) {
23− return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator);
23+ return CardCreator.cardString(JSON.parse(template), JSON.parse(components), isCardCreator, artShapeStyle);
24 }
24 }
25
25
26− function createCardComponent(template, components, isCardCreator) {
26+ function createCardComponent(template, components, isCardCreator, artShapeStyle) {
27− return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator) !== null;
27+ return CardCreator.createCardComponent(root, JSON.parse(template), JSON.parse(components), isCardCreator, artShapeStyle) !== null;
28 }
28 }
29}
29}
tests/qmltests/Dash/tst_Card.qml+12
@@ -496,6 +496,18 @@ Rectangle {
496 tryCompare(art, "visible", true);
496 tryCompare(art, "visible", true);
497 compare(artImage.source, Qt.resolvedUrl("artwork/checkers.png"));
497 compare(artImage.source, Qt.resolvedUrl("artwork/checkers.png"));
498
498
499+ card.cardData["art"] = "somethingbroken";
500+ card.cardDataChanged();
501+ waitForRendering(card);
502+ tryCompare(art, "visible", true);
503+ compare(artImage.source, Qt.resolvedUrl("artwork/checkers.png"));
504+
505+ card.cardData["art"] = Qt.resolvedUrl("artwork/music-player-design.png");
506+ card.cardDataChanged();
507+ waitForRendering(card);
508+ tryCompare(art, "visible", true);
509+ compare(artImage.source, Qt.resolvedUrl("artwork/music-player-design.png"));
510+
499 card.cardData["mascot"] = "somethingbroken2";
511 card.cardData["mascot"] = "somethingbroken2";
500 card.cardDataChanged();
512 card.cardDataChanged();
501 compare(mascotImage.status, Image.Error);
513 compare(mascotImage.status, Image.Error);