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

Usability: Add Ctrl+Shift+F shortcut to search the main tracks database #13200

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

cr7pt0gr4ph7
Copy link
Contributor

The new shortcut Ctrl+Shift+F (Search globally1) compliments the existing shortcut Ctrl+F (Search in current location).

The use case for this is pretty simple (and motivated by me teaching dance classes) and probably pretty common elsewhere, too:

After digging around in my playlists & crates, leaving the computer to teach, and then coming back to it, I want to be able to quickly search for a specific song without having to first pick up the mouse or fiddle around with the trackpad.

Footnotes

  1. Ok, it is only "globally" as long as all tracks are present in the main Mixxx database, and not contained in external libraries like iTunes or Rekordbox.2

  2. As a later improvement, one could extend Ctrl+Shift+F to, either:
    a. Actually initiate a global search over all available libraries, or:
    b. Make default library to which Ctrl+Shift+F jumps configurable in the preferences, or:
    c. Provide different shortcuts for the different external libraries.

@ronso0
Copy link
Member

ronso0 commented May 5, 2024

Note that there is already Library::searchTracksInCollection (emitted when clicking actions in WSearchRelatedTracksMenu), which (IMHO) allows a much simpler implementation.

@cr7pt0gr4ph7
Copy link
Contributor Author

@ronso0 Thanks, I will have a look! I'll have to place the shortcut handling somewehere else, though, so it also works when the search widget is disabled (this behavioris inherent to QShortcut). I'd use a custom key binding in KeyboardEventFilter, but then it'd only work when Keyboard shortcuts are enabled.

Sidenote: There seem to be at at least three ways to define keyboard shortcut actions and associated key sequences right now:

  1. via eventFilter/keyPressEvent
  2. via QShortcut/QAction
  3. via KeyboardEventFilter/*.kbd.cfg/ControlObject (only active wjen

Option 3 is only active when keyboard shortcuts are enabled in the options, but when it is, it (mostly) overrides the other two.
Option 2 is somewhat integrated with option 3, but it's all bit convoluted.

Maybe it makes sense to integrate the "(Custom) keyboard shortcuts disabled" codepath into KeyboardEventFilter, too?

@ronso0
Copy link
Member

ronso0 commented May 7, 2024

How about adding "Search in Tracks" to the Library menu?
And add the shortcut hint to the searchbar tooltip?

@cr7pt0gr4ph7 cr7pt0gr4ph7 force-pushed the search-in-tracks-shortcut branch 2 times, most recently from f5fe605 to 0210e1b Compare May 21, 2024 13:04
@cr7pt0gr4ph7 cr7pt0gr4ph7 deleted the search-in-tracks-shortcut branch May 21, 2024 19:20
@cr7pt0gr4ph7 cr7pt0gr4ph7 restored the search-in-tracks-shortcut branch May 21, 2024 21:49
@cr7pt0gr4ph7 cr7pt0gr4ph7 reopened this May 21, 2024
@cr7pt0gr4ph7 cr7pt0gr4ph7 marked this pull request as ready for review May 23, 2024 18:15
@cr7pt0gr4ph7 cr7pt0gr4ph7 marked this pull request as draft May 23, 2024 22:38
It now uses the format also used by the rest of the application.
…urrently focused

This scenario occurs e.g. when calling setLibraryFocus from a menu action.
The popup window has already been closed when QAction::triggered occurs,
but the main window has not yet gotten its focus back.

As per the documentation of QWidget::setFocus(), when the containing
window is not active, the focus change request is delayed until the
window becomes active - which is exactly what we want in our case.
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.

None yet

2 participants