[vlc-devel] [PATCH 14/14] qml: allow to only show borders of GridItem's play cover

Prince Gupta guptaprince8832 at gmail.com
Thu Jul 2 14:23:23 CEST 2020


---
 .../gui/qt/network/qml/NetworkGridItem.qml    |  1 +
 modules/gui/qt/widgets/qml/GridItem.qml       |  2 +-
 modules/gui/qt/widgets/qml/MediaCover.qml     |  1 +
 modules/gui/qt/widgets/qml/PlayCover.qml      | 20 ++++++++++++-------
 4 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/modules/gui/qt/network/qml/NetworkGridItem.qml b/modules/gui/qt/network/qml/NetworkGridItem.qml
index d0c380209b..134840bf2b 100644
--- a/modules/gui/qt/network/qml/NetworkGridItem.qml
+++ b/modules/gui/qt/network/qml/NetworkGridItem.qml
@@ -34,6 +34,7 @@ Widgets.GridItem {
     pictureWidth: VLCStyle.gridCover_network_width
     pictureHeight: VLCStyle.gridCover_network_height
     playCoverBorder.width: VLCStyle.gridCover_network_border
+    playCoverOnlyBorders: model.type === NetworkMediaModel.TYPE_NODE || model.type === NetworkMediaModel.TYPE_DIRECTORY
 
     image: {
         if (model.artwork && model.artwork.toString() !== "") {
diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index fb8d82a42e..262d2c04da 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -1,4 +1,3 @@
-
 /*****************************************************************************
  * Copyright (C) 2019 VLC authors and VideoLAN
  *
@@ -33,6 +32,7 @@ Item {
     property alias title: titleLabel.text
     property alias subtitle: subtitleTxt.text
     property alias playCoverBorder: picture.playCoverBorder
+    property alias playCoverOnlyBorders: picture.playCoverOnlyBorders
     property bool selected: false
 
     property alias progress: picture.progress
diff --git a/modules/gui/qt/widgets/qml/MediaCover.qml b/modules/gui/qt/widgets/qml/MediaCover.qml
index 796b6319b7..a0832962c2 100644
--- a/modules/gui/qt/widgets/qml/MediaCover.qml
+++ b/modules/gui/qt/widgets/qml/MediaCover.qml
@@ -29,6 +29,7 @@ Widgets.RoundImage {
     property var labels: []
     property alias progress: progressBar.value
     property alias playCoverVisible: playCover.visible
+    property alias playCoverOnlyBorders: playCover.onlyBorders
     property alias playIconSize: playCover.iconSize
     property alias playCoverBorder: playCover.border
     signal playIconClicked
diff --git a/modules/gui/qt/widgets/qml/PlayCover.qml b/modules/gui/qt/widgets/qml/PlayCover.qml
index 0e3573351a..68fcf68515 100644
--- a/modules/gui/qt/widgets/qml/PlayCover.qml
+++ b/modules/gui/qt/widgets/qml/PlayCover.qml
@@ -22,33 +22,39 @@ import "qrc:///style/"
 Rectangle {
     id: root
 
-    property alias iconSize: cover.width
+    property alias iconSize: icon.width
+    property bool onlyBorders: false
     signal iconClicked()
 
     border.color: VLCStyle.colors.accent
     border.width: VLCStyle.table_cover_border
 
     opacity: visible ? 1 : 0
-
-    gradient: Gradient {
-        GradientStop { position: 0.0; color: Qt.rgba(0, 0, 0, .5) }
-        GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, .7) }
-    }
+    gradient: !onlyBorders ? background : undefined
+    color: 'transparent'
 
     Behavior on opacity {
         NumberAnimation { duration: 150; easing.type: Easing.OutQuad }
     }
 
     Image {
-        id: cover
+        id: icon
 
         anchors.centerIn: parent
         fillMode: Image.PreserveAspectFit
         source: "qrc:/play_button.svg"
+        visible: !root.onlyBorders
 
         MouseArea {
             anchors.fill: parent
             onClicked: root.iconClicked()
         }
     }
+
+    Gradient {
+        id: background
+
+        GradientStop { position: 0.0; color: Qt.rgba(0, 0, 0, .5) }
+        GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, .7) }
+    }
 }
-- 
2.25.1



More information about the vlc-devel mailing list