[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: use `Loader` instead of `StackViewExt` in `BrowseDeviceView`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Apr 7 16:47:55 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
bf14995c by Fatih Uzunoglu at 2025-04-07T16:32:40+00:00
qml: use `Loader` instead of `StackViewExt` in `BrowseDeviceView`
It does not make any sense to use stack view here.
- - - - -
041bf8d8 by Fatih Uzunoglu at 2025-04-07T16:32:40+00:00
qml: use `Loader` instead of `StackViewExt` in `MusicArtist.qml`
It does not make any sense to use stack view here.
- - - - -
d94fd047 by Fatih Uzunoglu at 2025-04-07T16:32:40+00:00
qml: use `Loader` instead of `StackViewExt` in `MainViewLoader.qml`
It does not make any sense to use stack view here.
- - - - -
5 changed files:
- modules/gui/qt/maininterface/qml/MainViewLoader.qml
- modules/gui/qt/medialibrary/qml/MusicArtist.qml
- modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml
- modules/gui/qt/medialibrary/qml/VideoRecentVideos.qml
- modules/gui/qt/network/qml/BrowseDeviceView.qml
Changes:
=====================================
modules/gui/qt/maininterface/qml/MainViewLoader.qml
=====================================
@@ -23,11 +23,10 @@ import QtQml.Models
import VLC.MainInterface
-import VLC.Widgets as Widgets
import VLC.Util
import VLC.Style
-Widgets.StackViewExt {
+Loader {
id: root
/*
@@ -111,6 +110,10 @@ Widgets.StackViewExt {
// gets called multiple times even when the currentComponent stays the same.
property Component currentComponent: MainCtx.gridView ? grid : list
+ // ### StackView compat:
+ property alias initialItem: root.sourceComponent
+ property alias currentItem: root.item
+
// Navigation
// handle cancelAction, if currentIndex is set reset it to 0
@@ -191,7 +194,7 @@ Widgets.StackViewExt {
}
function _loadView(reason) {
- replace(null, currentComponent)
+ sourceComponent = currentComponent
if (typeof reason !== "undefined")
setCurrentItemFocus(reason)
=====================================
modules/gui/qt/medialibrary/qml/MusicArtist.qml
=====================================
@@ -57,9 +57,9 @@ FocusScope {
return headerItem.albumsListView.currentIndex
}
- property alias rightPadding: view.rightPadding
+ property real rightPadding
- property alias _currentView: view.currentItem
+ property alias _currentView: loader.item
property var _artist: ({})
@@ -281,11 +281,11 @@ FocusScope {
onArtistIdChanged: fetchArtistData()
function setCurrentItemFocus(reason) {
- if (view.currentItem === null) {
+ if (loader.item === null) {
Qt.callLater(setCurrentItemFocus, reason)
return
}
- view.currentItem.setCurrentItemFocus(reason);
+ loader.item.setCurrentItemFocus(reason);
}
function resetFocus() {
@@ -608,22 +608,13 @@ FocusScope {
}
}
- Widgets.StackViewExt {
- id: view
+ Loader {
+ id: loader
anchors.fill: parent
+ anchors.rightMargin: root.rightPadding
focus: albumModel.count !== 0
- initialItem: MainCtx.gridView ? gridComponent : tableComponent
-
- Connections {
- target: MainCtx
- function onGridViewChanged() {
- if (MainCtx.gridView)
- view.replace(gridComponent)
- else
- view.replace(tableComponent)
- }
- }
+ sourceComponent: MainCtx.gridView ? gridComponent : tableComponent
}
}
=====================================
modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml
=====================================
@@ -263,9 +263,6 @@ VideoAll {
header: VideoRecentVideos {
width: root.width
- leftPadding: root.leftPadding
- rightPadding: root.rightPadding
-
nbItemPerRow: root.currentItem?.nbItemPerRow ?? 0
allVideosContentLeftMargin: root.currentItem?.contentLeftMargin ?? 0
=====================================
modules/gui/qt/medialibrary/qml/VideoRecentVideos.qml
=====================================
@@ -117,11 +117,14 @@ FocusScope {
visible: recentModel.count > 0
- width: root.width
- height: currentItem?.contentHeight ?? 0
+ anchors {
+ left: parent.left
+ right: parent.right
+ leftMargin: root.leftPadding
+ rightMargin: root.rightPadding
+ }
- leftPadding: root.leftPadding
- rightPadding: root.rightPadding
+ height: currentItem?.contentHeight ?? 0
focus: true
=====================================
modules/gui/qt/network/qml/BrowseDeviceView.qml
=====================================
@@ -65,7 +65,7 @@ FocusScope {
Navigation.parentItem: root
Navigation.downAction: function() {
- view.setCurrentItemFocus(Qt.TabFocusReason)
+ loader.setCurrentItemFocus(Qt.TabFocusReason)
}
onSeeAllButtonClicked: reason => root.seeAll(reason)
@@ -75,12 +75,12 @@ FocusScope {
// Aliases
- property alias leftPadding: view.leftPadding
- property alias rightPadding: view.rightPadding
+ property alias leftPadding: loader.anchors.leftMargin
+ property alias rightPadding: loader.anchors.rightMargin
// Private
- property alias _currentView: view.currentItem
+ property alias _currentView: loader.item
// Signals
@@ -99,15 +99,6 @@ FocusScope {
// Connections
- Connections {
- target: MainCtx
-
- function onGridViewChanged() {
- if (MainCtx.gridView) view.replace(grid)
- else view.replace(list)
- }
- }
-
// Functions
function playAt(index) {
@@ -171,14 +162,14 @@ FocusScope {
model: root.model
}
- Widgets.StackViewExt {
- id: view
+ Loader {
+ id: loader
anchors.fill: parent
focus: (model.count !== 0)
- initialItem: (MainCtx.gridView) ? grid : list
+ sourceComponent: (MainCtx.gridView) ? grid : list
}
Component {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e80f981cca98f4fbf16dfed6e2f93748de6415d0...d94fd0473fb7b55ca467692d1ee8b9714b1338c9
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e80f981cca98f4fbf16dfed6e2f93748de6415d0...d94fd0473fb7b55ca467692d1ee8b9714b1338c9
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