@@ -71,19 +71,14 @@ var kArtShapeHolderCode = 'Item { \n\
7171 visible: image.status == Image.Ready; \n\
7272 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; \n\
7373 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1; \n\
74− readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect; \n\
7574 Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; } \n\
76− onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings(); \n\
7775 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } \n\
7876 function updateWidthHeightBindings() { \n\
7977 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { \n\
8078 width = root.fixedArtShapeSize.width; \n\
8179 height = root.fixedArtShapeSize.height; \n\
82− } else if (aspectSmallerThanImageAspect) { \n\
83− width = Qt.binding(function() { return !visible ? 0 : image.width }); \n\
84− height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect }); \n\
8580 } else { \n\
86− width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect }); \n\
81+ width = Qt.binding(function() { return !visible ? 0 : image.width }); \n\
8782 height = Qt.binding(function() { return !visible ? 0 : image.height }); \n\
8883 } \n\
8984 } \n\
@@ -92,8 +87,7 @@ var kArtShapeHolderCode = 'Item { \n\
9287 source: cardData && cardData["art"] || ""; \n\
9388 cache: true; \n\
9489 asynchronous: root.asynchronous; \n\
95− fillMode: components && components["art"]["fill-mode"] === "fit" ? Image.PreserveAspectFit: Image.PreserveAspectCrop; \n\
96− readonly property real aspect: implicitWidth / implicitHeight; \n\
90+ fillMode: Image.PreserveAspectCrop; \n\
9791 width: %2; \n\
9892 height: %3; \n\
9993 } \n\
@@ -114,7 +108,8 @@ var kOverlayLoaderCode = 'Loader { \n\
114108 sourceComponent: ShaderEffect { \n\
115109 id: overlay; \n\
116110 height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
117− opacity: 0.6; \n\
111+ property real luminance: 0.2126 * overlayColor.r + 0.7152 * overlayColor.g + 0.0722 * overlayColor.b; \n\
112+ property color overlayColor: cardData && cardData["overlayColor"] || "#99000000"; \n\
118113 property var source: ShaderEffectSource { \n\
119114 id: shaderSource; \n\
120115 sourceItem: artShapeLoader.item; \n\
@@ -135,17 +130,17 @@ var kOverlayLoaderCode = 'Loader { \n\
135130 varying highp vec2 coord; \n\
136131 uniform sampler2D source; \n\
137132 uniform lowp float qt_Opacity; \n\
133+ uniform highp vec4 overlayColor; \n\
138134 void main() { \n\
139135 lowp vec4 tex = texture2D(source, coord); \n\
140− gl_FragColor = vec4(0, 0, 0, tex.a) * qt_Opacity; \n\
136+ gl_FragColor = vec4(overlayColor.r, overlayColor.g, overlayColor.b, 1) * qt_Opacity * overlayColor.a * tex.a; \n\
141137 }"; \n\
142138 } \n\
143139 }\n';
144140
145−// %1 is used as anchors of row
146−// %2 is used as first child of the row
147−// %3 is used as second child of the row
148−var kHeaderRow2Code = 'Row { \n\
141+// multiple row version of HeaderRowCode
142+function kHeaderRowCodeGenerator() {
143+var kHeaderRowCodeTemplate = 'Row { \n\
149144 id: row; \n\
150145 objectName: "outerRow"; \n\
151146 property real margins: units.gu(1); \n\
@@ -153,58 +148,30 @@ var kHeaderRow2Code = 'Row { \n\
153148 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
154149 anchors { %1 } \n\
155150 anchors.right: parent.right; \n\
156− anchors.margins: margins;\n\
157− data: [ %2\n\
158− ,\n\
159− %3 \n\
151+ anchors.margins: margins; \n\
152+ anchors.rightMargin: 0; \n\
153+ data: [ \n\
154+ %2 \n\
160155 ] \n\
161156 }\n';
157+ var args = Array.prototype.slice.call(arguments);
158+ var code = kHeaderRowCodeTemplate.arg(args.shift()).arg(args.join(',\n'));
159+ return code;
160+}
162161
163−// %1 is used as anchors of row
164−// %2 is used as first child of the row
165−// %3 is used as second child of the row
166−// %4 is used as third child of the row
167−var kHeaderRow3Code = 'Row { \n\
168− id: row; \n\
169− objectName: "outerRow"; \n\
170− property real margins: units.gu(1); \n\
171− spacing: margins; \n\
172− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
173− anchors { %1 } \n\
174− anchors.right: parent.right; \n\
175− anchors.margins: margins;\n\
176− data: [ %2\n\
177− ,\n\
162+// multiple item version of kHeaderContainerCode
163+function kHeaderContainerCodeGenerator() {
164+ var headerContainerCodeTemplate = 'Item { \n\
165+ id: headerTitleContainer; \n\
166+ anchors { %1 } \n\
167+ width: parent.width - x; \n\
168+ implicitHeight: %2; \n\
169+ data: [ \n\
178170 %3 \n\
179− ,\n\
180− %4 \n\
181− ] \n\
182− }\n';
183−
184−// %1 is used as first child of the column
185−// %2 is used as second child of the column
186−var kHeaderColumnCode = 'Column { \n\
187− anchors.verticalCenter: parent.verticalCenter; \n\
188− spacing: units.dp(2); \n\
189− width: parent.width - x;\n\
190− data: [ %1\n\
191− ,\n\
192− %2 \n\
193− ] \n\
171+ ]\n\
194172 }\n';
195−
196−// multiple column version of kHeaderColumnCode.
197−function kHeaderColumnCodeGenerator() {
198− var headerColumnCodeTemplate = 'Column { \n\
199− anchors.verticalCenter: parent.verticalCenter; \n\
200− spacing: units.dp(2); \n\
201− width: parent.width - x;\n\
202− data: [ \n\
203− %1 \n\
204− ]\n\
205− }\n';
206173 var args = Array.prototype.slice.call(arguments);
207− var code = headerColumnCodeTemplate.arg(args.join(',\n'));
174+ var code = headerContainerCodeTemplate.arg(args.shift()).arg(args.shift()).arg(args.join(',\n'));
208175 return code;
209176}
210177
@@ -228,7 +195,7 @@ var kMascotImageCode = 'Image { \n\
228195 objectName: "mascotImage"; \n\
229196 anchors { %1 } \n\
230197 readonly property int maxSize: Math.max(width, height) * 4; \n\
231− source: cardData && cardData["mascot"]; \n\
198+ source: cardData && cardData["mascot"] || ""; \n\
232199 width: units.gu(6); \n\
233200 height: units.gu(5.625); \n\
234201 sourceSize { width: maxSize; height: maxSize } \n\
@@ -257,12 +224,39 @@ var kTitleLabelCode = 'Label { \n\
257224 horizontalAlignment: root.headerAlignment; \n\
258225 }\n';
259226
227+// %1 is used as extra anchors of emblemIcon
228+// %2 is used as color of emblemIcon
229+var kEmblemIconCode = 'Icon { \n\
230+ id: emblemIcon; \n\
231+ objectName: "emblemIcon"; \n\
232+ anchors { \n\
233+ bottom: titleLabel.baseline; \n\
234+ right: parent.right; \n\
235+ %1
236+ } \n\
237+ source: cardData && cardData["emblem"] || ""; \n\
238+ color: %2; \n\
239+ width: height; \n\
240+ height: source != "" ? titleLabel.font.pixelSize : 0; \n\
241+ }\n';
242+
243+// %1 is used as anchors of touchdown effect
244+var kTouchdownCode = 'UbuntuShape { \n\
245+ id: touchdown; \n\
246+ objectName: "touchdown"; \n\
247+ anchors { %1 } \n\
248+ visible: root.pressed; \n\
249+ radius: "medium"; \n\
250+ borderSource: "radius_pressed.sci" \n\
251+ }\n';
252+
260253// %1 is used as anchors of subtitleLabel
261254// %2 is used as color of subtitleLabel
262255var kSubtitleLabelCode = 'Label { \n\
263256 id: subtitleLabel; \n\
264257 objectName: "subtitleLabel"; \n\
265258 anchors { %1 } \n\
259+ anchors.topMargin: units.dp(2); \n\
266260 elide: Text.ElideRight; \n\
267261 fontSize: "small"; \n\
268262 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
@@ -274,12 +268,13 @@ var kSubtitleLabelCode = 'Label { \n\
274268 }\n';
275269
276270// %1 is used as anchors of attributesRow
271+// %2 is used as color of attributesRow
277272var kAttributesRowCode = 'CardAttributes { \n\
278273 id: attributesRow; \n\
279274 objectName: "attributesRow"; \n\
280275 anchors { %1 } \n\
281276 color: %2; \n\
282− model: cardData && cardData["attributes"] || undefined; \n\
277+ model: cardData && cardData["attributes"]; \n\
283278 }\n';
284279
285280// %1 is used as top anchor of summary
@@ -329,10 +324,11 @@ function cardString(template, components) {
329324 var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary);
330325 var hasTitle = components["title"] || false;
331326 var hasMascot = components["mascot"] || false;
327+ var hasEmblem = components["emblem"] && !(hasMascot && template["card-size"] === "small") || false;
332328 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
333329 var hasSubtitle = hasTitle && components["subtitle"] || false;
334330 var hasHeaderRow = hasMascot && hasTitle;
335− var hasAttributes = hasTitle && components["attributes"] || false;
331+ var hasAttributes = hasTitle && components["attributes"]["field"] || false;
336332
337333 if (hasBackground) {
338334 code += kBackgroundLoaderCode;
@@ -343,9 +339,9 @@ function cardString(template, components) {
343339 code += 'readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);\n';
344340
345341 var widthCode, heightCode;
346− var anchors;
342+ var artAnchors;
347343 if (isHorizontal) {
348− anchors = 'left: parent.left';
344+ artAnchors = 'left: parent.left';
349345 if (hasMascot || hasTitle) {
350346 widthCode = 'height * artShape.aspect'
351347 heightCode = 'headerHeight + 2 * units.gu(1)';
@@ -356,12 +352,12 @@ function cardString(template, components) {
356352 heightCode = 'units.gu(7.625)';
357353 }
358354 } else {
359− anchors = 'horizontalCenter: parent.horizontalCenter;';
355+ artAnchors = 'horizontalCenter: parent.horizontalCenter;';
360356 widthCode = 'root.width'
361357 heightCode = 'width / artShape.aspect';
362358 }
363359
364− code += kArtShapeHolderCode.arg(anchors).arg(widthCode).arg(heightCode);
360+ code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode);
365361 } else {
366362 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
367363 }
@@ -398,6 +394,8 @@ function cardString(template, components) {
398394 headerLeftAnchor = 'left: parent.left;\n';
399395 }
400396
397+ var touchdownOnArtShape = !hasBackground && hasArt && !hasMascot && !hasSummary;
398+
401399 if (hasHeaderRow) {
402400 code += 'readonly property int headerHeight: row.height;\n'
403401 } else if (hasMascot) {
@@ -418,182 +416,239 @@ function cardString(template, components) {
418416 code += 'readonly property int headerHeight: 0;\n'
419417 }
420418
421− var mascotShapeCode = "";
422− var mascotCode = "";
419+ var mascotShapeCode = '';
420+ var mascotCode = '';
423421 if (hasMascot) {
424422 var useMascotShape = !hasBackground && !headerAsOverlay;
425− var anchors = "";
423+ var mascotAnchors = '';
426424 if (!hasHeaderRow) {
427− anchors += headerLeftAnchor;
428− anchors += headerVerticalAnchors;
425+ mascotAnchors += headerLeftAnchor;
426+ mascotAnchors += headerVerticalAnchors;
429427 if (!headerLeftAnchorHasMargin) {
430− anchors += 'leftMargin: units.gu(1);\n'
428+ mascotAnchors += 'leftMargin: units.gu(1);\n'
431429 }
432430 } else {
433− anchors = "verticalCenter: parent.verticalCenter;"
431+ mascotAnchors = 'verticalCenter: parent.verticalCenter;'
434432 }
435433
436434 if (useMascotShape) {
437− mascotShapeCode = kMascotShapeLoaderCode.arg(anchors);
435+ mascotShapeCode = kMascotShapeLoaderCode.arg(mascotAnchors);
438436 }
439437
440438 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
441− mascotCode = kMascotImageCode.arg(anchors).arg(mascotImageVisible);
439+ mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible);
442440 }
443441
444− var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey")';
442+ var summaryColorWithBackground = 'backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey")';
445443
446− var titleSubtitleCode = "";
444+ var hasTitleContainer = hasTitle && (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes)));
445+ var titleSubtitleCode = '';
447446 if (hasTitle) {
448− var color;
447+ var titleColor;
449448 if (headerAsOverlay) {
450− color = '"white"';
449+ titleColor = 'overlayLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey")';
451450 } else if (hasSummary) {
452− color = 'summary.color';
451+ titleColor = 'summary.color';
453452 } else if (hasBackground) {
454− color = summaryColorWithBackground;
453+ titleColor = summaryColorWithBackground;
455454 } else {
456− color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
455+ titleColor = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
457456 }
458457
459458 var titleAnchors;
460459 var subtitleAnchors;
461460 var attributesAnchors;
462− if (hasMascot && (hasSubtitle || hasAttributes)) {
463− // Using row + column
464− titleAnchors = 'left: parent.left; right: parent.right';
465− subtitleAnchors = titleAnchors;
466− attributesAnchors = subtitleAnchors;
461+ var titleContainerAnchors;
462+ var titleRightAnchor;
463+
464+ var extraRightAnchor = '';
465+ var extraLeftAnchor = '';
466+ if (!touchdownOnArtShape) {
467+ extraRightAnchor = 'rightMargin: units.gu(1); \n';
468+ extraLeftAnchor = 'leftMargin: units.gu(1); \n';
469+ }
470+
471+ if (hasMascot) {
472+ titleContainerAnchors = 'verticalCenter: parent.verticalCenter; ';
473+ } else {
474+ titleContainerAnchors = 'right: parent.right; ';
475+ titleContainerAnchors += headerLeftAnchor;
476+ titleContainerAnchors += headerVerticalAnchors;
477+ if (!headerLeftAnchorHasMargin) {
478+ titleContainerAnchors += extraLeftAnchor;
479+ }
480+ }
481+ if (hasEmblem) {
482+ titleRightAnchor = 'right: emblemIcon.left; \n\
483+ rightMargin: emblemIcon.width > 0 ? units.gu(0.5) : 0; \n';
484+ } else {
485+ titleRightAnchor = 'right: parent.right; \n'
486+ titleRightAnchor += extraRightAnchor;
487+ }
488+
489+ if (hasTitleContainer) {
490+ // Using headerTitleContainer
491+ titleAnchors = titleRightAnchor;
492+ titleAnchors += 'left: parent.left; \n\
493+ top: parent.top;';
494+ subtitleAnchors = 'right: parent.right; \n\
495+ left: parent.left; \n';
496+ subtitleAnchors += extraRightAnchor;
497+ if (hasSubtitle) {
498+ attributesAnchors = subtitleAnchors + 'top: subtitleLabel.bottom;\n';
499+ subtitleAnchors += 'top: titleLabel.bottom;\n';
500+ } else {
501+ attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n';
502+ }
467503 } else if (hasMascot) {
468− // Using row + label
469− titleAnchors = 'verticalCenter: parent.verticalCenter;\n'
504+ // Using row + titleContainer
505+ titleAnchors = 'verticalCenter: parent.verticalCenter;\n';
470506 } else {
471507 if (headerAsOverlay) {
472508 // Using anchors to the overlay
473− titleAnchors = 'left: parent.left; \n\
474− leftMargin: units.gu(1); \n\
475− right: parent.right; \n\
476− rightMargin: units.gu(1); \n\
477− top: overlayLoader.top; \n\
478− topMargin: units.gu(1);\n';
509+ titleAnchors = titleRightAnchor;
510+ titleAnchors += 'left: parent.left; \n\
511+ leftMargin: units.gu(1); \n\
512+ top: overlayLoader.top; \n\
513+ topMargin: units.gu(1);\n';
479514 } else {
480515 // Using anchors to the mascot/parent
481− titleAnchors = "right: parent.right;\n";
482− titleAnchors += "rightMargin: units.gu(1);\n";
516+ titleAnchors = titleRightAnchor;
483517 titleAnchors += headerLeftAnchor;
484518 titleAnchors += headerVerticalAnchors;
485519 if (!headerLeftAnchorHasMargin) {
486− titleAnchors += 'leftMargin: units.gu(1);\n'
520+ titleAnchors += extraLeftAnchor;
487521 }
488522 }
489523 subtitleAnchors = 'left: titleLabel.left; \n\
490− leftMargin: titleLabel.leftMargin; \n\
491− right: titleLabel.right; \n\
492− rightMargin: titleLabel.rightMargin; \n\
493− top: titleLabel.bottom; \n\
494− topMargin: units.dp(2);\n';
524+ leftMargin: titleLabel.leftMargin; \n';
525+ subtitleAnchors += extraRightAnchor;
526+ if (hasEmblem) {
527+ // using container
528+ subtitleAnchors += 'right: parent.right; \n';
529+ } else {
530+ subtitleAnchors += 'right: titleLabel.right; \n';
531+ }
532+
495533 if (hasSubtitle) {
496− attributesAnchors = 'left: subtitleLabel.left; \n\
497− leftMargin: subtitleLabel.leftMargin; \n\
498− right: subtitleLabel.right; \n\
499− rightMargin: subtitleLabel.rightMargin; \n\
500− top: subtitleLabel.bottom; \n\
501− topMargin: units.dp(2);\n';
534+ attributesAnchors = subtitleAnchors + 'top: subtitleLabel.bottom;\n';
535+ subtitleAnchors += 'top: titleLabel.bottom;\n';
502536 } else {
503− attributesAnchors = subtitleAnchors;
537+ attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n';
504538 }
505539 }
506540
541+ // code for different elements
507542 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
508− var titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);
509− var subtitleCode = "";
543+ var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra);
544+ var subtitleCode;
545+ var attributesCode;
546+
547+ // code for the title container
548+ var containerCode = [];
549+ var containerHeight = 'titleLabel.height';
550+ containerCode.push(titleCode);
510551 if (hasSubtitle) {
511− subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);
552+ subtitleCode = kSubtitleLabelCode.arg(subtitleAnchors).arg(titleColor);
553+ containerCode.push(subtitleCode);
554+ containerHeight += ' + subtitleLabel.height';
555+ }
556+ if (hasEmblem) {
557+ containerCode.push(kEmblemIconCode.arg(extraRightAnchor).arg(titleColor));
558+ }
559+ if (hasAttributes) {
560+ attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(titleColor);
561+ containerCode.push(attributesCode);
562+ containerHeight += ' + attributesRow.height';
512563 }
513564
514− if (hasMascot && (hasSubtitle || hasAttributes)) {
515− // If using row + column wrap the code in the column
516− titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
517− if (hasSubtitle && hasAttributes) {
518− var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
519− titleSubtitleCode = kHeaderColumnCodeGenerator(titleCode, subtitleCode, attributesCode);
520− } else if (hasSubtitle) {
521− titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
522− } else if (hasAttributes) {
523− var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
524− titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(attributesCode);
525− }
565+ if (hasTitleContainer) {
566+ // use container
567+ titleSubtitleCode = kHeaderContainerCodeGenerator(titleContainerAnchors, containerHeight, containerCode);
526568 } else {
569+ // no container
527570 titleSubtitleCode = titleCode;
528571 if (hasSubtitle) {
529− titleSubtitleCode = titleSubtitleCode + subtitleCode;
572+ titleSubtitleCode += subtitleCode;
530573 }
531574 if (hasAttributes) {
532− var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
533− titleSubtitleCode = titleSubtitleCode + attributesCode;
575+ titleSubtitleCode += attributesCode;
534576 }
535577 }
536578 }
537579
538580 if (hasHeaderRow) {
539− if (mascotShapeCode != "") {
540− code += kHeaderRow3Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotShapeCode).arg(mascotCode).arg(titleSubtitleCode);
541− } else {
542− code += kHeaderRow2Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotCode).arg(titleSubtitleCode);
581+ var rowCode = [mascotCode, titleSubtitleCode];
582+ if (mascotShapeCode != '') {
583+ rowCode.unshift(mascotShapeCode);
543584 }
585+ code += kHeaderRowCodeGenerator(headerVerticalAnchors + headerLeftAnchor, rowCode)
544586 } else {
545587 code += mascotShapeCode + mascotCode + titleSubtitleCode;
546588 }
547589
548590 if (hasSummary) {
549591 var summaryTopAnchor;
550− if (isHorizontal && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
551− else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
552− else if (hasHeaderRow) summaryTopAnchor = "row.bottom";
553− else if (hasMascot) summaryTopAnchor = "mascotImage.bottom";
554− else if (hasAttributes) summaryTopAnchor = "attributesRow.bottom";
555− else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom";
556− else if (hasTitle) summaryTopAnchor = "titleLabel.bottom";
557− else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom";
558− else summaryTopAnchor = "parent.top";
559−
560− var color;
592+ if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
593+ else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
594+ else if (hasHeaderRow) summaryTopAnchor = 'row.bottom';
595+ else if (hasTitleContainer) summaryTopAnchor = 'headerTitleContainer.bottom';
596+ else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom';
597+ else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom';
598+ else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom';
599+ else if (hasTitle) summaryTopAnchor = 'titleLabel.bottom';
600+ else if (hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
601+ else summaryTopAnchor = 'parent.top';
602+
603+ var summaryColor;
561604 if (hasBackground) {
562− color = summaryColorWithBackground;
605+ summaryColor = summaryColorWithBackground;
563606 } else {
564− color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
607+ summaryColor = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
565608 }
566609
567610 var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0');
568611
569− code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);
612+ code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
613+ }
614+
615+ var touchdownAnchors;
616+ if (hasBackground) {
617+ touchdownAnchors = 'fill: backgroundLoader';
618+ } else if (touchdownOnArtShape) {
619+ touchdownAnchors = 'fill: artShapeHolder';
620+ } else {
621+ touchdownAnchors = 'fill: root'
570622 }
623+ code += kTouchdownCode.arg(touchdownAnchors);
571624
625+ var implicitHeight = 'implicitHeight: ';
572626 if (hasSummary) {
573− code += 'implicitHeight: summary.y + summary.height + (summary.text ? units.gu(1) : 0);\n';
627+ implicitHeight += 'summary.y + summary.height + (summary.text ? units.gu(1) : 0);\n';
574628 } else if (hasHeaderRow) {
575− code += 'implicitHeight: row.y + row.height + units.gu(1);\n';
629+ implicitHeight += 'row.y + row.height + units.gu(1);\n';
576630 } else if (hasMascot) {
577− code += 'implicitHeight: mascotImage.y + mascotImage.height;\n';
631+ implicitHeight += 'mascotImage.y + mascotImage.height;\n';
632+ } else if (hasTitleContainer) {
633+ implicitHeight += 'headerTitleContainer.y + headerTitleContainer.height + units.gu(1);\n';
578634 } else if (hasAttributes) {
579− code += 'implicitHeight: attributesRow.y + attributesRow.height + units.gu(1);\n';
635+ implicitHeight += 'attributesRow.y + attributesRow.height + units.gu(1);\n';
580636 } else if (hasSubtitle) {
581− code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
637+ implicitHeight += 'subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
582638 } else if (hasTitle) {
583− code += 'implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);\n';
639+ implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n';
584640 } else if (hasArt) {
585− code += 'implicitHeight: artShapeHolder.height;\n';
641+ implicitHeight += 'artShapeHolder.height;\n';
586642 }
587643 // Close the AbstractButton
588− code += '}\n';
644+ code += implicitHeight + '}\n';
589645
590646 return code;
591647}
592648
593649function createCardComponent(parent, template, components) {
594650 var imports = 'import QtQuick 2.2; \n\
595− import Ubuntu.Components 0.1; \n\
596− import Ubuntu.Thumbnailer 0.1;\n\
651+ import Ubuntu.Components 1.1; \n\
597652 import Dash 0.1;\n';
598653 var card = cardString(template, components);
599654 var code = imports + 'Component {\n' + card + '}\n';