@@ -16,8 +16,8 @@ onArtShapeBorderSourceChanged: { if (artShapeBorderSource !== undefined && artSh
16readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
16readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
18 id: artShapeHolder;
18 id: artShapeHolder;
19− height: root.fixedArtShapeSize.height != -1 ? root.fixedArtShapeSize.height : artShapeLoader.height;
19+ height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
20− width: root.fixedArtShapeSize.width != -1 ? root.fixedArtShapeSize.width : artShapeLoader.width;
20+ width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
21 anchors { horizontalCenter: parent.horizontalCenter; }
21 anchors { horizontalCenter: parent.horizontalCenter; }
23 id: artShapeLoader;
23 id: artShapeLoader;
@@ -29,19 +29,24 @@ Item {
29 id: artShape;
29 id: artShape;
30 objectName: "artShape";
30 objectName: "artShape";
31 radius: "medium";
31 radius: "medium";
32− readonly property real aspect: components !== undefined ? components["art"]["aspect-ratio"] : 1;
33− readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
34− Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
35− onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
36 visible: image.status == Image.Ready;
32 visible: image.status == Image.Ready;
33+ readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
34+ readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : components !== undefined ? components["art"]["aspect-ratio"] : 1;
35+ readonly property bool aspectSmallerThanImageAspect: aspect < image.aspect;
36+ Component.onCompleted: { updateWidthHeightBindings(); if (artShapeBorderSource !== undefined) borderSource = artShapeBorderSource; }
37+ onAspectSmallerThanImageAspectChanged: updateWidthHeightBindings();
38+ Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
37− function updateWidthHeightBindings() {
39+ function updateWidthHeightBindings() {
40+ if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
41+ width = root.fixedArtShapeSize.width;
42+ height = root.fixedArtShapeSize.height;
38− if (aspectSmallerThanImageAspect) {
43+ } else if (aspectSmallerThanImageAspect) {
39− width = Qt.binding(function() { return !visible ? 0 : image.width });
44+ width = Qt.binding(function() { return !visible ? 0 : image.width });
40− height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
45+ height = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.height : width / image.aspect });
41− } else {
46+ } else {
42− width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
47+ width = Qt.binding(function() { return !visible ? 0 : image.fillMode === Image.PreserveAspectCrop ? image.width : height * image.aspect });
43− height = Qt.binding(function() { return !visible ? 0 : image.height });
48+ height = Qt.binding(function() { return !visible ? 0 : image.height });
46 image: Image {
51 image: Image {
47 objectName: "artImage";
52 objectName: "artImage";
@@ -68,7 +73,7 @@ Loader {
68 visible: showHeader && status == Loader.Ready;
73 visible: showHeader && status == Loader.Ready;
69 sourceComponent: ShaderEffect {
74 sourceComponent: ShaderEffect {
70 id: overlay;
75 id: overlay;
71− height: fixedHeaderHeight != -1 ? fixedHeaderHeight + units.gu(1) * 2 : headerHeight;
76+ height: fixedHeaderHeight > 0 ? fixedHeaderHeight + units.gu(1) * 2 : headerHeight;
72 opacity: 0.6;
77 opacity: 0.6;
73 property var source: ShaderEffectSource {
78 property var source: ShaderEffectSource {
74 id: shaderSource;
79 id: shaderSource;