[vlc-commits] [Git][videolan/vlc][master] 7 commits: qml: standardize layout margins

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Dec 15 09:34:43 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
40a81efe by Leon Vitanos at 2024-12-15T09:10:51+00:00
qml: standardize layout margins

- - - - -
02097f4f by Leon Vitanos at 2024-12-15T09:10:51+00:00
qml: correctly set EmptyLabel alignment

- - - - -
69f01d14 by Leon Vitanos at 2024-12-15T09:10:51+00:00
qml: correctly set header view alignment in BrowseView

- - - - -
213f7a53 by Leon Vitanos at 2024-12-15T09:10:51+00:00
qml: fix layout title alignment issue caused by media library button size

- - - - -
fb5dda08 by Leon Vitanos at 2024-12-15T09:10:51+00:00
qml: correct contextButton alignment in tableView

- - - - -
61685170 by Leon Vitanos at 2024-12-15T09:10:51+00:00
qml: correctly set horizontal alignment in MusicArtist

- - - - -
12f3980d by Leon Vitanos at 2024-12-15T09:10:51+00:00
qml: fix vertical alignment in MusicArtist by setting the subtitle of a gridItem always visible

- - - - -


9 changed files:

- modules/gui/qt/medialibrary/qml/MusicArtist.qml
- modules/gui/qt/network/qml/BrowseTreeDisplay.qml
- modules/gui/qt/network/qml/BrowseTreeHeader.qml
- modules/gui/qt/style/VLCStyle.qml
- modules/gui/qt/widgets/qml/EmptyLabel.qml
- modules/gui/qt/widgets/qml/ExpandGridView.qml
- modules/gui/qt/widgets/qml/GridItem.qml
- modules/gui/qt/widgets/qml/TableViewDelegate.qml
- modules/gui/qt/widgets/qml/TableViewExt.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/MusicArtist.qml
=====================================
@@ -32,6 +32,10 @@ FocusScope {
 
     property var artist: ({})
 
+    readonly property int _extraMargin: VLCStyle.dynamicAppMargins(width)
+    readonly property int _contentLeftMargin: VLCStyle.layout_left_margin + _extraMargin
+    readonly property int _contentRightMargin: VLCStyle.layout_right_margin + _extraMargin
+
     //the index to "go to" when the view is loaded
     property int initialIndex: 0
 
@@ -115,7 +119,7 @@ FocusScope {
             Widgets.ViewHeader {
                 view: root
 
-                leftPadding: VLCStyle.margin_xlarge
+                leftPadding: root._contentLeftMargin
                 bottomPadding: VLCStyle.layoutTitle_bottom_padding -
                                (MainCtx.gridView ? 0 : VLCStyle.gridItemSelectedBorder)
 
@@ -145,9 +149,9 @@ FocusScope {
                     Widgets.ListViewExt {
                         id: albumsList
 
-                        x: VLCStyle.margin_xlarge - VLCStyle.gridItemSelectedBorder
+                        x: root._contentLeftMargin - VLCStyle.gridItemSelectedBorder
 
-                        width: root.width - root.rightPadding - x * 2
+                        width: root.width - root.rightPadding - root._contentLeftMargin - root._contentRightMargin
                         height: gridHelper.cellHeight + topMargin + bottomMargin + VLCStyle.margin_xxxsmall
 
                         leftMargin: VLCStyle.gridItemSelectedBorder
@@ -199,6 +203,7 @@ FocusScope {
 
                             title: model.title || qsTr("Unknown title")
                             subtitle: model.release_year || ""
+                            subtitleVisible: true
                             textAlignHCenter: true
                             dragItem: albumDragItem
 
@@ -232,7 +237,7 @@ FocusScope {
                     Widgets.ViewHeader {
                         view: root
 
-                        leftPadding: VLCStyle.margin_xlarge
+                        leftPadding: root._contentLeftMargin
                         topPadding: 0
 
                         text: qsTr("Tracks")


=====================================
modules/gui/qt/network/qml/BrowseTreeDisplay.qml
=====================================
@@ -37,10 +37,12 @@ MainViewLoader {
     readonly property int contentLeftMargin: currentItem?.contentLeftMargin ?? 0
     readonly property int contentRightMargin: currentItem?.contentRightMargin ?? 0
 
+    readonly property int extraMargin: VLCStyle.dynamicAppMargins(width)
+
     readonly property int headerLeftPadding: (contentLeftMargin > 0)
-                                             ? contentLeftMargin : VLCStyle.dynamicAppMargins(width)
+                                             ? contentLeftMargin : extraMargin + VLCStyle.layout_left_margin
     readonly property int headerRightPadding: (contentRightMargin > 0)
-                                              ? contentRightMargin : VLCStyle.dynamicAppMargins(width)
+                                              ? contentRightMargin : extraMargin + VLCStyle.layout_right_margin
 
     // fixme remove this
     property Item _currentView: currentItem
@@ -281,8 +283,8 @@ MainViewLoader {
             header: BrowseTreeHeader {
                 providerModel: root.model
 
-                leftPadding: root.contentLeftPadding
-                rightPadding: root.contentRightPadding
+                leftPadding: root.headerLeftPadding
+                rightPadding: root.headerRightPadding
 
                 width: tableView.width
 


=====================================
modules/gui/qt/network/qml/BrowseTreeHeader.qml
=====================================
@@ -60,6 +60,7 @@ T.Pane {
             color: colorContext.fg.primary
 
             Layout.fillWidth: true
+            Layout.fillHeight: true
         }
 
         Widgets.ButtonExt {


=====================================
modules/gui/qt/style/VLCStyle.qml
=====================================
@@ -226,6 +226,9 @@ QtObject {
     readonly property int layoutTitle_top_padding: margin_large + margin_xxsmall
     readonly property int layoutTitle_bottom_padding: margin_normal + margin_xxxsmall
 
+    readonly property int layout_left_margin: margin_normal
+    readonly property int layout_right_margin: layout_left_margin
+
     readonly property int table_cover_border: MainCtx.dp(2, scale)
 
     readonly property int tableHeaderText_height: fontHeight_normal


=====================================
modules/gui/qt/widgets/qml/EmptyLabel.qml
=====================================
@@ -25,6 +25,12 @@ import VLC.Widgets as Widgets
 T.Control {
     id: root
 
+    // Properties
+    readonly property int extraMargin: VLCStyle.dynamicAppMargins(width)
+
+    readonly property int contentLeftMargin: extraMargin + VLCStyle.layout_left_margin
+    readonly property int contentRightMargin: extraMargin + VLCStyle.layout_right_margin
+
     // Aliases
 
     default property alias contents: column.data
@@ -56,8 +62,9 @@ T.Control {
         id: column
 
         anchors.verticalCenter: parent.verticalCenter
+        anchors.horizontalCenter: parent.horizontalCenter
 
-        width: root.width
+        width: root.width - root.contentLeftMargin - root.contentRightMargin
 
         spacing: root.spacing
 


=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -37,8 +37,8 @@ FocusScope {
     //margin to apply
     property int bottomMargin: 0
     property int topMargin: 0
-    property int leftMargin: VLCStyle.margin_normal + leftPadding
-    property int rightMargin: VLCStyle.margin_normal + rightPadding
+    property int leftMargin: VLCStyle.layout_left_margin + leftPadding
+    property int rightMargin: VLCStyle.layout_right_margin + rightPadding
 
     property int leftPadding: 0
     property int rightPadding: 0


=====================================
modules/gui/qt/widgets/qml/GridItem.qml
=====================================
@@ -55,6 +55,7 @@ T.ItemDelegate {
 
     property alias title: titleLabel.text
     property alias subtitle: subtitleTxt.text
+    property alias subtitleVisible: subtitleTxt.visible
     property alias playCoverShowPlay: picture.playCoverShowPlay
     property alias playIconSize: picture.playIconSize
     property alias pictureRadius: picture.radius


=====================================
modules/gui/qt/widgets/qml/TableViewDelegate.qml
=====================================
@@ -192,6 +192,8 @@ T.Control {
     }
 
     contentItem: Row {
+        id: contentItemRow
+
         leftPadding: VLCStyle.margin_xxxsmall
         rightPadding: VLCStyle.margin_xxxsmall
 
@@ -244,11 +246,12 @@ T.Control {
             Widgets.IconToolButton {
                 id: contextButton
 
-                anchors.left: parent.left
+                anchors.right: parent.right
 
                 // NOTE: We want the contextButton to be contained inside the trailing
                 //       column_spacing.
-                anchors.leftMargin: -width - delegate.leftPadding
+                anchors.rightMargin: delegate.leftPadding - VLCStyle.layout_left_margin + delegate.rightPadding - VLCStyle.layout_right_margin +
+                                     parent.width + contentItemRow.rightPadding
 
                 anchors.verticalCenter: parent.verticalCenter
 


=====================================
modules/gui/qt/widgets/qml/TableViewExt.qml
=====================================
@@ -50,8 +50,8 @@ FocusScope {
     // NOTE: We want edge to edge backgrounds in our delegate and header, so we implement our own
     //       margins implementation like in ExpandGridView. The default values should be the same
     //       than ExpandGridView to respect the grid parti pris.
-    property int leftMargin: VLCStyle.margin_normal + leftPadding
-    property int rightMargin: VLCStyle.margin_normal + rightPadding
+    property int leftMargin: VLCStyle.layout_left_margin + leftPadding
+    property int rightMargin: VLCStyle.layout_right_margin + rightPadding
 
     property int leftPadding: 0
     property int rightPadding: 0



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4d1b065375a2c53c10be12198230e76d59642cdd...12f3980da15427873eaad4e6ac5d1736ba79c680

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4d1b065375a2c53c10be12198230e76d59642cdd...12f3980da15427873eaad4e6ac5d1736ba79c680
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