on xenial help sign in
Unbox the artshapeLoader
b17ae9eAlbert Astals Cid
plugins/Dash/CardCreator.js+67−77
@@ -74,7 +74,7 @@ var kArtProportionalShapeCode = 'ProportionalShape { \n\
74 aspect: UbuntuShape.DropShadow; \n\
74 aspect: UbuntuShape.DropShadow; \n\
75 }';
75 }';
76
76
77−// %1 is used as anchors of artShapeHolder
77+// %1 is used as anchors of artShapeLoader
78// %2 is used as image width
78// %2 is used as image width
79// %3 is used as image height
79// %3 is used as image height
80// %4 is whether the image should be visible
80// %4 is whether the image should be visible
@@ -82,42 +82,37 @@ var kArtProportionalShapeCode = 'ProportionalShape { \n\
82// %6 is the shape code we want to use
82// %6 is the shape code we want to use
83// %7 is injected as code to artImage
83// %7 is injected as code to artImage
84// %8 is used as image fallback
84// %8 is used as image fallback
85−var kArtShapeHolderCode = 'Item { \n\
85+var kArtShapeHolderCode = 'Loader { \n\
86− id: artShapeHolder; \n\
86+ id: artShapeLoader; \n\
87− height: root.fixedArtShapeSize.height; \n\
88− width: root.fixedArtShapeSize.width; \n\
89 anchors { %1 } \n\
87 anchors { %1 } \n\
90− Loader { \n\
91− id: artShapeLoader; \n\
92− objectName: "artShapeLoader"; \n\
88+ objectName: "artShapeLoader"; \n\
93− readonly property string cardArt: cardData && cardData["art"] || %8; \n\
89+ readonly property string cardArt: cardData && cardData["art"] || %8; \n\
94− onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
90+ onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
95− active: cardArt != ""; \n\
91+ active: cardArt != ""; \n\
96− asynchronous: %5; \n\
92+ asynchronous: %5; \n\
97− visible: status == Loader.Ready; \n\
93+ visible: status == Loader.Ready; \n\
98− sourceComponent: Item { \n\
94+ sourceComponent: Item { \n\
99− id: artShape; \n\
95+ id: artShape; \n\
100− objectName: "artShape"; \n\
96+ objectName: "artShape"; \n\
101− visible: image.status == Image.Ready; \n\
97+ visible: image.status == Image.Ready; \n\
102− readonly property alias image: artImage; \n\
98+ readonly property alias image: artImage; \n\
103− %6 \n\
99+ %6 \n\
104− width: root.fixedArtShapeSize.width; \n\
100+ width: root.fixedArtShapeSize.width; \n\
105− height: root.fixedArtShapeSize.height; \n\
101+ height: root.fixedArtShapeSize.height; \n\
106− CroppedImageMinimumSourceSize { \n\
102+ CroppedImageMinimumSourceSize { \n\
107− id: artImage; \n\
103+ id: artImage; \n\
108− objectName: "artImage"; \n\
104+ objectName: "artImage"; \n\
109− source: artShapeLoader.cardArt; \n\
105+ source: artShapeLoader.cardArt; \n\
110− asynchronous: %5; \n\
106+ asynchronous: %5; \n\
111− visible: %4; \n\
107+ visible: %4; \n\
112− width: %2; \n\
108+ width: %2; \n\
113− height: %3; \n\
109+ height: %3; \n\
114− %7 \n\
110+ %7 \n\
115− } \n\
116 } \n\
111 } \n\
117 } \n\
112 } \n\
118 }\n';
113 }\n';
119
114
120−// %1 is used as anchors of artShapeHolder
115+// %1 is used as anchors of artShapeLoader
121// %2 is used as image width
116// %2 is used as image width
122// %3 is used as image height
117// %3 is used as image height
123// %4 is whether the image should be visible
118// %4 is whether the image should be visible
@@ -125,37 +120,32 @@ var kArtShapeHolderCode = 'Item { \n\
125// %6 is the shape code we want to use
120// %6 is the shape code we want to use
126// %7 is injected as code to artImage
121// %7 is injected as code to artImage
127// %8 is used as image fallback
122// %8 is used as image fallback
128−var kArtShapeHolderCodeCardToolCard = 'Item { \n\
123+var kArtShapeHolderCodeCardToolCard = 'Loader { \n\
129− id: artShapeHolder; \n\
130− height: artShapeLoader.height; \n\
131− width: artShapeLoader.width; \n\
124+ id: artShapeLoader; \n\
132 anchors { %1 } \n\
125 anchors { %1 } \n\
133− Loader { \n\
134− id: artShapeLoader; \n\
135− objectName: "artShapeLoader"; \n\
126+ objectName: "artShapeLoader"; \n\
136− readonly property string cardArt: cardData && cardData["art"] || %8; \n\
127+ readonly property string cardArt: cardData && cardData["art"] || %8; \n\
137− onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
128+ onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
138− active: cardArt != ""; \n\
129+ active: cardArt != ""; \n\
139− asynchronous: %5; \n\
130+ asynchronous: %5; \n\
140− visible: status == Loader.Ready; \n\
131+ visible: status == Loader.Ready; \n\
141− sourceComponent: Item { \n\
132+ sourceComponent: Item { \n\
142− id: artShape; \n\
133+ id: artShape; \n\
143− objectName: "artShape"; \n\
134+ objectName: "artShape"; \n\
144− visible: image.status == Image.Ready; \n\
135+ visible: image.status == Image.Ready; \n\
145− readonly property alias image: artImage; \n\
136+ readonly property alias image: artImage; \n\
146− %6 \n\
137+ %6 \n\
147− width: image.status !== Image.Ready ? 0 : image.width; \n\
138+ width: image.status !== Image.Ready ? 0 : image.width; \n\
148− height: image.status !== Image.Ready ? 0 : image.height; \n\
139+ height: image.status !== Image.Ready ? 0 : image.height; \n\
149− CroppedImageMinimumSourceSize { \n\
140+ CroppedImageMinimumSourceSize { \n\
150− id: artImage; \n\
141+ id: artImage; \n\
151− objectName: "artImage"; \n\
142+ objectName: "artImage"; \n\
152− source: artShapeLoader.cardArt; \n\
143+ source: artShapeLoader.cardArt; \n\
153− asynchronous: %5; \n\
144+ asynchronous: %5; \n\
154− visible: %4; \n\
145+ visible: %4; \n\
155− width: %2; \n\
146+ width: %2; \n\
156− height: %3; \n\
147+ height: %3; \n\
157− %7 \n\
148+ %7 \n\
158− } \n\
159 } \n\
149 } \n\
160 } \n\
150 } \n\
161 }\n';
151 }\n';
@@ -213,7 +203,7 @@ var kAudioButtonCode = 'AbstractButton { \n\
213var kOverlayLoaderCode = 'Loader { \n\
203var kOverlayLoaderCode = 'Loader { \n\
214 id: overlayLoader; \n\
204 id: overlayLoader; \n\
215 readonly property real overlayHeight: %2 + units.gu(2); \n\
205 readonly property real overlayHeight: %2 + units.gu(2); \n\
216− anchors.fill: artShapeHolder; \n\
206+ anchors.fill: artShapeLoader; \n\
217 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; \n\
207 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; \n\
218 asynchronous: %1; \n\
208 asynchronous: %1; \n\
219 visible: showHeader && status == Loader.Ready; \n\
209 visible: showHeader && status == Loader.Ready; \n\
@@ -591,15 +581,15 @@ function cardString(template, components, isCardTool, artShapeStyle) {
591
581
592 var headerVerticalAnchors;
582 var headerVerticalAnchors;
593 if (headerAsOverlay) {
583 if (headerAsOverlay) {
594− headerVerticalAnchors = 'bottom: artShapeHolder.bottom; \n\
584+ headerVerticalAnchors = 'bottom: artShapeLoader.bottom; \n\
595 bottomMargin: units.gu(1);\n';
585 bottomMargin: units.gu(1);\n';
596 } else {
586 } else {
597 if (hasArt) {
587 if (hasArt) {
598 if (isHorizontal) {
588 if (isHorizontal) {
599− headerVerticalAnchors = 'top: artShapeHolder.top; \n\
589+ headerVerticalAnchors = 'top: artShapeLoader.top; \n\
600 topMargin: units.gu(1);\n';
590 topMargin: units.gu(1);\n';
601 } else {
591 } else {
602− headerVerticalAnchors = 'top: artShapeHolder.bottom; \n\
592+ headerVerticalAnchors = 'top: artShapeLoader.bottom; \n\
603 topMargin: units.gu(1);\n';
593 topMargin: units.gu(1);\n';
604 }
594 }
605 } else {
595 } else {
@@ -611,7 +601,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
611 var headerLeftAnchor;
601 var headerLeftAnchor;
612 var headerLeftAnchorHasMargin = false;
602 var headerLeftAnchorHasMargin = false;
613 if (isHorizontal && hasArt) {
603 if (isHorizontal && hasArt) {
614− headerLeftAnchor = 'left: artShapeHolder.right; \n\
604+ headerLeftAnchor = 'left: artShapeLoader.right; \n\
615 leftMargin: units.gu(1);\n';
605 leftMargin: units.gu(1);\n';
616 headerLeftAnchorHasMargin = true;
606 headerLeftAnchorHasMargin = true;
617 } else if (isHorizontal && isAudio) {
607 } else if (isHorizontal && isAudio) {
@@ -865,7 +855,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
865 var audioButtonWidth;
855 var audioButtonWidth;
866 var audioButtonHeight;
856 var audioButtonHeight;
867 if (hasArt) {
857 if (hasArt) {
868− audioButtonAnchorsFill = 'artShapeHolder';
858+ audioButtonAnchorsFill = 'artShapeLoader';
869 audioButtonWidth = 'undefined';
859 audioButtonWidth = 'undefined';
870 audioButtonHeight = 'undefined';
860 audioButtonHeight = 'undefined';
871 } else {
861 } else {
@@ -879,15 +869,15 @@ function cardString(template, components, isCardTool, artShapeStyle) {
879
869
880 if (hasSummary) {
870 if (hasSummary) {
881 var summaryTopAnchor;
871 var summaryTopAnchor;
882− if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
872+ if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeLoader.bottom';
883− else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
873+ else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeLoader.bottom';
884 else if (hasHeaderRow) summaryTopAnchor = 'row.bottom';
874 else if (hasHeaderRow) summaryTopAnchor = 'row.bottom';
885 else if (hasTitleContainer) summaryTopAnchor = 'headerTitleContainer.bottom';
875 else if (hasTitleContainer) summaryTopAnchor = 'headerTitleContainer.bottom';
886 else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom';
876 else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom';
887 else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom';
877 else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom';
888 else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom';
878 else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom';
889 else if (hasTitle) summaryTopAnchor = 'titleLabel.bottom';
879 else if (hasTitle) summaryTopAnchor = 'titleLabel.bottom';
890− else if (hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
880+ else if (hasArt) summaryTopAnchor = 'artShapeLoader.bottom';
891 else summaryTopAnchor = 'parent.top';
881 else summaryTopAnchor = 'parent.top';
892
882
893 var summaryColor;
883 var summaryColor;
@@ -907,15 +897,15 @@ function cardString(template, components, isCardTool, artShapeStyle) {
907 var socialTopAnchor;
897 var socialTopAnchor;
908
898
909 if (hasSummary) socialTopAnchor = 'summary.bottom;';
899 if (hasSummary) socialTopAnchor = 'summary.bottom;';
910− else if (isHorizontal && hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
900+ else if (isHorizontal && hasArt) socialTopAnchor = 'artShapeLoader.bottom;';
911− else if (headerAsOverlay && hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
901+ else if (headerAsOverlay && hasArt) socialTopAnchor = 'artShapeLoader.bottom;';
912 else if (hasHeaderRow) socialTopAnchor = 'row.bottom;';
902 else if (hasHeaderRow) socialTopAnchor = 'row.bottom;';
913 else if (hasTitleContainer) socialTopAnchor = 'headerTitleContainer.bottom;';
903 else if (hasTitleContainer) socialTopAnchor = 'headerTitleContainer.bottom;';
914 else if (hasMascot) socialTopAnchor = 'mascotImage.bottom;';
904 else if (hasMascot) socialTopAnchor = 'mascotImage.bottom;';
915 else if (hasAttributes) socialTopAnchor = 'attributesRow.bottom;';
905 else if (hasAttributes) socialTopAnchor = 'attributesRow.bottom;';
916 else if (hasSubtitle) socialTopAnchor = 'subtitleLabel.bottom;';
906 else if (hasSubtitle) socialTopAnchor = 'subtitleLabel.bottom;';
917 else if (hasTitle) socialTopAnchor = 'titleLabel.bottom;';
907 else if (hasTitle) socialTopAnchor = 'titleLabel.bottom;';
918− else if (hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
908+ else if (hasArt) socialTopAnchor = 'artShapeLoader.bottom;';
919 else socialTopAnchor = 'parent.top';
909 else socialTopAnchor = 'parent.top';
920
910
921 socialAnchors = 'top: ' + socialTopAnchor + ' left: parent.left; right: parent.right; topMargin: units.gu(1);'
911 socialAnchors = 'top: ' + socialTopAnchor + ' left: parent.left; right: parent.right; topMargin: units.gu(1);'
@@ -935,7 +925,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
935 if (hasBackground) {
925 if (hasBackground) {
936 touchdownAnchors = 'fill: backgroundLoader';
926 touchdownAnchors = 'fill: backgroundLoader';
937 } else if (touchdownOnArtShape) {
927 } else if (touchdownOnArtShape) {
938− touchdownAnchors = 'fill: artShapeHolder';
928+ touchdownAnchors = 'fill: artShapeLoader';
939 } else {
929 } else {
940 touchdownAnchors = 'fill: root'
930 touchdownAnchors = 'fill: root'
941 }
931 }
@@ -950,7 +940,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
950 } else if (isAudio) {
940 } else if (isAudio) {
951 implicitHeight += 'audioButton.height;\n';
941 implicitHeight += 'audioButton.height;\n';
952 } else if (headerAsOverlay) {
942 } else if (headerAsOverlay) {
953− implicitHeight += 'artShapeHolder.height;\n';
943+ implicitHeight += 'artShapeLoader.height;\n';
954 } else if (hasHeaderRow) {
944 } else if (hasHeaderRow) {
955 implicitHeight += 'row.y + row.height + units.gu(1);\n';
945 implicitHeight += 'row.y + row.height + units.gu(1);\n';
956 } else if (hasMascot) {
946 } else if (hasMascot) {
@@ -964,7 +954,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
964 } else if (hasTitle) {
954 } else if (hasTitle) {
965 implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n';
955 implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n';
966 } else if (hasArt) {
956 } else if (hasArt) {
967− implicitHeight += 'artShapeHolder.height;\n';
957+ implicitHeight += 'artShapeLoader.height;\n';
968 } else {
958 } else {
969 implicitHeight = '';
959 implicitHeight = '';
970 }
960 }
tests/plugins/Dash/cardcreator/1.res+4−9
@@ -12,13 +12,9 @@ AbstractButton {
12 property size fixedArtShapeSize: Qt.size(-1, -1);
12 property size fixedArtShapeSize: Qt.size(-1, -1);
13signal action(var actionId);
13signal action(var actionId);
14readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
14readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
15−Item {
16− id: artShapeHolder;
17− height: root.fixedArtShapeSize.height;
18− width: root.fixedArtShapeSize.width;
19− anchors { horizontalCenter: parent.horizontalCenter; }
20− Loader {
15+Loader {
21 id: artShapeLoader;
16 id: artShapeLoader;
17+ anchors { horizontalCenter: parent.horizontalCenter; }
22 objectName: "artShapeLoader";
18 objectName: "artShapeLoader";
23 readonly property string cardArt: cardData && cardData["art"] || "";
19 readonly property string cardArt: cardData && cardData["art"] || "";
24 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
20 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -50,14 +46,13 @@ Item {
50 }
46 }
51 }
47 }
52 }
48 }
53− }
54readonly property int headerHeight: titleLabel.height;
49readonly property int headerHeight: titleLabel.height;
55Label {
50Label {
56 id: titleLabel;
51 id: titleLabel;
57 objectName: "titleLabel";
52 objectName: "titleLabel";
58 anchors { right: parent.right;
53 anchors { right: parent.right;
59 left: parent.left;
54 left: parent.left;
60− top: artShapeHolder.bottom;
55+ top: artShapeLoader.bottom;
61 topMargin: units.gu(1);
56 topMargin: units.gu(1);
62 }
57 }
63 elide: Text.ElideRight;
58 elide: Text.ElideRight;
@@ -75,7 +70,7 @@ Label {
75UbuntuShape {
70UbuntuShape {
76 id: touchdown;
71 id: touchdown;
77 objectName: "touchdown";
72 objectName: "touchdown";
78− anchors { fill: artShapeHolder }
73+ anchors { fill: artShapeLoader }
79 visible: root.pressed;
74 visible: root.pressed;
80 radius: "medium";
75 radius: "medium";
81 borderSource: "radius_pressed.sci"
76 borderSource: "radius_pressed.sci"
tests/plugins/Dash/cardcreator/1.res.cardcreator+4−9
@@ -10,13 +10,9 @@ AbstractButton {
10 enabled: true;
10 enabled: true;
11signal action(var actionId);
11signal action(var actionId);
12readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
12readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
13−Item {
14− id: artShapeHolder;
15− height: artShapeLoader.height;
16− width: artShapeLoader.width;
17− anchors { horizontalCenter: parent.horizontalCenter; }
18− Loader {
13+Loader {
19 id: artShapeLoader;
14 id: artShapeLoader;
15+ anchors { horizontalCenter: parent.horizontalCenter; }
20 objectName: "artShapeLoader";
16 objectName: "artShapeLoader";
21 readonly property string cardArt: cardData && cardData["art"] || "";
17 readonly property string cardArt: cardData && cardData["art"] || "";
22 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
18 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -47,7 +43,6 @@ Item {
47 height: width / 1.6;
43 height: width / 1.6;
48 }
44 }
49 }
45 }
50− }
51 }
46 }
52readonly property int headerHeight: titleLabel.height;
47readonly property int headerHeight: titleLabel.height;
53Label {
48Label {
@@ -55,7 +50,7 @@ Label {
55 objectName: "titleLabel";
50 objectName: "titleLabel";
56 anchors { right: parent.right;
51 anchors { right: parent.right;
57 left: parent.left;
52 left: parent.left;
58− top: artShapeHolder.bottom;
53+ top: artShapeLoader.bottom;
59 topMargin: units.gu(1);
54 topMargin: units.gu(1);
60 }
55 }
61 elide: Text.ElideRight;
56 elide: Text.ElideRight;
@@ -73,7 +68,7 @@ Label {
73UbuntuShape {
68UbuntuShape {
74 id: touchdown;
69 id: touchdown;
75 objectName: "touchdown";
70 objectName: "touchdown";
76− anchors { fill: artShapeHolder }
71+ anchors { fill: artShapeLoader }
77 visible: root.pressed;
72 visible: root.pressed;
78 radius: "medium";
73 radius: "medium";
79 borderSource: "radius_pressed.sci"
74 borderSource: "radius_pressed.sci"
tests/plugins/Dash/cardcreator/11.res+4−9
@@ -50,13 +50,9 @@ Loader {
50 }
50 }
51 }
51 }
52readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
52readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
53−Item {
54− id: artShapeHolder;
55− height: root.fixedArtShapeSize.height;
56− width: root.fixedArtShapeSize.width;
57− anchors { horizontalCenter: parent.horizontalCenter; }
58− Loader {
53+Loader {
59 id: artShapeLoader;
54 id: artShapeLoader;
55+ anchors { horizontalCenter: parent.horizontalCenter; }
60 objectName: "artShapeLoader";
56 objectName: "artShapeLoader";
61 readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C");
57 readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C");
62 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
58 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -87,8 +83,7 @@ Item {
87 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
83 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
88 onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
84 onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
89 }
85 }
90− }
86+ }
91− }
92 }
87 }
93readonly property int headerHeight: row.height;
88readonly property int headerHeight: row.height;
94Row {
89Row {
@@ -97,7 +92,7 @@ Row {
97 property real margins: units.gu(1);
92 property real margins: units.gu(1);
98 spacing: margins;
93 spacing: margins;
99 height: root.fixedHeaderHeight;
94 height: root.fixedHeaderHeight;
100− anchors { top: artShapeHolder.bottom;
95+ anchors { top: artShapeLoader.bottom;
101 topMargin: units.gu(1);
96 topMargin: units.gu(1);
102left: parent.left;
97left: parent.left;
103 }
98 }
tests/plugins/Dash/cardcreator/11.res.cardcreator+3−8
@@ -48,13 +48,9 @@ Loader {
48 }
48 }
49 }
49 }
50readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
50readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
51−Item {
52− id: artShapeHolder;
53− height: artShapeLoader.height;
54− width: artShapeLoader.width;
55− anchors { horizontalCenter: parent.horizontalCenter; }
56− Loader {
51+Loader {
57 id: artShapeLoader;
52 id: artShapeLoader;
53+ anchors { horizontalCenter: parent.horizontalCenter; }
58 objectName: "artShapeLoader";
54 objectName: "artShapeLoader";
59 readonly property string cardArt: cardData && cardData["art"] || "";
55 readonly property string cardArt: cardData && cardData["art"] || "";
60 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
56 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -85,7 +81,6 @@ Item {
85 height: width / 1;
81 height: width / 1;
86 }
82 }
87 }
83 }
88− }
89 }
84 }
90readonly property int headerHeight: row.height;
85readonly property int headerHeight: row.height;
91Row {
86Row {
@@ -93,7 +88,7 @@ Row {
93 objectName: "outerRow";
88 objectName: "outerRow";
94 property real margins: units.gu(1);
89 property real margins: units.gu(1);
95 spacing: margins;
90 spacing: margins;
96− anchors { top: artShapeHolder.bottom;
91+ anchors { top: artShapeLoader.bottom;
97 topMargin: units.gu(1);
92 topMargin: units.gu(1);
98left: parent.left;
93left: parent.left;
99 }
94 }
tests/plugins/Dash/cardcreator/12.res+4−9
@@ -12,13 +12,9 @@ AbstractButton {
12 property size fixedArtShapeSize: Qt.size(-1, -1);
12 property size fixedArtShapeSize: Qt.size(-1, -1);
13signal action(var actionId);
13signal action(var actionId);
14readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
14readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
15−Item {
16− id: artShapeHolder;
17− height: root.fixedArtShapeSize.height;
18− width: root.fixedArtShapeSize.width;
19− anchors { horizontalCenter: parent.horizontalCenter; }
20− Loader {
15+Loader {
21 id: artShapeLoader;
16 id: artShapeLoader;
17+ anchors { horizontalCenter: parent.horizontalCenter; }
22 objectName: "artShapeLoader";
18 objectName: "artShapeLoader";
23 readonly property string cardArt: cardData && cardData["art"] || "";
19 readonly property string cardArt: cardData && cardData["art"] || "";
24 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
20 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -49,7 +45,6 @@ Item {
49 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
45 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
50 }
46 }
51 }
47 }
52− }
53 }
48 }
54readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
49readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
55Label {
50Label {
@@ -57,7 +52,7 @@ Label {
57 objectName: "titleLabel";
52 objectName: "titleLabel";
58 anchors { right: parent.right;
53 anchors { right: parent.right;
59 left: parent.left;
54 left: parent.left;
60− top: artShapeHolder.bottom;
55+ top: artShapeLoader.bottom;
61 topMargin: units.gu(1);
56 topMargin: units.gu(1);
62 }
57 }
63 elide: Text.ElideRight;
58 elide: Text.ElideRight;
@@ -101,7 +96,7 @@ CardSocialActions {
101UbuntuShape {
96UbuntuShape {
102 id: touchdown;
97 id: touchdown;
103 objectName: "touchdown";
98 objectName: "touchdown";
104− anchors { fill: artShapeHolder }
99+ anchors { fill: artShapeLoader }
105 visible: root.pressed;
100 visible: root.pressed;
106 radius: "medium";
101 radius: "medium";
107 borderSource: "radius_pressed.sci"
102 borderSource: "radius_pressed.sci"
tests/plugins/Dash/cardcreator/12.res.cardcreator+4−9
@@ -10,13 +10,9 @@ AbstractButton {
10 enabled: true;
10 enabled: true;
11signal action(var actionId);
11signal action(var actionId);
12readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
12readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
13−Item {
14− id: artShapeHolder;
15− height: artShapeLoader.height;
16− width: artShapeLoader.width;
17− anchors { horizontalCenter: parent.horizontalCenter; }
18− Loader {
13+Loader {
19 id: artShapeLoader;
14 id: artShapeLoader;
15+ anchors { horizontalCenter: parent.horizontalCenter; }
20 objectName: "artShapeLoader";
16 objectName: "artShapeLoader";
21 readonly property string cardArt: cardData && cardData["art"] || "";
17 readonly property string cardArt: cardData && cardData["art"] || "";
22 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
18 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -47,7 +43,6 @@ Item {
47 height: width / 0.75;
43 height: width / 0.75;
48 }
44 }
49 }
45 }
50− }
51 }
46 }
52readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
47readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
53Label {
48Label {
@@ -55,7 +50,7 @@ Label {
55 objectName: "titleLabel";
50 objectName: "titleLabel";
56 anchors { right: parent.right;
51 anchors { right: parent.right;
57 left: parent.left;
52 left: parent.left;
58− top: artShapeHolder.bottom;
53+ top: artShapeLoader.bottom;
59 topMargin: units.gu(1);
54 topMargin: units.gu(1);
60 }
55 }
61 elide: Text.ElideRight;
56 elide: Text.ElideRight;
@@ -99,7 +94,7 @@ CardSocialActions {
99UbuntuShape {
94UbuntuShape {
100 id: touchdown;
95 id: touchdown;
101 objectName: "touchdown";
96 objectName: "touchdown";
102− anchors { fill: artShapeHolder }
97+ anchors { fill: artShapeLoader }
103 visible: root.pressed;
98 visible: root.pressed;
104 radius: "medium";
99 radius: "medium";
105 borderSource: "radius_pressed.sci"
100 borderSource: "radius_pressed.sci"
tests/plugins/Dash/cardcreator/3.res+3−8
@@ -12,13 +12,9 @@ AbstractButton {
12 property size fixedArtShapeSize: Qt.size(-1, -1);
12 property size fixedArtShapeSize: Qt.size(-1, -1);
13signal action(var actionId);
13signal action(var actionId);
14readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
14readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
15−Item {
16− id: artShapeHolder;
17− height: root.fixedArtShapeSize.height;
18− width: root.fixedArtShapeSize.width;
19− anchors { horizontalCenter: parent.horizontalCenter; }
20− Loader {
15+Loader {
21 id: artShapeLoader;
16 id: artShapeLoader;
17+ anchors { horizontalCenter: parent.horizontalCenter; }
22 objectName: "artShapeLoader";
18 objectName: "artShapeLoader";
23 readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
19 readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
24 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
20 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -48,7 +44,6 @@ Item {
48 onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
44 onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
49 }
45 }
50 }
46 }
51− }
52 }
47 }
53readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
48readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
54Label {
49Label {
@@ -56,7 +51,7 @@ Label {
56 objectName: "titleLabel";
51 objectName: "titleLabel";
57 anchors { right: parent.right;
52 anchors { right: parent.right;
58 left: parent.left;
53 left: parent.left;
59− top: artShapeHolder.bottom;
54+ top: artShapeLoader.bottom;
60 topMargin: units.gu(1);
55 topMargin: units.gu(1);
61 }
56 }
62 elide: Text.ElideRight;
57 elide: Text.ElideRight;
tests/plugins/Dash/cardcreator/3.res.cardcreator+3−8
@@ -10,13 +10,9 @@ AbstractButton {
10 enabled: true;
10 enabled: true;
11signal action(var actionId);
11signal action(var actionId);
12readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
12readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
13−Item {
13+Loader {
14− id: artShapeHolder;
15− height: artShapeLoader.height;
14+ id: artShapeLoader;
16− width: artShapeLoader.width;
17 anchors { horizontalCenter: parent.horizontalCenter; }
15 anchors { horizontalCenter: parent.horizontalCenter; }
18− Loader {
19− id: artShapeLoader;
20 objectName: "artShapeLoader";
16 objectName: "artShapeLoader";
21 readonly property string cardArt: cardData && cardData["art"] || "";
17 readonly property string cardArt: cardData && cardData["art"] || "";
22 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
18 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -45,7 +41,6 @@ Item {
45 height: width / 0.75;
41 height: width / 0.75;
46 }
42 }
47 }
43 }
48− }
49 }
44 }
50readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
45readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
51Label {
46Label {
@@ -53,7 +48,7 @@ Label {
53 objectName: "titleLabel";
48 objectName: "titleLabel";
54 anchors { right: parent.right;
49 anchors { right: parent.right;
55 left: parent.left;
50 left: parent.left;
56− top: artShapeHolder.bottom;
51+ top: artShapeLoader.bottom;
57 topMargin: units.gu(1);
52 topMargin: units.gu(1);
58 }
53 }
59 elide: Text.ElideRight;
54 elide: Text.ElideRight;
tests/plugins/Dash/cardcreator/5.res+4−9
@@ -12,13 +12,9 @@ AbstractButton {
12 property size fixedArtShapeSize: Qt.size(-1, -1);
12 property size fixedArtShapeSize: Qt.size(-1, -1);
13signal action(var actionId);
13signal action(var actionId);
14readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
14readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
15−Item {
16− id: artShapeHolder;
17− height: root.fixedArtShapeSize.height;
18− width: root.fixedArtShapeSize.width;
19− anchors { horizontalCenter: parent.horizontalCenter; }
20− Loader {
15+Loader {
21 id: artShapeLoader;
16 id: artShapeLoader;
17+ anchors { horizontalCenter: parent.horizontalCenter; }
22 objectName: "artShapeLoader";
18 objectName: "artShapeLoader";
23 readonly property string cardArt: cardData && cardData["art"] || "";
19 readonly property string cardArt: cardData && cardData["art"] || "";
24 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
20 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -42,12 +38,11 @@ Item {
42 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
38 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
43 }
39 }
44 }
40 }
45− }
46 }
41 }
47Loader {
42Loader {
48 id: overlayLoader;
43 id: overlayLoader;
49 readonly property real overlayHeight: root.fixedHeaderHeight + units.gu(2);
44 readonly property real overlayHeight: root.fixedHeaderHeight + units.gu(2);
50− anchors.fill: artShapeHolder;
45+ anchors.fill: artShapeLoader;
51 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
46 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
52 asynchronous: true;
47 asynchronous: true;
53 visible: showHeader && status == Loader.Ready;
48 visible: showHeader && status == Loader.Ready;
@@ -102,5 +97,5 @@ Label {
102 text: cardData && cardData["subtitle"] || "";
97 text: cardData && cardData["subtitle"] || "";
103 font.weight: Font.Light;
98 font.weight: Font.Light;
104 }
99 }
105−implicitHeight: artShapeHolder.height;
100+implicitHeight: artShapeLoader.height;
106}
101}
tests/plugins/Dash/cardcreator/5.res.cardcreator+4−9
@@ -10,13 +10,9 @@ AbstractButton {
10 enabled: false;
10 enabled: false;
11signal action(var actionId);
11signal action(var actionId);
12readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
12readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
13−Item {
14− id: artShapeHolder;
15− height: artShapeLoader.height;
16− width: artShapeLoader.width;
17− anchors { horizontalCenter: parent.horizontalCenter; }
18− Loader {
13+Loader {
19 id: artShapeLoader;
14 id: artShapeLoader;
15+ anchors { horizontalCenter: parent.horizontalCenter; }
20 objectName: "artShapeLoader";
16 objectName: "artShapeLoader";
21 readonly property string cardArt: cardData && cardData["art"] || "";
17 readonly property string cardArt: cardData && cardData["art"] || "";
22 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
18 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -40,12 +36,11 @@ Item {
40 height: width / 1;
36 height: width / 1;
41 }
37 }
42 }
38 }
43− }
44 }
39 }
45Loader {
40Loader {
46 id: overlayLoader;
41 id: overlayLoader;
47 readonly property real overlayHeight: headerHeight + units.gu(2);
42 readonly property real overlayHeight: headerHeight + units.gu(2);
48− anchors.fill: artShapeHolder;
43+ anchors.fill: artShapeLoader;
49 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
44 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
50 asynchronous: false;
45 asynchronous: false;
51 visible: showHeader && status == Loader.Ready;
46 visible: showHeader && status == Loader.Ready;
@@ -100,5 +95,5 @@ Label {
100 text: cardData && cardData["subtitle"] || "";
95 text: cardData && cardData["subtitle"] || "";
101 font.weight: Font.Light;
96 font.weight: Font.Light;
102 }
97 }
103−implicitHeight: artShapeHolder.height;
98+implicitHeight: artShapeLoader.height;
104}
99}