[vlc-commits] qml: use backend function for sorting in Playlist

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


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

qml: use backend function for sorting in Playlist

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

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

 modules/gui/qt/playlist/qml/PlaylistListView.qml    | 12 ------------
 modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml | 20 ++++++++++----------
 modules/gui/qt/playlist/qml/PlaylistToolbar.qml     |  2 +-
 3 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/modules/gui/qt/playlist/qml/PlaylistListView.qml b/modules/gui/qt/playlist/qml/PlaylistListView.qml
index 1def0d4c61..fc0e8ecea0 100644
--- a/modules/gui/qt/playlist/qml/PlaylistListView.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistListView.qml
@@ -61,18 +61,6 @@ Widgets.NavigableFocusScope {
         drop.accept(Qt.IgnoreAction)
     }
 
-    function sortPL(key) {
-        if (mainPlaylistController.sortKey !== key) {
-            mainPlaylistController.setSortOrder(PlaylistControllerModel.SORT_ORDER_ASC)
-            mainPlaylistController.setSortKey(key)
-        }
-        else {
-            mainPlaylistController.switchSortOrder()
-        }
-
-        mainPlaylistController.sort()
-    }
-
     PlaylistOverlayMenu {
         id: overlayMenu
         anchors.fill: parent
diff --git a/modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml b/modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml
index 01d3f89bff..37a5f66236 100644
--- a/modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistOverlayMenu.qml
@@ -199,7 +199,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortTitleAction
         text: i18n.qtr("Title")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_TITLE
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -208,7 +208,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortDurationAction
         text: i18n.qtr("Duration")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_DURATION
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -217,7 +217,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortArtistAction
         text: i18n.qtr("Artist")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_ARTIST
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -226,7 +226,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortAlbumAction
         text: i18n.qtr("Album")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_ALBUM
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -235,7 +235,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortAlbumArtistAction
         text: i18n.qtr("Album Artist")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_ALBUM_ARTIST
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -244,7 +244,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortGenreAction
         text: i18n.qtr("Genre")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_GENRE
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -253,7 +253,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortDateAction
         text: i18n.qtr("Date")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_DATE
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -262,7 +262,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortTrackNumberAction
         text: i18n.qtr("Track Number")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_TRACK_NUMBER
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -271,7 +271,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortURLAction
         text: i18n.qtr("URL")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_URL
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
@@ -280,7 +280,7 @@ Widgets.OverlayMenu {
     Action {
         id: sortRatingAction
         text: i18n.qtr("Rating")
-        onTriggered: root.sortPL(key)
+        onTriggered: mainPlaylistController.sort(key)
         readonly property int key: PlaylistControllerModel.SORT_KEY_RATING
         readonly property string marking: sortOrderMarkRetriever(key)
         readonly property bool tickMark: (key === mainPlaylistController.sortKey)
diff --git a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
index 44be0441d7..6a3c4fdf8b 100644
--- a/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
+++ b/modules/gui/qt/playlist/qml/PlaylistToolbar.qml
@@ -102,7 +102,7 @@ Widgets.NavigableFocusScope {
 
                 listWidth: VLCStyle.widthSortBox
                 onSortSelected: {
-                    root.sortPL(modelData.criteria)
+                    mainPlaylistController.sort(modelData.criteria)
                 }
 
                 colors: playlistToolbar.colors



More information about the vlc-commits mailing list