[vlc-devel] [PATCH 06/12] qml: load placeholder icons with size VLCStyle.icon_normal for NetworkGridItem

Prince Gupta guptaprince8832 at gmail.com
Mon Aug 24 17:08:23 CEST 2020


---
 .../gui/qt/network/qml/NetworkGridItem.qml    | 58 +++++++++++++------
 1 file changed, 39 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt/network/qml/NetworkGridItem.qml b/modules/gui/qt/network/qml/NetworkGridItem.qml
index 134840bf2b..28fad0cc31 100644
--- a/modules/gui/qt/network/qml/NetworkGridItem.qml
+++ b/modules/gui/qt/network/qml/NetworkGridItem.qml
@@ -18,6 +18,7 @@
 import QtQuick 2.11
 import QtQuick.Controls 2.4
 import QtQml.Models 2.2
+import QtGraphicalEffects 1.0
 
 import org.videolan.vlc 0.1
 import org.videolan.medialib 0.1
@@ -35,27 +36,46 @@ Widgets.GridItem {
     pictureHeight: VLCStyle.gridCover_network_height
     playCoverBorder.width: VLCStyle.gridCover_network_border
     playCoverOnlyBorders: model.type === NetworkMediaModel.TYPE_NODE || model.type === NetworkMediaModel.TYPE_DIRECTORY
+    image: model.artwork && model.artwork.toString() !== "" ? model.artwork : ""
 
-    image: {
-        if (model.artwork && model.artwork.toString() !== "") {
-            return model.artwork
-        }
+    subtitle: model.mrl || ""
+    title: model.name || i18n.qtr("Unknown share")
 
-        switch (model.type){
-        case NetworkMediaModel.TYPE_DISC:
-            return  "qrc:///type/disc.svg"
-        case NetworkMediaModel.TYPE_CARD:
-            return  "qrc:///type/capture-card.svg"
-        case NetworkMediaModel.TYPE_STREAM:
-            return  "qrc:///type/stream.svg"
-        case NetworkMediaModel.TYPE_PLAYLIST:
-            return  "qrc:///type/playlist.svg"
-        case NetworkMediaModel.TYPE_FILE:
-            return  "qrc:///type/file_black.svg"
-        default:
-            return "qrc:///type/directory_black.svg"
+    Image {
+        id: custom_cover
+
+        x: (pictureWidth - this.width) / 2
+        y: (pictureHeight - this.height) / 2
+        width: VLCStyle.icon_normal
+        height: VLCStyle.icon_normal
+        opacity: item._highlighted && !item.playCoverOnlyBorders ? .1 : 1
+        visible: !model.artwork || model.artwork.toString() === ""
+        source: {
+            switch (model.type){
+            case NetworkMediaModel.TYPE_DISC:
+                return  "qrc:///type/disc.svg"
+            case NetworkMediaModel.TYPE_CARD:
+                return  "qrc:///type/capture-card.svg"
+            case NetworkMediaModel.TYPE_STREAM:
+                return  "qrc:///type/stream.svg"
+            case NetworkMediaModel.TYPE_PLAYLIST:
+                return  "qrc:///type/playlist.svg"
+            case NetworkMediaModel.TYPE_FILE:
+                return  "qrc:///type/file_black.svg"
+            default:
+                return "qrc:///type/directory_black.svg"
+            }
         }
     }
-    subtitle: model.mrl || ""
-    title: model.name || i18n.qtr("Unknown share")
+
+    ColorOverlay {
+        anchors.fill: custom_cover
+        source: custom_cover
+        color: VLCStyle.colors.text
+        visible: custom_cover.visible
+                 && model.type !== NetworkMediaModel.TYPE_DISC
+                 && model.type !== NetworkMediaModel.TYPE_CARD
+                 && model.type !== NetworkMediaModel.TYPE_STREAM
+    }
+
 }
-- 
2.25.1



More information about the vlc-devel mailing list