Skip to content

More advanced UI for specifying track filters#43

Merged
hyperquantum merged 22 commits into
developfrom
track-filters-widgets
Apr 1, 2026
Merged

More advanced UI for specifying track filters#43
hyperquantum merged 22 commits into
developfrom
track-filters-widgets

Conversation

@hyperquantum
Copy link
Copy Markdown
Owner

This PR replaces the old UI for specifying track filters with a new and more advanced one.

The combo box with a predefined list of filters has been removed. Instead, the "add" button now displays a hierarchical context menu for adding a filter. A filter that has been added can now be edited by clicking the description of the filter or the "edit" button. For example, "score > 80" can be changed to "score ≥ 87" or "score < 50". When in editing mode, clicking the "done editing" button will switch back to a read-only view of the filter which is easier to read.

The new UI introduces a few new filters that weren't available before. These are inverses of existing filters. Examples:

  • "heard in the last __ days" which is the inverse of "not heard in the last __ days"
  • "available" which is the inverse of "unavailable" (formerly called "no longer available")

This PR also modifies the UI for track highlighting. It can also take advantage of the new editing features, but it is still limited to a single condition for now.

Introduce files "trackfilterwidgets.h" and "trackfilterwidgets.cpp" and
move the following classes there:

 - FilterPickerWidget
 - FilterLineWidget
 - FiltersListWidget
Add the foundation for editing/customizing the track criteria that are
used for filtering the music collection. For now, only the track score
comparison criterium supports editing. A predefined criterium like
"score < 50" can be changed to an edit mode where both the operator and
the number can be changed. The reset button can be used to revert to
the list of predefined criteria.
Add an editor widget for track length comparisons. A predefined
criterium such as "length > 3 min." can now be edited. The editor makes
it possible to change both the comparison operator and the number. And
it is possible to enter hours, minutes, and seconds, not just an amount
of minutes.
Add a read-only view for filters. This will display the filter as a
label, which is much easier to read than a line containing multiple
spin boxes.

For now, an "OK" button is added that allows switching from edit mode
to read-only mode. The "Edit" button can be used to switch back from
read-only mode to edit mode. I am not fond of the "OK" button as a
solution for ending edit mode, and I will try to find something more
elegant later.
Add an editor widget for criteria like "not heard in the last 180 days"
or "not heard in the last year". The editor also supports the reverse,
like "heard in the last 10 days", i.e. without the "not".
Switch to edit mode when a read-only filter is clicked.
Instead of the generic "00:00:00" time view, use words when only one
time unit is specified.

Examples:

 - display "01:00:00" as "1 hour(s)"
 - display "00:03:00" as "3 minute(s)"
 - display "00:00:55" as "55 second(s)"

The generic view is still used when more than one time unit is used, as
in "00:03:30".
If the track length comparison editor produces 3 minutes and 60 seconds,
and then a switch to read-only view is done, make sure to display this
as "00:04:00" instead of "00:03:60".
Add support for a number of hours to the "(not) heard in the last
X years/days" filter. This makes it possible to specify filters like:

 - heard in the last 2 hours
 - not heard in the last 4 hours
 - not heard in the last 3 days 12 hours

Any number of hours larger than 23 will be normalized to an equivalent
amount of days and hours whenever starting or finishing editing mode.
For example, 30 hours will be normalized to 1 day and 6 hours.
The "Add" button to add a new filter now no longer adds an "(empty)"
filter. Clicking the button will now open a context menu providing
several categories:

 - score
 - length
 - last heard
 - metadata
 - status

Each category opens a submenu. Clicking an item in the submenu, like
"no score" from the "Score" category, will add the filter to the list.
As before, some filters can then be edited by clicking on their
description or by clicking the edit button on the right.

This new system adds a small number of new filters. These are logical
opposites of existing predefined filters:

 - available (opposite of "unavailable" or "no longer available")
 - with title (opposite of "without title")
 - with artist (opposite of "without artist")
 - with album (opposite of "without album")

The dropdown of predefined filters is still available for now, by
clicking the "reset" button on a filter line. But it will soon be
removed.
Remove the combobox with predefined track filter criteria from the
filter line UI. This combobox was only still used for the empty filter
line state (after clicking the reset button). Replace this combobox with
an empty state displaying a label with the text "(empty)". Clicking the
label will open a context menu that allows selecting a filter criterium
again.

Note that a combobox is still used for the track highlighting
criterium.
Remove the combobox with predefined track criteria from the track
highlighting UI, and replace it with the UI used for a track filter.

It is not possible yet to have multiple conditions with a logical AND
for track highlighting.
Only enable the 'reset highlighting' button when the highlighting
criterium is not empty.
In the read-only filter view, display length as 00:00 if hours is zero
and minutes and seconds are non-zero.
Improve consistency between the descriptions in the read-only filter
view and the context menu for adding/setting filters.
@hyperquantum hyperquantum marked this pull request as ready for review March 31, 2026 20:01
@hyperquantum hyperquantum merged commit e41ea78 into develop Apr 1, 2026
4 checks passed
@hyperquantum hyperquantum deleted the track-filters-widgets branch April 1, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant