Changeset View
Changeset View
Standalone View
Standalone View
src/qml/ListBrowserDelegate.qml
Show All 26 Lines | 26 | FocusScope { | |||
---|---|---|---|---|---|
27 | id: mediaTrack | 27 | id: mediaTrack | ||
28 | 28 | | |||
29 | property var databaseId | 29 | property var databaseId | ||
30 | property string title | 30 | property string title | ||
31 | property string artist | 31 | property string artist | ||
32 | property string album | 32 | property string album | ||
33 | property string albumArtist | 33 | property string albumArtist | ||
34 | property string duration | 34 | property string duration | ||
35 | property string fileName | ||||
35 | property url imageUrl | 36 | property url imageUrl | ||
36 | property int trackNumber | 37 | property int trackNumber | ||
37 | property int discNumber | 38 | property int discNumber | ||
38 | property int rating | 39 | property int rating | ||
39 | property bool hideDiscNumber | 40 | property bool hideDiscNumber | ||
40 | property bool isSelected | 41 | property bool isSelected | ||
41 | property bool isAlternateColor | 42 | property bool isAlternateColor | ||
42 | property bool detailedView: true | 43 | property bool detailedView: true | ||
44 | property string displayTitle: title ? title : fileName | ||||
43 | 45 | | |||
44 | signal clicked() | 46 | signal clicked() | ||
45 | signal enqueue(var databaseId, var name) | 47 | signal enqueue(var databaseId, var name) | ||
46 | signal replaceAndPlay(var databaseId, var name) | 48 | signal replaceAndPlay(var databaseId, var name) | ||
47 | signal callOpenMetaDataView(var databaseId) | 49 | signal callOpenMetaDataView(var databaseId) | ||
48 | 50 | | |||
49 | Accessible.role: Accessible.ListItem | 51 | Accessible.role: Accessible.ListItem | ||
50 | Accessible.name: title | 52 | Accessible.name: displayTitle | ||
51 | Accessible.description: title | 53 | Accessible.description: displayTitle | ||
52 | 54 | | |||
53 | Action { | 55 | Action { | ||
54 | id: enqueueAction | 56 | id: enqueueAction | ||
55 | text: i18nc("Enqueue current track", "Enqueue") | 57 | text: i18nc("Enqueue current track", "Enqueue") | ||
56 | icon.name: "list-add" | 58 | icon.name: "list-add" | ||
57 | onTriggered: enqueue(databaseId, title) | 59 | onTriggered: enqueue(databaseId, title) | ||
58 | } | 60 | } | ||
59 | 61 | | |||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | 109 | LabelWithToolTip { | |||
110 | visible: !detailedView | 112 | visible: !detailedView | ||
111 | 113 | | |||
112 | text: { | 114 | text: { | ||
113 | if (trackNumber !== 0) { | 115 | if (trackNumber !== 0) { | ||
114 | if (artist !== albumArtist) | 116 | if (artist !== albumArtist) | ||
115 | return i18nc("%1: track number. %2: track title. %3: artist name", | 117 | return i18nc("%1: track number. %2: track title. %3: artist name", | ||
116 | "<b>%1 - %2</b> - <i>%3</i>", | 118 | "<b>%1 - %2</b> - <i>%3</i>", | ||
117 | trackNumber.toLocaleString(Qt.locale(), 'f', 0), | 119 | trackNumber.toLocaleString(Qt.locale(), 'f', 0), | ||
118 | title, artist); | 120 | displayTitle, artist); | ||
119 | else | 121 | else | ||
120 | return i18nc("%1: track number. %2: track title.", | 122 | return i18nc("%1: track number. %2: track title.", | ||
121 | "<b>%1 - %2</b>", | 123 | "<b>%1 - %2</b>", | ||
122 | trackNumber.toLocaleString(Qt.locale(), 'f', 0), | 124 | trackNumber.toLocaleString(Qt.locale(), 'f', 0), | ||
123 | title); | 125 | displayTitle); | ||
124 | } else { | 126 | } else { | ||
125 | if (artist !== albumArtist) | 127 | if (artist !== albumArtist) | ||
126 | return i18nc("%1: track title. %2: artist name", | 128 | return i18nc("%1: track title. %2: artist name", | ||
127 | "<b>%1</b> - <i>%2</i>", | 129 | "<b>%1</b> - <i>%2</i>", | ||
128 | title, artist); | 130 | displayTitle, artist); | ||
129 | else | 131 | else | ||
130 | return i18nc("%1: track title", | 132 | return i18nc("%1: track title", | ||
131 | "<b>%1</b>", | 133 | "<b>%1</b>", | ||
132 | title); | 134 | displayTitle); | ||
133 | } | 135 | } | ||
134 | } | 136 | } | ||
135 | 137 | | |||
136 | elide: Text.ElideRight | 138 | elide: Text.ElideRight | ||
137 | horizontalAlignment: Text.AlignLeft | 139 | horizontalAlignment: Text.AlignLeft | ||
138 | 140 | | |||
139 | color: myPalette.text | 141 | color: myPalette.text | ||
140 | 142 | | |||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 195 | ColumnLayout { | |||
200 | spacing: 0 | 202 | spacing: 0 | ||
201 | 203 | | |||
202 | LabelWithToolTip { | 204 | LabelWithToolTip { | ||
203 | id: mainLabelDetailed | 205 | id: mainLabelDetailed | ||
204 | 206 | | |||
205 | text: { | 207 | text: { | ||
206 | if (trackNumber >= 0) { | 208 | if (trackNumber >= 0) { | ||
207 | return i18nc("%1: track number. %2: track title", "%1 - %2", | 209 | return i18nc("%1: track number. %2: track title", "%1 - %2", | ||
208 | trackNumber.toLocaleString(Qt.locale(), 'f', 0), title); | 210 | trackNumber.toLocaleString(Qt.locale(), 'f', 0), displayTitle); | ||
209 | } else { | 211 | } else { | ||
210 | return title; | 212 | return displayTitle; | ||
211 | } | 213 | } | ||
212 | } | 214 | } | ||
213 | 215 | | |||
214 | horizontalAlignment: Text.AlignLeft | 216 | horizontalAlignment: Text.AlignLeft | ||
215 | 217 | | |||
216 | font.weight: Font.Bold | 218 | font.weight: Font.Bold | ||
217 | color: myPalette.text | 219 | color: myPalette.text | ||
218 | 220 | | |||
▲ Show 20 Lines • Show All 226 Lines • Show Last 20 Lines |