on xenial help sign in
Add color.

Fix rightMargin.

commitc5dd30852eed24db2fa67a345b4d59283d03a33a authorYing-Chun Liu <paul.liu@canonical.com> dateThu 24 Jul 2014, 00:09 (12 years ago) parent86323ab
2 files changed+12−4
plugins/Dash/CardAttributes.qml+3 plugins/Dash/CardCreator.js+9−4
plugins/Dash/CardAttributes.qml+3
@@ -27,6 +27,8 @@ GridLayout {
2727 }
2828 columns: 2 + repeater.count % 2
2929 property alias model: repeater.model
30+ property var color
31+
3032 Repeater {
3133 id: repeater
3234 delegate: Row {
@@ -56,6 +58,7 @@ GridLayout {
5658 font.weight: "style" in modelData && modelData["style"] == "highlighted" ? Font.DemiBold : Font.Light
5759 fontSize: "small"
5860 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale)
61+ color: grid.color
5962 }
6063 }
6164 }
plugins/Dash/CardCreator.js+9−4
@@ -278,6 +278,7 @@ var kAttributesRowCode = 'CardAttributes { \n\
278278 id: attributesRow; \n\
279279 objectName: "attributesRow"; \n\
280280 anchors { %1 } \n\
281+ color: %2; \n\
281282 model: cardData["attributes"] \n\
282283 }\n';
283284
@@ -472,11 +473,13 @@ function cardString(template, components) {
472473 titleAnchors = 'left: parent.left; \n\
473474 leftMargin: units.gu(1); \n\
474475 right: parent.right; \n\
476+ rightMargin: units.gu(1); \n\
475477 top: overlayLoader.top; \n\
476478 topMargin: units.gu(1);\n';
477479 } else {
478480 // Using anchors to the mascot/parent
479− titleAnchors = "right: parent.right;";
481+ titleAnchors = "right: parent.right;\n";
482+ titleAnchors += "rightMargin: units.gu(1);\n";
480483 titleAnchors += headerLeftAnchor;
481484 titleAnchors += headerVerticalAnchors;
482485 if (!headerLeftAnchorHasMargin) {
@@ -486,12 +489,14 @@ function cardString(template, components) {
486489 subtitleAnchors = 'left: titleLabel.left; \n\
487490 leftMargin: titleLabel.leftMargin; \n\
488491 right: titleLabel.right; \n\
492+ rightMargin: titleLabel.rightMargin; \n\
489493 top: titleLabel.bottom; \n\
490494 topMargin: units.dp(2);\n';
491495 if (hasSubtitle) {
492496 attributesAnchors = 'left: subtitleLabel.left; \n\
493497 leftMargin: subtitleLabel.leftMargin; \n\
494498 right: subtitleLabel.right; \n\
499+ rightMargin: subtitleLabel.rightMargin; \n\
495500 top: subtitleLabel.bottom; \n\
496501 topMargin: units.dp(2);\n';
497502 } else {
@@ -510,12 +515,12 @@ function cardString(template, components) {
510515 // If using row + column wrap the code in the column
511516 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
512517 if (hasSubtitle && hasAttributes) {
513− var attributesCode = kAttributesRowCode.arg(attributesAnchors);
518+ var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
514519 titleSubtitleCode = kHeaderColumnCodeGenerator(titleCode, subtitleCode, attributesCode);
515520 } else if (hasSubtitle) {
516521 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(subtitleCode);
517522 } else if (hasAttributes) {
518− var attributesCode = kAttributesRowCode.arg(attributesAnchors);
523+ var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
519524 titleSubtitleCode = kHeaderColumnCode.arg(titleCode).arg(attributesCode);
520525 }
521526 } else {
@@ -524,7 +529,7 @@ function cardString(template, components) {
524529 titleSubtitleCode = titleSubtitleCode + subtitleCode;
525530 }
526531 if (hasAttributes) {
527− var attributesCode = kAttributesRowCode.arg(attributesAnchors);
532+ var attributesCode = kAttributesRowCode.arg(attributesAnchors).arg(color);
528533 titleSubtitleCode = titleSubtitleCode + attributesCode;
529534 }
530535 }