Move the filter bar and the timeline onto the library's Slint global
The date-range fields and their band on the capture-time axis, the timeline's bars, labels, scrub/pinch/pan/zoom callbacks and its sweep/current-bucket/anchored state, and the filter bar's people chips, mode, eyes-open toggle and gesture reference move from AppWindow onto the `Library` global. Rust reaches them through window.global::<Library>() rather than window.set_/get_/on_ on the root, as the earlier commits on this branch did for the grid's cells, selection, ratings and keywords.
This commit is contained in:
@@ -12,7 +12,7 @@ use std::rc::Rc;
|
||||
use slint::ComponentHandle;
|
||||
|
||||
use crate::library;
|
||||
use crate::AppWindow;
|
||||
use crate::{AppWindow, Library};
|
||||
|
||||
use super::controller::{stop, LibraryController};
|
||||
use super::open::schedule_reload;
|
||||
@@ -302,7 +302,7 @@ pub(super) fn start_sweep(window: &AppWindow, ctl: &Rc<LibraryController>) {
|
||||
Ok(m) => m,
|
||||
Err(std::sync::mpsc::TryRecvError::Empty) => return,
|
||||
Err(std::sync::mpsc::TryRecvError::Disconnected) => {
|
||||
w.set_library_sweep_total(0);
|
||||
w.global::<Library>().set_library_sweep_total(0);
|
||||
job.fail("stopped without finishing");
|
||||
stop(&ctl_cb.sweep_timer);
|
||||
return;
|
||||
@@ -311,13 +311,16 @@ pub(super) fn start_sweep(window: &AppWindow, ctl: &Rc<LibraryController>) {
|
||||
|
||||
match msg {
|
||||
library::SweepMessage::Total(n) => {
|
||||
w.set_library_sweep_total(n as i32);
|
||||
w.set_library_sweep_done(0);
|
||||
w.global::<Library>().set_library_sweep_total(n as i32);
|
||||
w.global::<Library>().set_library_sweep_done(0);
|
||||
job.total(n);
|
||||
}
|
||||
library::SweepMessage::Progress { done, dated } => {
|
||||
w.set_library_sweep_done(done as i32);
|
||||
job.progress(done, w.get_library_sweep_total() as usize);
|
||||
w.global::<Library>().set_library_sweep_done(done as i32);
|
||||
job.progress(
|
||||
done,
|
||||
w.global::<Library>().get_library_sweep_total() as usize,
|
||||
);
|
||||
// Rebuild as it goes: the histogram growing while the
|
||||
// sweep runs is the visible sign it is working.
|
||||
if dated > 0 {
|
||||
@@ -330,7 +333,7 @@ pub(super) fn start_sweep(window: &AppWindow, ctl: &Rc<LibraryController>) {
|
||||
library::SweepMessage::Finished { dated } => {
|
||||
log::info!("sweep finished: {dated} dated");
|
||||
job.finish(format!("{dated} dated"));
|
||||
w.set_library_sweep_total(0);
|
||||
w.global::<Library>().set_library_sweep_total(0);
|
||||
{
|
||||
let borrow = ctl_cb.catalog.borrow();
|
||||
if let Some(catalog) = borrow.as_ref() {
|
||||
|
||||
Reference in New Issue
Block a user