[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: add count column for grouped videos

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Mar 25 01:06:47 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
30e408a3 by Leon Vitanos at 2026-03-25T01:38:36+01:00
qml: add count column for grouped videos

- - - - -
3307ca77 by Leon Vitanos at 2026-03-25T01:38:36+01:00
qt: expose count as nb_videos for video groups

- - - - -
a351e77e by Leon Vitanos at 2026-03-25T01:38:36+01:00
qml: show nb_videos in compact list view

- - - - -
88ee3005 by Leon Vitanos at 2026-03-25T01:38:36+01:00
qml: remove count labels from list view

- - - - -


8 changed files:

- modules/gui/qt/medialibrary/mlvideofoldersmodel.cpp
- modules/gui/qt/medialibrary/mlvideofoldersmodel.hpp
- modules/gui/qt/medialibrary/mlvideogroupsmodel.cpp
- modules/gui/qt/medialibrary/mlvideogroupsmodel.hpp
- modules/gui/qt/medialibrary/qml/VideoAll.qml
- modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml
- modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
- modules/gui/qt/widgets/qml/TableColumns.qml


Changes:

=====================================
modules/gui/qt/medialibrary/mlvideofoldersmodel.cpp
=====================================
@@ -57,6 +57,7 @@ QHash<int, QByteArray> MLVideoFoldersModel::roleNames() const /* override */
         { FOLDER_THUMBNAIL, "thumbnail" },
         { FOLDER_DURATION, "duration" },
         { FOLDER_COUNT, "count" },
+        { FOLDER_NB_VIDEOS, "nb_videos" },
     };
 }
 
@@ -90,6 +91,7 @@ QVariant MLVideoFoldersModel::itemRoleData(const MLItem * item, const int role)
         case FOLDER_DURATION:
             return QVariant::fromValue(folder->getDuration());
         case FOLDER_COUNT:
+        case FOLDER_NB_VIDEOS:
             return QVariant::fromValue(folder->getVideoCount());
         default:
             return QVariant();


=====================================
modules/gui/qt/medialibrary/mlvideofoldersmodel.hpp
=====================================
@@ -39,7 +39,8 @@ public:
         FOLDER_TITLE_FIRST_SYMBOL,
         FOLDER_THUMBNAIL,
         FOLDER_DURATION,
-        FOLDER_COUNT
+        FOLDER_COUNT,
+        FOLDER_NB_VIDEOS
     };
 
 public:


=====================================
modules/gui/qt/medialibrary/mlvideogroupsmodel.cpp
=====================================
@@ -64,6 +64,7 @@ QHash<int, QByteArray> MLVideoGroupsModel::roleNames() const /* override */
         {GROUP_TITLE_FIRST_SYMBOL, "group_title_first_symbol"},
         {GROUP_DATE, "date"},
         {GROUP_COUNT, "count"},
+        {GROUP_NB_VIDEOS, "nb_videos"},
     };
 
     hash.insert(groupRoles);
@@ -109,6 +110,7 @@ QVariant MLVideoGroupsModel::itemRoleData(const MLItem * item, const int role) c
             case GROUP_DATE:
                 return QVariant::fromValue(group->getDate());
             case GROUP_COUNT:
+            case GROUP_NB_VIDEOS:
                 return QVariant::fromValue(group->getCount());
             default:
                 return QVariant();
@@ -131,6 +133,7 @@ QVariant MLVideoGroupsModel::itemRoleData(const MLItem * item, const int role) c
             case GROUP_DATE:
                 return QVariant();
             case GROUP_COUNT:
+            case GROUP_NB_VIDEOS:
                 return 1;
             // NOTE: Media specific.
             default:


=====================================
modules/gui/qt/medialibrary/mlvideogroupsmodel.hpp
=====================================
@@ -38,7 +38,8 @@ public:
         GROUP_IS_VIDEO = MLVideoModel::VIDEO_ROLES_COUNT,
         GROUP_TITLE_FIRST_SYMBOL,
         GROUP_DATE,
-        GROUP_COUNT
+        GROUP_COUNT,
+        GROUP_NB_VIDEOS
     };
 
 public:


=====================================
modules/gui/qt/medialibrary/qml/VideoAll.qml
=====================================
@@ -69,6 +69,8 @@ MainViewLoader {
     property var gridLabels: getLabel
     property var listLabels: getLabel
 
+    property bool showGroupCountColumn: false
+
     // Aliases
 
     property alias dragItem: dragItem
@@ -236,6 +238,8 @@ MainViewLoader {
             }
 
             coverLabels: root.listLabels
+
+            showGroupCountColumn: root.showGroupCountColumn
         }
     }
 


=====================================
modules/gui/qt/medialibrary/qml/VideoAllSubDisplay.qml
=====================================
@@ -82,6 +82,8 @@ VideoAll {
 
     sectionProperty: _meta?.sectionProperty ?? ""
 
+    showGroupCountColumn: _meta?.showGroupCountColumn ?? false
+
     header: Widgets.ViewHeader {
         view: root
 
@@ -186,9 +188,11 @@ VideoAll {
             }
 
             property var listLabels: function (model) {
-                return root.getLabelGroup(model, qsTr("%1"))
+                return root.getLabel(model)
             }
 
+            property bool showGroupCountColumn: true
+
             function onAction(indexes) {
                 const index = indexes[0]
 
@@ -247,9 +251,11 @@ VideoAll {
             }
 
             property var listLabels: function (model) {
-                return root.getLabelGroup(model, qsTr("%1"))
+                return root.getLabel(model)
             }
 
+            property bool showGroupCountColumn: true
+
             function onAction(indexes) {
                 const index = indexes[0]
 


=====================================
modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
=====================================
@@ -38,6 +38,8 @@ Widgets.TableViewExt {
 
     property var coverLabels
 
+    property bool showGroupCountColumn: false
+
     //---------------------------------------------------------------------------------------------
     // Private
 
@@ -47,7 +49,8 @@ Widgets.TableViewExt {
         model: ({
             criteria: mainCriteria,
 
-            subCriterias: [ "duration" ],
+            subCriterias: showGroupCountColumn ? [ "nb_videos", "duration" ]
+                                               : [ "duration" ],
 
             showSection: "title",
 
@@ -60,36 +63,53 @@ Widgets.TableViewExt {
         })
     }]
 
-    property var _modelMedium: [{
-        weight: 1,
+    property var _modelMedium: (function(){
+        const medium = [{
+            weight: 1,
 
-        model: ({
-            criteria: mainCriteria,
+            model: ({
+                criteria: mainCriteria,
 
-            showSection: "title",
+                showSection: "title",
 
-            text: qsTr("Title"),
+                text: qsTr("Title"),
 
-            headerDelegate: tableColumns.titleHeaderDelegate,
-            colDelegate   : tableColumns.titleDelegate,
+                headerDelegate: tableColumns.titleHeaderDelegate,
+                colDelegate   : tableColumns.titleDelegate,
 
-            placeHolder: VLCStyle.noArtVideoCover
-        })
-    }, {
-        size: 1,
+                placeHolder: VLCStyle.noArtVideoCover
+            })
+        }]
 
-        model: ({
-            criteria: "duration",
+        if (showGroupCountColumn) {
+            medium.push({
+                size: 0.5,
+                model: ({
+                    criteria: "nb_videos",
+                    text: qsTr("Videos"),
+                    isSortable: false
+                })
+            })
+        }
+
+        medium.push({
+            size: 0.5,
 
-            text: qsTr("Duration"),
+            model: ({
+                criteria: "duration",
 
-            showSection: "",
-            showContextButton: true,
+                text: qsTr("Duration"),
 
-            headerDelegate: tableColumns.timeHeaderDelegate,
-            colDelegate   : tableColumns.timeColDelegate
+                showSection: "",
+                showContextButton: true,
+
+                headerDelegate: tableColumns.timeHeaderDelegate,
+                colDelegate   : tableColumns.timeColDelegate
+            })
         })
-    }]
+
+        return medium
+    })()
 
     // Settings
 


=====================================
modules/gui/qt/widgets/qml/TableColumns.qml
=====================================
@@ -77,11 +77,11 @@ Item {
             const value = rowModel[criteria]
 
             if (value.formatShort) {
-
                 string += value.formatShort()
             } else if (criteria === "nb_tracks") {
-
                 string += qsTr("%1 track", "%1 tracks", value).arg(value)
+            } else if (criteria === "nb_videos") {
+                string += qsTr("%1 video", "%1 videos", value).arg(value)
             } else {
                 string += value
             }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/06c13ef3e6962ce3c6deb531338d153edb8d5d68...88ee30057d766225dc26810fbd932d00470e7c85

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/06c13ef3e6962ce3c6deb531338d153edb8d5d68...88ee30057d766225dc26810fbd932d00470e7c85
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list