4
4
property string backgroundShapeStyle: "inset";
5
5
property real fontScale: 1.0;
6
6
property var scopeStyle: null;
7
property size fixedArtShapeSize: Qt.size(-1, -1);
8
7
readonly property string title: cardData && cardData["title"] || "";
9
8
property bool showHeader: true;
10
9
implicitWidth: childrenRect.width;
12
11
signal action(var actionId);
13
12
readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
16
height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height;
17
width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width;
18
anchors { horizontalCenter: parent.horizontalCenter; }
20
14
id: artShapeLoader;
15
anchors { horizontalCenter: parent.horizontalCenter; }
21
16
objectName: "artShapeLoader";
22
17
readonly property string cardArt: cardData && cardData["art"] || "";
23
18
onCardArtChanged: { if (item) { item.image.source = cardArt; } }
24
19
active: cardArt != "";
25
20
asynchronous: false;
26
visible: status == Loader.Ready;
21
visible: status === Loader.Ready;
27
22
sourceComponent: Item {
29
24
objectName: "artShape";
30
visible: image.status == Image.Ready;
25
visible: image.status === Image.Ready;
31
26
readonly property alias image: artImage;
32
readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1;
33
readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
34
Component.onCompleted: { updateWidthHeightBindings(); }
35
Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); }
36
function updateWidthHeightBindings() {
37
if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) {
38
width = root.fixedArtShapeSize.width;
39
height = root.fixedArtShapeSize.height;
41
width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width });
42
height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height });
27
width: image.status !== Image.Ready ? 0 : image.width;
28
height: image.status !== Image.Ready ? 0 : image.height;
45
29
CroppedImageMinimumSourceSize {
47
31
objectName: "artImage";
49
33
asynchronous: false;
52
height: width / artShape.aspect;
59
42
readonly property real overlayHeight: headerHeight + units.gu(2);
60
anchors.fill: artShapeHolder;
43
anchors.fill: artShapeLoader;
61
44
active: artShapeLoader.active && artShapeLoader.item && artShapeLoader.item.image.status === Image.Ready || false;
62
45
asynchronous: false;
63
visible: showHeader && status == Loader.Ready;
46
visible: showHeader && status === Loader.Ready;
64
47
sourceComponent: UbuntuShapeOverlay {
66
49
property real luminance: Style.luminance(overlayColor);