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