on xenial help sign in
Unbox the artshapeLoader

There's no need for it to be inside an Item

commitb17ae9e9a4d7c9ddd7c3ec0bb6a2a9dd194b1d6c authorAlbert Astals Cid <albert.astals@canonical.com> dateFri 20 May 2016, 18:12 (10 years ago) parentc4c4e63
11 files changed+104−164
plugins/Dash/CardCreator.js+67−77 tests/plugins/Dash/cardcreator/1.res+4−9 tests/plugins/Dash/cardcreator/1.res.cardcreator+4−9 tests/plugins/Dash/cardcreator/11.res+4−9 tests/plugins/Dash/cardcreator/11.res.cardcreator+3−8 tests/plugins/Dash/cardcreator/12.res+4−9 tests/plugins/Dash/cardcreator/12.res.cardcreator+4−9 tests/plugins/Dash/cardcreator/3.res+3−8 tests/plugins/Dash/cardcreator/3.res.cardcreator+3−8 tests/plugins/Dash/cardcreator/5.res+4−9 tests/plugins/Dash/cardcreator/5.res.cardcreator+4−9
plugins/Dash/CardCreator.js+67−77
@@ -74,7 +74,7 @@ var kArtProportionalShapeCode = 'ProportionalShape { \n\
7474 aspect: UbuntuShape.DropShadow; \n\
7575 }';
7676
77−// %1 is used as anchors of artShapeHolder
77+// %1 is used as anchors of artShapeLoader
7878// %2 is used as image width
7979// %3 is used as image height
8080// %4 is whether the image should be visible
@@ -82,42 +82,37 @@ var kArtProportionalShapeCode = 'ProportionalShape { \n\
8282// %6 is the shape code we want to use
8383// %7 is injected as code to artImage
8484// %8 is used as image fallback
85−var kArtShapeHolderCode = 'Item { \n\
86− id: artShapeHolder; \n\
87− height: root.fixedArtShapeSize.height; \n\
88− width: root.fixedArtShapeSize.width; \n\
85+var kArtShapeHolderCode = 'Loader { \n\
86+ id: artShapeLoader; \n\
8987 anchors { %1 } \n\
90− Loader { \n\
91− id: artShapeLoader; \n\
92− objectName: "artShapeLoader"; \n\
93− readonly property string cardArt: cardData && cardData["art"] || %8; \n\
94− onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
95− active: cardArt != ""; \n\
96− asynchronous: %5; \n\
97− visible: status == Loader.Ready; \n\
98− sourceComponent: Item { \n\
99− id: artShape; \n\
100− objectName: "artShape"; \n\
101− visible: image.status == Image.Ready; \n\
102− readonly property alias image: artImage; \n\
103− %6 \n\
104− width: root.fixedArtShapeSize.width; \n\
105− height: root.fixedArtShapeSize.height; \n\
106− CroppedImageMinimumSourceSize { \n\
107− id: artImage; \n\
108− objectName: "artImage"; \n\
109− source: artShapeLoader.cardArt; \n\
110− asynchronous: %5; \n\
111− visible: %4; \n\
112− width: %2; \n\
113− height: %3; \n\
114− %7 \n\
115− } \n\
88+ objectName: "artShapeLoader"; \n\
89+ readonly property string cardArt: cardData && cardData["art"] || %8; \n\
90+ onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
91+ active: cardArt != ""; \n\
92+ asynchronous: %5; \n\
93+ visible: status == Loader.Ready; \n\
94+ sourceComponent: Item { \n\
95+ id: artShape; \n\
96+ objectName: "artShape"; \n\
97+ visible: image.status == Image.Ready; \n\
98+ readonly property alias image: artImage; \n\
99+ %6 \n\
100+ width: root.fixedArtShapeSize.width; \n\
101+ height: root.fixedArtShapeSize.height; \n\
102+ CroppedImageMinimumSourceSize { \n\
103+ id: artImage; \n\
104+ objectName: "artImage"; \n\
105+ source: artShapeLoader.cardArt; \n\
106+ asynchronous: %5; \n\
107+ visible: %4; \n\
108+ width: %2; \n\
109+ height: %3; \n\
110+ %7 \n\
116111 } \n\
117112 } \n\
118113 }\n';
119114
120−// %1 is used as anchors of artShapeHolder
115+// %1 is used as anchors of artShapeLoader
121116// %2 is used as image width
122117// %3 is used as image height
123118// %4 is whether the image should be visible
@@ -125,37 +120,32 @@ var kArtShapeHolderCode = 'Item { \n\
125120// %6 is the shape code we want to use
126121// %7 is injected as code to artImage
127122// %8 is used as image fallback
128−var kArtShapeHolderCodeCardToolCard = 'Item { \n\
129− id: artShapeHolder; \n\
130− height: artShapeLoader.height; \n\
131− width: artShapeLoader.width; \n\
123+var kArtShapeHolderCodeCardToolCard = 'Loader { \n\
124+ id: artShapeLoader; \n\
132125 anchors { %1 } \n\
133− Loader { \n\
134− id: artShapeLoader; \n\
135− objectName: "artShapeLoader"; \n\
136− readonly property string cardArt: cardData && cardData["art"] || %8; \n\
137− onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
138− active: cardArt != ""; \n\
139− asynchronous: %5; \n\
140− visible: status == Loader.Ready; \n\
141− sourceComponent: Item { \n\
142− id: artShape; \n\
143− objectName: "artShape"; \n\
144− visible: image.status == Image.Ready; \n\
145− readonly property alias image: artImage; \n\
146− %6 \n\
147− width: image.status !== Image.Ready ? 0 : image.width; \n\
148− height: image.status !== Image.Ready ? 0 : image.height; \n\
149− CroppedImageMinimumSourceSize { \n\
150− id: artImage; \n\
151− objectName: "artImage"; \n\
152− source: artShapeLoader.cardArt; \n\
153− asynchronous: %5; \n\
154− visible: %4; \n\
155− width: %2; \n\
156− height: %3; \n\
157− %7 \n\
158− } \n\
126+ objectName: "artShapeLoader"; \n\
127+ readonly property string cardArt: cardData && cardData["art"] || %8; \n\
128+ onCardArtChanged: { if (item) { item.image.source = cardArt; } } \n\
129+ active: cardArt != ""; \n\
130+ asynchronous: %5; \n\
131+ visible: status == Loader.Ready; \n\
132+ sourceComponent: Item { \n\
133+ id: artShape; \n\
134+ objectName: "artShape"; \n\
135+ visible: image.status == Image.Ready; \n\
136+ readonly property alias image: artImage; \n\
137+ %6 \n\
138+ width: image.status !== Image.Ready ? 0 : image.width; \n\
139+ height: image.status !== Image.Ready ? 0 : image.height; \n\
140+ CroppedImageMinimumSourceSize { \n\
141+ id: artImage; \n\
142+ objectName: "artImage"; \n\
143+ source: artShapeLoader.cardArt; \n\
144+ asynchronous: %5; \n\
145+ visible: %4; \n\
146+ width: %2; \n\
147+ height: %3; \n\
148+ %7 \n\
159149 } \n\
160150 } \n\
161151 }\n';
@@ -213,7 +203,7 @@ var kAudioButtonCode = 'AbstractButton { \n\
213203var kOverlayLoaderCode = 'Loader { \n\
214204 id: overlayLoader; \n\
215205 readonly property real overlayHeight: %2 + units.gu(2); \n\
216− anchors.fill: artShapeHolder; \n\
206+ anchors.fill: artShapeLoader; \n\
217207 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; \n\
218208 asynchronous: %1; \n\
219209 visible: showHeader && status == Loader.Ready; \n\
@@ -591,15 +581,15 @@ function cardString(template, components, isCardTool, artShapeStyle) {
591581
592582 var headerVerticalAnchors;
593583 if (headerAsOverlay) {
594− headerVerticalAnchors = 'bottom: artShapeHolder.bottom; \n\
584+ headerVerticalAnchors = 'bottom: artShapeLoader.bottom; \n\
595585 bottomMargin: units.gu(1);\n';
596586 } else {
597587 if (hasArt) {
598588 if (isHorizontal) {
599− headerVerticalAnchors = 'top: artShapeHolder.top; \n\
589+ headerVerticalAnchors = 'top: artShapeLoader.top; \n\
600590 topMargin: units.gu(1);\n';
601591 } else {
602− headerVerticalAnchors = 'top: artShapeHolder.bottom; \n\
592+ headerVerticalAnchors = 'top: artShapeLoader.bottom; \n\
603593 topMargin: units.gu(1);\n';
604594 }
605595 } else {
@@ -611,7 +601,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
611601 var headerLeftAnchor;
612602 var headerLeftAnchorHasMargin = false;
613603 if (isHorizontal && hasArt) {
614− headerLeftAnchor = 'left: artShapeHolder.right; \n\
604+ headerLeftAnchor = 'left: artShapeLoader.right; \n\
615605 leftMargin: units.gu(1);\n';
616606 headerLeftAnchorHasMargin = true;
617607 } else if (isHorizontal && isAudio) {
@@ -865,7 +855,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
865855 var audioButtonWidth;
866856 var audioButtonHeight;
867857 if (hasArt) {
868− audioButtonAnchorsFill = 'artShapeHolder';
858+ audioButtonAnchorsFill = 'artShapeLoader';
869859 audioButtonWidth = 'undefined';
870860 audioButtonHeight = 'undefined';
871861 } else {
@@ -879,15 +869,15 @@ function cardString(template, components, isCardTool, artShapeStyle) {
879869
880870 if (hasSummary) {
881871 var summaryTopAnchor;
882− if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
883− else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
872+ if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeLoader.bottom';
873+ else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeLoader.bottom';
884874 else if (hasHeaderRow) summaryTopAnchor = 'row.bottom';
885875 else if (hasTitleContainer) summaryTopAnchor = 'headerTitleContainer.bottom';
886876 else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom';
887877 else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom';
888878 else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom';
889879 else if (hasTitle) summaryTopAnchor = 'titleLabel.bottom';
890− else if (hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
880+ else if (hasArt) summaryTopAnchor = 'artShapeLoader.bottom';
891881 else summaryTopAnchor = 'parent.top';
892882
893883 var summaryColor;
@@ -907,15 +897,15 @@ function cardString(template, components, isCardTool, artShapeStyle) {
907897 var socialTopAnchor;
908898
909899 if (hasSummary) socialTopAnchor = 'summary.bottom;';
910− else if (isHorizontal && hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
911− else if (headerAsOverlay && hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
900+ else if (isHorizontal && hasArt) socialTopAnchor = 'artShapeLoader.bottom;';
901+ else if (headerAsOverlay && hasArt) socialTopAnchor = 'artShapeLoader.bottom;';
912902 else if (hasHeaderRow) socialTopAnchor = 'row.bottom;';
913903 else if (hasTitleContainer) socialTopAnchor = 'headerTitleContainer.bottom;';
914904 else if (hasMascot) socialTopAnchor = 'mascotImage.bottom;';
915905 else if (hasAttributes) socialTopAnchor = 'attributesRow.bottom;';
916906 else if (hasSubtitle) socialTopAnchor = 'subtitleLabel.bottom;';
917907 else if (hasTitle) socialTopAnchor = 'titleLabel.bottom;';
918− else if (hasArt) socialTopAnchor = 'artShapeHolder.bottom;';
908+ else if (hasArt) socialTopAnchor = 'artShapeLoader.bottom;';
919909 else socialTopAnchor = 'parent.top';
920910
921911 socialAnchors = 'top: ' + socialTopAnchor + ' left: parent.left; right: parent.right; topMargin: units.gu(1);'
@@ -935,7 +925,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
935925 if (hasBackground) {
936926 touchdownAnchors = 'fill: backgroundLoader';
937927 } else if (touchdownOnArtShape) {
938− touchdownAnchors = 'fill: artShapeHolder';
928+ touchdownAnchors = 'fill: artShapeLoader';
939929 } else {
940930 touchdownAnchors = 'fill: root'
941931 }
@@ -950,7 +940,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
950940 } else if (isAudio) {
951941 implicitHeight += 'audioButton.height;\n';
952942 } else if (headerAsOverlay) {
953− implicitHeight += 'artShapeHolder.height;\n';
943+ implicitHeight += 'artShapeLoader.height;\n';
954944 } else if (hasHeaderRow) {
955945 implicitHeight += 'row.y + row.height + units.gu(1);\n';
956946 } else if (hasMascot) {
@@ -964,7 +954,7 @@ function cardString(template, components, isCardTool, artShapeStyle) {
964954 } else if (hasTitle) {
965955 implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n';
966956 } else if (hasArt) {
967− implicitHeight += 'artShapeHolder.height;\n';
957+ implicitHeight += 'artShapeLoader.height;\n';
968958 } else {
969959 implicitHeight = '';
970960 }
tests/plugins/Dash/cardcreator/1.res+4−9
@@ -12,13 +12,9 @@ AbstractButton {
1212 property size fixedArtShapeSize: Qt.size(-1, -1);
1313signal action(var actionId);
1414readonly 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 {
2116 id: artShapeLoader;
17+ anchors { horizontalCenter: parent.horizontalCenter; }
2218 objectName: "artShapeLoader";
2319 readonly property string cardArt: cardData && cardData["art"] || "";
2420 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -50,14 +46,13 @@ Item {
5046 }
5147 }
5248 }
53− }
5449readonly property int headerHeight: titleLabel.height;
5550Label {
5651 id: titleLabel;
5752 objectName: "titleLabel";
5853 anchors { right: parent.right;
5954 left: parent.left;
60− top: artShapeHolder.bottom;
55+ top: artShapeLoader.bottom;
6156 topMargin: units.gu(1);
6257 }
6358 elide: Text.ElideRight;
@@ -75,7 +70,7 @@ Label {
7570UbuntuShape {
7671 id: touchdown;
7772 objectName: "touchdown";
78− anchors { fill: artShapeHolder }
73+ anchors { fill: artShapeLoader }
7974 visible: root.pressed;
8075 radius: "medium";
8176 borderSource: "radius_pressed.sci"
tests/plugins/Dash/cardcreator/1.res.cardcreator+4−9
@@ -10,13 +10,9 @@ AbstractButton {
1010 enabled: true;
1111signal action(var actionId);
1212readonly 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 {
1914 id: artShapeLoader;
15+ anchors { horizontalCenter: parent.horizontalCenter; }
2016 objectName: "artShapeLoader";
2117 readonly property string cardArt: cardData && cardData["art"] || "";
2218 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -47,7 +43,6 @@ Item {
4743 height: width / 1.6;
4844 }
4945 }
50− }
5146 }
5247readonly property int headerHeight: titleLabel.height;
5348Label {
@@ -55,7 +50,7 @@ Label {
5550 objectName: "titleLabel";
5651 anchors { right: parent.right;
5752 left: parent.left;
58− top: artShapeHolder.bottom;
53+ top: artShapeLoader.bottom;
5954 topMargin: units.gu(1);
6055 }
6156 elide: Text.ElideRight;
@@ -73,7 +68,7 @@ Label {
7368UbuntuShape {
7469 id: touchdown;
7570 objectName: "touchdown";
76− anchors { fill: artShapeHolder }
71+ anchors { fill: artShapeLoader }
7772 visible: root.pressed;
7873 radius: "medium";
7974 borderSource: "radius_pressed.sci"
tests/plugins/Dash/cardcreator/11.res+4−9
@@ -50,13 +50,9 @@ Loader {
5050 }
5151 }
5252readonly 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 {
5954 id: artShapeLoader;
55+ anchors { horizontalCenter: parent.horizontalCenter; }
6056 objectName: "artShapeLoader";
6157 readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C");
6258 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -87,8 +83,7 @@ Item {
8783 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
8884 onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
8985 }
90− }
91− }
86+ }
9287 }
9388readonly property int headerHeight: row.height;
9489Row {
@@ -97,7 +92,7 @@ Row {
9792 property real margins: units.gu(1);
9893 spacing: margins;
9994 height: root.fixedHeaderHeight;
100− anchors { top: artShapeHolder.bottom;
95+ anchors { top: artShapeLoader.bottom;
10196 topMargin: units.gu(1);
10297left: parent.left;
10398 }
tests/plugins/Dash/cardcreator/11.res.cardcreator+3−8
@@ -48,13 +48,9 @@ Loader {
4848 }
4949 }
5050readonly 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 {
5752 id: artShapeLoader;
53+ anchors { horizontalCenter: parent.horizontalCenter; }
5854 objectName: "artShapeLoader";
5955 readonly property string cardArt: cardData && cardData["art"] || "";
6056 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -85,7 +81,6 @@ Item {
8581 height: width / 1;
8682 }
8783 }
88− }
8984 }
9085readonly property int headerHeight: row.height;
9186Row {
@@ -93,7 +88,7 @@ Row {
9388 objectName: "outerRow";
9489 property real margins: units.gu(1);
9590 spacing: margins;
96− anchors { top: artShapeHolder.bottom;
91+ anchors { top: artShapeLoader.bottom;
9792 topMargin: units.gu(1);
9893left: parent.left;
9994 }
tests/plugins/Dash/cardcreator/12.res+4−9
@@ -12,13 +12,9 @@ AbstractButton {
1212 property size fixedArtShapeSize: Qt.size(-1, -1);
1313signal action(var actionId);
1414readonly 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 {
2116 id: artShapeLoader;
17+ anchors { horizontalCenter: parent.horizontalCenter; }
2218 objectName: "artShapeLoader";
2319 readonly property string cardArt: cardData && cardData["art"] || "";
2420 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -49,7 +45,6 @@ Item {
4945 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
5046 }
5147 }
52− }
5348 }
5449readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
5550Label {
@@ -57,7 +52,7 @@ Label {
5752 objectName: "titleLabel";
5853 anchors { right: parent.right;
5954 left: parent.left;
60− top: artShapeHolder.bottom;
55+ top: artShapeLoader.bottom;
6156 topMargin: units.gu(1);
6257 }
6358 elide: Text.ElideRight;
@@ -101,7 +96,7 @@ CardSocialActions {
10196UbuntuShape {
10297 id: touchdown;
10398 objectName: "touchdown";
104− anchors { fill: artShapeHolder }
99+ anchors { fill: artShapeLoader }
105100 visible: root.pressed;
106101 radius: "medium";
107102 borderSource: "radius_pressed.sci"
tests/plugins/Dash/cardcreator/12.res.cardcreator+4−9
@@ -10,13 +10,9 @@ AbstractButton {
1010 enabled: true;
1111signal action(var actionId);
1212readonly 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 {
1914 id: artShapeLoader;
15+ anchors { horizontalCenter: parent.horizontalCenter; }
2016 objectName: "artShapeLoader";
2117 readonly property string cardArt: cardData && cardData["art"] || "";
2218 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -47,7 +43,6 @@ Item {
4743 height: width / 0.75;
4844 }
4945 }
50− }
5146 }
5247readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
5348Label {
@@ -55,7 +50,7 @@ Label {
5550 objectName: "titleLabel";
5651 anchors { right: parent.right;
5752 left: parent.left;
58− top: artShapeHolder.bottom;
53+ top: artShapeLoader.bottom;
5954 topMargin: units.gu(1);
6055 }
6156 elide: Text.ElideRight;
@@ -99,7 +94,7 @@ CardSocialActions {
9994UbuntuShape {
10095 id: touchdown;
10196 objectName: "touchdown";
102− anchors { fill: artShapeHolder }
97+ anchors { fill: artShapeLoader }
10398 visible: root.pressed;
10499 radius: "medium";
105100 borderSource: "radius_pressed.sci"
tests/plugins/Dash/cardcreator/3.res+3−8
@@ -12,13 +12,9 @@ AbstractButton {
1212 property size fixedArtShapeSize: Qt.size(-1, -1);
1313signal action(var actionId);
1414readonly 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 {
2116 id: artShapeLoader;
17+ anchors { horizontalCenter: parent.horizontalCenter; }
2218 objectName: "artShapeLoader";
2319 readonly property string cardArt: cardData && cardData["art"] || decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
2420 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -48,7 +44,6 @@ Item {
4844 onStatusChanged: if (status === Image.Error) source = decodeURI("IHAVE%5C%22ESCAPED%5C%22QUOTES%5C%22");
4945 }
5046 }
51− }
5247 }
5348readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
5449Label {
@@ -56,7 +51,7 @@ Label {
5651 objectName: "titleLabel";
5752 anchors { right: parent.right;
5853 left: parent.left;
59− top: artShapeHolder.bottom;
54+ top: artShapeLoader.bottom;
6055 topMargin: units.gu(1);
6156 }
6257 elide: Text.ElideRight;
tests/plugins/Dash/cardcreator/3.res.cardcreator+3−8
@@ -10,13 +10,9 @@ AbstractButton {
1010 enabled: true;
1111signal action(var actionId);
1212readonly 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;
13+Loader {
14+ id: artShapeLoader;
1715 anchors { horizontalCenter: parent.horizontalCenter; }
18− Loader {
19− id: artShapeLoader;
2016 objectName: "artShapeLoader";
2117 readonly property string cardArt: cardData && cardData["art"] || "";
2218 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -45,7 +41,6 @@ Item {
4541 height: width / 0.75;
4642 }
4743 }
48− }
4944 }
5045readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
5146Label {
@@ -53,7 +48,7 @@ Label {
5348 objectName: "titleLabel";
5449 anchors { right: parent.right;
5550 left: parent.left;
56− top: artShapeHolder.bottom;
51+ top: artShapeLoader.bottom;
5752 topMargin: units.gu(1);
5853 }
5954 elide: Text.ElideRight;
tests/plugins/Dash/cardcreator/5.res+4−9
@@ -12,13 +12,9 @@ AbstractButton {
1212 property size fixedArtShapeSize: Qt.size(-1, -1);
1313signal action(var actionId);
1414readonly 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 {
2116 id: artShapeLoader;
17+ anchors { horizontalCenter: parent.horizontalCenter; }
2218 objectName: "artShapeLoader";
2319 readonly property string cardArt: cardData && cardData["art"] || "";
2420 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -42,12 +38,11 @@ Item {
4238 height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
4339 }
4440 }
45− }
4641 }
4742Loader {
4843 id: overlayLoader;
4944 readonly property real overlayHeight: root.fixedHeaderHeight + units.gu(2);
50− anchors.fill: artShapeHolder;
45+ anchors.fill: artShapeLoader;
5146 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
5247 asynchronous: true;
5348 visible: showHeader && status == Loader.Ready;
@@ -102,5 +97,5 @@ Label {
10297 text: cardData && cardData["subtitle"] || "";
10398 font.weight: Font.Light;
10499 }
105−implicitHeight: artShapeHolder.height;
100+implicitHeight: artShapeLoader.height;
106101}
tests/plugins/Dash/cardcreator/5.res.cardcreator+4−9
@@ -10,13 +10,9 @@ AbstractButton {
1010 enabled: false;
1111signal action(var actionId);
1212readonly 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 {
1914 id: artShapeLoader;
15+ anchors { horizontalCenter: parent.horizontalCenter; }
2016 objectName: "artShapeLoader";
2117 readonly property string cardArt: cardData && cardData["art"] || "";
2218 onCardArtChanged: { if (item) { item.image.source = cardArt; } }
@@ -40,12 +36,11 @@ Item {
4036 height: width / 1;
4137 }
4238 }
43− }
4439 }
4540Loader {
4641 id: overlayLoader;
4742 readonly property real overlayHeight: headerHeight + units.gu(2);
48− anchors.fill: artShapeHolder;
43+ anchors.fill: artShapeLoader;
4944 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
5045 asynchronous: false;
5146 visible: showHeader && status == Loader.Ready;
@@ -100,5 +95,5 @@ Label {
10095 text: cardData && cardData["subtitle"] || "";
10196 font.weight: Font.Light;
10297 }
103−implicitHeight: artShapeHolder.height;
98+implicitHeight: artShapeLoader.height;
10499}