on xenial help sign in
Concierge mode generated code optimization
4a9e68aAlbert Astals Cid
plugins/Dash/CardCreator.js+16−17
@@ -59,21 +59,17 @@ var kBackgroundLoaderCode = 'Loader {\n\
59 } \n\
59 } \n\
60 }\n';
60 }\n';
61
61
62−// %1 is the visible code
63−// %2 is the aspect of the UbuntuShape
62+// %1 is the aspect of the UbuntuShape
64var kArtUbuntuShapeCode = 'UbuntuShape { \n\
63var kArtUbuntuShapeCode = 'UbuntuShape { \n\
65 anchors.fill: parent; \n\
64 anchors.fill: parent; \n\
66− visible: %1; \n\
67 source: artImage; \n\
65 source: artImage; \n\
68 sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\
66 sourceFillMode: UbuntuShape.PreserveAspectCrop; \n\
69 radius: "medium"; \n\
67 radius: "medium"; \n\
70− aspect: %2; \n\
68+ aspect: %1; \n\
71 }';
69 }';
72
70
73−// %1 is the visible code
74var kArtProportionalShapeCode = 'ProportionalShape { \n\
71var kArtProportionalShapeCode = 'ProportionalShape { \n\
75 anchors.fill: parent; \n\
72 anchors.fill: parent; \n\
76− visible: %1; \n\
77 source: artImage; \n\
73 source: artImage; \n\
78 aspect: UbuntuShape.DropShadow; \n\
74 aspect: UbuntuShape.DropShadow; \n\
79 }';
75 }';
@@ -520,18 +516,21 @@ function cardString(template, components, isCardTool, artShapeStyle) {
520 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
516 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
521 }
517 }
522 var artShapeHolderShapeCode;
518 var artShapeHolderShapeCode;
519+ if (!isConciergeMode) {
523− if (artShapeStyle === "icon") {
520+ if (artShapeStyle === "icon") {
524− artShapeHolderShapeCode = kArtProportionalShapeCode.arg(isConciergeMode ? "false" : "true");
521+ artShapeHolderShapeCode = kArtProportionalShapeCode;
525− } else {
522+ } else {
526− var artShapeHolderShapeAspect;
523+ var artShapeHolderShapeAspect;
527− switch (artShapeStyle) {
524+ switch (artShapeStyle) {
528− case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break;
525+ case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break;
529− case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break;
526+ case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break;
530− default:
527+ default:
531− case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break;
528+ case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break;
529+ }
530+ artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(artShapeHolderShapeAspect);
532 }
531 }
532+ } else {
533− artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(isConciergeMode ? "false" : "true")
533+ artShapeHolderShapeCode = "";
534− .arg(artShapeHolderShapeAspect);
535 }
534 }
536 code += kArtShapeHolderCode.arg(artAnchors)
535 code += kArtShapeHolderCode.arg(artAnchors)
537 .arg(widthCode)
536 .arg(widthCode)
tests/plugins/Dash/cardcreator/1.res−1
@@ -31,7 +31,6 @@ Item {
31 readonly property alias image: artImage;
31 readonly property alias image: artImage;
32 UbuntuShape {
32 UbuntuShape {
33 anchors.fill: parent;
33 anchors.fill: parent;
34− visible: true;
35 source: artImage;
34 source: artImage;
36 sourceFillMode: UbuntuShape.PreserveAspectCrop;
35 sourceFillMode: UbuntuShape.PreserveAspectCrop;
37 radius: "medium";
36 radius: "medium";
tests/plugins/Dash/cardcreator/1.res.cardcreator−1
@@ -30,7 +30,6 @@ Item {
30 readonly property alias image: artImage;
30 readonly property alias image: artImage;
31 UbuntuShape {
31 UbuntuShape {
32 anchors.fill: parent;
32 anchors.fill: parent;
33− visible: true;
34 source: artImage;
33 source: artImage;
35 sourceFillMode: UbuntuShape.PreserveAspectCrop;
34 sourceFillMode: UbuntuShape.PreserveAspectCrop;
36 radius: "medium";
35 radius: "medium";
tests/plugins/Dash/cardcreator/11.res−1
@@ -69,7 +69,6 @@ Item {
69 readonly property alias image: artImage;
69 readonly property alias image: artImage;
70 UbuntuShape {
70 UbuntuShape {
71 anchors.fill: parent;
71 anchors.fill: parent;
72− visible: true;
73 source: artImage;
72 source: artImage;
74 sourceFillMode: UbuntuShape.PreserveAspectCrop;
73 sourceFillMode: UbuntuShape.PreserveAspectCrop;
75 radius: "medium";
74 radius: "medium";
tests/plugins/Dash/cardcreator/11.res.cardcreator−1
@@ -68,7 +68,6 @@ Item {
68 readonly property alias image: artImage;
68 readonly property alias image: artImage;
69 UbuntuShape {
69 UbuntuShape {
70 anchors.fill: parent;
70 anchors.fill: parent;
71− visible: true;
72 source: artImage;
71 source: artImage;
73 sourceFillMode: UbuntuShape.PreserveAspectCrop;
72 sourceFillMode: UbuntuShape.PreserveAspectCrop;
74 radius: "medium";
73 radius: "medium";
tests/plugins/Dash/cardcreator/12.res−1
@@ -31,7 +31,6 @@ Item {
31 readonly property alias image: artImage;
31 readonly property alias image: artImage;
32 UbuntuShape {
32 UbuntuShape {
33 anchors.fill: parent;
33 anchors.fill: parent;
34− visible: true;
35 source: artImage;
34 source: artImage;
36 sourceFillMode: UbuntuShape.PreserveAspectCrop;
35 sourceFillMode: UbuntuShape.PreserveAspectCrop;
37 radius: "medium";
36 radius: "medium";
tests/plugins/Dash/cardcreator/12.res.cardcreator−1
@@ -30,7 +30,6 @@ Item {
30 readonly property alias image: artImage;
30 readonly property alias image: artImage;
31 UbuntuShape {
31 UbuntuShape {
32 anchors.fill: parent;
32 anchors.fill: parent;
33− visible: true;
34 source: artImage;
33 source: artImage;
35 sourceFillMode: UbuntuShape.PreserveAspectCrop;
34 sourceFillMode: UbuntuShape.PreserveAspectCrop;
36 radius: "medium";
35 radius: "medium";
tests/plugins/Dash/cardcreator/3.res−1
@@ -31,7 +31,6 @@ Item {
31 readonly property alias image: artImage;
31 readonly property alias image: artImage;
32 ProportionalShape {
32 ProportionalShape {
33 anchors.fill: parent;
33 anchors.fill: parent;
34− visible: true;
35 source: artImage;
34 source: artImage;
36 aspect: UbuntuShape.DropShadow;
35 aspect: UbuntuShape.DropShadow;
37 }
36 }
tests/plugins/Dash/cardcreator/3.res.cardcreator−1
@@ -30,7 +30,6 @@ Item {
30 readonly property alias image: artImage;
30 readonly property alias image: artImage;
31 ProportionalShape {
31 ProportionalShape {
32 anchors.fill: parent;
32 anchors.fill: parent;
33− visible: true;
34 source: artImage;
33 source: artImage;
35 aspect: UbuntuShape.DropShadow;
34 aspect: UbuntuShape.DropShadow;
36 }
35 }
tests/plugins/Dash/cardcreator/5.res−8
@@ -29,14 +29,6 @@ Item {
29 objectName: "artShape";
29 objectName: "artShape";
30 visible: image.status == Image.Ready;
30 visible: image.status == Image.Ready;
31 readonly property alias image: artImage;
31 readonly property alias image: artImage;
32− UbuntuShape {
33− anchors.fill: parent;
34− visible: false;
35− source: artImage;
36− sourceFillMode: UbuntuShape.PreserveAspectCrop;
37− radius: "medium";
38− aspect: UbuntuShape.DropShadow;
39− }
40 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
32 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
41 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
33 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
42 Component.onCompleted: { updateWidthHeightBindings(); }
34 Component.onCompleted: { updateWidthHeightBindings(); }
tests/plugins/Dash/cardcreator/5.res.cardcreator−8
@@ -28,14 +28,6 @@ Item {
28 objectName: "artShape";
28 objectName: "artShape";
29 visible: image.status == Image.Ready;
29 visible: image.status == Image.Ready;
30 readonly property alias image: artImage;
30 readonly property alias image: artImage;
31− UbuntuShape {
32− anchors.fill: parent;
33− visible: false;
34− source: artImage;
35− sourceFillMode: UbuntuShape.PreserveAspectCrop;
36− radius: "medium";
37− aspect: UbuntuShape.DropShadow;
38− }
39 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
31 readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
40 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
32 readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
41 Component.onCompleted: { updateWidthHeightBindings(); }
33 Component.onCompleted: { updateWidthHeightBindings(); }