[vlc-commits] qt: add sort(key) function to PlaylistControllerModel
Fatih Uzunoglu
git at videolan.org
Tue Jan 12 13:20:15 UTC 2021
vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Jan 8 00:36:18 2021 +0300| [c71a44ce511fbb0429b2857ecef471d27ecf8afe] | committer: Pierre Lamot
qt: add sort(key) function to PlaylistControllerModel
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c71a44ce511fbb0429b2857ecef471d27ecf8afe
---
modules/gui/qt/playlist/playlist_controller.cpp | 18 ++++++++++++++++++
modules/gui/qt/playlist/playlist_controller.hpp | 1 +
2 files changed, 19 insertions(+)
diff --git a/modules/gui/qt/playlist/playlist_controller.cpp b/modules/gui/qt/playlist/playlist_controller.cpp
index 6d9932e49d..ab2a81d0d8 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 775c65a316..d285eded3d 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);
More information about the vlc-commits
mailing list