[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: fix data update handling in ExpandGridView

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Feb 1 12:07:40 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
0815fa52 by Prince Gupta at 2024-02-01T11:51:32+00:00
qml: fix data update handling in ExpandGridView

fixes a typo

- - - - -
345111da by Prince Gupta at 2024-02-01T11:51:32+00:00
qml: allow overriding default focus handling from view loader

- - - - -
ac771c20 by Prince Gupta at 2024-02-01T11:51:32+00:00
qml: fix keyboad focus handling in video view

- - - - -
4ee84035 by Prince Gupta at 2024-02-01T11:51:32+00:00
qml: fix possible invalid acces in VideoGridItem

fixes associated warning as well

- - - - -


6 changed files:

- modules/gui/qt/maininterface/qml/MainViewLoader.qml
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml
- modules/gui/qt/medialibrary/qml/VideoGridItem.qml
- modules/gui/qt/medialibrary/qml/VideoRecentVideos.qml
- modules/gui/qt/widgets/qml/ExpandGridView.qml


Changes:

=====================================
modules/gui/qt/maininterface/qml/MainViewLoader.qml
=====================================
@@ -80,7 +80,7 @@ Widgets.StackViewExt {
     property int initialIndex: -1
 
     // used in custom focus management for explicit "focusReason" transfer
-    readonly property var setCurrentItemFocus: {
+    property var setCurrentItemFocus: {
         return Helpers.get(currentItem, "setCurrentItemFocus", setCurrentItemFocusDefault)
     }
 


=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -101,10 +101,16 @@ MainInterface.MainViewLoader {
 
     // Private events
 
+    setCurrentItemFocus: function (reason) {
+        if (headerItem && headerItem.Navigation.navigable)
+            headerItem.setCurrentItemFocus(reason)
+        else
+            setCurrentItemFocusDefault(reason)
+    }
+
     function _onNavigationUp() {
-        // NOTE: We are calling the header focus function when we have one.
-        if (headerItem && headerItem.focus)
-            headerItem.forceActiveFocus(Qt.TabFocusReason)
+        if (headerItem && headerItem.Navigation.navigable)
+            headerItem.setCurrentItemFocus(Qt.BacktabFocusReason)
         else
             Navigation.defaultNavigationUp()
     }


=====================================
modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml
=====================================
@@ -90,15 +90,6 @@ VideoAll {
         }
     }
 
-    // VideoAll reimplementation
-
-    function setCurrentItemFocus(reason) {
-        if (headerItem && headerItem.focus)
-            headerItem.forceActiveFocus(reason) // continue watching section
-        else
-            setCurrentItemFocusDefault(reason)
-    }
-
     // VideoAll events reimplementation
 
     function onAction(indexes) { _meta.onAction(indexes) }


=====================================
modules/gui/qt/medialibrary/qml/VideoGridItem.qml
=====================================
@@ -42,7 +42,7 @@ Widgets.GridItem {
     fallbackImage: VLCStyle.noArtVideoCover
 
     title: model.title || I18n.qtr("Unknown title")
-    subtitle: model.duration.formatHMS() || ""
+    subtitle: !!model && (typeof model.duration !== "undefined") ? model.duration.formatHMS() : ""
     pictureWidth: VLCStyle.gridCover_video_width
     pictureHeight: VLCStyle.gridCover_video_height
     playCoverBorderWidth: VLCStyle.gridCover_video_border


=====================================
modules/gui/qt/medialibrary/qml/VideoRecentVideos.qml
=====================================
@@ -45,7 +45,15 @@ FocusScope {
 
     implicitHeight: recentVideosColumn.height
 
-    focus: recentModel.count > 0
+    Navigation.navigable: recentModel.count > 0
+
+    function setCurrentItemFocus(reason) {
+        console.assert(root.Navigation.navigable)
+        if (reason === Qt.BacktabFocusReason)
+            view.setCurrentItemFocus(reason)
+        else
+            button.forceActiveFocus(reason)
+    }
 
     // Childs
 
@@ -112,6 +120,10 @@ FocusScope {
 
                 Navigation.parentItem: root
 
+                Navigation.downAction: function() {
+                    view.setCurrentItemFocus(Qt.TabFocusReason)
+                }
+
                 onClicked: History.push(["mc", "video", "all", "recentVideos"]);
             }
         }
@@ -130,7 +142,7 @@ FocusScope {
             leftPadding: root.leftPadding
             rightPadding: root.rightPadding
 
-            focus: recentModel.count !== 0
+            focus: true
 
             model: recentModel
 
@@ -143,6 +155,10 @@ FocusScope {
 
                 showPlayAsAudioAction: true
             }
+
+            Navigation.parentItem: root
+
+            Navigation.upItem: button
         }
 
         Widgets.SubtitleLabel {


=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -251,7 +251,7 @@ FocusScope {
 
     Connections {
         target: model
-        onDataChanged: (topLeft, bottomRigth, roles) => {
+        onDataChanged: (topLeft, bottomRight, roles) => {
             const iMin = topLeft.row
             const iMax = bottomRight.row + 1 // [] => [)
             const f_l = _currentRange



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/051c1c067e7e9f335d14def2b7c41d48880cdb7f...4ee84035a335c4d969b1b63ef2edc429c12a9605

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/051c1c067e7e9f335d14def2b7c41d48880cdb7f...4ee84035a335c4d969b1b63ef2edc429c12a9605
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