Repository navigation
Suppress programmatically setting playhead position on drag operations 11176 - #11474
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 318290fc1baa4cd733896a0e6d062fb403c68552 and e7ca59a. 📒 Files selected for processing (23)
📝 WalkthroughWalkthroughThe change defers track-area playhead seeking until pointer release. Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Pointer
participant TracksItemsView
participant PlayCursorController
participant PlaybackController
Pointer->>TracksItemsView: Press in tracks area
TracksItemsView->>PlayCursorController: beginSeekGesture(...)
Pointer->>TracksItemsView: Move or release
TracksItemsView->>PlayCursorController: updateSeekGesture(...) or endSeekGesture()
PlayCursorController->>PlaybackController: Record last seek time when playing
PlayCursorController->>PlayCursorController: Dispatch seek for click gestures
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Warning Review ran into problems🔥 ProblemsLinked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/projectscene/tests/playcursorcontroller_tests.cpp (1)
19-19: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winLGTM! Solid coverage of the gesture state machine (click, drag, jitter, cancel, and playing-state paths).
One optional addition: since
setLastPlaybackSeekTimecurrently receives an unsnapped value (see the companion comment onplaycursorcontroller.cpplines 110-130), a variant ofSeekGesture_ClickWhilePlaying_RecordsSeekTime_DoesNotMovePlayheadwithuseGridSnapOff({ boundary })oruseGridSnapOn(...)would pin down the expected (snapped) behavior once fixed.Also applies to: 41-41, 69-69, 96-96, 198-363
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: e1dea0b3-a4a9-41f9-9001-0f17b020dd7b
📥 Commits
Reviewing files that changed from the base of the PR and between 97eb0f2 and 8444590afdd16d61fd54f792bd27f237ed322502.
📒 Files selected for processing (8)
src/playback/tests/mocks/playbackcontrollermock.hsrc/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TracksItemsView.qmlsrc/projectscene/tests/playcursorcontroller_tests.cppsrc/projectscene/tests/snaptestaccess.hsrc/projectscene/view/playcursor/playcursorcontroller.cppsrc/projectscene/view/playcursor/playcursorcontroller.hsrc/projectscene/view/tracksitemsview/selectionviewcontroller.cppsrc/projectscene/view/tracksitemsview/selectionviewcontroller.h
💤 Files with no reviewable changes (2)
- src/projectscene/view/tracksitemsview/selectionviewcontroller.h
- src/projectscene/view/tracksitemsview/selectionviewcontroller.cpp
baa2856 to
782ed9e
Compare
269bb98 to
4339c76
Compare
grliszas14
left a comment
There was a problem hiding this comment.
please prepare QA bulletpoint list to thoroughly check this feature (including manual testing of each test case from unit tests)
| dispatcher()->reg(this, CURS_SEL_START, this, &PlayPositionActionController::cursorToSelectionStart); | ||
| dispatcher()->reg(this, CURS_SEL_END, this, &PlayPositionActionController::cursorToSelectionEnd); |
There was a problem hiding this comment.
Should we put those two somewhere in the upper menu? @teetow @luapmartin
We already have Select->Move cursor to closest zero crossing
There was a problem hiding this comment.
I believe we are missing lot of those cursor movements from au3 (at least in menus)
There was a problem hiding this comment.
In this specific context: If it has a keybind and a menu item in AU3, we should bring it over (if straightforward). The rest we can defer to later, PRs welcome, guided by user feedback etc.
4339c76 to
1e74db1
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/projectscene/tests/playpositionactioncontroller_tests.cpp (1)
161-176: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAlso assert that the playing case does not request playback.
This test checks
seekTimebut nottriggerPlay; a regression that restarts playback would still pass. Add the same assertion used by the earlier cursor-action tests.Proposed assertion
EXPECT_DOUBLE_EQ(captured.param("seekTime").toDouble(), 5.0); + EXPECT_FALSE(captured.param("triggerPlay").toBool());
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 7089b3d0-6c67-4bb9-b467-372889bd8311
📥 Commits
Reviewing files that changed from the base of the PR and between 4339c7637f1f3042b05db6e780bba57bd29a96a6 and 1e74db14be96b010519fa82286f65c0ca58610c0.
📒 Files selected for processing (16)
src/playback/tests/mocks/playbackcontrollermock.hsrc/projectscene/internal/projectsceneuiactions.cppsrc/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TrackClipsContainer.qmlsrc/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TrackItemsContainer.qmlsrc/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TrackLabelsContainer.qmlsrc/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TracksItemsView.qmlsrc/projectscene/tests/CMakeLists.txtsrc/projectscene/tests/playcursorcontroller_tests.cppsrc/projectscene/tests/playpositionactioncontroller_tests.cppsrc/projectscene/tests/snaptestaccess.hsrc/projectscene/view/playcursor/playcursorcontroller.cppsrc/projectscene/view/playcursor/playcursorcontroller.hsrc/projectscene/view/playcursor/playpositionactioncontroller.cppsrc/projectscene/view/playcursor/playpositionactioncontroller.hsrc/projectscene/view/tracksitemsview/selectionviewcontroller.cppsrc/projectscene/view/tracksitemsview/selectionviewcontroller.h
💤 Files with no reviewable changes (3)
- src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TrackItemsContainer.qml
- src/projectscene/view/tracksitemsview/selectionviewcontroller.h
- src/projectscene/view/tracksitemsview/selectionviewcontroller.cpp
🚧 Files skipped from review as they are similar to previous changes (8)
- src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TrackClipsContainer.qml
- src/projectscene/internal/projectsceneuiactions.cpp
- src/projectscene/view/playcursor/playpositionactioncontroller.h
- src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TrackLabelsContainer.qml
- src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/TracksItemsView.qml
- src/projectscene/tests/playcursorcontroller_tests.cpp
- src/projectscene/view/playcursor/playcursorcontroller.h
- src/playback/tests/mocks/playbackcontrollermock.h
4932e36 to
318290f
Compare
A press in the track area must not move the playhead immediately: the target is remembered on press and the seek is dispatched on release, and only when the gesture stayed a plain click. Dragging past the threshold (in either axis) or cancelling the gesture suppresses the seek entirely. While playing, a click records the seek position for stop without moving the playhead.
Pressing in the track area no longer seeks immediately. The press begins a deferred seek gesture; the playhead moves on release, and only when the gesture stayed a plain click. Dragging a clip or a selection never moves the playhead, so the viewport no longer jumps mid-drag and playback is left alone. The release-time isLeftSelection seek is gone with it: it existed only to patch up the eager mousedown seek after a leftwards selection drag.
Dragging a selection — whether by dragging out a new range, extending one with Ctrl/Shift, or dragging a selection edge handle — left two paths that still repositioned the playhead and the next playback start: the unconditional playback-region update on release (which sets lastPlaybackSeekTime to the region start) and the seekToX emitted when a selection resize completes. Both are gone. The release path now updates playback position state only when the gesture was a plain click, and the seekToX plumbing is removed entirely since resizing a selection was its only caller. Nothing is lost by not setting the region eagerly: doPlay derives its region from the live data selection when playback starts.
seekToTime returns early when playing, before snapTime runs, so the position bookmarked for the eventual stop was stored raw while a click made when not playing lands on the snapped boundary. Clicking near a clip edge during playback then resumed slightly off that edge. Snap it explicitly at the call site. Covers both clip-boundary and grid snapping.
Implements the curs-sel-start / curs-sel-end actions, which existed as unbound placeholders in shortcuts.xml with no handler. Both move the play position to an edge of the time selection and scroll it into view, and are no-ops when there is no time selection. Unlike the stepping actions, and unlike au3's CursSelStart/CursSelEnd which collapse the selection to the cursor, these leave the selection intact — moving the playhead and changing the selection are separate concerns. No default shortcut, matching au3 where both ship unbound; the actions are registered as UiActions so users can bind them in preferences.
318290f to
e7ca59a
Compare
Resolves: Suppress programmatically setting playhead position on drag operations #11176
Recommended:
QA: