on xenial help sign in
Fix test card creator
b11778fAndrea Cimitan
tests/plugins/Dash/cardcreator/1.res+6−7
@@ -2,7 +2,7 @@ AbstractButton {
2 id: root;
2 id: root;
3 property var components;
3 property var components;
4 property var cardData;
4 property var cardData;
5− property var artShapeBorderSource: undefined;
5+ property string artShapeStyle: "inset";
6 property real fontScale: 1.0;
6 property real fontScale: 1.0;
7 property var scopeStyle: null;
7 property var scopeStyle: null;
8 property int titleAlignment: Text.AlignLeft;
8 property int titleAlignment: Text.AlignLeft;
@@ -14,7 +14,6 @@ AbstractButton {
14 implicitWidth: childrenRect.width;
14 implicitWidth: childrenRect.width;
15 enabled: true;
15 enabled: true;
16
16
17−onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
18readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
19Item {
18Item {
20 id: artShapeHolder;
19 id: artShapeHolder;
@@ -30,10 +29,9 @@ Item {
30 sourceComponent: Item {
29 sourceComponent: Item {
31 id: artShape;
30 id: artShape;
32 objectName: "artShape";
31 objectName: "artShape";
33− property bool doShapeItem: components["art"]["conciergeMode"] !== true;
32+ readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
34 visible: image.status == Image.Ready;
33 visible: image.status == Image.Ready;
35 readonly property alias image: artImage.image;
34 readonly property alias image: artImage.image;
36− property alias borderSource: artShapeShape.borderSource;
37 ShaderEffectSource {
35 ShaderEffectSource {
38 id: artShapeSource;
36 id: artShapeSource;
39 sourceItem: artImage;
37 sourceItem: artImage;
@@ -42,16 +40,17 @@ Item {
42 height: 1;
40 height: 1;
43 hideSource: doShapeItem;
41 hideSource: doShapeItem;
44 }
42 }
45− Shape {
43+ UbuntuShape {
46 id: artShapeShape;
44 id: artShapeShape;
47− image: artShapeSource;
45+ source: artShapeSource;
48 anchors.fill: parent;
46 anchors.fill: parent;
49 visible: doShapeItem;
47 visible: doShapeItem;
50 radius: "medium";
48 radius: "medium";
49+ aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
51 }
50 }
52 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
51 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
53 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
52 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
54− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
53+ Component.onCompleted: { updateWidthHeightBindings(); }
55 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
54 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
56 function updateWidthHeightBindings() {
55 function updateWidthHeightBindings() {
57 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
56 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
tests/plugins/Dash/cardcreator/2.res+6−5
@@ -2,7 +2,7 @@ AbstractButton {
2 id: root;
2 id: root;
3 property var components;
3 property var components;
4 property var cardData;
4 property var cardData;
5− property var artShapeBorderSource: undefined;
5+ property string artShapeStyle: "inset";
6 property real fontScale: 1.0;
6 property real fontScale: 1.0;
7 property var scopeStyle: null;
7 property var scopeStyle: null;
8 property int titleAlignment: Text.AlignLeft;
8 property int titleAlignment: Text.AlignLeft;
@@ -23,11 +23,12 @@ Loader {
23 sourceComponent: UbuntuShape {
23 sourceComponent: UbuntuShape {
24 objectName: "background";
24 objectName: "background";
25 radius: "medium";
25 radius: "medium";
26− color: getColor(0) || "white";
26+ backgroundColor: getColor(0) || "white";
27− gradientColor: getColor(1) || color;
27+ secondaryBackgroundColor: getColor(1) || backgroundColor;
28+ backgroundMode: cardData && typeof cardData["background"] === "object" && cardData["background"]["type"] === "gradient" ? UbuntuShape.VerticalGradient : UbuntuShape.SolidColor;
28 anchors.fill: parent;
29 anchors.fill: parent;
29− image: backgroundImage.source ? backgroundImage : null;
30+ source: backgroundImage.source ? backgroundImage : null;
30− property real luminance: Style.luminance(color);
31+ property real luminance: Style.luminance(backgroundColor);
31 property Image backgroundImage: Image {
32 property Image backgroundImage: Image {
32 objectName: "backgroundImage";
33 objectName: "backgroundImage";
33 source: {
34 source: {
tests/plugins/Dash/cardcreator/3.res+6−7
@@ -2,7 +2,7 @@ AbstractButton {
2 id: root;
2 id: root;
3 property var components;
3 property var components;
4 property var cardData;
4 property var cardData;
5− property var artShapeBorderSource: undefined;
5+ property string artShapeStyle: "inset";
6 property real fontScale: 1.0;
6 property real fontScale: 1.0;
7 property var scopeStyle: null;
7 property var scopeStyle: null;
8 property int titleAlignment: Text.AlignLeft;
8 property int titleAlignment: Text.AlignLeft;
@@ -14,7 +14,6 @@ AbstractButton {
14 implicitWidth: childrenRect.width;
14 implicitWidth: childrenRect.width;
15 enabled: true;
15 enabled: true;
16
16
17−onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
18readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
19Item {
18Item {
20 id: artShapeHolder;
19 id: artShapeHolder;
@@ -30,10 +29,9 @@ Item {
30 sourceComponent: Item {
29 sourceComponent: Item {
31 id: artShape;
30 id: artShape;
32 objectName: "artShape";
31 objectName: "artShape";
33− property bool doShapeItem: components["art"]["conciergeMode"] !== true;
32+ readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
34 visible: image.status == Image.Ready;
33 visible: image.status == Image.Ready;
35 readonly property alias image: artImage.image;
34 readonly property alias image: artImage.image;
36− property alias borderSource: artShapeShape.borderSource;
37 ShaderEffectSource {
35 ShaderEffectSource {
38 id: artShapeSource;
36 id: artShapeSource;
39 sourceItem: artImage;
37 sourceItem: artImage;
@@ -42,16 +40,17 @@ Item {
42 height: 1;
40 height: 1;
43 hideSource: doShapeItem;
41 hideSource: doShapeItem;
44 }
42 }
45− Shape {
43+ UbuntuShape {
46 id: artShapeShape;
44 id: artShapeShape;
47− image: artShapeSource;
45+ source: artShapeSource;
48 anchors.fill: parent;
46 anchors.fill: parent;
49 visible: doShapeItem;
47 visible: doShapeItem;
50 radius: "medium";
48 radius: "medium";
49+ aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
51 }
50 }
52 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
51 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
53 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
52 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
54− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
53+ Component.onCompleted: { updateWidthHeightBindings(); }
55 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
54 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
56 function updateWidthHeightBindings() {
55 function updateWidthHeightBindings() {
57 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
56 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
tests/plugins/Dash/cardcreator/4.res+1−1
@@ -2,7 +2,7 @@ AbstractButton {
2 id: root;
2 id: root;
3 property var components;
3 property var components;
4 property var cardData;
4 property var cardData;
5− property var artShapeBorderSource: undefined;
5+ property string artShapeStyle: "inset";
6 property real fontScale: 1.0;
6 property real fontScale: 1.0;
7 property var scopeStyle: null;
7 property var scopeStyle: null;
8 property int titleAlignment: Text.AlignLeft;
8 property int titleAlignment: Text.AlignLeft;
tests/plugins/Dash/cardcreator/5.res+16−43
@@ -2,7 +2,7 @@ AbstractButton {
2 id: root;
2 id: root;
3 property var components;
3 property var components;
4 property var cardData;
4 property var cardData;
5− property var artShapeBorderSource: undefined;
5+ property string artShapeStyle: "inset";
6 property real fontScale: 1.0;
6 property real fontScale: 1.0;
7 property var scopeStyle: null;
7 property var scopeStyle: null;
8 property int titleAlignment: Text.AlignLeft;
8 property int titleAlignment: Text.AlignLeft;
@@ -14,7 +14,6 @@ AbstractButton {
14 implicitWidth: childrenRect.width;
14 implicitWidth: childrenRect.width;
15 enabled: false;
15 enabled: false;
16
16
17−onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artShapeLoader.item) artShapeLoader.item.borderSource = artShapeBorderSource; }
18readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
17readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
19Item {
18Item {
20 id: artShapeHolder;
19 id: artShapeHolder;
@@ -30,10 +29,9 @@ Item {
30 sourceComponent: Item {
29 sourceComponent: Item {
31 id: artShape;
30 id: artShape;
32 objectName: "artShape";
31 objectName: "artShape";
33− property bool doShapeItem: components["art"]["conciergeMode"] !== true;
32+ readonly property bool doShapeItem: components["art"]["conciergeMode"] !== true;
34 visible: image.status == Image.Ready;
33 visible: image.status == Image.Ready;
35 readonly property alias image: artImage.image;
34 readonly property alias image: artImage.image;
36− property alias borderSource: artShapeShape.borderSource;
37 ShaderEffectSource {
35 ShaderEffectSource {
38 id: artShapeSource;
36 id: artShapeSource;
39 sourceItem: artImage;
37 sourceItem: artImage;
@@ -42,16 +40,17 @@ Item {
42 height: 1;
40 height: 1;
43 hideSource: doShapeItem;
41 hideSource: doShapeItem;
44 }
42 }
45− Shape {
43+ UbuntuShape {
46 id: artShapeShape;
44 id: artShapeShape;
47− image: artShapeSource;
45+ source: artShapeSource;
48 anchors.fill: parent;
46 anchors.fill: parent;
49 visible: doShapeItem;
47 visible: doShapeItem;
50 radius: "medium";
48 radius: "medium";
49+ aspect: root.artShapeStyle === "inset" ? UbuntuShape.Inset : UbuntuShape.Flat;
51 }
50 }
52 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
51 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
53 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
52 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
54− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
53+ Component.onCompleted: { updateWidthHeightBindings(); }
55 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
54 Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
56 function updateWidthHeightBindings() {
55 function updateWidthHeightBindings() {
57 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
56 if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
@@ -75,44 +74,18 @@ Item {
75 }
74 }
76Loader {
75Loader {
77 id: overlayLoader;
76 id: overlayLoader;
78− anchors {
77+ readonly property real overlayHeight: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
79− left: artShapeHolder.left;
80− right: artShapeHolder.right;
78+ anchors.fill: artShapeHolder;
81− bottom: artShapeHolder.bottom;
82− }
83− active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
79+ active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
84 asynchronous: root.asynchronous;
80 asynchronous: root.asynchronous;
85 visible: showHeader && status == Loader.Ready;
81 visible: showHeader && status == Loader.Ready;
86− sourceComponent: ShaderEffect {
82+ sourceComponent: UbuntuShapeOverlay {
87 id: overlay;
83 id: overlay;
88− height: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
89− property real luminance: Style.luminance(overlayColor);
84+ property real luminance: Style.luminance(overlayColor);
85+ aspect: UbuntuShape.Flat;
86+ radius: "medium";
90− property color overlayColor: cardData && cardData["overlayColor"] || "#99000000";
87+ overlayColor: cardData && cardData["overlayColor"] || "#99000000";
91− property var source: ShaderEffectSource {
88+ overlayRect: Qt.rect(0, 1 - overlayLoader.overlayHeight / height, 1, 1);
92− id: shaderSource;
93− sourceItem: artShapeLoader.item;
94− onVisibleChanged: if (visible) scheduleUpdate();
95− live: false;
96− sourceRect: Qt.rect(0, artShapeLoader.height - overlay.height, artShapeLoader.width, overlay.height);
97− }
98− vertexShader: "
99− uniform highp mat4 qt_Matrix;
100− attribute highp vec4 qt_Vertex;
101− attribute highp vec2 qt_MultiTexCoord0;
102− varying highp vec2 coord;
103− void main() {
104− coord = qt_MultiTexCoord0;
105− gl_Position = qt_Matrix * qt_Vertex;
106− }";
107− fragmentShader: "
108− varying highp vec2 coord;
109− uniform sampler2D source;
110− uniform lowp float qt_Opacity;
111− uniform highp vec4 overlayColor;
112− void main() {
113− lowp vec4 tex = texture2D(source, coord);
114− gl_FragColor = vec4(overlayColor.r, overlayColor.g, overlayColor.b, 1) * qt_Opacity * overlayColor.a * tex.a;
115− }";
116 }
89 }
117 }
90 }
118readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
91readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin;
@@ -124,7 +97,7 @@ Label {
124 left: parent.left;
97 left: parent.left;
125 leftMargin: units.gu(1);
98 leftMargin: units.gu(1);
126 top: overlayLoader.top;
99 top: overlayLoader.top;
127− topMargin: units.gu(1);
100+ topMargin: units.gu(1) + overlayLoader.height - overlayLoader.overlayHeight;
128 }
101 }
129 elide: Text.ElideRight;
102 elide: Text.ElideRight;
130 fontSize: "small";
103 fontSize: "small";
tests/plugins/Dash/cardcreator/6.res+6−5
@@ -2,7 +2,7 @@ AbstractButton {
2 id: root;
2 id: root;
3 property var components;
3 property var components;
4 property var cardData;
4 property var cardData;
5− property var artShapeBorderSource: undefined;
5+ property string artShapeStyle: "inset";
6 property real fontScale: 1.0;
6 property real fontScale: 1.0;
7 property var scopeStyle: null;
7 property var scopeStyle: null;
8 property int titleAlignment: Text.AlignLeft;
8 property int titleAlignment: Text.AlignLeft;
@@ -23,11 +23,12 @@ Loader {
23 sourceComponent: UbuntuShape {
23 sourceComponent: UbuntuShape {
24 objectName: "background";
24 objectName: "background";
25 radius: "medium";
25 radius: "medium";
26− color: getColor(0) || "white";
26+ backgroundColor: getColor(0) || "white";
27− gradientColor: getColor(1) || color;
27+ secondaryBackgroundColor: getColor(1) || backgroundColor;
28+ backgroundMode: cardData && typeof cardData["background"] === "object" && cardData["background"]["type"] === "gradient" ? UbuntuShape.VerticalGradient : UbuntuShape.SolidColor;
28 anchors.fill: parent;
29 anchors.fill: parent;
29− image: backgroundImage.source ? backgroundImage : null;
30+ source: backgroundImage.source ? backgroundImage : null;
30− property real luminance: Style.luminance(color);
31+ property real luminance: Style.luminance(backgroundColor);
31 property Image backgroundImage: Image {
32 property Image backgroundImage: Image {
32 objectName: "backgroundImage";
33 objectName: "backgroundImage";
33 source: {
34 source: {
tests/plugins/Dash/cardcreator/7.res+6−5
@@ -2,7 +2,7 @@ AbstractButton {
2 id: root;
2 id: root;
3 property var components;
3 property var components;
4 property var cardData;
4 property var cardData;
5− property var artShapeBorderSource: undefined;
5+ property string artShapeStyle: "inset";
6 property real fontScale: 1.0;
6 property real fontScale: 1.0;
7 property var scopeStyle: null;
7 property var scopeStyle: null;
8 property int titleAlignment: Text.AlignLeft;
8 property int titleAlignment: Text.AlignLeft;
@@ -23,11 +23,12 @@ Loader {
23 sourceComponent: UbuntuShape {
23 sourceComponent: UbuntuShape {
24 objectName: "background";
24 objectName: "background";
25 radius: "medium";
25 radius: "medium";
26− color: getColor(0) || "white";
26+ backgroundColor: getColor(0) || "white";
27− gradientColor: getColor(1) || color;
27+ secondaryBackgroundColor: getColor(1) || backgroundColor;
28+ backgroundMode: cardData && typeof cardData["background"] === "object" && cardData["background"]["type"] === "gradient" ? UbuntuShape.VerticalGradient : UbuntuShape.SolidColor;
28 anchors.fill: parent;
29 anchors.fill: parent;
29− image: backgroundImage.source ? backgroundImage : null;
30+ source: backgroundImage.source ? backgroundImage : null;
30− property real luminance: Style.luminance(color);
31+ property real luminance: Style.luminance(backgroundColor);
31 property Image backgroundImage: Image {
32 property Image backgroundImage: Image {
32 objectName: "backgroundImage";
33 objectName: "backgroundImage";
33 source: {
34 source: {
tests/plugins/Dash/cardcreator/8.res+6−5
@@ -2,7 +2,7 @@ AbstractButton {
2 id: root;
2 id: root;
3 property var components;
3 property var components;
4 property var cardData;
4 property var cardData;
5− property var artShapeBorderSource: undefined;
5+ property string artShapeStyle: "inset";
6 property real fontScale: 1.0;
6 property real fontScale: 1.0;
7 property var scopeStyle: null;
7 property var scopeStyle: null;
8 property int titleAlignment: Text.AlignLeft;
8 property int titleAlignment: Text.AlignLeft;
@@ -23,11 +23,12 @@ Loader {
23 sourceComponent: UbuntuShape {
23 sourceComponent: UbuntuShape {
24 objectName: "background";
24 objectName: "background";
25 radius: "medium";
25 radius: "medium";
26− color: getColor(0) || "white";
26+ backgroundColor: getColor(0) || "white";
27− gradientColor: getColor(1) || color;
27+ secondaryBackgroundColor: getColor(1) || backgroundColor;
28+ backgroundMode: cardData && typeof cardData["background"] === "object" && cardData["background"]["type"] === "gradient" ? UbuntuShape.VerticalGradient : UbuntuShape.SolidColor;
28 anchors.fill: parent;
29 anchors.fill: parent;
29− image: backgroundImage.source ? backgroundImage : null;
30+ source: backgroundImage.source ? backgroundImage : null;
30− property real luminance: Style.luminance(color);
31+ property real luminance: Style.luminance(backgroundColor);
31 property Image backgroundImage: Image {
32 property Image backgroundImage: Image {
32 objectName: "backgroundImage";
33 objectName: "backgroundImage";
33 source: {
34 source: {