[vlc-commits] qml: add sortOrderSelected signal to SortControl
Fatih Uzunoglu
git at videolan.org
Thu Oct 15 10:32:44 CEST 2020
vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Oct 9 19:56:34 2020 +0300| [017a8f89894ec0b21b44f45c856dfda3e20c98df] | committer: Pierre Lamot
qml: add sortOrderSelected signal to SortControl
This signal is needed when parent does not automatically switch sort order if sort key is the same when sortSelected triggered
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=017a8f89894ec0b21b44f45c856dfda3e20c98df
---
modules/gui/qt/widgets/qml/SortControl.qml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/modules/gui/qt/widgets/qml/SortControl.qml b/modules/gui/qt/widgets/qml/SortControl.qml
index 9129b8a6d7..951583075f 100644
--- a/modules/gui/qt/widgets/qml/SortControl.qml
+++ b/modules/gui/qt/widgets/qml/SortControl.qml
@@ -46,7 +46,10 @@ Widgets.NavigableFocusScope {
property var sortKey : PlaylistControllerModel.SORT_KEY_NONE
property var sortOrder : undefined
+ property bool _intSortOrder : false
+
signal sortSelected(var modelData)
+ signal sortOrderSelected(var order)
onFocusChanged: {
if (!focus)
@@ -190,7 +193,24 @@ Widgets.NavigableFocusScope {
onClicked: {
root.currentIndex = index
+
+ if (root.sortOrder !== undefined) {
+ var _sortOrder = root.sortOrder
+ var _sortKey = root.sortKey
+ }
+
root.sortSelected(Array.isArray(root.model) ? modelData : model)
+
+ if (root.sortOrder !== undefined) {
+ if (root.sortKey !== _sortKey)
+ root._intSortOrder = false
+
+ if (root.sortOrder === _sortOrder) {
+ root.sortOrderSelected(root._intSortOrder ? PlaylistControllerModel.SORT_ORDER_DESC : PlaylistControllerModel.SORT_ORDER_ASC)
+ root._intSortOrder = !root._intSortOrder
+ }
+ }
+
popup.close()
}
}
More information about the vlc-commits
mailing list