[vlc-commits] qml: allow to only show borders of GridItem's play cover

Prince Gupta git at videolan.org
Fri Jul 3 14:59:40 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Sat Jun 27 00:09:59 2020 +0530| [9afe08a7b7427f79618facd06f1931d745ce4218] | committer: Pierre Lamot

qml: allow to only show borders of GridItem's play cover

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

 modules/gui/qt/network/qml/NetworkGridItem.qml |  1 +
 modules/gui/qt/widgets/qml/GridItem.qml        |  1 +
 modules/gui/qt/widgets/qml/MediaCover.qml      |  1 +
 modules/gui/qt/widgets/qml/PlayCover.qml       | 20 +++++++++++++-------
 4 files changed, 16 insertions(+), 7 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 30b5e69187..0c62b5a0e6 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -32,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) }
+    }
 }



More information about the vlc-commits mailing list