[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt/qml: replace New Media with New Videos

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Wed Jul 22 14:54:25 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
e6a69ba3 by Leon Vitanos at 2026-07-22T16:18:12+02:00
qt/qml: replace New Media with New Videos

- - - - -
e14fecce by Leon Vitanos at 2026-07-22T16:18:12+02:00
qt/qml: add New Music layout

- - - - -


4 changed files:

- modules/gui/qt/medialibrary/mlaudiomodel.cpp
- modules/gui/qt/medialibrary/mlvideomodel.cpp
- modules/gui/qt/medialibrary/qml/HomeDisplay.qml
- modules/gui/qt/medialibrary/qml/HomePage.qml


Changes:

=====================================
modules/gui/qt/medialibrary/mlaudiomodel.cpp
=====================================
@@ -84,6 +84,7 @@ vlc_ml_sorting_criteria_t MLAudioModel::nameToCriteria(QByteArray name) const
         {QByteArrayLiteral("release_year"), VLC_ML_SORTING_RELEASEDATE},
         {QByteArrayLiteral("main_artist"), VLC_ML_SORTING_ARTIST},
         {QByteArrayLiteral("duration"), VLC_ML_SORTING_DURATION},
+        {QByteArrayLiteral("insertion"), VLC_ML_SORTING_INSERTIONDATE},
     }.value(name, VLC_ML_SORTING_DEFAULT);
 }
 


=====================================
modules/gui/qt/medialibrary/mlvideomodel.cpp
=====================================
@@ -103,6 +103,7 @@ vlc_ml_sorting_criteria_t MLVideoModel::nameToCriteria(QByteArray name) const
         {QByteArrayLiteral("title"), VLC_ML_SORTING_ALPHA},
         {QByteArrayLiteral("duration"), VLC_ML_SORTING_DURATION},
         {QByteArrayLiteral("playcount"), VLC_ML_SORTING_PLAYCOUNT},
+        {QByteArrayLiteral("insertion"), VLC_ML_SORTING_INSERTIONDATE},
     }.value(name, VLC_ML_SORTING_DEFAULT);
 }
 


=====================================
modules/gui/qt/medialibrary/qml/HomeDisplay.qml
=====================================
@@ -39,8 +39,11 @@ Widgets.PageLoader {
         name: "favorites",
         component: favoritesComponent
     }, {
-        name: "newMedia",
-        component: newMediaComponent
+        name: "newVideo",
+        component: newVideoComponent
+    }, {
+        name: "newMusic",
+        component: newMusicComponent
     }]
 
     property int displayMarginBeginning: 0
@@ -138,24 +141,64 @@ Widgets.PageLoader {
     }
 
     Component {
-        id: newMediaComponent
+        id: newVideoComponent
 
         Widgets.PageExt {
-            id: newMediaPage
+            id: newVideoPage
+
+            title: qsTr("New Videos")
 
-            title: qsTr("New Medias")
+            VideoAll {
+                id: newVideo
+
+                anchors.fill: parent
+
+                focus: true
+
+                model: MLVideoModel {
+                    ml: MediaLib
+
+                    sortCriteria: newVideoPage.sort.criteria || "insertion"
+                    sortOrder: newVideoPage.sort.order
+                    searchPattern: newVideoPage.search.pattern
+                }
+
+                sectionProperty: model.sortCriteria === "title" ? "title_first_symbol" : ""
+
+                contextMenu: MLContextMenu {
+                    model: newVideo.model
+
+                    showPlayAsAudioAction: true
+                }
+
+                displayMarginBeginning: root.displayMarginBeginning
+                displayMarginEnd: root.displayMarginEnd
+
+                enableBeginningFade: root.enableBeginningFade
+                enableEndFade: root.enableEndFade
+            }
+        }
+    }
+
+    Component {
+        id: newMusicComponent
+
+        Widgets.PageExt {
+            id: newMusicPage
+
+            title: qsTr("New Music")
 
             MediaView {
                 focus: true
 
                 anchors.fill: parent
 
-                model: MLMediaModel {
+                model: MLAudioModel {
                     ml: MediaLib
 
-                    sortCriteria: newMediaPage.sort.criteria || "insertion"
-                    sortOrder: newMediaPage.sort.order
-                    searchPattern: newMediaPage.search.pattern
+                    sortCriteria: newMusicPage.sort.criteria || "insertion"
+                    sortOrder: newMusicPage.sort.order
+                    searchPattern: newMusicPage.search.pattern
                 }
 
                 displayMarginBeginning: root.displayMarginBeginning


=====================================
modules/gui/qt/medialibrary/qml/HomePage.qml
=====================================
@@ -68,8 +68,10 @@ Widgets.PageExt {
             continueWatchingRow.setCurrentItemFocus(reason)
         else if (favoritesRow.focus)
             favoritesRow.setCurrentItemFocus(reason)
-        else if (newMediaRow.focus)
-            newMediaRow.setCurrentItemFocus(reason)
+        else if (newVideoRow.focus)
+            newVideoRow.setCurrentItemFocus(reason)
+        else if (newMusicRow.focus)
+            newMusicRow.setCurrentItemFocus(reason)
         else
             coneNButtons.forceActiveFocus(reason)
     }
@@ -135,7 +137,7 @@ Widgets.PageExt {
             }
 
             MainCtx.setTimeout(() => {
-                flickable._hasMedias = Qt.binding(() => { return continueWatchingRow.visible || favoritesRow.visible || newMediaRow.visible } )
+                flickable._hasMedias = Qt.binding(() => { return continueWatchingRow.visible || favoritesRow.visible || newVideoRow.visible || newMusicRow.visible } )
             }, 50, [], flickable)
         }
 
@@ -159,7 +161,7 @@ Widgets.PageExt {
             anchors.centerIn: flickable._hasMedias ? undefined : parent
             anchors.top: flickable._hasMedias ? parent.top : undefined
             anchors.left: flickable._hasMedias ? parent.left : undefined
-            anchors.leftMargin: flickable._hasMedias ? newMediaRow.contentLeftMargin : 0
+            anchors.leftMargin: flickable._hasMedias ? newVideoRow.contentLeftMargin : 0
 
             Navigation.parentItem: root
             Navigation.upItem: root.header
@@ -337,18 +339,96 @@ Widgets.PageExt {
             }
 
             Widgets.ViewHeader {
-                text: qsTr("New Medias")
-                visible: newMediaRow.visible
-                view: newMediaRow
-                seeAllButton.visible: newMediaRow.model.maximumCount > newMediaRow.model.count
+                text: qsTr("New Videos")
+                visible: newVideoRow.visible
+                view: newVideoRow
+                seeAllButton.visible: newVideoRow.model.maximumCount > newVideoRow.model.count
 
                 onSeeAllButtonClicked: function (reason) {
-                    root.seeAllButtonClicked("newMedia", reason)
+                    root.seeAllButtonClicked("newVideo", reason)
+                }
+            }
+
+            VideoAll {
+                id: newVideoRow
+
+                anchors.left: parent.left
+                anchors.right: parent.right
+
+                height: currentItem?.contentHeight ?? implicitHeight
+
+                visible: model.count !== 0
+
+                headerPositioning: ListView.InlineHeader
+                enableBeginningFade: false
+                enableEndFade: false
+                sectionProperty: ""
+
+                interactive: false
+
+                emptyLabel: null
+
+                // FIXME: `ExpandGridView` causes extreme performance degradation when `reuseItems`
+                //        is true and items provided by the model change (#29084).
+                reuseItems: !MainCtx.gridView
+
+                listCoverWidth: root.listCoverWidth
+                listCoverHeight: root.listCoverHeight
+                listCoverRadius: root.listCoverRadius
+
+                Navigation.parentItem: mediaRows
+
+                model: MLVideoModel {
+                    ml: MediaLib
+
+                    sortCriteria: root.sort.criteria || "insertion"
+                    sortOrder: root.sort.order
+                    searchPattern: root.search.pattern
+
+                    // FIXME: Make limit 0 load no items, instead of loading all items.
+                    limit: MainCtx.gridView ? Math.max(newVideoRow.currentItem?.nbItemPerRow ?? null, 1) : 5
+                }
+
+                contextMenu: MLContextMenu {
+                    model: newVideoRow.model
+
+                    showPlayAsAudioAction: true
+                }
+
+                onActiveFocusChanged: {
+                    if (activeFocus) {
+                        const item = currentItem?.currentItem ?? currentItem?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
+                        contentYBehavior.enabled = true
+                        Helpers.positionFlickableToContainItem(flickable, item ?? this)
+                        contentYBehavior.enabled = false
+                    }
+                }
+
+                onCurrentIndexChanged: {
+                    if (activeFocus) {
+                        const item = currentItem?.currentItem ?? currentItem?._getItem(currentIndex) // FIXME: `ExpandGridView` does not have `currentItem`.
+                        if (item) {
+                            contentYBehavior.enabled = true
+                            Helpers.positionFlickableToContainItem(flickable, item)
+                            contentYBehavior.enabled = false
+                        }
+                    }
+                }
+            }
+
+            Widgets.ViewHeader {
+                text: qsTr("New Music")
+                visible: newMusicRow.visible
+                view: newMusicRow
+                seeAllButton.visible: newMusicRow.model.maximumCount > newMusicRow.model.count
+
+                onSeeAllButtonClicked: function (reason) {
+                    root.seeAllButtonClicked("newMusic", reason)
                 }
             }
 
             MediaView {
-                id: newMediaRow
+                id: newMusicRow
 
                 anchors.left: parent.left
                 anchors.right: parent.right
@@ -376,7 +456,7 @@ Widgets.PageExt {
 
                 Navigation.parentItem: mediaRows
 
-                model: MLMediaModel {
+                model: MLAudioModel {
                     ml: MediaLib
 
                     sortCriteria: root.sort.criteria || "insertion"
@@ -384,7 +464,7 @@ Widgets.PageExt {
                     searchPattern: root.search.pattern
 
                     // FIXME: Make limit 0 load no items, instead of loading all items.
-                    limit: MainCtx.gridView ? Math.max(newMediaRow.currentItem?.nbItemPerRow ?? null, 1) : 5
+                    limit: MainCtx.gridView ? Math.max(newMusicRow.currentItem?.nbItemPerRow ?? null, 1) : 5
                 }
 
                 onActiveFocusChanged: {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7c7d50a4f54051480e9d042909f02214d26889da...e14fecced479021ddc90c9703a3b47d79175248c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7c7d50a4f54051480e9d042909f02214d26889da...e14fecced479021ddc90c9703a3b47d79175248c
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list