Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eject: double click does 'un-replace', i.e. reloads the previous track #11246

Merged
merged 8 commits into from Jul 11, 2023

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Feb 3, 2023

follow-up for Un-eject #4668

Long-press eject (> 800 ms) to reload the previous track.

Double-press (< 500 ms) Eject to reload the last replaced track.

Like uneject this works across decks (restore a replaced track in another deck).

TODO

  • adjust tests

@ronso0
Copy link
Member Author

ronso0 commented Feb 4, 2023

Okay, the current implementation would break all mappings that don't send 0 when Eject is released, and some tests need adjusted (press, sleep, release).

I think I'll try the double-tap solution used for deck cloning.

@ronso0 ronso0 changed the title eject: make long-press reload the previous/last ejected track eject: double click does 'un-replace', i.e. reloads the previous track Feb 4, 2023
@ronso0
Copy link
Member Author

ronso0 commented Feb 4, 2023

Does anyone have recommendations how to do timed actions (sleep) in tests?

edit QTest::qSleep(millis) seems to be the preferred solution.

@ronso0 ronso0 added changelog This PR should be included in the changelog feature labels Feb 4, 2023
@ronso0
Copy link
Member Author

ronso0 commented Feb 4, 2023

Done. Works and tests pass 🎉

@ronso0 ronso0 requested a review from ywwg February 4, 2023 16:38
@daschuer
Copy link
Member

daschuer commented Feb 4, 2023

I can confirm that this PR works and the code looks good.

However I am unsure if it works as you might expect, after a dim memory in a panic situation:
"double click does 'un-replace'".

Scenario:

  • Replace a track accidentally
  • Shit ... eject
  • Remember: double click.
  • The wrong track appears and disappears.

So we do not have a double click. In fact we have the requirement to undo the eject within 500 ms.

How about bringing back the SecondLastEjectedTrack in that scenario as well?

@ronso0
Copy link
Member Author

ronso0 commented Feb 4, 2023

I don't understand why you would do that "Shit... eject" in the first place? That kinda feels like setting the table cloth on fire and "Shit... turn away"

I mean, I could implement it in a way that we always wait for the second click before reacting. That would allow testing for a double-click but it would also delay the single-click eject. Eject is not time-sensitive, so I that is acceptable and would be m preferred solution.

Otherwise (double-eject empty deck after panic eject) it would be

  • track1 loaded
  • load track2
  • oh shit...
  • panic, eject
  • remember double-click
  • double-click
    • reload track2
    • reload track1

If that one useless track load is acceptable..

@daschuer
Copy link
Member

daschuer commented Feb 4, 2023

That was exactly my idea. Do you think that will still "feel" natural?

@ronso0
Copy link
Member Author

ronso0 commented Feb 4, 2023

I don't know, we'd have to try.

However, I'm still not convinced we need to worry about the "Oh shit... eject" situation, I consider that part of the learning process tbh. What matters is the feature description (tooltip and manual): if that clearly states that double-click does does un-replace while the wrong new track is still loaded we're fine I'd say.

@daschuer
Copy link
Member

daschuer commented Feb 4, 2023

When trying you PR the first time I had just the expectation that I can restore the old track with a double click unconditionally.
Than I have realized it is not longer possible whenever you have reached the 500 ms tresshold. I think the feature would be more robust, if we can "undo" such a fail in passing the threshold.

@ronso0
Copy link
Member Author

ronso0 commented Feb 5, 2023

That was exactly my idea. Do you think that will still "feel" natural?

The delay feels weird, it's not clear why eject takes "so long".

I changed it to always un-replace on double-click, no matter the delay or if a track is loaded. Note that like uneject this works across decks (restore a replaced track in another deck).

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except of the test crasher, it works good now.

Do you mean, just toggle between un-load the last and the second last track?
That works for me as well and would make the feature even more predictable.

src/mixer/basetrackplayer.cpp Show resolved Hide resolved
@ronso0
Copy link
Member Author

ronso0 commented Feb 6, 2023

Do you mean, just toggle between un-load the last and the second last track?

That's what it does right now, no?
Double-click does eject first so last and second last are swapped each time.

I'll fix the tests.

@daschuer
Copy link
Member

daschuer commented Feb 6, 2023

Yes, it is working fine.

I just did not understand that comment:

The delay feels weird, it's not clear why eject takes "so long".

@ronso0
Copy link
Member Author

ronso0 commented Feb 6, 2023

I meant it's not clear for users why there's a delay when ejecting a track because everything else happens immediately incl. track load.

@ronso0
Copy link
Member Author

ronso0 commented Feb 6, 2023

I fixed EngineSyncTest.EjectTrackSyncRemains, please check if that's the preferred solution (I didn't deal with tests that much, let alone the engine mock)

@ronso0 ronso0 added this to the 2.4.0 milestone Mar 24, 2023
@ronso0 ronso0 linked an issue Mar 24, 2023 that may be closed by this pull request
src/test/playermanagertest.cpp Outdated Show resolved Hide resolved
src/mixer/playermanager.cpp Outdated Show resolved Hide resolved
src/test/playermanagertest.cpp Outdated Show resolved Hide resolved
@@ -123,6 +123,8 @@ class BaseTrackPlayerImpl : public BaseTrackPlayer {
bool m_replaygainPending;
EngineChannel* m_pChannelToCloneFrom;

PerformanceTimer m_ejectTimer;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO PerformanceTimer is a little overkill, but we don't have anything better in mixxx right now (except possibly implementing a custom clock based on std::chrono). Unimportant.

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Code LGTM, still need to do a manual test though.

@ronso0 ronso0 requested review from ywwg and removed request for ywwg June 2, 2023 22:17
@ronso0
Copy link
Member Author

ronso0 commented Jun 2, 2023

@ywwg Do you have time to take a look?

@ronso0
Copy link
Member Author

ronso0 commented Jul 8, 2023

friendly ping @ywwg and @Swiftb0y maybe

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks almost good. Just a text nit pick.

src/controllers/controlpickermenu.cpp Outdated Show resolved Hide resolved
Also enable word-warp for the control description label in the Learning dialg
@ronso0
Copy link
Member Author

ronso0 commented Jul 11, 2023

Okido, done

@daschuer
Copy link
Member

Thank you.

@daschuer daschuer merged commit 6bbb11c into mixxxdj:2.4 Jul 11, 2023
13 checks passed
@ronso0 ronso0 deleted the reload-track branch July 11, 2023 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog This PR should be included in the changelog code quality feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undo track load, restore previous track
3 participants