on xenial help sign in
Concierge mode generated code optimization
15626feAlbert 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 }';
@@ -505,18 +501,21 @@ function cardString(template, components, isCardTool, artShapeStyle) {
505 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
501 fallbackURICode = 'decodeURI("%1")'.arg(fallback);
506 }
502 }
507 var artShapeHolderShapeCode;
503 var artShapeHolderShapeCode;
504+ if (!isConciergeMode) {
508− if (artShapeStyle === "icon") {
505+ if (artShapeStyle === "icon") {
509− artShapeHolderShapeCode = kArtProportionalShapeCode.arg(isConciergeMode ? "false" : "true");
506+ artShapeHolderShapeCode = kArtProportionalShapeCode;
510− } else {
507+ } else {
511− var artShapeHolderShapeAspect;
508+ var artShapeHolderShapeAspect;
512− switch (artShapeStyle) {
509+ switch (artShapeStyle) {
513− case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break;
510+ case "inset": artShapeHolderShapeAspect = "UbuntuShape.Inset"; break;
514− case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break;
511+ case "shadow": artShapeHolderShapeAspect = "UbuntuShape.DropShadow"; break;
515− default:
512+ default:
516− case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break;
513+ case "flat": artShapeHolderShapeAspect = "UbuntuShape.Flat"; break;
514+ }
515+ artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(artShapeHolderShapeAspect);
517 }
516 }
517+ } else {
518− artShapeHolderShapeCode = kArtUbuntuShapeCode.arg(isConciergeMode ? "false" : "true")
518+ artShapeHolderShapeCode = "";
519− .arg(artShapeHolderShapeAspect);
520 }
519 }
521 code += kArtShapeHolderCode.arg(artAnchors)
520 code += kArtShapeHolderCode.arg(artAnchors)
522 .arg(widthCode)
521 .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/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(); }