-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Search related Tracks: add checkboxes + Search button #12213
Conversation
@uklotzde What do you think about this? |
Nice to have: remember & restore checked state of filters. This would simplify repeating the previous filter combo, e.g. searching again for genre and BPM then only requires pressing Search ( Either have only one track menu per deck (track menu features are/should be the same anyway for WTrackProperty, WTrackText & WTrackWidgetGroup). I think Alternatively, keep the per-widget menu and share just the checked flags elsewhere. |
3e18079
to
35f88bd
Compare
Now clazy is inhibited by clang-tidy failing on unrelated files 🤷 |
I only consider key, bpm, and genre as useful conjunctions. Everything else is probably too restrictive in the context of DJing. Even combining the genre filter with others is too restrictive if you encode multiple genres in the field as I do. Remembering and recalling the last checkmarks is not helpful. I often switch between different filters, e.g. artist and directory/album. That would require lots of extra clicks.
To me this extension seems more like a workaround for the absence of dynamic filters and smart playlists. Using the properties of the selected track instead of hard-coded values for the filter conditions of a smart playlist would be a new concept. |
Why twice?
|
If no additional clicks are required for searching with a single condition then this extension is reasonable. |
The last item should be renamed to "Search checked" and only be enabled if one or more check boxes are checked. |
That's how it's implemented, disabled by default. "Search checked" is indeed better, thanks. edit |
6ac5739
to
3ed07df
Compare
3ed07df
to
daf0d2b
Compare
Menu items are checkboxes now, so there are two ways to search for tracks: * single filter (as before): click an action (text), or press `Return` on a selected checkbox, to trigger its search * combine filters: * check multiple actions (click `[ ]` box or press `Space` on a selected item * click 'Search selected' (or press `S`, or `Return` on Search) to search with all checked filters
daf0d2b
to
7b22b8c
Compare
This PR is marked as stale because it has been open 90 days with no activity. |
This works good. However with Qt5 I don't see the magnifier icon. Did you consider to give the "Search selected" menu entry a button style. Now building with Qt6 |
Also no magnifier icon with Qt6. |
Indeed. Thinking this further, the ideal solution would be a 'Filter' popup attached to the searchbar with customizable rows |
I'm not sure if that really makes the situation more clear. |
Which use case do you intend to cover? |
Oh, the screenshot is from a previous state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small nit from clang-tidy
Couple of feedback on UI - looks like the checkbox doesn't render when selected. Also, it be great if the menu would stay open till it loose the focus after the first click, so you can easily select key + BPM for example. (edit: realise I had to click the checkbox. Still would be great, but nice to have only
Edit 2: Realised that the Search related
at the bottom is meant to be a submit button. Make sense now)
Note that I merged main
as I needed TagLib 2.0 support, maybe why these issue didn't occur before?
Love the feature btw! So many time I struggle to filter key + bpm and end up having to cheat with sorting... My last wish would be a configurable kRelativeBpmRange
or the the ability to define the range :D
} | ||
QStyleOptionButton option; | ||
option.initFrom(box); | ||
auto pStyle = box->style(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy
auto pStyle = box->style(); | |
auto *pStyle = box->style(); |
A bit of an issue with controller compatibility: |
@acolombier Thanks for testing!
In main you can set that range in Pref -> Library. It's used for the fuzzy BPM search and for the "Search related" menu. |
I understand. You may add an extra |
Sound good. I might give that a go once its merged so that feature is available mouse/click-free.
Tested and search button now works fine on Qt6! |
Can you try to find out why it didn't work? Maybe with a clean config? |
No, it's was just my eyes that were failing me 😅 |
It is just the minor issue that the "refine" is more like a "redo", because after selecting "search related" the menu is closed and you need to repopulate the check boxes before manually on a second attempt. (Just an idea ...) |
Yes, the clearing can be a bit annoying, I already added a TODO inline Saving the check states is a bit more eleaborate, at least if you refer to when opening the entire track menu again. |
There is/was a slight delay after clicking search actions or the Search button (also a checkbox internally), I have the impression it's longer with this PR. Can someone confirm? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @acolombier is your issue also solved?
res/images/heart_icon_dark.svg
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated?
} | ||
QStyleOptionButton option; | ||
option.initFrom(box); | ||
auto pStyle = box->style(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto pStyle = box->style(); | |
auto* pStyle = box->style(); |
if (queries.isEmpty()) { | ||
return; | ||
} else { | ||
QString queryCombo = queries.join(QStringLiteral(" ")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QString queryCombo = queries.join(QStringLiteral(" ")); | |
QString queryCombo = queries.join(QChar(' ')); |
return; | ||
} | ||
m_pSearchAction->setDisabled(true); | ||
for (const auto* child : std::as_const(children())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is already const see: https://doc.qt.io/qt-6/qobject.html#children
for (const auto* child : std::as_const(children())) { | |
for (const auto* child : children()) { |
void WSearchRelatedTracksMenu::combineQueriesTriggerSearch() { | ||
// collect queries of all checked checkboxes | ||
QStringList queries; | ||
for (const auto* child : std::as_const(children())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const auto* child : std::as_const(children())) { | |
for (const auto* child : children()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may also decorate child and friends with a "p" prefix
6679db8
to
e897d66
Compare
Yeah, the only issue I had was sitting between the chair and the keyboard 😅 Only thing is I think it would be great to keep state between context menu, but that can come as an iteration. |
Fine. Thank you. |
Closes #12211
Implementation adopted from Crates menu.
Menu items are checkboxes now, so there are two ways to search for tracks:
click an action (text), or press
Return
on a selected checkbox, to trigger its search[ ]
box or pressSpace
on a selected itemS
, orReturn
on the selected action) to search with all checked filtersWhile this may actually go into 2.4 I'm targeting
main
because this adds yet another tr string ("Search selected").