@@ -1,183 +0,0 @@
1−/*
2− * Copyright 2015 Podbird Team
3− *
4− * This file is part of Podbird.
5− *
6− * Podbird is free software; you can redistribute it and/or modify
7− * it under the terms of the GNU General Public License as published by
8− * the Free Software Foundation; version 3.
9− *
10− * Podbird is distributed in the hope that it will be useful,
11− * but WITHOUT ANY WARRANTY; without even the implied warranty of
12− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13− * GNU General Public License for more details.
14− *
15− * You should have received a copy of the GNU General Public License
16− * along with this program. If not, see <http://www.gnu.org/licenses/>.
17− */
18−
19−import QtQuick 2.4
20−import QtQuick.Layouts 1.1
21−import Ubuntu.Components 1.3
22−
23−ListItem {
24− id: listDelegate
25−
26− // Public APIs
27− property bool expanded: false
28−
29− property string coverArt: ""
30−
31− property alias title: _title.text
32− property alias titleColor: _title.color
33− property alias subtitle: _subtitle.text
34−
35− property alias buttonText: _button.text
36− property alias buttonColor: _button.color
37−
38− property string description: ""
39−
40− property bool isDownloaded: false
41−
42− property bool showProgressBar: false
43− property bool isInDeterminateDownload: false
44− property real progress: 0
45−
46− signal buttonClicked()
47−
48− highlightColor: "Transparent"
49− divider.visible: false
50− height: mainColumn.height + units.gu(2)
51−
52− Column {
53− id: mainColumn
54−
55− anchors { left: parent.left; right: parent.right; margins: units.gu(2); verticalCenter: parent.verticalCenter }
56−
57− RowLayout {
58− id: mainRow
59−
60− width: parent.width
61− spacing: units.gu(2)
62−
63− Loader {
64− id: imgFrameLoader
65− visible: coverArt !== ""
66− sourceComponent: coverArt !== "" ? imgFrame : undefined
67− }
68−
69− Column {
70− id: detailColumn
71−
72− anchors.verticalCenter: parent.verticalCenter
73− Layout.fillWidth: true
74−
75− Label {
76− id: _title
77− textFormat: Text.PlainText
78− width: parent.width
79− maximumLineCount: 2
80− wrapMode: Text.WordWrap
81− elide: Text.ElideRight
82− color: podbird.appTheme.baseText
83− }
84−
85− Row {
86− height: _subtitle.height
87− visible: _subtitle.text
88− width: parent.width
89− spacing: units.gu(1)
90−
91− Loader {
92− id: downloadIconLoader
93− height: _subtitle.height
94− width: height
95− visible: isDownloaded
96− sourceComponent: downloadIcon
97− }
98−
99− Label {
100− id: _subtitle
101− width: parent.width
102− fontSize: "x-small"
103− elide: Text.ElideRight
104− color: podbird.appTheme.baseSubText
105− }
106− }
107− }
108−
109− Button {
110− id: _button
111− visible: text.length > 0
112− onClicked: {
113− listDelegate.buttonClicked();
114− }
115− }
116− }
117−
118− Item {
119− id: gapFiller2
120− height: showProgressBar || expanded ? units.gu(1) : 0
121− width: height
122− }
123−
124− Loader {
125− id: progressBarLoader
126− width: parent.width
127− height: showProgressBar ? units.dp(5) : 0
128− visible: sourceComponent !== undefined
129− sourceComponent: showProgressBar ? progressBar : undefined
130− }
131−
132− Loader {
133− id: descriptionLoader
134− width: parent.width
135− height: expanded && loaded ? item.contentHeight : 0
136− visible: sourceComponent !== undefined
137− sourceComponent: expanded ? _description : undefined
138− Behavior on height {
139− UbuntuNumberAnimation {
140− duration: UbuntuAnimation.BriskDuration
141− }
142− }
143− }
144− }
145−
146− Component {
147− id: imgFrame
148− Image {
149− height: width
150− width: units.gu(6)
151− source: coverArt
152− sourceSize { width: width; height: height }
153− }
154− }
155−
156− Component {
157− id: progressBar
158− CustomProgressBar {
159− indeterminateProgress: isInDeterminateDownload
160− progress: listDelegate.progress
161− }
162− }
163−
164− Component {
165− id: downloadIcon
166− Icon {
167− name: "attachment"
168− }
169− }
170−
171− Component {
172− id: _description
173− Label {
174− clip: true
175− text: description
176− wrapMode: Text.WordWrap
177− fontSize: "small"
178− color: podbird.appTheme.baseSubText
179− linkColor: podbird.appTheme.linkText
180− onLinkActivated: Qt.openUrlExternally(link)
181− }
182− }
183−}