[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt/mlgrouplistmodel: Add VLC_ML_SORTING_DURATION

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Wed Dec 8 10:14:06 UTC 2021



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


Commits:
21c688d7 by Benjamin Arnaud at 2021-12-08T09:58:39+00:00
qt/mlgrouplistmodel: Add VLC_ML_SORTING_DURATION

fix #26281

- - - - -
c1e7e96a by Benjamin Arnaud at 2021-12-08T09:58:39+00:00
qml/MediaGroupList: Update the 'sortModel' property

- - - - -
07f6be92 by Benjamin Arnaud at 2021-12-08T09:58:39+00:00
qml/MediaGroupList: Fix double click on TableView

- - - - -


2 changed files:

- modules/gui/qt/medialibrary/mlgrouplistmodel.cpp
- modules/gui/qt/medialibrary/qml/MediaGroupList.qml


Changes:

=====================================
modules/gui/qt/medialibrary/mlgrouplistmodel.cpp
=====================================
@@ -44,9 +44,9 @@ static const int MLGROUPLISTMODEL_COVER_HEIGHT = 320 * 2;
 
 static const QHash<QByteArray, vlc_ml_sorting_criteria_t> criterias =
 {
-    {"id",   VLC_ML_SORTING_DEFAULT},
-    {"name", VLC_ML_SORTING_ALPHA},
-    {"date", VLC_ML_SORTING_INSERTIONDATE}
+    { "name",     VLC_ML_SORTING_ALPHA         },
+    { "duration", VLC_ML_SORTING_DURATION      },
+    { "date",     VLC_ML_SORTING_INSERTIONDATE }
 };
 
 //=================================================================================================
@@ -181,6 +181,8 @@ vlc_ml_sorting_criteria_t MLGroupListModel::roleToCriteria(int role) const /* ov
     {
         case GROUP_NAME:
             return VLC_ML_SORTING_ALPHA;
+        case GROUP_DURATION:
+            return VLC_ML_SORTING_DURATION;
         case GROUP_DATE:
             return VLC_ML_SORTING_INSERTIONDATE;
         default:


=====================================
modules/gui/qt/medialibrary/qml/MediaGroupList.qml
=====================================
@@ -41,8 +41,9 @@ FocusScope {
     property int initialIndex: 0
 
     property var sortModel: [
-        { text: i18n.qtr("Alphabetic"), criteria: "name" },
-        { text: i18n.qtr("Date"),       criteria: "date" }
+        { text: i18n.qtr("Alphabetic"), criteria: "name"     },
+        { text: i18n.qtr("Duration"),   criteria: "duration" },
+        { text: i18n.qtr("Date"),       criteria: "date"     }
     ]
 
     //---------------------------------------------------------------------------------------------
@@ -369,6 +370,9 @@ FocusScope {
 
             onActionForSelection: _actionAtIndex()
 
+            // NOTE: We make sure we're double clicking on a group.
+            onItemDoubleClicked: if (model.count > 1) showList(model, Qt.MouseFocusReason)
+
             onContextMenuButtonClicked: contextMenu.popup(modelSelect.selectedIndexes,
                                                           menuParent.mapToGlobal(0,0))
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/378d84f8a528919d0ad4aed7acf529d4ea5c39ae...07f6be926c94d46fa8cc6f1d988c2c0a0dd74044

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/378d84f8a528919d0ad4aed7acf529d4ea5c39ae...07f6be926c94d46fa8cc6f1d988c2c0a0dd74044
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list