~3v1n0/unity8/indicators-client-modernize

« back to all changes in this revision

Viewing changes to tests/plugins/Dash/cardcreator/5.res.cardcreator

  • Committer: Marco Trevisan (Treviño)
  • Date: 2016-09-08 16:48:59 UTC
  • mfrom: (2445.1.4 fake-indicators-model)
  • Revision ID: mail@3v1n0.net-20160908164859-9m8cqbb2ra0s02l6
Merging with lp:~3v1n0/unity8/fake-indicators-model

Show diffs side-by-side

added added

removed removed

Lines of Context:
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; 
11
10
                enabled: false;
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);
14
 
Item  { 
15
 
                            id: artShapeHolder; 
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; } 
19
 
                            Loader { 
 
13
Loader  {
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 {
28
23
                                    id: artShape;
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;
40
 
                                        } else {
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 });
43
 
                                        }
44
 
                                    }
 
27
                                    width: image.status !== Image.Ready ? 0 : image.width;
 
28
                                    height: image.status !== Image.Ready ? 0 : image.height;
45
29
                                    CroppedImageMinimumSourceSize {
46
30
                                        id: artImage;
47
31
                                        objectName: "artImage";
49
33
                                        asynchronous: false;
50
34
                                        visible: true;
51
35
                                        width: root.width;
52
 
                                        height: width / artShape.aspect;
 
36
                                        height: width / 1;
53
37
                                    }
54
38
                                } 
55
 
                            }
56
39
                        }
57
40
Loader { 
58
41
                            id: overlayLoader; 
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 { 
65
48
                                id: overlay; 
66
49
                                property real luminance: Style.luminance(overlayColor); 
112
95
                            text: cardData && cardData["subtitle"] || ""; 
113
96
                            font.weight: Font.Light; 
114
97
                        }
115
 
implicitHeight: artShapeHolder.height;
 
98
implicitHeight: artShapeLoader.height;
116
99
}