@@ -1,140 +1,140 @@
1−AbstractButton {
1+AbstractButton {
3− property var template;
3+ property var template;
4− property var components;
4+ property var components;
5− property var cardData;
5+ property var cardData;
6− property var artShapeBorderSource: undefined;
6+ property var artShapeBorderSource: undefined;
7− property real fontScale: 1.0;
7+ property real fontScale: 1.0;
8− property var scopeStyle: null;
8+ property var scopeStyle: null;
9− property int headerAlignment: Text.AlignLeft;
9+ property int headerAlignment: Text.AlignLeft;
10− property int fixedHeaderHeight: -1;
10+ property int fixedHeaderHeight: -1;
11− property size fixedArtShapeSize: Qt.size(-1, -1);
11+ property size fixedArtShapeSize: Qt.size(-1, -1);
12− readonly property string title: cardData && cardData["title"] || "";
12+ readonly property string title: cardData && cardData["title"] || "";
13− property bool asynchronous: true;
13+ property bool asynchronous: true;
14− property bool showHeader: true;
14+ property bool showHeader: true;
15− implicitWidth: childrenRect.width;
15+ implicitWidth: childrenRect.width;
17− id: backgroundLoader;
17+ id: backgroundLoader;
18− objectName: "backgroundLoader";
18+ objectName: "backgroundLoader";
19− anchors.fill: parent;
19+ anchors.fill: parent;
20− asynchronous: root.asynchronous;
20+ asynchronous: root.asynchronous;
21− visible: status == Loader.Ready;
21+ visible: status == Loader.Ready;
22− sourceComponent: UbuntuShape {
22+ sourceComponent: UbuntuShape {
23− objectName: "background";
23+ objectName: "background";
24− radius: "medium";
24+ radius: "medium";
25− color: getColor(0) || "white";
25+ color: getColor(0) || "white";
26− gradientColor: getColor(1) || color;
26+ gradientColor: getColor(1) || color;
27− anchors.fill: parent;
27+ anchors.fill: parent;
28− image: backgroundImage.source ? backgroundImage : null;
28+ image: backgroundImage.source ? backgroundImage : null;
29− property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
29+ property real luminance: 0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b;
30− property Image backgroundImage: Image {
30+ property Image backgroundImage: Image {
31− objectName: "backgroundImage";
31+ objectName: "backgroundImage";
32− source: {
32+ source: {
33− if (cardData && typeof cardData["background"] === "string") return cardData["background"];
33+ if (cardData && typeof cardData["background"] === "string") return cardData["background"];
34− else if (template && typeof template["card-background"] === "string") return template["card-background"];
34+ else if (template && typeof template["card-background"] === "string") return template["card-background"];
35− else return "";
35+ else return "";
38− function getColor(index) {
38+ function getColor(index) {
39− if (cardData && typeof cardData["background"] === "object"
39+ if (cardData && typeof cardData["background"] === "object"
40− && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
40+ && (cardData["background"]["type"] === "color" || cardData["background"]["type"] === "gradient")) {
41− return cardData["background"]["elements"][index];
41+ return cardData["background"]["elements"][index];
42− } else if (template && typeof template["card-background"] === "object"
42+ } else if (template && typeof template["card-background"] === "object"
43− && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
43+ && (template["card-background"]["type"] === "color" || template["card-background"]["type"] === "gradient")) {
44− return template["card-background"]["elements"][index];
44+ return template["card-background"]["elements"][index];
45− } else return undefined;
45+ } else return undefined;
49readonly property size artShapeSize: Qt.size(-1, -1);
49readonly property size artShapeSize: Qt.size(-1, -1);
50readonly property int headerHeight: row.height;
50readonly property int headerHeight: row.height;
53− objectName: "outerRow";
53+ objectName: "outerRow";
54− property real margins: units.gu(1);
54+ property real margins: units.gu(1);
55− spacing: margins;
55+ spacing: margins;
56− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
56+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
57− anchors { top: parent.top;
57+ anchors { top: parent.top;
58 topMargin: units.gu(1);
58 topMargin: units.gu(1);
59 left: parent.left;
59 left: parent.left;
61− anchors.right: parent.right;
61+ anchors.right: parent.right;
62 anchors.margins: margins;
62 anchors.margins: margins;
63 anchors.rightMargin: 0;
63 anchors.rightMargin: 0;
66− id: mascotImage;
66+ id: mascotImage;
67− objectName: "mascotImage";
67+ objectName: "mascotImage";
68− anchors { verticalCenter: parent.verticalCenter; }
68+ anchors { verticalCenter: parent.verticalCenter; }
69− readonly property int maxSize: Math.max(width, height) * 4;
69+ readonly property int maxSize: Math.max(width, height) * 4;
70− source: cardData && cardData["mascot"] || "";
70+ source: cardData && cardData["mascot"] || "";
71− width: units.gu(6);
71+ width: units.gu(6);
72− height: units.gu(5.625);
72+ height: units.gu(5.625);
73− sourceSize { width: maxSize; height: maxSize }
73+ sourceSize { width: maxSize; height: maxSize }
74− fillMode: Image.PreserveAspectCrop;
74+ fillMode: Image.PreserveAspectCrop;
75− horizontalAlignment: Image.AlignHCenter;
75+ horizontalAlignment: Image.AlignHCenter;
76− verticalAlignment: Image.AlignVCenter;
76+ verticalAlignment: Image.AlignVCenter;
77− visible: showHeader;
77+ visible: showHeader;
81− id: headerTitleContainer;
81+ id: headerTitleContainer;
82− anchors { verticalCenter: parent.verticalCenter; }
82+ anchors { verticalCenter: parent.verticalCenter; }
83− width: parent.width - x;
83+ width: parent.width - x;
84− implicitHeight: titleLabel.height + subtitleLabel.height + attributesRow.height;
84+ implicitHeight: titleLabel.height + subtitleLabel.height + attributesRow.height;
87− id: titleLabel;
87+ id: titleLabel;
88− objectName: "titleLabel";
88+ objectName: "titleLabel";
89− anchors { right: parent.right;
89+ anchors { right: parent.right;
90− rightMargin: units.gu(1);
90+ rightMargin: units.gu(1);
91− left: parent.left;
91+ left: parent.left;
92− top: parent.top; }
92+ top: parent.top; }
93− elide: Text.ElideRight;
93+ elide: Text.ElideRight;
94− fontSize: "small";
94+ fontSize: "small";
95− wrapMode: Text.Wrap;
95+ wrapMode: Text.Wrap;
96− maximumLineCount: 2;
96+ maximumLineCount: 2;
97− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
97+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
98− color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
98+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
99− visible: showHeader ;
99+ visible: showHeader ;
100− text: root.title;
100+ text: root.title;
101− font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
101+ font.weight: components && components["subtitle"] ? Font.DemiBold : Font.Normal;
102− horizontalAlignment: root.headerAlignment;
102+ horizontalAlignment: root.headerAlignment;
105− id: subtitleLabel;
105+ id: subtitleLabel;
106− objectName: "subtitleLabel";
106+ objectName: "subtitleLabel";
107− anchors { right: parent.right;
107+ anchors { right: parent.right;
108− left: parent.left;
108+ left: parent.left;
109− rightMargin: units.gu(1);
109+ rightMargin: units.gu(1);
110− top: titleLabel.bottom;
110+ top: titleLabel.bottom;
112− anchors.topMargin: units.dp(2);
112+ anchors.topMargin: units.dp(2);
113− elide: Text.ElideRight;
113+ elide: Text.ElideRight;
114− fontSize: "small";
114+ fontSize: "small";
115− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
115+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
116− color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
116+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
117− visible: titleLabel.visible && titleLabel.text;
117+ visible: titleLabel.visible && titleLabel.text;
118− text: cardData && cardData["subtitle"] || "";
118+ text: cardData && cardData["subtitle"] || "";
119− font.weight: Font.Light;
119+ font.weight: Font.Light;
120− horizontalAlignment: root.headerAlignment;
120+ horizontalAlignment: root.headerAlignment;
122−,CardAttributes {
122+,CardAttributes {
123− id: attributesRow;
123+ id: attributesRow;
124− objectName: "attributesRow";
124+ objectName: "attributesRow";
125 anchors { right: parent.right;
125 anchors { right: parent.right;
126 left: parent.left;
126 left: parent.left;
127 rightMargin: units.gu(1);
127 rightMargin: units.gu(1);
128− top: subtitleLabel.bottom;
128+ top: subtitleLabel.bottom;
130− color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
130+ color: backgroundLoader.active && backgroundLoader.item && backgroundLoader.item.luminance < 0.7 ? "white" : (root.scopeStyle ? root.scopeStyle.foreground : "grey");
131− model: cardData && cardData["attributes"];
131+ model: cardData && cardData["attributes"];
139UbuntuShape {
139UbuntuShape {
140 id: touchdown;
140 id: touchdown;