on xenial help sign in
document and narrow the rest of substitutions
95a3764Albert Astals
plugins/Dash/CardCreator.js+85−49
@@ -16,7 +16,7 @@
16
16
17.pragma library
17.pragma library
18
18
19−var backgroundLoaderCode = 'Loader {\n\
19+var kBackgroundLoaderCode = 'Loader {\n\
20 id: backgroundLoader; \n\
20 id: backgroundLoader; \n\
21 objectName: "backgroundLoader"; \n\
21 objectName: "backgroundLoader"; \n\
22 anchors.fill: parent; \n\
22 anchors.fill: parent; \n\
@@ -53,7 +53,7 @@ var backgroundLoaderCode = 'Loader {\n\
53// %1 is used as anchors of artShapeHolder
53// %1 is used as anchors of artShapeHolder
54// %2 is used as image width
54// %2 is used as image width
55// %3 is used as image height
55// %3 is used as image height
56−var artShapeHolderCode = 'Item { \n\
56+var kArtShapeHolderCode = 'Item { \n\
57 id: artShapeHolder; \n\
57 id: artShapeHolder; \n\
58 height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
58 height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height; \n\
59 width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width; \n\
59 width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width; \n\
@@ -96,7 +96,7 @@ var artShapeHolderCode = 'Item { \n\
96 } \n\
96 } \n\
97 }\n';
97 }\n';
98
98
99−var overlayLoaderCode = 'Loader { \n\
99+var kOverlayLoaderCode = 'Loader { \n\
100 id: overlayLoader; \n\
100 id: overlayLoader; \n\
101 anchors { \n\
101 anchors { \n\
102 left: artShapeHolder.left; \n\
102 left: artShapeHolder.left; \n\
@@ -137,21 +137,46 @@ var overlayLoaderCode = 'Loader { \n\
137 } \n\
137 } \n\
138 }\n';
138 }\n';
139
139
140−var headerRowCode = 'Row { \n\
140+// %1 is used as anchors of row
141+// %2 is used as first child of the row
142+// %3 is used as second child of the row
143+var kHeaderRow2Code = 'Row { \n\
141 id: row; \n\
144 id: row; \n\
142 objectName: "outerRow"; \n\
145 objectName: "outerRow"; \n\
143 property real margins: units.gu(1); \n\
146 property real margins: units.gu(1); \n\
144 spacing: margins; \n\
147 spacing: margins; \n\
145− %1 \n\
148+ anchors { %1 } \n\
146− %2 \n\
147 anchors.right: parent.right; \n\
149 anchors.right: parent.right; \n\
148 anchors.margins: margins;\n\
150 anchors.margins: margins;\n\
151+ data: [ %2\n\
152+ ,\n\
153+ %3 \n\
154+ ] \n\
155+ }\n';
156+
157+// %1 is used as anchors of row
158+// %2 is used as first child of the row
159+// %3 is used as second child of the row
160+// %4 is used as third child of the row
161+var kHeaderRow3Code = 'Row { \n\
162+ id: row; \n\
163+ objectName: "outerRow"; \n\
164+ property real margins: units.gu(1); \n\
165+ spacing: margins; \n\
166+ anchors { %1 } \n\
167+ anchors.right: parent.right; \n\
168+ anchors.margins: margins;\n\
169+ data: [ %2\n\
170+ ,\n\
171+ %3 \n\
172+ ,\n\
173+ %4 \n\
149− %3 \n\
174+ ] \n\
150 }\n';
175 }\n';
151
176
152// %1 is used as first child of the column
177// %1 is used as first child of the column
153// %2 is used as second child of the column
178// %2 is used as second child of the column
154−var headerColumnCode = 'Column { \n\
179+var kHeaderColumnCode = 'Column { \n\
155 anchors.verticalCenter: parent.verticalCenter; \n\
180 anchors.verticalCenter: parent.verticalCenter; \n\
156 spacing: units.dp(2); \n\
181 spacing: units.dp(2); \n\
157 width: parent.width - x;\n\
182 width: parent.width - x;\n\
@@ -161,7 +186,8 @@ var headerColumnCode = 'Column { \n\
161 ] \n\
186 ] \n\
162 }\n';
187 }\n';
163
188
164−var mascotShapeLoaderCode = 'Loader { \n\
189+// %1 is used as anchors of mascotShapeLoader
190+var kMascotShapeLoaderCode = 'Loader { \n\
165 id: mascotShapeLoader; \n\
191 id: mascotShapeLoader; \n\
166 objectName: "mascotShapeLoader"; \n\
192 objectName: "mascotShapeLoader"; \n\
167 asynchronous: root.asynchronous; \n\
193 asynchronous: root.asynchronous; \n\
@@ -170,13 +196,15 @@ var mascotShapeLoaderCode = 'Loader { \n\
170 width: units.gu(6); \n\
196 width: units.gu(6); \n\
171 height: units.gu(5.625); \n\
197 height: units.gu(5.625); \n\
172 sourceComponent: UbuntuShape { image: mascotImage } \n\
198 sourceComponent: UbuntuShape { image: mascotImage } \n\
173− %1 \n\
199+ anchors { %1 } \n\
174 }\n';
200 }\n';
175
201
176−var mascotImageCode = 'Image { \n\
202+// %1 is used as anchors of mascotImage
203+// %2 is used as visible of mascotImage
204+var kMascotImageCode = 'Image { \n\
177 id: mascotImage; \n\
205 id: mascotImage; \n\
178 objectName: "mascotImage"; \n\
206 objectName: "mascotImage"; \n\
179− %1 \n\
207+ anchors { %1 } \n\
180 readonly property int maxSize: Math.max(width, height) * 4; \n\
208 readonly property int maxSize: Math.max(width, height) * 4; \n\
181 source: cardData && cardData["mascot"]; \n\
209 source: cardData && cardData["mascot"]; \n\
182 width: units.gu(6); \n\
210 width: units.gu(6); \n\
@@ -188,10 +216,13 @@ var mascotImageCode = 'Image { \n\
188 visible: %2; \n\
216 visible: %2; \n\
189 }\n';
217 }\n';
190
218
191−var titleLabelCode = 'Label { \n\
219+// %1 is used as anchors of titleLabel
220+// %1 is used as color of titleLabel
221+// %3 is used as extra condition for visible of titleLabel
222+var kTitleLabelCode = 'Label { \n\
192 id: titleLabel; \n\
223 id: titleLabel; \n\
193 objectName: "titleLabel"; \n\
224 objectName: "titleLabel"; \n\
194− %1 \n\
225+ anchors { %1 } \n\
195 elide: Text.ElideRight; \n\
226 elide: Text.ElideRight; \n\
196 fontSize: "small"; \n\
227 fontSize: "small"; \n\
197 wrapMode: Text.Wrap; \n\
228 wrapMode: Text.Wrap; \n\
@@ -206,7 +237,7 @@ var titleLabelCode = 'Label { \n\
206
237
207// %1 is used as anchors of subtitleLabel
238// %1 is used as anchors of subtitleLabel
208// %2 is used as color of subtitleLabel
239// %2 is used as color of subtitleLabel
209−var subtitleLabelCode = 'Label { \n\
240+var kSubtitleLabelCode = 'Label { \n\
210 id: subtitleLabel; \n\
241 id: subtitleLabel; \n\
211 objectName: "subtitleLabel"; \n\
242 objectName: "subtitleLabel"; \n\
212 anchors { %1 } \n\
243 anchors { %1 } \n\
@@ -223,7 +254,7 @@ var subtitleLabelCode = 'Label { \n\
223// %1 is used as top anchor of summary
254// %1 is used as top anchor of summary
224// %2 is used as topMargin anchor of summary
255// %2 is used as topMargin anchor of summary
225// %3 is used as color of summary
256// %3 is used as color of summary
226−var summaryLabelCode = 'Label { \n\
257+var kSummaryLabelCode = 'Label { \n\
227 id: summary; \n\
258 id: summary; \n\
228 objectName: "summaryLabel"; \n\
259 objectName: "summaryLabel"; \n\
229 anchors { \n\
260 anchors { \n\
@@ -270,7 +301,7 @@ function cardString(template, components) {
270 var hasHeaderRow = hasMascot && hasTitle;
301 var hasHeaderRow = hasMascot && hasTitle;
271
302
272 if (hasBackground) {
303 if (hasBackground) {
273− code += backgroundLoaderCode;
304+ code += kBackgroundLoaderCode;
274 }
305 }
275
306
276 if (hasArt) {
307 if (hasArt) {
@@ -295,41 +326,41 @@ function cardString(template, components) {
295 heightCode = 'width / artShape.aspect';
326 heightCode = 'width / artShape.aspect';
296 }
327 }
297
328
298− code += artShapeHolderCode.arg(anchors).arg(widthCode).arg(heightCode);
329+ code += kArtShapeHolderCode.arg(anchors).arg(widthCode).arg(heightCode);
299 } else {
330 } else {
300 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
331 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
301 }
332 }
302
333
303 if (headerAsOverlay) {
334 if (headerAsOverlay) {
304− code += overlayLoaderCode;
335+ code += kOverlayLoaderCode;
305 }
336 }
306
337
307 var headerVerticalAnchors;
338 var headerVerticalAnchors;
308 if (headerAsOverlay) {
339 if (headerAsOverlay) {
309− headerVerticalAnchors = 'anchors.bottom: artShapeHolder.bottom; \n\
340+ headerVerticalAnchors = 'bottom: artShapeHolder.bottom; \n\
310− anchors.bottomMargin: units.gu(1);\n';
341+ bottomMargin: units.gu(1);\n';
311 } else {
342 } else {
312 if (hasArt) {
343 if (hasArt) {
313 if (isHorizontal) {
344 if (isHorizontal) {
314− headerVerticalAnchors = 'anchors.top: artShapeHolder.top; \n\
345+ headerVerticalAnchors = 'top: artShapeHolder.top; \n\
315− anchors.topMargin: units.gu(1);\n';
346+ topMargin: units.gu(1);\n';
316 } else {
347 } else {
317− headerVerticalAnchors = 'anchors.top: artShapeHolder.bottom; \n\
348+ headerVerticalAnchors = 'top: artShapeHolder.bottom; \n\
318− anchors.topMargin: units.gu(1);\n';
349+ topMargin: units.gu(1);\n';
319 }
350 }
320 } else {
351 } else {
321− headerVerticalAnchors = 'anchors.top: parent.top; \n\
352+ headerVerticalAnchors = 'top: parent.top; \n\
322− anchors.topMargin: units.gu(1);\n';
353+ topMargin: units.gu(1);\n';
323 }
354 }
324 }
355 }
325 var headerLeftAnchor;
356 var headerLeftAnchor;
326 var headerLeftAnchorHasMagin = false;
357 var headerLeftAnchorHasMagin = false;
327 if (isHorizontal && hasArt) {
358 if (isHorizontal && hasArt) {
328− headerLeftAnchor = 'anchors.left: artShapeHolder.right; \n\
359+ headerLeftAnchor = 'left: artShapeHolder.right; \n\
329− anchors.leftMargin: units.gu(1);\n';
360+ leftMargin: units.gu(1);\n';
330 headerLeftAnchorHasMagin = true;
361 headerLeftAnchorHasMagin = true;
331 } else {
362 } else {
332− headerLeftAnchor = 'anchors.left: parent.left;\n';
363+ headerLeftAnchor = 'left: parent.left;\n';
333 }
364 }
334
365
335 if (hasHeaderRow) {
366 if (hasHeaderRow) {
@@ -344,6 +375,7 @@ function cardString(template, components) {
344 code += 'readonly property int headerHeight: 0;\n'
375 code += 'readonly property int headerHeight: 0;\n'
345 }
376 }
346
377
378+ var mascotShapeCode = "";
347 var mascotCode = "";
379 var mascotCode = "";
348 if (hasMascot) {
380 if (hasMascot) {
349 var useMascotShape = !hasBackground && !headerAsOverlay;
381 var useMascotShape = !hasBackground && !headerAsOverlay;
@@ -352,18 +384,18 @@ function cardString(template, components) {
352 anchors += headerLeftAnchor;
384 anchors += headerLeftAnchor;
353 anchors += headerVerticalAnchors;
385 anchors += headerVerticalAnchors;
354 if (!headerLeftAnchorHasMagin) {
386 if (!headerLeftAnchorHasMagin) {
355− anchors += 'anchors.leftMargin: units.gu(1);\n'
387+ anchors += 'leftMargin: units.gu(1);\n'
356 }
388 }
357 } else {
389 } else {
358− anchors = "anchors.verticalCenter: parent.verticalCenter;"
390+ anchors = "verticalCenter: parent.verticalCenter;"
359 }
391 }
360
392
361 if (useMascotShape) {
393 if (useMascotShape) {
362− mascotCode += mascotShapeLoaderCode.arg(anchors);
394+ mascotShapeCode = kMascotShapeLoaderCode.arg(anchors);
363 }
395 }
364
396
365 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
397 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
366− mascotCode += mascotImageCode.arg(anchors).arg(mascotImageVisible);
398+ mascotCode = kMascotImageCode.arg(anchors).arg(mascotImageVisible);
367 }
399 }
368
400
369 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : "grey"';
401 var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : "grey"';
@@ -385,22 +417,22 @@ function cardString(template, components) {
385 var subtitleAnchors;
417 var subtitleAnchors;
386 if (hasMascot && hasSubtitle) {
418 if (hasMascot && hasSubtitle) {
387 // Using row + column
419 // Using row + column
388− titleAnchors = 'anchors { left: parent.left; right: parent.right }\n';
420+ titleAnchors = 'left: parent.left; right: parent.right';
389− subtitleAnchors = 'left: parent.left; right: parent.right';
421+ subtitleAnchors = titleAnchors;
390 } else if (hasMascot) {
422 } else if (hasMascot) {
391 // Using row + label
423 // Using row + label
392− titleAnchors = 'anchors.verticalCenter: parent.verticalCenter;\n'
424+ titleAnchors = 'verticalCenter: parent.verticalCenter;\n'
393 } else {
425 } else {
394 if (headerAsOverlay) {
426 if (headerAsOverlay) {
395 // Using anchors to the overlay
427 // Using anchors to the overlay
396− titleAnchors = 'anchors.left: parent.left; \n\
428+ titleAnchors = 'left: parent.left; \n\
397− anchors.leftMargin: units.gu(1); \n\
429+ leftMargin: units.gu(1); \n\
398− anchors.right: parent.right; \n\
430+ right: parent.right; \n\
399− anchors.top: overlayLoader.top; \n\
431+ top: overlayLoader.top; \n\
400− anchors.topMargin: units.gu(1);\n';
432+ topMargin: units.gu(1);\n';
401 } else {
433 } else {
402 // Using anchors to the mascot/parent
434 // Using anchors to the mascot/parent
403− titleAnchors = "anchors.right: parent.right;";
435+ titleAnchors = "right: parent.right;";
404 titleAnchors += headerLeftAnchor;
436 titleAnchors += headerLeftAnchor;
405 titleAnchors += headerVerticalAnchors;
437 titleAnchors += headerVerticalAnchors;
406 }
438 }
@@ -412,24 +444,28 @@ function cardString(template, components) {
412 }
444 }
413
445
414 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
446 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
415− var titleCode = titleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);
447+ var titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);
416 var subtitleCode = "";
448 var subtitleCode = "";
417 if (hasSubtitle) {
449 if (hasSubtitle) {
418− subtitleCode += subtitleLabelCode.arg(subtitleAnchors).arg(color);
450+ subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);
419 }
451 }
420
452
421 if (hasMascot && hasSubtitle) {
453 if (hasMascot && hasSubtitle) {
422 // If using row + column wrap the code in the column
454 // If using row + column wrap the code in the column
423− titleSubtitleCode = headerColumnCode.arg(titleCode).arg(subtitleCode);
455+ titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
424 } else {
456 } else {
425 titleSubtitleCode = titleCode + subtitleCode;
457 titleSubtitleCode = titleCode + subtitleCode;
426 }
458 }
427 }
459 }
428
460
429 if (hasHeaderRow) {
461 if (hasHeaderRow) {
462+ if (mascotShapeCode != "") {
430− code += headerRowCode.arg(headerVerticalAnchors).arg(headerLeftAnchor).arg(mascotCode + titleSubtitleCode);
463+ code += kHeaderRow3Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotShapeCode).arg(mascotCode).arg(titleSubtitleCode);
464+ } else {
465+ code += kHeaderRow2Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotCode).arg(titleSubtitleCode);
466+ }
431 } else {
467 } else {
432− code += mascotCode + titleSubtitleCode;
468+ code += mascotShapeCode + mascotCode + titleSubtitleCode;
433 }
469 }
434
470
435 if (hasSummary) {
471 if (hasSummary) {
@@ -452,7 +488,7 @@ function cardString(template, components) {
452
488
453 var summaryTopMargin = (hasMascot || hasSubtitle ? 'anchors.margins' : '0');
489 var summaryTopMargin = (hasMascot || hasSubtitle ? 'anchors.margins' : '0');
454
490
455− code += summaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);
491+ code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);
456 }
492 }
457
493
458 if (hasSummary) {
494 if (hasSummary) {
tests/plugins/Dash/cardcreator/1.res+4−6
@@ -17,7 +17,6 @@ Item {
17 height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
17 height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
18 width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
18 width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
19 anchors { horizontalCenter: parent.horizontalCenter; }
19 anchors { horizontalCenter: parent.horizontalCenter; }
20−
21 Loader {
20 Loader {
22 id: artShapeLoader;
21 id: artShapeLoader;
23 objectName: "artShapeLoader";
22 objectName: "artShapeLoader";
@@ -51,7 +50,6 @@ Item {
51 readonly property real aspect: implicitWidth / implicitHeight;
50 readonly property real aspect: implicitWidth / implicitHeight;
52 width: root.width;
51 width: root.width;
53 height: width / artShape.aspect;
52 height: width / artShape.aspect;
54−
55 }
53 }
56 }
54 }
57 }
55 }
@@ -60,10 +58,10 @@ readonly property int headerHeight: titleLabel.height + titleLabel.anchors.topMa
60Label {
58Label {
61 id: titleLabel;
59 id: titleLabel;
62 objectName: "titleLabel";
60 objectName: "titleLabel";
63− anchors.right: parent.right;anchors.left: parent.left;
61+ anchors { right: parent.right;left: parent.left;
64−anchors.top: artShapeHolder.bottom;
62+top: artShapeHolder.bottom;
65− anchors.topMargin: units.gu(1);
63+ topMargin: units.gu(1);
66−
64+ }
67 elide: Text.ElideRight;
65 elide: Text.ElideRight;
68 fontSize: "small";
66 fontSize: "small";
69 wrapMode: Text.Wrap;
67 wrapMode: Text.Wrap;
tests/plugins/Dash/cardcreator/2.res+8−8
@@ -51,17 +51,16 @@ Row {
51 objectName: "outerRow";
51 objectName: "outerRow";
52 property real margins: units.gu(1);
52 property real margins: units.gu(1);
53 spacing: margins;
53 spacing: margins;
54− anchors.top: parent.top;
54+ anchors { top: parent.top;
55− anchors.topMargin: units.gu(1);
55+ topMargin: units.gu(1);
56−
57− anchors.left: parent.left;
56+ left: parent.left;
58−
57+}
59 anchors.right: parent.right;
58 anchors.right: parent.right;
60 anchors.margins: margins;
59 anchors.margins: margins;
61−Image {
60+data: [ Image {
62 id: mascotImage;
61 id: mascotImage;
63 objectName: "mascotImage";
62 objectName: "mascotImage";
64− anchors.verticalCenter: parent.verticalCenter;
63+ anchors { verticalCenter: parent.verticalCenter; }
65 readonly property int maxSize: Math.max(width, height) * 4;
64 readonly property int maxSize: Math.max(width, height) * 4;
66 source: cardData && cardData["mascot"];
65 source: cardData && cardData["mascot"];
67 width: units.gu(6);
66 width: units.gu(6);
@@ -72,6 +71,7 @@ Image {
72 verticalAlignment: Image.AlignVCenter;
71 verticalAlignment: Image.AlignVCenter;
73 visible: showHeader;
72 visible: showHeader;
74 }
73 }
74+,
75Column {
75Column {
76 anchors.verticalCenter: parent.verticalCenter;
76 anchors.verticalCenter: parent.verticalCenter;
77 spacing: units.dp(2);
77 spacing: units.dp(2);
@@ -81,7 +81,6 @@ Label {
81 id: titleLabel;
81 id: titleLabel;
82 objectName: "titleLabel";
82 objectName: "titleLabel";
83 anchors { left: parent.left; right: parent.right }
83 anchors { left: parent.left; right: parent.right }
84−
85 elide: Text.ElideRight;
84 elide: Text.ElideRight;
86 fontSize: "small";
85 fontSize: "small";
87 wrapMode: Text.Wrap;
86 wrapMode: Text.Wrap;
@@ -110,6 +109,7 @@ Label {
110 }
109 }
111]
110]
112}
111}
112+]
113}
113}
114implicitHeight: row.y + row.height + units.gu(1);
114implicitHeight: row.y + row.height + units.gu(1);
115}
115}
tests/plugins/Dash/cardcreator/3.res+4−6
@@ -17,7 +17,6 @@ Item {
17 height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
17 height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
18 width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
18 width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
19 anchors { horizontalCenter: parent.horizontalCenter; }
19 anchors { horizontalCenter: parent.horizontalCenter; }
20−
21 Loader {
20 Loader {
22 id: artShapeLoader;
21 id: artShapeLoader;
23 objectName: "artShapeLoader";
22 objectName: "artShapeLoader";
@@ -51,7 +50,6 @@ Item {
51 readonly property real aspect: implicitWidth / implicitHeight;
50 readonly property real aspect: implicitWidth / implicitHeight;
52 width: root.width;
51 width: root.width;
53 height: width / artShape.aspect;
52 height: width / artShape.aspect;
54−
55 }
53 }
56 }
54 }
57 }
55 }
@@ -60,10 +58,10 @@ readonly property int headerHeight: subtitleLabel.y + subtitleLabel.height - tit
60Label {
58Label {
61 id: titleLabel;
59 id: titleLabel;
62 objectName: "titleLabel";
60 objectName: "titleLabel";
63− anchors.right: parent.right;anchors.left: parent.left;
61+ anchors { right: parent.right;left: parent.left;
64−anchors.top: artShapeHolder.bottom;
62+top: artShapeHolder.bottom;
65− anchors.topMargin: units.gu(1);
63+ topMargin: units.gu(1);
66−
64+}
67 elide: Text.ElideRight;
65 elide: Text.ElideRight;
68 fontSize: "small";
66 fontSize: "small";
69 wrapMode: Text.Wrap;
67 wrapMode: Text.Wrap;
tests/plugins/Dash/cardcreator/4.res+13−11
@@ -18,14 +18,13 @@ Row {
18 objectName: "outerRow";
18 objectName: "outerRow";
19 property real margins: units.gu(1);
19 property real margins: units.gu(1);
20 spacing: margins;
20 spacing: margins;
21− anchors.top: parent.top;
21+ anchors { top: parent.top;
22− anchors.topMargin: units.gu(1);
22+ topMargin: units.gu(1);
23−
24− anchors.left: parent.left;
23+ left: parent.left;
25−
24+}
26 anchors.right: parent.right;
25 anchors.right: parent.right;
27 anchors.margins: margins;
26 anchors.margins: margins;
28−Loader {
27+data: [ Loader {
29 id: mascotShapeLoader;
28 id: mascotShapeLoader;
30 objectName: "mascotShapeLoader";
29 objectName: "mascotShapeLoader";
31 asynchronous: root.asynchronous;
30 asynchronous: root.asynchronous;
@@ -34,12 +33,14 @@ Loader {
34 width: units.gu(6);
33 width: units.gu(6);
35 height: units.gu(5.625);
34 height: units.gu(5.625);
36 sourceComponent: UbuntuShape { image: mascotImage }
35 sourceComponent: UbuntuShape { image: mascotImage }
37− anchors.verticalCenter: parent.verticalCenter;
36+ anchors { verticalCenter: parent.verticalCenter; }
38 }
37 }
38+
39+,
39Image {
40Image {
40 id: mascotImage;
41 id: mascotImage;
41 objectName: "mascotImage";
42 objectName: "mascotImage";
42− anchors.verticalCenter: parent.verticalCenter;
43+ anchors { verticalCenter: parent.verticalCenter; }
43 readonly property int maxSize: Math.max(width, height) * 4;
44 readonly property int maxSize: Math.max(width, height) * 4;
44 source: cardData && cardData["mascot"];
45 source: cardData && cardData["mascot"];
45 width: units.gu(6);
46 width: units.gu(6);
@@ -50,16 +51,16 @@ Image {
50 verticalAlignment: Image.AlignVCenter;
51 verticalAlignment: Image.AlignVCenter;
51 visible: false;
52 visible: false;
52 }
53 }
54+
55+,
53Column {
56Column {
54 anchors.verticalCenter: parent.verticalCenter;
57 anchors.verticalCenter: parent.verticalCenter;
55 spacing: units.dp(2);
58 spacing: units.dp(2);
56 width: parent.width - x;
59 width: parent.width - x;
57−data: [
58−Label {
60+data: [ Label {
59 id: titleLabel;
61 id: titleLabel;
60 objectName: "titleLabel";
62 objectName: "titleLabel";
61 anchors { left: parent.left; right: parent.right }
63 anchors { left: parent.left; right: parent.right }
62−
63 elide: Text.ElideRight;
64 elide: Text.ElideRight;
64 fontSize: "small";
65 fontSize: "small";
65 wrapMode: Text.Wrap;
66 wrapMode: Text.Wrap;
@@ -88,6 +89,7 @@ Label {
88 }
89 }
89]
90]
90}
91}
92+]
91}
93}
92implicitHeight: row.y + row.height + units.gu(1);
94implicitHeight: row.y + row.height + units.gu(1);
93}
95}
tests/plugins/Dash/cardcreator/5.res+8−11
@@ -17,7 +17,6 @@ Item {
17 height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
17 height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
18 width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
18 width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
19 anchors { horizontalCenter: parent.horizontalCenter; }
19 anchors { horizontalCenter: parent.horizontalCenter; }
20−
21 Loader {
20 Loader {
22 id: artShapeLoader;
21 id: artShapeLoader;
23 objectName: "artShapeLoader";
22 objectName: "artShapeLoader";
@@ -51,7 +50,6 @@ Item {
51 readonly property real aspect: implicitWidth / implicitHeight;
50 readonly property real aspect: implicitWidth / implicitHeight;
52 width: root.width;
51 width: root.width;
53 height: width / artShape.aspect;
52 height: width / artShape.aspect;
54−
55 }
53 }
56 }
54 }
57 }
55 }
@@ -69,7 +67,6 @@ Loader {
69 sourceComponent: ShaderEffect {
67 sourceComponent: ShaderEffect {
70 id: overlay;
68 id: overlay;
71 height: fixedHeaderHeight != -1 ? fixedHeaderHeight : headerHeight;
69 height: fixedHeaderHeight != -1 ? fixedHeaderHeight : headerHeight;
72−
73 opacity: 0.6;
70 opacity: 0.6;
74 property var source: ShaderEffectSource {
71 property var source: ShaderEffectSource {
75 id: shaderSource;
72 id: shaderSource;
@@ -101,12 +98,12 @@ readonly property int headerHeight: subtitleLabel.y + subtitleLabel.height - tit
101Label {
98Label {
102 id: titleLabel;
99 id: titleLabel;
103 objectName: "titleLabel";
100 objectName: "titleLabel";
104− anchors.left: parent.left;
101+ anchors { left: parent.left;
105− anchors.leftMargin: units.gu(1);
102+ leftMargin: units.gu(1);
106− anchors.right: parent.right;
103+ right: parent.right;
107− anchors.top: overlayLoader.top;
104+ top: overlayLoader.top;
108− anchors.topMargin: units.gu(1);
105+ topMargin: units.gu(1);
109−
106+}
110 elide: Text.ElideRight;
107 elide: Text.ElideRight;
111 fontSize: "small";
108 fontSize: "small";
112 wrapMode: Text.Wrap;
109 wrapMode: Text.Wrap;
@@ -125,8 +122,8 @@ Label {
125 leftMargin: titleLabel.leftMargin;
122 leftMargin: titleLabel.leftMargin;
126 right: titleLabel.right;
123 right: titleLabel.right;
127 top: titleLabel.bottom;
124 top: titleLabel.bottom;
128− topMargin: units.dp(2); }
125+ topMargin: units.dp(2);
129−
126+ }
130 elide: Text.ElideRight;
127 elide: Text.ElideRight;
131 fontSize: "small";
128 fontSize: "small";
132 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
129 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);