vlc | branch: master | Prince Gupta <guptaprince8...@gmail.com> | Mon Dec 21 
20:44:30 2020 +0530| [a09434f0c1f6b39f968dffa0a7253298f5d30e06] | committer: 
Pierre Lamot

qml: don't use Widgets.ListItem as delegate for Music Artist list

ListItem does more than required and follows old designs

Signed-off-by: Pierre Lamot <pie...@videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a09434f0c1f6b39f968dffa0a7253298f5d30e06
---

 .../gui/qt/medialibrary/qml/MusicArtistsAlbums.qml | 79 ++++++++++++++--------
 1 file changed, 50 insertions(+), 29 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml 
b/modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
index 27fdaeee90..31a26d5570 100644
--- a/modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
@@ -138,19 +138,28 @@ Widgets.NavigableFocusScope {
                 topPadding: VLCStyle.margin_normal
             }
 
-            delegate: Widgets.ListItem {
-                height: VLCStyle.play_cover_small + (VLCStyle.margin_xsmall * 
2)
-                width: artistList.width
+            delegate: Rectangle {
+                id: item
 
-                property bool selected: artistList.currentIndex === index
-                property bool _highlighted: selected || this.hovered || 
this.activeFocus
+                property bool _highlighted: mouseArea.containsMouse || 
this.activeFocus
 
-                color: VLCStyle.colors.getBgColor(selected, this.hovered, 
this.activeFocus)
+                height: VLCStyle.play_cover_small + (VLCStyle.margin_xsmall * 
2)
+                width: artistList.width
+                color: _highlighted ? VLCStyle.colors.bgHover : "transparent"
 
-                cover: Item {
+                Widgets.CurrentIndicator {
+                   visible: item.ListView.isCurrentItem
+                }
 
-                    width: VLCStyle.play_cover_small
-                    height: VLCStyle.play_cover_small
+                RowLayout {
+                    spacing: VLCStyle.margin_xsmall
+                    anchors {
+                        fill: parent
+                        leftMargin: VLCStyle.margin_normal
+                        rightMargin: VLCStyle.margin_normal
+                        topMargin: VLCStyle.margin_xsmall
+                        bottomMargin: VLCStyle.margin_xsmall
+                    }
 
                     Widgets.RoundImage {
                         source: model.cover || VLCStyle.noArtArtistSmall
@@ -158,34 +167,46 @@ Widgets.NavigableFocusScope {
                         width: VLCStyle.play_cover_small
                         radius: VLCStyle.play_cover_small
                         mipmap: true
+
+                        Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
+
+                        Rectangle {
+                            anchors.fill: parent
+                            color: "transparent"
+                            radius: VLCStyle.play_cover_small
+                            border.width: VLCStyle.dp(1, VLCStyle.scale)
+                            border.color: !_highlighted ? 
VLCStyle.colors.roundPlayCoverBorder : VLCStyle.colors.accent
+                        }
                     }
 
-                    Rectangle {
-                        height: VLCStyle.play_cover_small
-                        width: VLCStyle.play_cover_small
-                        radius: VLCStyle.play_cover_small
-                        color: 'transparent'
-                        border.width: VLCStyle.dp(1, VLCStyle.scale)
-                        border.color: !_highlighted ? 
VLCStyle.colors.roundPlayCoverBorder : VLCStyle.colors.accent
+                    Widgets.ListLabel {
+                        text: model.name || i18n.qtr("Unknown artist")
+                        color: _highlighted ? VLCStyle.colors.bgHoverText : 
VLCStyle.colors.text
+
+                        Layout.fillWidth: true
+                        Layout.fillHeight: true
                     }
                 }
 
-                line1: model.name || i18n.qtr("Unknown artist")
+                MouseArea {
+                    id: mouseArea
 
-                actionButtons: []
+                    anchors.fill: parent
+                    hoverEnabled: true
 
-                onItemClicked: {
-                    artistId = model.id
-                    selectionModel.updateSelection( modifier , 
artistList.currentIndex, index)
-                    artistList.currentIndex = index
-                    artistList.forceActiveFocus()
-                }
+                    onClicked: {
+                        artistId = model.id
+                        selectionModel.updateSelection( mouse.modifiers , 
artistList.currentIndex, index)
+                        artistList.currentIndex = index
+                        artistList.forceActiveFocus()
+                    }
 
-                onItemDoubleClicked: {
-                    if (keys === Qt.RightButton)
-                        medialib.addAndPlay( model.id )
-                    else
-                        albumSubView.forceActiveFocus()
+                    onDoubleClicked: {
+                        if (mouse.buttons === Qt.LeftButton)
+                            medialib.addAndPlay( model.id )
+                        else
+                            albumSubView.forceActiveFocus()
+                    }
                 }
             }
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to