on xenial help sign in
Fix results
commit68a114e26727696fee6f0f3a54b47909b96848db authorYing-Chun Liu <paul.liu@canonical.com> dateThu 9 Oct 2014, 21:57 (12 years ago) parentd21a1cc
7 files changed+307−307
tests/plugins/Dash/cardcreator/1.res+25−25 tests/plugins/Dash/cardcreator/2.res+36−36 tests/plugins/Dash/cardcreator/3.res+33−33 tests/plugins/Dash/cardcreator/4.res+87−87 tests/plugins/Dash/cardcreator/5.res+40−40 tests/plugins/Dash/cardcreator/6.res+45−46 tests/plugins/Dash/cardcreator/7.res+41−40
tests/plugins/Dash/cardcreator/1.res+25−25
@@ -33,21 +33,21 @@ Item {
3333 visible: image.status == Image.Ready;
3434 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
3535 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
36− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
36+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
3737 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
3838 function updateWidthHeightBindings() {
3939 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
4040 width = root.fixedArtShapeSize.width;
4141 height = root.fixedArtShapeSize.height;
4242 } else {
43− width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
44− height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
43+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
44+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
4545 }
4646 }
47− image: CroppedImageMinimumSourceSize {
47+ image: CroppedImageMinimumSourceSize {
4848 objectName: "artImage";
49− property bool doLoadSource: !NetworkingStatus.limitedBandwith;
50− source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
49+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
50+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
5151 cache: true;
5252 asynchronous: root.asynchronous;
5353 visible: false;
@@ -61,34 +61,34 @@ readonly property int headerHeight: titleLabel.height;
6161Label {
6262 id: titleLabel;
6363 objectName: "titleLabel";
64− anchors { right: parent.right;
65−left: parent.left;
66−top: artShapeHolder.bottom;
67− topMargin: units.gu(1);
68− }
64+ anchors { right: parent.right;
65+ left: parent.left;
66+ top: artShapeHolder.bottom;
67+ topMargin: units.gu(1);
68+ }
6969 elide: Text.ElideRight;
7070 fontSize: "small";
7171 wrapMode: Text.Wrap;
7272 maximumLineCount: 2;
7373 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
74− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
74+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
7575 visible: showHeader ;
7676 text: root.title;
7777 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
7878 horizontalAlignment: root.titleAlignment;
7979 }
80−UbuntuShape {
81− id: touchdown;
82− objectName: "touchdown";
83− anchors { fill: artShapeHolder }
84− visible: {
85− if (root.template && root.template["non-interactive"]) {
86− return false;
87− }
88− return root.pressed;
89− }
90− radius: "medium";
91− borderSource: "radius_pressed.sci"
92− }
80+UbuntuShape {
81+ id: touchdown;
82+ objectName: "touchdown";
83+ anchors { fill: artShapeHolder }
84+ visible: {
85+ if (root.template && root.template["non-interactive"]) {
86+ return false;
87+ }
88+ return root.pressed;
89+ }
90+ radius: "medium";
91+ borderSource: "radius_pressed.sci"
92+}
9393implicitHeight: titleLabel.y + titleLabel.height + units.gu(1);
9494}
tests/plugins/Dash/cardcreator/2.res+36−36
@@ -55,24 +55,24 @@ Row {
5555 spacing: margins;
5656 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
5757 anchors { top: parent.top;
58− topMargin: units.gu(1);
59−left: parent.left;
60− }
58+ topMargin: units.gu(1);
59+ left: parent.left;
60+ }
6161 anchors.right: parent.right;
62− anchors.margins: margins;
63− anchors.rightMargin: 0;
64− data: [
65− CroppedImageMinimumSourceSize {
62+ anchors.margins: margins;
63+ anchors.rightMargin: 0;
64+ data: [
65+CroppedImageMinimumSourceSize {
6666 id: mascotImage;
6767 objectName: "mascotImage";
6868 anchors { verticalCenter: parent.verticalCenter; }
69− property bool doLoadSource: !NetworkingStatus.limitedBandwith;
70− source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
69+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
70+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
7171 width: units.gu(6);
7272 height: units.gu(5.625);
7373 horizontalAlignment: Image.AlignHCenter;
7474 verticalAlignment: Image.AlignVCenter;
75− visible: showHeader && resized;
75+ visible: showHeader && resized;
7676 }
7777,Item {
7878 id: headerTitleContainer;
@@ -83,56 +83,56 @@ left: parent.left;
8383 Label {
8484 id: titleLabel;
8585 objectName: "titleLabel";
86− anchors { right: parent.right;
87−rightMargin: units.gu(1);
88−left: parent.left;
89− top: parent.top; }
86+ anchors { right: parent.right;
87+ rightMargin: units.gu(1);
88+ left: parent.left;
89+ top: parent.top; }
9090 elide: Text.ElideRight;
9191 fontSize: "small";
9292 wrapMode: Text.Wrap;
9393 maximumLineCount: 2;
9494 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
95− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
95+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
9696 visible: showHeader ;
9797 text: root.title;
9898 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
9999 horizontalAlignment: root.titleAlignment;
100100 }
101−,Label {
101+ ,Label {
102102 id: subtitleLabel;
103103 objectName: "subtitleLabel";
104− anchors { right: parent.right;
105− left: parent.left;
106−rightMargin: units.gu(1);
107−top: titleLabel.bottom;
108− }
104+ anchors { right: parent.right;
105+ left: parent.left;
106+ rightMargin: units.gu(1);
107+ top: titleLabel.bottom;
108+ }
109109 anchors.topMargin: units.dp(2);
110110 elide: Text.ElideRight;
111111 fontSize: "x-small";
112112 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
113− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
113+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
114114 visible: titleLabel.visible && titleLabel.text;
115115 text: cardData && cardData["subtitle"] || "";
116116 font.weight: Font.Light;
117117 }
118118
119− ]
119+ ]
120120 }
121121
122122 ]
123123 }
124−UbuntuShape {
125− id: touchdown;
126− objectName: "touchdown";
127− anchors { fill: backgroundLoader }
128− visible: {
129− if (root.template && root.template["non-interactive"]) {
130− return false;
131− }
132− return root.pressed;
133− }
134− radius: "medium";
135− borderSource: "radius_pressed.sci"
136− }
124+UbuntuShape {
125+ id: touchdown;
126+ objectName: "touchdown";
127+ anchors { fill: backgroundLoader }
128+ visible: {
129+ if (root.template && root.template["non-interactive"]) {
130+ return false;
131+ }
132+ return root.pressed;
133+ }
134+ radius: "medium";
135+ borderSource: "radius_pressed.sci"
136+}
137137implicitHeight: row.y + row.height + units.gu(1);
138138}
tests/plugins/Dash/cardcreator/3.res+33−33
@@ -25,7 +25,7 @@ Item {
2525 objectName: "artShapeLoader";
2626 active: cardData && cardData["art"] || false;
2727 asynchronous: root.asynchronous;
28− visible: status == Loader.Ready;
28+ visible: status == Loader.Ready;
2929 sourceComponent: UbuntuShape {
3030 id: artShape;
3131 objectName: "artShape";
@@ -40,15 +40,15 @@ Item {
4040 width = root.fixedArtShapeSize.width;
4141 height = root.fixedArtShapeSize.height;
4242 } else {
43− width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
44− height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
45− }
43+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
44+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
45+ }
4646 }
47− image: CroppedImageMinimumSourceSize {
47+ image: CroppedImageMinimumSourceSize {
4848 objectName: "artImage";
49− property bool doLoadSource: !NetworkingStatus.limitedBandwith;
50− source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
51− cache: true;
49+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
50+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
51+ cache: true;
5252 asynchronous: root.asynchronous;
5353 visible: false;
5454 width: root.width;
@@ -61,17 +61,17 @@ readonly property int headerHeight: titleLabel.height + subtitleLabel.height + s
6161Label {
6262 id: titleLabel;
6363 objectName: "titleLabel";
64− anchors { right: parent.right;
65−left: parent.left;
66−top: artShapeHolder.bottom;
67− topMargin: units.gu(1);
68− }
64+ anchors { right: parent.right;
65+ left: parent.left;
66+ top: artShapeHolder.bottom;
67+ topMargin: units.gu(1);
68+ }
6969 elide: Text.ElideRight;
7070 fontSize: "small";
7171 wrapMode: Text.Wrap;
7272 maximumLineCount: 2;
7373 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
74− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
74+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
7575 visible: showHeader ;
7676 text: root.title;
7777 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -81,31 +81,31 @@ Label {
8181 id: subtitleLabel;
8282 objectName: "subtitleLabel";
8383 anchors { left: titleLabel.left;
84− leftMargin: titleLabel.leftMargin;
85−right: titleLabel.right;
86−top: titleLabel.bottom;
87− }
88− anchors.topMargin: units.dp(2);
84+ leftMargin: titleLabel.leftMargin;
85+ right: titleLabel.right;
86+ top: titleLabel.bottom;
87+ }
88+ anchors.topMargin: units.dp(2);
8989 elide: Text.ElideRight;
9090 fontSize: "x-small";
9191 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
92− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
92+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
9393 visible: titleLabel.visible && titleLabel.text;
9494 text: cardData && cardData["subtitle"] || "";
9595 font.weight: Font.Light;
9696 }
97−UbuntuShape {
98− id: touchdown;
99− objectName: "touchdown";
100− anchors { fill: artShapeHolder }
101− visible: {
102− if (root.template && root.template["non-interactive"]) {
103− return false;
104− }
105− return root.pressed;
106− }
107− radius: "medium";
108− borderSource: "radius_pressed.sci"
109− }
97+UbuntuShape {
98+ id: touchdown;
99+ objectName: "touchdown";
100+ anchors { fill: artShapeHolder }
101+ visible: {
102+ if (root.template && root.template["non-interactive"]) {
103+ return false;
104+ }
105+ return root.pressed;
106+ }
107+ radius: "medium";
108+ borderSource: "radius_pressed.sci"
109+}
110110implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
111111}
tests/plugins/Dash/cardcreator/4.res+87−87
@@ -5,8 +5,8 @@ AbstractButton {
55 property var cardData;
66 property var artShapeBorderSource: undefined;
77 property real fontScale: 1.0;
8− property var scopeStyle: null;
9− property int titleAlignment: Text.AlignLeft;
8+ property var scopeStyle: null;
9+ property int titleAlignment: Text.AlignLeft;
1010 property int fixedHeaderHeight: -1;
1111 property size fixedArtShapeSize: Qt.size(-1, -1);
1212 readonly property string title: cardData && cardData["title"] || "";
@@ -16,101 +16,101 @@ AbstractButton {
1616readonly property size artShapeSize: Qt.size(-1, -1);
1717readonly property int headerHeight: row.height;
1818Row {
19− id: row;
20− objectName: "outerRow";
21− property real margins: units.gu(1);
22− spacing: margins;
23− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
24− anchors { top: parent.top;
19+ id: row;
20+ objectName: "outerRow";
21+ property real margins: units.gu(1);
22+ spacing: margins;
23+ height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
24+ anchors { top: parent.top;
2525 topMargin: units.gu(1);
26−left: parent.left;
27− }
28− anchors.right: parent.right;
29− anchors.margins: margins;
30− anchors.rightMargin: 0;
31− data: [
32− Loader {
33− id: mascotShapeLoader;
34− objectName: "mascotShapeLoader";
35− asynchronous: root.asynchronous;
36− active: mascotImage.status === Image.Ready;
37− visible: showHeader && active && status == Loader.Ready;
38− width: units.gu(6);
39− height: units.gu(5.625);
40− sourceComponent: UbuntuShape { image: mascotImage }
41− anchors { verticalCenter: parent.verticalCenter; }
42− }
43−,CroppedImageMinimumSourceSize {
44− id: mascotImage;
45− objectName: "mascotImage";
46− anchors { verticalCenter: parent.verticalCenter; }
47− property bool doLoadSource: !NetworkingStatus.limitedBandwith;
48− source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
49− width: units.gu(6);
50− height: units.gu(5.625);
51− horizontalAlignment: Image.AlignHCenter;
52− verticalAlignment: Image.AlignVCenter;
53− visible: false;
54− }
26+ left: parent.left;
27+}
28+ anchors.right: parent.right;
29+ anchors.margins: margins;
30+ anchors.rightMargin: 0;
31+data: [
32+Loader {
33+ id: mascotShapeLoader;
34+ objectName: "mascotShapeLoader";
35+ asynchronous: root.asynchronous;
36+ active: mascotImage.status === Image.Ready;
37+ visible: showHeader && active && status == Loader.Ready;
38+ width: units.gu(6);
39+ height: units.gu(5.625);
40+ sourceComponent: UbuntuShape { image: mascotImage }
41+ anchors { verticalCenter: parent.verticalCenter; }
42+ }
43+
44+,CroppedImageMinimumSourceSize {
45+ id: mascotImage;
46+ objectName: "mascotImage";
47+ anchors { verticalCenter: parent.verticalCenter; }
48+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
49+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
50+ width: units.gu(6);
51+ height: units.gu(5.625);
52+ horizontalAlignment: Image.AlignHCenter;
53+ verticalAlignment: Image.AlignVCenter;
54+ visible: false;
55+ }
56+
5557,Item {
5658 id: headerTitleContainer;
5759 anchors { verticalCenter: parent.verticalCenter; }
5860 width: parent.width - x;
5961 implicitHeight: titleLabel.height + subtitleLabel.height;
6062 data: [
61− Label {
62− id: titleLabel;
63− objectName: "titleLabel";
63+Label {
64+ id: titleLabel;
65+ objectName: "titleLabel";
66+ anchors { right: parent.right;
67+ rightMargin: units.gu(1);
68+ left: parent.left;
69+ top: parent.top; }
70+ elide: Text.ElideRight;
71+ fontSize: "small";
72+ wrapMode: Text.Wrap;
73+ maximumLineCount: 2;
74+ font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
75+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
76+ visible: showHeader ;
77+ text: root.title;
78+ font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
79+ horizontalAlignment: root.titleAlignment;
80+ }
81+,Label {
82+ id: subtitleLabel;
83+ objectName: "subtitleLabel";
6484 anchors { right: parent.right;
65−rightMargin: units.gu(1);
66−left: parent.left;
67− top: parent.top; }
85+ left: parent.left;
86+ rightMargin: units.gu(1);
87+ top: titleLabel.bottom;
88+ }
89+ anchors.topMargin: units.dp(2);
6890 elide: Text.ElideRight;
69− fontSize: "small";
70− wrapMode: Text.Wrap;
71− maximumLineCount: 2;
91+ fontSize: "x-small";
7292 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
73− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
74− visible: showHeader ;
75− text: root.title;
76− font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
77− horizontalAlignment: root.titleAlignment;
78− }
79−,Label {
80− id: subtitleLabel;
81− objectName: "subtitleLabel";
82− anchors { right: parent.right;
83− left: parent.left;
84−rightMargin: units.gu(1);
85−top: titleLabel.bottom;
86− }
87− anchors.topMargin: units.dp(2);
88− elide: Text.ElideRight;
89− fontSize: "x-small";
90− font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
91− color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
92− visible: titleLabel.visible && titleLabel.text;
93− text: cardData && cardData["subtitle"] || "";
94− font.weight: Font.Light;
95− }
96−
97− ]
98− }
99−
100− ]
101− }
102−UbuntuShape {
103− id: touchdown;
104− objectName: "touchdown";
105− anchors { fill: root }
106− visible: {
107− if (root.template && root.template["non-interactive"]) {
108− return false;
109− }
110− return root.pressed;
111− }
112− radius: "medium";
113− borderSource: "radius_pressed.sci"
93+ color: root.scopeStyle ? root.scopeStyle.foreground : Theme.palette.normal.baseText;
94+ visible: titleLabel.visible && titleLabel.text;
95+ text: cardData && cardData["subtitle"] || "";
96+ font.weight: Font.Light;
11497 }
98+]
99+}
100+]
101+}
102+UbuntuShape {
103+ id: touchdown;
104+ objectName: "touchdown";
105+ anchors { fill: root }
106+ visible: {
107+ if (root.template && root.template["non-interactive"]) {
108+ return false;
109+ }
110+ return root.pressed;
111+ }
112+ radius: "medium";
113+ borderSource: "radius_pressed.sci"
114+}
115115implicitHeight: row.y + row.height + units.gu(1);
116116}
tests/plugins/Dash/cardcreator/5.res+40−40
@@ -25,7 +25,7 @@ Item {
2525 objectName: "artShapeLoader";
2626 active: cardData && cardData["art"] || false;
2727 asynchronous: root.asynchronous;
28− visible: status == Loader.Ready;
28+ visible: status == Loader.Ready;
2929 sourceComponent: UbuntuShape {
3030 id: artShape;
3131 objectName: "artShape";
@@ -40,22 +40,22 @@ Item {
4040 width = root.fixedArtShapeSize.width;
4141 height = root.fixedArtShapeSize.height;
4242 } else {
43− width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
44− height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
45− }
43+ width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
44+ height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
45+ }
4646 }
47− image: CroppedImageMinimumSourceSize {
47+ image: CroppedImageMinimumSourceSize {
4848 objectName: "artImage";
49− property bool doLoadSource: !NetworkingStatus.limitedBandwith;
50− source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
51− cache: true;
49+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
50+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["art"] || ""; }
51+ cache: true;
5252 asynchronous: root.asynchronous;
5353 visible: false;
5454 width: root.width;
5555 height: width / artShape.aspect;
5656 }
5757 }
58− }
58+ }
5959 }
6060Loader {
6161 id: overlayLoader;
@@ -64,14 +64,14 @@ Loader {
6464 right: artShapeHolder.right;
6565 bottom: artShapeHolder.bottom;
6666 }
67− active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
67+ active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
6868 asynchronous: root.asynchronous;
6969 visible: showHeader && status == Loader.Ready;
7070 sourceComponent: ShaderEffect {
7171 id: overlay;
72− height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
73− property real luminance: Style.luminance(overlayColor);
74− property color overlayColor: cardData && cardData["overlayColor"] || "#99000000";
72+ height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
73+ property real luminance: Style.luminance(overlayColor);
74+ property color overlayColor: cardData && cardData["overlayColor"] || "#99000000";
7575 property var source: ShaderEffectSource {
7676 id: shaderSource;
7777 sourceItem: artShapeLoader.item;
@@ -92,7 +92,7 @@ Loader {
9292 varying highp vec2 coord;
9393 uniform sampler2D source;
9494 uniform lowp float qt_Opacity;
95− uniform highp vec4 overlayColor;
95+ uniform highp vec4 overlayColor;
9696 void main() {
9797 lowp vec4 tex = texture2D(source, coord);
9898 gl_FragColor = vec4(overlayColor.r, overlayColor.g, overlayColor.b, 1) * qt_Opacity * overlayColor.a * tex.a;
@@ -101,21 +101,21 @@ Loader {
101101 }
102102readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
103103Label {
104− id: titleLabel;
104+ id: titleLabel;
105105 objectName: "titleLabel";
106106 anchors { right: parent.right;
107−rightMargin: units.gu(1);
108−left: parent.left;
109− leftMargin: units.gu(1);
110− top: overlayLoader.top;
111− topMargin: units.gu(1);
112− }
107+ rightMargin: units.gu(1);
108+ left: parent.left;
109+ leftMargin: units.gu(1);
110+ top: overlayLoader.top;
111+ topMargin: units.gu(1);
112+ }
113113 elide: Text.ElideRight;
114114 fontSize: "small";
115115 wrapMode: Text.Wrap;
116116 maximumLineCount: 2;
117117 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
118− color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
118+ color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
119119 visible: showHeader && overlayLoader.active;
120120 text: root.title;
121121 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -125,32 +125,32 @@ Label {
125125 id: subtitleLabel;
126126 objectName: "subtitleLabel";
127127 anchors { left: titleLabel.left;
128− leftMargin: titleLabel.leftMargin;
129−rightMargin: units.gu(1);
130−right: titleLabel.right;
131−top: titleLabel.bottom;
132− }
128+ leftMargin: titleLabel.leftMargin;
129+ rightMargin: units.gu(1);
130+ right: titleLabel.right;
131+ top: titleLabel.bottom;
132+ }
133133 anchors.topMargin: units.dp(2);
134134 elide: Text.ElideRight;
135135 fontSize: "x-small";
136136 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
137− color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
137+ color: root.scopeStyle && overlayLoader.item ? root.scopeStyle.getTextColor(overlayLoader.item.luminance) : (overlayLoader.item && overlayLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
138138 visible: titleLabel.visible && titleLabel.text;
139139 text: cardData && cardData["subtitle"] || "";
140140 font.weight: Font.Light;
141141 }
142142UbuntuShape {
143− id: touchdown;
144− objectName: "touchdown";
145− anchors { fill: artShapeHolder }
146− visible: {
147− if (root.template && root.template["non-interactive"]) {
148− return false;
149− }
150− return root.pressed;
151− }
152− radius: "medium";
153− borderSource: "radius_pressed.sci"
154− }
143+ id: touchdown;
144+ objectName: "touchdown";
145+ anchors { fill: artShapeHolder }
146+ visible: {
147+ if (root.template && root.template["non-interactive"]) {
148+ return false;
149+ }
150+ return root.pressed;
151+ }
152+ radius: "medium";
153+ borderSource: "radius_pressed.sci"
154+}
155155implicitHeight: subtitleLabel.y + subtitleLabel.height + units.gu(1);
156156}
tests/plugins/Dash/cardcreator/6.res+45−46
@@ -1,18 +1,18 @@
1−AbstractButton {
2− id: root;
3− property var template;
4− property var components;
5− property var cardData;
6− property var artShapeBorderSource: undefined;
7− property real fontScale: 1.0;
8− property var scopeStyle: null;
9− property int titleAlignment: Text.AlignLeft;
10− property int fixedHeaderHeight: -1;
11− property size fixedArtShapeSize: Qt.size(-1, -1);
12− readonly property string title: cardData && cardData["title"] || "";
13− property bool asynchronous: true;
14− property bool showHeader: true;
15− implicitWidth: childrenRect.width;
1+AbstractButton {
2+ id: root;
3+ property var template;
4+ property var components;
5+ property var cardData;
6+ property var artShapeBorderSource: undefined;
7+ property real fontScale: 1.0;
8+ property var scopeStyle: null;
9+ property int titleAlignment: Text.AlignLeft;
10+ property int fixedHeaderHeight: -1;
11+ property size fixedArtShapeSize: Qt.size(-1, -1);
12+ readonly property string title: cardData && cardData["title"] || "";
13+ property bool asynchronous: true;
14+ property bool showHeader: true;
15+ implicitWidth: childrenRect.width;
1616Loader {
1717 id: backgroundLoader;
1818 objectName: "backgroundLoader";
@@ -51,10 +51,10 @@ readonly property int headerHeight: titleLabel.height + subtitleLabel.height + s
5151Item {
5252 id: headerTitleContainer;
5353 anchors { right: parent.right; left: parent.left;
54−top: parent.top;
55− topMargin: units.gu(1);
56−leftMargin: units.gu(1);
57− }
54+ top: parent.top;
55+ topMargin: units.gu(1);
56+ leftMargin: units.gu(1);
57+ }
5858 width: parent.width - x;
5959 implicitHeight: titleLabel.height + subtitleLabel.height;
6060 data: [
@@ -62,15 +62,15 @@ leftMargin: units.gu(1);
6262 id: titleLabel;
6363 objectName: "titleLabel";
6464 anchors { right: emblemIcon.left;
65− rightMargin: emblemIcon.width > 0 ? units.gu(0.5) : 0;
66−left: parent.left;
67− top: parent.top; }
65+ rightMargin: emblemIcon.width > 0 ? units.gu(0.5) : 0;
66+ left: parent.left;
67+ top: parent.top; }
6868 elide: Text.ElideRight;
6969 fontSize: "small";
7070 wrapMode: Text.Wrap;
7171 maximumLineCount: 2;
7272 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
73− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
73+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
7474 visible: showHeader ;
7575 text: root.title;
7676 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -80,15 +80,15 @@ left: parent.left;
8080 id: subtitleLabel;
8181 objectName: "subtitleLabel";
8282 anchors { right: parent.right;
83− left: parent.left;
84−rightMargin: units.gu(1);
85−top: titleLabel.bottom;
86− }
83+ left: parent.left;
84+ rightMargin: units.gu(1);
85+ top: titleLabel.bottom;
86+ }
8787 anchors.topMargin: units.dp(2);
8888 elide: Text.ElideRight;
8989 fontSize: "x-small";
9090 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
91− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
91+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
9292 visible: titleLabel.visible && titleLabel.text;
9393 text: cardData && cardData["subtitle"] || "";
9494 font.weight: Font.Light;
@@ -97,30 +97,29 @@ top: titleLabel.bottom;
9797 id: emblemIcon;
9898 objectName: "emblemIcon";
9999 anchors {
100− bottom: titleLabel.baseline;
101− right: parent.right;
102− rightMargin: units.gu(1);
103−
100+ bottom: titleLabel.baseline;
101+ right: parent.right;
102+ rightMargin: units.gu(1);
104103 }
105104 source: cardData && cardData["emblem"] || "";
106− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
105+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
107106 height: source != "" ? titleLabel.font.pixelSize : 0;
108107 }
109108
110109 ]
111110 }
112−UbuntuShape {
113− id: touchdown;
114− objectName: "touchdown";
115− anchors { fill: backgroundLoader }
116− visible: {
117− if (root.template && root.template["non-interactive"]) {
118− return false;
119− }
120− return root.pressed;
121− }
122− radius: "medium";
123− borderSource: "radius_pressed.sci"
124− }
111+UbuntuShape {
112+ id: touchdown;
113+ objectName: "touchdown";
114+ anchors { fill: backgroundLoader }
115+ visible: {
116+ if (root.template && root.template["non-interactive"]) {
117+ return false;
118+ }
119+ return root.pressed;
120+ }
121+ radius: "medium";
122+ borderSource: "radius_pressed.sci"
123+}
125124implicitHeight: headerTitleContainer.y + headerTitleContainer.height + units.gu(1);
126125}
tests/plugins/Dash/cardcreator/7.res+41−40
@@ -55,25 +55,26 @@ Row {
5555 spacing: margins;
5656 height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
5757 anchors { top: parent.top;
58− topMargin: units.gu(1);
59−left: parent.left;
60− }
58+ topMargin: units.gu(1);
59+ left: parent.left;
60+ }
6161 anchors.right: parent.right;
62− anchors.margins: margins;
63− anchors.rightMargin: 0;
62+ anchors.margins: margins;
63+ anchors.rightMargin: 0;
6464 data: [
65− CroppedImageMinimumSourceSize {
65+CroppedImageMinimumSourceSize {
6666 id: mascotImage;
6767 objectName: "mascotImage";
6868 anchors { verticalCenter: parent.verticalCenter; }
69− property bool doLoadSource: !NetworkingStatus.limitedBandwith;
70− source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
71− width: units.gu(6);
69+ property bool doLoadSource: !NetworkingStatus.limitedBandwith;
70+ source: { if (root.visible) doLoadSource = true; return doLoadSource && cardData && cardData["mascot"] || ""; }
71+ width: units.gu(6);
7272 height: units.gu(5.625);
7373 horizontalAlignment: Image.AlignHCenter;
7474 verticalAlignment: Image.AlignVCenter;
75− visible: showHeader && resized;
75+ visible: showHeader && resized;
7676 }
77+
7778,Item {
7879 id: headerTitleContainer;
7980 anchors { verticalCenter: parent.verticalCenter; }
@@ -84,15 +85,15 @@ left: parent.left;
8485 id: titleLabel;
8586 objectName: "titleLabel";
8687 anchors { right: parent.right;
87−rightMargin: units.gu(1);
88−left: parent.left;
89− top: parent.top; }
88+ rightMargin: units.gu(1);
89+ left: parent.left;
90+ top: parent.top; }
9091 elide: Text.ElideRight;
9192 fontSize: "small";
9293 wrapMode: Text.Wrap;
9394 maximumLineCount: 2;
9495 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
95− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
96+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
9697 visible: showHeader ;
9798 text: root.title;
9899 font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal;
@@ -102,15 +103,15 @@ left: parent.left;
102103 id: subtitleLabel;
103104 objectName: "subtitleLabel";
104105 anchors { right: parent.right;
105− left: parent.left;
106−rightMargin: units.gu(1);
107−top: titleLabel.bottom;
108− }
106+ left: parent.left;
107+ rightMargin: units.gu(1);
108+ top: titleLabel.bottom;
109+ }
109110 anchors.topMargin: units.dp(2);
110111 elide: Text.ElideRight;
111112 fontSize: "x-small";
112113 font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale);
113− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
114+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
114115 visible: titleLabel.visible && titleLabel.text;
115116 text: cardData && cardData["subtitle"] || "";
116117 font.weight: Font.Light;
@@ -118,33 +119,33 @@ top: titleLabel.bottom;
118119,CardAttributes {
119120 id: attributesRow;
120121 objectName: "attributesRow";
121− anchors { right: parent.right;
122− left: parent.left;
123−rightMargin: units.gu(1);
124−top: subtitleLabel.bottom;
125− }
126− color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
122+ anchors { right: parent.right;
123+ left: parent.left;
124+ rightMargin: units.gu(1);
125+ top: subtitleLabel.bottom;
126+ }
127+ color: backgroundLoader.active && backgroundLoader.item && root.scopeStyle ? root.scopeStyle.getTextColor(backgroundLoader.item.luminance) : (backgroundLoader.item && backgroundLoader.item.luminance > 0.7 ? Theme.palette.normal.baseText : "white");
127128 fontScale: root.fontScale;
128129 model: cardData && cardData["attributes"];
129130 }
130131
131− ]
132− }
132+ ]
133+ }
133134
134135 ]
135136 }
136−UbuntuShape {
137− id: touchdown;
138− objectName: "touchdown";
139− anchors { fill: backgroundLoader }
140− visible: {
141− if (root.template && root.template["non-interactive"]) {
142− return false;
143− }
144− return root.pressed;
145− }
146− radius: "medium";
147− borderSource: "radius_pressed.sci"
148− }
137+UbuntuShape {
138+ id: touchdown;
139+ objectName: "touchdown";
140+ anchors { fill: backgroundLoader }
141+ visible: {
142+ if (root.template && root.template["non-interactive"]) {
143+ return false;
144+ }
145+ return root.pressed;
146+ }
147+ radius: "medium";
148+ borderSource: "radius_pressed.sci"
149+}
149150implicitHeight: row.y + row.height + units.gu(1);
150151}