Changeset View
Changeset View
Standalone View
Standalone View
src/PlayListEntry.qml
Show All 19 Lines | |||||
20 | import QtQuick 2.5 | 20 | import QtQuick 2.5 | ||
21 | import QtQuick.Layouts 1.2 | 21 | import QtQuick.Layouts 1.2 | ||
22 | import QtQuick.Controls 1.2 | 22 | import QtQuick.Controls 1.2 | ||
23 | import QtQuick.Window 2.2 | 23 | import QtQuick.Window 2.2 | ||
24 | import QtGraphicalEffects 1.0 | 24 | import QtGraphicalEffects 1.0 | ||
25 | import org.mgallien.QmlExtension 1.0 | 25 | import org.mgallien.QmlExtension 1.0 | ||
26 | 26 | | |||
27 | FocusScope { | 27 | FocusScope { | ||
28 | id: viewAlbumDelegate | 28 | id: playListEntry | ||
29 | 29 | | |||
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 var index | 34 | property var index | ||
35 | property var itemDecoration | 35 | property var itemDecoration | ||
36 | property alias duration : durationLabel.text | 36 | property alias duration : durationLabel.text | ||
Show All 10 Lines | |||||
47 | property var playListModel | 47 | property var playListModel | ||
48 | property var playListControler | 48 | property var playListControler | ||
49 | property var contextMenu | 49 | property var contextMenu | ||
50 | property alias clearPlayListAction: removeFromPlayList | 50 | property alias clearPlayListAction: removeFromPlayList | ||
51 | property alias playNowAction: playNow | 51 | property alias playNowAction: playNow | ||
52 | 52 | | |||
53 | signal startPlayback() | 53 | signal startPlayback() | ||
54 | 54 | | |||
55 | Action { | 55 | Action { | ||
56 | id: removeFromPlayList | 56 | id: removeFromPlayList | ||
57 | text: i18nc("Remove current track from play list", "Remove") | 57 | text: i18nc("Remove current track from play list", "Remove") | ||
58 | iconName: "list-remove" | 58 | iconName: "list-remove" | ||
59 | onTriggered: { | 59 | onTriggered: { | ||
60 | playListModel.removeRows(viewAlbumDelegate.index, 1) | 60 | playListModel.removeRows(playListEntry.index, 1) | ||
61 | } | 61 | } | ||
mgallien: What are you trying to achieve with this modification ? | |||||
this was moved from the playNow action so that it is always included when the startPlayback signal is emitted. This way draggableItem must only emit the signal of the playlistentry to change the playing title (see MediaPlaylistView). I can change this back and add a similar call in MediaPlaylistView if you prefer astippich: this was moved from the playNow action so that it is always included when the startPlayback… | |||||
62 | } | 62 | } | ||
63 | 63 | | |||
64 | Action { | 64 | Action { | ||
65 | id: playNow | 65 | id: playNow | ||
66 | text: i18nc("Play now current track from play list", "Play Now") | 66 | text: i18nc("Play now current track from play list", "Play Now") | ||
67 | iconName: "media-playback-start" | 67 | iconName: "media-playback-start" | ||
68 | enabled: !isPlaying && isValid | 68 | enabled: !(isPlaying == MediaPlayList.IsPlaying) && isValid | ||
69 | onTriggered: { | 69 | onTriggered: { | ||
70 | playListControler.switchTo(viewAlbumDelegate.index) | 70 | playListControler.switchTo(playListEntry.index) | ||
71 | viewAlbumDelegate.startPlayback() | 71 | playListEntry.startPlayback() | ||
72 | } | 72 | } | ||
73 | } | 73 | } | ||
74 | 74 | | |||
75 | Rectangle { | 75 | Rectangle { | ||
76 | id: entryBackground | 76 | id: entryBackground | ||
77 | 77 | | |||
78 | anchors.fill: parent | 78 | anchors.fill: parent | ||
79 | 79 | | |||
Show All 25 Lines | 103 | RowLayout { | |||
105 | 105 | | |||
106 | spacing: elisaTheme.layoutHorizontalMargin | 106 | spacing: elisaTheme.layoutHorizontalMargin | ||
107 | 107 | | |||
108 | anchors.fill: parent | 108 | anchors.fill: parent | ||
109 | 109 | | |||
110 | Image { | 110 | Image { | ||
111 | id: mainIcon | 111 | id: mainIcon | ||
112 | 112 | | |||
113 | source: (isValid ? (viewAlbumDelegate.itemDecoration ? viewAlbumDelegate.itemDecoration : Qt.resolvedUrl(elisaTheme.albumCover)) : Qt.resolvedUrl(elisaTheme.errorIcon)) | 113 | source: (isValid ? (playListEntry.itemDecoration ? playListEntry.itemDecoration : Qt.resolvedUrl(elisaTheme.albumCover)) : Qt.resolvedUrl(elisaTheme.errorIcon)) | ||
114 | 114 | | |||
115 | Layout.minimumWidth: headerRow.height - 4 | 115 | Layout.minimumWidth: headerRow.height - 4 | ||
116 | Layout.maximumWidth: headerRow.height - 4 | 116 | Layout.maximumWidth: headerRow.height - 4 | ||
117 | Layout.preferredWidth: headerRow.height - 4 | 117 | Layout.preferredWidth: headerRow.height - 4 | ||
118 | Layout.minimumHeight: headerRow.height - 4 | 118 | Layout.minimumHeight: headerRow.height - 4 | ||
119 | Layout.maximumHeight: headerRow.height - 4 | 119 | Layout.maximumHeight: headerRow.height - 4 | ||
120 | Layout.preferredHeight: headerRow.height - 4 | 120 | Layout.preferredHeight: headerRow.height - 4 | ||
121 | Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter | 121 | Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter | ||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | 200 | RowLayout { | |||
207 | LabelWithToolTip { | 207 | LabelWithToolTip { | ||
208 | id: mainCompactLabel | 208 | id: mainCompactLabel | ||
209 | 209 | | |||
210 | text: ((discNumber && !isSingleDiscAlbum) ? discNumber + ' - ' + trackNumber : trackNumber) + ' - ' + title | 210 | text: ((discNumber && !isSingleDiscAlbum) ? discNumber + ' - ' + trackNumber : trackNumber) + ' - ' + title | ||
211 | 211 | | |||
212 | font.weight: (isPlaying ? Font.Bold : Font.Normal) | 212 | font.weight: (isPlaying ? Font.Bold : Font.Normal) | ||
213 | color: myPalette.text | 213 | color: myPalette.text | ||
214 | 214 | | |||
215 | Layout.maximumWidth: mainCompactLabel.implicitWidth + 1 | ||||
mgallien: Please add space around the operator + . | |||||
215 | Layout.fillWidth: true | 216 | Layout.fillWidth: true | ||
216 | Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft | 217 | Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft | ||
217 | 218 | | |||
mgallien: Add back the extra line, please. | |||||
218 | visible: isValid | 219 | visible: isValid | ||
219 | 220 | | |||
220 | elide: Text.ElideRight | 221 | elide: Text.ElideRight | ||
221 | } | 222 | } | ||
222 | 223 | | |||
mgallien: Add back the extra line, please. | |||||
223 | LabelWithToolTip { | 224 | LabelWithToolTip { | ||
224 | id: mainInvalidCompactLabel | 225 | id: mainInvalidCompactLabel | ||
225 | 226 | | |||
226 | text: title | 227 | text: title | ||
227 | 228 | | |||
228 | font.weight: Font.Normal | 229 | font.weight: Font.Normal | ||
229 | color: myPalette.text | 230 | color: myPalette.text | ||
230 | 231 | | |||
231 | Layout.fillWidth: true | 232 | Layout.fillWidth: true | ||
232 | Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft | 233 | Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft | ||
233 | 234 | | |||
234 | visible: !isValid | 235 | visible: !isValid | ||
235 | 236 | | |||
236 | elide: Text.ElideRight | 237 | elide: Text.ElideRight | ||
237 | } | 238 | } | ||
238 | 239 | | |||
239 | Item { Layout.fillWidth: true } | 240 | Item { | ||
241 | Layout.fillWidth: true | ||||
242 | Layout.preferredWidth: 0 | ||||
243 | } | ||||
240 | 244 | | |||
241 | ToolButton { | 245 | ToolButton { | ||
242 | id: playNowButton | 246 | id: playNowButton | ||
243 | 247 | | |||
244 | implicitHeight: elisaTheme.smallDelegateToolButtonSize | 248 | implicitHeight: elisaTheme.smallDelegateToolButtonSize | ||
245 | implicitWidth: elisaTheme.smallDelegateToolButtonSize | 249 | implicitWidth: elisaTheme.smallDelegateToolButtonSize | ||
246 | 250 | | |||
247 | opacity: 0 | 251 | opacity: 0 | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | |||||
332 | } | 336 | } | ||
333 | } | 337 | } | ||
334 | } | 338 | } | ||
335 | } | 339 | } | ||
336 | 340 | | |||
337 | states: [ | 341 | states: [ | ||
338 | State { | 342 | State { | ||
339 | name: 'notSelected' | 343 | name: 'notSelected' | ||
340 | when: !containsMouse && (!viewAlbumDelegate.activeFocus || !isSelected) | 344 | when: !containsMouse && (!playListEntry.activeFocus || !isSelected) | ||
341 | PropertyChanges { | 345 | PropertyChanges { | ||
342 | target: viewAlbumDelegate | 346 | target: playListEntry | ||
343 | height: (hasAlbumHeader ? elisaTheme.delegateWithHeaderHeight : elisaTheme.delegateHeight) | 347 | height: (hasAlbumHeader ? elisaTheme.delegateWithHeaderHeight : elisaTheme.delegateHeight) | ||
344 | } | 348 | } | ||
345 | PropertyChanges { | 349 | PropertyChanges { | ||
346 | target: removeButton | 350 | target: removeButton | ||
347 | opacity: 0 | 351 | opacity: 0 | ||
348 | } | 352 | } | ||
349 | PropertyChanges { | 353 | PropertyChanges { | ||
350 | target: playNowButton | 354 | target: playNowButton | ||
351 | opacity: 0 | 355 | opacity: 0 | ||
352 | } | 356 | } | ||
353 | PropertyChanges { | 357 | PropertyChanges { | ||
354 | target: entryBackground | 358 | target: entryBackground | ||
355 | color: (isAlternateColor ? myPalette.alternateBase : myPalette.base) | 359 | color: (isAlternateColor ? myPalette.alternateBase : myPalette.base) | ||
356 | } | 360 | } | ||
357 | }, | 361 | }, | ||
358 | State { | 362 | State { | ||
359 | name: 'hoveredOrSelected' | 363 | name: 'hoveredOrSelected' | ||
360 | when: containsMouse || (viewAlbumDelegate.activeFocus && isSelected) | 364 | when: containsMouse || (playListEntry.activeFocus && isSelected) | ||
361 | PropertyChanges { | 365 | PropertyChanges { | ||
362 | target: viewAlbumDelegate | 366 | target: playListEntry | ||
363 | height: (hasAlbumHeader ? elisaTheme.delegateWithHeaderHeight : elisaTheme.delegateHeight) | 367 | height: (hasAlbumHeader ? elisaTheme.delegateWithHeaderHeight : elisaTheme.delegateHeight) | ||
364 | } | 368 | } | ||
365 | PropertyChanges { | 369 | PropertyChanges { | ||
366 | target: removeButton | 370 | target: removeButton | ||
367 | opacity: 1 | 371 | opacity: 1 | ||
368 | } | 372 | } | ||
369 | PropertyChanges { | 373 | PropertyChanges { | ||
370 | target: playNowButton | 374 | target: playNowButton | ||
Show All 23 Lines |
What are you trying to achieve with this modification ?