[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: fix play cover position in network views

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Mar 30 18:08:29 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
ff3174d9 by Prince Gupta at 2022-03-30T17:53:41+00:00
qml: fix play cover position in network views

fixup 4e2f82386a8

- - - - -
c984a594 by Prince Gupta at 2022-03-30T17:53:41+00:00
qml: fix warnings in NetworkThumbnailItem

- - - - -
af41ad18 by Prince Gupta at 2022-03-30T17:53:41+00:00
qml: fix warnings in NetworkCustomCover

- - - - -
2c27f5e0 by Prince Gupta at 2022-03-30T17:53:41+00:00
qml: use rounded values for position in NetworkThumbnailItem

- - - - -


2 changed files:

- modules/gui/qt/network/qml/NetworkCustomCover.qml
- modules/gui/qt/network/qml/NetworkThumbnailItem.qml


Changes:

=====================================
modules/gui/qt/network/qml/NetworkCustomCover.qml
=====================================
@@ -32,10 +32,13 @@ Item {
         id: custom_cover
 
         anchors.centerIn: parent
-        visible: !networkModel.artwork || networkModel.artwork.toString() === ""
+        visible: !networkModel || !networkModel.artwork || networkModel.artwork.toString() === ""
         height: iconSize
         sourceSize: Qt.size(width, height)
         source: {
+            if (!networkModel)
+                return ""
+
             switch (networkModel.type) {
             case NetworkMediaModel.TYPE_DISC:
                 return "qrc:///type/disc.svg"
@@ -58,6 +61,7 @@ Item {
         source: custom_cover
         color: VLCStyle.colors.text
         visible: custom_cover.visible
+                 && !!networkModel
                  && networkModel.type !== NetworkMediaModel.TYPE_DISC
                  && networkModel.type !== NetworkMediaModel.TYPE_CARD
                  && networkModel.type !== NetworkMediaModel.TYPE_STREAM


=====================================
modules/gui/qt/network/qml/NetworkThumbnailItem.qml
=====================================
@@ -35,6 +35,13 @@ Item {
     readonly property bool containsMouse: parent.containsMouse
     readonly property int index: parent.index
 
+    readonly property string artworkSource: !!rowModel ? rowModel.artwork : ""
+
+    readonly property bool _showPlayCover: (currentlyFocused || containsMouse)
+                                           && !!rowModel
+                                           && (rowModel.type !== NetworkMediaModel.TYPE_NODE)
+                                           && (rowModel.type !== NetworkMediaModel.TYPE_DIRECTORY)
+
     signal playClicked(int index)
 
     Widgets.ListCoverShadow {
@@ -63,11 +70,7 @@ Item {
 
             width: VLCStyle.play_cover_small
 
-            visible: ((currentlyFocused || containsMouse)
-                      &&
-                      (rowModel.type !== NetworkMediaModel.TYPE_NODE
-                       &&
-                       rowModel.type !== NetworkMediaModel.TYPE_DIRECTORY))
+            visible: item._showPlayCover
 
             onClicked: playClicked(item.index)
         }
@@ -76,27 +79,23 @@ Item {
     Widgets.ScaledImage {
         id: artwork
 
-        x: (width - paintedWidth) / 2
-        y: (parent.height - paintedHeight) / 2
+        x: Math.round((width - paintedWidth) / 2)
+        y: Math.round((parent.height - paintedHeight) / 2)
         width: VLCStyle.listAlbumCover_width
         height: VLCStyle.listAlbumCover_height
         fillMode: Image.PreserveAspectFit
         horizontalAlignment: Image.AlignLeft
         verticalAlignment: Image.AlignTop
-        source: item.rowModel.artwork
-        visible: item.rowModel.artwork
-                 && item.rowModel.artwork.toString() !== ""
+        source: item.artworkSource
+        visible: item.artworkSource !== ""
 
         Widgets.PlayCover {
-            anchors.centerIn: parent
+            x: Math.round((artwork.paintedWidth - width) / 2)
+            y: Math.round((artwork.paintedHeight - height) / 2)
 
             width: VLCStyle.play_cover_small
 
-            visible: ((currentlyFocused || containsMouse)
-                      &&
-                      (rowModel.type !== NetworkMediaModel.TYPE_NODE
-                       &&
-                       rowModel.type !== NetworkMediaModel.TYPE_DIRECTORY))
+            visible: item._showPlayCover
 
             onClicked: playClicked(item.index)
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/11c4e593ceb0c87829d8a03c788c09fee38b78c1...2c27f5e09efd66c2a195f8da170791a1ae798816

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/11c4e593ceb0c87829d8a03c788c09fee38b78c1...2c27f5e09efd66c2a195f8da170791a1ae798816
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list