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

Refocus library #11767

Merged
merged 2 commits into from
Jul 28, 2023
Merged

Refocus library #11767

merged 2 commits into from
Jul 28, 2023

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Jul 26, 2023

Another little GUI helper:

When clicking into any beatsize spinbox or selecting an effect/effect chain via the GUI selectors these widgets get keyboad focus. This interrupts the current library workflow (and keyboard shortcuts wouldn't work anymore) since you'd need to Tab, Esc or click to get back to the desired library widget.
Currently the focus is set to the Tracks table since that is the most likely place to be when DJing, but obviously not always.

With this PR the library widget that was focused previously is stored and can be foused again any time by any widget/object that has controlobject.h included via

ControlObject::set(ConfigKey("[Library]", "refocus_prev_widget"), 1);

(any value except 0 will do, it's just triggering a valueChangeRequest)

Especially helpful for #11755 :)

// to call refocusPrevLibraryWidget() are cumbersome to connect to.
// This CO is never actually set or read so the value just needs to be not 0
m_pRefocusPrevWidgetCO = std::make_unique<ControlPushButton>(
ConfigKey("[Library]", "refocus_prev_widget"));
Copy link
Member

Choose a reason for hiding this comment

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

This should work when connecting to keyboard or controllers. Probably not a use case, but this would make it complete.

Suggested change
ConfigKey("[Library]", "refocus_prev_widget"));
ConfigKey("[Library]", "refocus_prev_widget"));
m_pRefocusPrevWidgetCO->setButtonMode(ControlPushButton::TRIGGER);

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting! Will try.

Copy link
Member Author

Choose a reason for hiding this comment

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

Jup, works. Thanks.

// This CO is never actually set or read so the value just needs to be not 0
m_pRefocusPrevWidgetCO = std::make_unique<ControlPushButton>(
ConfigKey("[Library]", "refocus_prev_widget"));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason to not connect it in Qt 6?

Copy link
Member Author

Choose a reason for hiding this comment

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

QML. No legacy library widgets, so it's guarded like the other functions that work with these widgets.

Useful to return to the library workflow in case it was interrupted by clicking on a
beatsize spinbox, effect selector or any other widget that grabs keyboard focus.
@ronso0 ronso0 force-pushed the refocus-library branch from 3c1d965 to fe58227 Compare July 28, 2023 01:14
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.

LGTM, Thank you.

@daschuer daschuer merged commit fe25d77 into mixxxdj:2.4 Jul 28, 2023
@ronso0 ronso0 deleted the refocus-library branch July 28, 2023 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants