~saviq/unity8/skip-logind-test

« back to all changes in this revision

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

  • Committer: CI Train Bot
  • Author(s): Albert Astals Cid, Michael Zanetti
  • Date: 2016-01-07 08:04:43 UTC
  • mfrom: (1757.3.53 audioCardSupport)
  • Revision ID: ci-train-bot@canonical.com-20160107080443-6khrb6nm9o075wl4
Introduce audio cards
Approved by: Michał Sawicz, Pawel Stolowski, Andrea Cimitan

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
AbstractButton { 
 
2
                id: root; 
 
3
                property var components; 
 
4
                property var cardData; 
 
5
                property string artShapeStyle: "inset"; 
 
6
                property real fontScale: 1.0; 
 
7
                property var scopeStyle: null; 
 
8
                property int titleAlignment: Text.AlignLeft; 
 
9
                property int fixedHeaderHeight: -1; 
 
10
                property size fixedArtShapeSize: Qt.size(-1, -1); 
 
11
                readonly property string title: cardData && cardData["title"] || ""; 
 
12
                property bool asynchronous: true; 
 
13
                property bool showHeader: true; 
 
14
                implicitWidth: childrenRect.width; 
 
15
                enabled: true; 
 
16
                
 
17
readonly property size artShapeSize: Qt.size(-1, -1);
 
18
readonly property int headerHeight: titleLabel.height + subtitleLabel.height + subtitleLabel.anchors.topMargin + audioProgressBar.height + audioProgressBar.anchors.topMargin;
 
19
Label { 
 
20
                        id: titleLabel; 
 
21
                        objectName: "titleLabel"; 
 
22
                        anchors { right: parent.right; 
 
23
rightMargin: units.gu(1); 
 
24
left: audioButton.right; 
 
25
                            leftMargin: units.gu(1);
 
26
top: parent.top; 
 
27
                                     topMargin: units.gu(1);
 
28
 } 
 
29
                        elide: Text.ElideRight; 
 
30
                        fontSize: "small"; 
 
31
                        wrapMode: Text.Wrap; 
 
32
                        maximumLineCount: 2; 
 
33
                        font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 
 
34
                        color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText; 
 
35
                        visible: showHeader ; 
 
36
                        width: undefined; 
 
37
                        text: root.title; 
 
38
                        font.weight: cardData && cardData["subtitle"] ? Font.DemiBold : Font.Normal; 
 
39
                        horizontalAlignment: root.titleAlignment; 
 
40
                    }
 
41
Label { 
 
42
                            id: subtitleLabel; 
 
43
                            objectName: "subtitleLabel"; 
 
44
                            anchors { left: titleLabel.left; 
 
45
                               leftMargin: titleLabel.leftMargin; 
 
46
rightMargin: units.gu(1); 
 
47
right: titleLabel.right; 
 
48
top: titleLabel.bottom;
 
49
 } 
 
50
                            anchors.topMargin: units.dp(2); 
 
51
                            elide: Text.ElideRight; 
 
52
                            maximumLineCount: 1; 
 
53
                            fontSize: "x-small"; 
 
54
                            font.pixelSize: Math.round(FontUtils.sizeToPixels(fontSize) * fontScale); 
 
55
                            color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText; 
 
56
                            visible: titleLabel.visible && titleLabel.text; 
 
57
                            text: cardData && cardData["subtitle"] || ""; 
 
58
                            font.weight: Font.Light; 
 
59
                        }
 
60
CardAudioProgress { 
 
61
                            id: audioProgressBar; 
 
62
                            duration: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["duration"]) || 0; 
 
63
                            source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || ""; 
 
64
                            anchors { 
 
65
                                bottom: audioButton.bottom; 
 
66
                                left: audioButton.right; 
 
67
                                right: parent.right; 
 
68
                                margins: units.gu(1); 
 
69
                            } 
 
70
                            color: root.scopeStyle ? root.scopeStyle.foreground : theme.palette.normal.baseText; 
 
71
                         }AbstractButton { 
 
72
                            id: audioButton; 
 
73
                            anchors.fill: undefined; 
 
74
                            width: height; 
 
75
                            height: (root.fixedHeaderHeight > 0 ? root.fixedHeaderHeight : headerHeight) + 2 * units.gu(1); 
 
76
                            readonly property url source: (cardData["quickPreviewData"] && cardData["quickPreviewData"]["uri"]) || ""; 
 
77
                            UbuntuShape { 
 
78
                                anchors.fill: parent; 
 
79
                                visible: parent.pressed; 
 
80
                                radius: "medium"; 
 
81
                            } 
 
82
                            Icon {  
 
83
                                anchors.fill: parent; 
 
84
                                anchors.margins: parent.height > units.gu(5) ? units.gu(2) : 0; 
 
85
                                opacity: 0.9; 
 
86
                                name: DashAudioPlayer.playing && AudioUrlComparer.compare(parent.source, DashAudioPlayer.currentSource) ? "media-playback-pause" : "media-playback-start"; 
 
87
                            } 
 
88
                            onClicked: { 
 
89
                                if (AudioUrlComparer.compare(source, DashAudioPlayer.currentSource)) { 
 
90
                                    if (DashAudioPlayer.playing) { 
 
91
                                        DashAudioPlayer.pause(); 
 
92
                                    } else { 
 
93
                                        DashAudioPlayer.play(); 
 
94
                                    } 
 
95
                                } else { 
 
96
                                    var playlist = (cardData["quickPreviewData"] && cardData["quickPreviewData"]["playlist"]) || null; 
 
97
                                    DashAudioPlayer.playSource(source, playlist); 
 
98
                                } 
 
99
                            } 
 
100
                            onPressAndHold: { 
 
101
                                root.pressAndHold(); 
 
102
                            } 
 
103
                        }UbuntuShape { 
 
104
                        id: touchdown; 
 
105
                        objectName: "touchdown"; 
 
106
                        anchors { fill: root } 
 
107
                        visible: root.artShapeStyle != "shadow" && root.artShapeStyle != "icon" && root.pressed; 
 
108
                        radius: "medium"; 
 
109
                        borderSource: "radius_pressed.sci" 
 
110
                    }
 
111
implicitHeight: audioButton.height;
 
112
}