~saviq/unity8/build-arm64

« back to all changes in this revision

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

  • Committer: Michał Sawicz
  • Date: 2016-07-15 09:51:02 UTC
  • mfrom: (2400.1.142 unity8)
  • Revision ID: michal.sawicz@canonical.com-20160715095102-hf5ac4iqnfn1itpw
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
AbstractButton { 
2
2
                id: root; 
3
3
                property var cardData; 
4
 
                property string artShapeStyle: "inset"; 
5
4
                property string backgroundShapeStyle: "inset"; 
6
5
                property real fontScale: 1.0; 
7
6
                property var scopeStyle: null; 
 
7
                readonly property string title: cardData && cardData["title"] || "";
 
8
                property bool showHeader: true;
 
9
                implicitWidth: childrenRect.width;
 
10
                enabled: true;
8
11
                property int fixedHeaderHeight: -1; 
9
12
                property size fixedArtShapeSize: Qt.size(-1, -1); 
10
 
                readonly property string title: cardData && cardData["title"] || ""; 
11
 
                property bool showHeader: true; 
12
 
                implicitWidth: childrenRect.width; 
13
 
                enabled: true; 
14
13
signal action(var actionId);
15
14
Loader {
16
15
                                id: backgroundLoader; 
53
52
readonly property size artShapeSize: artShapeLoader.item ? Qt.size(artShapeLoader.item.width, artShapeLoader.item.height) : Qt.size(-1, -1);
54
53
Item { 
55
54
                            id: artShapeHolder; 
56
 
                            height: root.fixedArtShapeSize.height > 0 ? root.fixedArtShapeSize.height : artShapeLoader.height; 
57
 
                            width: root.fixedArtShapeSize.width > 0 ? root.fixedArtShapeSize.width : artShapeLoader.width; 
 
55
                            height: root.fixedArtShapeSize.height;
 
56
                            width: root.fixedArtShapeSize.width;
58
57
                            anchors { horizontalCenter: parent.horizontalCenter; } 
59
58
                            Loader { 
60
59
                                id: artShapeLoader; 
61
60
                                objectName: "artShapeLoader"; 
62
61
                                readonly property string cardArt: cardData && cardData["art"] || decodeURI("%5C");
 
62
                                onCardArtChanged: { if (item) { item.image.source = cardArt; } }
63
63
                                active: cardArt != "";
64
64
                                asynchronous: true;
65
65
                                visible: status == Loader.Ready; 
68
68
                                    objectName: "artShape"; 
69
69
                                    visible: image.status == Image.Ready; 
70
70
                                    readonly property alias image: artImage; 
71
 
                                    Loader { 
72
 
                                        anchors.fill: parent; 
73
 
                                        visible: true;
74
 
                                        sourceComponent: root.artShapeStyle === "icon" ? artShapeIconComponent : artShapeShapeComponent; 
75
 
                                        Component { 
76
 
                                            id: artShapeShapeComponent; 
77
 
                                            UbuntuShape { 
78
 
                                                source: artImage;
79
 
                                                sourceFillMode: UbuntuShape.PreserveAspectCrop; 
80
 
                                                radius: "medium"; 
81
 
                                                aspect: { 
82
 
                                                    switch (root.artShapeStyle) { 
83
 
                                                        case "inset": return UbuntuShape.Inset; 
84
 
                                                        case "shadow": return UbuntuShape.DropShadow; 
85
 
                                                        default: 
86
 
                                                        case "flat": return UbuntuShape.Flat; 
87
 
                                                    } 
88
 
                                                } 
89
 
                                            } 
90
 
                                        } 
91
 
                                        Component { 
92
 
                                            id: artShapeIconComponent; 
93
 
                                            ProportionalShape { source: artImage; aspect: UbuntuShape.DropShadow; }
94
 
                                        } 
95
 
                                    } 
96
 
                                    readonly property real fixedArtShapeSizeAspect: (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) ? root.fixedArtShapeSize.width / root.fixedArtShapeSize.height : -1; 
97
 
                                    readonly property real aspect: fixedArtShapeSizeAspect > 0 ? fixedArtShapeSizeAspect : 1;
98
 
                                    Component.onCompleted: { updateWidthHeightBindings(); } 
99
 
                                    Connections { target: root; onFixedArtShapeSizeChanged: updateWidthHeightBindings(); } 
100
 
                                    function updateWidthHeightBindings() { 
101
 
                                        if (root.fixedArtShapeSize.height > 0 && root.fixedArtShapeSize.width > 0) { 
102
 
                                            width = root.fixedArtShapeSize.width; 
103
 
                                            height = root.fixedArtShapeSize.height; 
104
 
                                        } else { 
105
 
                                            width = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.width }); 
106
 
                                            height = Qt.binding(function() { return image.status !== Image.Ready ? 0 : image.height }); 
107
 
                                        } 
108
 
                                    } 
109
 
                                    CroppedImageMinimumSourceSize { 
 
71
                                    UbuntuShape {
 
72
                                        anchors.fill: parent;
 
73
                                        source: artImage;
 
74
                                        sourceFillMode: UbuntuShape.PreserveAspectCrop;
 
75
                                        radius: "medium";
 
76
                                        aspect: UbuntuShape.Flat;
 
77
                                    }
 
78
                                    width: root.fixedArtShapeSize.width;
 
79
                                    height: root.fixedArtShapeSize.height;
 
80
                                    CroppedImageMinimumSourceSize {
110
81
                                        id: artImage; 
111
82
                                        objectName: "artImage"; 
112
83
                                        source: artShapeLoader.cardArt;
113
84
                                        asynchronous: true;
114
 
                                        visible: !true;
 
85
                                        visible: false;
115
86
                                        width: root.width; 
116
 
                                        height: width / artShape.aspect; 
 
87
                                        height: width / (root.fixedArtShapeSize.width / root.fixedArtShapeSize.height);
117
88
                                        onStatusChanged: if (status === Image.Error) source = decodeURI("%5C");
118
89
                                    } 
119
90
                                } 
199
170
                        id: touchdown; 
200
171
                        objectName: "touchdown"; 
201
172
                        anchors { fill: backgroundLoader } 
202
 
                        visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; 
 
173
                        visible: root.pressed;
203
174
                        radius: "medium"; 
204
175
                        borderSource: "radius_pressed.sci" 
205
176
                    }