[vlc-commits] qml: add first item indicator to playlist

Fatih Uzunoglu git at videolan.org
Tue Jan 12 13:20:52 UTC 2021


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Jan  8 00:36:54 2021 +0300| [86e4caec3e8abcc35228a6f85c453994c7b4a561] | committer: Pierre Lamot

qml: add first item indicator to playlist

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/playlist/qml/PlaylistListView.qml | 46 +++++++++++++++++++++---
 1 file changed, 42 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index 3c95f6560c..6058b3bf1e 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -320,6 +320,8 @@ Widgets.NavigableFocusScope {
                     width: parent.width
                     height: Math.max(VLCStyle.icon_normal, listView.height - y)
 
+                    property alias firstItemIndicatorVisible: firstItemIndicator.visible
+
                     function setDropIndicatorVisible(visible) {
                         dropIndicator.visible = visible
                     }
@@ -353,6 +355,33 @@ Widgets.NavigableFocusScope {
                         color: colors.accent
                     }
 
+                    Rectangle {
+                        id: firstItemIndicator
+
+                        anchors.fill: parent
+                        anchors.margins: VLCStyle.margin_small
+
+                        border.width: VLCStyle.dp(2)
+                        border.color: colors.accent
+
+                        color: "transparent"
+
+                        visible: false
+
+                        opacity: 0.8
+
+                        Label {
+                            anchors.centerIn: parent
+
+                            text: VLCIcons.add
+
+                            font.pointSize: VLCStyle.fontHeight_xxxlarge
+
+                            font.family: VLCIcons.fontFamily
+                            color: colors.accent
+                        }
+                    }
+
                     DropArea {
                         id: dropArea
 
@@ -362,10 +391,16 @@ Widgets.NavigableFocusScope {
                             if(!root.isDropAcceptable(drag, root.model.count))
                                 return
 
-                            dropIndicator.visible = true
+                            if (root.model.count === 0)
+                                firstItemIndicator.visible = true
+                            else
+                                dropIndicator.visible = true
                         }
                         onExited: {
-                            dropIndicator.visible = false
+                            if (root.model.count === 0)
+                                firstItemIndicator.visible = false
+                            else
+                                dropIndicator.visible = false
                         }
                         onDropped: {
                             if(!root.isDropAcceptable(drop, root.model.count))
@@ -373,7 +408,10 @@ Widgets.NavigableFocusScope {
 
                             root.acceptDrop(root.model.count, drop)
 
-                            dropIndicator.visible = false
+                            if (root.model.count === 0)
+                                firstItemIndicator.visible = false
+                            else
+                                dropIndicator.visible = false
                         }
                     }
                 }
@@ -520,7 +558,7 @@ Widgets.NavigableFocusScope {
                 Column {
                     id: noContentInfoColumn
                     anchors.centerIn: parent
-                    visible: model.count === 0
+                    visible: model.count === 0 && !listView.footerItem.firstItemIndicatorVisible
 
                     Widgets.IconLabel {
                         font.pixelSize: VLCStyle.dp(48, VLCStyle.scale)



More information about the vlc-commits mailing list