[vlc-commits] [Git][videolan/vlc][master] qml: restore last used sorting criteria and order on startup
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Mar 17 14:36:26 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
1b0f6732 by Leon Vitanos at 2026-03-17T14:06:41+00:00
qml: restore last used sorting criteria and order on startup
- - - - -
2 changed files:
- modules/gui/qt/maininterface/qml/MainInterface.qml
- modules/gui/qt/util/qml/ModelSortSettingHandler.qml
Changes:
=====================================
modules/gui/qt/maininterface/qml/MainInterface.qml
=====================================
@@ -51,8 +51,6 @@ Item {
{ name: "minimal", url:"qrc:///qt/qml/VLC/Player/MinimalView.qml" },
]
- property var _oldHistoryPath: ([])
-
function setInitialView() {
//set the initial view
if (!MainPlaylistController.empty)
@@ -62,18 +60,27 @@ Item {
}
function loadCurrentHistoryView(focusReason) {
- contextSaver.save(_oldHistoryPath)
-
stackView.loadView(History.viewPath, History.viewProp, focusReason)
contextSaver.restore(History.viewPath)
- _oldHistoryPath = History.viewPath
}
ModelSortSettingHandler {
id: contextSaver
}
+ Connections {
+ target: MainCtx.sort
+
+ function onCriteriaChanged(criteria) {
+ contextSaver.save(History.viewPath)
+ }
+
+ function onOrderChanged(order) {
+ contextSaver.save(History.viewPath)
+ }
+ }
+
Item {
id: g_mainInterface
=====================================
modules/gui/qt/util/qml/ModelSortSettingHandler.qml
=====================================
@@ -28,8 +28,12 @@ QtObject {
readonly property string _sortCriteriaKey: "sortCriteria"
readonly property string _sortOrderKey: "sortOrder"
+ property bool _restoring: false
function save(path) {
+ if (_restoring)
+ return
+
const orderKey = [_sortOrderKey, ...path].join("/")
const critKey = [_sortCriteriaKey, ...path].join("/")
if (MainCtx.sort.available) {
@@ -42,6 +46,8 @@ QtObject {
const orderKey = [_sortOrderKey, ...path].join("/")
const critKey = [_sortCriteriaKey, ...path].join("/")
+ _restoring = true
+
const criteria = MainCtx.settingValue(critKey, undefined)
if (criteria !== undefined)
MainCtx.sort.criteria = criteria
@@ -49,5 +55,8 @@ QtObject {
const order = MainCtx.settingValue(orderKey, undefined)
if (order !== undefined)
MainCtx.sort.order = parseInt(order)
+
+ _restoring = false
}
+
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1b0f673291a3035bec8763d449545c34ec572597
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1b0f673291a3035bec8763d449545c34ec572597
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list