[vlc-commits] qml: use playlist sort menu model from the backend

Fatih Uzunoglu git at videolan.org
Tue Jan 12 13:20:19 UTC 2021


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Jan  8 00:36:22 2021 +0300| [c7fac5323e80e138920948479e262016097ff03f] | committer: Pierre Lamot

qml: use playlist sort menu model from the backend

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c7fac5323e80e138920948479e262016097ff03f
---

 modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml | 11 +----------
 modules/gui/qt/playlist/qml/PlaylistToolbar.qml     | 18 ++++--------------
 2 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml b/modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml
index 77cb4c2220..ea855a978f 100644
--- a/modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml
@@ -212,16 +212,7 @@ Widgets.OverlayMenu {
     }
 
     Repeater {
-        model: [{title: i18n.qtr("Title"), key: PlaylistControllerModel.SORT_KEY_TITLE},
-                {title: i18n.qtr("Duration"), key: PlaylistControllerModel.SORT_KEY_DURATION},
-                {title: i18n.qtr("Artist"), key: PlaylistControllerModel.SORT_KEY_ARTIST},
-                {title: i18n.qtr("Album"), key: PlaylistControllerModel.SORT_KEY_ALBUM},
-                {title: i18n.qtr("Album Artist"), key: PlaylistControllerModel.SORT_KEY_ALBUM_ARTIST},
-                {title: i18n.qtr("Genre"), key: PlaylistControllerModel.SORT_KEY_GENRE},
-                {title: i18n.qtr("Date"), key: PlaylistControllerModel.SORT_KEY_DATE},
-                {title: i18n.qtr("Track Number"), key: PlaylistControllerModel.SORT_KEY_TRACK_NUMBER},
-                {title: i18n.qtr("URL"), key: PlaylistControllerModel.SORT_KEY_URL},
-                {title: i18n.qtr("Rating"), key: PlaylistControllerModel.SORT_KEY_RATING}]
+        model: mainPlaylistController.sortKeyTitleList
 
         delegate: Loader {
             asynchronous: true
diff --git a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
index 6a3c4fdf8b..f1a1f44a2f 100644
--- a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
@@ -86,23 +86,13 @@ Widgets.NavigableFocusScope {
 
                 focusPolicy: Qt.NoFocus
 
-                model: [
-                    { text: i18n.qtr("Title"),            criteria: PlaylistControllerModel.SORT_KEY_TITLE },
-                    { text: i18n.qtr("Duration"),         criteria: PlaylistControllerModel.SORT_KEY_DURATION },
-                    { text: i18n.qtr("Artist"),           criteria: PlaylistControllerModel.SORT_KEY_ARTIST },
-                    { text: i18n.qtr("Album"),            criteria: PlaylistControllerModel.SORT_KEY_ALBUM },
-                    { text: i18n.qtr("Genre"),            criteria: PlaylistControllerModel.SORT_KEY_GENRE },
-                    { text: i18n.qtr("Date"),             criteria: PlaylistControllerModel.SORT_KEY_DATE },
-                    { text: i18n.qtr("Track number"),     criteria: PlaylistControllerModel.SORT_KEY_TRACK_NUMBER },
-                    { text: i18n.qtr("URL"),              criteria: PlaylistControllerModel.SORT_KEY_URL },
-                    { text: i18n.qtr("Rating"),           criteria: PlaylistControllerModel.SORT_KEY_RATING },
-                ]
-                textRole: "text"
-                criteriaRole: "criteria"
+                model: mainPlaylistController.sortKeyTitleList
+                textRole: "title"
+                criteriaRole: "key"
 
                 listWidth: VLCStyle.widthSortBox
                 onSortSelected: {
-                    mainPlaylistController.sort(modelData.criteria)
+                    mainPlaylistController.sort(modelData.key)
                 }
 
                 colors: playlistToolbar.colors



More information about the vlc-commits mailing list