[vlc-commits] [Git][videolan/vlc][master] 10 commits: qml/StackViewExt: Add the 'padding(s)' properties
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Jan 27 11:40:26 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
fad1fc71 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/StackViewExt: Add the 'padding(s)' properties
This allows us to propagate padding values from the StackView to the currentItem.
That's useful when we want to apply paddings from parent to children, like safe margins.
- - - - -
9488fe12 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/PageLoader: Add the 'padding(s)' properties
- - - - -
aaa9f15a by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/ExpandGridView: Add the 'padding(s)' properties
- - - - -
3b53b966 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/KeyNavigableTableView: Add the 'paddings' properties
- - - - -
e10a5dd7 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/MainDisplay: Update paddings implementation
- - - - -
201f0764 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/VideoAll: Update paddings implementation
- - - - -
01887c39 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/PlaylistMedia(s): Update paddings implementation
- - - - -
bad8cc63 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/Music(s): Update paddings implementation
- - - - -
552bced5 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/Browse(s): Update paddings implementation
- - - - -
f8e84a47 by Benjamin Arnaud at 2023-01-27T11:03:23+00:00
qml/DiscoverUrlDisplay: Update paddings implementation
- - - - -
18 changed files:
- modules/gui/qt/maininterface/qml/MainDisplay.qml
- modules/gui/qt/medialibrary/qml/MusicAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
- modules/gui/qt/medialibrary/qml/MusicArtist.qml
- modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicGenres.qml
- modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/network/qml/BrowseDeviceView.qml
- modules/gui/qt/network/qml/BrowseHomeDisplay.qml
- modules/gui/qt/network/qml/BrowseTreeDisplay.qml
- modules/gui/qt/network/qml/DiscoverUrlDisplay.qml
- modules/gui/qt/widgets/qml/ExpandGridView.qml
- modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
- modules/gui/qt/widgets/qml/PageLoader.qml
- modules/gui/qt/widgets/qml/StackViewExt.qml
Changes:
=====================================
modules/gui/qt/maininterface/qml/MainDisplay.qml
=====================================
@@ -298,11 +298,13 @@ FocusScope {
right: (playlistColumn.visible && !VLCStyle.isScreenSmall)
? playlistColumn.left
: parent.right
- rightMargin: (MainCtx.playlistDocked && MainCtx.playlistVisible)
- ? 0
- : VLCStyle.applicationHorizontalMargin
- leftMargin: VLCStyle.applicationHorizontalMargin
}
+
+ leftPadding: VLCStyle.applicationHorizontalMargin
+
+ rightPadding: (MainCtx.playlistDocked && MainCtx.playlistVisible)
+ ? 0
+ : VLCStyle.applicationHorizontalMargin
}
Rectangle {
=====================================
modules/gui/qt/medialibrary/qml/MusicAlbums.qml
=====================================
@@ -30,6 +30,18 @@ import "qrc:///style/"
FocusScope {
id: root
+ // Properties
+
+ //the index to "go to" when the view is loaded
+ property int initialIndex: 0
+ property int gridViewMarginTop: VLCStyle.margin_large
+ property var gridViewRowX: MainCtx.gridView ? _currentView.rowX : undefined
+
+ readonly property var currentIndex: _currentView.currentIndex
+
+ property Component header: Item{}
+ readonly property Item headerItem: _currentView ? _currentView.headerItem : null
+
property var sortModel: [
{ text: I18n.qtr("Alphabetic"), criteria: "title"},
{ text: I18n.qtr("Duration"), criteria: "duration" },
@@ -37,16 +49,13 @@ FocusScope {
{ text: I18n.qtr("Artist"), criteria: "main_artist" },
]
+ // Aliases
+
+ property alias leftPadding: view.leftPadding
+ property alias rightPadding: view.rightPadding
+
property alias model: albumModelId
property alias parentId: albumModelId.parentId
- readonly property var currentIndex: _currentView.currentIndex
- //the index to "go to" when the view is loaded
- property int initialIndex: 0
- property int gridViewMarginTop: VLCStyle.margin_large
- property var gridViewRowX: MainCtx.gridView ? _currentView.rowX : undefined
-
- property Component header: Item{}
- readonly property Item headerItem: _currentView ? _currentView.headerItem : null
property alias _currentView: view.currentItem
@@ -281,6 +290,7 @@ FocusScope {
id: view
anchors.fill: parent
+
focus: albumModelId.count !== 0
initialItem: MainCtx.gridView ? gridComponent : tableComponent
=====================================
modules/gui/qt/medialibrary/qml/MusicAllArtists.qml
=====================================
@@ -32,8 +32,16 @@ import "qrc:///style/"
FocusScope {
id: root
+ // Properties
+
readonly property int currentIndex: _currentView.currentIndex
property int initialIndex: 0
+
+ // Aliases
+
+ property alias leftPadding: view.leftPadding
+ property alias rightPadding: view.rightPadding
+
property alias model: artistModel
property alias _currentView: view.currentItem
@@ -225,6 +233,7 @@ FocusScope {
id: view
anchors.fill: parent
+
visible: artistModel.count > 0
focus: artistModel.count > 0
initialItem: MainCtx.gridView ? gridComponent : tableComponent
=====================================
modules/gui/qt/medialibrary/qml/MusicArtist.qml
=====================================
@@ -31,6 +31,8 @@ import "qrc:///style/"
FocusScope {
id: root
+ property int rightPadding: 0
+
property var artist: ({})
//the index to "go to" when the view is loaded
@@ -58,7 +60,7 @@ FocusScope {
focus: true
height: col.height
- width: root.width
+ width: root.width - root.rightPadding
function setCurrentItemFocus(reason) {
if (albumsListView)
@@ -71,14 +73,14 @@ FocusScope {
id: col
height: implicitHeight
- width: root.width
+ width: headerFs.width
bottomPadding: VLCStyle.margin_normal
ArtistTopBanner {
id: artistBanner
focus: true
- width: root.width
+ width: headerFs.width
artist: root.artist
Navigation.parentItem: root
Navigation.downAction: function() {
@@ -465,6 +467,9 @@ FocusScope {
id: view
anchors.fill: parent
+
+ rightPadding: root.rightPadding
+
focus: albumModel.count !== 0
initialItem: MainCtx.gridView ? gridComponent : tableComponent
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
=====================================
@@ -33,15 +33,25 @@ import "qrc:///style/"
FocusScope {
id: root
- property alias model: artistModel
+ // Properties
+
+ property int leftPadding: 0
+ property int rightPadding: 0
+
property var sortModel: [
{ text: I18n.qtr("Alphabetic"), criteria: "title" }
]
- property alias currentIndex: artistList.currentIndex
- property alias currentAlbumIndex: albumSubView.currentIndex
property int initialIndex: 0
property int initialAlbumIndex: 0
+
+ // Aliases
+
+ property alias model: artistModel
+
+ property alias currentIndex: artistList.currentIndex
+ property alias currentAlbumIndex: albumSubView.currentIndex
+
property alias currentArtist: albumSubView.artist
onInitialAlbumIndexChanged: resetFocus()
@@ -112,6 +122,9 @@ FocusScope {
Row {
anchors.fill: parent
+
+ anchors.leftMargin: root.leftPadding
+
visible: artistModel.count > 0
Widgets.KeyNavigableListView {
@@ -211,7 +224,10 @@ FocusScope {
id: albumSubView
height: parent.height
- width: root.width - artistList.width
+ width: root.width - root.leftPadding - artistList.width
+
+ rightPadding: root.rightPadding
+
focus: true
initialIndex: root.initialAlbumIndex
Navigation.parentItem: root
=====================================
modules/gui/qt/medialibrary/qml/MusicGenres.qml
=====================================
@@ -29,15 +29,25 @@ import "qrc:///style/"
FocusScope {
id: root
- property alias model: genreModel
+
+ // Properties
+
property var sortModel: [
{ text: I18n.qtr("Alphabetic"), criteria: "title" }
]
readonly property var currentIndex: _currentView.currentIndex
+
//the index to "go to" when the view is loaded
property int initialIndex: 0
+ // Aliases
+
+ property alias leftPadding: view.leftPadding
+ property alias rightPadding: view.rightPadding
+
+ property alias model: genreModel
+
property alias _currentView: view.currentItem
signal showAlbumView(var id, string name, int reason)
@@ -292,9 +302,10 @@ FocusScope {
Widgets.StackViewExt {
id: view
+ anchors.fill: parent
+
initialItem: MainCtx.gridView ? gridComponent : tableComponent
- anchors.fill: parent
focus: genreModel.count !== 0
}
=====================================
modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
=====================================
@@ -27,6 +27,10 @@ import "qrc:///main/" as MainInterface
FocusScope {
id: root
+ // Properties
+
+ readonly property bool isViewMultiView: false
+
property var sortModel: [
{ text: I18n.qtr("Title"), criteria: "title"},
{ text: I18n.qtr("Album"), criteria: "album_title" },
@@ -36,9 +40,13 @@ FocusScope {
{ text: I18n.qtr("Disc"), criteria: "disc_number" }
]
+ // Aliases
+
+ property alias leftPadding: tracklistdisplay_id.leftPadding
+ property alias rightPadding: tracklistdisplay_id.rightPadding
+
property alias model: tracklistdisplay_id.model
property alias selectionModel: tracklistdisplay_id.selectionDelegateModel
- readonly property bool isViewMultiView: false
function setCurrentItemFocus(reason) {
tracklistdisplay_id.setCurrentItemFocus(reason);
@@ -48,6 +56,7 @@ FocusScope {
id: tracklistdisplay_id
anchors.fill: parent
+
visible: model.count > 0
focus: model.count > 0
headerTopPadding: VLCStyle.margin_normal
=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
=====================================
@@ -36,6 +36,9 @@ FocusScope {
readonly property bool isViewMultiView: false
+ property int leftPadding: 0
+ property int rightPadding: 0
+
readonly property int currentIndex: view.currentIndex
// NOTE: We need 'var' for properties altered by StackView.replace().
=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
=====================================
@@ -36,10 +36,10 @@ FocusScope {
// Properties
//---------------------------------------------------------------------------------------------
- readonly property int currentIndex: _currentView.currentIndex
-
property bool isMusic: false
+ readonly property int currentIndex: _currentView.currentIndex
+
property int initialIndex: 0
property var sortModel: [{ text: I18n.qtr("Alphabetic"), criteria: "title" }]
@@ -66,6 +66,9 @@ FocusScope {
// Alias
//---------------------------------------------------------------------------------------------
+ property alias leftPadding: view.leftPadding
+ property alias rightPadding: view.rightPadding
+
property alias model: model
property alias _currentView: view.currentItem
=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -58,6 +58,9 @@ FocusScope {
// Aliases
+ property alias leftPadding: view.leftPadding
+ property alias rightPadding: view.rightPadding
+
property alias dragItem: dragItem
// Private
=====================================
modules/gui/qt/network/qml/BrowseDeviceView.qml
=====================================
@@ -72,6 +72,9 @@ FocusScope {
// Aliases
+ property alias leftPadding: view.leftPadding
+ property alias rightPadding: view.rightPadding
+
property alias modelFilter: modelFilter
property alias sourceModel: modelFilter.sourceModel
=====================================
modules/gui/qt/network/qml/BrowseHomeDisplay.qml
=====================================
@@ -31,6 +31,11 @@ import "qrc:///style/"
FocusScope {
id: root
+ // Properties
+
+ property int leftPadding: 0
+ property int rightPadding: 0
+
property int maximumRows: (MainCtx.gridView) ? 2 : 5
property var sortModel: [
@@ -38,14 +43,18 @@ FocusScope {
{ text: I18n.qtr("Url"), criteria: "mrl" }
]
+ // Aliases
+
property alias model: foldersSection.model
- focus: true
+ // Signals
signal seeAll(var title, var sd_source, int reason)
signal browse(var tree, int reason)
+ focus: true
+
Component.onCompleted: resetFocus()
onActiveFocusChanged: resetFocus()
@@ -101,7 +110,12 @@ FocusScope {
ScrollView {
id: flickable
+
anchors.fill: parent
+
+ anchors.leftMargin: root.leftPadding
+ anchors.rightMargin: root.rightPadding
+
focus: true
Column {
=====================================
modules/gui/qt/network/qml/BrowseTreeDisplay.qml
=====================================
@@ -29,7 +29,8 @@ import "qrc:///style/"
FocusScope {
id: root
- property alias model: filterModel
+ // Properties
+
property var providerModel
property var contextMenu
property var tree
@@ -47,6 +48,13 @@ FocusScope {
{ text: I18n.qtr("File modified"), criteria: "fileModified" }
]
+ // Aliases
+
+ property alias leftPadding: view.leftPadding
+ property alias rightPadding: view.rightPadding
+
+ property alias model: filterModel
+
property alias _currentView: view.currentItem
signal browse(var tree, int reason)
@@ -346,7 +354,8 @@ FocusScope {
Widgets.StackViewExt {
id: view
- anchors.fill:parent
+ anchors.fill: parent
+
focus: true
initialItem: MainCtx.gridView ? gridComponent : tableComponent
=====================================
modules/gui/qt/network/qml/DiscoverUrlDisplay.qml
=====================================
@@ -28,8 +28,13 @@ import "qrc:///style/"
FocusScope {
id: root
+ // Properties
+
readonly property bool isViewMultiView: false
+ property int leftPadding: 0
+ property int rightPadding: 0
+
//---------------------------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------------------------
@@ -115,7 +120,16 @@ FocusScope {
active: MainCtx.mediaLibraryAvailable
source: "qrc:///medialibrary/UrlListDisplay.qml"
+
onLoaded: {
+ item.leftPadding = Qt.binding(function() {
+ return root.leftPadding
+ })
+
+ item.rightPadding = Qt.binding(function() {
+ return root.rightPadding
+ })
+
item.Navigation.upItem = searchField
item.Navigation.parentItem = root
}
=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -38,8 +38,11 @@ FocusScope {
//margin to apply
property int bottomMargin: 0
property int topMargin: 0
- property int leftMargin: VLCStyle.column_margin
- property int rightMargin: VLCStyle.column_margin
+ property int leftMargin: VLCStyle.column_margin + leftPadding
+ property int rightMargin: VLCStyle.column_margin + rightPadding
+
+ property int leftPadding: 0
+ property int rightPadding: 0
readonly property int extraMargin: (_contentWidth - nbItemPerRow * _effectiveCellWidth
+
=====================================
modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
=====================================
@@ -41,8 +41,11 @@ 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.column_margin
- property int rightMargin: VLCStyle.column_margin
+ property int leftMargin: VLCStyle.column_margin + leftPadding
+ property int rightMargin: VLCStyle.column_margin + rightPadding
+
+ property int leftPadding: 0
+ property int rightPadding: 0
readonly property int extraMargin: Math.max(0, (width - usedRowSpace) / 2)
=====================================
modules/gui/qt/widgets/qml/PageLoader.qml
=====================================
@@ -31,6 +31,9 @@ FocusScope {
// one may use `loadPage(string pageName)` to load the page from 'pageModel'
property var loadDefaultView: null
+ property alias leftPadding: stackView.leftPadding
+ property alias rightPadding: stackView.rightPadding
+
property alias stackView: stackView
signal pageChanged(string page)
=====================================
modules/gui/qt/widgets/qml/StackViewExt.qml
=====================================
@@ -26,12 +26,41 @@ import "qrc:///style/"
StackView {
id: root
+ // Private
+
property string _currentView: ""
+ // Settings
+
replaceEnter: null
replaceExit: null
+ // Events
+
+ onCurrentItemChanged: {
+ if (currentItem === null)
+ return
+
+ // NOTE: When the currentItem has a padding defined we propagate the StackView values.
+
+ if (currentItem.leftPadding !== undefined)
+ {
+ currentItem.leftPadding = Qt.binding(function() {
+ return leftPadding
+ })
+ }
+
+ if (currentItem.rightPadding !== undefined)
+ {
+ currentItem.rightPadding = Qt.binding(function() {
+ return rightPadding
+ })
+ }
+ }
+
+ // Functions
+
/**
* viewModel: model with the definition of the available view
* elements should contains at least :
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8ecb45684a49a5efa9f23c36266b4be24ab64add...f8e84a478f71befd9690626de333c38f1c2d1906
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8ecb45684a49a5efa9f23c36266b4be24ab64add...f8e84a478f71befd9690626de333c38f1c2d1906
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