[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: fix unable to drag a large collection of media
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Sep 6 13:25:42 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
f358ddf2 by Fatih Uzunoglu at 2024-09-06T13:00:46+00:00
qt: fix unable to drag a large collection of media
When `Drag.active` is unset, the FSM goes into inactive
state even though the input items are yet to be parsed.
Unlike loading done and loading failed states, inactive
state does not have an handling mechanism when the input
items are ready.
We should not fail the drag early if the input items can
not be collected until the drag operation finishes.
Ideally, this should be a synchronous operation, but it
can be asynchronously handled like this as well because
we can invalidate the drag if the user starts a new drag
operation before the previous operation is completed.
- - - - -
76fb17bb by Fatih Uzunoglu at 2024-09-06T13:00:46+00:00
qt: reset input items in DragItem when a new drag is initiated
If a new drag is initiated before the previous one is completed
(succeeded or failed), we should reset the input items so that
the new operation starts fresh and does not use the obsolete
input items.
- - - - -
1 changed file:
- modules/gui/qt/widgets/qml/DragItem.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/DragItem.qml
=====================================
@@ -94,7 +94,7 @@ Item {
readonly property int _displayedCoversCount: Math.min(_indexesSize, _maxCovers + 1)
- property var _inputItems: []
+ property var _inputItems
property var _data: []
@@ -273,7 +273,22 @@ Item {
}
transitions: ({
- startDrag: fsmDragActive
+ startDrag: fsmDragActive,
+ resolveInputItems: {
+ guard: (requestId, items) => requestId === dragItem._currentRequest,
+ action: (requestId, items) => {
+ if (dragItem._dropCallback) {
+ dragItem._dropCallback(items)
+ }
+ }
+ },
+ resolveFailed: {
+ action: () => {
+ if (dragItem._dropFailedCallback) {
+ dragItem._dropFailedCallback()
+ }
+ }
+ }
})
}
@@ -283,6 +298,11 @@ Item {
initialState: fsmRequestData
function enter() {
+ dragItem._dropPromise = null
+ dragItem._dropFailedCallback = null
+ dragItem._dropCallback = null
+ dragItem._inputItems = undefined
+
MainCtx.setCursor(Qt.DragMoveCursor)
}
@@ -290,13 +310,6 @@ Item {
MainCtx.restoreCursor()
_pendingNativeDragStart = false
-
- if (dragItem._dropFailedCallback) {
- dragItem._dropFailedCallback()
- }
- dragItem._dropPromise = null
- dragItem._dropFailedCallback = null
- dragItem._dropCallback = null
}
transitions: ({
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/30ad95ef3872a9b14110671631f5a64a768ff91b...76fb17bbbfc0639926fe980316b6972324818bfa
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/30ad95ef3872a9b14110671631f5a64a768ff91b...76fb17bbbfc0639926fe980316b6972324818bfa
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