@@ -138,10 +138,9 @@ var kOverlayLoaderCode = 'Loader { \n\
141−// %1 is used as anchors of row
141+// multiple row version of HeaderRowCode
142−// %2 is used as first child of the row
142+function kHeaderRowCodeGenerator() {
143−// %3 is used as second child of the row
143+var kHeaderRowCodeTemplate = 'Row { \n\
144−var kHeaderRow2Code = 'Row { \n\
145 id: row; \n\
144 id: row; \n\
146 objectName: "outerRow"; \n\
145 objectName: "outerRow"; \n\
147 property real margins: units.gu(1); \n\
146 property real margins: units.gu(1); \n\
@@ -149,58 +148,30 @@ var kHeaderRow2Code = 'Row { \n\
149 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
148 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
150 anchors { %1 } \n\
149 anchors { %1 } \n\
151 anchors.right: parent.right; \n\
150 anchors.right: parent.right; \n\
152− anchors.margins: margins;\n\
151+ anchors.margins: margins; \n\
152+ anchors.rightMargin: 0; \n\
153− data: [ %2\n\
153+ data: [ \n\
157+ var args = Array.prototype.slice.call(arguments);
158+ var code = kHeaderRowCodeTemplate.arg(args.shift()).arg(args.join(',\n'));
159−// %1 is used as anchors of row
162+// multiple item version of kHeaderContainerCode
160−// %2 is used as first child of the row
163+function kHeaderContainerCodeGenerator() {
161−// %3 is used as second child of the row
164+ var headerContainerCodeTemplate = 'Item { \n\
162−// %4 is used as third child of the row
165+ id: headerTitleContainer; \n\
163−var kHeaderRow3Code = 'Row { \n\
166+ anchors { %1 } \n\
164− id: row; \n\
167+ width: parent.width - x; \n\
165− objectName: "outerRow"; \n\
168+ implicitHeight: %2; \n\
166− property real margins: units.gu(1); \n\
167− spacing: margins; \n\
168− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
170− anchors.right: parent.right; \n\
171− anchors.margins: margins;\n\
172− data: [ %2\n\
169+ data: [ \n\
180−// %1 is used as first child of the column
181−// %2 is used as second child of the column
182−var kHeaderColumnCode = 'Column { \n\
183− anchors.verticalCenter: parent.verticalCenter; \n\
184− spacing: units.dp(2); \n\
185− width: parent.width - x;\n\
192−// multiple column version of kHeaderColumnCode.
193−function kHeaderColumnCodeGenerator() {
194− var headerColumnCodeTemplate = 'Column { \n\
195− anchors.verticalCenter: parent.verticalCenter; \n\
196− spacing: units.dp(2); \n\
197− width: parent.width - x;\n\
202 var args = Array.prototype.slice.call(arguments);
173 var args = Array.prototype.slice.call(arguments);
203− var code = headerColumnCodeTemplate.arg(args.join(',\n'));
174+ var code = headerContainerCodeTemplate.arg(args.shift()).arg(args.shift()).arg(args.join(',\n'));
204 return code;
175 return code;
@@ -224,7 +195,7 @@ var kMascotImageCode = 'Image { \n\
224 objectName: "mascotImage"; \n\
195 objectName: "mascotImage"; \n\
225 anchors { %1 } \n\
196 anchors { %1 } \n\
226 readonly property int maxSize: Math.max(width, height) * 4; \n\
197 readonly property int maxSize: Math.max(width, height) * 4; \n\
227− source: cardData && cardData["mascot"]; \n\
198+ source: cardData && cardData["mascot"] || ""; \n\
228 width: units.gu(6); \n\
199 width: units.gu(6); \n\
229 height: units.gu(5.625); \n\
200 height: units.gu(5.625); \n\
230 sourceSize { width: maxSize; height: maxSize } \n\
201 sourceSize { width: maxSize; height: maxSize } \n\
@@ -253,6 +224,22 @@ var kTitleLabelCode = 'Label { \n\
253 horizontalAlignment: root.headerAlignment; \n\
224 horizontalAlignment: root.headerAlignment; \n\
227+// %1 is used as extra anchors of emblemIcon
228+// %2 is used as color of emblemIcon
229+var kEmblemIconCode = 'Icon { \n\
231+ objectName: "emblemIcon"; \n\
233+ bottom: titleLabel.baseline; \n\
234+ right: parent.right; \n\
237+ source: cardData && cardData["emblem"] || ""; \n\
240+ height: source != "" ? titleLabel.font.pixelSize : 0; \n\
256// %1 is used as anchors of touchdown effect
243// %1 is used as anchors of touchdown effect
257var kTouchdownCode = 'UbuntuShape { \n\
244var kTouchdownCode = 'UbuntuShape { \n\
258 id: touchdown; \n\
245 id: touchdown; \n\
@@ -269,6 +256,7 @@ var kSubtitleLabelCode = 'Label { \n\
269 id: subtitleLabel; \n\
256 id: subtitleLabel; \n\
270 objectName: "subtitleLabel"; \n\
257 objectName: "subtitleLabel"; \n\
271 anchors { %1 } \n\
258 anchors { %1 } \n\
259+ anchors.topMargin: units.dp(2); \n\
272 elide: Text.ElideRight; \n\
260 elide: Text.ElideRight; \n\
273 fontSize: "small"; \n\
261 fontSize: "small"; \n\
274 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
262 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); \n\
@@ -280,12 +268,13 @@ var kSubtitleLabelCode = 'Label { \n\
282// %1 is used as anchors of attributesRow
270// %1 is used as anchors of attributesRow
271+// %2 is used as color of attributesRow
283var kAttributesRowCode = 'CardAttributes { \n\
272var kAttributesRowCode = 'CardAttributes { \n\
284 id: attributesRow; \n\
273 id: attributesRow; \n\
285 objectName: "attributesRow"; \n\
274 objectName: "attributesRow"; \n\
286 anchors { %1 } \n\
275 anchors { %1 } \n\
287 color: %2; \n\
276 color: %2; \n\
288− model: cardData["attributes"]; \n\
277+ model: cardData && cardData["attributes"]; \n\
291// %1 is used as top anchor of summary
280// %1 is used as top anchor of summary
@@ -335,10 +324,11 @@ function cardString(template, components) {
335 var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary);
324 var hasBackground = !isHorizontal && (template["card-background"] || components["background"] || artAndSummary);
336 var hasTitle = components["title"] || false;
325 var hasTitle = components["title"] || false;
337 var hasMascot = components["mascot"] || false;
326 var hasMascot = components["mascot"] || false;
327+ var hasEmblem = components["emblem"] && !(hasMascot && template["card-size"] === "small") || false;
338 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
328 var headerAsOverlay = hasArt && template && template["overlay"] === true && (hasTitle || hasMascot);
339 var hasSubtitle = hasTitle && components["subtitle"] || false;
329 var hasSubtitle = hasTitle && components["subtitle"] || false;
340 var hasHeaderRow = hasMascot && hasTitle;
330 var hasHeaderRow = hasMascot && hasTitle;
341− var hasAttributes = hasTitle && components["attributes"] || false;
331+ var hasAttributes = hasTitle && components["attributes"]["field"] || false;
343 if (hasBackground) {
333 if (hasBackground) {
344 code += kBackgroundLoaderCode;
334 code += kBackgroundLoaderCode;
@@ -349,9 +339,9 @@ function cardString(template, components) {
349 code += 'readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);\n';
339 code += 'readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);\n';
351 var widthCode, heightCode;
341 var widthCode, heightCode;
352− var anchors;
342+ var artAnchors;
353 if (isHorizontal) {
343 if (isHorizontal) {
354− anchors = 'left: parent.left';
344+ artAnchors = 'left: parent.left';
355 if (hasMascot || hasTitle) {
345 if (hasMascot || hasTitle) {
356 widthCode = 'height * artShape.aspect'
346 widthCode = 'height * artShape.aspect'
357 heightCode = 'headerHeight + 2 * units.gu(1)';
347 heightCode = 'headerHeight + 2 * units.gu(1)';
@@ -362,12 +352,12 @@ function cardString(template, components) {
362 heightCode = 'units.gu(7.625)';
352 heightCode = 'units.gu(7.625)';
365− anchors = 'horizontalCenter: parent.horizontalCenter;';
355+ artAnchors = 'horizontalCenter: parent.horizontalCenter;';
366 widthCode = 'root.width'
356 widthCode = 'root.width'
367 heightCode = 'width / artShape.aspect';
357 heightCode = 'width / artShape.aspect';
370− code += kArtShapeHolderCode.arg(anchors).arg(widthCode).arg(heightCode);
360+ code += kArtShapeHolderCode.arg(artAnchors).arg(widthCode).arg(heightCode);
372 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
362 code += 'readonly property size artShapeSize: Qt.size(-1, -1);\n'
@@ -404,6 +394,8 @@ function cardString(template, components) {
404 headerLeftAnchor = 'left: parent.left;\n';
394 headerLeftAnchor = 'left: parent.left;\n';
397+ var touchdownOnArtShape = !hasBackground && hasArt && !hasMascot && !hasSummary;
407 if (hasHeaderRow) {
399 if (hasHeaderRow) {
408 code += 'readonly property int headerHeight: row.height;\n'
400 code += 'readonly property int headerHeight: row.height;\n'
409 } else if (hasMascot) {
401 } else if (hasMascot) {
@@ -424,191 +416,239 @@ function cardString(template, components) {
424 code += 'readonly property int headerHeight: 0;\n'
416 code += 'readonly property int headerHeight: 0;\n'
427− var mascotShapeCode = "";
419+ var mascotShapeCode = '';
428− var mascotCode = "";
420+ var mascotCode = '';
429 if (hasMascot) {
421 if (hasMascot) {
430 var useMascotShape = !hasBackground && !headerAsOverlay;
422 var useMascotShape = !hasBackground && !headerAsOverlay;
431− var anchors = "";
423+ var mascotAnchors = '';
432 if (!hasHeaderRow) {
424 if (!hasHeaderRow) {
433− anchors += headerLeftAnchor;
425+ mascotAnchors += headerLeftAnchor;
434− anchors += headerVerticalAnchors;
426+ mascotAnchors += headerVerticalAnchors;
435 if (!headerLeftAnchorHasMargin) {
427 if (!headerLeftAnchorHasMargin) {
436− anchors += 'leftMargin: units.gu(1);\n'
428+ mascotAnchors += 'leftMargin: units.gu(1);\n'
439− anchors = "verticalCenter: parent.verticalCenter;"
431+ mascotAnchors = 'verticalCenter: parent.verticalCenter;'
442 if (useMascotShape) {
434 if (useMascotShape) {
443− mascotShapeCode = kMascotShapeLoaderCode.arg(anchors);
435+ mascotShapeCode = kMascotShapeLoaderCode.arg(mascotAnchors);
446 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
438 var mascotImageVisible = useMascotShape ? 'false' : 'showHeader';
447− mascotCode = kMascotImageCode.arg(anchors).arg(mascotImageVisible);
439+ mascotCode = kMascotImageCode.arg(mascotAnchors).arg(mascotImageVisible);
450 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")';
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")';
444+ var hasTitleContainer = hasTitle && (hasEmblem || (hasMascot && (hasSubtitle || hasAttributes)));
452− var titleSubtitleCode = "";
445+ var titleSubtitleCode = '';
453 if (hasTitle) {
446 if (hasTitle) {
454− var color;
447+ var titleColor;
455 if (headerAsOverlay) {
448 if (headerAsOverlay) {
456− color = 'overlayLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey")';
449+ titleColor = 'overlayLoader.item.luminance < (root.scopeStyle ? root.scopeStyle.threshold : 0.7) ? (root.scopeStyle ? root.scopeStyle.light : "white") : (root.scopeStyle ? root.scopeStyle.dark : "grey")';
457 } else if (hasSummary) {
450 } else if (hasSummary) {
458− color = 'summary.color';
451+ titleColor = 'summary.color';
459 } else if (hasBackground) {
452 } else if (hasBackground) {
460− color = summaryColorWithBackground;
453+ titleColor = summaryColorWithBackground;
462− color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
455+ titleColor = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
465 var titleAnchors;
458 var titleAnchors;
466 var subtitleAnchors;
459 var subtitleAnchors;
467 var attributesAnchors;
460 var attributesAnchors;
461+ var titleContainerAnchors;
462+ var titleRightAnchor;
464+ var extraRightAnchor = '';
465+ var extraLeftAnchor = '';
466+ if (!touchdownOnArtShape) {
467+ extraRightAnchor = 'rightMargin: units.gu(1); \n';
468+ extraLeftAnchor = 'leftMargin: units.gu(1); \n';
468− if (hasMascot && (hasSubtitle || hasAttributes)) {
471+ if (hasMascot) {
469− // Using row + column
472+ titleContainerAnchors = 'verticalCenter: parent.verticalCenter; ';
474+ titleContainerAnchors = 'right: parent.right; ';
475+ titleContainerAnchors += headerLeftAnchor;
476+ titleContainerAnchors += headerVerticalAnchors;
477+ if (!headerLeftAnchorHasMargin) {
478+ titleContainerAnchors += extraLeftAnchor;
482+ titleRightAnchor = 'right: emblemIcon.left; \n\
483+ rightMargin: emblemIcon.width > 0 ? units.gu(0.5) : 0; \n';
485+ titleRightAnchor = 'right: parent.right; \n'
486+ titleRightAnchor += extraRightAnchor;
489+ if (hasTitleContainer) {
490+ // Using headerTitleContainer
491+ titleAnchors = titleRightAnchor;
470− titleAnchors = 'left: parent.left; right: parent.right';
492+ titleAnchors += 'left: parent.left; \n\
494+ subtitleAnchors = 'right: parent.right; \n\
495+ left: parent.left; \n';
471− subtitleAnchors = titleAnchors;
496+ subtitleAnchors += extraRightAnchor;
498+ attributesAnchors = subtitleAnchors + 'top: subtitleLabel.bottom;\n';
499+ subtitleAnchors += 'top: titleLabel.bottom;\n';
472− attributesAnchors = subtitleAnchors;
501+ attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n';
473 } else if (hasMascot) {
503 } else if (hasMascot) {
474− // Using row + label
504+ // Using row + titleContainer
475− titleAnchors = 'verticalCenter: parent.verticalCenter;\n'
505+ titleAnchors = 'verticalCenter: parent.verticalCenter;\n';
477 if (headerAsOverlay) {
507 if (headerAsOverlay) {
478 // Using anchors to the overlay
508 // Using anchors to the overlay
509+ titleAnchors = titleRightAnchor;
479− titleAnchors = 'left: parent.left; \n\
510+ titleAnchors += 'left: parent.left; \n\
480− leftMargin: units.gu(1); \n\
511+ leftMargin: units.gu(1); \n\
481− right: parent.right; \n\
482− rightMargin: units.gu(1); \n\
483− top: overlayLoader.top; \n\
512+ top: overlayLoader.top; \n\
484− topMargin: units.gu(1);\n';
513+ topMargin: units.gu(1);\n';
486 // Using anchors to the mascot/parent
515 // Using anchors to the mascot/parent
487− titleAnchors = "right: parent.right;\n";
516+ titleAnchors = titleRightAnchor;
488− titleAnchors += "rightMargin: units.gu(1);\n";
489 titleAnchors += headerLeftAnchor;
517 titleAnchors += headerLeftAnchor;
490 titleAnchors += headerVerticalAnchors;
518 titleAnchors += headerVerticalAnchors;
491 if (!headerLeftAnchorHasMargin) {
519 if (!headerLeftAnchorHasMargin) {
492− titleAnchors += 'leftMargin: units.gu(1);\n'
520+ titleAnchors += extraLeftAnchor;
495 subtitleAnchors = 'left: titleLabel.left; \n\
523 subtitleAnchors = 'left: titleLabel.left; \n\
496− leftMargin: titleLabel.leftMargin; \n\
524+ leftMargin: titleLabel.leftMargin; \n';
497− right: titleLabel.right; \n\
525+ subtitleAnchors += extraRightAnchor;
498− rightMargin: titleLabel.rightMargin; \n\
526+ if (hasEmblem) {
499− top: titleLabel.bottom; \n\
527+ // using container
500− topMargin: units.dp(2);\n';
528+ subtitleAnchors += 'right: parent.right; \n';
530+ subtitleAnchors += 'right: titleLabel.right; \n';
501 if (hasSubtitle) {
533 if (hasSubtitle) {
502− attributesAnchors = 'left: subtitleLabel.left; \n\
534+ attributesAnchors = subtitleAnchors + 'top: subtitleLabel.bottom;\n';
503− leftMargin: subtitleLabel.leftMargin; \n\
535+ subtitleAnchors += 'top: titleLabel.bottom;\n';
504− right: subtitleLabel.right; \n\
505− rightMargin: subtitleLabel.rightMargin; \n\
506− top: subtitleLabel.bottom; \n\
507− topMargin: units.dp(2);\n';
509− attributesAnchors = subtitleAnchors;
537+ attributesAnchors = subtitleAnchors + 'top: titleLabel.bottom;\n';
541+ // code for different elements
513 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
542 var titleLabelVisibleExtra = (headerAsOverlay ? '&& overlayLoader.active': '');
514− var titleCode = kTitleLabelCode.arg(titleAnchors).arg(color).arg(titleLabelVisibleExtra);
543+ var titleCode = kTitleLabelCode.arg(titleAnchors).arg(titleColor).arg(titleLabelVisibleExtra);
515− var subtitleCode = "";
544+ var subtitleCode;
547+ // code for the title container
548+ var containerCode = [];
549+ var containerHeight = 'titleLabel.height';
550+ containerCode.push(titleCode);
516 if (hasSubtitle) {
551 if (hasSubtitle) {
517− subtitleCode += kSubtitleLabelCode.arg(subtitleAnchors).arg(color);
552+ subtitleCode = kSubtitleLabelCode.arg(subtitleAnchors).arg(titleColor);
553+ containerCode.push(subtitleCode);
554+ containerHeight += ' + subtitleLabel.height';
557+ containerCode.push(kEmblemIconCode.arg(extraRightAnchor).arg(titleColor));
559+ if (hasAttributes) {
560+ attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(titleColor);
561+ containerCode.push(attributesCode);
562+ containerHeight += ' + attributesRow.height';
520− if (hasMascot && (hasSubtitle || hasAttributes)) {
565+ if (hasTitleContainer) {
521− // If using row + column wrap the code in the column
566+ // use container
522− titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
567+ titleSubtitleCode = kHeaderContainerCodeGenerator(titleContainerAnchors, containerHeight, containerCode);
523− if (hasSubtitle && hasAttributes) {
524− var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
525− titleSubtitleCode = kHeaderColumnCodeGenerator(titleCode, subtitleCode, attributesCode);
526− } else if (hasSubtitle) {
527− titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
528− } else if (hasAttributes) {
529− var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
530− titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(attributesCode);
533 titleSubtitleCode = titleCode;
570 titleSubtitleCode = titleCode;
534 if (hasSubtitle) {
571 if (hasSubtitle) {
535− titleSubtitleCode = titleSubtitleCode + subtitleCode;
572+ titleSubtitleCode += subtitleCode;
537 if (hasAttributes) {
574 if (hasAttributes) {
538− var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
539− titleSubtitleCode = titleSubtitleCode + attributesCode;
575+ titleSubtitleCode += attributesCode;
544 if (hasHeaderRow) {
580 if (hasHeaderRow) {
581+ var rowCode = [mascotCode, titleSubtitleCode];
545− if (mascotShapeCode != "") {
582+ if (mascotShapeCode != '') {
546− code += kHeaderRow3Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotShapeCode).arg(mascotCode).arg(titleSubtitleCode);
583+ rowCode.unshift(mascotShapeCode);
548− code += kHeaderRow2Code.arg(headerVerticalAnchors + headerLeftAnchor).arg(mascotCode).arg(titleSubtitleCode);
585+ code += kHeaderRowCodeGenerator(headerVerticalAnchors + headerLeftAnchor, rowCode)
551 code += mascotShapeCode + mascotCode + titleSubtitleCode;
587 code += mascotShapeCode + mascotCode + titleSubtitleCode;
554 if (hasSummary) {
590 if (hasSummary) {
555 var summaryTopAnchor;
591 var summaryTopAnchor;
556− if (isHorizontal && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
592+ if (isHorizontal && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
557− else if (headerAsOverlay && hasArt) summaryTopAnchor = "artShapeHolder.bottom";
593+ else if (headerAsOverlay && hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
558− else if (hasHeaderRow) summaryTopAnchor = "row.bottom";
594+ else if (hasHeaderRow) summaryTopAnchor = 'row.bottom';
595+ else if (hasTitleContainer) summaryTopAnchor = 'headerTitleContainer.bottom';
559− else if (hasMascot) summaryTopAnchor = "mascotImage.bottom";
596+ else if (hasMascot) summaryTopAnchor = 'mascotImage.bottom';
560− else if (hasAttributes) summaryTopAnchor = "attributesRow.bottom";
597+ else if (hasAttributes) summaryTopAnchor = 'attributesRow.bottom';
561− else if (hasSubtitle) summaryTopAnchor = "subtitleLabel.bottom";
598+ else if (hasSubtitle) summaryTopAnchor = 'subtitleLabel.bottom';
562− else if (hasTitle) summaryTopAnchor = "titleLabel.bottom";
599+ else if (hasTitle) summaryTopAnchor = 'titleLabel.bottom';
563− else if (hasArt) summaryTopAnchor = "artShapeHolder.bottom";
600+ else if (hasArt) summaryTopAnchor = 'artShapeHolder.bottom';
564− else summaryTopAnchor = "parent.top";
601+ else summaryTopAnchor = 'parent.top';
566− var color;
603+ var summaryColor;
567 if (hasBackground) {
604 if (hasBackground) {
568− color = summaryColorWithBackground;
605+ summaryColor = summaryColorWithBackground;
570− color = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
607+ summaryColor = 'root.scopeStyle ? root.scopeStyle.foreground : "grey"';
573 var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0');
610 var summaryTopMargin = (hasMascot || hasSubtitle || hasAttributes ? 'anchors.margins' : '0');
575− code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(color);
612+ code += kSummaryLabelCode.arg(summaryTopAnchor).arg(summaryTopMargin).arg(summaryColor);
578 var touchdownAnchors;
615 var touchdownAnchors;
579 if (hasBackground) {
616 if (hasBackground) {
580 touchdownAnchors = 'fill: backgroundLoader';
617 touchdownAnchors = 'fill: backgroundLoader';
581− } else if (hasArt && !hasMascot && !hasSummary) {
618+ } else if (touchdownOnArtShape) {
582 touchdownAnchors = 'fill: artShapeHolder';
619 touchdownAnchors = 'fill: artShapeHolder';
584 touchdownAnchors = 'fill: root'
621 touchdownAnchors = 'fill: root'
586 code += kTouchdownCode.arg(touchdownAnchors);
623 code += kTouchdownCode.arg(touchdownAnchors);
625+ var implicitHeight = 'implicitHeight: ';
588 if (hasSummary) {
626 if (hasSummary) {
589− 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';
590 } else if (hasHeaderRow) {
628 } else if (hasHeaderRow) {
591− code += 'implicitHeight: row.y + row.height + units.gu(1);\n';
629+ implicitHeight += 'row.y + row.height + units.gu(1);\n';
592 } else if (hasMascot) {
630 } else if (hasMascot) {
593− 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';
594 } else if (hasAttributes) {
634 } else if (hasAttributes) {
595− code += 'implicitHeight: attributesRow.y + attributesRow.height + units.gu(1);\n';
635+ implicitHeight += 'attributesRow.y + attributesRow.height + units.gu(1);\n';
596 } else if (hasSubtitle) {
636 } else if (hasSubtitle) {
597− code += 'implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
637+ implicitHeight += 'subtitleLabel.y + subtitleLabel.height + units.gu(1);\n';
598 } else if (hasTitle) {
638 } else if (hasTitle) {
599− code += 'implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);\n';
639+ implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n';
600 } else if (hasArt) {
640 } else if (hasArt) {
601− code += 'implicitHeight: artShapeHolder.height;\n';
641+ implicitHeight += 'artShapeHolder.height;\n';
603 // Close the AbstractButton
643 // Close the AbstractButton
604− code += '}\n';
644+ code += implicitHeight + '}\n';
606 return code;
646 return code;
609function createCardComponent(parent, template, components) {
649function createCardComponent(parent, template, components) {
610 var imports = 'import QtQuick 2.2; \n\
650 var imports = 'import QtQuick 2.2; \n\
611− import Ubuntu.Components 0.1; \n\
651+ import Ubuntu.Components 1.1; \n\
612 import Dash 0.1;\n';
652 import Dash 0.1;\n';
613 var card = cardString(template, components);
653 var card = cardString(template, components);
614 var code = imports + 'Component {\n' + card + '}\n';
654 var code = imports + 'Component {\n' + card + '}\n';