diff --git a/modules/gui/qt/playlist/playlist_controller.cpp b/modules/gui/qt/playlist/playlist_controller.cpp index 6d9932e49d6066e26ad624c519241154e60a90f8..ab2a81d0d8ffdd699b33864a552df7a38bb5ebb3 100644 --- a/modules/gui/qt/playlist/playlist_controller.cpp +++ b/modules/gui/qt/playlist/playlist_controller.cpp @@ -465,6 +465,24 @@ void PlaylistControllerModel::sort(PlaylistControllerModel::SortKey key, Playlis sort(); } +void PlaylistControllerModel::sort(PlaylistControllerModel::SortKey key) +{ + if (key == SortKey::SORT_KEY_NONE) + return; + + if (getSortKey() != key) + { + setSortOrder(SortOrder::SORT_ORDER_ASC); + setSortKey(key); + } + else + { + switchSortOrder(); + } + + sort(); +} + void PlaylistControllerModel::sort(void) { Q_D(PlaylistControllerModel); diff --git a/modules/gui/qt/playlist/playlist_controller.hpp b/modules/gui/qt/playlist/playlist_controller.hpp index 775c65a316a51dcdeef4f7af666a4a7e0f28bd48..d285eded3d0ee8d07a046765b14c05a690cf46dc 100644 --- a/modules/gui/qt/playlist/playlist_controller.hpp +++ b/modules/gui/qt/playlist/playlist_controller.hpp @@ -112,6 +112,7 @@ public: void sort(const QVector<vlc_playlist_sort_criterion> &); Q_INVOKABLE void sort(SortKey key, SortOrder order); + Q_INVOKABLE void sort(SortKey key); Q_INVOKABLE void sort(void); Q_INVOKABLE void explore(const PlaylistItem& pItem);