[vlc-commits] [Git][videolan/vlc][master] 9 commits: qml: do not use `Screen.devicePixelRatio` in `ArtistTopBanner.qml`

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jan 24 09:38:46 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f3306081 by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: do not use `Screen.devicePixelRatio` in `ArtistTopBanner.qml`

`Screen.devicePixelRatio` is not reported correctly on Wayland,
unlike window's effective device pixel ratio.

- - - - -
ca22f402 by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: do not use `Screen.devicePixelRatio` in `MusicAlbumsGridExpandDelegate.qml`

`Screen.devicePixelRatio` is not reported correctly on Wayland,
unlike window's effective device pixel ratio.

- - - - -
d91a333e by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: do not use `Screen.devicePixelRatio` in `MusicArtistDelegate.qml`

`Screen.devicePixelRatio` is not reported correctly on Wayland,
unlike window's effective device pixel ratio.

- - - - -
10487684 by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: do not use `Screen.devicePixelRatio` in `VideoInfoExpandPanel.qml`

`Screen.devicePixelRatio` is not reported correctly on Wayland,
unlike window's effective device pixel ratio.

- - - - -
544a0835 by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: do not use `Screen.devicePixelRatio` in `ArtworkInfoWidget.qml`

`Screen.devicePixelRatio` is not reported correctly on Wayland,
unlike window's effective device pixel ratio.

- - - - -
868b14cc by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: do not use `Screen.devicePixelRatio` in `DragItem.qml`

`Screen.devicePixelRatio` is not reported correctly on Wayland,
unlike window's effective device pixel ratio.

- - - - -
a8f8c23f by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: do not use `Screen.devicePixelRatio` in `MediaCover.qml`

`Screen.devicePixelRatio` is not reported correctly on Wayland,
unlike window's effective device pixel ratio.

- - - - -
7180eb18 by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: do not use `Screen.devicePixelRatio` in `ScaledImage.qml`

`Screen.devicePixelRatio` is not reported correctly on Wayland,
unlike window's effective device pixel ratio.

- - - - -
bba1e9de by Fatih Uzunoglu at 2025-01-24T09:07:52+00:00
qml: scale player cover image according to the window dpr

- - - - -


9 changed files:

- modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
- modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
- modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
- modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
- modules/gui/qt/player/qml/Player.qml
- modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
- modules/gui/qt/widgets/qml/DragItem.qml
- modules/gui/qt/widgets/qml/MediaCover.qml
- modules/gui/qt/widgets/qml/ScaledImage.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
=====================================
@@ -104,10 +104,11 @@ FocusScope {
             Widgets.RoundImage {
                 id: roundImage
                 source: artist.cover || VLCStyle.noArtArtist
-                sourceSize.width: width * Screen.devicePixelRatio
-                sourceSize.height: height * Screen.devicePixelRatio
+                sourceSize.width: width * eDPR
+                sourceSize.height: height * eDPR
                 anchors.fill: parent
                 radius: VLCStyle.cover_normal
+                readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
             }
 
             Rectangle {


=====================================
modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
=====================================
@@ -126,8 +126,10 @@ FocusScope {
                 source: (root.model && root.model.cover && root.model.cover !== "")
                     ?  root.model.cover
                     : VLCStyle.noArtAlbumCover
-                sourceSize.width: width * Screen.devicePixelRatio
-                sourceSize.height: height * Screen.devicePixelRatio
+                sourceSize.width: width * eDPR
+                sourceSize.height: height * eDPR
+
+                readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
 
                 Widgets.DefaultShadow {
                     anchors.centerIn: parent


=====================================
modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
=====================================
@@ -26,6 +26,7 @@ import QtQml.Models
 
 import VLC.MediaLibrary
 
+import VLC.MainInterface
 import VLC.Widgets as Widgets
 import VLC.Style
 import VLC.Util
@@ -169,11 +170,13 @@ T.ItemDelegate {
 
             source: (model.cover) ? model.cover
                                   : VLCStyle.noArtArtistSmall
-            sourceSize.width: width * Screen.devicePixelRatio
-            sourceSize.height: height * Screen.devicePixelRatio
+            sourceSize.width: width * eDPR
+            sourceSize.height: height * eDPR
 
             Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
 
+            readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
+
             Rectangle {
                 anchors.fill: parent
 


=====================================
modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
=====================================
@@ -114,10 +114,12 @@ FocusScope {
 
                             anchors.fill: parent
                             source: model.thumbnail || VLCStyle.noArtVideoCover
-                            sourceSize.width: width * Screen.devicePixelRatio
-                            sourceSize.height: height * Screen.devicePixelRatio
+                            sourceSize.width: width * eDPR
+                            sourceSize.height: height * eDPR
                             radius: VLCStyle.gridCover_radius
 
+                            readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
+
                             Widgets.DefaultShadow {
                                 anchors.centerIn: parent
 


=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -363,11 +363,13 @@ FocusScope {
 
                                 //source aspect ratio
                                 readonly property real sar: paintedWidth / paintedHeight
-                                readonly property int maximumWidth: Helpers.alignUp((Screen.desktopAvailableWidth / coverItem.sizeConstant), 32)
-                                readonly property int maximumHeight: Helpers.alignUp((Screen.desktopAvailableHeight / coverItem.sizeConstant), 32)
+                                readonly property int maximumWidth: Helpers.alignUp((Screen.desktopAvailableWidth * eDPR / coverItem.sizeConstant), 32)
+                                readonly property int maximumHeight: Helpers.alignUp((Screen.desktopAvailableHeight * eDPR / coverItem.sizeConstant), 32)
 
                                 readonly property int maximumSize: Math.min(maximumWidth, maximumHeight)
 
+                                readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
+
                                 anchors.top: parent.top
                                 anchors.bottom: parent.bottom
                                 anchors.horizontalCenter: parent.horizontalCenter


=====================================
modules/gui/qt/player/qml/controlbarcontrols/ArtworkInfoWidget.qml
=====================================
@@ -162,7 +162,7 @@ AbstractButton {
                     return VLCStyle.noArtAlbumCover
             }
 
-            sourceSize.height: root.height * Screen.devicePixelRatio
+            sourceSize.height: root.height * MainCtx.effectiveDevicePixelRatio(Window.window)
 
             fillMode: Image.PreserveAspectFit
 


=====================================
modules/gui/qt/widgets/qml/DragItem.qml
=====================================
@@ -472,7 +472,9 @@ Item {
                 height: coverSize
                 radius: bg.radius
                 source: modelData.artwork ?? ""
-                sourceSize: dragItem.imageSourceSize ?? Qt.size(width * Screen.devicePixelRatio, height * Screen.devicePixelRatio)
+                sourceSize: dragItem.imageSourceSize ?? Qt.size(width * eDPR, height * eDPR)
+
+                readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
 
                 onStatusChanged: {
                     if (status === Image.Ready)


=====================================
modules/gui/qt/widgets/qml/MediaCover.qml
=====================================
@@ -20,7 +20,7 @@ import QtQuick
 import QtQuick.Window
 import QtQuick.Controls
 
-
+import VLC.MainInterface
 import VLC.Widgets as Widgets
 import VLC.Style
 
@@ -40,6 +40,8 @@ Item {
                                                           : (fallbackImage.visible ? fallbackImage.effectiveRadius
                                                                                    : 0.0)
 
+    readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
+
     // Aliases
 
     property alias radius: image.radius
@@ -106,8 +108,8 @@ Item {
 
         anchors.fill: parent
 
-        sourceSize.width: root.pictureWidth * Screen.devicePixelRatio
-        sourceSize.height: root.pictureHeight * Screen.devicePixelRatio
+        sourceSize.width: root.pictureWidth * root.eDPR
+        sourceSize.height: root.pictureHeight * root.eDPR
 
         onStatusChanged: {
             if (status === Image.Loading) {
@@ -136,8 +138,8 @@ Item {
         // try to release the resources otherwise
         source: visible ? root.fallbackImageSource : ""
 
-        sourceSize.width: root.pictureWidth * Screen.devicePixelRatio
-        sourceSize.height: root.pictureHeight * Screen.devicePixelRatio
+        sourceSize.width: root.pictureWidth * root.eDPR
+        sourceSize.height: root.pictureHeight * root.eDPR
 
         cache: true
     }


=====================================
modules/gui/qt/widgets/qml/ScaledImage.qml
=====================================
@@ -25,11 +25,13 @@ import VLC.MainInterface
 
 Image {
     id: root
-    sourceSize: Qt.size(width * Screen.devicePixelRatio,
-                        height * Screen.devicePixelRatio)
+    sourceSize: Qt.size(width * eDPR,
+                        height * eDPR)
 
     property bool disableSmoothWhenIntegerUpscaling: false
 
+    readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
+
     Binding on smooth {
         when: root.disableSmoothWhenIntegerUpscaling &&
               !((root.paintedWidth % root.implicitWidth) || (root.paintedHeight % root.implicitHeight))



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/60e95ad5c2ab53dec17112fc9caab6bf52a90db8...bba1e9dea95d00f2c0713270f7f22b652754bdf9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/60e95ad5c2ab53dec17112fc9caab6bf52a90db8...bba1e9dea95d00f2c0713270f7f22b652754bdf9
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