on xenial help sign in
Use fixedHeaderHeight only in the non cardtool cards
7552279Albert Astals Cid
plugins/Dash/CardCreator.js+15−8
@@ -190,9 +190,10 @@ var kAudioButtonCode = 'AbstractButton { \n\
190 }';
190 }';
191
191
192// %1 is whether the loader should be asynchronous or not
192// %1 is whether the loader should be asynchronous or not
193+// %2 is the header height code
193var kOverlayLoaderCode = 'Loader { \n\
194var kOverlayLoaderCode = 'Loader { \n\
194 id: overlayLoader; \n\
195 id: overlayLoader; \n\
195− readonly property real overlayHeight: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2); \n\
196+ readonly property real overlayHeight: %2 + units.gu(2); \n\
196 anchors.fill: artShapeHolder; \n\
197 anchors.fill: artShapeHolder; \n\
197 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; \n\
198 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false; \n\
198 asynchronous: %1; \n\
199 asynchronous: %1; \n\
@@ -214,17 +215,19 @@ function kHeaderRowCodeGenerator() {
214 objectName: "outerRow"; \n\
215 objectName: "outerRow"; \n\
215 property real margins: units.gu(1); \n\
216 property real margins: units.gu(1); \n\
216 spacing: margins; \n\
217 spacing: margins; \n\
217− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight; \n\
218+ %2\
218 anchors { %1 } \n\
219 anchors { %1 } \n\
219 anchors.right: parent.right; \n\
220 anchors.right: parent.right; \n\
220 anchors.margins: margins; \n\
221 anchors.margins: margins; \n\
221 anchors.rightMargin: 0; \n\
222 anchors.rightMargin: 0; \n\
222 data: [ \n\
223 data: [ \n\
223− %2 \n\
224+ %3 \n\
224 ] \n\
225 ] \n\
225 }\n';
226 }\n';
226 var args = Array.prototype.slice.call(arguments);
227 var args = Array.prototype.slice.call(arguments);
228+ var isCardTool = args.shift();
229+ var heightCode = isCardTool ? "" : "height: root.fixedHeaderHeight; \n";
227− var code = kHeaderRowCodeTemplate.arg(args.shift()).arg(args.join(',\n'));
230+ var code = kHeaderRowCodeTemplate.arg(args.shift()).arg(heightCode).arg(args.join(',\n'));
228 return code;
231 return code;
229}
232}
230
233
@@ -415,7 +418,7 @@ function cardString(template, components, isCardTool) {
415 property string backgroundShapeStyle: "inset"; \n\
418 property string backgroundShapeStyle: "inset"; \n\
416 property real fontScale: 1.0; \n\
419 property real fontScale: 1.0; \n\
417 property var scopeStyle: null; \n\
420 property var scopeStyle: null; \n\
418− property int fixedHeaderHeight: -1; \n\
421+ %2\
419 property size fixedArtShapeSize: Qt.size(-1, -1); \n\
422 property size fixedArtShapeSize: Qt.size(-1, -1); \n\
420 readonly property string title: cardData && cardData["title"] || ""; \n\
423 readonly property string title: cardData && cardData["title"] || ""; \n\
421 property bool showHeader: true; \n\
424 property bool showHeader: true; \n\
@@ -423,6 +426,8 @@ function cardString(template, components, isCardTool) {
423 enabled: %1; \n\
426 enabled: %1; \n\
424 \n'.arg(templateInteractive);
427 \n'.arg(templateInteractive);
425
428
429+ code = code.arg(isCardTool ? "" : "property int fixedHeaderHeight: -1; \n");
430+
426 var hasArt = components["art"] && components["art"]["field"] || false;
431 var hasArt = components["art"] && components["art"]["field"] || false;
427 var hasSummary = components["summary"] || false;
432 var hasSummary = components["summary"] || false;
428 var isConciergeMode = components["art"] && components["art"]["conciergeMode"] || false;
433 var isConciergeMode = components["art"] && components["art"]["conciergeMode"] || false;
@@ -524,7 +529,8 @@ function cardString(template, components, isCardTool) {
524 }
529 }
525
530
526 if (headerAsOverlay) {
531 if (headerAsOverlay) {
532+ var headerHeightCode = isCardTool ? "headerHeight" : "root.fixedHeaderHeight";
527− code += kOverlayLoaderCode.arg(asynchronous);
533+ code += kOverlayLoaderCode.arg(asynchronous).arg(headerHeightCode);
528 }
534 }
529
535
530 var headerVerticalAnchors;
536 var headerVerticalAnchors;
@@ -785,7 +791,7 @@ function cardString(template, components, isCardTool) {
785 if (mascotShapeCode != '') {
791 if (mascotShapeCode != '') {
786 rowCode.unshift(mascotShapeCode);
792 rowCode.unshift(mascotShapeCode);
787 }
793 }
788− code += kHeaderRowCodeGenerator(headerVerticalAnchors + headerLeftAnchor, rowCode)
794+ code += kHeaderRowCodeGenerator(isCardTool, headerVerticalAnchors + headerLeftAnchor, rowCode)
789 } else {
795 } else {
790 code += mascotShapeCode + mascotCode + titleSubtitleCode;
796 code += mascotShapeCode + mascotCode + titleSubtitleCode;
791 }
797 }
@@ -809,7 +815,8 @@ function cardString(template, components, isCardTool) {
809 } else {
815 } else {
810 audioButtonAnchorsFill = 'undefined';
816 audioButtonAnchorsFill = 'undefined';
811 audioButtonWidth = 'height';
817 audioButtonWidth = 'height';
812− audioButtonHeight = '(root.fixedHeaderHeight > 0 ? root.fixedHeaderHeight : headerHeight) + 2 * units.gu(1)';
818+ audioButtonHeight = isCardTool ? 'headerHeight + 2 * units.gu(1)'
819+ : 'root.fixedHeaderHeight + 2 * units.gu(1)';
813 }
820 }
814 code += kAudioButtonCode.arg(audioButtonAnchorsFill).arg(audioButtonWidth).arg(audioButtonHeight);
821 code += kAudioButtonCode.arg(audioButtonAnchorsFill).arg(audioButtonWidth).arg(audioButtonHeight);
815 }
822 }
tests/plugins/Dash/cardcreator/1.res.cardcreator−1
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
tests/plugins/Dash/cardcreator/10.res+1−1
@@ -57,7 +57,7 @@ Row {
57 objectName: "outerRow";
57 objectName: "outerRow";
58 property real margins: units.gu(1);
58 property real margins: units.gu(1);
59 spacing: margins;
59 spacing: margins;
60− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
60+ height: root.fixedHeaderHeight;
61 anchors { top: parent.top;
61 anchors { top: parent.top;
62 topMargin: units.gu(1);
62 topMargin: units.gu(1);
63left: parent.left;
63left: parent.left;
tests/plugins/Dash/cardcreator/10.res.cardcreator−2
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
@@ -57,7 +56,6 @@ Row {
57 objectName: "outerRow";
56 objectName: "outerRow";
58 property real margins: units.gu(1);
57 property real margins: units.gu(1);
59 spacing: margins;
58 spacing: margins;
60− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
61 anchors { top: parent.top;
59 anchors { top: parent.top;
62 topMargin: units.gu(1);
60 topMargin: units.gu(1);
63left: parent.left;
61left: parent.left;
tests/plugins/Dash/cardcreator/11.res+1−1
@@ -132,7 +132,7 @@ Row {
132 objectName: "outerRow";
132 objectName: "outerRow";
133 property real margins: units.gu(1);
133 property real margins: units.gu(1);
134 spacing: margins;
134 spacing: margins;
135− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
135+ height: root.fixedHeaderHeight;
136 anchors { top: artShapeHolder.bottom;
136 anchors { top: artShapeHolder.bottom;
137 topMargin: units.gu(1);
137 topMargin: units.gu(1);
138left: parent.left;
138left: parent.left;
tests/plugins/Dash/cardcreator/11.res.cardcreator−2
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
@@ -131,7 +130,6 @@ Row {
131 objectName: "outerRow";
130 objectName: "outerRow";
132 property real margins: units.gu(1);
131 property real margins: units.gu(1);
133 spacing: margins;
132 spacing: margins;
134− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
135 anchors { top: artShapeHolder.bottom;
133 anchors { top: artShapeHolder.bottom;
136 topMargin: units.gu(1);
134 topMargin: units.gu(1);
137left: parent.left;
135left: parent.left;
tests/plugins/Dash/cardcreator/2.res+1−1
@@ -57,7 +57,7 @@ Row {
57 objectName: "outerRow";
57 objectName: "outerRow";
58 property real margins: units.gu(1);
58 property real margins: units.gu(1);
59 spacing: margins;
59 spacing: margins;
60− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
60+ height: root.fixedHeaderHeight;
61 anchors { top: parent.top;
61 anchors { top: parent.top;
62 topMargin: units.gu(1);
62 topMargin: units.gu(1);
63 left: parent.left;
63 left: parent.left;
tests/plugins/Dash/cardcreator/2.res.cardcreator−2
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
@@ -57,7 +56,6 @@ Row {
57 objectName: "outerRow";
56 objectName: "outerRow";
58 property real margins: units.gu(1);
57 property real margins: units.gu(1);
59 spacing: margins;
58 spacing: margins;
60− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
61 anchors { top: parent.top;
59 anchors { top: parent.top;
62 topMargin: units.gu(1);
60 topMargin: units.gu(1);
63 left: parent.left;
61 left: parent.left;
tests/plugins/Dash/cardcreator/3.res.cardcreator−1
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
tests/plugins/Dash/cardcreator/4.res+1−1
@@ -19,7 +19,7 @@ Row {
19 objectName: "outerRow";
19 objectName: "outerRow";
20 property real margins: units.gu(1);
20 property real margins: units.gu(1);
21 spacing: margins;
21 spacing: margins;
22− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
22+ height: root.fixedHeaderHeight;
23 anchors { top: parent.top;
23 anchors { top: parent.top;
24 topMargin: units.gu(1);
24 topMargin: units.gu(1);
25 left: parent.left;
25 left: parent.left;
tests/plugins/Dash/cardcreator/4.res.cardcreator−2
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
@@ -19,7 +18,6 @@ Row {
19 objectName: "outerRow";
18 objectName: "outerRow";
20 property real margins: units.gu(1);
19 property real margins: units.gu(1);
21 spacing: margins;
20 spacing: margins;
22− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
23 anchors { top: parent.top;
21 anchors { top: parent.top;
24 topMargin: units.gu(1);
22 topMargin: units.gu(1);
25 left: parent.left;
23 left: parent.left;
tests/plugins/Dash/cardcreator/5.res+1−1
@@ -89,7 +89,7 @@ Item {
89 }
89 }
90Loader {
90Loader {
91 id: overlayLoader;
91 id: overlayLoader;
92− readonly property real overlayHeight: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
92+ readonly property real overlayHeight: root.fixedHeaderHeight + units.gu(2);
93 anchors.fill: artShapeHolder;
93 anchors.fill: artShapeHolder;
94 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
94 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
95 asynchronous: true;
95 asynchronous: true;
tests/plugins/Dash/cardcreator/5.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
@@ -89,7 +88,7 @@ Item {
89 }
88 }
90Loader {
89Loader {
91 id: overlayLoader;
90 id: overlayLoader;
92− readonly property real overlayHeight: (fixedHeaderHeight > 0 ? fixedHeaderHeight : headerHeight) + units.gu(2);
91+ readonly property real overlayHeight: headerHeight + units.gu(2);
93 anchors.fill: artShapeHolder;
92 anchors.fill: artShapeHolder;
94 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
93 active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
95 asynchronous: false;
94 asynchronous: false;
tests/plugins/Dash/cardcreator/6.res.cardcreator−1
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
tests/plugins/Dash/cardcreator/7.res+1−1
@@ -57,7 +57,7 @@ Row {
57 objectName: "outerRow";
57 objectName: "outerRow";
58 property real margins: units.gu(1);
58 property real margins: units.gu(1);
59 spacing: margins;
59 spacing: margins;
60− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
60+ height: root.fixedHeaderHeight;
61 anchors { top: parent.top;
61 anchors { top: parent.top;
62 topMargin: units.gu(1);
62 topMargin: units.gu(1);
63 left: parent.left;
63 left: parent.left;
tests/plugins/Dash/cardcreator/7.res.cardcreator−2
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
@@ -57,7 +56,6 @@ Row {
57 objectName: "outerRow";
56 objectName: "outerRow";
58 property real margins: units.gu(1);
57 property real margins: units.gu(1);
59 spacing: margins;
58 spacing: margins;
60− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
61 anchors { top: parent.top;
59 anchors { top: parent.top;
62 topMargin: units.gu(1);
60 topMargin: units.gu(1);
63 left: parent.left;
61 left: parent.left;
tests/plugins/Dash/cardcreator/8.res+1−1
@@ -57,7 +57,7 @@ Row {
57 objectName: "outerRow";
57 objectName: "outerRow";
58 property real margins: units.gu(1);
58 property real margins: units.gu(1);
59 spacing: margins;
59 spacing: margins;
60− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
60+ height: root.fixedHeaderHeight;
61 anchors { top: parent.top;
61 anchors { top: parent.top;
62 topMargin: units.gu(1);
62 topMargin: units.gu(1);
63left: parent.left;
63left: parent.left;
tests/plugins/Dash/cardcreator/8.res.cardcreator−2
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
@@ -57,7 +56,6 @@ Row {
57 objectName: "outerRow";
56 objectName: "outerRow";
58 property real margins: units.gu(1);
57 property real margins: units.gu(1);
59 spacing: margins;
58 spacing: margins;
60− height: root.fixedHeaderHeight != -1 ? root.fixedHeaderHeight : implicitHeight;
61 anchors { top: parent.top;
59 anchors { top: parent.top;
62 topMargin: units.gu(1);
60 topMargin: units.gu(1);
63left: parent.left;
61left: parent.left;
tests/plugins/Dash/cardcreator/9.res+1−1
@@ -70,7 +70,7 @@ CardAudioProgress {
70 id: audioButton;
70 id: audioButton;
71 anchors.fill: undefined;
71 anchors.fill: undefined;
72 width: height;
72 width: height;
73− height: (root.fixedHeaderHeight > 0 ? root.fixedHeaderHeight : headerHeight) + 2 * units.gu(1);
73+ height: root.fixedHeaderHeight + 2 * units.gu(1);
74 readonly property url source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || "";
74 readonly property url source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || "";
75 UbuntuShape {
75 UbuntuShape {
76 anchors.fill: parent;
76 anchors.fill: parent;
tests/plugins/Dash/cardcreator/9.res.cardcreator+1−2
@@ -5,7 +5,6 @@ AbstractButton {
5 property string backgroundShapeStyle: "inset";
5 property string backgroundShapeStyle: "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 fixedHeaderHeight: -1;
9 property size fixedArtShapeSize: Qt.size(-1, -1);
8 property size fixedArtShapeSize: Qt.size(-1, -1);
10 readonly property string title: cardData && cardData["title"] || "";
9 readonly property string title: cardData && cardData["title"] || "";
11 property bool showHeader: true;
10 property bool showHeader: true;
@@ -70,7 +69,7 @@ CardAudioProgress {
70 id: audioButton;
69 id: audioButton;
71 anchors.fill: undefined;
70 anchors.fill: undefined;
72 width: height;
71 width: height;
73− height: (root.fixedHeaderHeight > 0 ? root.fixedHeaderHeight : headerHeight) + 2 * units.gu(1);
72+ height: headerHeight + 2 * units.gu(1);
74 readonly property url source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || "";
73 readonly property url source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || "";
75 UbuntuShape {
74 UbuntuShape {
76 anchors.fill: parent;
75 anchors.fill: parent;