[vlc-commits] qml: simplify scaling of center content in PlayerWidget

Prince Gupta git at videolan.org
Mon Mar 15 10:32:51 UTC 2021


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Thu Feb  4 20:44:34 2021 +0530| [d47dc103a97df02f6838744a4a660355c98dd5b3] | committer: Pierre Lamot

qml: simplify scaling of center content in PlayerWidget

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/player/qml/Player.qml | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index 928b1ff8ec..95ce36d995 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -280,19 +280,14 @@ Widgets.NavigableFocusScope {
         }
 
         ColumnLayout {
-            anchors.fill: parent
+            anchors.centerIn: parent
             spacing: 0
             visible: !rootPlayer.hasEmbededVideo
 
             Item {
-                Layout.fillHeight: true
-            }
-
-            Item {
-                Layout.preferredHeight: Math.max(Math.min(parent.height, parent.width - VLCStyle.margin_small * 2), 0)
-                Layout.maximumHeight: rootPlayer.height / 2.7182
-                Layout.minimumHeight: 1
+                Layout.preferredHeight: rootPlayer.height / 2.7182
                 Layout.preferredWidth: height * cover.sar
+                Layout.maximumHeight: centerContent.height
                 Layout.alignment: Qt.AlignHCenter
 
                 Image {
@@ -319,8 +314,7 @@ Widgets.NavigableFocusScope {
             Widgets.SubtitleLabel {
                 id: albumLabel
 
-                Layout.fillWidth: true
-                Layout.preferredHeight: implicitHeight
+                Layout.alignment: Qt.AlignHCenter
                 Layout.topMargin: VLCStyle.margin_xxlarge
 
                 visible: centerContent.height > (albumLabel.y + albumLabel.height)
@@ -334,8 +328,7 @@ Widgets.NavigableFocusScope {
             Widgets.MenuLabel {
                 id: artistLabel
 
-                Layout.fillWidth: true
-                Layout.preferredHeight: implicitHeight
+                Layout.alignment: Qt.AlignHCenter
                 Layout.topMargin: VLCStyle.margin_small
 
                 visible: centerContent.height > (artistLabel.y + artistLabel.height)
@@ -349,10 +342,9 @@ Widgets.NavigableFocusScope {
             Widgets.NavigableRow {
                 id: audioControls
 
-                Layout.preferredHeight: implicitHeight
-                Layout.preferredWidth: implicitWidth
-                Layout.topMargin: VLCStyle.margin_large
                 Layout.alignment: Qt.AlignHCenter
+                Layout.topMargin: VLCStyle.margin_large
+
                 visible: player.videoTracks.count === 0 && centerContent.height > (audioControls.y + audioControls.height)
                 focus: visible
                 spacing: VLCStyle.margin_xxsmall
@@ -386,10 +378,6 @@ Widgets.NavigableFocusScope {
                     }
                 }
             }
-
-            Item {
-                Layout.fillHeight: true
-            }
         }
     }
 



More information about the vlc-commits mailing list