Changeset View
Changeset View
Standalone View
Standalone View
src/qml/ListBrowserDelegate.qml
Show All 34 Lines | 26 | FocusScope { | |||
---|---|---|---|---|---|
35 | property url imageUrl | 35 | property url imageUrl | ||
36 | property int trackNumber | 36 | property int trackNumber | ||
37 | property int discNumber | 37 | property int discNumber | ||
38 | property int rating | 38 | property int rating | ||
39 | property bool isSingleDiscAlbum | 39 | property bool isSingleDiscAlbum | ||
40 | property bool isSelected | 40 | property bool isSelected | ||
41 | property bool isAlternateColor | 41 | property bool isAlternateColor | ||
42 | property bool detailedView: true | 42 | property bool detailedView: true | ||
43 | 43 | | |||
astippich: you don't seem to use it, please remove | |||||
44 | signal clicked() | 44 | signal clicked() | ||
45 | signal enqueue(var databaseId, var name) | 45 | signal enqueue(var databaseId, var name) | ||
46 | signal replaceAndPlay(var databaseId, var name) | 46 | signal replaceAndPlay(var databaseId, var name) | ||
47 | signal callOpenMetaDataView(var databaseId) | ||||
astippich: please give this a more common name, like openMetaDataView | |||||
47 | 48 | | |||
48 | Accessible.role: Accessible.ListItem | 49 | Accessible.role: Accessible.ListItem | ||
49 | Accessible.name: title | 50 | Accessible.name: title | ||
50 | Accessible.description: title | 51 | Accessible.description: title | ||
51 | 52 | | |||
52 | Action { | 53 | Action { | ||
53 | id: enqueueAction | 54 | id: enqueueAction | ||
54 | text: i18nc("Enqueue current track", "Enqueue") | 55 | text: i18nc("Enqueue current track", "Enqueue") | ||
55 | icon.name: "list-add" | 56 | icon.name: "list-add" | ||
56 | onTriggered: enqueue(databaseId, title) | 57 | onTriggered: enqueue(databaseId, title) | ||
57 | } | 58 | } | ||
58 | 59 | | |||
59 | Action { | 60 | Action { | ||
60 | id: viewDetailsAction | 61 | id: viewDetailsAction | ||
61 | text: i18nc("Show track metadata", "View Details") | 62 | text: i18nc("Show track metadata", "View Details") | ||
62 | icon.name: "help-about" | 63 | icon.name: "help-about" | ||
63 | onTriggered: { | 64 | onTriggered: { | ||
64 | if (metadataLoader.active === false) { | 65 | callOpenMetaDataView(databaseId) | ||
65 | metadataLoader.active = true | | |||
66 | } | | |||
67 | else { | | |||
68 | metadataLoader.item.close(); | | |||
69 | metadataLoader.active = false | | |||
70 | } | | |||
71 | } | 66 | } | ||
72 | } | 67 | } | ||
73 | 68 | | |||
74 | Action { | 69 | Action { | ||
75 | id: replaceAndPlayAction | 70 | id: replaceAndPlayAction | ||
76 | text: i18nc("Clear play list and enqueue current track", "Play Now and Replace Play List") | 71 | text: i18nc("Clear play list and enqueue current track", "Play Now and Replace Play List") | ||
77 | icon.name: "media-playback-start" | 72 | icon.name: "media-playback-start" | ||
78 | onTriggered: replaceAndPlay(databaseId, title) | 73 | onTriggered: replaceAndPlay(databaseId, title) | ||
79 | } | 74 | } | ||
80 | 75 | | |||
81 | Keys.onReturnPressed: enqueue(databaseId, title) | 76 | Keys.onReturnPressed: enqueue(databaseId, title) | ||
82 | Keys.onEnterPressed: enqueue(databaseId, title) | 77 | Keys.onEnterPressed: enqueue(databaseId, title) | ||
83 | 78 | | |||
84 | Loader { | | |||
85 | id: metadataLoader | | |||
86 | active: false | | |||
87 | onLoaded: item.show() | | |||
88 | | ||||
89 | sourceComponent: MediaTrackMetadataView { | | |||
90 | databaseId: mediaTrack.databaseId | | |||
91 | onRejected: metadataLoader.active = false; | | |||
92 | } | | |||
93 | } | | |||
94 | | ||||
95 | Rectangle { | 79 | Rectangle { | ||
96 | id: rowRoot | 80 | id: rowRoot | ||
97 | 81 | | |||
98 | anchors.fill: parent | 82 | anchors.fill: parent | ||
99 | z: 1 | 83 | z: 1 | ||
100 | 84 | | |||
101 | color: (isAlternateColor ? myPalette.alternateBase : myPalette.base) | 85 | color: (isAlternateColor ? myPalette.alternateBase : myPalette.base) | ||
102 | } | 86 | } | ||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | 193 | ColumnLayout { | |||
214 | Layout.alignment: Qt.AlignLeft | 198 | Layout.alignment: Qt.AlignLeft | ||
215 | 199 | | |||
216 | spacing: 0 | 200 | spacing: 0 | ||
217 | 201 | | |||
218 | LabelWithToolTip { | 202 | LabelWithToolTip { | ||
219 | id: mainLabelDetailed | 203 | id: mainLabelDetailed | ||
220 | 204 | | |||
221 | text: { | 205 | text: { | ||
222 | if (trackNumber !== 0) { | 206 | if (trackNumber >= 0) { | ||
Tracks can have negative numbers I believe @astippich can you confirm ? mgallien: Tracks can have negative numbers I believe @astippich can you confirm ? | |||||
No, tracks can only be positive, but zero is actually valid. So the correct check here is >= 0 astippich: No, tracks can only be positive, but zero is actually valid. So the correct check here is >= 0 | |||||
Thanks, I was not sure if special/hidden tracks would have a negative number. mgallien: Thanks, I was not sure if special/hidden tracks would have a negative number. | |||||
223 | return i18nc("%1: track number. %2: track title", "%1 - %2", | 207 | return i18nc("%1: track number. %2: track title", "%1 - %2", | ||
224 | trackNumber.toLocaleString(Qt.locale(), 'f', 0), title); | 208 | trackNumber.toLocaleString(Qt.locale(), 'f', 0), title); | ||
225 | } else { | 209 | } else { | ||
226 | return title; | 210 | return title; | ||
227 | } | 211 | } | ||
228 | } | 212 | } | ||
229 | 213 | | |||
230 | horizontalAlignment: Text.AlignLeft | 214 | horizontalAlignment: Text.AlignLeft | ||
Show All 19 Lines | 232 | LabelWithToolTip { | |||
250 | 234 | | |||
251 | text: { | 235 | text: { | ||
252 | var labelText = "" | 236 | var labelText = "" | ||
253 | if (artist) { | 237 | if (artist) { | ||
254 | labelText += artist | 238 | labelText += artist | ||
255 | } | 239 | } | ||
256 | if (album !== '') { | 240 | if (album !== '') { | ||
257 | labelText += ' - ' + album | 241 | labelText += ' - ' + album | ||
258 | if (!isSingleDiscAlbum) { | 242 | if (!isSingleDiscAlbum && discNumber !== -1) { | ||
259 | labelText += ' - CD ' + discNumber | 243 | labelText += ' - CD ' + discNumber | ||
260 | } | 244 | } | ||
261 | } | 245 | } | ||
262 | return labelText; | 246 | return labelText; | ||
263 | } | 247 | } | ||
264 | horizontalAlignment: Text.AlignLeft | 248 | horizontalAlignment: Text.AlignLeft | ||
265 | 249 | | |||
266 | font.weight: Font.Light | 250 | font.weight: Font.Light | ||
▲ Show 20 Lines • Show All 194 Lines • Show Last 20 Lines |
you don't seem to use it, please remove