fix(slint): widen artists carousel and make the filter apply
- The most-popular row used alignment:start, which packed the artists carousel to its preferred width (one card). Dropped it so the carousel stretches and shows as many cards as fit. - The searchType filter only re-queried on per-type tabs (none on All, so it did nothing). It now re-queries albums/tracks/artists with the search_type and replaces all three lists, so it applies on every tab. cc
This commit is contained in:
2 files changed
+22
-14
No files matched your search
@@ -634,8 +634,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
});
|
||||
}
|
||||
|
||||
// Change the searchType filter on a per-type tab: re-query that
|
||||
// category from offset 0 and replace its list.
|
||||
// Change the searchType filter: re-query the three filterable
|
||||
// categories (albums / tracks / artists) and replace their lists, so
|
||||
// the filter takes effect on every tab including All.
|
||||
{
|
||||
let runtime = app_runtime.clone();
|
||||
let weak = window.as_weak();
|
||||
@@ -647,24 +648,32 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
};
|
||||
let st = w.global::<SearchState>();
|
||||
st.set_filter_index(index);
|
||||
let Some(category) = search::category_for_tab(st.get_tab()) else {
|
||||
return;
|
||||
};
|
||||
let query = st.get_query().to_string();
|
||||
if query.trim().is_empty() {
|
||||
return;
|
||||
}
|
||||
let search_type = search::search_type_for_filter(index);
|
||||
let runtime = runtime.clone();
|
||||
let weak = weak.clone();
|
||||
let image_cache = image_cache.clone();
|
||||
handle.spawn(async move {
|
||||
match search::load_more(&runtime, &query, category, search_type, 0).await {
|
||||
Ok(more) => {
|
||||
let jobs = search::artwork_jobs_for_more(&more, 0);
|
||||
let _ = weak.upgrade_in_event_loop(move |w| {
|
||||
search::replace_category(&w, more);
|
||||
});
|
||||
artwork::spawn_loads(jobs, weak.clone(), image_cache);
|
||||
for category in [
|
||||
search::SearchCategory::Albums,
|
||||
search::SearchCategory::Tracks,
|
||||
search::SearchCategory::Artists,
|
||||
] {
|
||||
match search::load_more(&runtime, &query, category, search_type.clone(), 0)
|
||||
.await
|
||||
{
|
||||
Ok(more) => {
|
||||
let jobs = search::artwork_jobs_for_more(&more, 0);
|
||||
let _ = weak.upgrade_in_event_loop(move |w| {
|
||||
search::replace_category(&w, more);
|
||||
});
|
||||
artwork::spawn_loads(jobs, weak.clone(), image_cache.clone());
|
||||
}
|
||||
Err(e) => log::error!("[qbz-slint] search filter failed: {e}"),
|
||||
}
|
||||
Err(e) => log::error!("[qbz-slint] search filter failed: {e}"),
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -431,7 +431,6 @@ export component SearchResultsView inherits Rectangle {
|
||||
// ---- Most popular + Artists (All tab) ---------------------
|
||||
if SearchState.tab == 0 && SearchState.most-popular-kind != "": HorizontalLayout {
|
||||
spacing: 24px;
|
||||
alignment: start;
|
||||
|
||||
// Most-popular hero column.
|
||||
VerticalLayout {
|
||||
|
||||
Reference in new issue
Block a user