feat(slint): searchType filter dropdown for per-type tabs

The Albums / Tracks / Artists tabs get a QbzSelect filter (No filter /
Main artist / Performer / Composer / Label / Release name). Changing it
re-queries that category from offset 0 with the search_type and replaces
the list; load-more carries the active filter forward. The filter
resets on every new search. search_type_for_filter is unit-tested.

cc
This commit is contained in:
vicrodh committed 2026-05-19 12:35:20 -06:00
1 parent 6a584803f1
commit fa5f22e609
4 files changed
+116 -8

No files matched your search

@@ -15,6 +15,7 @@ import { SearchTrackRow } from "SearchTrackRow.slint";
import { QbzIcon } from "../primitives/QbzIcon.slint";
import { ContextMenu } from "../primitives/ContextMenu.slint";
import { ContextMenuItem } from "../primitives/ContextMenuItem.slint";
import { QbzSelect } from "../primitives/QbzSelect.slint";
// One tab in the results tab strip.
component SearchTab inherits Rectangle {
@@ -375,6 +376,26 @@ export component SearchResultsView inherits Rectangle {
}
}
// searchType filter — shown on the Albums / Tracks / Artists tabs.
if SearchState.tab >= 1 && SearchState.tab <= 3: HorizontalLayout {
alignment: start;
QbzSelect {
menu-width: 180px;
options: [
@tr("No filter"),
@tr("Main artist"),
@tr("Performer"),
@tr("Composer"),
@tr("Label"),
@tr("Release name"),
];
current-index: SearchState.filter-index;
selected(i) => {
SearchActions.filter-changed(i);
}
}
}
// Scrollable results region.
Flickable {
vertical-stretch: 1;
+5 -4
View File
@@ -372,8 +372,9 @@ export global SearchState {
in property <AlbumCardItem> most-popular-album;
in property <SlimItem> most-popular-artist;
in property <SearchTrackItem> most-popular-track;
// Active searchType filter: "" | "MainArtist" | "Performer" | ...
in property <string> filter-type;
// Active searchType filter, as a dropdown index (0 = no filter).
// The controller owns the index -> API-value mapping.
in property <int> filter-index: 0;
}
// Search actions wired to the Rust search controller.
@@ -384,8 +385,8 @@ export global SearchActions {
callback live(string);
// User picked a results tab (0..4).
callback tab-changed(int);
// searchType filter changed.
callback filter-changed(string);
// searchType filter changed — the new dropdown index.
callback filter-changed(int);
// Request the next page for the given tab.
callback load-more(int);
}