From 561e5b25afc0e510be5e4920a12cee226ef0481f Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sat, 24 Oct 2026 08:05:16 -0400 Subject: [PATCH 01/11] LR-BEHAV-BG-TASKS: a preview build asked for while another runs can wait in line for it Jobs that must not run side by side share a lane (`activity::Lane`; the preview lane first: Build Previews and background Build / Discard Smart Previews). With `queue: true` a build asked for while its lane is busy waits in line instead of being refused: it keeps what it was asked, with the photos written out, and `Session::start_waiting` (after every command, and every frame in the app) runs it under the id it had in line once the lane is free. `activity.list` lists waiting tasks after the running ones (`waiting`, `place`, `lane`); `activity.cancel` takes one out of the line, `all` empties it, and opening another library drops it. The line holds at most 100. Without `queue` the call is refused as before. The activity stack draws running tasks only. Co-Authored-By: Claude --- crates/engine/src/activity.rs | 290 +++++++++++++++++++++++++- crates/engine/src/cmd/activity.rs | 4 +- crates/engine/src/cmd/previews.rs | 144 +++++++++++-- crates/engine/src/lib.rs | 34 ++- crates/engine/src/library.rs | 5 + crates/engine/src/tests.rs | 1 + crates/engine/src/tests/task_queue.rs | 249 ++++++++++++++++++++++ crates/ui-egui/src/app/frame.rs | 2 + crates/ui-egui/src/control.rs | 2 +- crates/ui-egui/src/panels/activity.rs | 3 +- crates/ui-egui/src/tests/activity.rs | 35 ++++ crates/ui-egui/src/tests/progress.rs | 3 + docs/background-tasks.md | 12 ++ docs/control-protocol.md | 6 +- 14 files changed, 751 insertions(+), 39 deletions(-) create mode 100644 crates/engine/src/tests/task_queue.rs diff --git a/crates/engine/src/activity.rs b/crates/engine/src/activity.rs index 147d20f3a58..c7b4944ca46 100644 --- a/crates/engine/src/activity.rs +++ b/crates/engine/src/activity.rs @@ -7,14 +7,80 @@ //! check between files or photos: the guard adopts it ([`Cancel::Flag`]), so the stack's ✕, `activity.cancel` and the //! job's own Cancel all set the same atomic. Numbers are worded by the frontend from `done`, `total` and [`Unit`]; a //! detail set here is a name (a file, a model), never a sentence, so the frontend can translate everything else. +//! +//! Jobs that must not run side by side share a [`Lane`]. One asked for while its lane is busy can wait in line +//! ([`Activity::enqueue`]): it keeps what it was asked ([`Request`], the command and its parameters) and runs it +//! when the jobs ahead of it are over ([`crate::Session::start_waiting`]), planning its work then, not when it was +//! asked. Nothing waits across another library: the files may have changed meanwhile. use std::sync::atomic::{AtomicBool, AtomicU8, AtomicU64, Ordering}; use std::sync::{Arc, Mutex, MutexGuard, PoisonError}; use serde::Serialize; +use serde_json::Value; /// The longest label or detail kept, in characters (a file name can be anything). const MAX_TEXT: usize = 200; +/// The most tasks waiting in line, in all lanes. +pub const MAX_WAITING: usize = 100; + +/// Jobs that must not run side by side: one waits for those ahead of it to end. Kinds without a lane run as they +/// always did (and are refused while one of their kind runs, where that is the rule). +#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)] +#[serde(rename_all = "camelCase")] +pub enum Lane { + /// Build Previews and Build / Discard Smart Previews: one preview build at a time (`Session::preview_build`). + Previews, +} + +impl Lane { + /// The lane of tasks of `kind` ([`TaskInfo::kind`]). + pub fn of(kind: &str) -> Option { + match kind { + "previews" | "smartPreviews" => Some(Lane::Previews), + _ => None, + } + } +} + +/// What a job was asked: the command and its parameters, with everything that depends on the moment (the +/// selection, the photos in view) written out, so that running it later does the same work. +#[derive(Clone, Debug, PartialEq)] +pub struct Request { + pub command: String, + pub params: Value, +} + +/// A task waiting in line ([`Activity::enqueue`]), as [`Activity::take_ready`] hands it over to be started. +#[derive(Debug)] +pub struct Waiting { + pub id: u64, + pub kind: &'static str, + pub label: String, + pub lane: Lane, + pub request: Request, + queued: web_time::Instant, +} + +impl Waiting { + fn info(&self, place: usize) -> TaskInfo { + TaskInfo { + id: self.id, + kind: self.kind, + label: self.label.clone(), + done: 0, + total: 0, + unit: Unit::Count, + detail: String::new(), + cancellable: true, + cancelling: false, + age_ms: millis(self.queued.elapsed()), + waiting: true, + place, + lane: Some(self.lane), + } + } +} /// The background tasks in flight. Cheap to clone (one `Arc`), so worker threads can hold it. #[derive(Clone, Default)] @@ -26,6 +92,10 @@ pub struct Activity { struct Inner { /// Oldest first. tasks: Mutex>>, + /// The tasks waiting in line, in the order they were asked for. + waiting: Mutex>, + /// The id the waiting task being started keeps (its kind, its id): see [`Activity::take_ready`]. + reserved: Mutex>, next: AtomicU64, } @@ -87,6 +157,11 @@ pub struct TaskInfo { /// Cancel was asked for; the job stops at its next check. pub cancelling: bool, pub age_ms: u64, + /// It waits in line for the tasks ahead of it in its lane (nothing done yet: `done` and `total` are 0). + pub waiting: bool, + /// Its place in its lane's line, from 1; 0 for a running task. + pub place: usize, + pub lane: Option, } struct Entry { @@ -162,7 +237,10 @@ impl Entry { detail: lock(&self.detail).clone(), cancellable: self.is_cancellable(), cancelling: self.is_cancelled(), - age_ms: u64::try_from(self.started.elapsed().as_millis()).unwrap_or(u64::MAX), + age_ms: millis(self.started.elapsed()), + waiting: false, + place: 0, + lane: Lane::of(self.kind), } } } @@ -171,7 +249,9 @@ impl Activity { /// Register a task; it is listed until the returned guard is dropped. `label` is English (the frontend /// translates it). pub fn start(&self, kind: &'static str, label: &str, cancel: Cancel) -> TaskGuard { - let id = self.inner.next.fetch_add(1, Ordering::Relaxed).saturating_add(1); + // a task that waited in line keeps the id it had there + let reserved = lock(&self.inner.reserved).take_if(|(k, _)| *k == kind).map(|(_, id)| id); + let id = reserved.unwrap_or_else(|| self.inner.next.fetch_add(1, Ordering::Relaxed).saturating_add(1)); let cancel = match cancel { Cancel::No => None, Cancel::Yes => Some(Arc::new(AtomicBool::new(false))), @@ -194,29 +274,130 @@ impl Activity { TaskGuard { activity: self.clone(), entry } } - /// Every task in flight, oldest first. + /// Every task in flight, oldest first, then those waiting in line, in the order they were asked for. pub fn list(&self) -> Vec { - lock(&self.inner.tasks).iter().map(|e| e.info()).collect() - } - - /// Ask task `id` to stop (it stops at its next check). An unknown id (the task may have just ended) or a task - /// that can't be cancelled is an error. + let mut rows: Vec = lock(&self.inner.tasks).iter().map(|e| e.info()).collect(); + rows.extend(self.waiting()); + rows + } + + /// The tasks waiting in line, in the order they were asked for, each with its place in its lane. + pub fn waiting(&self) -> Vec { + let waiting = lock(&self.inner.waiting); + let mut ahead: Vec<(Lane, usize)> = Vec::new(); + waiting + .iter() + .map(|w| { + let place = match ahead.iter_mut().find(|(lane, _)| *lane == w.lane) { + Some((_, n)) => { + *n += 1; + *n + } + None => { + ahead.push((w.lane, 1)); + 1 + } + }; + w.info(place) + }) + .collect() + } + + /// Ask task `id` to stop (it stops at its next check), or take it out of the line if it waits. An unknown id + /// (the task may have just ended) or a task that can't be cancelled is an error. pub fn cancel(&self, id: u64) -> Result<(), String> { + { + let mut waiting = lock(&self.inner.waiting); + if let Some(at) = waiting.iter().position(|w| w.id == id) { + waiting.remove(at); + return Ok(()); + } + } let tasks = lock(&self.inner.tasks); let entry = tasks.iter().find(|e| e.id == id).ok_or_else(|| format!("no task {id}"))?; if entry.try_cancel() { Ok(()) } else { Err(format!("{} can't be cancelled", entry.label)) } } - /// Ask every cancellable task to stop; returns how many were asked. + /// Ask every cancellable task to stop, and empty the line (what waits would start as soon as they stopped); + /// returns how many were asked or taken out. pub fn cancel_all(&self) -> usize { + let dropped = std::mem::take(&mut *lock(&self.inner.waiting)).len(); let tasks = lock(&self.inner.tasks); - tasks.iter().filter(|e| e.try_cancel()).count() + dropped + tasks.iter().filter(|e| e.try_cancel()).count() } /// Tasks that quitting would cut short: cancellable ones not already stopping. pub fn running_cancellable(&self) -> Vec { lock(&self.inner.tasks).iter().filter(|e| e.is_cancellable() && !e.is_cancelled()).map(|e| e.info()).collect() } + + /// Put a task of `kind` in line behind the others of its lane; it runs `request` when its turn comes. Returns + /// its id and its place in the line. A kind without a lane, or a line already [`MAX_WAITING`] long, is an error. + pub fn enqueue(&self, kind: &'static str, label: &str, request: Request) -> Result<(u64, usize), String> { + let lane = Lane::of(kind).ok_or_else(|| format!("{kind} tasks don't wait in line"))?; + let mut waiting = lock(&self.inner.waiting); + if waiting.len() >= MAX_WAITING { + return Err(format!("{MAX_WAITING} tasks are waiting already")); + } + let id = self.inner.next.fetch_add(1, Ordering::Relaxed).saturating_add(1); + waiting.push(Waiting { id, kind, label: capped(label), lane, request, queued: web_time::Instant::now() }); + let place = waiting.iter().filter(|w| w.lane == lane).count(); + Ok((id, place)) + } + + /// Whether a task of `lane` runs now. + pub fn lane_busy(&self, lane: Lane) -> bool { + lock(&self.inner.tasks).iter().any(|e| Lane::of(e.kind) == Some(lane)) + } + + /// Whether a task waits in `lane`'s line. + pub fn lane_waiting(&self, lane: Lane) -> bool { + lock(&self.inner.waiting).iter().any(|w| w.lane == lane) + } + + /// Take the first waiting task whose lane is free out of the line, to be started now. The next task of its + /// kind started ([`Activity::start`]) keeps its id, until [`Activity::started`] says the attempt is over. + pub fn take_ready(&self) -> Option { + self.take_ready_if(|_| true) + } + + /// [`Activity::take_ready`] among the tasks whose request `runs` can run: each frontend starts what it knows how to + /// (the engine its commands, the app its own). Only the first in each lane's line is looked at: one the caller + /// can't run holds its lane, as it would if it had started. + pub fn take_ready_if(&self, runs: impl Fn(&Request) -> bool) -> Option { + let mut waiting = lock(&self.inner.waiting); + let mut held: Vec = lock(&self.inner.tasks).iter().filter_map(|e| Lane::of(e.kind)).collect(); + let mut at = None; + for (i, w) in waiting.iter().enumerate() { + if held.contains(&w.lane) { + continue; + } + if runs(&w.request) { + at = Some(i); + break; + } + held.push(w.lane); + } + let w = waiting.remove(at?); + *lock(&self.inner.reserved) = Some((w.kind, w.id)); + Some(w) + } + + /// The attempt to start the task [`Activity::take_ready`] handed over is over (it started, or it could not). + pub fn started(&self) { + *lock(&self.inner.reserved) = None; + } + + /// Another library was opened: what waited in line was about the old one's photos and folders, so the line + /// empties. Returns how many tasks waited. + pub fn library_changed(&self) -> usize { + std::mem::take(&mut *lock(&self.inner.waiting)).len() + } +} + +/// Milliseconds, saturating. +fn millis(d: std::time::Duration) -> u64 { + u64::try_from(d.as_millis()).unwrap_or(u64::MAX) } /// A task's place in the list, held by whoever owns the job; dropping it removes the row. @@ -435,4 +616,93 @@ mod tests { std::thread::spawn(move || h.progress(3, 7)).join().unwrap(); assert_eq!((a.list()[0].done, a.list()[0].total), (3, 7)); } + + fn request(command: &str) -> Request { + Request { command: command.into(), params: serde_json::json!({}) } + } + + #[test] + fn a_task_of_a_kind_without_a_lane_does_not_wait() { + let a = Activity::default(); + let e = a.enqueue("export", "Exporting", request("x")).unwrap_err(); + assert!(e.contains("export"), "{e}"); + assert!(a.list().is_empty()); + } + + #[test] + fn the_line_is_bounded_and_lists_places_per_lane() { + let a = Activity::default(); + for place in 1..=MAX_WAITING { + assert_eq!(a.enqueue("previews", "P", request("x")).unwrap().1, place); + } + assert!(a.enqueue("smartPreviews", "S", request("x")).unwrap_err().contains("100")); + let rows = a.list(); + assert_eq!(rows.len(), MAX_WAITING); + assert!(rows.iter().all(|r| r.waiting && r.lane == Some(Lane::Previews))); + assert_eq!(rows.iter().map(|r| r.place).collect::>(), (1..=MAX_WAITING).collect::>()); + } + + #[test] + fn a_waiting_task_starts_when_its_lane_is_free_and_keeps_its_id() { + let a = Activity::default(); + let ahead = a.start("previews", "P", Cancel::Yes); + let (id, _) = a.enqueue("smartPreviews", "S", request("smart")).unwrap(); + assert!(a.lane_busy(Lane::Previews) && a.lane_waiting(Lane::Previews)); + assert!(a.take_ready().is_none(), "the lane is busy: one preview build at a time"); + drop(ahead); + assert!(!a.lane_busy(Lane::Previews)); + let w = a.take_ready().expect("the lane is free"); + assert_eq!((w.id, w.request.command.as_str()), (id, "smart")); + assert!(!a.lane_waiting(Lane::Previews)); + let g = a.start("smartPreviews", "S", Cancel::Yes); + a.started(); + assert_eq!(g.id(), id, "it keeps the id it had in line"); + assert!(!a.list()[0].waiting); + assert_ne!(a.start("export", "E", Cancel::Yes).id(), id); + } + + #[test] + fn an_attempt_that_did_not_start_a_task_gives_its_id_up() { + let a = Activity::default(); + let (id, _) = a.enqueue("previews", "P", request("x")).unwrap(); + let w = a.take_ready().unwrap(); + assert_eq!(w.id, id); + a.started(); // the command failed before starting anything + assert_ne!(a.start("previews", "P", Cancel::Yes).id(), id, "a later task of the kind doesn't take it"); + } + + #[test] + fn take_ready_if_skips_what_the_caller_cannot_run_but_keeps_its_lane_held() { + let a = Activity::default(); + a.enqueue("previews", "mine", request("engine")).unwrap(); + a.enqueue("previews", "next", request("engine")).unwrap(); + assert!(a.take_ready_if(|r| r.command == "other").is_none(), "the first in the lane isn't ours: it holds the lane"); + assert_eq!(a.take_ready_if(|_| true).map(|w| w.label), Some("mine".to_string())); + } + + #[test] + fn cancelling_a_waiting_task_removes_it_and_cancel_all_empties_the_line() { + let a = Activity::default(); + let _running = a.start("previews", "P", Cancel::Yes); + let (first, _) = a.enqueue("previews", "A", request("x")).unwrap(); + a.enqueue("previews", "B", request("x")).unwrap(); + a.enqueue("smartPreviews", "C", request("x")).unwrap(); + a.cancel(first).unwrap(); + assert!(a.cancel(first).is_err()); + assert_eq!(a.waiting().iter().map(|t| (t.label.as_str(), t.place)).collect::>(), vec![("B", 1), ("C", 2)]); + assert_eq!(a.cancel_all(), 3, "the running one and the two that waited"); + assert!(a.waiting().is_empty() && !a.lane_waiting(Lane::Previews)); + } + + #[test] + fn a_library_change_empties_the_line() { + let a = Activity::default(); + let running = a.start("previews", "P", Cancel::Yes); + a.enqueue("previews", "A", request("x")).unwrap(); + a.enqueue("smartPreviews", "B", request("x")).unwrap(); + assert_eq!(a.library_changed(), 2); + assert_eq!(a.list().len(), 1, "what runs goes on"); + drop(running); + assert!(a.take_ready().is_none()); + } } diff --git a/crates/engine/src/cmd/activity.rs b/crates/engine/src/cmd/activity.rs index ed4e8d35c73..3fa99b488a7 100644 --- a/crates/engine/src/cmd/activity.rs +++ b/crates/engine/src/cmd/activity.rs @@ -11,7 +11,7 @@ pub fn specs() -> Vec { "Background Tasks", [], None, - "{} → {tasks: [{id, kind, label, done, total, unit: count|bytes|percent, detail, cancellable, cancelling, ageMs}]} — the long-running tasks in flight (imports, exports, preview builds, downloads, the face scan…), oldest first; total 0 = not known yet", + "{} → {tasks: [{id, kind, label, done, total, unit: count|bytes|percent, detail, cancellable, cancelling, ageMs, waiting, place, lane}]} — the long-running tasks in flight (imports, exports, preview builds, downloads, the face scan…), oldest first, then those waiting in line for a task of their lane (waiting: true, place: 1 = next in its lane, lane: previews; done and total 0); total 0 = not known yet", always, |s, _| Ok(json!({"tasks": s.activity.list()})) ), @@ -20,7 +20,7 @@ pub fn specs() -> Vec { "Cancel Background Task", [], None, - "{id} | {all: true} → {cancelled: n} — ask a task (or every cancellable task) to stop; it stops at its next file or photo (a preview build also stops between a photo's own previews). An unknown id (it may have just finished) or a task that can't be cancelled is an error", + "{id} | {all: true} → {cancelled: n} — ask a task (or every cancellable task) to stop; it stops at its next file or photo (a preview build also stops between a photo's own previews). A task waiting in line is taken out of it and never runs; all also empties the line. An unknown id (it may have just finished) or a task that can't be cancelled is an error", always, |s, p| { const C: &str = "activity.cancel"; diff --git a/crates/engine/src/cmd/previews.rs b/crates/engine/src/cmd/previews.rs index e1b33cc7144..34f13e4cf6b 100644 --- a/crates/engine/src/cmd/previews.rs +++ b/crates/engine/src/cmd/previews.rs @@ -9,7 +9,7 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use serde_json::{Value, json}; use super::{CommandSpec, always, bad, cmd, str_param}; -use crate::activity::{Cancel, TaskGuard}; +use crate::activity::{Cancel, Lane, Request, TaskGuard}; use crate::media::{RenderJob, THUMB_SIZES}; use crate::{Result, Session}; @@ -69,18 +69,80 @@ pub(crate) fn jobs_for(s: &mut Session, id: lightcraft_catalog::PhotoId, edge: O if e >= thumb { view.into_iter().chain(grid).collect() } else { grid.into_iter().chain(view).collect() } } -/// The build's row in the activity stack (`what` as in [`PreviewBuild::what`]). -fn task_for(s: &Session, state: &PreviewBuild) -> TaskGuard { - let (kind, label) = match state.what { +/// The row in the activity stack of a build of `what` (as in [`PreviewBuild::what`]): its kind and its label. +fn row_of(what: &str) -> (&'static str, &'static str) { + match what { "" => ("previews", "Building previews"), "smart previews" => ("smartPreviews", "Building smart previews"), _ => ("smartPreviews", "Discarding smart previews"), - }; + } +} + +/// The build's row in the activity stack. +fn task_for(s: &Session, state: &PreviewBuild) -> TaskGuard { + let (kind, label) = row_of(state.what); let task = s.activity.start(kind, label, Cancel::Flag(state.cancel.clone())); task.progress(0, state.total as u64); task } +/// A build's state and its row, which go together. However the build ends (it finishes, its worker panics, or the +/// worker can't be started) the state reads as finished first, and then the row goes: a build waiting in line starts +/// when the row is gone, and is refused if the state still said a build runs. A build that did not mark itself +/// finished did not end well: it says so, instead of reading as one that built nothing. +struct Running { + state: Arc, + task: TaskGuard, +} + +impl Drop for Running { + fn drop(&mut self) { + if !self.state.finished.load(Ordering::Relaxed) { + self.state + .error + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner) + .get_or_insert_with(|| "the build stopped unexpectedly".to_string()); + } + self.state.finished.store(true, Ordering::Relaxed); + } +} + +/// What a build of `ids` was asked, as it runs later (from the line): the photos written out (the selection or the +/// view may have changed by then), in the background (nothing waits for it then), and not queued again. +fn request_for(command: &str, p: &Value, ids: &[lightcraft_catalog::PhotoId]) -> Request { + let mut params = p.as_object().cloned().unwrap_or_default(); + for key in ["id", "queue", "wait"] { + params.remove(key); + } + params.insert("ids".into(), ids.iter().map(|id| id.0).collect()); + Request { command: command.into(), params: Value::Object(params) } +} + +/// The refusal of a build while another runs, unless the call asks to `queue`. +const REFUSED: &str = "a preview build is already running"; + +fn queue_param(p: &Value) -> bool { + p.get("queue").and_then(Value::as_bool).unwrap_or(false) +} + +fn build_running(s: &Session) -> bool { + s.preview_build.as_ref().is_some_and(|b| !b.finished.load(Ordering::Relaxed)) +} + +/// A build asked for with `queue`: while one runs (or others already wait) this one waits in line behind them → +/// `{queued: id, place}`. `None`: nothing is ahead of it, so it starts now. +fn wait_in_line(s: &Session, c: &str, p: &Value, what: &str, request: &Request) -> Option> { + if !build_running(s) && !s.activity.lane_waiting(Lane::Previews) { + return None; + } + if p.get("wait").and_then(Value::as_bool) == Some(true) { + return Some(Err(bad(c, "a build that waits in line can't also be waited for: leave out wait"))); + } + let (kind, label) = row_of(what); + Some(s.activity.enqueue(kind, label, request.clone()).map(|(id, place)| json!({"queued": id, "place": place})).map_err(|e| bad(c, e))) +} + /// Render one photo's jobs in order. The source the first job decodes serves the ones after it /// (the grid thumbnail is made from the view's source instead of decoding the file again). /// `None` when `cancel` was asked for before a job started: that photo is not counted as done. @@ -282,31 +344,34 @@ fn build(s: &mut Session, p: &Value) -> Result { "full" | "1:1" => None, other => return Err(bad(C, format!("unknown size `{other}` (standard|full)"))), }; - if s.preview_build.as_ref().is_some_and(|b| !b.finished.load(Ordering::Relaxed)) { - return Err(bad(C, "a preview build is already running")); + let queue = queue_param(p); + if !queue && build_running(s) { + return Err(bad(C, REFUSED)); } // explicit ids, else the selection, else everything in view let ids = if p.get("ids").is_some() || p.get("id").is_some() || !s.selection.ids.is_empty() { s.targets(p)? } else { s.visible_cloned() }; + if queue && let Some(queued) = wait_in_line(s, C, p, "", &request_for(C, p, &ids)) { + return queued; + } let jobs: Vec> = ids.iter().map(|id| jobs_for(s, *id, edge)).filter(|j| !j.is_empty()).collect(); #[cfg(test)] let state = Arc::new(PreviewBuild { total: jobs.len(), gate, ..Default::default() }); #[cfg(not(test))] let state = Arc::new(PreviewBuild { total: jobs.len(), ..Default::default() }); s.preview_build = Some(state.clone()); - let task = task_for(s, &state); + let run = Running { task: task_for(s, &state), state: state.clone() }; let lanes = lanes(jobs.len(), edge.is_none()); let wait = p.get("wait").and_then(Value::as_bool).unwrap_or(false) || cfg!(target_arch = "wasm32"); if wait { - run_all(jobs, &state, &task, lanes); + run_all(jobs, &run.state, &run.task, lanes); return Ok(state.json()); } #[cfg(not(target_arch = "wasm32"))] { // the row stays while the worker runs (it is dropped with the closure, however that ends) - let st = state.clone(); std::thread::Builder::new() .name("lc-build-previews".into()) - .spawn(move || run_all(jobs, &st, &task, lanes)) + .spawn(move || run_all(jobs, &run.state, &run.task, lanes)) .map_err(|e| bad(C, format!("could not start: {e}")))?; } Ok(state.json()) @@ -471,10 +536,15 @@ fn smart(s: &mut Session, p: &Value) -> Result { let dir = s.media.smart_dir.clone().ok_or_else(|| bad(C, "smart previews need a library on disk"))?; let discard = p.get("discard").and_then(Value::as_bool).unwrap_or(false); let background = p.get("background").and_then(Value::as_bool).unwrap_or(false); - if background && s.preview_build.as_ref().is_some_and(|b| !b.finished.load(Ordering::Relaxed)) { - return Err(bad(C, "a preview build is already running")); + let queue = background && queue_param(p); + if background && !queue && build_running(s) { + return Err(bad(C, REFUSED)); } let ids = if p.get("ids").is_some() || !s.selection.ids.is_empty() { s.targets(p)? } else { s.visible_cloned() }; + let what = if discard { "discarding smart previews" } else { "smart previews" }; + if queue && let Some(queued) = wait_in_line(s, C, p, what, &request_for(C, p, &ids)) { + return queued; + } let mut jobs: Vec = Vec::new(); for id in ids { let Some(ph) = s.catalog.photo(id).cloned() else { continue }; @@ -487,19 +557,17 @@ fn smart(s: &mut Session, p: &Value) -> Result { } let custom = s.smart_previews_dir.is_some(); if background { - let what = if discard { "discarding smart previews" } else { "smart previews" }; let state = Arc::new(PreviewBuild { total: jobs.len(), what, ..Default::default() }); s.preview_build = Some(state.clone()); - let task = task_for(s, &state); - let st = state.clone(); + let run = Running { task: task_for(s, &state), state: state.clone() }; std::thread::Builder::new() .name("lc-smart-previews".into()) .spawn(move || { - if let Err(e) = smart_run(&dir, custom, discard, jobs, Some((&st, &task))) { + if let Err(e) = smart_run(&dir, custom, discard, jobs, Some((&run.state, &run.task))) { log::warn!("{C}: {e}"); - *st.error.lock().unwrap_or_else(std::sync::PoisonError::into_inner) = Some(e); + *run.state.error.lock().unwrap_or_else(std::sync::PoisonError::into_inner) = Some(e); } - st.finished.store(true, Ordering::Relaxed); + run.state.finished.store(true, Ordering::Relaxed); }) .map_err(|e| bad(C, format!("could not start: {e}")))?; return Ok(state.json()); @@ -640,7 +708,7 @@ pub fn specs() -> Vec { "Build Smart Previews", [], None, - "{ids?, discard?: bool, background?: bool} — build (or discard) the smart previews of the selected photos (else all in view): compact proxies in the library that keep photos editable and exportable (at proxy size) while their originals are offline; a damaged proxy (cut short) is rebuilt → {built, repaired, removed, failed}; with background (the app's menu) the files are read and written on a worker thread → {total, done, failed, repaired, running, what} like library.buildPreviews (progress: library.previewProgress, stop: library.cancelPreviews)", + "{ids?, discard?: bool, background?: bool, queue?: bool} — build (or discard) the smart previews of the selected photos (else all in view): compact proxies in the library that keep photos editable and exportable (at proxy size) while their originals are offline; a damaged proxy (cut short) is rebuilt → {built, repaired, removed, failed}; with background (the app's menu) the files are read and written on a worker thread → {total, done, failed, repaired, running, what} like library.buildPreviews (progress: library.previewProgress, stop: library.cancelPreviews). A background one while a preview build runs is refused, or with queue waits in line for it, as library.buildPreviews does → {queued, place}", always, smart ), @@ -667,7 +735,7 @@ pub fn specs() -> Vec { "Build Previews", [], None, - "{size?: standard (2048 px, or `edge`) | full (1:1), ids?, wait?: bool} — render the grid thumbnail and loupe view of the selected photos (else all in view) into the preview cache, in the background unless `wait` → {total, done, failed, running}", + "{size?: standard (2048 px, or `edge`) | full (1:1), ids?, wait?: bool, queue?: bool} — render the grid thumbnail and loupe view of the selected photos (else all in view) into the preview cache, in the background unless `wait` → {total, done, failed, running}. One build runs at a time (this, or Build / Discard Smart Previews in the background): while one runs another is refused, or with queue waits in line for it and starts by itself when the builds ahead of it end → {queued: its activity id, place: 1 = next}. It builds the photos chosen when it was asked; activity.list shows it waiting, activity.cancel takes it out of the line. Not with wait while one runs", always, build ), @@ -716,4 +784,38 @@ mod tests { assert_eq!(r["total"], json!(ids.len())); assert_eq!(r["failed"], json!(0)); } + // Given a build whose worker dies (or can't start), the build reads as finished and its row goes, so that a + // build waiting in line starts instead of being refused as "already running" + #[test] + fn a_build_whose_worker_dies_reads_as_finished_before_its_row_goes() { + use std::sync::Arc; + use std::sync::atomic::Ordering; + + let s = Session::with_demo(); + let state = Arc::new(super::PreviewBuild::default()); + let run = super::Running { task: super::task_for(&s, &state), state: state.clone() }; + assert!(s.activity.lane_busy(crate::activity::Lane::Previews)); + let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(move || { + let _run = run; + panic!("synthetic worker panic"); + })); + assert!(r.is_err()); + assert!(state.finished.load(Ordering::Relaxed)); + assert_eq!(state.error().as_deref(), Some("the build stopped unexpectedly"), "a crash is not a success that built nothing"); + assert!(!s.activity.lane_busy(crate::activity::Lane::Previews)); + } + + // Given a build that marked itself finished, its row going leaves no error + #[test] + fn a_build_that_finished_leaves_no_error() { + use std::sync::Arc; + use std::sync::atomic::Ordering; + + let s = Session::with_demo(); + let state = Arc::new(super::PreviewBuild::default()); + let run = super::Running { task: super::task_for(&s, &state), state: state.clone() }; + state.finished.store(true, Ordering::Relaxed); + drop(run); + assert!(state.error().is_none()); + } } diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index acaa1807009..97a366216cc 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -321,6 +321,8 @@ pub struct Session { /// Current time provider (ISO 8601); injectable for tests and wasm. pub clock: Box String + Send>, depth: u32, + /// [`Session::start_waiting`] is starting tasks (the commands it runs don't start more themselves). + starting_waiting: bool, /// Selected mask (Masking panel), by mask id. pub active_mask: Option, /// AI masks (SAM 3): the model and the last photo prepared for it. @@ -496,6 +498,7 @@ impl Session { media: media::MediaCache::default(), clock: Box::new(|| "2026-09-30T12:00:00".to_string()), depth: 0, + starting_waiting: false, active_mask: None, segmenter: segment::Segmenter::default(), active_spot: None, @@ -556,6 +559,15 @@ impl Session { /// Run a command by id. THE entry point for every frontend. pub fn execute(&mut self, id: &str, params: &Value) -> Result { + let r = self.dispatch(id, params, true); + // a task this command freed the lane of starts now, not at the next frame + self.start_waiting(); + r + } + + /// [`Session::execute`] without starting waiting tasks; `journal`: record the call when the command is journaled + /// (not for a task that waited: the call that asked for it is recorded already). + fn dispatch(&mut self, id: &str, params: &Value, journal: bool) -> Result { let spec = find_command(id).ok_or_else(|| EngineError::UnknownCommand(id.to_string()))?; // a command that validates the photos a call names isn't held back by the selection if !(spec.explicit_targets && cmd::names_photos(params)) { @@ -563,13 +575,33 @@ impl Session { } let empty = Value::Object(Default::default()); let params = if params.is_null() { &empty } else { params }; - self.run_command(id, spec.journal.then_some(params), |s| (spec.run)(s, params)).map_err(|e| match e { + self.run_command(id, (journal && spec.journal).then_some(params), |s| (spec.run)(s, params)).map_err(|e| match e { // a shared parameter check ([`Session::targets`]) names the command it ran for EngineError::BadParams { cmd, msg } if cmd.is_empty() => EngineError::BadParams { cmd: id.to_string(), msg }, e => e, }) } + /// Start the tasks waiting in line whose lane is free ([`crate::activity`]), each by running the command it was + /// asked with. One that can't start is logged and the next in line goes on. Every frontend gets this after each + /// command; the app also calls it every frame, for a lane that frees while nothing is asked. + pub fn start_waiting(&mut self) { + if self.depth > 0 || self.starting_waiting { + return; + } + self.starting_waiting = true; + // (bounded: each turn takes one task out of a line that is at most this long) + for _ in 0..activity::MAX_WAITING { + let Some(w) = self.activity.take_ready() else { break }; + let r = self.dispatch(&w.request.command, &w.request.params, false); + self.activity.started(); + if let Err(e) = r { + log::warn!("{}: a task that waited could not start: {e}", w.request.command); + } + } + self.starting_waiting = false; + } + /// Run `f` as command `id` with what [`Session::execute`] does around every command: the /// panic guard, auto versions, XMP sidecar auto-write and the durable save (a failed save is /// `NotSaved`). Not journaled. The app's import task commits its batches this way. diff --git a/crates/engine/src/library.rs b/crates/engine/src/library.rs index a5071b4b358..edb06b8ea0e 100644 --- a/crates/engine/src/library.rs +++ b/crates/engine/src/library.rs @@ -475,6 +475,11 @@ impl Session { static LOADS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); catalog.revision = LOADS.fetch_add(1, std::sync::atomic::Ordering::Relaxed).wrapping_add(1) << 32; self.catalog = catalog; + // nor do tasks waiting in line carry over: they name the old library's photos and folders + let dropped = self.activity.library_changed(); + if dropped > 0 { + log::info!("library: {dropped} task(s) waiting in line were dropped with the old library"); + } // (nothing of the list the last library showed is this one's) self.refresh_view(); self.library_generation = crate::LIBRARY_GEN.fetch_add(1, std::sync::atomic::Ordering::Relaxed); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index ae03859d21f..437cf10fc73 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -46,6 +46,7 @@ mod slide; mod slideshow_export; mod spots; mod sync; +mod task_queue; mod view_follow; pub(super) mod xmp; diff --git a/crates/engine/src/tests/task_queue.rs b/crates/engine/src/tests/task_queue.rs new file mode 100644 index 00000000000..1eade863445 --- /dev/null +++ b/crates/engine/src/tests/task_queue.rs @@ -0,0 +1,249 @@ +//! Tasks waiting in line for their lane (see `crate::activity`), with the preview builds. +//! +//! Scenarios, in the words of an agent building previews for several shoots: +//! +//! * Build Previews while a build runs: without `queue` it is refused, as it always was. With `queue` it waits +//! behind the build, `activity.list` says it is next, and it builds the photos chosen when it was asked. +//! * It starts by itself when the build ahead of it ends. +//! * `activity.cancel` on it takes it out of the line: it never runs; `all` empties the line. +//! * The line is bounded. +//! * Another library: nothing waits for it. +//! +//! These go through commands and `activity.list` only, so that they describe what a control or MCP client sees. + +use std::path::PathBuf; +use std::sync::Arc; +use std::sync::atomic::Ordering; + +use serde_json::{Value, json}; + +use crate::Session; +use crate::activity::{Cancel, MAX_WAITING, TaskGuard}; +use crate::cmd::previews::PreviewBuild; + +fn temp_dir(tag: &str) -> PathBuf { + let d = std::env::temp_dir().join(format!("lc-task-queue-{tag}-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&d); + std::fs::create_dir_all(&d).unwrap(); + d +} + +/// A preview build that holds the lane until [`release`]: its row runs, and the build reads as unfinished. +struct Hold { + _row: TaskGuard, + build: Arc, +} + +fn hold(s: &mut Session) -> Hold { + let build = Arc::new(PreviewBuild::default()); + s.preview_build = Some(build.clone()); + Hold { _row: s.activity.start("previews", "Building previews", Cancel::Yes), build } +} + +/// The held build ends as a real one does: finished first, then its row goes. +fn release(h: Hold) { + h.build.finished.store(true, Ordering::Release); + drop(h); +} + +/// Wait (at most a minute) until no task runs or waits. +fn settle(s: &mut Session) { + let t0 = std::time::Instant::now(); + loop { + // any command lets a waiting task whose lane is free start (the app's frame loop does too) + let rows = tasks(s); + if rows.is_empty() { + return; + } + assert!(t0.elapsed().as_secs() < 60, "tasks still listed: {rows:?}"); + std::thread::sleep(std::time::Duration::from_millis(10)); + } +} + +fn tasks(s: &mut Session) -> Vec { + s.execute("activity.list", &json!({})).unwrap()["tasks"].as_array().cloned().unwrap_or_default() +} + +fn build_ids(s: &Session, n: usize) -> Vec { + s.catalog.photos().take(n).map(|p| p.id.0).collect() +} + +/// Given a preview build running and two photos chosen, when Build Previews is asked for with `queue`, then it waits +/// behind the build, first in line, with nothing done. When other photos are chosen meanwhile and the build ahead +/// ends, then it starts by itself and builds the two photos chosen when it was asked. +#[test] +fn a_build_asked_for_while_one_runs_waits_behind_it_and_builds_the_photos_chosen_then() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 3); + s.execute("library.select", &json!({"ids": [ids[0], ids[1]]})).unwrap(); + let h = hold(&mut s); + let r = s.execute("library.buildPreviews", &json!({"edge": 256, "queue": true})).unwrap(); + let id = r["queued"].as_u64().expect("an id while it waits"); + assert_eq!(r["place"], 1); + let rows = tasks(&mut s); + assert_eq!(rows.len(), 2, "the running build, then the waiting one: {rows:?}"); + assert_eq!(rows[1]["id"], id); + assert_eq!((rows[1]["waiting"].as_bool(), rows[1]["place"].as_u64(), rows[1]["lane"].as_str()), (Some(true), Some(1), Some("previews"))); + assert_eq!((rows[1]["done"].as_u64(), rows[1]["total"].as_u64()), (Some(0), Some(0))); + assert_eq!(rows[1]["label"], "Building previews"); + assert_eq!((rows[0]["waiting"].as_bool(), rows[0]["place"].as_u64()), (Some(false), Some(0)), "the running one is not in line"); + s.execute("library.select", &json!({"ids": [ids[2]]})).unwrap(); + release(h); + settle(&mut s); + let progress = s.execute("library.previewProgress", &json!({})).unwrap(); + assert_eq!((progress["total"].as_u64(), progress["done"].as_u64()), (Some(2), Some(2)), "{progress}"); + // the journal has the call that asked for it, once: starting it was not a second call + assert_eq!(s.journal.iter().filter(|(c, _)| c == "library.buildPreviews").count(), 1, "{:?}", s.journal); +} + +/// Given a preview build running, when a build is asked for without `queue`, then it is refused as before, and +/// nothing waits. +#[test] +fn a_build_asked_for_while_one_runs_is_refused_unless_it_asks_to_queue() { + let mut s = Session::with_demo(); + let h = hold(&mut s); + let e = s.execute("library.buildPreviews", &json!({"edge": 256})).unwrap_err().to_string(); + assert!(e.contains("a preview build is already running"), "{e}"); + let e = s.execute("library.buildPreviews", &json!({"edge": 256, "queue": false})).unwrap_err().to_string(); + assert!(e.contains("a preview build is already running"), "{e}"); + assert_eq!(tasks(&mut s).len(), 1, "only the running build is listed"); + release(h); + assert!(tasks(&mut s).is_empty()); +} + +/// Given no build running, when a build is asked for with `queue`, then it starts at once, as one without it does. +#[test] +fn a_build_that_asks_to_queue_starts_at_once_when_nothing_is_ahead_of_it() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 2); + let r = s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true, "wait": true})).unwrap(); + assert!(r.get("queued").is_none(), "{r}"); + assert_eq!((r["total"].as_u64(), r["done"].as_u64()), (Some(2), Some(2)), "{r}"); +} + +/// Given a build waiting behind another, when `activity.cancel` is asked for it, then it leaves the line and never +/// runs. +#[test] +fn a_waiting_build_taken_out_of_the_line_never_runs() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let h = hold(&mut s); + let held = h.build.clone(); + let id = s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap()["queued"].as_u64().unwrap(); + assert_eq!(s.execute("activity.cancel", &json!({"id": id})).unwrap()["cancelled"], 1); + assert_eq!(tasks(&mut s).len(), 1, "only the running build is left"); + assert!(s.execute("activity.cancel", &json!({"id": id})).is_err(), "it is gone: an unknown id"); + release(h); + settle(&mut s); + assert!(s.preview_build.as_ref().is_some_and(|b| Arc::ptr_eq(b, &held)), "no build started after the held one"); +} + +/// Given builds waiting, when every task is cancelled, then the line is empty and the count includes the waiting ones, +/// so that nothing starts as soon as the running build stops. +#[test] +fn cancelling_every_task_empties_the_line() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let h = hold(&mut s); + let held = h.build.clone(); + for _ in 0..2 { + s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + } + assert_eq!(tasks(&mut s).len(), 3); + assert_eq!(s.execute("activity.cancel", &json!({"all": true})).unwrap()["cancelled"], 3, "the running one and the two waiting"); + assert_eq!(tasks(&mut s).len(), 1, "only the running (stopping) build is listed"); + release(h); + settle(&mut s); + assert!(s.preview_build.as_ref().is_some_and(|b| Arc::ptr_eq(b, &held)), "nothing started after it"); +} + +/// Given a full line, when one more build is asked for, then it is refused and says why; the line is as it was. +#[test] +fn the_line_is_bounded() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let h = hold(&mut s); + for place in 1..=MAX_WAITING { + let r = s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + assert_eq!(r["place"].as_u64(), Some(place as u64)); + } + let e = s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap_err().to_string(); + assert!(e.contains(&MAX_WAITING.to_string()), "{e}"); + assert_eq!(tasks(&mut s).len(), MAX_WAITING + 1); + s.execute("activity.cancel", &json!({"all": true})).unwrap(); + release(h); +} + +/// Build Smart Previews in the background waits in the same line (one preview build at a time). +#[test] +fn smart_previews_wait_behind_a_preview_build() { + let dir = temp_dir("smart"); + let mut s = Session::new(); + s.open_library(&dir, true).unwrap(); + let ids = build_ids(&s, 2); + let h = hold(&mut s); + let e = s.execute("library.smartPreviews", &json!({"ids": ids, "background": true})).unwrap_err().to_string(); + assert!(e.contains("already running"), "{e}"); + let r = s.execute("library.smartPreviews", &json!({"ids": ids, "background": true, "queue": true})).unwrap(); + assert!(r["queued"].is_u64(), "{r}"); + let rows = tasks(&mut s); + assert_eq!( + (rows[1]["kind"].as_str(), rows[1]["waiting"].as_bool(), rows[1]["lane"].as_str()), + (Some("smartPreviews"), Some(true), Some("previews")) + ); + release(h); + settle(&mut s); + let progress = s.execute("library.previewProgress", &json!({})).unwrap(); + // (the demo photos aren't files, so it has nothing to build: that it ran at all is what counts) + assert_eq!(progress["what"], "smart previews", "{progress}"); + assert_eq!(progress["running"], false, "{progress}"); + s.close_library().unwrap(); + let _ = std::fs::remove_dir_all(&dir); +} + +/// Two builds waiting, the first of which can't start (here: it was asked for a size no build accepts, as if what it +/// needs went away while it waited): the second still runs. +#[test] +fn a_build_that_can_not_start_does_not_hold_up_the_line() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let h = hold(&mut s); + let bad = crate::activity::Request { command: "library.buildPreviews".into(), params: json!({"size": "huge"}) }; + s.activity.enqueue("previews", "Building previews", bad).unwrap(); + s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + release(h); + settle(&mut s); + let progress = s.execute("library.previewProgress", &json!({})).unwrap(); + assert_eq!((progress["total"].as_u64(), progress["done"].as_u64()), (Some(1), Some(1)), "{progress}"); +} + +/// `queue` with `wait` while a build runs: the call can't both wait in line and return when the build is done. +#[test] +fn a_build_that_would_wait_for_its_turn_and_its_end_is_refused() { + let mut s = Session::with_demo(); + let h = hold(&mut s); + let e = s.execute("library.buildPreviews", &json!({"edge": 256, "queue": true, "wait": true})).unwrap_err().to_string(); + assert!(e.contains("wait"), "{e}"); + assert_eq!(tasks(&mut s).len(), 1); + release(h); +} + +/// Given a build waiting and one still running, when another library is opened, then nothing waits any more: the +/// build asked for was about the old library's photos. +#[test] +fn another_library_drops_what_waits() { + let dir = temp_dir("switch"); + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let h = hold(&mut s); + s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + assert_eq!(tasks(&mut s).len(), 2); + s.open_library(&dir, false).unwrap(); + let rows = tasks(&mut s); + assert_eq!(rows.len(), 1, "only the old library's running build: {rows:?}"); + assert_eq!(rows[0]["waiting"], false); + release(h); + settle(&mut s); + s.close_library().unwrap(); + let _ = std::fs::remove_dir_all(&dir); +} diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 6e92091c780..4eafa60c773 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -71,6 +71,8 @@ impl LightcraftApp { tasks::poll(self, ctx); updates_ui::tick(self, ctx); self.preview_build_status(ctx); + // a task waiting in line whose lane freed while nothing was asked starts now (commands start them too) + self.session.start_waiting(); self.save_status(ctx); self.ai_mask_detail(ctx, now); self.place_names_outcome(ctx); diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index caacbc59088..41fa664e93f 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -148,7 +148,7 @@ pub fn inspect(app: &LightcraftApp, ctx: &egui::Context) -> Value { "export": {"running": app.export.as_ref().map(crate::export_task::ExportTask::status), "last": app.last_export_result}, "import": app.import.as_ref().map(crate::import::ImportTask::status), "tasks": app.tasks.labels(), - // every long-running task in flight, as the activity stack shows them (`activity.list`) + // every long-running task in flight and every task waiting in line (`activity.list`); the stack draws the running ones "activity": app.session.activity.list(), // commands waiting on a native file dialog shown off the UI thread (`pick`) "fileDialogs": app.pending_picks.iter().map(|p| p.command.clone()).collect::>(), diff --git a/crates/ui-egui/src/panels/activity.rs b/crates/ui-egui/src/panels/activity.rs index dffdd1c4d33..0aadc198347 100644 --- a/crates/ui-egui/src/panels/activity.rs +++ b/crates/ui-egui/src/panels/activity.rs @@ -55,7 +55,8 @@ fn detail_line(t: &TaskInfo) -> String { /// Draw the stack (called every frame, after the panels and dialogs). pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) { - let all = app.session.activity.list(); + // (a task waiting in line has nothing to show yet and no progress to draw: agents see it in `activity.list`) + let all: Vec = app.session.activity.list().into_iter().filter(|t| !t.waiting).collect(); if all.is_empty() { app.activity_expanded = false; return; diff --git a/crates/ui-egui/src/tests/activity.rs b/crates/ui-egui/src/tests/activity.rs index 58873a6e2e9..40fd79c1152 100644 --- a/crates/ui-egui/src/tests/activity.rs +++ b/crates/ui-egui/src/tests/activity.rs @@ -110,6 +110,9 @@ fn count_text_by_unit() { cancellable: true, cancelling: false, age_ms: 600, + waiting: false, + place: 0, + lane: None, }; assert_eq!(count_text(&t), "3 of 25"); (t.done, t.total, t.unit) = (12 * 1_048_576, 340 * 1_048_576, Unit::Bytes); @@ -534,3 +537,35 @@ fn immediate_library_commands_and_auto_sync_show_completion() { assert!(h.app.run("library.compact", json!({})).is_err()); assert!(h.app.ui.toast.is_none()); } + +/// Given a preview build running and another waiting in line behind it, then the stack shows the running build only, +/// and the waiting one starts by itself, in a frame, when the build ahead of it ends. +#[test] +fn a_task_waiting_in_line_has_no_row_and_starts_when_the_lane_frees() { + use lightcraft_engine::cmd::previews::PreviewBuild; + use std::sync::atomic::Ordering; + + let mut h = demo(); + let build = std::sync::Arc::new(PreviewBuild::default()); + h.app.session.preview_build = Some(build.clone()); + let running = h.app.session.activity.start("previews", "Building previews", Cancel::Yes); + let ids: Vec = h.app.session.catalog.photos().take(1).map(|p| p.id.0).collect(); + let queued = h.app.session.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + let waiting = queued["queued"].as_u64().expect("it waits"); + assert_eq!(h.app.session.activity.list().len(), 2); + wait_visible(&mut h); + assert!(has(&h, &format!("activity:row:{}", running.id()))); + assert!(!has(&h, &format!("activity:row:{waiting}")) && rows(&h) == 1, "a waiting task draws no row"); + // the lane frees with no command asked: the frame loop starts it + build.finished.store(true, Ordering::Release); + drop(running); + let t0 = std::time::Instant::now(); + while h.app.session.activity.list().iter().any(|t| t.id == waiting && t.label == "Building previews") && t0.elapsed() < T { + h.step(); + let started = h.app.session.preview_build.as_ref().is_some_and(|b| !std::sync::Arc::ptr_eq(b, &build)); + if started { + break; + } + } + assert!(h.app.session.preview_build.as_ref().is_some_and(|b| !std::sync::Arc::ptr_eq(b, &build)), "the waiting build started"); +} diff --git a/crates/ui-egui/src/tests/progress.rs b/crates/ui-egui/src/tests/progress.rs index 09e9234a0c9..b0c9f6f7d4a 100644 --- a/crates/ui-egui/src/tests/progress.rs +++ b/crates/ui-egui/src/tests/progress.rs @@ -276,6 +276,9 @@ fn an_activity_bar_is_named_after_its_task() { cancellable: true, cancelling: false, age_ms: 600, + waiting: false, + place: 0, + lane: None, }; let (nodes, _, _) = frames(Vec::new(), |ui| crate::panels::activity::bar(ui, &task, 200.0).rect.width()); let bar = nodes.iter().find(|n| n.role == "ProgressIndicator").unwrap_or_else(|| panic!("{nodes:?}")); diff --git a/docs/background-tasks.md b/docs/background-tasks.md index 0c9281dfc22..128bd60e3ce 100644 --- a/docs/background-tasks.md +++ b/docs/background-tasks.md @@ -49,6 +49,18 @@ guard.detail(&file_name); - **Quiet periodic work** shows no row: the auto-import folder listing runs every few seconds through `tasks::spawn(.., None, ..)`. +## Waiting in line + +Jobs that must not run side by side share a lane (`activity::Lane`; for now only the preview builds: Build Previews and +the background Build / Discard Smart Previews). A call that sets `queue: true` while its lane is busy does not fail: +`Activity::enqueue` keeps what it was asked (`Request`: the command and its parameters, with the photos written out) +and `Session::start_waiting` runs it, under the id it had in line, once the lane is free. The engine calls it after +every command and the app every frame. `activity.list` shows a waiting task after the running ones (`waiting`, +`place`, `lane`); the activity stack in the app draws only running tasks. `activity.cancel` takes a waiting task out +of the line, `activity.cancel {all: true}` empties it, and opening another library drops it: the photos it names +belong to the old one. At most `MAX_WAITING` (100) tasks wait. Without `queue` a call is refused while its lane is +busy, as before. A waiting task whose start fails (there is no smart previews folder any more, say) is logged and the next in line goes on. + ## Examples in the code | Job | Where | Shows how to | diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 36294c78756..fc0dccf4cc4 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -79,7 +79,7 @@ filmstrip is visible. | `engine.commands` | — | Engine + UI commands: id, label, menu, shortcut, params doc, enabled | | `ui.menu.list` | — | Menu entries (flat: id, label, menu path, shortcut, enabled) | | `ui.menu.tree` | — | The menu bar as shown (File … Help): items `{id, params?, label, shortcut?, enabled, checked?}`, separators, submenus — the model behind the native macOS menu bar and the in-window menus | -| `ui.inspect` | — | UI state, window, `loupe` (`source`, `pending`, `failed` = why its render failed, else `null`, and `region: {full, window, pending}` when a zoomed view also renders the window on screen at no more than 100 % — `full` is the frame it is cut from, `window` its `[x, y, w, h]` — and `regionBefore` for the Before side of a Before/After view), canvas/image rects, `scroll: {grid, filmstrip}` (scroll offsets in points, `null` until drawn), active photo, selection, perf (`frameMs` = layout, `logicMs` = per-frame logic before it, `updateMs` = both, `maxUpdateMs`, `fps`, render queue …, `gpu` = adapter in use, `gpuReason` = why renders don't use the GPU, `gpuFallback` = latest render redone on the CPU and why — see `docs/gpu-pipeline.md`), status, memory (bytes per cache, see `library.memory`; plus stage caches — `budgetBytes`, `trimmed`, `sharedSourceBytes` (the one device copy of a big original) — and textures), `export: {running: {total, done, current} \| null, last}`, `notices` (warnings waiting to be shown, e.g. a damaged settings file; OK = `button:noticeOk`), `quitPrompt` (why quitting was stopped: tasks that would be cut short are running — `button:quitAnyway` cancels them and quits, `button:quitCancel` keeps working — or unsaved changes: `button:quitRetry` / `button:quitAnyway` / `button:quitCancel`), `import: {done, total, imported, cancelled} \| null` (an import runs on a worker thread), `tasks` (other background work: `Find Missing Photos`, `Auto Import`), `activity` (every long-running task in flight as the activity stack in the top-left corner shows it, same shape as `activity.list`; a row appears once its task is 0.5 s old, ids `activity:row:`, ✕ = `activity:cancel:`, `activity:more` expands past 3 rows), `fileDialogs` (commands waiting on a native file dialog, which runs off the UI thread; they run again with the answer when it closes), `copied` (the text the UI last put on the clipboard, `null` until something is copied) | +| `ui.inspect` | — | UI state, window, `loupe` (`source`, `pending`, `failed` = why its render failed, else `null`, and `region: {full, window, pending}` when a zoomed view also renders the window on screen at no more than 100 % — `full` is the frame it is cut from, `window` its `[x, y, w, h]` — and `regionBefore` for the Before side of a Before/After view), canvas/image rects, `scroll: {grid, filmstrip}` (scroll offsets in points, `null` until drawn), active photo, selection, perf (`frameMs` = layout, `logicMs` = per-frame logic before it, `updateMs` = both, `maxUpdateMs`, `fps`, render queue …, `gpu` = adapter in use, `gpuReason` = why renders don't use the GPU, `gpuFallback` = latest render redone on the CPU and why — see `docs/gpu-pipeline.md`), status, memory (bytes per cache, see `library.memory`; plus stage caches — `budgetBytes`, `trimmed`, `sharedSourceBytes` (the one device copy of a big original) — and textures), `export: {running: {total, done, current} \| null, last}`, `notices` (warnings waiting to be shown, e.g. a damaged settings file; OK = `button:noticeOk`), `quitPrompt` (why quitting was stopped: tasks that would be cut short are running — `button:quitAnyway` cancels them and quits, `button:quitCancel` keeps working — or unsaved changes: `button:quitRetry` / `button:quitAnyway` / `button:quitCancel`), `import: {done, total, imported, cancelled} \| null` (an import runs on a worker thread), `tasks` (other background work: `Find Missing Photos`, `Auto Import`), `activity` (every long-running task in flight, same shape as `activity.list` (including tasks waiting in line, which have no row); the activity stack in the top-left corner shows the running ones, and a row appears once its task is 0.5 s old, ids `activity:row:`, ✕ = `activity:cancel:`, `activity:more` expands past 3 rows), `fileDialogs` (commands waiting on a native file dialog, which runs off the UI thread; they run again with the answer when it closes), `copied` (the text the UI last put on the clipboard, `null` until something is copied) | | `ui.widgets` | `{filter?}` | On-screen widgets `{id, rect: [x, y, w, h]}` (screen points) | | `ui.clickWidget` / `ui.dragWidget` / `ui.hoverWidget` | `{id, count?, button?, fx?, fy?}` (`button: "right"` right-clicks; `count` is capped at 16) / `{id, toX?, toY?, dx?, dy?, steps?}` (steps are capped at 1000) / `{id, fx?, fy?}` | Real egui input on a widget (hover: the pointer rests on it, e.g. for preset/profile previews). `fx`/`fy` are fractions of the registered rect and may lie outside `[0,1]`; the resulting point must still be inside egui's clipped interaction rect, and a non-finite fraction or resolved point is rejected before any input is queued. Geometry comes from the latest completed layout; if the widget moves before the first event or before a press, or its latest clipped rect no longer contains the point, the request fails with an error instead of clicking another widget or retargeting. A target below an ordinary modal dialog may succeed as a no-op or a backdrop click, because egui routes that input to the dialog; a target covered by a non-modal overlay fails. The blocking library-problem/launch-list window is explicit: its dim takes the modal layer, but a background target fails instead of reporting a no-op success, and only that window's own controls (`button:library…`) pass. Its creation frame is shielded and redrawn with empty input like a prompt's, so background text/pointer input cannot act while the new modal areas settle. A quit prompt or settings notice is a real egui modal scope with a foreground backdrop. Only its own buttons (`button:quit…`, `button:noticeOk`) accept a `ui.clickWidget`; background targets fail, and background keystrokes, text/clipboard input, wheel/zoom input and AccessKit actions are dropped before panels see them. The prompt itself takes Tab/Shift+Tab, Enter/Space on the focused button, and Escape/Enter for the safe default Cancel; AccessKit Focus/Click works when targeted at a prompt button. Its first creation frame (including a Tasks→Unsaved or notice→next-notice transition) is shielded and redrawn with empty input, so a press/release in that frame, or a held press from before it, cannot act underneath it; a synthetic drag already in progress is canceled. Once settled, raw `ui.click`/`ui.drag`/`ui.pointer` and backdrop clicks are still delivered to the prompt backdrop as no-ops, and the prompt's own button clicks work normally. The area/layer check cannot see a different widget covering the point in the same layer. A `ui.clickWidget` whose widget disappears before its release also fails, after canceling the pointer press without a click or drag (the same rules apply when a click spans several host frames) | | `ui.move` / `ui.click` / `ui.drag` | `{x, y, count?, button?}` / `{x, y, toX, toY, steps?}` | Raw pointer input, screen points (the same click and step caps apply) | @@ -96,8 +96,8 @@ filmstrip is visible. | `ui.zoomFactor` | `{factor}` | Set the interface scale (0.5–3; egui's zoom keys are off, Cmd+= / Cmd+- zoom the photo) | | `ui.screenshot` | `{path?, headless?}` | `{path, width, height}` once the frame (with finished renders) is captured. A `path` that did not exist when the request was admitted is written with create-new semantics and is never replaced if a file (including a newly imported original) appears there while the capture is queued; an existing ordinary file may be refreshed. `headless: true` draws the UI on the CPU (no compositor needed); a windowed capture that gets no frame within 2 s falls back to headless automatically. While the loupe still waits for a render, `ui.widgets {filter: "loupe:rendering"}` lists its "Rendering…" pill; `loupe:renderFailed` is the pill saying a render failed behind a stand-in; Compare and Reference panes have their own (`compare:rendering:`, `compare:renderFailed:`) | | `engine.execute {command: "app.export", params}` | export params (see `docs/mcp.md`), plus `preset`, `dir` / `path`, `ids`, `background`; `destinationMode: "sameAsOriginal"` writes each photo into its original's folder (+ `subfolder`) instead of `dir` | Writes the files and returns `{files}` (one `{path, width, height, bytes, sidecars}` per file, plus `gpuFallback` — why that render fell back from the GPU to the CPU — when it did; see `docs/gpu-pipeline.md`); with `background: true` (what the Export dialog and menus use) it returns `{background: true, total}` at once and the batch runs on a worker thread — poll `ui.inspect` → `export` | -| `engine.execute {command: "activity.list"}` | — | The long-running tasks in flight (imports, exports, preview builds, downloads, the face scan…), oldest first: `{tasks: [{id, kind, label, done, total, unit, detail, cancellable, cancelling, ageMs}]}`; `total` 0 = not known yet; `unit` is `count`, `bytes` or `percent`; `label` is English (the app shows it translated) | -| `engine.execute {command: "activity.cancel"}` | `{id}` or `{all: true}` | Asks the task (or every cancellable one) to stop at its next file or photo → `{cancelled: n}`; an unknown id (it may have just finished) or a task that can't be cancelled is an error | +| `engine.execute {command: "activity.list"}` | — | The long-running tasks in flight (imports, exports, preview builds, downloads, the face scan…), oldest first: `{tasks: [{id, kind, label, done, total, unit, detail, cancellable, cancelling, ageMs, waiting, place, lane}]}`, then the tasks waiting in line for one of their lane (`waiting: true`, `place` 1 = next in its lane, `lane: "previews"`, `done` and `total` 0; `queue: true` on `library.buildPreviews` / `library.smartPreviews` puts a build there instead of refusing it); `total` 0 = not known yet; `unit` is `count`, `bytes` or `percent`; `label` is English (the app shows it translated) | +| `engine.execute {command: "activity.cancel"}` | `{id}` or `{all: true}` | Asks the task (or every cancellable one) to stop at its next file or photo (a waiting task leaves the line and never runs; `all` empties it) → `{cancelled: n}`; an unknown id (it may have just finished) or a task that can't be cancelled is an error | | `ui.render` | `{id?, size?, path?}` | Render a photo (PNG to `path`), `{width, height}` | | `engine.execute {command: "slideshow.layout"}` | `{margins?, marginLeft?, …, zoomToFill?, strokeBorder?, castShadow?, backdropColor?, colorWash?, backgroundImage?, …}` (see `engine.commands`) | The slideshow's slide layout (Layout, Options, Backdrop), saved with the library; omitted keys keep their value, `{}` reads it; out-of-range numbers are clamped, a wrong type or unknown key is refused and nothing changes | | `engine.execute {command: "slideshow.overlays"}` | `{identityPlate?: {enabled?, text?, image?, size?, color?, opacity?, anchor?, offsetX?, offsetY?, relativeTo?, behind?}, ratingStars?: {enabled?, color?, size?, anchor?, …}, texts?: [{text?, size?, color?, opacity?, anchor?, offsetX?, offsetY?, relativeTo?, shadow?, shadowOpacity?, shadowOffset?, shadowRadius?, shadowAngle?}], addText?, removeText?, showWatermark?, watermark?}` (see `engine.commands`) | The overlays drawn on every slide, saved with the library: sizes and offsets are fractions of the slide's shorter side, anchors `topLeft`…`bottomRight` of the `slide` or the `photo`; text overlays expand tokens (`{caption}`, `{exposure}`, `{date}`, the file-naming tokens…; unknown tags show as typed); `watermark` takes the export watermark's keys. Replies with the settings and `warnings` | From 0784cdc30eb7381517096d85f8977561478684b2 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sat, 24 Oct 2026 13:07:52 -0400 Subject: [PATCH 02/11] LR-BEHAV-BG-TASKS: a build replaced by the one waiting behind it is still announced A build that ends is replaced as the current build by the next one, which a waiting build now starts inside whatever command comes after the first ended. If the app had not yet announced the first, its toast, failed count and error were lost. Such a build is now kept (`Session::take_unreported_builds`, at most 16) until the app announces it once, and `PreviewBuild::reported` stops a build that was announced already from being kept. Co-Authored-By: Claude --- crates/engine/src/cmd/previews.rs | 19 ++++++++-- crates/engine/src/lib.rs | 20 +++++++++++ crates/ui-egui/src/app.rs | 53 ++++++++++++++++------------ crates/ui-egui/src/state.rs | 4 --- crates/ui-egui/src/tests/activity.rs | 26 ++++++++++++++ 5 files changed, 94 insertions(+), 28 deletions(-) diff --git a/crates/engine/src/cmd/previews.rs b/crates/engine/src/cmd/previews.rs index 34f13e4cf6b..010c0b10a4a 100644 --- a/crates/engine/src/cmd/previews.rs +++ b/crates/engine/src/cmd/previews.rs @@ -25,6 +25,9 @@ pub struct PreviewBuild { /// Shared with the build's row in the activity stack (its ✕ sets it). pub cancel: Arc, pub finished: AtomicBool, + /// A frontend announced how it ended (the app's toast); one that ended and was not announced is kept when the next + /// build replaces it ([`Session::take_unreported_builds`]). + pub reported: AtomicBool, /// Damaged smart previews rebuilt (Build Smart Previews only). pub repaired: AtomicUsize, /// What is built ("" = previews; "smart previews" — Build Smart Previews runs the same way). @@ -108,6 +111,18 @@ impl Drop for Running { } } +/// Make `state` the session's current build. A build that ended and was not announced yet ([`PreviewBuild::reported`]) +/// is kept for the frontend to announce ([`Session::take_unreported_builds`]), so that starting the next one right +/// after it (as a build waiting in line does) does not lose its result, its failed count or its error. +fn set_current(s: &mut Session, state: Arc) { + if let Some(old) = s.preview_build.replace(state) + && old.finished.load(Ordering::Relaxed) + && !old.reported.load(Ordering::Relaxed) + { + s.keep_unreported_build(old); + } +} + /// What a build of `ids` was asked, as it runs later (from the line): the photos written out (the selection or the /// view may have changed by then), in the background (nothing waits for it then), and not queued again. fn request_for(command: &str, p: &Value, ids: &[lightcraft_catalog::PhotoId]) -> Request { @@ -358,7 +373,7 @@ fn build(s: &mut Session, p: &Value) -> Result { let state = Arc::new(PreviewBuild { total: jobs.len(), gate, ..Default::default() }); #[cfg(not(test))] let state = Arc::new(PreviewBuild { total: jobs.len(), ..Default::default() }); - s.preview_build = Some(state.clone()); + set_current(s, state.clone()); let run = Running { task: task_for(s, &state), state: state.clone() }; let lanes = lanes(jobs.len(), edge.is_none()); let wait = p.get("wait").and_then(Value::as_bool).unwrap_or(false) || cfg!(target_arch = "wasm32"); @@ -558,7 +573,7 @@ fn smart(s: &mut Session, p: &Value) -> Result { let custom = s.smart_previews_dir.is_some(); if background { let state = Arc::new(PreviewBuild { total: jobs.len(), what, ..Default::default() }); - s.preview_build = Some(state.clone()); + set_current(s, state.clone()); let run = Running { task: task_for(s, &state), state: state.clone() }; std::thread::Builder::new() .name("lc-smart-previews".into()) diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 97a366216cc..6b123df2647 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -391,6 +391,9 @@ pub struct Session { pub slideshow_export: Option>, /// The last (or running) Build Previews. pub preview_build: Option>, + /// Builds that ended and were replaced by the next one before a frontend announced them + /// ([`Session::take_unreported_builds`]). + unreported_builds: Vec>, /// Develop defaults applied on import (persisted in prefs.json). pub import_defaults: import::ImportDefaults, /// Disk budget of the library's thumbnail cache in MB (0 = default; persisted in prefs.json). @@ -528,6 +531,7 @@ impl Session { folder_changes: None, activity: Default::default(), preview_build: None, + unreported_builds: Vec::new(), slideshow_export: None, import_defaults: import::ImportDefaults::default(), cache_mb: 0, @@ -582,6 +586,22 @@ impl Session { }) } + /// A build that ended is replaced by the next one before a frontend announced it: keep it (at most 16; the oldest + /// goes first) for [`Session::take_unreported_builds`]. + pub(crate) fn keep_unreported_build(&mut self, build: std::sync::Arc) { + const KEEP: usize = 16; + if self.unreported_builds.len() >= KEEP { + self.unreported_builds.remove(0); + } + self.unreported_builds.push(build); + } + + /// The builds that ended and were replaced before a frontend announced them, oldest first, once. The frontend + /// announces each (and sets its `reported`) like the current build's end. + pub fn take_unreported_builds(&mut self) -> Vec> { + std::mem::take(&mut self.unreported_builds) + } + /// Start the tasks waiting in line whose lane is free ([`crate::activity`]), each by running the command it was /// asked with. One that can't start is logged and the next in line goes on. Every frontend gets this after each /// command; the app also calls it every frame, for a lane that frees while nothing is asked. diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index fa10210f0a3..04a15302cdc 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -361,32 +361,41 @@ impl LightcraftApp { panels::slideshow::tick(self, ctx, now); } - /// Announce the end of a Build Previews run. + /// Announce the end of a Build Previews run, and of those a build waiting in line replaced before it was announced + /// (in one toast, oldest first). A build is announced once: its `reported` flag says so, not where it lives. fn preview_build_status(&mut self, ctx: &egui::Context) { use std::sync::atomic::Ordering; - let Some(b) = self.session.preview_build.clone() else { return }; - let key = std::sync::Arc::as_ptr(&b) as usize; - if b.finished.load(Ordering::Relaxed) { - if self.ui.preview_build_seen != Some((key, true)) { - self.ui.preview_build_seen = Some((key, true)); - let (done, failed) = (b.done.load(Ordering::Relaxed), b.failed.load(Ordering::Relaxed)); - let plural = if done == 1 { "" } else { "s" }; - let mut msg = match (b.error(), b.what) { - (Some(e), what) => format!("{}: {e}", if what.is_empty() { "previews" } else { what }), - (None, "") => crate::i18n::tr_format!("Previews ready for {done} photo{plural}", done = done, plural = plural), - (None, what) => { - crate::i18n::tr_format!("Done ({what}): {done} photo{plural}", done = done, plural = plural, what = crate::i18n::tr(what)) - } - }; - if failed > 0 { - msg.push_str(&crate::i18n::tr_format!(" · {failed} couldn't be rendered", failed = failed)); - } - self.toast(ctx, msg); + let mut ended = self.session.take_unreported_builds(); + match self.session.preview_build.clone() { + Some(b) if b.finished.load(Ordering::Relaxed) => ended.push(b), + Some(_) => { + // The activity stack shows the run while it works; poll for the end. + ctx.request_repaint_after(std::time::Duration::from_millis(250)); } - } else { - // The activity stack shows the run while it works; poll for the end. - ctx.request_repaint_after(std::time::Duration::from_millis(250)); + None => {} + } + let msgs: Vec = ended.iter().filter(|b| !b.reported.swap(true, Ordering::Relaxed)).map(|b| Self::build_message(b)).collect(); + if !msgs.is_empty() { + self.toast(ctx, msgs.join("; ")); + } + } + + /// How a finished Build Previews run ended, as the toast words it. + fn build_message(b: &lightcraft_engine::cmd::previews::PreviewBuild) -> String { + use std::sync::atomic::Ordering; + let (done, failed) = (b.done.load(Ordering::Relaxed), b.failed.load(Ordering::Relaxed)); + let plural = if done == 1 { "" } else { "s" }; + let mut msg = match (b.error(), b.what) { + (Some(e), what) => format!("{}: {e}", if what.is_empty() { "previews" } else { what }), + (None, "") => crate::i18n::tr_format!("Previews ready for {done} photo{plural}", done = done, plural = plural), + (None, what) => { + crate::i18n::tr_format!("Done ({what}): {done} photo{plural}", done = done, plural = plural, what = crate::i18n::tr(what)) + } + }; + if failed > 0 { + msg.push_str(&crate::i18n::tr_format!(" · {failed} couldn't be rendered", failed = failed)); } + msg } /// Announce when saving the library starts failing (changes then live only in memory and are diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 38b50902c50..6f458169bd7 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -33,9 +33,6 @@ pub struct UiState { pub docking_version: u32, #[serde(default = "crate::i18n::default_language")] pub language: crate::i18n::Locale, - /// The Build Previews run last announced (its identity, finished?). - #[serde(skip)] - pub preview_build_seen: Option<(usize, bool)>, /// Saving the library is failing (announced with a toast; the top bar shows a warning until /// a later save succeeds). #[serde(skip)] @@ -361,7 +358,6 @@ impl Default for UiState { docking: None, docking_version: crate::docking::DOCKING_VERSION, language: crate::i18n::default_language(), - preview_build_seen: None, unsaved_seen: false, frame_rate: std::env::var("LIGHTCRAFT_FPS").is_ok_and(|v| matches!(v.trim(), "1" | "on" | "true" | "yes")), luminance_map_restore: None, diff --git a/crates/ui-egui/src/tests/activity.rs b/crates/ui-egui/src/tests/activity.rs index 40fd79c1152..1868b8162ce 100644 --- a/crates/ui-egui/src/tests/activity.rs +++ b/crates/ui-egui/src/tests/activity.rs @@ -569,3 +569,29 @@ fn a_task_waiting_in_line_has_no_row_and_starts_when_the_lane_frees() { } assert!(h.app.session.preview_build.as_ref().is_some_and(|b| !std::sync::Arc::ptr_eq(b, &build)), "the waiting build started"); } + +/// Given a build that ended and a build waiting behind it, when a command starts the waiting one before the frame that +/// announces the first, then the first one's end is still announced, and once. +#[test] +fn a_build_replaced_by_the_one_waiting_behind_it_is_still_announced() { + use lightcraft_engine::cmd::previews::PreviewBuild; + use std::sync::atomic::Ordering; + + let mut h = demo(); + let first = std::sync::Arc::new(PreviewBuild::default()); + first.done.store(2, Ordering::Relaxed); + h.app.session.preview_build = Some(first.clone()); + let row = h.app.session.activity.start("previews", "Building previews", Cancel::Yes); + let ids: Vec = h.app.session.catalog.photos().take(1).map(|p| p.id.0).collect(); + h.app.session.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + first.finished.store(true, Ordering::Release); + drop(row); + // a command in the same frame, before the app looks at the finished build + h.app.session.execute("activity.list", &json!({})).unwrap(); + assert!(h.app.session.preview_build.as_ref().is_some_and(|b| !std::sync::Arc::ptr_eq(b, &first)), "the waiting build replaced it"); + h.step(); + assert!(first.reported.load(Ordering::Relaxed), "its end was announced"); + let toast = h.app.ui.toast.as_ref().map(|t| t.0.clone()).unwrap_or_default(); + assert!(toast.contains("Previews ready for 2 photos"), "{toast}"); + assert!(h.app.session.take_unreported_builds().is_empty()); +} From 6dd303f2379a24022dfe0fc16b44c5aa7e8eff4a Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sun, 25 Oct 2026 20:28:19 -0400 Subject: [PATCH 03/11] LR-BEHAV-BG-TASKS: the frame that starts a waiting build looks at it before it ends The tick looked at the run in progress (to poll for its end) before it started the build waiting in line, so a build started by the tick was not polled until something else repainted: with the list closed, or in Full Screen Preview, the end of the build could go unannounced for a while. The tick now starts the waiting build first. --- crates/ui-egui/src/app.rs | 7 +++++++ crates/ui-egui/src/app/frame.rs | 4 +--- crates/ui-egui/src/tests/activity.rs | 28 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 04a15302cdc..9b8b3fcb07f 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -361,6 +361,13 @@ impl LightcraftApp { panels::slideshow::tick(self, ctx, now); } + /// A task waiting in line whose lane freed while nothing was asked starts now (commands start them too); then the + /// run in progress is looked at, so that one started here is polled for its end from this frame on. + fn tick_preview_builds(&mut self, ctx: &egui::Context) { + self.session.start_waiting(); + self.preview_build_status(ctx); + } + /// Announce the end of a Build Previews run, and of those a build waiting in line replaced before it was announced /// (in one toast, oldest first). A build is announced once: its `reported` flag says so, not where it lives. fn preview_build_status(&mut self, ctx: &egui::Context) { diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 4eafa60c773..0621cb01071 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -70,9 +70,7 @@ impl LightcraftApp { recheck::tick(self); tasks::poll(self, ctx); updates_ui::tick(self, ctx); - self.preview_build_status(ctx); - // a task waiting in line whose lane freed while nothing was asked starts now (commands start them too) - self.session.start_waiting(); + self.tick_preview_builds(ctx); self.save_status(ctx); self.ai_mask_detail(ctx, now); self.place_names_outcome(ctx); diff --git a/crates/ui-egui/src/tests/activity.rs b/crates/ui-egui/src/tests/activity.rs index 1868b8162ce..1ea56f3e500 100644 --- a/crates/ui-egui/src/tests/activity.rs +++ b/crates/ui-egui/src/tests/activity.rs @@ -595,3 +595,31 @@ fn a_build_replaced_by_the_one_waiting_behind_it_is_still_announced() { assert!(toast.contains("Previews ready for 2 photos"), "{toast}"); assert!(h.app.session.take_unreported_builds().is_empty()); } + +/// Given a build that ended and a build waiting behind it, when the frame starts the waiting one, then the same frame +/// asks to be drawn again to see how it goes: nothing else repaints an idle window (the list is closed, or Full Screen +/// Preview hides it). +#[test] +fn the_frame_that_starts_a_waiting_build_asks_for_the_next_one() { + use lightcraft_engine::cmd::previews::PreviewBuild; + use std::sync::atomic::Ordering; + + let mut h = demo(); + let first = std::sync::Arc::new(PreviewBuild::default()); + h.app.session.preview_build = Some(first.clone()); + let row = h.app.session.activity.start("previews", "Building previews", Cancel::Yes); + let ids: Vec = h.app.session.catalog.photos().take(1).map(|p| p.id.0).collect(); + h.app.session.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + first.finished.store(true, Ordering::Release); + drop(row); + let ctx = egui::Context::default(); + // (a few empty passes let the context's own first-frame requests go by) + for _ in 0..4 { + let mut out = ctx.run_ui(egui::RawInput::default(), |_| {}); + out.textures_delta.clear(); + } + assert!(!ctx.has_requested_repaint(), "an idle context asks for nothing"); + h.app.tick_preview_builds(&ctx); + assert!(h.app.session.preview_build.as_ref().is_some_and(|b| !std::sync::Arc::ptr_eq(b, &first)), "the waiting build started"); + assert!(ctx.has_requested_repaint(), "and the frame asked to look at it again"); +} From ccd0a3b6ac7b913d9f7e78aaf61c2f6c2cb23fda Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sun, 25 Oct 2026 23:41:06 -0400 Subject: [PATCH 04/11] LR-BEHAV-BG-TASKS: a build asked for without queue does not go ahead of builds waiting in line Between the end of a build and the next command or frame the line holds builds that no one has started yet, and a build asked for without queue then started ahead of them (they waited behind it). It is refused as while a build runs. Build Previews and background Smart Previews. --- crates/engine/src/cmd/previews.rs | 11 ++++- crates/engine/src/tests/task_queue.rs | 69 +++++++++++++++++++++++++++ crates/ui-egui/src/app.rs | 2 +- 3 files changed, 79 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/previews.rs b/crates/engine/src/cmd/previews.rs index 010c0b10a4a..44c01678373 100644 --- a/crates/engine/src/cmd/previews.rs +++ b/crates/engine/src/cmd/previews.rs @@ -137,6 +137,11 @@ fn request_for(command: &str, p: &Value, ids: &[lightcraft_catalog::PhotoId]) -> /// The refusal of a build while another runs, unless the call asks to `queue`. const REFUSED: &str = "a preview build is already running"; +/// Builds wait in line ahead of one asked for now (not counting the line a build is being started from). +fn line_ahead(s: &Session) -> bool { + !s.starting_waiting && s.activity.lane_waiting(Lane::Previews) +} + fn queue_param(p: &Value) -> bool { p.get("queue").and_then(Value::as_bool).unwrap_or(false) } @@ -360,7 +365,9 @@ fn build(s: &mut Session, p: &Value) -> Result { other => return Err(bad(C, format!("unknown size `{other}` (standard|full)"))), }; let queue = queue_param(p); - if !queue && build_running(s) { + // (nor ahead of builds already waiting: the line starts them after this command, in the order asked; the build + // `start_waiting` is starting itself is not held back by the line it came out of) + if !queue && (build_running(s) || line_ahead(s)) { return Err(bad(C, REFUSED)); } // explicit ids, else the selection, else everything in view @@ -552,7 +559,7 @@ fn smart(s: &mut Session, p: &Value) -> Result { let discard = p.get("discard").and_then(Value::as_bool).unwrap_or(false); let background = p.get("background").and_then(Value::as_bool).unwrap_or(false); let queue = background && queue_param(p); - if background && !queue && build_running(s) { + if background && !queue && (build_running(s) || line_ahead(s)) { return Err(bad(C, REFUSED)); } let ids = if p.get("ids").is_some() || !s.selection.ids.is_empty() { s.targets(p)? } else { s.visible_cloned() }; diff --git a/crates/engine/src/tests/task_queue.rs b/crates/engine/src/tests/task_queue.rs index 1eade863445..939c2d30428 100644 --- a/crates/engine/src/tests/task_queue.rs +++ b/crates/engine/src/tests/task_queue.rs @@ -247,3 +247,72 @@ fn another_library_drops_what_waits() { s.close_library().unwrap(); let _ = std::fs::remove_dir_all(&dir); } + +/// Given a build that ended and a build waiting behind it, when the next command starts the waiting one before the +/// app announced the first, then the first is kept (once, with its counts) for the frontend to announce, and the +/// new build is the current one. +#[test] +fn a_build_replaced_by_the_one_waiting_behind_it_is_kept_until_it_is_announced() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let h = hold(&mut s); + let first = h.build.clone(); + first.done.store(2, Ordering::Relaxed); + first.failed.store(1, Ordering::Relaxed); + s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + release(h); + tasks(&mut s); // the command that ends up starting the waiting build + assert!(s.preview_build.as_ref().is_some_and(|b| !Arc::ptr_eq(b, &first)), "the waiting build is the current one"); + let kept = s.take_unreported_builds(); + assert_eq!(kept.len(), 1); + assert!(Arc::ptr_eq(&kept[0], &first)); + assert_eq!((kept[0].done.load(Ordering::Relaxed), kept[0].failed.load(Ordering::Relaxed)), (2, 1)); + assert!(s.take_unreported_builds().is_empty(), "once"); + settle(&mut s); +} + +/// A build the frontend announced already is not kept when the next one replaces it. +#[test] +fn a_build_that_was_announced_is_not_kept_when_the_next_one_replaces_it() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let h = hold(&mut s); + h.build.reported.store(true, Ordering::Relaxed); + s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap(); + release(h); + tasks(&mut s); + assert!(s.take_unreported_builds().is_empty()); + settle(&mut s); +} + +/// Given a build that ended and a build waiting in line behind it that has not been started yet, when Build Previews is +/// asked for without `queue`, then it is refused, as it is while a build runs: it does not start ahead of the one +/// waiting, which the line starts after this command. +#[test] +fn a_build_asked_for_without_queue_does_not_go_ahead_of_one_waiting_in_line() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let running = hold(&mut s); + s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap()["queued"].as_u64().expect("it waits"); + // the build ends, and nothing has started the one waiting yet (no command or frame since) + release(running); + let refused = s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256})).unwrap_err().to_string(); + assert!(refused.contains("preview build"), "{refused}"); + settle(&mut s); +} + +/// Given a build running and two builds waiting behind it, when the build ends, then both start in turn, each one when +/// the lane is free (the line is not "ahead" of the build it is starting). +#[test] +fn builds_waiting_in_line_all_start_in_turn() { + let mut s = Session::with_demo(); + let ids = build_ids(&s, 1); + let running = hold(&mut s); + for _ in 0..2 { + s.execute("library.buildPreviews", &json!({"ids": ids, "edge": 256, "queue": true})).unwrap()["queued"].as_u64().expect("it waits"); + } + release(running); + settle(&mut s); + // the held build, and the first of the two, were replaced by the next: three builds ran in all + assert_eq!(s.take_unreported_builds().len(), 2, "both waiting builds started"); +} diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 9b8b3fcb07f..108583b7ae2 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -363,7 +363,7 @@ impl LightcraftApp { /// A task waiting in line whose lane freed while nothing was asked starts now (commands start them too); then the /// run in progress is looked at, so that one started here is polled for its end from this frame on. - fn tick_preview_builds(&mut self, ctx: &egui::Context) { + pub(crate) fn tick_preview_builds(&mut self, ctx: &egui::Context) { self.session.start_waiting(); self.preview_build_status(ctx); } From 67a5f01565c890c6acef7190af7337cd2ab35ffb Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Tue, 27 Oct 2026 14:29:16 -0400 Subject: [PATCH 05/11] LR-BEHAV-BG-TASKS: tests: a started preview build ends before its test returns Co-Authored-By: Claude --- crates/ui-egui/src/tests/activity.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/ui-egui/src/tests/activity.rs b/crates/ui-egui/src/tests/activity.rs index 1ea56f3e500..decbc472915 100644 --- a/crates/ui-egui/src/tests/activity.rs +++ b/crates/ui-egui/src/tests/activity.rs @@ -568,6 +568,7 @@ fn a_task_waiting_in_line_has_no_row_and_starts_when_the_lane_frees() { } } assert!(h.app.session.preview_build.as_ref().is_some_and(|b| !std::sync::Arc::ptr_eq(b, &build)), "the waiting build started"); + assert!(h.step_until(T, |h| h.app.session.activity.list().is_empty()), "the started build ends"); } /// Given a build that ended and a build waiting behind it, when a command starts the waiting one before the frame that @@ -594,6 +595,7 @@ fn a_build_replaced_by_the_one_waiting_behind_it_is_still_announced() { let toast = h.app.ui.toast.as_ref().map(|t| t.0.clone()).unwrap_or_default(); assert!(toast.contains("Previews ready for 2 photos"), "{toast}"); assert!(h.app.session.take_unreported_builds().is_empty()); + assert!(h.step_until(T, |h| h.app.session.activity.list().is_empty()), "the started build ends"); } /// Given a build that ended and a build waiting behind it, when the frame starts the waiting one, then the same frame @@ -622,4 +624,5 @@ fn the_frame_that_starts_a_waiting_build_asks_for_the_next_one() { h.app.tick_preview_builds(&ctx); assert!(h.app.session.preview_build.as_ref().is_some_and(|b| !std::sync::Arc::ptr_eq(b, &first)), "the waiting build started"); assert!(ctx.has_requested_repaint(), "and the frame asked to look at it again"); + assert!(h.step_until(T, |h| h.app.session.activity.list().is_empty()), "the started build ends"); } From ff7a5fef33e71df037a3220d4e2909934a56b88b Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Thu, 15 Oct 2026 16:46:34 -0400 Subject: [PATCH 06/11] LR-BEHAV-BG-TASKS: imports and Synchronize Folder wait for each other instead of refusing Imports and Synchronize Folder share the library lane (`Lane::Library`, kinds `import` and `sync`): each readies its files against the library as it is when it starts, so one asked for while the other runs now waits in line behind it and starts by itself, and a toast says it was queued. Their requests are the app's (`app:import`, `app:synchronize`); `Activity::take_ready_if` lets the engine pump leave them to `LightcraftApp::start_waiting`. A drop of photos while an import runs is no longer refused for that reason (it waits too); one while a scan runs or a review waits behind a dialog still is. A waiting import plans at its turn (duplicates checked then; a new album is made only once it adds a photo). A waiting Synchronize Folder scans its folder again (`SyncRescan`) and removes or relinks only the missing and moved photos its dialog showed; others are left alone and counted in its end message. It stops untouched, and says so, if another library opens while it scans or if its folder is gone. The dialog's own scan is kind `scan`, so it holds up nothing; Auto Import waits for the whole lane. Co-Authored-By: Claude --- crates/engine/src/activity.rs | 26 ++- crates/engine/src/cmd/activity.rs | 2 +- crates/engine/src/lib.rs | 4 +- crates/ui-egui/locales/cs-formats.json | 4 +- crates/ui-egui/locales/cs.json | 5 +- crates/ui-egui/locales/de-formats.json | 4 +- crates/ui-egui/locales/de.json | 5 +- crates/ui-egui/locales/es-formats.json | 4 +- crates/ui-egui/locales/es.json | 5 +- crates/ui-egui/locales/fi-formats.json | 4 +- crates/ui-egui/locales/fi.json | 5 +- crates/ui-egui/locales/fr-formats.json | 4 +- crates/ui-egui/locales/fr.json | 5 +- crates/ui-egui/locales/id-formats.json | 4 +- crates/ui-egui/locales/id.json | 5 +- crates/ui-egui/locales/it-formats.json | 4 +- crates/ui-egui/locales/it.json | 5 +- crates/ui-egui/locales/ja-formats.json | 4 +- crates/ui-egui/locales/ja.json | 5 +- crates/ui-egui/locales/ka-formats.json | 4 +- crates/ui-egui/locales/ka.json | 5 +- crates/ui-egui/locales/pl-formats.json | 4 +- crates/ui-egui/locales/pl.json | 5 +- crates/ui-egui/locales/pt-br-formats.json | 4 +- crates/ui-egui/locales/pt-br.json | 5 +- crates/ui-egui/locales/ru-formats.json | 4 +- crates/ui-egui/locales/ru.json | 5 +- crates/ui-egui/locales/sv-formats.json | 4 +- crates/ui-egui/locales/sv.json | 5 +- crates/ui-egui/locales/uk-formats.json | 4 +- crates/ui-egui/locales/uk.json | 5 +- crates/ui-egui/locales/vi-formats.json | 4 +- crates/ui-egui/locales/vi.json | 5 +- crates/ui-egui/locales/zh-hans-formats.json | 4 +- crates/ui-egui/locales/zh-hans.json | 5 +- crates/ui-egui/locales/zh-hant-formats.json | 4 +- crates/ui-egui/locales/zh-hant.json | 5 +- crates/ui-egui/src/app.rs | 46 +++- crates/ui-egui/src/app/frame.rs | 11 +- crates/ui-egui/src/app/input.rs | 2 +- crates/ui-egui/src/dialogs/import.rs | 6 +- crates/ui-egui/src/dialogs/import/scan.rs | 46 +++- crates/ui-egui/src/dialogs/import/task.rs | 104 ++++++--- .../src/dialogs/lightroom_destination.rs | 2 +- crates/ui-egui/src/drop_overlay.rs | 2 +- crates/ui-egui/src/headless.rs | 1 + crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/lightroom_import.rs | 2 +- crates/ui-egui/src/sync.rs | 199 ++++++++++++++++-- crates/ui-egui/src/tests/drop_import.rs | 35 ++- crates/ui-egui/src/tests/sync.rs | 148 +++++++++++-- docs/background-tasks.md | 21 +- docs/control-protocol.md | 4 +- docs/parity-checklist.md | 5 +- docs/whats-new.md | 12 ++ 55 files changed, 672 insertions(+), 161 deletions(-) diff --git a/crates/engine/src/activity.rs b/crates/engine/src/activity.rs index c7b4944ca46..45d0e59e04e 100644 --- a/crates/engine/src/activity.rs +++ b/crates/engine/src/activity.rs @@ -31,6 +31,9 @@ pub const MAX_WAITING: usize = 100; pub enum Lane { /// Build Previews and Build / Discard Smart Previews: one preview build at a time (`Session::preview_build`). Previews, + /// Imports and Synchronize Folder: each plans its work against the library as it is when it starts, so two side by + /// side could add the same file twice. Run by the app (the requests' commands are the app's, `app:…`). + Library, } impl Lane { @@ -38,6 +41,7 @@ impl Lane { pub fn of(kind: &str) -> Option { match kind { "previews" | "smartPreviews" => Some(Lane::Previews), + "import" | "sync" => Some(Lane::Library), _ => None, } } @@ -142,7 +146,7 @@ impl Unit { #[serde(rename_all = "camelCase")] pub struct TaskInfo { pub id: u64, - /// A stable id: `import`, `export`, `scan`, `previews`, `smartPreviews`, `lightroom`, `merge`, `download`, + /// A stable id: `import`, `export`, `scan`, `sync`, `previews`, `smartPreviews`, `lightroom`, `merge`, `download`, /// `faces`, `denoise`, `findMissing`, `applePhotos`, `cache`, `focus`. pub kind: &'static str, /// English; the frontend translates it. @@ -705,4 +709,24 @@ mod tests { drop(running); assert!(a.take_ready().is_none()); } + + /// The engine starts only the requests it can run; one it can't (an app import) holds its lane for the app, and a + /// later one in that lane never jumps it. Other lanes go on. + #[test] + fn each_frontend_starts_only_what_it_can_run_and_no_task_jumps_its_line() { + let a = Activity::default(); + let app = |p: u64| Request { command: "app:import".into(), params: serde_json::json!({ "n": p }) }; + let engine = |p: u64| Request { command: "library.import".into(), params: serde_json::json!({ "n": p }) }; + let (first, _) = a.enqueue("import", "Importing", app(1)).unwrap(); + let (second, _) = a.enqueue("import", "Importing", engine(2)).unwrap(); + let (previews, _) = a.enqueue("previews", "Building previews", request("library.buildPreviews")).unwrap(); + let engine_runs = |r: &Request| !r.command.starts_with("app:"); + assert_eq!(a.take_ready_if(engine_runs).map(|w| w.id), Some(previews), "the preview lane isn't held up"); + a.started(); + assert!(a.take_ready_if(engine_runs).is_none(), "the second import waits behind the first, which the app runs"); + assert_eq!(a.take_ready_if(|r| r.command.starts_with("app:")).map(|w| w.id), Some(first)); + a.started(); + assert_eq!(a.take_ready_if(engine_runs).map(|w| w.id), Some(second)); + assert_eq!(Lane::of("sync"), Some(Lane::Library)); + } } diff --git a/crates/engine/src/cmd/activity.rs b/crates/engine/src/cmd/activity.rs index 3fa99b488a7..a960c998fbd 100644 --- a/crates/engine/src/cmd/activity.rs +++ b/crates/engine/src/cmd/activity.rs @@ -11,7 +11,7 @@ pub fn specs() -> Vec { "Background Tasks", [], None, - "{} → {tasks: [{id, kind, label, done, total, unit: count|bytes|percent, detail, cancellable, cancelling, ageMs, waiting, place, lane}]} — the long-running tasks in flight (imports, exports, preview builds, downloads, the face scan…), oldest first, then those waiting in line for a task of their lane (waiting: true, place: 1 = next in its lane, lane: previews; done and total 0); total 0 = not known yet", + "{} → {tasks: [{id, kind, label, done, total, unit: count|bytes|percent, detail, cancellable, cancelling, ageMs, waiting, place, lane}]} — the long-running tasks in flight (imports, exports, preview builds, downloads, the face scan…), oldest first, then those waiting in line for their lane (waiting: true, place 1 = next in its lane, lane: previews or library (imports and Synchronize Folder, which the app starts); they start by themselves when the tasks ahead end, keeping their id), in the order they were asked for; total 0 = not known yet", always, |s, _| Ok(json!({"tasks": s.activity.list()})) ), diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 6b123df2647..b663508818d 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -605,6 +605,8 @@ impl Session { /// Start the tasks waiting in line whose lane is free ([`crate::activity`]), each by running the command it was /// asked with. One that can't start is logged and the next in line goes on. Every frontend gets this after each /// command; the app also calls it every frame, for a lane that frees while nothing is asked. + /// Requests that aren't engine commands (the app's own, `app:…`: an import, a Synchronize Folder) are left to the + /// app, which starts them the same way. pub fn start_waiting(&mut self) { if self.depth > 0 || self.starting_waiting { return; @@ -612,7 +614,7 @@ impl Session { self.starting_waiting = true; // (bounded: each turn takes one task out of a line that is at most this long) for _ in 0..activity::MAX_WAITING { - let Some(w) = self.activity.take_ready() else { break }; + let Some(w) = self.activity.take_ready_if(|r| find_command(&r.command).is_some()) else { break }; let r = self.dispatch(&w.request.command, &w.request.params, false); self.activity.started(); if let Err(e) = r { diff --git a/crates/ui-egui/locales/cs-formats.json b/crates/ui-egui/locales/cs-formats.json index 1eb882f09d4..48806ebd143 100644 --- a/crates/ui-egui/locales/cs-formats.json +++ b/crates/ui-egui/locales/cs-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "Soubor {name} se nepodařilo přečíst: {e}", "Added {n} photo{}": "Přidáno fotografií: {n}{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Kam má jít katalog Lightroomu „{catalog}“?", - "Merge into the open library “{library}” ({count} photo{})": "Sloučit s otevřenou knihovnou „{library}“ (fotografie: {count}{:.0})" + "Merge into the open library “{library}” ({count} photo{})": "Sloučit s otevřenou knihovnou „{library}“ (fotografie: {count}{:.0})", + "Queued: it starts after {n} more": "Ve frontě: začne po {n} dalších", + "{n} more missing, left alone: synchronize again to review them": "{n} dalších chybí, ponecháno beze změny: pro kontrolu synchronizujte znovu" } diff --git a/crates/ui-egui/locales/cs.json b/crates/ui-egui/locales/cs.json index 52ca94a524d..af68f83b201 100644 --- a/crates/ui-egui/locales/cs.json +++ b/crates/ui-egui/locales/cs.json @@ -16,7 +16,6 @@ "= exactly": "= přesně", "A blank template keeps the original names.": "Prázdná šablona zachová původní názvy.", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Fotografie v tomto zobrazení skrývá filtr: změňte jej nebo jej zrušte (Zobrazení → Zrušit filtry)", - "A folder is already being synchronized": "Již probíhá synchronizace složky", "A folder is being synchronized": "Probíhá synchronizace složky", "A keyword set needs a name": "Sada klíčových slov musí mít název", "A one-time download of about": "Jednorázové stažení přibližně", @@ -2408,5 +2407,7 @@ "Import dropped files without review": "Importovat přetažené soubory bez kontroly", "An import is running": "Import už běží", "An import is running. Drop photos when it has finished": "Import už běží. Fotky přetáhněte, až skončí", - "Finish Lightroom catalog import before adding photos": "Dokončete import katalogu Lightroom, než přidáte fotky" + "Finish Lightroom catalog import before adding photos": "Dokončete import katalogu Lightroom, než přidáte fotky", + "Queued: it starts when the task ahead of it ends": "Ve frontě: začne, až skončí úloha před ní", + "Another library was opened: nothing was done": "Byla otevřena jiná knihovna: nic se neprovedlo" } diff --git a/crates/ui-egui/locales/de-formats.json b/crates/ui-egui/locales/de-formats.json index 79390f13647..b47170de57e 100644 --- a/crates/ui-egui/locales/de-formats.json +++ b/crates/ui-egui/locales/de-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "{name} konnte nicht gelesen werden: {e}", "Added {n} photo{}": "{n} Foto{} hinzugefügt", "Where should the Lightroom catalog “{catalog}” go?": "Wohin soll der Lightroom-Katalog „{catalog}“?", - "Merge into the open library “{library}” ({count} photo{})": "Mit der geöffneten Bibliothek „{library}“ zusammenführen ({count} Foto{})" + "Merge into the open library “{library}” ({count} photo{})": "Mit der geöffneten Bibliothek „{library}“ zusammenführen ({count} Foto{})", + "Queued: it starts after {n} more": "In der Warteschlange: startet nach {n} weiteren", + "{n} more missing, left alone: synchronize again to review them": "{n} weitere fehlen und blieben unangetastet: zum Prüfen erneut synchronisieren" } diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.json index e2205db782f..ed644215e58 100644 --- a/crates/ui-egui/locales/de.json +++ b/crates/ui-egui/locales/de.json @@ -2070,7 +2070,6 @@ "Skipped: files that can't be read": "Übersprungen: Dateien, die nicht gelesen werden können", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "Dieser Ordner ist nicht vorhanden: Er wurde verschoben oder umbenannt, oder sein Datenträger ist nicht verbunden.", "Relink photos whose file was renamed or moved": "Fotos neu verknüpfen, deren Datei umbenannt oder verschoben wurde", - "A folder is already being synchronized": "Es wird bereits ein Ordner synchronisiert", "Synchronizing…": "Wird synchronisiert…", "Relinked": "Neu verknüpft", "Removed": "Entfernt", @@ -3440,5 +3439,7 @@ "Import dropped files without review": "Abgelegte Dateien ohne Prüfung importieren", "An import is running": "Ein Import läuft", "An import is running. Drop photos when it has finished": "Ein Import läuft. Lege die Fotos ab, wenn er fertig ist", - "Finish Lightroom catalog import before adding photos": "Schließe den Import des Lightroom-Katalogs ab, bevor du Fotos hinzufügst" + "Finish Lightroom catalog import before adding photos": "Schließe den Import des Lightroom-Katalogs ab, bevor du Fotos hinzufügst", + "Queued: it starts when the task ahead of it ends": "In der Warteschlange: startet, wenn die Aufgabe davor endet", + "Another library was opened: nothing was done": "Eine andere Bibliothek wurde geöffnet: es wurde nichts getan" } diff --git a/crates/ui-egui/locales/es-formats.json b/crates/ui-egui/locales/es-formats.json index 33e5f52fc6e..cabf7433efa 100644 --- a/crates/ui-egui/locales/es-formats.json +++ b/crates/ui-egui/locales/es-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "No se pudo leer {name}: {e}", "Added {n} photo{}": "{n} foto{0} añadida{0}", "Where should the Lightroom catalog “{catalog}” go?": "¿Dónde debe ir el catálogo de Lightroom “{catalog}”?", - "Merge into the open library “{library}” ({count} photo{})": "Combinar con la biblioteca abierta “{library}” ({count} foto{})" + "Merge into the open library “{library}” ({count} photo{})": "Combinar con la biblioteca abierta “{library}” ({count} foto{})", + "Queued: it starts after {n} more": "En cola: empieza tras {n} más", + "{n} more missing, left alone: synchronize again to review them": "Faltan {n} más, sin tocar: sincroniza de nuevo para revisarlas" } diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.json index 888af077ff2..03589c0dcc4 100644 --- a/crates/ui-egui/locales/es.json +++ b/crates/ui-egui/locales/es.json @@ -2098,7 +2098,6 @@ "Skipped: files that can't be read": "Omitidos: archivos que no se pueden leer", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "Esta carpeta no está: se movió o se le cambió el nombre, o su disco no está conectado.", "Relink photos whose file was renamed or moved": "Volver a vincular fotos cuyo archivo se renombró o movió", - "A folder is already being synchronized": "Ya se está sincronizando una carpeta", "Synchronizing…": "Sincronizando…", "Relinked": "Revinculadas", "Removed": "Quitadas", @@ -2358,5 +2357,7 @@ "Import dropped files without review": "Importar los archivos soltados sin revisión", "An import is running": "Hay una importación en curso", "An import is running. Drop photos when it has finished": "Hay una importación en curso. Suelta las fotos cuando termine", - "Finish Lightroom catalog import before adding photos": "Termina la importación del catálogo de Lightroom antes de añadir fotos" + "Finish Lightroom catalog import before adding photos": "Termina la importación del catálogo de Lightroom antes de añadir fotos", + "Queued: it starts when the task ahead of it ends": "En cola: empieza cuando termine la tarea anterior", + "Another library was opened: nothing was done": "Se abrió otra biblioteca: no se hizo nada" } diff --git a/crates/ui-egui/locales/fi-formats.json b/crates/ui-egui/locales/fi-formats.json index 1daab3dab9f..72f65964852 100644 --- a/crates/ui-egui/locales/fi-formats.json +++ b/crates/ui-egui/locales/fi-formats.json @@ -305,5 +305,7 @@ "Drop to import {n} preset{}": "Pudota tuodaksesi esiasetuksia: {n}{:.0}", "Drop to review {n} item{} for import": "Pudota tarkistaaksesi ennen tuontia (kohteita: {n}){:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Minne Lightroom-luettelo ”{catalog}” tuodaan?", - "Merge into the open library “{library}” ({count} photo{})": "Yhdistä avoimeen kirjastoon ”{library}” (kuvia: {count}{:.0})" + "Merge into the open library “{library}” ({count} photo{})": "Yhdistä avoimeen kirjastoon ”{library}” (kuvia: {count}{:.0})", + "Queued: it starts after {n} more": "Jonossa: alkaa {n} muun jälkeen", + "{n} more missing, left alone: synchronize again to review them": "{n} muuta puuttuu ja jätettiin ennalleen: synkronoi uudelleen tarkistaaksesi ne" } diff --git a/crates/ui-egui/locales/fi.json b/crates/ui-egui/locales/fi.json index e0a8c622a36..f63b4b43cfb 100644 --- a/crates/ui-egui/locales/fi.json +++ b/crates/ui-egui/locales/fi.json @@ -21,7 +21,6 @@ "A dark slate backdrop with the exposure, ISO and focal length, then the camera and lens, under each photo.": "Tumma liuskekivitausta, jossa kunkin kuvan alla valotus, ISO ja polttoväli sekä kamera ja objektiivi.", "A face model uses the GPU only when a check shows it gives the same results faster.": "Kasvomalli käyttää GPU:ta vain, jos tarkistus osoittaa sen antavan samat tulokset nopeammin.", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Suodatin piilottaa tämän näkymän kuvat: muuta sitä tai tyhjennä se (Näytä → Tyhjennä suodattimet)", - "A folder is already being synchronized": "Kansio on jo synkronoitumassa", "A folder is being synchronized": "Kansiota synkronoidaan", "A keyword set needs a name": "Avainsanajoukolle täytyy antaa nimi", "A light grey wall with a white mat and a soft shadow; the caption and the rating under the photo.": "Vaaleanharmaa seinä, valkoinen paspis ja pehmeä varjo; kuvateksti ja luokitus kuvan alla.", @@ -2327,5 +2326,7 @@ "Drop to open the face model": "Pudota avataksesi kasvomallin", "Dropped Files": "Pudotetut tiedostot", "Finish Lightroom catalog import before adding photos": "Viimeistele Lightroom-luettelon tuonti ennen kuvien lisäämistä", - "Import dropped files without review": "Tuo pudotetut tiedostot ilman tarkistusta" + "Import dropped files without review": "Tuo pudotetut tiedostot ilman tarkistusta", + "Queued: it starts when the task ahead of it ends": "Jonossa: alkaa, kun sen edellä oleva tehtävä päättyy", + "Another library was opened: nothing was done": "Toinen kirjasto avattiin: mitään ei tehty" } diff --git a/crates/ui-egui/locales/fr-formats.json b/crates/ui-egui/locales/fr-formats.json index 294273781e0..4b3326065b9 100644 --- a/crates/ui-egui/locales/fr-formats.json +++ b/crates/ui-egui/locales/fr-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "Impossible de lire {name} : {e}", "Added {n} photo{}": "{n} photo{} ajoutée(s)", "Where should the Lightroom catalog “{catalog}” go?": "Où importer le catalogue Lightroom « {catalog} » ?", - "Merge into the open library “{library}” ({count} photo{})": "Fusionner avec la bibliothèque ouverte « {library} » ({count} photo{})" + "Merge into the open library “{library}” ({count} photo{})": "Fusionner avec la bibliothèque ouverte « {library} » ({count} photo{})", + "Queued: it starts after {n} more": "En file : démarre après {n} autres", + "{n} more missing, left alone: synchronize again to review them": "{n} autres manquantes, laissées telles quelles : synchronisez à nouveau pour les examiner" } diff --git a/crates/ui-egui/locales/fr.json b/crates/ui-egui/locales/fr.json index 3278d6ccda6..27179c32682 100644 --- a/crates/ui-egui/locales/fr.json +++ b/crates/ui-egui/locales/fr.json @@ -1906,7 +1906,6 @@ "Skipped: files that can't be read": "Ignorés : fichiers illisibles", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "Ce dossier est introuvable : il a été déplacé ou renommé, ou son disque n'est pas connecté.", "Relink photos whose file was renamed or moved": "Relier les photos dont le fichier a été renommé ou déplacé", - "A folder is already being synchronized": "Un dossier est déjà en cours de synchronisation", "Synchronizing…": "Synchronisation…", "Relinked": "Reliées", "Removed": "Retirées", @@ -2390,5 +2389,7 @@ "Checking recent libraries": "Vérification des bibliothèques récentes", "The photos are imported once a library is open": "Les photos seront importées dès qu'une bibliothèque sera ouverte", "Open a library first, then drop the presets again": "Ouvrez d'abord une bibliothèque, puis déposez à nouveau les préréglages", - "This library couldn't be checked:": "Impossible de vérifier cette bibliothèque :" + "This library couldn't be checked:": "Impossible de vérifier cette bibliothèque :", + "Queued: it starts when the task ahead of it ends": "En file : démarre à la fin de la tâche précédente", + "Another library was opened: nothing was done": "Une autre bibliothèque a été ouverte : rien n’a été fait" } diff --git a/crates/ui-egui/locales/id-formats.json b/crates/ui-egui/locales/id-formats.json index 7fc3255221e..d42faac7969 100644 --- a/crates/ui-egui/locales/id-formats.json +++ b/crates/ui-egui/locales/id-formats.json @@ -305,5 +305,7 @@ "Drop to review {n} item{} for import": "Jatuhkan untuk meninjau {n} item sebelum impor{:.0}", "Inside: {names}": "Di dalam: {names}", "Where should the Lightroom catalog “{catalog}” go?": "Ke mana katalog Lightroom “{catalog}” diimpor?", - "Merge into the open library “{library}” ({count} photo{})": "Gabungkan ke pustaka yang terbuka “{library}” ({count} foto{:.0})" + "Merge into the open library “{library}” ({count} photo{})": "Gabungkan ke pustaka yang terbuka “{library}” ({count} foto{:.0})", + "Queued: it starts after {n} more": "Dalam antrean: dimulai setelah {n} lagi", + "{n} more missing, left alone: synchronize again to review them": "{n} lagi hilang dan dibiarkan: sinkronkan lagi untuk memeriksanya" } diff --git a/crates/ui-egui/locales/id.json b/crates/ui-egui/locales/id.json index 0d6da9b8fb8..3073c328cbc 100644 --- a/crates/ui-egui/locales/id.json +++ b/crates/ui-egui/locales/id.json @@ -22,7 +22,6 @@ "A dark slate backdrop with the exposure, ISO and focal length, then the camera and lens, under each photo.": "Latar abu-abu gelap berisi eksposur, ISO, dan panjang fokus, lalu kamera dan lensa, di bawah setiap foto.", "A face model uses the GPU only when a check shows it gives the same results faster.": "Model wajah hanya menggunakan GPU jika pengujian menunjukkan hasilnya sama tetapi lebih cepat.", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Filter menyembunyikan foto di tampilan ini: ubah atau hapus filternya (Tampilan → Hapus filter)", - "A folder is already being synchronized": "Sudah ada folder yang sedang disinkronkan", "A folder is being synchronized": "Folder sedang disinkronkan", "A keyword set needs a name": "Set kata kunci harus diberi nama", "A light grey wall with a white mat and a soft shadow; the caption and the rating under the photo.": "Dinding abu-abu muda dengan paspartu putih dan bayangan lembut; keterangan dan rating di bawah foto.", @@ -2339,5 +2338,7 @@ "Drop to open the face model": "Jatuhkan untuk membuka model wajah", "Dropped Files": "File yang dijatuhkan", "Finish Lightroom catalog import before adding photos": "Selesaikan impor katalog Lightroom sebelum menambahkan foto", - "Import dropped files without review": "Impor file yang dijatuhkan tanpa tinjauan" + "Import dropped files without review": "Impor file yang dijatuhkan tanpa tinjauan", + "Queued: it starts when the task ahead of it ends": "Dalam antrean: dimulai saat tugas di depannya selesai", + "Another library was opened: nothing was done": "Pustaka lain dibuka: tidak ada yang dilakukan" } diff --git a/crates/ui-egui/locales/it-formats.json b/crates/ui-egui/locales/it-formats.json index 7efae90e945..23650b47c58 100644 --- a/crates/ui-egui/locales/it-formats.json +++ b/crates/ui-egui/locales/it-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "Impossibile leggere {name}: {e}", "Added {n} photo{}": "Foto aggiunte: {n}{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Dove importare il catalogo Lightroom “{catalog}”?", - "Merge into the open library “{library}” ({count} photo{})": "Unisci alla libreria aperta “{library}” (foto: {count}{:.0})" + "Merge into the open library “{library}” ({count} photo{})": "Unisci alla libreria aperta “{library}” (foto: {count}{:.0})", + "Queued: it starts after {n} more": "In coda: parte dopo altre {n}", + "{n} more missing, left alone: synchronize again to review them": "Ne mancano altre {n}, lasciate com'erano: sincronizza di nuovo per esaminarle" } diff --git a/crates/ui-egui/locales/it.json b/crates/ui-egui/locales/it.json index e159fd47d15..1f143b04772 100644 --- a/crates/ui-egui/locales/it.json +++ b/crates/ui-egui/locales/it.json @@ -2026,7 +2026,6 @@ "Skipped: files that can't be read": "Saltati: file che non si possono leggere", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "Questa cartella non c'è: è stata spostata o rinominata, oppure il suo disco non è collegato.", "Relink photos whose file was renamed or moved": "Ricollega le foto il cui file è stato rinominato o spostato", - "A folder is already being synchronized": "Una cartella è già in sincronizzazione", "Synchronizing…": "Sincronizzazione in corso…", "Relinked": "Ricollegate", "Removed": "Rimosse", @@ -2361,5 +2360,7 @@ "Import dropped files without review": "Importa i file rilasciati senza revisione", "An import is running": "Un'importazione è in corso", "An import is running. Drop photos when it has finished": "Un'importazione è in corso. Trascina le foto quando è finita", - "Finish Lightroom catalog import before adding photos": "Termina l'importazione del catalogo Lightroom prima di aggiungere foto" + "Finish Lightroom catalog import before adding photos": "Termina l'importazione del catalogo Lightroom prima di aggiungere foto", + "Queued: it starts when the task ahead of it ends": "In coda: parte quando finisce l'attività precedente", + "Another library was opened: nothing was done": "È stata aperta un'altra libreria: non è stato fatto nulla" } diff --git a/crates/ui-egui/locales/ja-formats.json b/crates/ui-egui/locales/ja-formats.json index 99c14bf16dc..15853a927b0 100644 --- a/crates/ui-egui/locales/ja-formats.json +++ b/crates/ui-egui/locales/ja-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "{name} を読み取れませんでした: {e}", "Added {n} photo{}": "{n}枚を追加しました{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Lightroom カタログ「{catalog}」をどこに読み込みますか?", - "Merge into the open library “{library}” ({count} photo{})": "開いているライブラリ「{library}」に統合(写真{count}枚){:.0}" + "Merge into the open library “{library}” ({count} photo{})": "開いているライブラリ「{library}」に統合(写真{count}枚){:.0}", + "Queued: it starts after {n} more": "キューに追加: あと {n} 件の後に開始します", + "{n} more missing, left alone: synchronize again to review them": "ほかに {n} 件が見つからず、そのままにしました: 確認するにはもう一度同期してください" } diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.json index e1834555bd7..f954190daeb 100644 --- a/crates/ui-egui/locales/ja.json +++ b/crates/ui-egui/locales/ja.json @@ -1918,7 +1918,6 @@ "Skipped: files that can't be read": "スキップ: 読み込めないファイル", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "このフォルダが見つかりません。移動または名前の変更がされたか、ディスクが接続されていません。", "Relink photos whose file was renamed or moved": "ファイル名の変更や移動があった写真をリンクし直す", - "A folder is already being synchronized": "すでにフォルダを同期中です", "Synchronizing…": "同期中…", "Relinked": "リンクし直し", "Removed": "除去", @@ -2356,5 +2355,7 @@ "Import dropped files without review": "ドロップしたファイルを確認せずに読み込む", "An import is running": "読み込み中です", "An import is running. Drop photos when it has finished": "読み込み中です。完了してから写真をドロップしてください", - "Finish Lightroom catalog import before adding photos": "写真を追加する前に Lightroom カタログの読み込みを完了してください" + "Finish Lightroom catalog import before adding photos": "写真を追加する前に Lightroom カタログの読み込みを完了してください", + "Queued: it starts when the task ahead of it ends": "キューに追加: 前のタスクが終わると開始します", + "Another library was opened: nothing was done": "別のライブラリが開かれました: 何も行われていません" } diff --git a/crates/ui-egui/locales/ka-formats.json b/crates/ui-egui/locales/ka-formats.json index 46036826186..73ddac481ae 100644 --- a/crates/ui-egui/locales/ka-formats.json +++ b/crates/ui-egui/locales/ka-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "ვერ წაიკითხა {name}: {e}", "Added {n} photo{}": "დაემატა ფოტო: {n}{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "სად გადავიტანოთ Lightroom-ის კატალოგი „{catalog}“?", - "Merge into the open library “{library}” ({count} photo{})": "გაერთიანება ღია ბიბლიოთეკასთან „{library}“ (ფოტოები: {count}){:.0}" + "Merge into the open library “{library}” ({count} photo{})": "გაერთიანება ღია ბიბლიოთეკასთან „{library}“ (ფოტოები: {count}){:.0}", + "Queued: it starts after {n} more": "რიგშია: დაიწყება კიდევ {n}-ის შემდეგ", + "{n} more missing, left alone: synchronize again to review them": "კიდევ {n} აკლია და ხელუხლებლად დარჩა: გადასახედად ხელახლა მოახდინეთ სინქრონიზაცია" } diff --git a/crates/ui-egui/locales/ka.json b/crates/ui-egui/locales/ka.json index 32c40770018..4db6010bd24 100644 --- a/crates/ui-egui/locales/ka.json +++ b/crates/ui-egui/locales/ka.json @@ -63,7 +63,6 @@ "A change that can't be saved to disk (full or unplugged drive) is no longer silent: the command reports": "ცვლილება, რომლის დისკზე შენახვაც ვერ ხერხდება (სავსე ან გამორთული დისკი), აღარ რჩება შეუმჩნეველი: ბრძანება იტყობინება", "A dialog taller than the window no longer runs off it (issue #781): on a 1366×768 screen the Export dialog's title": "ფანჯარაზე მაღალი დიალოგი აღარ გადის მის საზღვრებს გარეთ (ხარვეზი #781): 1366×768 ეკრანზე ექსპორტის დიალოგის სათაური", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "ფილტრი მალავს ამ ხედის ფოტოებს: შეცვალეთ ან გაასუფთავეთ იგი (ხედი → ფილტრების გასუფთავება)", - "A folder is already being synchronized": "საქაღალდე უკვე სინქრონიზდება", "A folder is being synchronized": "საქაღალდე სინქრონიზდება", "A keyword set needs a name": "საკვანძო სიტყვების ნაკრებს სახელი სჭირდება", "A label follows its folder when it is renamed or moved in LightCraft, together with the labels of the folders": "იარლიყი თავის საქაღალდეს მიჰყვება, როცა ის LightCraft-ში გადაერქმევა ან გადაიტანება, მასში მყოფი საქაღალდეების", @@ -2734,5 +2733,7 @@ "Import dropped files without review": "ჩაგდებული ფაილების იმპორტი გადახედვის გარეშე", "An import is running": "იმპორტი მიმდინარეობს", "An import is running. Drop photos when it has finished": "იმპორტი მიმდინარეობს. ფოტოები ჩააგდეთ, როცა დასრულდება", - "Finish Lightroom catalog import before adding photos": "ფოტოების დამატებამდე დაასრულეთ Lightroom-ის კატალოგის იმპორტი" + "Finish Lightroom catalog import before adding photos": "ფოტოების დამატებამდე დაასრულეთ Lightroom-ის კატალოგის იმპორტი", + "Queued: it starts when the task ahead of it ends": "რიგშია: დაიწყება, როცა წინა ამოცანა დასრულდება", + "Another library was opened: nothing was done": "სხვა ბიბლიოთეკა გაიხსნა: არაფერი გაკეთებულა" } diff --git a/crates/ui-egui/locales/pl-formats.json b/crates/ui-egui/locales/pl-formats.json index 20c7f840d6e..b7fe22f5cb7 100644 --- a/crates/ui-egui/locales/pl-formats.json +++ b/crates/ui-egui/locales/pl-formats.json @@ -305,5 +305,7 @@ "Added {n} photo{}": "Dodano zdjęcia: {n}{:.0}", "Inside: {names}": "Wewnątrz: {names}", "Where should the Lightroom catalog “{catalog}” go?": "Dokąd zaimportować katalog Lightroom „{catalog}”?", - "Merge into the open library “{library}” ({count} photo{})": "Scal z otwartą biblioteką „{library}” (zdjęcia: {count}){:.0}" + "Merge into the open library “{library}” ({count} photo{})": "Scal z otwartą biblioteką „{library}” (zdjęcia: {count}){:.0}", + "Queued: it starts after {n} more": "W kolejce: rozpocznie się po {n} kolejnych", + "{n} more missing, left alone: synchronize again to review them": "Brakuje jeszcze {n}, pozostawiono bez zmian: zsynchronizuj ponownie, aby je przejrzeć" } diff --git a/crates/ui-egui/locales/pl.json b/crates/ui-egui/locales/pl.json index adac22e62ad..ad13a39be9b 100644 --- a/crates/ui-egui/locales/pl.json +++ b/crates/ui-egui/locales/pl.json @@ -1858,7 +1858,6 @@ "Skipped: files that can't be read": "Pominięto: pliki, których nie można odczytać", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "Ten folder nie istnieje: przeniesiono go, zmieniono nazwę albo odłączono dysk.", "Relink photos whose file was renamed or moved": "Połącz ponownie zdjęcia, których pliki przeniesiono lub przemianowano", - "A folder is already being synchronized": "Trwa już synchronizacja folderu", "Synchronizing…": "Synchronizowanie…", "Relinked": "Połączono ponownie", "Removed": "Usunięto", @@ -2283,5 +2282,7 @@ "Import dropped files without review": "Importuj upuszczone pliki bez przeglądu", "An import is running": "Import jest w toku", "An import is running. Drop photos when it has finished": "Import jest w toku. Upuść zdjęcia, gdy się zakończy", - "Finish Lightroom catalog import before adding photos": "Zakończ import katalogu Lightrooma, zanim dodasz zdjęcia" + "Finish Lightroom catalog import before adding photos": "Zakończ import katalogu Lightrooma, zanim dodasz zdjęcia", + "Queued: it starts when the task ahead of it ends": "W kolejce: rozpocznie się po zakończeniu poprzedniego zadania", + "Another library was opened: nothing was done": "Otwarto inną bibliotekę: nic nie zrobiono" } diff --git a/crates/ui-egui/locales/pt-br-formats.json b/crates/ui-egui/locales/pt-br-formats.json index f17f2c0fd4b..25c8a28b770 100644 --- a/crates/ui-egui/locales/pt-br-formats.json +++ b/crates/ui-egui/locales/pt-br-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "Não foi possível ler {name}: {e}", "Added {n} photo{}": "{n} foto{0} adicionada{0}", "Where should the Lightroom catalog “{catalog}” go?": "Para onde vai o catálogo do Lightroom “{catalog}”?", - "Merge into the open library “{library}” ({count} photo{})": "Mesclar na biblioteca aberta “{library}” ({count} foto{})" + "Merge into the open library “{library}” ({count} photo{})": "Mesclar na biblioteca aberta “{library}” ({count} foto{})", + "Queued: it starts after {n} more": "Na fila: começa depois de mais {n}", + "{n} more missing, left alone: synchronize again to review them": "Faltam mais {n}, deixadas como estavam: sincronize de novo para revisá-las" } diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.json index e84fb7615b7..222fd260f62 100644 --- a/crates/ui-egui/locales/pt-br.json +++ b/crates/ui-egui/locales/pt-br.json @@ -1916,7 +1916,6 @@ "Skipped: files that can't be read": "Ignorados: arquivos que não podem ser lidos", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "Esta pasta não está lá: foi movida ou renomeada, ou o disco dela não está conectado.", "Relink photos whose file was renamed or moved": "Vincular de novo fotos cujo arquivo foi renomeado ou movido", - "A folder is already being synchronized": "Uma pasta já está sendo sincronizada", "Synchronizing…": "Sincronizando…", "Relinked": "Revinculadas", "Removed": "Removidas", @@ -2202,5 +2201,7 @@ "Import dropped files without review": "Importar arquivos soltos sem revisão", "An import is running": "Uma importação está em andamento", "An import is running. Drop photos when it has finished": "Uma importação está em andamento. Solte as fotos quando ela terminar", - "Finish Lightroom catalog import before adding photos": "Conclua a importação do catálogo do Lightroom antes de adicionar fotos" + "Finish Lightroom catalog import before adding photos": "Conclua a importação do catálogo do Lightroom antes de adicionar fotos", + "Queued: it starts when the task ahead of it ends": "Na fila: começa quando a tarefa anterior terminar", + "Another library was opened: nothing was done": "Outra biblioteca foi aberta: nada foi feito" } diff --git a/crates/ui-egui/locales/ru-formats.json b/crates/ui-egui/locales/ru-formats.json index 76b7af42764..df0cff8badc 100644 --- a/crates/ui-egui/locales/ru-formats.json +++ b/crates/ui-egui/locales/ru-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "Не удалось прочитать {name}: {e}", "Added {n} photo{}": "Добавлено фото: {n}{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Куда импортировать каталог Lightroom «{catalog}»?", - "Merge into the open library “{library}” ({count} photo{})": "Объединить с открытой библиотекой «{library}» (фото: {count}){:.0}" + "Merge into the open library “{library}” ({count} photo{})": "Объединить с открытой библиотекой «{library}» (фото: {count}){:.0}", + "Queued: it starts after {n} more": "В очереди: начнётся после ещё {n}", + "{n} more missing, left alone: synchronize again to review them": "Не хватает ещё {n}, оставлены как есть: синхронизируйте снова, чтобы их просмотреть" } diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index 306804df045..fe8bfda9e90 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -1628,7 +1628,6 @@ "Skipped: files that can't be read": "Пропущено: файлы, которые не удаётся прочитать", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "Этой папки нет: её переместили или переименовали, либо её диск не подключён.", "Relink photos whose file was renamed or moved": "Повторно связать фото, файл которых переименован или перемещён", - "A folder is already being synchronized": "Папка уже синхронизируется", "Synchronizing…": "Синхронизация…", "Imported": "Импортированные", "Relinked": "Связано повторно", @@ -2349,5 +2348,7 @@ "Import dropped files without review": "Импортировать перетащенные файлы без проверки", "An import is running": "Импорт уже выполняется", "An import is running. Drop photos when it has finished": "Импорт уже выполняется. Перетащите фото, когда он закончится", - "Finish Lightroom catalog import before adding photos": "Завершите импорт каталога Lightroom, прежде чем добавлять фото" + "Finish Lightroom catalog import before adding photos": "Завершите импорт каталога Lightroom, прежде чем добавлять фото", + "Queued: it starts when the task ahead of it ends": "В очереди: начнётся, когда закончится задача перед ней", + "Another library was opened: nothing was done": "Открыта другая библиотека: ничего не сделано" } diff --git a/crates/ui-egui/locales/sv-formats.json b/crates/ui-egui/locales/sv-formats.json index 9a71a0288c4..3493eda8222 100644 --- a/crates/ui-egui/locales/sv-formats.json +++ b/crates/ui-egui/locales/sv-formats.json @@ -305,5 +305,7 @@ "Drop to review {n} item{} for import": "Släpp för att granska {n} objekt före import{:.0}", "Inside: {names}": "Inuti: {names}", "Where should the Lightroom catalog “{catalog}” go?": "Vart ska Lightroom-katalogen ”{catalog}” importeras?", - "Merge into the open library “{library}” ({count} photo{})": "Slå samman med det öppna biblioteket ”{library}” ({count} foto{:.0})" + "Merge into the open library “{library}” ({count} photo{})": "Slå samman med det öppna biblioteket ”{library}” ({count} foto{:.0})", + "Queued: it starts after {n} more": "I kö: startar efter {n} till", + "{n} more missing, left alone: synchronize again to review them": "{n} fler saknas och lämnades orörda: synkronisera igen för att granska dem" } diff --git a/crates/ui-egui/locales/sv.json b/crates/ui-egui/locales/sv.json index 66e69b7ba5d..76983ad20f6 100644 --- a/crates/ui-egui/locales/sv.json +++ b/crates/ui-egui/locales/sv.json @@ -32,7 +32,6 @@ "A change that can't be saved to disk (full or unplugged drive) is no longer silent: the command reports": "En ändring som inte kan sparas till disk (full eller urkopplad enhet) är inte längre tyst: kommandot rapporterar", "A dark slate backdrop with the exposure, ISO and focal length, then the camera and lens, under each photo.": "En mörk skifferbakgrund med exponering, ISO och brännvidd, sedan kamera och objektiv, under varje foto.", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Ett filter döljer den här vyns foton: ändra det eller rensa det (Visa → Rensa filter)", - "A folder is already being synchronized": "En mapp synkroniseras redan", "A folder is being synchronized": "En mapp synkroniseras", "a full drive) no longer counts as built and Build Smart Previews replaces it.": "en full enhet) räknas inte längre som byggd och Bygg smarta förhandsgranskningar ersätter den.", "A keyword set needs a name": "En nyckelordsuppsättning behöver ett namn", @@ -2429,5 +2428,7 @@ "Drop to open the face model": "Släpp för att öppna ansiktsmodellen", "Dropped Files": "Släppta filer", "Finish Lightroom catalog import before adding photos": "Slutför importen av Lightroom-katalogen innan du lägger till foton", - "Import dropped files without review": "Importera släppta filer utan granskning" + "Import dropped files without review": "Importera släppta filer utan granskning", + "Queued: it starts when the task ahead of it ends": "I kö: startar när uppgiften före är klar", + "Another library was opened: nothing was done": "Ett annat bibliotek öppnades: ingenting gjordes" } diff --git a/crates/ui-egui/locales/uk-formats.json b/crates/ui-egui/locales/uk-formats.json index 36022ac1a25..209fdd16b83 100644 --- a/crates/ui-egui/locales/uk-formats.json +++ b/crates/ui-egui/locales/uk-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "Не вдалося прочитати {name}: {e}", "Added {n} photo{}": "Додано фото: {n}{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Куди імпортувати каталог Lightroom «{catalog}»?", - "Merge into the open library “{library}” ({count} photo{})": "Об’єднати з відкритою бібліотекою «{library}» (фото: {count}){:.0}" + "Merge into the open library “{library}” ({count} photo{})": "Об’єднати з відкритою бібліотекою «{library}» (фото: {count}){:.0}", + "Queued: it starts after {n} more": "У черзі: почнеться після ще {n}", + "{n} more missing, left alone: synchronize again to review them": "Бракує ще {n}, залишено як є: синхронізуйте знову, щоб їх переглянути" } diff --git a/crates/ui-egui/locales/uk.json b/crates/ui-egui/locales/uk.json index ee694ed4fe0..1f0a5f99f44 100644 --- a/crates/ui-egui/locales/uk.json +++ b/crates/ui-egui/locales/uk.json @@ -2100,7 +2100,6 @@ "Skipped: files that can't be read": "Пропущено: файли, які не вдається прочитати", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "Цієї теки немає: її переміщено чи перейменовано, або її диск не під’єднано.", "Relink photos whose file was renamed or moved": "Перезв’язати фото, файл яких перейменовано чи переміщено", - "A folder is already being synchronized": "Тека вже синхронізується", "Synchronizing…": "Синхронізація…", "Relinked": "Перезв’язано", "Removed": "Прибрано", @@ -2354,5 +2353,7 @@ "Import dropped files without review": "Імпортувати перетягнуті файли без перегляду", "An import is running": "Імпорт уже виконується", "An import is running. Drop photos when it has finished": "Імпорт уже виконується. Перетягніть фото, коли він завершиться", - "Finish Lightroom catalog import before adding photos": "Завершіть імпорт каталогу Lightroom, перш ніж додавати фото" + "Finish Lightroom catalog import before adding photos": "Завершіть імпорт каталогу Lightroom, перш ніж додавати фото", + "Queued: it starts when the task ahead of it ends": "У черзі: почнеться, коли завершиться попереднє завдання", + "Another library was opened: nothing was done": "Відкрито іншу бібліотеку: нічого не зроблено" } diff --git a/crates/ui-egui/locales/vi-formats.json b/crates/ui-egui/locales/vi-formats.json index d5e28bff060..ad050727993 100644 --- a/crates/ui-egui/locales/vi-formats.json +++ b/crates/ui-egui/locales/vi-formats.json @@ -305,5 +305,7 @@ "Drop to import {n} preset{}": "Thả để nhập {n} thiết lập sẵn{:.0}", "Drop to review {n} item{} for import": "Thả để xem lại {n} mục trước khi nhập{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Nhập danh mục Lightroom «{catalog}» vào đâu?", - "Merge into the open library “{library}” ({count} photo{})": "Gộp vào thư viện đang mở «{library}» ({count} ảnh{:.0})" + "Merge into the open library “{library}” ({count} photo{})": "Gộp vào thư viện đang mở «{library}» ({count} ảnh{:.0})", + "Queued: it starts after {n} more": "Trong hàng đợi: bắt đầu sau {n} tác vụ nữa", + "{n} more missing, left alone: synchronize again to review them": "Còn {n} mục bị thiếu được giữ nguyên: hãy đồng bộ hóa lại để xem xét" } diff --git a/crates/ui-egui/locales/vi.json b/crates/ui-egui/locales/vi.json index e4fb8feb81c..c71b2e3d5bd 100644 --- a/crates/ui-egui/locales/vi.json +++ b/crates/ui-egui/locales/vi.json @@ -26,7 +26,6 @@ "A blank template keeps the original names.": "Mẫu trống giữ tên gốc.", "A change that can't be saved to disk (full or unplugged drive) is no longer silent: the command reports": "Thay đổi không thể lưu ra đĩa (đĩa đầy hoặc đã rút) không còn im lặng: lệnh báo", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Bộ lọc đang ẩn ảnh trong chế độ xem này: đổi bộ lọc hoặc xóa (Xem → Xóa bộ lọc)", - "A folder is already being synchronized": "Một thư mục đang được đồng bộ", "A folder is being synchronized": "Một thư mục đang được đồng bộ", "A keyword set needs a name": "Bộ từ khóa cần một tên", "A library is open in one program at a time (issue #99): opening a library that LightCraft or `lightcraft-cli` already": "Một thư viện chỉ mở trong một chương trình tại một thời điểm (issue #99): mở thư viện mà LightCraft hoặc `lightcraft-cli` đã", @@ -2235,5 +2234,7 @@ "Drop to open the face model": "Thả để mở mô hình khuôn mặt", "Dropped Files": "Tệp đã thả", "Finish Lightroom catalog import before adding photos": "Hoàn tất nhập danh mục Lightroom trước khi thêm ảnh", - "Import dropped files without review": "Nhập các tệp đã thả mà không xem lại" + "Import dropped files without review": "Nhập các tệp đã thả mà không xem lại", + "Queued: it starts when the task ahead of it ends": "Trong hàng đợi: bắt đầu khi tác vụ trước nó kết thúc", + "Another library was opened: nothing was done": "Đã mở thư viện khác: không có gì được thực hiện" } diff --git a/crates/ui-egui/locales/zh-hans-formats.json b/crates/ui-egui/locales/zh-hans-formats.json index 7406c39b866..f16499d8b53 100644 --- a/crates/ui-egui/locales/zh-hans-formats.json +++ b/crates/ui-egui/locales/zh-hans-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "无法读取 {name}:{e}", "Added {n} photo{}": "已添加 {n} 张照片{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Lightroom 目录“{catalog}”要导入到哪里?", - "Merge into the open library “{library}” ({count} photo{})": "合并到当前打开的图库“{library}”({count} 张照片){:.0}" + "Merge into the open library “{library}” ({count} photo{})": "合并到当前打开的图库“{library}”({count} 张照片){:.0}", + "Queued: it starts after {n} more": "已加入队列:再过 {n} 个后开始", + "{n} more missing, left alone: synchronize again to review them": "还有 {n} 个缺失,未作处理:再次同步以检查它们" } diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.json index 270af8a6251..e13758890f6 100644 --- a/crates/ui-egui/locales/zh-hans.json +++ b/crates/ui-egui/locales/zh-hans.json @@ -1910,7 +1910,6 @@ "Skipped: files that can't be read": "已跳过:无法读取的文件", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "此文件夹不存在:它已被移动或重命名,或其磁盘未连接。", "Relink photos whose file was renamed or moved": "重新链接文件被重命名或移动的照片", - "A folder is already being synchronized": "已有文件夹正在同步", "Synchronizing…": "正在同步…", "Relinked": "已重新链接", "Removed": "已移除", @@ -2200,5 +2199,7 @@ "Import dropped files without review": "不经检查直接导入拖入的文件", "An import is running": "正在导入", "An import is running. Drop photos when it has finished": "正在导入。导入完成后再拖放照片", - "Finish Lightroom catalog import before adding photos": "添加照片前,请先完成 Lightroom 目录的导入" + "Finish Lightroom catalog import before adding photos": "添加照片前,请先完成 Lightroom 目录的导入", + "Queued: it starts when the task ahead of it ends": "已加入队列:前一个任务结束后开始", + "Another library was opened: nothing was done": "已打开另一个图库:未执行任何操作" } diff --git a/crates/ui-egui/locales/zh-hant-formats.json b/crates/ui-egui/locales/zh-hant-formats.json index d5c4eb279a2..5230ccec2ae 100644 --- a/crates/ui-egui/locales/zh-hant-formats.json +++ b/crates/ui-egui/locales/zh-hant-formats.json @@ -305,5 +305,7 @@ "Could not read {name}: {e}": "無法讀取 {name}:{e}", "Added {n} photo{}": "已加入 {n} 張照片{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Lightroom 目錄「{catalog}」要匯入到哪裡?", - "Merge into the open library “{library}” ({count} photo{})": "合併到目前開啟的照片庫「{library}」({count} 張照片){:.0}" + "Merge into the open library “{library}” ({count} photo{})": "合併到目前開啟的照片庫「{library}」({count} 張照片){:.0}", + "Queued: it starts after {n} more": "已加入佇列:再過 {n} 個後開始", + "{n} more missing, left alone: synchronize again to review them": "還有 {n} 個遺失,未作處理:再次同步以檢查它們" } diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.json index 0408e23ec87..692f9c55919 100644 --- a/crates/ui-egui/locales/zh-hant.json +++ b/crates/ui-egui/locales/zh-hant.json @@ -1916,7 +1916,6 @@ "Skipped: files that can't be read": "已略過:無法讀取的檔案", "This folder isn't there: it was moved or renamed, or its disk isn't connected.": "此資料夾不存在:它已被移動或重新命名,或其磁碟未連接。", "Relink photos whose file was renamed or moved": "重新連結檔案被重新命名或移動的照片", - "A folder is already being synchronized": "已有資料夾正在同步", "Synchronizing…": "正在同步…", "Relinked": "已重新連結", "Removed": "已移除", @@ -2157,5 +2156,7 @@ "Import dropped files without review": "不經檢查直接匯入拖放的檔案", "An import is running": "正在匯入", "An import is running. Drop photos when it has finished": "正在匯入。匯入完成後再拖放照片", - "Finish Lightroom catalog import before adding photos": "新增照片前,請先完成 Lightroom 目錄的匯入" + "Finish Lightroom catalog import before adding photos": "新增照片前,請先完成 Lightroom 目錄的匯入", + "Queued: it starts when the task ahead of it ends": "已加入佇列:前一個工作結束後開始", + "Another library was opened: nothing was done": "已開啟另一個圖庫:未執行任何操作" } diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 108583b7ae2..16060c29cb9 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -105,6 +105,7 @@ impl LightcraftApp { sync: None, sync_owns_changes: false, sync_run: None, + sync_queued: None, lightroom: None, lightroom_last: None, lightroom_result: None, @@ -286,6 +287,49 @@ impl LightcraftApp { r } + /// Say that a task waits in line at `place` of its lane: without it, asking for it seems to do nothing. + pub(crate) fn queued_toast(&mut self, place: u64) { + // (counted as its row counts: the waiting tasks ahead of it, after the running one) + let text = if place <= 1 { + i18n::tr("Queued: it starts when the task ahead of it ends").to_string() + } else { + i18n::tr_format!("Queued: it starts after {n} more", n = place - 1) + }; + let now = self.tick_now(); + self.ui.toast = Some((text, now + TOAST_SECONDS, None)); + } + + /// Start the tasks waiting in line whose lane is free: the engine's ([`lightcraft_engine::Session::start_waiting`]) + /// and the app's own (`app:import`, `app:synchronize`), each the way it was asked. One that can't start says why + /// in a toast; the next in line goes on. + fn start_waiting(&mut self, ctx: &egui::Context) { + self.session.start_waiting(); + // The app's own wait while its slots are taken, row or no row yet: an import set this frame (Auto Import, its + // row comes at the next tick), a synchronize, or a Local folder being read (it becomes an import when read). + let held = self.lightroom.is_some() + || self.import.is_some() + || self.sync_run.is_some() + || self.sync_queued.is_some() + || self.scan.as_ref().is_some_and(|t| t.browse); + if held { + return; + } + // (bounded: each turn takes one task out of a line that is at most this long) + for _ in 0..lightcraft_engine::activity::MAX_WAITING { + let Some(w) = self.session.activity.take_ready_if(|r| r.command.starts_with("app:")) else { break }; + let r = match w.request.command.as_str() { + import::IMPORT_REQUEST => import::start_request(self, ctx, &w.request), + sync::SYNC_REQUEST => sync::start_request(self, ctx, &w.request), + other => Err(format!("unknown request {other}")), + }; + self.session.activity.started(); + if let Err(e) = r { + log::warn!("{}: a task that waited could not start: {e}", w.request.command); + self.toast_error(ctx, e); + } + } + } + /// The remembered ratio belongs to the tool until the user starts editing the crop. pub(crate) fn crop_tool_aspect(&self) -> Option<(u32, u32)> { let photo = self.session.active()?; @@ -364,7 +408,7 @@ impl LightcraftApp { /// A task waiting in line whose lane freed while nothing was asked starts now (commands start them too); then the /// run in progress is looked at, so that one started here is polled for its end from this frame on. pub(crate) fn tick_preview_builds(&mut self, ctx: &egui::Context) { - self.session.start_waiting(); + self.start_waiting(ctx); self.preview_build_status(ctx); } diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 0621cb01071..04874c8cc6a 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -59,6 +59,7 @@ impl LightcraftApp { merge::poll(self, ctx); import::poll_scan(self, ctx); sync::poll(self, ctx); + sync::poll_rescan(self, ctx); sync::poll_run(self, ctx); // Import commits batches and must not run twice in one host frame. The first layout pass // and a hidden logic tick both report pass index 0; a second pass reports 1. A wall-clock @@ -84,12 +85,8 @@ impl LightcraftApp { #[cfg(not(target_arch = "wasm32"))] if let Some(folder) = self.session.import_defaults.auto_folder.clone() { const LABEL: &str = "Auto Import"; - if now - self.ui.auto_import_at >= 3.0 - && self.import.is_none() - && self.sync_run.is_none() - && self.lightroom.is_none() - && !self.tasks.is_running(LABEL) - { + // (it waits for the whole library lane: what runs, rescans or waits there goes first) + if now - self.ui.auto_import_at >= 3.0 && !import::library_busy(self) && self.lightroom.is_none() && !self.tasks.is_running(LABEL) { self.ui.auto_import_at = now; let work = move || lightcraft_engine::cmd::library::list_auto_import_folder(&folder); let done = |app: &mut LightcraftApp, _ctx: &egui::Context, listing: Result, String>| { @@ -99,7 +96,7 @@ impl LightcraftApp { }; let p = serde_json::json!({"listing": listing, "start": false}); let Ok(r) = app.session.execute("library.autoImportScan", &p) else { return }; - let Some(mut params) = r.get("import").cloned().filter(|_| app.import.is_none()) else { return }; + let Some(mut params) = r.get("import").cloned().filter(|_| !import::library_busy(app)) else { return }; let paths: Vec = params["paths"].as_array().into_iter().flatten().filter_map(|v| v.as_str().map(str::to_string)).collect(); if let Some(o) = params.as_object_mut() { diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rs index 35b7991b485..ed9ffde9108 100644 --- a/crates/ui-egui/src/app/input.rs +++ b/crates/ui-egui/src/app/input.rs @@ -97,7 +97,7 @@ impl LightcraftApp { self.toast(ctx, crate::i18n::tr("Finish Lightroom catalog import before adding photos")); return; } - if import::running(self) { + if import::drop_blocked(self) { self.toast(ctx, crate::i18n::tr("An import is running")); return; } diff --git a/crates/ui-egui/src/dialogs/import.rs b/crates/ui-egui/src/dialogs/import.rs index 8425c3ec965..bfddcc35503 100644 --- a/crates/ui-egui/src/dialogs/import.rs +++ b/crates/ui-egui/src/dialogs/import.rs @@ -9,6 +9,7 @@ //! one undo step. use egui::{Align2, Color32, Rect, Sense, Stroke, StrokeKind, Vec2, pos2, vec2}; +use lightcraft_engine::activity::{Lane, Request}; use lightcraft_engine::import::{ ImportCandidate, ImportUprightMode, ImportWarning, ImportWarningCode, ScanInput, ScanOutput, ScanProgress, scan_with, }; @@ -32,13 +33,14 @@ pub(crate) use body::grid_height; use body::{DEFAULT_BELOW_GRID, badge_rect, dup_counts}; pub use body::{DEFAULT_FOLDER_TEMPLATE, body, example_destination, source_summary}; pub(crate) use body::{DIALOG_SIZE, note_dialog_bottom}; +pub(crate) use scan::library_busy; +pub use scan::{IMPORT_REQUEST, ScanTask, browse, drop_blocked, open, poll_scan, running}; #[cfg(not(target_arch = "wasm32"))] pub(crate) use scan::cards_seen; -pub use scan::{ScanTask, browse, open, poll_scan, running}; #[cfg(test)] pub(crate) use scan::{stall_scan, stall_scan_of}; pub(crate) use tags::{tag_field_width, tag_help, tag_toggle, unknown_tags_warning}; -pub use task::{ImportTask, start, start_paths, tick}; +pub use task::{ImportTask, start, start_paths, start_request, tick}; #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] #[serde(default, rename_all = "camelCase")] diff --git a/crates/ui-egui/src/dialogs/import/scan.rs b/crates/ui-egui/src/dialogs/import/scan.rs index 67b1fa176b2..43edb41ae91 100644 --- a/crates/ui-egui/src/dialogs/import/scan.rs +++ b/crates/ui-egui/src/dialogs/import/scan.rs @@ -1,5 +1,5 @@ use super::task::ImportTask; -use super::{ImportDialog, LightcraftApp, Ordering, ScanInput, ScanOutput, ScanProgress, Value, json, scan_with}; +use super::{ImportDialog, Lane, LightcraftApp, Ordering, Request, ScanInput, ScanOutput, ScanProgress, Value, json, scan_with}; /// A folder scan running on a worker thread (a network share can take minutes to read; the /// window must keep answering meanwhile). @@ -11,7 +11,7 @@ pub struct ScanTask { /// Open the review with this album chosen (an album's context menu ▸ Import…). pub album: Option, /// Browsing a folder (Local): the photos are read in place instead of opening the review. - pub(super) browse: bool, + pub(crate) browse: bool, /// What is being scanned (the review's source). sources: Vec, /// The scan's row in the activity stack (its ✕ and `activity.cancel` set `progress.cancel`). @@ -24,10 +24,31 @@ fn scan_guard(app: &LightcraftApp, progress: &ScanProgress, browse: bool) -> lig app.session.activity.start("scan", label, lightcraft_engine::activity::Cancel::Flag(progress.cancel.clone())) } -/// An import and a Synchronize Folder never run at once: each readies its files against the -/// library as it was when it started, so both could add the same file. -pub(crate) fn busy_synchronizing(app: &LightcraftApp) -> Result<(), String> { - if app.sync_run.is_some() { Err(crate::i18n::tr("A folder is being synchronized").to_string()) } else { Ok(()) } +/// The command of an import's request ([`Request`]): the app runs it ([`start_request`]), with its files and its +/// `library.import` params. +pub const IMPORT_REQUEST: &str = "app:import"; + +fn import_request(paths: &[String], params: &Value) -> Request { + Request { command: IMPORT_REQUEST.into(), params: json!({"paths": paths, "params": params}) } +} + +/// The library lane is taken: an import (or the reading of a Local folder) or a Synchronize Folder runs, or waits +/// to. Each readies its files against the library as it is when it starts, so two side by side could add the same +/// file: one asked for now waits in line ([`Lane::Library`]). +pub(crate) fn library_busy(app: &LightcraftApp) -> bool { + app.import.is_some() + || app.scan.as_ref().is_some_and(|t| t.browse) + || app.sync_run.is_some() + || app.sync_queued.is_some() + || app.session.activity.lane_busy(Lane::Library) + || app.session.activity.lane_waiting(Lane::Library) +} + +/// Put an import of `paths` with `params` in line behind what runs in the library lane, and say so. +pub(super) fn wait_in_line(app: &mut LightcraftApp, paths: &[String], params: &Value) -> Result { + let (id, place) = app.session.activity.enqueue("import", "Importing", import_request(paths, params))?; + app.queued_toast(place as u64); + Ok(json!({"queued": id, "place": place})) } /// Settings → Import → "Show the import review when a camera or card is connected", called with @@ -254,13 +275,20 @@ pub(crate) fn stall_scan_of(app: &mut LightcraftApp, browse: bool) -> Box bool { app.import.is_some() || app.scan.is_some() || app.review_pending.is_some() } +/// Whether any scan (the review's, or a Local folder browse) is running, or a finished scan's review waits for a +/// dialog to close, which a drop of photos must not replace: `open` refuses while a scan runs, and a browse that +/// finishes replaces `app.import`. A drop while an import runs is not refused: it waits in line ([`library_busy`]). +pub fn drop_blocked(app: &LightcraftApp) -> bool { + app.scan.is_some() || app.review_pending.is_some() +} + impl ScanTask { /// `{done, total}` for `ui.inspect` (total is 0 while the folders are still being listed). pub fn status(&self) -> Value { diff --git a/crates/ui-egui/src/dialogs/import/task.rs b/crates/ui-egui/src/dialogs/import/task.rs index e1f506d5b46..a66dfe9cd08 100644 --- a/crates/ui-egui/src/dialogs/import/task.rs +++ b/crates/ui-egui/src/dialogs/import/task.rs @@ -1,5 +1,7 @@ -use super::scan::{busy_synchronizing, running}; -use super::{ImportDialog, ImportUprightMode, ImportWarning, ImportWarningCode, LightcraftApp, Ordering, Value, json}; +use super::scan::wait_in_line; +use super::{ + ImportDialog, ImportUprightMode, ImportWarning, ImportWarningCode, LightcraftApp, Ordering, Request, Value, drop_blocked, json, library_busy, +}; /// Files per batch in the browser build (each batch joins the catalog as it is ready, so the /// progress window updates); the desktop's worker uses [`lightcraft_engine::import::batch_size`]. @@ -193,15 +195,14 @@ impl ImportRun { } } -/// Start importing the dialog's checked files (the dialog's OK / `ui.dialog.confirm`). Refused while another -/// import runs: replacing `app.import` would stop its worker. +/// Start importing the dialog's checked files (the dialog's OK / `ui.dialog.confirm`). While the library lane is +/// taken (an import or a Synchronize Folder runs) it waits in line, and plans its work when its turn comes. pub fn start(app: &mut LightcraftApp, d: &ImportDialog) -> Result { - busy_synchronizing(app)?; if !d.in_library(app) { return Err("another library was opened since the photos were scanned: nothing was imported".into()); } // a browse scan that finishes starts its own import, replacing this one - if app.import.is_some() || app.scan.as_ref().is_some_and(|t| t.browse) { + if app.scan.as_ref().is_some_and(|t| t.browse) { return Err(crate::i18n::tr("An import is running").to_string()); } let queue = d.selected_paths(); @@ -209,9 +210,13 @@ pub fn start(app: &mut LightcraftApp, d: &ImportDialog) -> Result return Err("no photos selected".into()); } let undo0 = app.session.undo.len(); + let waits = library_busy(app); let mut album = d.album; - if album.is_none() && !d.new_album.trim().is_empty() { - let r = app.session.execute("album.create", &json!({"name": d.new_album.trim()})).map_err(|e| e.to_string())?; + let new_album = d.new_album.trim(); + // (one that waits names its new album instead: it is made once the import adds a photo, so a waiting import taken + // out of the line leaves no empty album behind) + if album.is_none() && !new_album.is_empty() && !waits { + let r = app.session.execute("album.create", &json!({"name": new_album})).map_err(|e| e.to_string())?; album = r["id"].as_u64(); } let mode = match (d.copy, d.move_files) { @@ -225,6 +230,8 @@ pub fn start(app: &mut LightcraftApp, d: &ImportDialog) -> Result } if let Some(a) = album { params["album"] = json!(a); + } else if waits && !new_album.is_empty() { + params["albumName"] = json!(new_album); } if !d.preset.is_empty() { params["preset"] = json!(d.preset); @@ -247,50 +254,77 @@ pub fn start(app: &mut LightcraftApp, d: &ImportDialog) -> Result params["dng"] = json!(true); } } + // the review's thumbnails are done with, whether it runs now or later + app.renderer.forget_imports(); + if waits { + return wait_in_line(app, &queue, ¶ms); + } let total = queue.len(); app.import = Some(ImportTask::new(queue, params, undo0, false)); - app.renderer.forget_imports(); Ok(json!({"importing": total})) } -/// Start importing `paths` (files or folders) in the background, e.g. dropped on the window. +/// Start importing `paths` (files or folders) in the background, e.g. dropped on the window; in line, like +/// [`start`], while the library lane is taken. pub fn start_paths(app: &mut LightcraftApp, paths: Vec) -> Result { - busy_synchronizing(app)?; - if running(app) { + if drop_blocked(app) { return Err(crate::i18n::tr("An import is running").to_string()); } + let params = json!({"mode": "add"}); + if library_busy(app) { + return wait_in_line(app, &paths, ¶ms); + } let undo0 = app.session.undo.len(); let total = paths.len(); - app.import = Some(ImportTask::new(paths, json!({"mode": "add"}), undo0, false)); + app.import = Some(ImportTask::new(paths, params, undo0, false)); Ok(json!({"importing": total})) } +/// Start an import that waited in line (`request`, made by [`import_request`]): it plans its work now, against the +/// library as it is, under the id it had while it waited. +pub fn start_request(app: &mut LightcraftApp, ctx: &egui::Context, request: &Request) -> Result<(), String> { + let paths: Vec = + request.params["paths"].as_array().map(|a| a.iter().filter_map(|p| p.as_str().map(str::to_string)).collect()).unwrap_or_default(); + if paths.is_empty() { + return Err("no files to import".into()); + } + if app.import.is_some() { + return Err("an import is running".into()); + } + let undo0 = app.session.undo.len(); + let mut task = ImportTask::new(paths, request.params["params"].clone(), undo0, false); + begin(app, ctx, &mut task)?; + app.import = Some(task); + Ok(()) +} + +/// Plan the import against the library as it is and start its worker, under a row in the activity stack. +fn begin(app: &mut LightcraftApp, ctx: &egui::Context, task: &mut ImportTask) -> Result<(), String> { + let mut p = task.params.clone(); + p["paths"] = json!(task.queue); + let (job, album, name) = lightcraft_engine::cmd::library::import_params(&app.session, &p) + .and_then(|req| Ok((lightcraft_engine::import::ImportJob::new(&mut app.session, req.opts)?, req.album, req.album_name))) + .map_err(|e| e.to_string())?; + let run = ImportRun::start(job, std::mem::take(&mut task.queue), album, name, ctx)?; + if task.auto { + task.keep_selection = Some(app.session.selection.clone()); + } + let label = if task.browse { "Reading folder" } else { "Importing" }; + task.guard = Some(app.session.activity.start("import", label, lightcraft_engine::activity::Cancel::Flag(run.cancel.clone()))); + task.run = Some(run); + Ok(()) +} + /// Advance the import in progress (called every frame): start its worker, then add the batches it /// has readied to the catalog. pub fn tick(app: &mut LightcraftApp, ctx: &egui::Context) { let Some(mut task) = app.import.take() else { return }; - if task.run.is_none() { - let mut p = task.params.clone(); - p["paths"] = json!(task.queue); - let started = lightcraft_engine::cmd::library::import_params(&app.session, &p) - .and_then(|req| Ok((lightcraft_engine::import::ImportJob::new(&mut app.session, req.opts)?, req.album, req.album_name))) - .map_err(|e| e.to_string()) - .and_then(|(job, album, name)| ImportRun::start(job, std::mem::take(&mut task.queue), album, name, ctx)); - if task.auto { - task.keep_selection = Some(app.session.selection.clone()); - } - match started { - Ok(run) => { - let label = if task.browse { "Reading folder" } else { "Importing" }; - task.guard = Some(app.session.activity.start("import", label, lightcraft_engine::activity::Cancel::Flag(run.cancel.clone()))); - task.run = Some(run); - } - Err(e) => { - log::warn!("import: {e}"); - app.toast(ctx, crate::i18n::tr_format!("Import failed: {e}", e = e)); - return; - } - } + if task.run.is_none() + && let Err(e) = begin(app, ctx, &mut task) + { + log::warn!("import: {e}"); + app.toast(ctx, crate::i18n::tr_format!("Import failed: {e}", e = e)); + return; } ctx.request_repaint_after(std::time::Duration::from_millis(100)); let Some(run) = task.run.as_mut() else { return }; diff --git a/crates/ui-egui/src/dialogs/lightroom_destination.rs b/crates/ui-egui/src/dialogs/lightroom_destination.rs index 5fd781cfdd8..7009b0b76a6 100644 --- a/crates/ui-egui/src/dialogs/lightroom_destination.rs +++ b/crates/ui-egui/src/dialogs/lightroom_destination.rs @@ -115,7 +115,7 @@ fn busy(app: &LightcraftApp) -> Result<(), String> { if crate::lightroom_import::is_running(app) { return Err("a Lightroom catalog task is already running; wait for it to finish".into()); } - if app.import.is_some() || app.scan.is_some() { + if app.import.is_some() || app.scan.is_some() || crate::import::library_busy(app) { return Err("an import is running; wait for it to finish before importing a Lightroom catalog".into()); } Ok(()) diff --git a/crates/ui-egui/src/drop_overlay.rs b/crates/ui-egui/src/drop_overlay.rs index dfe8262c8c0..d2ac40229aa 100644 --- a/crates/ui-egui/src/drop_overlay.rs +++ b/crates/ui-egui/src/drop_overlay.rs @@ -52,7 +52,7 @@ fn lines(app: &LightcraftApp, paths: Vec, unknown: bool) -> Vec } else if !drop.photos.is_empty() && app.lightroom.is_some() && !cfg!(target_arch = "wasm32") { // the drop is refused while a Lightroom catalog import owns the catalog out.push(crate::i18n::tr("Finish Lightroom catalog import before adding photos").to_string()); - } else if !drop.photos.is_empty() && crate::import::running(app) && !cfg!(target_arch = "wasm32") { + } else if !drop.photos.is_empty() && crate::import::drop_blocked(app) && !cfg!(target_arch = "wasm32") { out.push(crate::i18n::tr("An import is running. Drop photos when it has finished").to_string()); } else if !drop.photos.is_empty() { let n = drop.photos.len(); diff --git a/crates/ui-egui/src/headless.rs b/crates/ui-egui/src/headless.rs index ab49563cbb8..360b3726ee2 100644 --- a/crates/ui-egui/src/headless.rs +++ b/crates/ui-egui/src/headless.rs @@ -397,6 +397,7 @@ impl Headless { || self.app.scan.is_some() || self.app.sync.is_some() || self.app.sync_run.is_some() + || self.app.sync_queued.is_some() || self.app.import.is_some() || self.app.export.is_some() || self.app.session.denoise_busy() diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 8bf57b341c6..d5d61a75fc1 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -304,6 +304,8 @@ pub struct LightcraftApp { pub sync_owns_changes: bool, /// A Synchronize Folder at work in the background. pub sync_run: Option, + /// A Synchronize Folder that waited in line, scanning its folder again before it runs. + pub sync_queued: Option, /// A Lightroom catalog inspect/import in progress. pub lightroom: Option, /// Last terminal Lightroom result, exposed by the command's status/wait response. diff --git a/crates/ui-egui/src/lightroom_import.rs b/crates/ui-egui/src/lightroom_import.rs index 098c989d5cf..dbc81d17c7c 100644 --- a/crates/ui-egui/src/lightroom_import.rs +++ b/crates/ui-egui/src/lightroom_import.rs @@ -166,7 +166,7 @@ fn busy(app: &LightcraftApp) -> Result<(), String> { if app.lightroom.is_some() { return Err("a Lightroom catalog task is already running".into()); } - if app.import.is_some() || app.scan.is_some() { + if app.import.is_some() || app.scan.is_some() || crate::import::library_busy(app) { return Err("an import is running".into()); } Ok(()) diff --git a/crates/ui-egui/src/sync.rs b/crates/ui-egui/src/sync.rs index 25d7cd84c5a..254db3d52a9 100644 --- a/crates/ui-egui/src/sync.rs +++ b/crates/ui-egui/src/sync.rs @@ -3,11 +3,16 @@ //! changed and what to do about it. Synchronize runs `folder.synchronize`, which acts on exactly //! the scan the dialog showed (see `lightcraft_engine::sync`). Both the scan and the run show a row in the activity //! stack (issue #345); its ✕ stops them like the dialog's Cancel. +//! +//! A Synchronize asked for while an import or another synchronize runs waits in line behind it (the library lane, +//! [`lightcraft_engine::activity::Lane::Library`]). When its turn comes it scans the folder again ([`SyncRescan`]) and +//! then runs as it was asked, but it removes or relinks only the photos its dialog showed: one that went missing +//! meanwhile was never shown to the person, so it is left alone, and the end says so. use std::sync::Arc; use std::sync::atomic::Ordering; -use lightcraft_engine::activity::{Cancel, TaskGuard}; +use lightcraft_engine::activity::{Cancel, Request, TaskGuard}; use lightcraft_engine::sync::{FolderChanges, SyncChoice, SyncCommit, SyncInput, SyncJob, SyncProgress, SyncStep, scan_with}; use serde_json::{Value, json}; @@ -58,7 +63,8 @@ pub fn open(app: &mut LightcraftApp, path: &str, name: &str, disk: bool) -> Resu std::thread::spawn(job); #[cfg(target_arch = "wasm32")] job(); - let guard = app.session.activity.start("sync", "Looking for changes", Cancel::Flag(progress.files.cancel.clone())); + // (kind `scan`, not `sync`: it only reads, and doesn't hold up an import) + let guard = app.session.activity.start("scan", "Looking for changes", Cancel::Flag(progress.files.cancel.clone())); guard.detail(name); app.sync = Some(SyncTask { path: path.to_string(), name: name.to_string(), progress, rx, guard }); let d = SyncChoice::default(); @@ -221,25 +227,37 @@ pub fn body(app: &LightcraftApp, ui: &mut egui::Ui, dlg: &mut Dialog) { /// thread at once ([`SyncRun`]); nothing is read from disk on the UI thread. A scan that went /// stale (the folder's photos changed meanwhile) is refused and made again, keeping the choices. /// A folder that is up to date has nothing to hand over: confirming it only closes the dialog. +/// While an import or another synchronize runs it waits in line instead ([`SyncRescan`]). pub fn confirm(app: &mut LightcraftApp, dlg: &Dialog) -> Result { let Dialog::SynchronizeFolder { path, name, disk, counts: Some(counts), import_new, relink_moved, remove_missing, read_metadata, .. } = dlg else { return Err("the folder is still being scanned".into()); }; - // (before the busy checks: nothing is imported or written, so a running import or - // synchronize can't clash with it, and the dialog closes either way. Like every result the + // (before the line: nothing is imported or written, so a running import or + // synchronize can't clash with it and it has nothing to wait for; the dialog closes either way. Like every result the // dialog shows, it is the scan's: a file added since is found by the next Synchronize) if counts.up_to_date() { return Ok(json!({"upToDate": true})); } - if app.sync_run.is_some() { - return Err(crate::i18n::tr("A folder is already being synchronized").to_string()); - } + let choice = SyncChoice { import_new: *import_new, relink_moved: *relink_moved, remove_missing: *remove_missing, read_metadata: *read_metadata }; // (an import readies its files against the library as it was: both could add the same file) - if app.import.is_some() { - return Err(crate::i18n::tr("Wait for the import to finish").to_string()); + if crate::import::library_busy(app) { + // what the dialog showed: only these are removed or relinked, whenever the run comes + let shown = app + .session + .folder_changes + .as_ref() + .filter(|c| lightcraft_catalog::query::folder_key(&c.path) == lightcraft_catalog::query::folder_key(path)); + let (missing, moved): (Vec, Vec) = + shown.map(|c| (c.missing.iter().map(|m| m.id).collect(), c.moved.iter().map(|m| m.id).collect())).unwrap_or_default(); + let request = sync_request(path, name, *disk, choice, &missing, &moved); + if std::mem::take(&mut app.sync_owns_changes) { + app.session.folder_changes = None; + } + let (id, place) = app.session.activity.enqueue("sync", "Synchronizing folder", request)?; + app.queued_toast(place as u64); + return Ok(json!({"queued": id, "place": place})); } - let choice = SyncChoice { import_new: *import_new, relink_moved: *relink_moved, remove_missing: *remove_missing, read_metadata: *read_metadata }; app.sync_owns_changes = false; let started = match app.session.take_folder_changes(path) { Some(changes) => SyncJob::start(&mut app.session, changes, choice).map_err(|e| e.to_string()), @@ -259,6 +277,23 @@ pub fn confirm(app: &mut LightcraftApp, dlg: &Dialog) -> Result { } }; let progress = Arc::new(SyncProgress::default()); + let guard = app.session.activity.start("sync", "Synchronizing folder", Cancel::Flag(progress.files.cancel.clone())); + guard.detail(name); + run(app, name, work, commit, progress, guard, 0); + Ok(json!({"started": true})) +} + +/// Hand the work of a synchronize to a worker thread, its steps committed between frames ([`poll_run`]). `left_alone`: +/// photos found missing (or moved) that its dialog never showed, said at the end. +fn run( + app: &mut LightcraftApp, + name: &str, + work: lightcraft_engine::sync::SyncWork, + commit: SyncCommit, + progress: Arc, + guard: TaskGuard, + left_alone: usize, +) { let crashed = Arc::new(std::sync::atomic::AtomicBool::new(false)); let (tx, rx) = std::sync::mpsc::channel(); let (p, c) = (progress.clone(), crashed.clone()); @@ -273,10 +308,138 @@ pub fn confirm(app: &mut LightcraftApp, dlg: &Dialog) -> Result { std::thread::spawn(job); #[cfg(target_arch = "wasm32")] job(); + app.sync_run = Some(SyncRun { + name: name.to_string(), + progress, + crashed, + rx, + commit: Some(commit), + stopping: false, + not_saved: Vec::new(), + guard, + left_alone, + }); +} + +/// The command of a Synchronize Folder's request ([`Request`]): the app runs it ([`start_request`]). +pub const SYNC_REQUEST: &str = "app:synchronize"; + +/// What a synchronize was asked, to run it later in line or again: the folder, the dialog's choices, and the missing +/// and moved photos it showed (the only ones it may remove or relink). +fn sync_request(path: &str, name: &str, disk: bool, choice: SyncChoice, missing: &[u64], moved: &[u64]) -> Request { + Request { + command: SYNC_REQUEST.into(), + params: json!({ + "path": path, "name": name, "disk": disk, + "importNew": choice.import_new, "relinkMoved": choice.relink_moved, "removeMissing": choice.remove_missing, "readMetadata": choice.read_metadata, + "missing": missing, "moved": moved, + }), + } +} + +/// A synchronize that waited in line, scanning its folder again on a worker thread before it runs ([`poll_rescan`]). +pub struct SyncRescan { + name: String, + choice: SyncChoice, + /// The missing and moved photos its dialog showed. + missing: std::collections::HashSet, + moved: std::collections::HashSet, + /// The library it was asked in ([`lightcraft_engine::Session::library_generation`]): its photo ids mean nothing in + /// another one. + library: u64, + progress: Arc, + rx: std::sync::mpsc::Receiver, + /// Its row, from the line through the scan to the end of the run. + guard: TaskGuard, +} + +/// Start a synchronize that waited in line (`request`, made by [`sync_request`]): it scans the folder again, under the +/// row it had while it waited, and runs when the scan is in ([`poll_rescan`]). +pub fn start_request(app: &mut LightcraftApp, _ctx: &egui::Context, request: &Request) -> Result<(), String> { + let p = &request.params; + let path = p["path"].as_str().ok_or("no folder to synchronize")?; + let name = p["name"].as_str().unwrap_or(path).to_string(); + let flag = |k: &str| p[k].as_bool().unwrap_or(false); + let ids = |k: &str| p[k].as_array().map(|a| a.iter().filter_map(Value::as_u64).collect()).unwrap_or_default(); + let choice = SyncChoice { + import_new: flag("importNew"), + relink_moved: flag("relinkMoved"), + remove_missing: flag("removeMissing"), + read_metadata: flag("readMetadata"), + }; + let input = SyncInput::new(&mut app.session, path, flag("disk")).map_err(|e| e.to_string())?; + let progress = Arc::new(SyncProgress::default()); + let (tx, rx) = std::sync::mpsc::channel(); + let pr = progress.clone(); + let job = move || { + let _ = tx.send(scan_with(input, &pr)); + }; + #[cfg(not(target_arch = "wasm32"))] + std::thread::spawn(job); + #[cfg(target_arch = "wasm32")] + job(); let guard = app.session.activity.start("sync", "Synchronizing folder", Cancel::Flag(progress.files.cancel.clone())); - guard.detail(name); - app.sync_run = Some(SyncRun { name: name.clone(), progress, crashed, rx, commit: Some(commit), stopping: false, not_saved: Vec::new(), guard }); - Ok(json!({"started": true})) + guard.detail(&name); + let library = app.session.library_generation(); + app.sync_queued = Some(SyncRescan { name, choice, missing: ids("missing"), moved: ids("moved"), library, progress, rx, guard }); + Ok(()) +} + +/// Run the waiting synchronize once its scan is in (called every frame): only the missing and moved photos its dialog +/// showed are acted on. +pub fn poll_rescan(app: &mut LightcraftApp, ctx: &egui::Context) { + let Some(task) = app.sync_queued.as_ref() else { return }; + let (done, total) = task.progress.counts(); + task.guard.progress(done as u64, total as u64); + ctx.request_repaint_after(std::time::Duration::from_millis(100)); + let got = task.rx.try_recv(); + if matches!(got, Err(std::sync::mpsc::TryRecvError::Empty)) && !task.guard.is_cancelled() { + return; + } + let Some(task) = app.sync_queued.take() else { return }; + let SyncRescan { name, choice, missing, moved, library, progress, guard, .. } = task; + if library != app.session.library_generation() { + // another library was opened while it scanned: its photos are not these + progress.files.cancel.store(true, Ordering::Relaxed); + app.toast(ctx, format!("{name}: {}", crate::i18n::tr("Another library was opened: nothing was done"))); + return; + } + let mut changes = match got { + _ if guard.is_cancelled() => { + progress.files.cancel.store(true, Ordering::Relaxed); + return; + } + Ok(c) => c, + Err(_) => { + // the scan's worker died (a panic, logged) + app.toast(ctx, crate::i18n::tr("Scan failed")); + return; + } + }; + if changes.offline { + let why = crate::i18n::tr("This folder isn't there: it was moved or renamed, or its disk isn't connected.").to_string(); + app.toast(ctx, format!("{name}: {why}")); + return; + } + // only what the person saw is removed or relinked; what they would have been asked about is said + let (missing_before, moved_before) = (changes.missing.len(), changes.moved.len()); + changes.missing.retain(|m| missing.contains(&m.id)); + changes.moved.retain(|m| moved.contains(&m.id)); + let left_alone = if choice.remove_missing { missing_before - changes.missing.len() } else { 0 } + + if choice.relink_moved { moved_before - changes.moved.len() } else { 0 }; + match SyncJob::start(&mut app.session, changes, choice) { + Ok((work, commit)) => { + // (a fresh count, the same ✕: its row's flag stops the run as it stopped the scan) + let run_progress = Arc::new(SyncProgress { + files: lightcraft_engine::import::ScanProgress { cancel: progress.files.cancel.clone(), ..Default::default() }, + ..Default::default() + }); + run(app, &name, work, commit, run_progress, guard, left_alone); + } + Err(e) => { + app.toast(ctx, format!("{name}: {e}")); + } + } } /// A synchronize at work: the file-system half on a worker thread, its steps committed here @@ -294,6 +457,8 @@ pub struct SyncRun { stopping: bool, /// Its row in the activity stack (its ✕ is Cancel). guard: TaskGuard, + /// Photos found missing or moved that its dialog never showed (a run that waited in line): left alone, and said. + left_alone: usize, } impl SyncRun { @@ -333,6 +498,7 @@ pub(crate) fn stall_run(app: &mut LightcraftApp, name: &str) -> Box 0 { + parts.push(crate::i18n::tr_format!("{n} more missing, left alone: synchronize again to review them", n = left_alone)); + } let text = if parts.is_empty() { crate::i18n::tr("The library is up to date with this folder.").to_string() } else { parts.join(" · ") }; if not_saved.is_empty() && !crashed { app.toast(ctx, format!("{name}: {text}")); diff --git a/crates/ui-egui/src/tests/drop_import.rs b/crates/ui-egui/src/tests/drop_import.rs index 3d8031a69bd..a4094d8a1ee 100644 --- a/crates/ui-egui/src/tests/drop_import.rs +++ b/crates/ui-egui/src/tests/drop_import.rs @@ -822,18 +822,37 @@ fn a_waiting_review_never_replaces_a_running_import() { h.step(); let Some(review) = h.app.ui.dialog.clone() else { panic!("the review opens once the dialog is closed") }; assert!(matches!(review, Dialog::Import { .. })); - // an import that started anyway (a Local folder browse, say) is the one that runs + // an import that started anyway (a Local folder browse, say) is the one that runs: the review's OK waits behind it h.app.import = Some(crate::import::ImportTask::new(vec![dir.path("more")], json!({"mode": "add"}), 0, false)); - assert!(crate::panels::dialogs::confirm_dialog(&mut h.app, &review).is_err(), "the review's OK is refused"); + let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &review); + assert!(r.as_ref().is_ok_and(|v| v["queued"].as_u64().is_some()), "the review's OK waits in line: {r:?}"); assert_eq!(h.app.import.as_ref().map(|t| t.total), Some(1), "the running import stays"); - assert!(h.step_until(SETTLE, |h| h.app.import.is_none()), "it runs to the end"); - assert_eq!(photos(&h), 1, "only the running import's photo arrives"); + assert!(h.step_until(SETTLE, |h| h.app.import.is_none() && h.app.session.activity.list().is_empty()), "both run to the end"); + assert_eq!(photos(&h), 3, "the running import's photo arrives, then the review's two"); } -/// A drop while an import runs would open a review whose OK replaces the running import: it is +/// Given an import that runs, when photos are dropped directly on the window, then they are not refused: they wait in +/// line behind it and are imported when it ends. +#[test] +fn a_direct_drop_while_an_import_runs_waits_in_line() { + let dir = Scratch::new("running-waits"); + let mut h = app(&dir); + h.app.ui.settings.import_dropped_directly = true; + write_png(&dir.path("more/c.png"), 3); + // (held by a row of the lane, so that it can't finish between the frames of the drop) + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + drop_files(&mut h, &[dir.path("trip")], false); + assert_eq!(h.app.session.activity.waiting().iter().map(|t| t.kind).collect::>(), vec!["import"]); + assert!(h.app.ui.toast.as_ref().is_some_and(|t| t.0.starts_with("Queued")), "{:?}", h.app.ui.toast); + drop(hold); + assert!(h.step_until(SETTLE, |h| h.app.import.is_none() && h.app.session.activity.list().is_empty()), "both run to the end"); + assert_eq!(photos(&h), 2, "the dropped folder's two photos"); +} + +/// A drop while a scan runs would open a review whose OK replaces the import the scan starts: it is /// refused instead, and the card says so. #[test] -fn a_drop_while_an_import_runs_is_refused() { +fn a_drop_while_a_scan_runs_is_refused() { let dir = Scratch::new("running"); let mut h = app(&dir); write_png(&dir.path("more/c.png"), 3); @@ -851,9 +870,9 @@ fn a_drop_while_an_import_runs_is_refused() { assert_eq!(photos(&h), 0); } -/// An import that is running stays the one that runs: a direct drop doesn't start a second. +/// A scan that is running stays the one that runs: a direct drop doesn't start a second import beside it. #[test] -fn a_direct_drop_while_an_import_runs_is_refused_too() { +fn a_direct_drop_while_a_scan_runs_is_refused_too() { let dir = Scratch::new("running-direct"); let mut h = app(&dir); h.app.ui.settings.import_dropped_directly = true; diff --git a/crates/ui-egui/src/tests/sync.rs b/crates/ui-egui/src/tests/sync.rs index 84cda586021..362f4c1a7f9 100644 --- a/crates/ui-egui/src/tests/sync.rs +++ b/crates/ui-egui/src/tests/sync.rs @@ -18,6 +18,12 @@ //! * While the folder is listed (minutes, on a network share), the scan's row says how many //! folders and files it has listed, with a bar that moves on its own, not "0 of 64085"; then it //! counts the files and photos checked. +//! * A Synchronize Folder and an import never run at once: one asked for while the other runs waits in line behind it +//! and starts by itself, planning its work then (an import checks for duplicates against the library as it is +//! when it starts; a synchronize scans the folder again). +//! * A synchronize that waited removes or relinks only the photos its dialog showed: a photo that went missing while +//! it waited stays, and the end says so. +//! * The dialog's own scan doesn't hold up an import: it only reads. use std::time::Duration; @@ -292,33 +298,137 @@ fn a_stopped_synchronize_says_it_was_stopped_and_stays_at_most_one_step() { assert!(h.app.session.undo.len() <= steps + 1, "what was done by then is at most one step"); } +fn sync_dialog(dir: &Scratch, remove_missing: bool) -> Dialog { + Dialog::SynchronizeFolder { + path: dir.path("trip"), + name: "trip".into(), + disk: false, + counts: Some(crate::state::SyncCounts { new: 1, ..Default::default() }), + import_new: true, + relink_moved: true, + remove_missing, + read_metadata: false, + } +} + +/// Every task done, nothing waiting. +fn idle(h: &Headless) -> bool { + h.app.sync_run.is_none() && h.app.import.is_none() && h.app.session.activity.list().is_empty() +} + +/// Given a synchronize running, when the same folder is dropped on the window, then the import waits in line behind +/// it and starts by itself once it ends, adding nothing twice (it plans its work then). The other way round: a +/// synchronize confirmed while an import runs waits for it, and then synchronizes. #[test] -fn a_synchronize_and_an_import_never_run_at_once() { +fn a_synchronize_and_an_import_wait_for_each_other() { let dir = Scratch::new("exclusive"); let mut h = changed_folder(&dir); open_and_scan(&mut h, &dir.path("trip")); let dlg = h.app.ui.dialog.take().expect("the dialog is open"); assert!(crate::panels::dialogs::confirm_dialog(&mut h.app, &dlg).is_ok()); // dropping the same folder on the window while the run works would add its files twice - let r = crate::import::start_paths(&mut h.app, vec![dir.path("trip")]); - assert!(r.is_err(), "no import while synchronizing: {r:?}"); - assert!(h.step_until(T, |h| h.app.sync_run.is_none())); + write_png(&dir.path("elsewhere/e.png"), 9); + let r = crate::import::start_paths(&mut h.app, vec![dir.path("trip"), dir.path("elsewhere/e.png")]).expect("it waits instead of being refused"); + let id = r["queued"].as_u64().unwrap_or_else(|| panic!("queued: {r}")); + let waiting = h.app.session.activity.waiting(); + assert_eq!(waiting.iter().map(|t| (t.id, t.kind, t.label.as_str())).collect::>(), vec![(id, "import", "Importing")]); + assert!(h.app.ui.toast.as_ref().is_some_and(|t| t.0.starts_with("Queued")), "{:?}", h.app.ui.toast); + assert!(h.step_until(SETTLE, idle), "both ran"); + let c = h.app.session.catalog.photos().filter(|p| p.in_library() && p.file_name == "c.png").count(); + assert_eq!(c, 1, "the import found c already in the library when its turn came"); + assert!(in_library(&h).contains(&"e.png".to_string()), "and it ran: {:?}", in_library(&h)); // and the other way round: an import is running (no frame has run since it started) + write_png(&dir.path("trip/d.png"), 4); let r = crate::import::start_paths(&mut h.app, vec![dir.path("trip/a.png")]); - assert!(r.is_ok(), "{r:?}"); - assert!(h.app.import.is_some()); - let d = Dialog::SynchronizeFolder { - path: dir.path("trip"), - name: "trip".into(), - disk: false, - counts: Some(crate::state::SyncCounts { new: 1, ..Default::default() }), - import_new: true, - relink_moved: true, - remove_missing: false, - read_metadata: false, - }; - let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &d); - assert!(r.is_err() && h.app.sync_run.is_none(), "no synchronize while importing: {r:?}"); + assert!(r.as_ref().is_ok_and(|v| v.get("importing").is_some()), "{r:?}"); + let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &sync_dialog(&dir, false)); + assert!(r.as_ref().is_ok_and(|v| v.get("queued").is_some()), "the synchronize waits: {r:?}"); + assert!(h.app.sync_run.is_none()); + assert!(h.step_until(SETTLE, idle), "both ran"); + assert!(in_library(&h).contains(&"d.png".to_string()), "the synchronize scanned the folder at its turn: {:?}", in_library(&h)); +} + +/// Given a synchronize that will remove the one missing photo its dialog showed (b), waiting behind an import, when +/// another photo of the folder (a) goes missing while it waits, then at its turn it removes b only: a stays, and the +/// end says one more is missing and was left alone. +#[test] +fn a_waiting_synchronize_removes_only_the_missing_photos_its_dialog_showed() { + let dir = Scratch::new("reviewed"); + let mut h = changed_folder(&dir); + open_and_scan(&mut h, &dir.path("trip")); + tick_remove_missing(&mut h); + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + let dlg = h.app.ui.dialog.take().expect("the dialog is open"); + let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &dlg); + assert!(r.as_ref().is_ok_and(|v| v.get("queued").is_some()), "it waits for the import: {r:?}"); + std::fs::remove_file(dir.path("trip/a.png")).unwrap(); + drop(hold); + assert!(h.step_until(SETTLE, idle), "it ran"); + assert_eq!(in_library(&h), vec!["a.png", "c.png"], "b (shown) was removed, a (gone since) was not"); + let said = h.app.ui.toast.iter().map(|t| t.0.clone()).collect::(); + assert!(said.contains("1 more missing"), "{said}"); +} + +/// Given a Local folder being read, when a synchronize is confirmed, then it waits: the read becomes an import when +/// it finishes, and the two would run side by side. +#[test] +fn a_synchronize_confirmed_while_a_local_folder_is_read_waits() { + let dir = Scratch::new("browse"); + let mut h = changed_folder(&dir); + let _scan = crate::import::stall_scan_of(&mut h.app, true); + let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &sync_dialog(&dir, false)); + assert!(r.as_ref().is_ok_and(|v| v.get("queued").is_some()), "{r:?}"); + assert!(h.app.sync_run.is_none()); + h.app.scan = None; +} + +/// Given a waiting synchronize that has started scanning its folder again, when another library is opened before the +/// scan is in, then it stops without touching the new library: its photo ids were the old library's. +#[test] +fn a_waiting_synchronize_never_acts_on_another_library() { + let dir = Scratch::new("switch"); + let mut h = changed_folder(&dir); + open_and_scan(&mut h, &dir.path("trip")); + tick_remove_missing(&mut h); + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + let dlg = h.app.ui.dialog.take().expect("the dialog is open"); + assert!(crate::panels::dialogs::confirm_dialog(&mut h.app, &dlg).is_ok_and(|v| v["queued"].as_u64().is_some()), "it waits"); + drop(hold); + // one frame: it starts scanning; the next library opens before the scan is looked at + assert!(h.step_until(T, |h| h.app.sync_queued.is_some()), "it started scanning again"); + h.app.session.open_library(dir.path("other"), false).unwrap(); + assert!(h.step_until(SETTLE, idle), "it ended"); + assert_eq!(h.app.session.catalog.photos().count(), 0, "nothing came into the new library, nothing was removed"); + let said = h.app.ui.toast.iter().map(|t| t.0.clone()).collect::(); + assert!(said.contains("Another library was opened"), "{said}"); +} + +/// Given a synchronize waiting in line, when its folder is gone by its turn, then it ends saying so and changes +/// nothing. +#[test] +fn a_waiting_synchronize_whose_folder_went_away_says_so() { + let dir = Scratch::new("gone"); + let mut h = changed_folder(&dir); + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &sync_dialog(&dir, false)); + assert!(r.is_ok_and(|v| v["queued"].as_u64().is_some()), "it waits"); + std::fs::rename(dir.path("trip"), dir.path("trip-away")).unwrap(); + drop(hold); + assert!(h.step_until(SETTLE, idle), "it ended"); + let said = h.app.ui.toast.iter().map(|t| t.0.clone()).collect::(); + assert!(said.contains("isn't there"), "{said}"); + assert!(!in_library(&h).contains(&"c.png".to_string()), "{:?}", in_library(&h)); +} + +/// The dialog's scan only reads: an import dropped on the window while it scans starts at once. +#[test] +fn the_dialogs_scan_doesnt_hold_up_an_import() { + let dir = Scratch::new("scan-free"); + let mut h = changed_folder(&dir); + crate::sync::open(&mut h.app, &dir.path("trip"), "trip", false).unwrap(); + let r = crate::import::start_paths(&mut h.app, vec![dir.path("trip/c.png")]); + assert!(r.as_ref().is_ok_and(|v| v.get("importing").is_some()), "{r:?}"); + h.settle(SETTLE); } #[test] @@ -357,7 +467,7 @@ fn the_folders_scan_shows_a_row_and_its_cross_closes_the_dialog() { crate::sync::open(&mut h.app, &dir.path("trip"), "trip", false).unwrap(); let rows = h.app.session.activity.list(); assert_eq!(rows.len(), 1, "{rows:?}"); - assert_eq!((rows[0].kind, rows[0].label.as_str(), rows[0].detail.as_str()), ("sync", "Looking for changes", "trip")); + assert_eq!((rows[0].kind, rows[0].label.as_str(), rows[0].detail.as_str()), ("scan", "Looking for changes", "trip")); assert!(rows[0].cancellable); h.app.session.activity.cancel(rows[0].id).unwrap(); h.step(); diff --git a/docs/background-tasks.md b/docs/background-tasks.md index 128bd60e3ce..2299e894dcd 100644 --- a/docs/background-tasks.md +++ b/docs/background-tasks.md @@ -51,15 +51,30 @@ guard.detail(&file_name); ## Waiting in line -Jobs that must not run side by side share a lane (`activity::Lane`; for now only the preview builds: Build Previews and -the background Build / Discard Smart Previews). A call that sets `queue: true` while its lane is busy does not fail: +Jobs that must not run side by side share a lane (`activity::Lane`). There are two so far: + +- **The preview lane:** Build Previews and the background Build / Discard Smart Previews, one preview build at a time. +- **The library lane:** imports (the import review's Import, files dropped on the window) and Synchronize Folder. + Each plans its work against the library as it is when it starts, so two side by side could add the same file. An + import asked for while the lane is taken is not refused any more: it waits and checks for duplicates against the + library as it is when its turn comes. A Synchronize Folder that waits scans its folder again at its turn, then + removes or relinks only the photos its dialog showed: one that went missing while it waited was never shown, so it + is left alone and the end says so ("1 more missing, left alone: synchronize again to review them"). If another + library is opened while it scans, or its folder is gone, it stops without doing anything and a toast says so. A + toast says it was queued when it was put in line. The dialog's own scan ("Looking for changes", kind `scan`) only + reads and holds up nothing. These requests are the app's (`app:import`, `app:synchronize`): the app starts them + (`LightcraftApp::start_waiting`, every frame), and the engine leaves them alone (`Activity::take_ready_if`). Auto + Import waits until nothing runs, rescans or waits in this lane. A drop while an import's review is open or a scan + runs is still refused. + +A call that sets `queue: true` while its lane is busy does not fail: `Activity::enqueue` keeps what it was asked (`Request`: the command and its parameters, with the photos written out) and `Session::start_waiting` runs it, under the id it had in line, once the lane is free. The engine calls it after every command and the app every frame. `activity.list` shows a waiting task after the running ones (`waiting`, `place`, `lane`); the activity stack in the app draws only running tasks. `activity.cancel` takes a waiting task out of the line, `activity.cancel {all: true}` empties it, and opening another library drops it: the photos it names belong to the old one. At most `MAX_WAITING` (100) tasks wait. Without `queue` a call is refused while its lane is -busy, as before. A waiting task whose start fails (there is no smart previews folder any more, say) is logged and the next in line goes on. +busy, as before. A waiting task whose start fails (there is no smart previews folder any more, say) is logged (the app's own, an import or a Synchronize Folder, also says why in a toast) and the next in line goes on. ## Examples in the code diff --git a/docs/control-protocol.md b/docs/control-protocol.md index fc0dccf4cc4..b7f0e0c7e07 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -90,13 +90,13 @@ filmstrip is visible. | `ui.scroll` | `{dx, dy, source?, unit?, phase?, cmd?, ctrl?, shift?, alt?}` | Wheel / two-finger scroll at the current pointer; pans over the image, modifier-scroll zooms. `source` is `unknown` (default), `wheel`, `trackpad` or `momentum`; `unit` is `point` (default), `line` or `page`; `phase` is `move` (default), `start`, `end` or `cancel`. Wheel/line events drive the grid/filmstrip one-third wheel step and the loupe's notch zoom; trackpad/momentum phases drive kinetic scrolling and rubber-band boundaries. Invalid values are refused and queue nothing | | `ui.zoom` | `{factor}` | Pinch zoom at the current pointer (positive scale multiplier; 1 = unchanged). Position it first with `ui.move` or `ui.hoverWidget` | | `ui.set` | partial UI state, e.g. `{"view": "detail"}` | Resulting UI state | -| `ui.dialog.confirm` / `ui.dialog.cancel` | — | Close the open dialog (confirm runs its action; Synchronize Folder on a folder that is up to date answers `{"upToDate": true}` and starts nothing) | +| `ui.dialog.confirm` / `ui.dialog.cancel` | — | Close the open dialog (confirm runs its action; Synchronize Folder on a folder that is up to date answers `{"upToDate": true}` and starts nothing; the Import review and Synchronize Folder answer `{queued, place}` instead of `{importing}` / `{started}` while an import or a synchronize runs: the task waits in line and starts by itself) | | `ui.resize` | `{width, height}` | Resize the window | | `ui.dropFiles` | `{paths: [..], hover?}` | Files dragged from the file manager. `hover: true` makes every following frame report `paths` as hovered over the window (the drop card appears, `ui.widgets` lists `dropOverlay`) until another `ui.dropFiles` replaces them; `{paths: [], hover: true}` ends the hover. Without `hover` the files are dropped: the hover ends and the next frame receives them as dropped files, exactly as an OS drop arrives (photos and folders open the import review, or import at once with Settings ▸ Import ▸ Import dropped files without review). An empty path stands for a file whose path the platform doesn't tell | | `ui.zoomFactor` | `{factor}` | Set the interface scale (0.5–3; egui's zoom keys are off, Cmd+= / Cmd+- zoom the photo) | | `ui.screenshot` | `{path?, headless?}` | `{path, width, height}` once the frame (with finished renders) is captured. A `path` that did not exist when the request was admitted is written with create-new semantics and is never replaced if a file (including a newly imported original) appears there while the capture is queued; an existing ordinary file may be refreshed. `headless: true` draws the UI on the CPU (no compositor needed); a windowed capture that gets no frame within 2 s falls back to headless automatically. While the loupe still waits for a render, `ui.widgets {filter: "loupe:rendering"}` lists its "Rendering…" pill; `loupe:renderFailed` is the pill saying a render failed behind a stand-in; Compare and Reference panes have their own (`compare:rendering:`, `compare:renderFailed:`) | | `engine.execute {command: "app.export", params}` | export params (see `docs/mcp.md`), plus `preset`, `dir` / `path`, `ids`, `background`; `destinationMode: "sameAsOriginal"` writes each photo into its original's folder (+ `subfolder`) instead of `dir` | Writes the files and returns `{files}` (one `{path, width, height, bytes, sidecars}` per file, plus `gpuFallback` — why that render fell back from the GPU to the CPU — when it did; see `docs/gpu-pipeline.md`); with `background: true` (what the Export dialog and menus use) it returns `{background: true, total}` at once and the batch runs on a worker thread — poll `ui.inspect` → `export` | -| `engine.execute {command: "activity.list"}` | — | The long-running tasks in flight (imports, exports, preview builds, downloads, the face scan…), oldest first: `{tasks: [{id, kind, label, done, total, unit, detail, cancellable, cancelling, ageMs, waiting, place, lane}]}`, then the tasks waiting in line for one of their lane (`waiting: true`, `place` 1 = next in its lane, `lane: "previews"`, `done` and `total` 0; `queue: true` on `library.buildPreviews` / `library.smartPreviews` puts a build there instead of refusing it); `total` 0 = not known yet; `unit` is `count`, `bytes` or `percent`; `label` is English (the app shows it translated) | +| `engine.execute {command: "activity.list"}` | — | The long-running tasks in flight (imports, exports, preview builds, downloads, the face scan…), oldest first: `{tasks: [{id, kind, label, done, total, unit, detail, cancellable, cancelling, ageMs, waiting, place, lane}]}`, then the tasks waiting in line for one of their lane (`waiting: true`, `place` 1 = next in its lane, `lane: "previews"` or `"library"`, `done` and `total` 0; `queue: true` on `library.buildPreviews` / `library.smartPreviews` puts a build there instead of refusing it; the app puts its own imports and Synchronize Folder there, `lane: "library"`); `total` 0 = not known yet; `unit` is `count`, `bytes` or `percent`; `label` is English (the app shows it translated) | | `engine.execute {command: "activity.cancel"}` | `{id}` or `{all: true}` | Asks the task (or every cancellable one) to stop at its next file or photo (a waiting task leaves the line and never runs; `all` empties it) → `{cancelled: n}`; an unknown id (it may have just finished) or a task that can't be cancelled is an error | | `ui.render` | `{id?, size?, path?}` | Render a photo (PNG to `path`), `{width, height}` | | `engine.execute {command: "slideshow.layout"}` | `{margins?, marginLeft?, …, zoomToFill?, strokeBorder?, castShadow?, backdropColor?, colorWash?, backgroundImage?, …}` (see `engine.commands`) | The slideshow's slide layout (Layout, Options, Backdrop), saved with the library; omitted keys keep their value, `{}` reads it; out-of-range numbers are clamped, a wrong type or unknown key is refused and nothing changes | diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 90cfc248f60..78eee63fcbf 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder wait for each other instead of refusing; earlier: LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -461,7 +461,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-BEHAV-BATCH | Batch apply to selection | P0 | ✅ | `cmd:photo.rate`, `cmd:develop.paste`, `cmd:preset.apply`, `cmd:app.export` | | | LR-BEHAV-PREVIEW-HOVER | Hover previews | P1 | ✅ | `crates/ui-egui/src/panels/presets.rs`, `crates/ui-egui/src/panels/profiles.rs`, `crates/ui-egui/src/panels/right.rs` (`versions`), `crates/ui-egui/src/panels/detail.rs` | presets, profile menu, profile browser and versions preview in the loupe | | LR-BEHAV-PROGRESSIVE | Progressive rendering | P0 | ✅ | `crates/engine/src/media.rs`, `crates/preview/src/lib.rs` | | -| LR-BEHAV-BG-TASKS | Background tasks | P0 | ✅ | `cmd:activity.list`, `cmd:activity.cancel`, `crates/engine/src/activity.rs`, `crates/ui-egui/src/panels/activity.rs`, `crates/ui-egui/src/widgets/progress.rs`, `docs/background-tasks.md`, `crates/preview/src/lib.rs` (`JobPool`) | renders off the UI thread; exports run several photos of a batch side by side (`export_parallelism`, memory-gated; files, names and order as one at a time, #496); one activity stack in the top-left corner under the top bar, as in Lightroom Classic (issue #345): imports, folder scans, exports (and the contact sheet PDF), Synchronize Folder (its scan and its run), Build / Smart Previews, Lightroom catalog inspect / import, Photo Merge, model downloads (SAM 3, face, AI Denoise), the face scan, AI Denoise, Find Missing Photos and Reload from Disk (`cmd:photo.reload`, its files decoded on a worker thread, cancellable; `wait: true` for agents) each show a row (name, progress bar or a sweep while the amount isn't known, count and current item) once 0.5 s old, three rows then "+N more"; ✕ cancels the jobs that can stop ("Stopping…" until they do); quitting asks while a cancellable task runs; agents and `ui.inspect` (`activity`) see the same list. No pause (Lightroom can pause some tasks) | +| LR-BEHAV-BG-TASKS | Background tasks | P0 | ✅ | `cmd:activity.list`, `cmd:activity.cancel`, `crates/engine/src/activity.rs`, `crates/ui-egui/src/panels/activity.rs`, `crates/ui-egui/src/widgets/progress.rs`, `docs/background-tasks.md`, `crates/preview/src/lib.rs` (`JobPool`) | renders off the UI thread; exports run several photos of a batch side by side (`export_parallelism`, memory-gated; files, names and order as one at a time, #496); one activity stack in the top-left corner under the top bar, as in Lightroom Classic (issue #345): imports, folder scans, exports (and the contact sheet PDF), Synchronize Folder (its scan and its run), Build / Smart Previews, Lightroom catalog inspect / import, Photo Merge, model downloads (SAM 3, face, AI Denoise), the face scan, AI Denoise, Find Missing Photos and Reload from Disk (`cmd:photo.reload`, its files decoded on a worker thread, cancellable; `wait: true` for agents) each show a row (name, progress bar or a sweep while the amount isn't known, count and current item) once 0.5 s old, three rows then "+N more"; ✕ cancels the jobs that can stop ("Stopping…" until they do); quitting asks while a cancellable task runs; agents and `ui.inspect` (`activity`) see the same list; an import and a Synchronize Folder never run at once: one asked for while the other runs waits in line and starts by itself (the library lane, `activity::Lane`). No pause (Lightroom can pause some tasks) | | LR-BEHAV-OFFLINE | Offline editing | P1 | ✅ | | local-first: everything works offline | | LR-BEHAV-WEB-SAFETY | Library safety in the browser build | P1 | 🟡 | `cmd:file.backupLibrary`, `cmd:file.restoreLibrary`, `apps/lightcraft-web/src/safety.rs`, `apps/lightcraft-web/src/backup.rs`, `apps/lightcraft-web/src/files.rs` | web only (experimental): Back Up Library (zip of the catalog and every stored original) and a non-destructive Restore; failed saves show as unsaved and are retried; a photo that can't be stored isn't added; one tab per library (Web Locks); notices for storage that isn't persistent and for a library that can't open; `?reset` asks first; a panic shows a message. Missing: `?safe` start, deleting originals of removed photos, zip64 (backups > 4 GB) | | LR-BEHAV-GPU | GPU acceleration | P0 | ✅ | `crates/gpu/src/render.rs`, `cmd:app.gpu`, `docs/gpu-pipeline.md`, `crates/ui-egui/src/panels/notices.rs` | CPU fallback per render on device limits, out of memory, device errors / loss, incomplete or black results (`perf.gpuReason`, `perf.gpuFallback`; each render reports its own reason — `lightcraft_gpu::try_render`, `gpuFallback` per exported file — issue #675); short submissions for slow iGPUs; backend choice (DX12 only on Windows, `LIGHTCRAFT_GPU_BACKEND` / `WGPU_BACKEND`), device created after the window opens, crash sentinel (issue #136); a GPU lost while LightCraft runs (driver reset) stops it with that message and turns GPU rendering off for the next start, which says why (issue #1337; the window's renderer can't survive the lost device); quitting waits (up to 2 s) for renders in flight and starts no new GPU work, so none is inside the driver when the process exits (`crates/gpu/src/exit.rs`, issue #620; seen crashing only on Linux + NVIDIA, other drivers unverified); with GPU rendering on and no adapter found at all (e.g. no Vulkan loader on NixOS outside `nix develop`), the desktop app says once per session that it renders on the CPU and points to Help ▸ System Info (`gpu_notice`; not when the GPU is turned off or only a software adapter exists); no tiling beyond the buffer limit (CPU) | @@ -959,3 +959,4 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-23 | patch | LR-BEHAV-ACCESS: the name field of New Album, New Smart Album, Rename and the other one-field dialogs takes the keyboard focus once when the dialog opens instead of every frame, so Tab and Shift+Tab reach the check box, Cancel and OK; status unchanged (🟡) | | 2026-10-22 | minor | LR-CROP-AUTO: Auto straighten turns by at most 10° and only on at least 3 agreeing lines, and says when it finds nothing to level by; measured on 68 photos straightened by hand and 300 left as shot, unwanted turns of more than 1° fell from 79 to 19 of the 300. Downgraded ✅ → 🟡: it still leaves most tilted photos alone | | 2026-10-23 | patch | LRC-LIB-FILTERBAR: showing an album (`library.source`) while the filter holds an album drops the filter's album, as showing a library folder already dropped its folder filter; before, the old album stayed in the filter unseen (the filter bar has no album chip) and narrowed the next source such as All Photos; the row's note says so; status unchanged (✅) | +| 2026-10-24 | minor | LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder share the library lane: one asked for while the other runs waits in line instead of being refused; a waiting Synchronize Folder scans again and acts only on the photos its dialog showed; status unchanged (✅) | diff --git a/docs/whats-new.md b/docs/whats-new.md index c6c25920034..6c330181bfb 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -2,6 +2,18 @@ ## 2026-10-24 +### Imports and Synchronize Folder wait for each other +- An import confirmed (or photos dropped on the window) while a Synchronize Folder runs, or a Synchronize Folder + confirmed while an import runs, now waits in line and starts by itself when the other ends, with a message that it + was queued. Before, it was refused ("Wait for the import to finish", "A folder is being synchronized"). +- Photos dropped on the window, or an import review confirmed, while another import runs also wait in line instead of + being refused with "An import is running"; a drop is still refused while a folder is being scanned for the review. +- A waiting import checks for duplicates against the library as it is when its turn comes, so nothing is added twice. +- A waiting Synchronize Folder looks at its folder again when its turn comes. It removes or relinks only the photos + its dialog showed: one that went missing while it waited is left alone, and the message at the end says so. +- Nothing waits across another library: a Synchronize Folder that is still scanning when another library opens does + nothing. + ### Relative-date filters and smart albums follow the clock - A current view or source count using “in the last” rules now refreshes when the session clock moves into a new minute, even when no catalog edit occurred. This fixes stale photos remaining in the grid and stale counts for From a6f87cb3aa58c7abd6c33d764d6bf8a3753b8dd5 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sat, 24 Oct 2026 18:26:28 -0400 Subject: [PATCH 07/11] =?UTF-8?q?LR-BEHAV-BG-TASKS:=20a=20task=20waiting?= =?UTF-8?q?=20in=20line=20shows=20in=20the=20activity=20stack,=20with=20?= =?UTF-8?q?=E2=9C=95=20to=20take=20it=20out?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On this base a task waiting in the library or preview lane showed only a "Queued" toast and could not be withdrawn. The activity stack now draws it at once (it was just asked for) as a row without a bar: its name, "Starts next" or "Starts after N more", and ✕ named "Remove from Queue: ", which runs `activity.cancel` (the engine takes a waiting task out of the line and leaves the running one alone). Co-Authored-By: Claude --- crates/ui-egui/locales/cs-formats.json | 4 ++- crates/ui-egui/locales/cs.json | 3 +- crates/ui-egui/locales/de-formats.json | 4 ++- crates/ui-egui/locales/de.json | 3 +- crates/ui-egui/locales/es-formats.json | 4 ++- crates/ui-egui/locales/es.json | 3 +- crates/ui-egui/locales/fi-formats.json | 4 ++- crates/ui-egui/locales/fi.json | 3 +- crates/ui-egui/locales/fr-formats.json | 4 ++- crates/ui-egui/locales/fr.json | 3 +- crates/ui-egui/locales/id-formats.json | 4 ++- crates/ui-egui/locales/id.json | 3 +- crates/ui-egui/locales/it-formats.json | 4 ++- crates/ui-egui/locales/it.json | 3 +- crates/ui-egui/locales/ja-formats.json | 4 ++- crates/ui-egui/locales/ja.json | 3 +- crates/ui-egui/locales/ka-formats.json | 4 ++- crates/ui-egui/locales/ka.json | 3 +- crates/ui-egui/locales/pl-formats.json | 4 ++- crates/ui-egui/locales/pl.json | 3 +- crates/ui-egui/locales/pt-br-formats.json | 4 ++- crates/ui-egui/locales/pt-br.json | 3 +- crates/ui-egui/locales/ru-formats.json | 4 ++- crates/ui-egui/locales/ru.json | 3 +- crates/ui-egui/locales/sv-formats.json | 4 ++- crates/ui-egui/locales/sv.json | 3 +- crates/ui-egui/locales/uk-formats.json | 4 ++- crates/ui-egui/locales/uk.json | 3 +- crates/ui-egui/locales/vi-formats.json | 4 ++- crates/ui-egui/locales/vi.json | 3 +- crates/ui-egui/locales/zh-hans-formats.json | 4 ++- crates/ui-egui/locales/zh-hans.json | 3 +- crates/ui-egui/locales/zh-hant-formats.json | 4 ++- crates/ui-egui/locales/zh-hant.json | 3 +- crates/ui-egui/src/panels/activity.rs | 28 ++++++++++------- crates/ui-egui/src/tests/activity.rs | 11 ++++--- crates/ui-egui/src/tests/drop_import.rs | 33 +++++++++++++++++++++ docs/background-tasks.md | 2 +- docs/parity-checklist.md | 6 ++-- docs/whats-new.md | 1 + 40 files changed, 148 insertions(+), 52 deletions(-) diff --git a/crates/ui-egui/locales/cs-formats.json b/crates/ui-egui/locales/cs-formats.json index 48806ebd143..baca445ebb6 100644 --- a/crates/ui-egui/locales/cs-formats.json +++ b/crates/ui-egui/locales/cs-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Kam má jít katalog Lightroomu „{catalog}“?", "Merge into the open library “{library}” ({count} photo{})": "Sloučit s otevřenou knihovnou „{library}“ (fotografie: {count}{:.0})", "Queued: it starts after {n} more": "Ve frontě: začne po {n} dalších", - "{n} more missing, left alone: synchronize again to review them": "{n} dalších chybí, ponecháno beze změny: pro kontrolu synchronizujte znovu" + "{n} more missing, left alone: synchronize again to review them": "{n} dalších chybí, ponecháno beze změny: pro kontrolu synchronizujte znovu", + "Starts after {n} more": "Začne po {n} dalších", + "Remove from Queue: {label}": "Odebrat z fronty: {label}" } diff --git a/crates/ui-egui/locales/cs.json b/crates/ui-egui/locales/cs.json index af68f83b201..2ffc8846ee3 100644 --- a/crates/ui-egui/locales/cs.json +++ b/crates/ui-egui/locales/cs.json @@ -2409,5 +2409,6 @@ "An import is running. Drop photos when it has finished": "Import už běží. Fotky přetáhněte, až skončí", "Finish Lightroom catalog import before adding photos": "Dokončete import katalogu Lightroom, než přidáte fotky", "Queued: it starts when the task ahead of it ends": "Ve frontě: začne, až skončí úloha před ní", - "Another library was opened: nothing was done": "Byla otevřena jiná knihovna: nic se neprovedlo" + "Another library was opened: nothing was done": "Byla otevřena jiná knihovna: nic se neprovedlo", + "Starts next": "Začne jako další" } diff --git a/crates/ui-egui/locales/de-formats.json b/crates/ui-egui/locales/de-formats.json index b47170de57e..c0aa7b83095 100644 --- a/crates/ui-egui/locales/de-formats.json +++ b/crates/ui-egui/locales/de-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Wohin soll der Lightroom-Katalog „{catalog}“?", "Merge into the open library “{library}” ({count} photo{})": "Mit der geöffneten Bibliothek „{library}“ zusammenführen ({count} Foto{})", "Queued: it starts after {n} more": "In der Warteschlange: startet nach {n} weiteren", - "{n} more missing, left alone: synchronize again to review them": "{n} weitere fehlen und blieben unangetastet: zum Prüfen erneut synchronisieren" + "{n} more missing, left alone: synchronize again to review them": "{n} weitere fehlen und blieben unangetastet: zum Prüfen erneut synchronisieren", + "Starts after {n} more": "Startet nach {n} weiteren", + "Remove from Queue: {label}": "Aus der Warteschlange entfernen: {label}" } diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.json index ed644215e58..a809ebe4c3d 100644 --- a/crates/ui-egui/locales/de.json +++ b/crates/ui-egui/locales/de.json @@ -3441,5 +3441,6 @@ "An import is running. Drop photos when it has finished": "Ein Import läuft. Lege die Fotos ab, wenn er fertig ist", "Finish Lightroom catalog import before adding photos": "Schließe den Import des Lightroom-Katalogs ab, bevor du Fotos hinzufügst", "Queued: it starts when the task ahead of it ends": "In der Warteschlange: startet, wenn die Aufgabe davor endet", - "Another library was opened: nothing was done": "Eine andere Bibliothek wurde geöffnet: es wurde nichts getan" + "Another library was opened: nothing was done": "Eine andere Bibliothek wurde geöffnet: es wurde nichts getan", + "Starts next": "Startet als Nächstes" } diff --git a/crates/ui-egui/locales/es-formats.json b/crates/ui-egui/locales/es-formats.json index cabf7433efa..405df93e588 100644 --- a/crates/ui-egui/locales/es-formats.json +++ b/crates/ui-egui/locales/es-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "¿Dónde debe ir el catálogo de Lightroom “{catalog}”?", "Merge into the open library “{library}” ({count} photo{})": "Combinar con la biblioteca abierta “{library}” ({count} foto{})", "Queued: it starts after {n} more": "En cola: empieza tras {n} más", - "{n} more missing, left alone: synchronize again to review them": "Faltan {n} más, sin tocar: sincroniza de nuevo para revisarlas" + "{n} more missing, left alone: synchronize again to review them": "Faltan {n} más, sin tocar: sincroniza de nuevo para revisarlas", + "Starts after {n} more": "Empieza tras {n} más", + "Remove from Queue: {label}": "Quitar de la cola: {label}" } diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.json index 03589c0dcc4..3dc670f7089 100644 --- a/crates/ui-egui/locales/es.json +++ b/crates/ui-egui/locales/es.json @@ -2359,5 +2359,6 @@ "An import is running. Drop photos when it has finished": "Hay una importación en curso. Suelta las fotos cuando termine", "Finish Lightroom catalog import before adding photos": "Termina la importación del catálogo de Lightroom antes de añadir fotos", "Queued: it starts when the task ahead of it ends": "En cola: empieza cuando termine la tarea anterior", - "Another library was opened: nothing was done": "Se abrió otra biblioteca: no se hizo nada" + "Another library was opened: nothing was done": "Se abrió otra biblioteca: no se hizo nada", + "Starts next": "Empieza la siguiente" } diff --git a/crates/ui-egui/locales/fi-formats.json b/crates/ui-egui/locales/fi-formats.json index 72f65964852..e6caa87a913 100644 --- a/crates/ui-egui/locales/fi-formats.json +++ b/crates/ui-egui/locales/fi-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Minne Lightroom-luettelo ”{catalog}” tuodaan?", "Merge into the open library “{library}” ({count} photo{})": "Yhdistä avoimeen kirjastoon ”{library}” (kuvia: {count}{:.0})", "Queued: it starts after {n} more": "Jonossa: alkaa {n} muun jälkeen", - "{n} more missing, left alone: synchronize again to review them": "{n} muuta puuttuu ja jätettiin ennalleen: synkronoi uudelleen tarkistaaksesi ne" + "{n} more missing, left alone: synchronize again to review them": "{n} muuta puuttuu ja jätettiin ennalleen: synkronoi uudelleen tarkistaaksesi ne", + "Starts after {n} more": "Alkaa {n} muun jälkeen", + "Remove from Queue: {label}": "Poista jonosta: {label}" } diff --git a/crates/ui-egui/locales/fi.json b/crates/ui-egui/locales/fi.json index f63b4b43cfb..e818f109e0b 100644 --- a/crates/ui-egui/locales/fi.json +++ b/crates/ui-egui/locales/fi.json @@ -2328,5 +2328,6 @@ "Finish Lightroom catalog import before adding photos": "Viimeistele Lightroom-luettelon tuonti ennen kuvien lisäämistä", "Import dropped files without review": "Tuo pudotetut tiedostot ilman tarkistusta", "Queued: it starts when the task ahead of it ends": "Jonossa: alkaa, kun sen edellä oleva tehtävä päättyy", - "Another library was opened: nothing was done": "Toinen kirjasto avattiin: mitään ei tehty" + "Another library was opened: nothing was done": "Toinen kirjasto avattiin: mitään ei tehty", + "Starts next": "Alkaa seuraavaksi" } diff --git a/crates/ui-egui/locales/fr-formats.json b/crates/ui-egui/locales/fr-formats.json index 4b3326065b9..b3d7d0a92d7 100644 --- a/crates/ui-egui/locales/fr-formats.json +++ b/crates/ui-egui/locales/fr-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Où importer le catalogue Lightroom « {catalog} » ?", "Merge into the open library “{library}” ({count} photo{})": "Fusionner avec la bibliothèque ouverte « {library} » ({count} photo{})", "Queued: it starts after {n} more": "En file : démarre après {n} autres", - "{n} more missing, left alone: synchronize again to review them": "{n} autres manquantes, laissées telles quelles : synchronisez à nouveau pour les examiner" + "{n} more missing, left alone: synchronize again to review them": "{n} autres manquantes, laissées telles quelles : synchronisez à nouveau pour les examiner", + "Starts after {n} more": "Démarre après {n} autres", + "Remove from Queue: {label}": "Retirer de la file : {label}" } diff --git a/crates/ui-egui/locales/fr.json b/crates/ui-egui/locales/fr.json index 27179c32682..ef1faa5f8d6 100644 --- a/crates/ui-egui/locales/fr.json +++ b/crates/ui-egui/locales/fr.json @@ -2391,5 +2391,6 @@ "Open a library first, then drop the presets again": "Ouvrez d'abord une bibliothèque, puis déposez à nouveau les préréglages", "This library couldn't be checked:": "Impossible de vérifier cette bibliothèque :", "Queued: it starts when the task ahead of it ends": "En file : démarre à la fin de la tâche précédente", - "Another library was opened: nothing was done": "Une autre bibliothèque a été ouverte : rien n’a été fait" + "Another library was opened: nothing was done": "Une autre bibliothèque a été ouverte : rien n’a été fait", + "Starts next": "Démarre ensuite" } diff --git a/crates/ui-egui/locales/id-formats.json b/crates/ui-egui/locales/id-formats.json index d42faac7969..22637a1805c 100644 --- a/crates/ui-egui/locales/id-formats.json +++ b/crates/ui-egui/locales/id-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Ke mana katalog Lightroom “{catalog}” diimpor?", "Merge into the open library “{library}” ({count} photo{})": "Gabungkan ke pustaka yang terbuka “{library}” ({count} foto{:.0})", "Queued: it starts after {n} more": "Dalam antrean: dimulai setelah {n} lagi", - "{n} more missing, left alone: synchronize again to review them": "{n} lagi hilang dan dibiarkan: sinkronkan lagi untuk memeriksanya" + "{n} more missing, left alone: synchronize again to review them": "{n} lagi hilang dan dibiarkan: sinkronkan lagi untuk memeriksanya", + "Starts after {n} more": "Dimulai setelah {n} lagi", + "Remove from Queue: {label}": "Hapus dari antrean: {label}" } diff --git a/crates/ui-egui/locales/id.json b/crates/ui-egui/locales/id.json index 3073c328cbc..00d6d0753ec 100644 --- a/crates/ui-egui/locales/id.json +++ b/crates/ui-egui/locales/id.json @@ -2340,5 +2340,6 @@ "Finish Lightroom catalog import before adding photos": "Selesaikan impor katalog Lightroom sebelum menambahkan foto", "Import dropped files without review": "Impor file yang dijatuhkan tanpa tinjauan", "Queued: it starts when the task ahead of it ends": "Dalam antrean: dimulai saat tugas di depannya selesai", - "Another library was opened: nothing was done": "Pustaka lain dibuka: tidak ada yang dilakukan" + "Another library was opened: nothing was done": "Pustaka lain dibuka: tidak ada yang dilakukan", + "Starts next": "Dimulai berikutnya" } diff --git a/crates/ui-egui/locales/it-formats.json b/crates/ui-egui/locales/it-formats.json index 23650b47c58..e5d958558d7 100644 --- a/crates/ui-egui/locales/it-formats.json +++ b/crates/ui-egui/locales/it-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Dove importare il catalogo Lightroom “{catalog}”?", "Merge into the open library “{library}” ({count} photo{})": "Unisci alla libreria aperta “{library}” (foto: {count}{:.0})", "Queued: it starts after {n} more": "In coda: parte dopo altre {n}", - "{n} more missing, left alone: synchronize again to review them": "Ne mancano altre {n}, lasciate com'erano: sincronizza di nuovo per esaminarle" + "{n} more missing, left alone: synchronize again to review them": "Ne mancano altre {n}, lasciate com'erano: sincronizza di nuovo per esaminarle", + "Starts after {n} more": "Parte dopo altre {n}", + "Remove from Queue: {label}": "Rimuovi dalla coda: {label}" } diff --git a/crates/ui-egui/locales/it.json b/crates/ui-egui/locales/it.json index 1f143b04772..28d4a80c322 100644 --- a/crates/ui-egui/locales/it.json +++ b/crates/ui-egui/locales/it.json @@ -2362,5 +2362,6 @@ "An import is running. Drop photos when it has finished": "Un'importazione è in corso. Trascina le foto quando è finita", "Finish Lightroom catalog import before adding photos": "Termina l'importazione del catalogo Lightroom prima di aggiungere foto", "Queued: it starts when the task ahead of it ends": "In coda: parte quando finisce l'attività precedente", - "Another library was opened: nothing was done": "È stata aperta un'altra libreria: non è stato fatto nulla" + "Another library was opened: nothing was done": "È stata aperta un'altra libreria: non è stato fatto nulla", + "Starts next": "Parte subito dopo" } diff --git a/crates/ui-egui/locales/ja-formats.json b/crates/ui-egui/locales/ja-formats.json index 15853a927b0..63366fe394c 100644 --- a/crates/ui-egui/locales/ja-formats.json +++ b/crates/ui-egui/locales/ja-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Lightroom カタログ「{catalog}」をどこに読み込みますか?", "Merge into the open library “{library}” ({count} photo{})": "開いているライブラリ「{library}」に統合(写真{count}枚){:.0}", "Queued: it starts after {n} more": "キューに追加: あと {n} 件の後に開始します", - "{n} more missing, left alone: synchronize again to review them": "ほかに {n} 件が見つからず、そのままにしました: 確認するにはもう一度同期してください" + "{n} more missing, left alone: synchronize again to review them": "ほかに {n} 件が見つからず、そのままにしました: 確認するにはもう一度同期してください", + "Starts after {n} more": "あと {n} 件の後に開始します", + "Remove from Queue: {label}": "キューから削除: {label}" } diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.json index f954190daeb..2709a330ca9 100644 --- a/crates/ui-egui/locales/ja.json +++ b/crates/ui-egui/locales/ja.json @@ -2357,5 +2357,6 @@ "An import is running. Drop photos when it has finished": "読み込み中です。完了してから写真をドロップしてください", "Finish Lightroom catalog import before adding photos": "写真を追加する前に Lightroom カタログの読み込みを完了してください", "Queued: it starts when the task ahead of it ends": "キューに追加: 前のタスクが終わると開始します", - "Another library was opened: nothing was done": "別のライブラリが開かれました: 何も行われていません" + "Another library was opened: nothing was done": "別のライブラリが開かれました: 何も行われていません", + "Starts next": "次に開始します" } diff --git a/crates/ui-egui/locales/ka-formats.json b/crates/ui-egui/locales/ka-formats.json index 73ddac481ae..03b886141a2 100644 --- a/crates/ui-egui/locales/ka-formats.json +++ b/crates/ui-egui/locales/ka-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "სად გადავიტანოთ Lightroom-ის კატალოგი „{catalog}“?", "Merge into the open library “{library}” ({count} photo{})": "გაერთიანება ღია ბიბლიოთეკასთან „{library}“ (ფოტოები: {count}){:.0}", "Queued: it starts after {n} more": "რიგშია: დაიწყება კიდევ {n}-ის შემდეგ", - "{n} more missing, left alone: synchronize again to review them": "კიდევ {n} აკლია და ხელუხლებლად დარჩა: გადასახედად ხელახლა მოახდინეთ სინქრონიზაცია" + "{n} more missing, left alone: synchronize again to review them": "კიდევ {n} აკლია და ხელუხლებლად დარჩა: გადასახედად ხელახლა მოახდინეთ სინქრონიზაცია", + "Starts after {n} more": "დაიწყება კიდევ {n}-ის შემდეგ", + "Remove from Queue: {label}": "რიგიდან ამოღება: {label}" } diff --git a/crates/ui-egui/locales/ka.json b/crates/ui-egui/locales/ka.json index 4db6010bd24..98f22f908f9 100644 --- a/crates/ui-egui/locales/ka.json +++ b/crates/ui-egui/locales/ka.json @@ -2735,5 +2735,6 @@ "An import is running. Drop photos when it has finished": "იმპორტი მიმდინარეობს. ფოტოები ჩააგდეთ, როცა დასრულდება", "Finish Lightroom catalog import before adding photos": "ფოტოების დამატებამდე დაასრულეთ Lightroom-ის კატალოგის იმპორტი", "Queued: it starts when the task ahead of it ends": "რიგშია: დაიწყება, როცა წინა ამოცანა დასრულდება", - "Another library was opened: nothing was done": "სხვა ბიბლიოთეკა გაიხსნა: არაფერი გაკეთებულა" + "Another library was opened: nothing was done": "სხვა ბიბლიოთეკა გაიხსნა: არაფერი გაკეთებულა", + "Starts next": "დაიწყება შემდეგი" } diff --git a/crates/ui-egui/locales/pl-formats.json b/crates/ui-egui/locales/pl-formats.json index b7fe22f5cb7..c0a741cb28c 100644 --- a/crates/ui-egui/locales/pl-formats.json +++ b/crates/ui-egui/locales/pl-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Dokąd zaimportować katalog Lightroom „{catalog}”?", "Merge into the open library “{library}” ({count} photo{})": "Scal z otwartą biblioteką „{library}” (zdjęcia: {count}){:.0}", "Queued: it starts after {n} more": "W kolejce: rozpocznie się po {n} kolejnych", - "{n} more missing, left alone: synchronize again to review them": "Brakuje jeszcze {n}, pozostawiono bez zmian: zsynchronizuj ponownie, aby je przejrzeć" + "{n} more missing, left alone: synchronize again to review them": "Brakuje jeszcze {n}, pozostawiono bez zmian: zsynchronizuj ponownie, aby je przejrzeć", + "Starts after {n} more": "Rozpocznie się po {n} kolejnych", + "Remove from Queue: {label}": "Usuń z kolejki: {label}" } diff --git a/crates/ui-egui/locales/pl.json b/crates/ui-egui/locales/pl.json index ad13a39be9b..da7a834f42b 100644 --- a/crates/ui-egui/locales/pl.json +++ b/crates/ui-egui/locales/pl.json @@ -2284,5 +2284,6 @@ "An import is running. Drop photos when it has finished": "Import jest w toku. Upuść zdjęcia, gdy się zakończy", "Finish Lightroom catalog import before adding photos": "Zakończ import katalogu Lightrooma, zanim dodasz zdjęcia", "Queued: it starts when the task ahead of it ends": "W kolejce: rozpocznie się po zakończeniu poprzedniego zadania", - "Another library was opened: nothing was done": "Otwarto inną bibliotekę: nic nie zrobiono" + "Another library was opened: nothing was done": "Otwarto inną bibliotekę: nic nie zrobiono", + "Starts next": "Rozpocznie się jako następne" } diff --git a/crates/ui-egui/locales/pt-br-formats.json b/crates/ui-egui/locales/pt-br-formats.json index 25c8a28b770..90a6c23d291 100644 --- a/crates/ui-egui/locales/pt-br-formats.json +++ b/crates/ui-egui/locales/pt-br-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Para onde vai o catálogo do Lightroom “{catalog}”?", "Merge into the open library “{library}” ({count} photo{})": "Mesclar na biblioteca aberta “{library}” ({count} foto{})", "Queued: it starts after {n} more": "Na fila: começa depois de mais {n}", - "{n} more missing, left alone: synchronize again to review them": "Faltam mais {n}, deixadas como estavam: sincronize de novo para revisá-las" + "{n} more missing, left alone: synchronize again to review them": "Faltam mais {n}, deixadas como estavam: sincronize de novo para revisá-las", + "Starts after {n} more": "Começa depois de mais {n}", + "Remove from Queue: {label}": "Remover da fila: {label}" } diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.json index 222fd260f62..e210d177197 100644 --- a/crates/ui-egui/locales/pt-br.json +++ b/crates/ui-egui/locales/pt-br.json @@ -2203,5 +2203,6 @@ "An import is running. Drop photos when it has finished": "Uma importação está em andamento. Solte as fotos quando ela terminar", "Finish Lightroom catalog import before adding photos": "Conclua a importação do catálogo do Lightroom antes de adicionar fotos", "Queued: it starts when the task ahead of it ends": "Na fila: começa quando a tarefa anterior terminar", - "Another library was opened: nothing was done": "Outra biblioteca foi aberta: nada foi feito" + "Another library was opened: nothing was done": "Outra biblioteca foi aberta: nada foi feito", + "Starts next": "Começa em seguida" } diff --git a/crates/ui-egui/locales/ru-formats.json b/crates/ui-egui/locales/ru-formats.json index df0cff8badc..0db7b87b32d 100644 --- a/crates/ui-egui/locales/ru-formats.json +++ b/crates/ui-egui/locales/ru-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Куда импортировать каталог Lightroom «{catalog}»?", "Merge into the open library “{library}” ({count} photo{})": "Объединить с открытой библиотекой «{library}» (фото: {count}){:.0}", "Queued: it starts after {n} more": "В очереди: начнётся после ещё {n}", - "{n} more missing, left alone: synchronize again to review them": "Не хватает ещё {n}, оставлены как есть: синхронизируйте снова, чтобы их просмотреть" + "{n} more missing, left alone: synchronize again to review them": "Не хватает ещё {n}, оставлены как есть: синхронизируйте снова, чтобы их просмотреть", + "Starts after {n} more": "Начнётся после ещё {n}", + "Remove from Queue: {label}": "Убрать из очереди: {label}" } diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index fe8bfda9e90..dabb4c10039 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -2350,5 +2350,6 @@ "An import is running. Drop photos when it has finished": "Импорт уже выполняется. Перетащите фото, когда он закончится", "Finish Lightroom catalog import before adding photos": "Завершите импорт каталога Lightroom, прежде чем добавлять фото", "Queued: it starts when the task ahead of it ends": "В очереди: начнётся, когда закончится задача перед ней", - "Another library was opened: nothing was done": "Открыта другая библиотека: ничего не сделано" + "Another library was opened: nothing was done": "Открыта другая библиотека: ничего не сделано", + "Starts next": "Начнётся следующей" } diff --git a/crates/ui-egui/locales/sv-formats.json b/crates/ui-egui/locales/sv-formats.json index 3493eda8222..06ce7f8a7f0 100644 --- a/crates/ui-egui/locales/sv-formats.json +++ b/crates/ui-egui/locales/sv-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Vart ska Lightroom-katalogen ”{catalog}” importeras?", "Merge into the open library “{library}” ({count} photo{})": "Slå samman med det öppna biblioteket ”{library}” ({count} foto{:.0})", "Queued: it starts after {n} more": "I kö: startar efter {n} till", - "{n} more missing, left alone: synchronize again to review them": "{n} fler saknas och lämnades orörda: synkronisera igen för att granska dem" + "{n} more missing, left alone: synchronize again to review them": "{n} fler saknas och lämnades orörda: synkronisera igen för att granska dem", + "Starts after {n} more": "Startar efter {n} till", + "Remove from Queue: {label}": "Ta bort från kön: {label}" } diff --git a/crates/ui-egui/locales/sv.json b/crates/ui-egui/locales/sv.json index 76983ad20f6..16b96132f52 100644 --- a/crates/ui-egui/locales/sv.json +++ b/crates/ui-egui/locales/sv.json @@ -2430,5 +2430,6 @@ "Finish Lightroom catalog import before adding photos": "Slutför importen av Lightroom-katalogen innan du lägger till foton", "Import dropped files without review": "Importera släppta filer utan granskning", "Queued: it starts when the task ahead of it ends": "I kö: startar när uppgiften före är klar", - "Another library was opened: nothing was done": "Ett annat bibliotek öppnades: ingenting gjordes" + "Another library was opened: nothing was done": "Ett annat bibliotek öppnades: ingenting gjordes", + "Starts next": "Startar härnäst" } diff --git a/crates/ui-egui/locales/uk-formats.json b/crates/ui-egui/locales/uk-formats.json index 209fdd16b83..a86f38de075 100644 --- a/crates/ui-egui/locales/uk-formats.json +++ b/crates/ui-egui/locales/uk-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Куди імпортувати каталог Lightroom «{catalog}»?", "Merge into the open library “{library}” ({count} photo{})": "Об’єднати з відкритою бібліотекою «{library}» (фото: {count}){:.0}", "Queued: it starts after {n} more": "У черзі: почнеться після ще {n}", - "{n} more missing, left alone: synchronize again to review them": "Бракує ще {n}, залишено як є: синхронізуйте знову, щоб їх переглянути" + "{n} more missing, left alone: synchronize again to review them": "Бракує ще {n}, залишено як є: синхронізуйте знову, щоб їх переглянути", + "Starts after {n} more": "Почнеться після ще {n}", + "Remove from Queue: {label}": "Прибрати з черги: {label}" } diff --git a/crates/ui-egui/locales/uk.json b/crates/ui-egui/locales/uk.json index 1f0a5f99f44..cf2ff1448dd 100644 --- a/crates/ui-egui/locales/uk.json +++ b/crates/ui-egui/locales/uk.json @@ -2355,5 +2355,6 @@ "An import is running. Drop photos when it has finished": "Імпорт уже виконується. Перетягніть фото, коли він завершиться", "Finish Lightroom catalog import before adding photos": "Завершіть імпорт каталогу Lightroom, перш ніж додавати фото", "Queued: it starts when the task ahead of it ends": "У черзі: почнеться, коли завершиться попереднє завдання", - "Another library was opened: nothing was done": "Відкрито іншу бібліотеку: нічого не зроблено" + "Another library was opened: nothing was done": "Відкрито іншу бібліотеку: нічого не зроблено", + "Starts next": "Почнеться наступним" } diff --git a/crates/ui-egui/locales/vi-formats.json b/crates/ui-egui/locales/vi-formats.json index ad050727993..c03c61896f1 100644 --- a/crates/ui-egui/locales/vi-formats.json +++ b/crates/ui-egui/locales/vi-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Nhập danh mục Lightroom «{catalog}» vào đâu?", "Merge into the open library “{library}” ({count} photo{})": "Gộp vào thư viện đang mở «{library}» ({count} ảnh{:.0})", "Queued: it starts after {n} more": "Trong hàng đợi: bắt đầu sau {n} tác vụ nữa", - "{n} more missing, left alone: synchronize again to review them": "Còn {n} mục bị thiếu được giữ nguyên: hãy đồng bộ hóa lại để xem xét" + "{n} more missing, left alone: synchronize again to review them": "Còn {n} mục bị thiếu được giữ nguyên: hãy đồng bộ hóa lại để xem xét", + "Starts after {n} more": "Bắt đầu sau {n} tác vụ nữa", + "Remove from Queue: {label}": "Xóa khỏi hàng đợi: {label}" } diff --git a/crates/ui-egui/locales/vi.json b/crates/ui-egui/locales/vi.json index c71b2e3d5bd..9d127ff71a1 100644 --- a/crates/ui-egui/locales/vi.json +++ b/crates/ui-egui/locales/vi.json @@ -2236,5 +2236,6 @@ "Finish Lightroom catalog import before adding photos": "Hoàn tất nhập danh mục Lightroom trước khi thêm ảnh", "Import dropped files without review": "Nhập các tệp đã thả mà không xem lại", "Queued: it starts when the task ahead of it ends": "Trong hàng đợi: bắt đầu khi tác vụ trước nó kết thúc", - "Another library was opened: nothing was done": "Đã mở thư viện khác: không có gì được thực hiện" + "Another library was opened: nothing was done": "Đã mở thư viện khác: không có gì được thực hiện", + "Starts next": "Bắt đầu tiếp theo" } diff --git a/crates/ui-egui/locales/zh-hans-formats.json b/crates/ui-egui/locales/zh-hans-formats.json index f16499d8b53..4bb13622240 100644 --- a/crates/ui-egui/locales/zh-hans-formats.json +++ b/crates/ui-egui/locales/zh-hans-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Lightroom 目录“{catalog}”要导入到哪里?", "Merge into the open library “{library}” ({count} photo{})": "合并到当前打开的图库“{library}”({count} 张照片){:.0}", "Queued: it starts after {n} more": "已加入队列:再过 {n} 个后开始", - "{n} more missing, left alone: synchronize again to review them": "还有 {n} 个缺失,未作处理:再次同步以检查它们" + "{n} more missing, left alone: synchronize again to review them": "还有 {n} 个缺失,未作处理:再次同步以检查它们", + "Starts after {n} more": "再过 {n} 个后开始", + "Remove from Queue: {label}": "从队列中移除:{label}" } diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.json index e13758890f6..afdb746b3f8 100644 --- a/crates/ui-egui/locales/zh-hans.json +++ b/crates/ui-egui/locales/zh-hans.json @@ -2201,5 +2201,6 @@ "An import is running. Drop photos when it has finished": "正在导入。导入完成后再拖放照片", "Finish Lightroom catalog import before adding photos": "添加照片前,请先完成 Lightroom 目录的导入", "Queued: it starts when the task ahead of it ends": "已加入队列:前一个任务结束后开始", - "Another library was opened: nothing was done": "已打开另一个图库:未执行任何操作" + "Another library was opened: nothing was done": "已打开另一个图库:未执行任何操作", + "Starts next": "接下来开始" } diff --git a/crates/ui-egui/locales/zh-hant-formats.json b/crates/ui-egui/locales/zh-hant-formats.json index 5230ccec2ae..35a436c7c26 100644 --- a/crates/ui-egui/locales/zh-hant-formats.json +++ b/crates/ui-egui/locales/zh-hant-formats.json @@ -307,5 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Lightroom 目錄「{catalog}」要匯入到哪裡?", "Merge into the open library “{library}” ({count} photo{})": "合併到目前開啟的照片庫「{library}」({count} 張照片){:.0}", "Queued: it starts after {n} more": "已加入佇列:再過 {n} 個後開始", - "{n} more missing, left alone: synchronize again to review them": "還有 {n} 個遺失,未作處理:再次同步以檢查它們" + "{n} more missing, left alone: synchronize again to review them": "還有 {n} 個遺失,未作處理:再次同步以檢查它們", + "Starts after {n} more": "再過 {n} 個後開始", + "Remove from Queue: {label}": "從佇列中移除:{label}" } diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.json index 692f9c55919..006e49fc447 100644 --- a/crates/ui-egui/locales/zh-hant.json +++ b/crates/ui-egui/locales/zh-hant.json @@ -2158,5 +2158,6 @@ "An import is running. Drop photos when it has finished": "正在匯入。匯入完成後再拖放照片", "Finish Lightroom catalog import before adding photos": "新增照片前,請先完成 Lightroom 目錄的匯入", "Queued: it starts when the task ahead of it ends": "已加入佇列:前一個工作結束後開始", - "Another library was opened: nothing was done": "已開啟另一個圖庫:未執行任何操作" + "Another library was opened: nothing was done": "已開啟另一個圖庫:未執行任何操作", + "Starts next": "接下來開始" } diff --git a/crates/ui-egui/src/panels/activity.rs b/crates/ui-egui/src/panels/activity.rs index 0aadc198347..581bf56ea3a 100644 --- a/crates/ui-egui/src/panels/activity.rs +++ b/crates/ui-egui/src/panels/activity.rs @@ -1,7 +1,8 @@ //! The activity stack (issue #345): every long-running task in one place, floating in the top-left corner under the //! top bar while something runs — a row each with its name, a progress bar, what it is working on, and ✕ for the ones -//! that can be cancelled. The tasks come from the engine's registry ([`lightcraft_engine::activity`]); ✕ runs -//! `activity.cancel` like any other frontend would. +//! that can be cancelled. A task waiting in line behind another of its lane has a row too, at once: its name, when it +//! starts, and ✕ to take it out of the line. The tasks come from the engine's registry +//! ([`lightcraft_engine::activity`]); ✕ runs `activity.cancel` like any other frontend would. use egui::{Align, Layout, Margin, RichText, Sense, Stroke, pos2, vec2}; use lightcraft_engine::activity::{TaskInfo, Unit}; @@ -55,15 +56,16 @@ fn detail_line(t: &TaskInfo) -> String { /// Draw the stack (called every frame, after the panels and dialogs). pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) { - // (a task waiting in line has nothing to show yet and no progress to draw: agents see it in `activity.list`) - let all: Vec = app.session.activity.list().into_iter().filter(|t| !t.waiting).collect(); + // (a task waiting in line has a row without a bar: its name, when it starts, and ✕) + let all: Vec = app.session.activity.list(); if all.is_empty() { app.activity_expanded = false; return; } // look again soon: a young task becomes due, bars move ctx.request_repaint_after(std::time::Duration::from_millis(100)); - let tasks: Vec<&TaskInfo> = all.iter().filter(|t| t.age_ms >= SHOW_AFTER_MS).collect(); + // a running task shows once it has run a while; one waiting in line was just asked for, so it shows now + let tasks: Vec<&TaskInfo> = all.iter().filter(|t| t.waiting || t.age_ms >= SHOW_AFTER_MS).collect(); if tasks.is_empty() { return; } @@ -116,7 +118,7 @@ pub(crate) fn cancel(app: &mut LightcraftApp, id: u64) { let _ = app.session.execute("activity.cancel", &json!({"id": id})); } -/// One task: name and ✕, the bar, the detail line. True when ✕ was clicked. +/// One task: name and ✕, the bar, the detail line (a waiting one: name and ✕, when it starts). True when ✕ was clicked. fn row(ui: &mut egui::Ui, t: &Tokens, task: &TaskInfo, width: f32) -> bool { let mut clicked = false; let r = ui.vertical(|ui| { @@ -131,14 +133,20 @@ fn row(ui: &mut egui::Ui, t: &Tokens, task: &TaskInfo, width: f32) -> bool { }); if cross { let (rect, resp) = ui.allocate_exact_size(vec2(CROSS, CROSS), Sense::click()); - crate::widgets::announce(&resp, crate::i18n::tr("Cancel")); + let name = if task.waiting { tr_format!("Remove from Queue: {label}", label = tr(&task.label)) } else { tr("Cancel").to_string() }; + crate::widgets::announce(&resp, name.clone()); paint(ui.painter(), rect.shrink(2.0), Icon::Close, if resp.hovered() { t.text } else { t.icon }); register(ui, format!("activity:cancel:{}", task.id), rect); - clicked = resp.on_hover_text(tr("Cancel")).clicked(); + clicked = resp.on_hover_text(name).clicked(); } }); - bar(ui, task, width); - let line = detail_line(task); + let line = if task.waiting { + // (counted as the Queued toast counts: the waiting tasks ahead of it, after the running one) + if task.place <= 1 { tr("Starts next").to_string() } else { tr_format!("Starts after {n} more", n = task.place - 1) } + } else { + bar(ui, task, width); + detail_line(task) + }; if !line.is_empty() { ui.add(egui::Label::new(RichText::new(line).font(t.font(11.0)).color(t.text_dim)).truncate()); } diff --git a/crates/ui-egui/src/tests/activity.rs b/crates/ui-egui/src/tests/activity.rs index decbc472915..02505025d9c 100644 --- a/crates/ui-egui/src/tests/activity.rs +++ b/crates/ui-egui/src/tests/activity.rs @@ -538,10 +538,10 @@ fn immediate_library_commands_and_auto_sync_show_completion() { assert!(h.app.ui.toast.is_none()); } -/// Given a preview build running and another waiting in line behind it, then the stack shows the running build only, -/// and the waiting one starts by itself, in a frame, when the build ahead of it ends. +/// Given a preview build running and another waiting in line behind it, then the stack shows both (the waiting one +/// with ✕), and the waiting one starts by itself, in a frame, when the build ahead of it ends. #[test] -fn a_task_waiting_in_line_has_no_row_and_starts_when_the_lane_frees() { +fn a_task_waiting_in_line_has_a_row_and_starts_when_the_lane_frees() { use lightcraft_engine::cmd::previews::PreviewBuild; use std::sync::atomic::Ordering; @@ -555,7 +555,10 @@ fn a_task_waiting_in_line_has_no_row_and_starts_when_the_lane_frees() { assert_eq!(h.app.session.activity.list().len(), 2); wait_visible(&mut h); assert!(has(&h, &format!("activity:row:{}", running.id()))); - assert!(!has(&h, &format!("activity:row:{waiting}")) && rows(&h) == 1, "a waiting task draws no row"); + assert!( + has(&h, &format!("activity:row:{waiting}")) && has(&h, &format!("activity:cancel:{waiting}")) && rows(&h) == 2, + "a waiting task draws a row with ✕" + ); // the lane frees with no command asked: the frame loop starts it build.finished.store(true, Ordering::Release); drop(running); diff --git a/crates/ui-egui/src/tests/drop_import.rs b/crates/ui-egui/src/tests/drop_import.rs index a4094d8a1ee..76e1e28450e 100644 --- a/crates/ui-egui/src/tests/drop_import.rs +++ b/crates/ui-egui/src/tests/drop_import.rs @@ -849,6 +849,39 @@ fn a_direct_drop_while_an_import_runs_waits_in_line() { assert_eq!(photos(&h), 2, "the dropped folder's two photos"); } +/// Given an import that runs and two more waiting in line behind it, then each waiting one has a row saying when it +/// starts and a ✕ named for it; ✕ takes that one out of the line and leaves the running import alone. +#[test] +fn a_waiting_import_shows_a_row_and_its_cross_takes_it_out_of_the_line() { + let dir = Scratch::new("waiting-rows"); + let mut h = app(&dir); + h.app.ui.settings.import_dropped_directly = true; + write_png(&dir.path("more/c.png"), 3); + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + drop_files(&mut h, &[dir.path("trip")], false); + drop_files(&mut h, &[dir.path("more")], false); + let waiting = h.app.session.activity.waiting(); + assert_eq!(waiting.len(), 2, "{waiting:?}"); + let (first, second) = (waiting[0].id, waiting[1].id); + for _ in 0..3 { + h.step(); + } + let drawn = |h: &Headless, id: &str| h.app.widgets.iter().any(|(w, _)| w == id); + assert!(drawn(&h, &format!("activity:row:{first}")) && drawn(&h, &format!("activity:row:{second}")), "a row each: {:?}", h.app.widgets); + assert!(said(&h, "Starts next") && said(&h, "Starts after 1 more"), "{:?}", h.painted_text()); + let cross = format!("activity:cancel:{second}"); + assert!(drawn(&h, &cross), "✕ on the waiting row"); + assert_eq!(h.request("ui.clickWidget", json!({"id": cross}), T)["ok"], true); + for _ in 0..4 { + h.step(); + } + assert_eq!(h.app.session.activity.waiting().iter().map(|t| t.id).collect::>(), vec![first], "only the first still waits"); + assert!(!drawn(&h, &format!("activity:row:{second}")), "its row is gone"); + assert!(h.app.session.activity.list().iter().any(|t| !t.waiting && t.kind == "import"), "the running import is untouched"); + assert!(!hold.is_cancelled()); + drop(hold); +} + /// A drop while a scan runs would open a review whose OK replaces the import the scan starts: it is /// refused instead, and the card says so. #[test] diff --git a/docs/background-tasks.md b/docs/background-tasks.md index 2299e894dcd..bbfc90ea45a 100644 --- a/docs/background-tasks.md +++ b/docs/background-tasks.md @@ -71,7 +71,7 @@ A call that sets `queue: true` while its lane is busy does not fail: `Activity::enqueue` keeps what it was asked (`Request`: the command and its parameters, with the photos written out) and `Session::start_waiting` runs it, under the id it had in line, once the lane is free. The engine calls it after every command and the app every frame. `activity.list` shows a waiting task after the running ones (`waiting`, -`place`, `lane`); the activity stack in the app draws only running tasks. `activity.cancel` takes a waiting task out +`place`, `lane`); the activity stack in the app draws a waiting task too, at once, as a row without a bar ("Starts next" or "Starts after N more") with ✕, "Remove from Queue", which runs `activity.cancel`. `activity.cancel` takes a waiting task out of the line, `activity.cancel {all: true}` empties it, and opening another library drops it: the photos it names belong to the old one. At most `MAX_WAITING` (100) tasks wait. Without `queue` a call is refused while its lane is busy, as before. A waiting task whose start fails (there is no smart previews folder any more, say) is logged (the app's own, an import or a Synchronize Folder, also says why in a toast) and the next in line goes on. diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 78eee63fcbf..74e1529d8a6 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder wait for each other instead of refusing; earlier: LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder wait for each other instead of refusing, and a waiting task shows in the activity stack with ✕ to remove it; earlier: LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -461,7 +461,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-BEHAV-BATCH | Batch apply to selection | P0 | ✅ | `cmd:photo.rate`, `cmd:develop.paste`, `cmd:preset.apply`, `cmd:app.export` | | | LR-BEHAV-PREVIEW-HOVER | Hover previews | P1 | ✅ | `crates/ui-egui/src/panels/presets.rs`, `crates/ui-egui/src/panels/profiles.rs`, `crates/ui-egui/src/panels/right.rs` (`versions`), `crates/ui-egui/src/panels/detail.rs` | presets, profile menu, profile browser and versions preview in the loupe | | LR-BEHAV-PROGRESSIVE | Progressive rendering | P0 | ✅ | `crates/engine/src/media.rs`, `crates/preview/src/lib.rs` | | -| LR-BEHAV-BG-TASKS | Background tasks | P0 | ✅ | `cmd:activity.list`, `cmd:activity.cancel`, `crates/engine/src/activity.rs`, `crates/ui-egui/src/panels/activity.rs`, `crates/ui-egui/src/widgets/progress.rs`, `docs/background-tasks.md`, `crates/preview/src/lib.rs` (`JobPool`) | renders off the UI thread; exports run several photos of a batch side by side (`export_parallelism`, memory-gated; files, names and order as one at a time, #496); one activity stack in the top-left corner under the top bar, as in Lightroom Classic (issue #345): imports, folder scans, exports (and the contact sheet PDF), Synchronize Folder (its scan and its run), Build / Smart Previews, Lightroom catalog inspect / import, Photo Merge, model downloads (SAM 3, face, AI Denoise), the face scan, AI Denoise, Find Missing Photos and Reload from Disk (`cmd:photo.reload`, its files decoded on a worker thread, cancellable; `wait: true` for agents) each show a row (name, progress bar or a sweep while the amount isn't known, count and current item) once 0.5 s old, three rows then "+N more"; ✕ cancels the jobs that can stop ("Stopping…" until they do); quitting asks while a cancellable task runs; agents and `ui.inspect` (`activity`) see the same list; an import and a Synchronize Folder never run at once: one asked for while the other runs waits in line and starts by itself (the library lane, `activity::Lane`). No pause (Lightroom can pause some tasks) | +| LR-BEHAV-BG-TASKS | Background tasks | P0 | ✅ | `cmd:activity.list`, `cmd:activity.cancel`, `crates/engine/src/activity.rs`, `crates/ui-egui/src/panels/activity.rs`, `crates/ui-egui/src/widgets/progress.rs`, `docs/background-tasks.md`, `crates/preview/src/lib.rs` (`JobPool`) | renders off the UI thread; exports run several photos of a batch side by side (`export_parallelism`, memory-gated; files, names and order as one at a time, #496); one activity stack in the top-left corner under the top bar, as in Lightroom Classic (issue #345): imports, folder scans, exports (and the contact sheet PDF), Synchronize Folder (its scan and its run), Build / Smart Previews, Lightroom catalog inspect / import, Photo Merge, model downloads (SAM 3, face, AI Denoise), the face scan, AI Denoise, Find Missing Photos and Reload from Disk (`cmd:photo.reload`, its files decoded on a worker thread, cancellable; `wait: true` for agents) each show a row (name, progress bar or a sweep while the amount isn't known, count and current item) once 0.5 s old, three rows then "+N more"; ✕ cancels the jobs that can stop ("Stopping…" until they do); quitting asks while a cancellable task runs; agents and `ui.inspect` (`activity`) see the same list; an import and a Synchronize Folder never run at once: one asked for while the other runs waits in line and starts by itself (the library lane, `activity::Lane`); a task waiting in line has a row in the stack at once, with when it starts and ✕ (Remove from Queue) to take it out of the line. No pause (Lightroom can pause some tasks) | | LR-BEHAV-OFFLINE | Offline editing | P1 | ✅ | | local-first: everything works offline | | LR-BEHAV-WEB-SAFETY | Library safety in the browser build | P1 | 🟡 | `cmd:file.backupLibrary`, `cmd:file.restoreLibrary`, `apps/lightcraft-web/src/safety.rs`, `apps/lightcraft-web/src/backup.rs`, `apps/lightcraft-web/src/files.rs` | web only (experimental): Back Up Library (zip of the catalog and every stored original) and a non-destructive Restore; failed saves show as unsaved and are retried; a photo that can't be stored isn't added; one tab per library (Web Locks); notices for storage that isn't persistent and for a library that can't open; `?reset` asks first; a panic shows a message. Missing: `?safe` start, deleting originals of removed photos, zip64 (backups > 4 GB) | | LR-BEHAV-GPU | GPU acceleration | P0 | ✅ | `crates/gpu/src/render.rs`, `cmd:app.gpu`, `docs/gpu-pipeline.md`, `crates/ui-egui/src/panels/notices.rs` | CPU fallback per render on device limits, out of memory, device errors / loss, incomplete or black results (`perf.gpuReason`, `perf.gpuFallback`; each render reports its own reason — `lightcraft_gpu::try_render`, `gpuFallback` per exported file — issue #675); short submissions for slow iGPUs; backend choice (DX12 only on Windows, `LIGHTCRAFT_GPU_BACKEND` / `WGPU_BACKEND`), device created after the window opens, crash sentinel (issue #136); a GPU lost while LightCraft runs (driver reset) stops it with that message and turns GPU rendering off for the next start, which says why (issue #1337; the window's renderer can't survive the lost device); quitting waits (up to 2 s) for renders in flight and starts no new GPU work, so none is inside the driver when the process exits (`crates/gpu/src/exit.rs`, issue #620; seen crashing only on Linux + NVIDIA, other drivers unverified); with GPU rendering on and no adapter found at all (e.g. no Vulkan loader on NixOS outside `nix develop`), the desktop app says once per session that it renders on the CPU and points to Help ▸ System Info (`gpu_notice`; not when the GPU is turned off or only a software adapter exists); no tiling beyond the buffer limit (CPU) | @@ -959,4 +959,4 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-23 | patch | LR-BEHAV-ACCESS: the name field of New Album, New Smart Album, Rename and the other one-field dialogs takes the keyboard focus once when the dialog opens instead of every frame, so Tab and Shift+Tab reach the check box, Cancel and OK; status unchanged (🟡) | | 2026-10-22 | minor | LR-CROP-AUTO: Auto straighten turns by at most 10° and only on at least 3 agreeing lines, and says when it finds nothing to level by; measured on 68 photos straightened by hand and 300 left as shot, unwanted turns of more than 1° fell from 79 to 19 of the 300. Downgraded ✅ → 🟡: it still leaves most tilted photos alone | | 2026-10-23 | patch | LRC-LIB-FILTERBAR: showing an album (`library.source`) while the filter holds an album drops the filter's album, as showing a library folder already dropped its folder filter; before, the old album stayed in the filter unseen (the filter bar has no album chip) and narrowed the next source such as All Photos; the row's note says so; status unchanged (✅) | -| 2026-10-24 | minor | LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder share the library lane: one asked for while the other runs waits in line instead of being refused; a waiting Synchronize Folder scans again and acts only on the photos its dialog showed; status unchanged (✅) | +| 2026-10-24 | minor | LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder share the library lane: one asked for while the other runs waits in line instead of being refused; a waiting Synchronize Folder scans again and acts only on the photos its dialog showed; every waiting task has a row in the activity stack (when it starts, ✕ to remove it); status unchanged (✅) | diff --git a/docs/whats-new.md b/docs/whats-new.md index 6c330181bfb..f9e11d5d19c 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -8,6 +8,7 @@ was queued. Before, it was refused ("Wait for the import to finish", "A folder is being synchronized"). - Photos dropped on the window, or an import review confirmed, while another import runs also wait in line instead of being refused with "An import is running"; a drop is still refused while a folder is being scanned for the review. +- A task waiting in line shows in the activity stack at once: its name, "Starts next" or "Starts after N more", and ✕ to take it out of the line, so a mistaken one can be withdrawn. This holds for a waiting preview build too. - A waiting import checks for duplicates against the library as it is when its turn comes, so nothing is added twice. - A waiting Synchronize Folder looks at its folder again when its turn comes. It removes or relinks only the photos its dialog showed: one that went missing while it waited is left alone, and the message at the end says so. From 2eda69ab35c3e291d5d839811bd49dd097fc00cc Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sat, 24 Oct 2026 18:47:35 -0400 Subject: [PATCH 08/11] LR-BEHAV-BG-TASKS: review fixes: Auto Import waits in line, a waiting synchronize reads only the sidecars its dialog showed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Auto Import's listing that comes in while the library lane is taken no longer drops the files (the engine has noted them as tried): they wait in line, quietly, as an Auto Import, and a full line leaves the folder to its next listing. A waiting Synchronize Folder reads sidecars of only the photos its dialog listed, like missing and moved ones, and the end says how many were left alone in words that fit all three ("Left alone: N"). A synchronize refused for a full line keeps what its dialog showed. Another library opening ends a waiting synchronize's rescan at once. The import review's OK waits behind a Local folder being read instead of being refused. Counts of 1 read correctly in cs, fr, it and pl. The ✕ names are tested. Co-Authored-By: Claude --- crates/engine/src/sync.rs | 19 +++-- crates/engine/src/tests/sync.rs | 15 ++++ crates/ui-egui/locales/cs-formats.json | 6 +- crates/ui-egui/locales/cs.json | 3 +- crates/ui-egui/locales/de-formats.json | 2 +- crates/ui-egui/locales/de.json | 3 +- crates/ui-egui/locales/es-formats.json | 2 +- crates/ui-egui/locales/es.json | 3 +- crates/ui-egui/locales/fi-formats.json | 2 +- crates/ui-egui/locales/fi.json | 3 +- crates/ui-egui/locales/fr-formats.json | 6 +- crates/ui-egui/locales/fr.json | 3 +- crates/ui-egui/locales/id-formats.json | 2 +- crates/ui-egui/locales/id.json | 3 +- crates/ui-egui/locales/it-formats.json | 6 +- crates/ui-egui/locales/it.json | 3 +- crates/ui-egui/locales/ja-formats.json | 2 +- crates/ui-egui/locales/ja.json | 3 +- crates/ui-egui/locales/ka-formats.json | 2 +- crates/ui-egui/locales/ka.json | 3 +- crates/ui-egui/locales/pl-formats.json | 6 +- crates/ui-egui/locales/pl.json | 3 +- crates/ui-egui/locales/pt-br-formats.json | 2 +- crates/ui-egui/locales/pt-br.json | 3 +- crates/ui-egui/locales/ru-formats.json | 2 +- crates/ui-egui/locales/ru.json | 3 +- crates/ui-egui/locales/sv-formats.json | 2 +- crates/ui-egui/locales/sv.json | 3 +- crates/ui-egui/locales/uk-formats.json | 2 +- crates/ui-egui/locales/uk.json | 3 +- crates/ui-egui/locales/vi-formats.json | 2 +- crates/ui-egui/locales/vi.json | 3 +- crates/ui-egui/locales/zh-hans-formats.json | 2 +- crates/ui-egui/locales/zh-hans.json | 3 +- crates/ui-egui/locales/zh-hant-formats.json | 2 +- crates/ui-egui/locales/zh-hant.json | 3 +- crates/ui-egui/src/app/frame.rs | 18 +--- crates/ui-egui/src/dialogs/import.rs | 2 +- crates/ui-egui/src/dialogs/import/scan.rs | 41 +++++++-- crates/ui-egui/src/dialogs/import/task.rs | 12 +-- crates/ui-egui/src/panels/activity.rs | 7 +- crates/ui-egui/src/sync.rs | 78 +++++++++++------ crates/ui-egui/src/tests/activity.rs | 4 + crates/ui-egui/src/tests/drop_import.rs | 66 +++++++++++++++ crates/ui-egui/src/tests/sync.rs | 93 ++++++++++++++++++++- docs/background-tasks.md | 14 ++-- docs/parity-checklist.md | 2 +- docs/whats-new.md | 11 ++- 48 files changed, 349 insertions(+), 134 deletions(-) diff --git a/crates/engine/src/sync.rs b/crates/engine/src/sync.rs index f20ad9c95ec..6f8be5cbadb 100644 --- a/crates/engine/src/sync.rs +++ b/crates/engine/src/sync.rs @@ -302,13 +302,13 @@ pub fn scan_with(input: SyncInput, progress: &SyncProgress) -> FolderChanges { } /// Whether a photo is the same as far as synchronizing goes: its file, its place in the library -/// and what a sidecar is compared with. Face and pet regions found in the background meanwhile -/// don't make a scan stale. +/// and what a sidecar is compared with. Face and pet regions and the focus point, which the +/// background searches fill in meanwhile, don't make a scan stale. fn same_for_sync(a: &Arc, b: &Arc) -> bool { if Arc::ptr_eq(a, b) { return true; } - let meta = |p: &Photo| lightcraft_catalog::Meta { regions: Vec::new(), ..p.meta.clone() }; + let meta = |p: &Photo| lightcraft_catalog::Meta { regions: Vec::new(), focus: None, ..p.meta.clone() }; (&a.source, a.deleted, a.local, a.copy_of, &a.content_hash, a.file_size, a.rating, a.flag, a.label, &a.captured, &a.edited, &a.develop) == (&b.source, b.deleted, b.local, b.copy_of, &b.content_hash, b.file_size, b.rating, b.flag, b.label, &b.captured, &b.edited, &b.develop) && meta(a) == meta(b) @@ -584,13 +584,18 @@ impl Session { if lightcraft_catalog::query::folder_key(&c.path) != lightcraft_catalog::query::folder_key(path) { return None; } - let f = Filter { library_folder: Some(path.to_string()), ..Default::default() }; + self.scan_is_current(&c).then_some(c) + } + + /// Whether the library still holds the photos `changes` saw in its folder, none of them changed since: a scan that + /// ran on a worker thread from a snapshot (a waiting synchronize's) is acted on only while this holds. + pub fn scan_is_current(&self, changes: &FolderChanges) -> bool { + let f = Filter { library_folder: Some(changes.path.clone()), ..Default::default() }; let mut now: Vec = self.catalog.query(&f, &Sort::default()); - let mut then: Vec = c.seen.iter().map(|p| p.id).collect(); + let mut then: Vec = changes.seen.iter().map(|p| p.id).collect(); now.sort(); then.sort(); - let unchanged = now == then && c.seen.iter().all(|p| self.catalog.photo(p.id).is_some_and(|q| same_for_sync(p, q))); - unchanged.then_some(c) + now == then && changes.seen.iter().all(|p| self.catalog.photo(p.id).is_some_and(|q| same_for_sync(p, q))) } } diff --git a/crates/engine/src/tests/sync.rs b/crates/engine/src/tests/sync.rs index 8b1ec4f6721..1eb651bca1f 100644 --- a/crates/engine/src/tests/sync.rs +++ b/crates/engine/src/tests/sync.rs @@ -566,6 +566,21 @@ fn face_regions_found_meanwhile_leave_the_scan_current() { assert_eq!(r["imported"], 1, "{r}"); } +#[test] +fn a_focus_point_found_meanwhile_leaves_the_scan_current() { + let dir = Scratch::new("focus"); + let mut s = library(&dir); + write_png(&dir.path("trip/c.png"), 3); + scan(&mut s, &dir.path("trip")); + // the background focus-point scan commits a point for a photo of the folder + let a = s.catalog.photos().find(|p| p.file_name == "a.png").unwrap().id; + let mut meta = s.catalog.photo(a).unwrap().meta.clone(); + meta.focus = Some(lightcraft_meta::FocusPoint { rect: Default::default(), mode: None, area: None, tracking: None }); + s.catalog.apply(lightcraft_catalog::Op::SetMeta { id: a, meta: Box::new(meta) }).unwrap(); + let r = s.execute("folder.synchronize", &json!({"path": dir.path("trip"), "scanned": true})).unwrap(); + assert_eq!(r["imported"], 1, "{r}"); +} + /// Synchronizing in halves, as the app does it: readied on the UI thread without touching the /// disk, the work (every file read) on a worker, each step committed back on the UI thread. fn sync_in_halves(s: &mut Session, path: &str, choice: crate::sync::SyncChoice) -> crate::sync::SyncReport { diff --git a/crates/ui-egui/locales/cs-formats.json b/crates/ui-egui/locales/cs-formats.json index baca445ebb6..0b49424366b 100644 --- a/crates/ui-egui/locales/cs-formats.json +++ b/crates/ui-egui/locales/cs-formats.json @@ -306,8 +306,8 @@ "Added {n} photo{}": "Přidáno fotografií: {n}{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Kam má jít katalog Lightroomu „{catalog}“?", "Merge into the open library “{library}” ({count} photo{})": "Sloučit s otevřenou knihovnou „{library}“ (fotografie: {count}{:.0})", - "Queued: it starts after {n} more": "Ve frontě: začne po {n} dalších", - "{n} more missing, left alone: synchronize again to review them": "{n} dalších chybí, ponecháno beze změny: pro kontrolu synchronizujte znovu", - "Starts after {n} more": "Začne po {n} dalších", + "Queued: it starts after {n} more": "Ve frontě: začne po dalších úlohách: {n}", + "Left alone: {n} (synchronize again to review them)": "Ponecháno: {n} (pro kontrolu synchronizujte znovu)", + "Starts after {n} more": "Začne po dalších úlohách: {n}", "Remove from Queue: {label}": "Odebrat z fronty: {label}" } diff --git a/crates/ui-egui/locales/cs.json b/crates/ui-egui/locales/cs.json index 2ffc8846ee3..5d83f25f8a5 100644 --- a/crates/ui-egui/locales/cs.json +++ b/crates/ui-egui/locales/cs.json @@ -16,7 +16,6 @@ "= exactly": "= přesně", "A blank template keeps the original names.": "Prázdná šablona zachová původní názvy.", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Fotografie v tomto zobrazení skrývá filtr: změňte jej nebo jej zrušte (Zobrazení → Zrušit filtry)", - "A folder is being synchronized": "Probíhá synchronizace složky", "A keyword set needs a name": "Sada klíčových slov musí mít název", "A one-time download of about": "Jednorázové stažení přibližně", "A pen's pressure sets the size and flow of the brush": "Přítlak pera určuje velikost a tok štětce", @@ -2023,7 +2022,6 @@ "Visualize range": "Zobrazit rozsah", "Vivid": "Živé", "Vivid Pop": "Živé zvýraznění", - "Wait for the import to finish": "Počkejte na dokončení importu", "Waiting to start…": "Čekání na spuštění…", "Warm Film": "Teplý film", "Warm Glow": "Teplá záře", @@ -2410,5 +2408,6 @@ "Finish Lightroom catalog import before adding photos": "Dokončete import katalogu Lightroom, než přidáte fotky", "Queued: it starts when the task ahead of it ends": "Ve frontě: začne, až skončí úloha před ní", "Another library was opened: nothing was done": "Byla otevřena jiná knihovna: nic se neprovedlo", + "Photos of the folder changed while it was read: nothing was done": "Fotografie ve složce se během čtení změnily: nic se neprovedlo", "Starts next": "Začne jako další" } diff --git a/crates/ui-egui/locales/de-formats.json b/crates/ui-egui/locales/de-formats.json index c0aa7b83095..5b5b38fa33f 100644 --- a/crates/ui-egui/locales/de-formats.json +++ b/crates/ui-egui/locales/de-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Wohin soll der Lightroom-Katalog „{catalog}“?", "Merge into the open library “{library}” ({count} photo{})": "Mit der geöffneten Bibliothek „{library}“ zusammenführen ({count} Foto{})", "Queued: it starts after {n} more": "In der Warteschlange: startet nach {n} weiteren", - "{n} more missing, left alone: synchronize again to review them": "{n} weitere fehlen und blieben unangetastet: zum Prüfen erneut synchronisieren", + "Left alone: {n} (synchronize again to review them)": "Unangetastet: {n} (zum Prüfen erneut synchronisieren)", "Starts after {n} more": "Startet nach {n} weiteren", "Remove from Queue: {label}": "Aus der Warteschlange entfernen: {label}" } diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.json index a809ebe4c3d..7038fcdeba9 100644 --- a/crates/ui-egui/locales/de.json +++ b/crates/ui-egui/locales/de.json @@ -2078,8 +2078,6 @@ "Stopped": "Angehalten", "Stopped by an error (see the log)": "Durch einen Fehler angehalten (siehe Protokoll)", "Not saved": "Nicht gespeichert", - "A folder is being synchronized": "Ein Ordner wird gerade synchronisiert", - "Wait for the import to finish": "Warte, bis der Import abgeschlossen ist", "Appearance": "Erscheinungsbild", "Appearance Mode": "Erscheinungsmodus", "Sync with System": "Mit System synchronisieren", @@ -3442,5 +3440,6 @@ "Finish Lightroom catalog import before adding photos": "Schließe den Import des Lightroom-Katalogs ab, bevor du Fotos hinzufügst", "Queued: it starts when the task ahead of it ends": "In der Warteschlange: startet, wenn die Aufgabe davor endet", "Another library was opened: nothing was done": "Eine andere Bibliothek wurde geöffnet: es wurde nichts getan", + "Photos of the folder changed while it was read: nothing was done": "Fotos des Ordners haben sich beim Lesen geändert: es wurde nichts getan", "Starts next": "Startet als Nächstes" } diff --git a/crates/ui-egui/locales/es-formats.json b/crates/ui-egui/locales/es-formats.json index 405df93e588..aad6ee5face 100644 --- a/crates/ui-egui/locales/es-formats.json +++ b/crates/ui-egui/locales/es-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "¿Dónde debe ir el catálogo de Lightroom “{catalog}”?", "Merge into the open library “{library}” ({count} photo{})": "Combinar con la biblioteca abierta “{library}” ({count} foto{})", "Queued: it starts after {n} more": "En cola: empieza tras {n} más", - "{n} more missing, left alone: synchronize again to review them": "Faltan {n} más, sin tocar: sincroniza de nuevo para revisarlas", + "Left alone: {n} (synchronize again to review them)": "Sin tocar: {n} (sincroniza de nuevo para revisarlos)", "Starts after {n} more": "Empieza tras {n} más", "Remove from Queue: {label}": "Quitar de la cola: {label}" } diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.json index 3dc670f7089..49d1d977d4c 100644 --- a/crates/ui-egui/locales/es.json +++ b/crates/ui-egui/locales/es.json @@ -2106,8 +2106,6 @@ "Stopped": "Detenido", "Stopped by an error (see the log)": "Detenido por un error (ver el registro)", "Not saved": "Sin guardar", - "A folder is being synchronized": "Se está sincronizando una carpeta", - "Wait for the import to finish": "Esperar a que termine la importación", "Appearance": "Apariencia", "Appearance Mode": "Modo de apariencia", "Sync with System": "Sincronizar con el sistema", @@ -2360,5 +2358,6 @@ "Finish Lightroom catalog import before adding photos": "Termina la importación del catálogo de Lightroom antes de añadir fotos", "Queued: it starts when the task ahead of it ends": "En cola: empieza cuando termine la tarea anterior", "Another library was opened: nothing was done": "Se abrió otra biblioteca: no se hizo nada", + "Photos of the folder changed while it was read: nothing was done": "Las fotos de la carpeta cambiaron mientras se leía: no se hizo nada", "Starts next": "Empieza la siguiente" } diff --git a/crates/ui-egui/locales/fi-formats.json b/crates/ui-egui/locales/fi-formats.json index e6caa87a913..8e85c136fb2 100644 --- a/crates/ui-egui/locales/fi-formats.json +++ b/crates/ui-egui/locales/fi-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Minne Lightroom-luettelo ”{catalog}” tuodaan?", "Merge into the open library “{library}” ({count} photo{})": "Yhdistä avoimeen kirjastoon ”{library}” (kuvia: {count}{:.0})", "Queued: it starts after {n} more": "Jonossa: alkaa {n} muun jälkeen", - "{n} more missing, left alone: synchronize again to review them": "{n} muuta puuttuu ja jätettiin ennalleen: synkronoi uudelleen tarkistaaksesi ne", + "Left alone: {n} (synchronize again to review them)": "Jätetty ennalleen: {n} (synkronoi uudelleen tarkistaaksesi)", "Starts after {n} more": "Alkaa {n} muun jälkeen", "Remove from Queue: {label}": "Poista jonosta: {label}" } diff --git a/crates/ui-egui/locales/fi.json b/crates/ui-egui/locales/fi.json index e818f109e0b..09b3a15bf54 100644 --- a/crates/ui-egui/locales/fi.json +++ b/crates/ui-egui/locales/fi.json @@ -21,7 +21,6 @@ "A dark slate backdrop with the exposure, ISO and focal length, then the camera and lens, under each photo.": "Tumma liuskekivitausta, jossa kunkin kuvan alla valotus, ISO ja polttoväli sekä kamera ja objektiivi.", "A face model uses the GPU only when a check shows it gives the same results faster.": "Kasvomalli käyttää GPU:ta vain, jos tarkistus osoittaa sen antavan samat tulokset nopeammin.", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Suodatin piilottaa tämän näkymän kuvat: muuta sitä tai tyhjennä se (Näytä → Tyhjennä suodattimet)", - "A folder is being synchronized": "Kansiota synkronoidaan", "A keyword set needs a name": "Avainsanajoukolle täytyy antaa nimi", "A light grey wall with a white mat and a soft shadow; the caption and the rating under the photo.": "Vaaleanharmaa seinä, valkoinen paspis ja pehmeä varjo; kuvateksti ja luokitus kuvan alla.", "A one-time download of about": "Kertaluonteinen lataus, noin", @@ -2146,7 +2145,6 @@ "Visualize range": "Havainnollista alue", "Vivid": "Eloisa", "Vivid Pop": "Eloisa pop", - "Wait for the import to finish": "Odota tuonnin valmistumista", "Waiting to start…": "Odotetaan käynnistymistä…", "Warm Film": "Lämmin filmi", "Warm Glow": "Lämmin hehku", @@ -2329,5 +2327,6 @@ "Import dropped files without review": "Tuo pudotetut tiedostot ilman tarkistusta", "Queued: it starts when the task ahead of it ends": "Jonossa: alkaa, kun sen edellä oleva tehtävä päättyy", "Another library was opened: nothing was done": "Toinen kirjasto avattiin: mitään ei tehty", + "Photos of the folder changed while it was read: nothing was done": "Kansion valokuvat muuttuivat lukemisen aikana: mitään ei tehty", "Starts next": "Alkaa seuraavaksi" } diff --git a/crates/ui-egui/locales/fr-formats.json b/crates/ui-egui/locales/fr-formats.json index b3d7d0a92d7..b8442d2131e 100644 --- a/crates/ui-egui/locales/fr-formats.json +++ b/crates/ui-egui/locales/fr-formats.json @@ -306,8 +306,8 @@ "Added {n} photo{}": "{n} photo{} ajoutée(s)", "Where should the Lightroom catalog “{catalog}” go?": "Où importer le catalogue Lightroom « {catalog} » ?", "Merge into the open library “{library}” ({count} photo{})": "Fusionner avec la bibliothèque ouverte « {library} » ({count} photo{})", - "Queued: it starts after {n} more": "En file : démarre après {n} autres", - "{n} more missing, left alone: synchronize again to review them": "{n} autres manquantes, laissées telles quelles : synchronisez à nouveau pour les examiner", - "Starts after {n} more": "Démarre après {n} autres", + "Queued: it starts after {n} more": "En file : démarre après {n} autre(s) tâche(s)", + "Left alone: {n} (synchronize again to review them)": "Laissés tels quels : {n} (synchronisez à nouveau pour les examiner)", + "Starts after {n} more": "Démarre après {n} autre(s) tâche(s)", "Remove from Queue: {label}": "Retirer de la file : {label}" } diff --git a/crates/ui-egui/locales/fr.json b/crates/ui-egui/locales/fr.json index ef1faa5f8d6..da8ab1885d1 100644 --- a/crates/ui-egui/locales/fr.json +++ b/crates/ui-egui/locales/fr.json @@ -1914,8 +1914,6 @@ "Stopped": "Arrêté", "Stopped by an error (see the log)": "Arrêté par une erreur (voir le journal)", "Not saved": "Non enregistré", - "A folder is being synchronized": "Un dossier est en cours de synchronisation", - "Wait for the import to finish": "Attendez la fin de l'importation", "Show less": "Afficher moins", "Quit while tasks are running?": "Quitter pendant que des tâches sont en cours ?", "Exporting contact sheet": "Exportation de la planche-contact", @@ -2392,5 +2390,6 @@ "This library couldn't be checked:": "Impossible de vérifier cette bibliothèque :", "Queued: it starts when the task ahead of it ends": "En file : démarre à la fin de la tâche précédente", "Another library was opened: nothing was done": "Une autre bibliothèque a été ouverte : rien n’a été fait", + "Photos of the folder changed while it was read: nothing was done": "Les photos du dossier ont changé pendant la lecture : rien n’a été fait", "Starts next": "Démarre ensuite" } diff --git a/crates/ui-egui/locales/id-formats.json b/crates/ui-egui/locales/id-formats.json index 22637a1805c..c331f292705 100644 --- a/crates/ui-egui/locales/id-formats.json +++ b/crates/ui-egui/locales/id-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Ke mana katalog Lightroom “{catalog}” diimpor?", "Merge into the open library “{library}” ({count} photo{})": "Gabungkan ke pustaka yang terbuka “{library}” ({count} foto{:.0})", "Queued: it starts after {n} more": "Dalam antrean: dimulai setelah {n} lagi", - "{n} more missing, left alone: synchronize again to review them": "{n} lagi hilang dan dibiarkan: sinkronkan lagi untuk memeriksanya", + "Left alone: {n} (synchronize again to review them)": "Dibiarkan: {n} (sinkronkan lagi untuk meninjau)", "Starts after {n} more": "Dimulai setelah {n} lagi", "Remove from Queue: {label}": "Hapus dari antrean: {label}" } diff --git a/crates/ui-egui/locales/id.json b/crates/ui-egui/locales/id.json index 00d6d0753ec..16131bb8e53 100644 --- a/crates/ui-egui/locales/id.json +++ b/crates/ui-egui/locales/id.json @@ -22,7 +22,6 @@ "A dark slate backdrop with the exposure, ISO and focal length, then the camera and lens, under each photo.": "Latar abu-abu gelap berisi eksposur, ISO, dan panjang fokus, lalu kamera dan lensa, di bawah setiap foto.", "A face model uses the GPU only when a check shows it gives the same results faster.": "Model wajah hanya menggunakan GPU jika pengujian menunjukkan hasilnya sama tetapi lebih cepat.", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Filter menyembunyikan foto di tampilan ini: ubah atau hapus filternya (Tampilan → Hapus filter)", - "A folder is being synchronized": "Folder sedang disinkronkan", "A keyword set needs a name": "Set kata kunci harus diberi nama", "A light grey wall with a white mat and a soft shadow; the caption and the rating under the photo.": "Dinding abu-abu muda dengan paspartu putih dan bayangan lembut; keterangan dan rating di bawah foto.", "A one-time download of about": "Unduhan satu kali, sekitar", @@ -2139,7 +2138,6 @@ "Visualize range": "Visualisasikan rentang", "Vivid": "Cerah", "Vivid Pop": "Warna Hidup", - "Wait for the import to finish": "Tunggu hingga impor selesai", "Waiting to start…": "Menunggu untuk dimulai…", "Warm Film": "Film Hangat", "Warm Glow": "Hangat Bercahaya", @@ -2341,5 +2339,6 @@ "Import dropped files without review": "Impor file yang dijatuhkan tanpa tinjauan", "Queued: it starts when the task ahead of it ends": "Dalam antrean: dimulai saat tugas di depannya selesai", "Another library was opened: nothing was done": "Pustaka lain dibuka: tidak ada yang dilakukan", + "Photos of the folder changed while it was read: nothing was done": "Foto di folder berubah saat dibaca: tidak ada yang dilakukan", "Starts next": "Dimulai berikutnya" } diff --git a/crates/ui-egui/locales/it-formats.json b/crates/ui-egui/locales/it-formats.json index e5d958558d7..52b73fc3788 100644 --- a/crates/ui-egui/locales/it-formats.json +++ b/crates/ui-egui/locales/it-formats.json @@ -306,8 +306,8 @@ "Added {n} photo{}": "Foto aggiunte: {n}{:.0}", "Where should the Lightroom catalog “{catalog}” go?": "Dove importare il catalogo Lightroom “{catalog}”?", "Merge into the open library “{library}” ({count} photo{})": "Unisci alla libreria aperta “{library}” (foto: {count}{:.0})", - "Queued: it starts after {n} more": "In coda: parte dopo altre {n}", - "{n} more missing, left alone: synchronize again to review them": "Ne mancano altre {n}, lasciate com'erano: sincronizza di nuovo per esaminarle", - "Starts after {n} more": "Parte dopo altre {n}", + "Queued: it starts after {n} more": "In coda: parte dopo altre attività ({n})", + "Left alone: {n} (synchronize again to review them)": "Lasciati invariati: {n} (sincronizza di nuovo per rivederli)", + "Starts after {n} more": "Parte dopo altre attività ({n})", "Remove from Queue: {label}": "Rimuovi dalla coda: {label}" } diff --git a/crates/ui-egui/locales/it.json b/crates/ui-egui/locales/it.json index 28d4a80c322..b467fadc7d7 100644 --- a/crates/ui-egui/locales/it.json +++ b/crates/ui-egui/locales/it.json @@ -2034,8 +2034,6 @@ "Stopped": "Interrotto", "Stopped by an error (see the log)": "Interrotta da un errore (vedi il log)", "Not saved": "Non salvato", - "A folder is being synchronized": "Una cartella è in sincronizzazione", - "Wait for the import to finish": "Aspetta che l'importazione finisca", "Appearance": "Aspetto", "Appearance Mode": "Modalità aspetto", "Sync with System": "Segui il sistema", @@ -2363,5 +2361,6 @@ "Finish Lightroom catalog import before adding photos": "Termina l'importazione del catalogo Lightroom prima di aggiungere foto", "Queued: it starts when the task ahead of it ends": "In coda: parte quando finisce l'attività precedente", "Another library was opened: nothing was done": "È stata aperta un'altra libreria: non è stato fatto nulla", + "Photos of the folder changed while it was read: nothing was done": "Le foto della cartella sono cambiate durante la lettura: non è stato fatto nulla", "Starts next": "Parte subito dopo" } diff --git a/crates/ui-egui/locales/ja-formats.json b/crates/ui-egui/locales/ja-formats.json index 63366fe394c..ff5030690b0 100644 --- a/crates/ui-egui/locales/ja-formats.json +++ b/crates/ui-egui/locales/ja-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Lightroom カタログ「{catalog}」をどこに読み込みますか?", "Merge into the open library “{library}” ({count} photo{})": "開いているライブラリ「{library}」に統合(写真{count}枚){:.0}", "Queued: it starts after {n} more": "キューに追加: あと {n} 件の後に開始します", - "{n} more missing, left alone: synchronize again to review them": "ほかに {n} 件が見つからず、そのままにしました: 確認するにはもう一度同期してください", + "Left alone: {n} (synchronize again to review them)": "そのまま: {n} 件(再度同期して確認してください)", "Starts after {n} more": "あと {n} 件の後に開始します", "Remove from Queue: {label}": "キューから削除: {label}" } diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.json index 2709a330ca9..6c97e1e93dd 100644 --- a/crates/ui-egui/locales/ja.json +++ b/crates/ui-egui/locales/ja.json @@ -1926,8 +1926,6 @@ "Stopped": "停止しました", "Stopped by an error (see the log)": "エラーで停止しました(ログを参照)", "Not saved": "保存されていません", - "A folder is being synchronized": "フォルダを同期中です", - "Wait for the import to finish": "読み込みが終わるまでお待ちください", "Appearance": "外観", "Appearance Mode": "外観モード", "Sync with System": "システムと同期", @@ -2358,5 +2356,6 @@ "Finish Lightroom catalog import before adding photos": "写真を追加する前に Lightroom カタログの読み込みを完了してください", "Queued: it starts when the task ahead of it ends": "キューに追加: 前のタスクが終わると開始します", "Another library was opened: nothing was done": "別のライブラリが開かれました: 何も行われていません", + "Photos of the folder changed while it was read: nothing was done": "読み取り中にフォルダ内の写真が変更されました: 何も行われていません", "Starts next": "次に開始します" } diff --git a/crates/ui-egui/locales/ka-formats.json b/crates/ui-egui/locales/ka-formats.json index 03b886141a2..ef610bd14cc 100644 --- a/crates/ui-egui/locales/ka-formats.json +++ b/crates/ui-egui/locales/ka-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "სად გადავიტანოთ Lightroom-ის კატალოგი „{catalog}“?", "Merge into the open library “{library}” ({count} photo{})": "გაერთიანება ღია ბიბლიოთეკასთან „{library}“ (ფოტოები: {count}){:.0}", "Queued: it starts after {n} more": "რიგშია: დაიწყება კიდევ {n}-ის შემდეგ", - "{n} more missing, left alone: synchronize again to review them": "კიდევ {n} აკლია და ხელუხლებლად დარჩა: გადასახედად ხელახლა მოახდინეთ სინქრონიზაცია", + "Left alone: {n} (synchronize again to review them)": "უცვლელი დარჩა: {n} (გადასახედად თავიდან დაასინქრონეთ)", "Starts after {n} more": "დაიწყება კიდევ {n}-ის შემდეგ", "Remove from Queue: {label}": "რიგიდან ამოღება: {label}" } diff --git a/crates/ui-egui/locales/ka.json b/crates/ui-egui/locales/ka.json index 98f22f908f9..fc1bc2983f5 100644 --- a/crates/ui-egui/locales/ka.json +++ b/crates/ui-egui/locales/ka.json @@ -63,7 +63,6 @@ "A change that can't be saved to disk (full or unplugged drive) is no longer silent: the command reports": "ცვლილება, რომლის დისკზე შენახვაც ვერ ხერხდება (სავსე ან გამორთული დისკი), აღარ რჩება შეუმჩნეველი: ბრძანება იტყობინება", "A dialog taller than the window no longer runs off it (issue #781): on a 1366×768 screen the Export dialog's title": "ფანჯარაზე მაღალი დიალოგი აღარ გადის მის საზღვრებს გარეთ (ხარვეზი #781): 1366×768 ეკრანზე ექსპორტის დიალოგის სათაური", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "ფილტრი მალავს ამ ხედის ფოტოებს: შეცვალეთ ან გაასუფთავეთ იგი (ხედი → ფილტრების გასუფთავება)", - "A folder is being synchronized": "საქაღალდე სინქრონიზდება", "A keyword set needs a name": "საკვანძო სიტყვების ნაკრებს სახელი სჭირდება", "A label follows its folder when it is renamed or moved in LightCraft, together with the labels of the folders": "იარლიყი თავის საქაღალდეს მიჰყვება, როცა ის LightCraft-ში გადაერქმევა ან გადაიტანება, მასში მყოფი საქაღალდეების", "A library holding thousands of presets (a Lightroom collection imported whole: 11 000 presets, a 42 MB": "ბიბლიოთეკა ათასობით პრესეტით (მთლიანად იმპორტირებული Lightroom-ის კოლექცია: 11 000 პრესეტი, 42 MB-იანი", @@ -2237,7 +2236,6 @@ "Visualize range": "დიაპაზონის ვიზუალიზაცია", "Vivid": "ცოცხალი", "Vivid Pop": "ცოცხალი და მკვეთრი", - "Wait for the import to finish": "დაელოდეთ იმპორტის დასრულებას", "Waiting to start…": "დაწყების მოლოდინში…", "Warm Film": "თბილი ფირი", "Warm Glow": "თბილი ნათება", @@ -2736,5 +2734,6 @@ "Finish Lightroom catalog import before adding photos": "ფოტოების დამატებამდე დაასრულეთ Lightroom-ის კატალოგის იმპორტი", "Queued: it starts when the task ahead of it ends": "რიგშია: დაიწყება, როცა წინა ამოცანა დასრულდება", "Another library was opened: nothing was done": "სხვა ბიბლიოთეკა გაიხსნა: არაფერი გაკეთებულა", + "Photos of the folder changed while it was read: nothing was done": "საქაღალდის ფოტოები წაკითხვისას შეიცვალა: არაფერი გაკეთებულა", "Starts next": "დაიწყება შემდეგი" } diff --git a/crates/ui-egui/locales/pl-formats.json b/crates/ui-egui/locales/pl-formats.json index c0a741cb28c..ad311891b51 100644 --- a/crates/ui-egui/locales/pl-formats.json +++ b/crates/ui-egui/locales/pl-formats.json @@ -306,8 +306,8 @@ "Inside: {names}": "Wewnątrz: {names}", "Where should the Lightroom catalog “{catalog}” go?": "Dokąd zaimportować katalog Lightroom „{catalog}”?", "Merge into the open library “{library}” ({count} photo{})": "Scal z otwartą biblioteką „{library}” (zdjęcia: {count}){:.0}", - "Queued: it starts after {n} more": "W kolejce: rozpocznie się po {n} kolejnych", - "{n} more missing, left alone: synchronize again to review them": "Brakuje jeszcze {n}, pozostawiono bez zmian: zsynchronizuj ponownie, aby je przejrzeć", - "Starts after {n} more": "Rozpocznie się po {n} kolejnych", + "Queued: it starts after {n} more": "W kolejce: rozpocznie się po kolejnych zadaniach ({n})", + "Left alone: {n} (synchronize again to review them)": "Pominięto: {n} (zsynchronizuj ponownie, aby je sprawdzić)", + "Starts after {n} more": "Rozpocznie się po kolejnych zadaniach ({n})", "Remove from Queue: {label}": "Usuń z kolejki: {label}" } diff --git a/crates/ui-egui/locales/pl.json b/crates/ui-egui/locales/pl.json index da7a834f42b..5195fa91cd1 100644 --- a/crates/ui-egui/locales/pl.json +++ b/crates/ui-egui/locales/pl.json @@ -1866,8 +1866,6 @@ "Stopped": "Zatrzymano", "Stopped by an error (see the log)": "Zatrzymano z powodu błędu (zobacz dziennik)", "Not saved": "Nie zapisano", - "A folder is being synchronized": "Trwa synchronizacja folderu", - "Wait for the import to finish": "Poczekaj na zakończenie importu", "Show less": "Pokaż mniej", "Quit while tasks are running?": "Zakończyć, gdy trwają zadania?", "Exporting contact sheet": "Eksportowanie arkusza stykowego", @@ -2285,5 +2283,6 @@ "Finish Lightroom catalog import before adding photos": "Zakończ import katalogu Lightrooma, zanim dodasz zdjęcia", "Queued: it starts when the task ahead of it ends": "W kolejce: rozpocznie się po zakończeniu poprzedniego zadania", "Another library was opened: nothing was done": "Otwarto inną bibliotekę: nic nie zrobiono", + "Photos of the folder changed while it was read: nothing was done": "Zdjęcia w folderze zmieniły się podczas odczytu: nic nie zrobiono", "Starts next": "Rozpocznie się jako następne" } diff --git a/crates/ui-egui/locales/pt-br-formats.json b/crates/ui-egui/locales/pt-br-formats.json index 90a6c23d291..4960090f14f 100644 --- a/crates/ui-egui/locales/pt-br-formats.json +++ b/crates/ui-egui/locales/pt-br-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Para onde vai o catálogo do Lightroom “{catalog}”?", "Merge into the open library “{library}” ({count} photo{})": "Mesclar na biblioteca aberta “{library}” ({count} foto{})", "Queued: it starts after {n} more": "Na fila: começa depois de mais {n}", - "{n} more missing, left alone: synchronize again to review them": "Faltam mais {n}, deixadas como estavam: sincronize de novo para revisá-las", + "Left alone: {n} (synchronize again to review them)": "Deixados como estavam: {n} (sincronize de novo para revisá-los)", "Starts after {n} more": "Começa depois de mais {n}", "Remove from Queue: {label}": "Remover da fila: {label}" } diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.json index e210d177197..8d58d8e1082 100644 --- a/crates/ui-egui/locales/pt-br.json +++ b/crates/ui-egui/locales/pt-br.json @@ -1924,8 +1924,6 @@ "Stopped": "Interrompido", "Stopped by an error (see the log)": "Interrompido por um erro (veja o log)", "Not saved": "Não salvo", - "A folder is being synchronized": "Uma pasta está sendo sincronizada", - "Wait for the import to finish": "Aguarde a importação terminar", "Appearance": "Aparência", "Appearance Mode": "Modo de aparência", "Sync with System": "Sincronizar com o sistema", @@ -2204,5 +2202,6 @@ "Finish Lightroom catalog import before adding photos": "Conclua a importação do catálogo do Lightroom antes de adicionar fotos", "Queued: it starts when the task ahead of it ends": "Na fila: começa quando a tarefa anterior terminar", "Another library was opened: nothing was done": "Outra biblioteca foi aberta: nada foi feito", + "Photos of the folder changed while it was read: nothing was done": "As fotos da pasta mudaram durante a leitura: nada foi feito", "Starts next": "Começa em seguida" } diff --git a/crates/ui-egui/locales/ru-formats.json b/crates/ui-egui/locales/ru-formats.json index 0db7b87b32d..de63d603eac 100644 --- a/crates/ui-egui/locales/ru-formats.json +++ b/crates/ui-egui/locales/ru-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Куда импортировать каталог Lightroom «{catalog}»?", "Merge into the open library “{library}” ({count} photo{})": "Объединить с открытой библиотекой «{library}» (фото: {count}){:.0}", "Queued: it starts after {n} more": "В очереди: начнётся после ещё {n}", - "{n} more missing, left alone: synchronize again to review them": "Не хватает ещё {n}, оставлены как есть: синхронизируйте снова, чтобы их просмотреть", + "Left alone: {n} (synchronize again to review them)": "Оставлено без изменений: {n} (синхронизируйте снова, чтобы проверить)", "Starts after {n} more": "Начнётся после ещё {n}", "Remove from Queue: {label}": "Убрать из очереди: {label}" } diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index dabb4c10039..dd87893628b 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -1637,8 +1637,6 @@ "Stopped": "Остановлено", "Stopped by an error (see the log)": "Остановлено из-за ошибки (см. журнал)", "Not saved": "Не сохранено", - "A folder is being synchronized": "Папка синхронизируется", - "Wait for the import to finish": "Дождитесь завершения импорта", "Appearance": "Оформление", "Appearance Mode": "Режим оформления", "Sync with System": "Как в системе", @@ -2351,5 +2349,6 @@ "Finish Lightroom catalog import before adding photos": "Завершите импорт каталога Lightroom, прежде чем добавлять фото", "Queued: it starts when the task ahead of it ends": "В очереди: начнётся, когда закончится задача перед ней", "Another library was opened: nothing was done": "Открыта другая библиотека: ничего не сделано", + "Photos of the folder changed while it was read: nothing was done": "Фотографии в папке изменились во время чтения: ничего не сделано", "Starts next": "Начнётся следующей" } diff --git a/crates/ui-egui/locales/sv-formats.json b/crates/ui-egui/locales/sv-formats.json index 06ce7f8a7f0..1e71f5f9a6c 100644 --- a/crates/ui-egui/locales/sv-formats.json +++ b/crates/ui-egui/locales/sv-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Vart ska Lightroom-katalogen ”{catalog}” importeras?", "Merge into the open library “{library}” ({count} photo{})": "Slå samman med det öppna biblioteket ”{library}” ({count} foto{:.0})", "Queued: it starts after {n} more": "I kö: startar efter {n} till", - "{n} more missing, left alone: synchronize again to review them": "{n} fler saknas och lämnades orörda: synkronisera igen för att granska dem", + "Left alone: {n} (synchronize again to review them)": "Lämnade orörda: {n} (synkronisera igen för att granska dem)", "Starts after {n} more": "Startar efter {n} till", "Remove from Queue: {label}": "Ta bort från kön: {label}" } diff --git a/crates/ui-egui/locales/sv.json b/crates/ui-egui/locales/sv.json index 16b96132f52..9a6594fdad3 100644 --- a/crates/ui-egui/locales/sv.json +++ b/crates/ui-egui/locales/sv.json @@ -32,7 +32,6 @@ "A change that can't be saved to disk (full or unplugged drive) is no longer silent: the command reports": "En ändring som inte kan sparas till disk (full eller urkopplad enhet) är inte längre tyst: kommandot rapporterar", "A dark slate backdrop with the exposure, ISO and focal length, then the camera and lens, under each photo.": "En mörk skifferbakgrund med exponering, ISO och brännvidd, sedan kamera och objektiv, under varje foto.", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Ett filter döljer den här vyns foton: ändra det eller rensa det (Visa → Rensa filter)", - "A folder is being synchronized": "En mapp synkroniseras", "a full drive) no longer counts as built and Build Smart Previews replaces it.": "en full enhet) räknas inte längre som byggd och Bygg smarta förhandsgranskningar ersätter den.", "A keyword set needs a name": "En nyckelordsuppsättning behöver ett namn", "A library is open in one program at a time (issue #99): opening a library that LightCraft or `lightcraft-cli` already": "Ett bibliotek kan bara vara öppet i ett program åt gången (ärende #99): att öppna ett bibliotek som LightCraft eller `lightcraft-cli` redan", @@ -2335,7 +2334,6 @@ "Vivid": "Livfull", "Vivid Pop": "Livfull pop", "volumes (Linux, case-sensitive APFS) `img_1.JPG` next to `IMG_1.JPG` is a different photo and the renamed one gets": "volymer (Linux, skiftlägeskänslig APFS) är `img_1.JPG` bredvid `IMG_1.JPG` ett annat foto och det omdöpta får", - "Wait for the import to finish": "Vänta tills importen är klar", "Waiting to start…": "Väntar på att starta…", "Warm Film": "Varm film", "Warm Glow": "Varm glöd", @@ -2431,5 +2429,6 @@ "Import dropped files without review": "Importera släppta filer utan granskning", "Queued: it starts when the task ahead of it ends": "I kö: startar när uppgiften före är klar", "Another library was opened: nothing was done": "Ett annat bibliotek öppnades: ingenting gjordes", + "Photos of the folder changed while it was read: nothing was done": "Fotona i mappen ändrades medan den lästes: ingenting gjordes", "Starts next": "Startar härnäst" } diff --git a/crates/ui-egui/locales/uk-formats.json b/crates/ui-egui/locales/uk-formats.json index a86f38de075..045d654b817 100644 --- a/crates/ui-egui/locales/uk-formats.json +++ b/crates/ui-egui/locales/uk-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Куди імпортувати каталог Lightroom «{catalog}»?", "Merge into the open library “{library}” ({count} photo{})": "Об’єднати з відкритою бібліотекою «{library}» (фото: {count}){:.0}", "Queued: it starts after {n} more": "У черзі: почнеться після ще {n}", - "{n} more missing, left alone: synchronize again to review them": "Бракує ще {n}, залишено як є: синхронізуйте знову, щоб їх переглянути", + "Left alone: {n} (synchronize again to review them)": "Залишено без змін: {n} (синхронізуйте знову, щоб переглянути)", "Starts after {n} more": "Почнеться після ще {n}", "Remove from Queue: {label}": "Прибрати з черги: {label}" } diff --git a/crates/ui-egui/locales/uk.json b/crates/ui-egui/locales/uk.json index cf2ff1448dd..b4798a7feaf 100644 --- a/crates/ui-egui/locales/uk.json +++ b/crates/ui-egui/locales/uk.json @@ -2108,8 +2108,6 @@ "Stopped": "Зупинено", "Stopped by an error (see the log)": "Зупинено через помилку (див. журнал)", "Not saved": "Не збережено", - "A folder is being synchronized": "Тека синхронізується", - "Wait for the import to finish": "Дочекайтеся завершення імпорту", "Show less": "Показати менше", "Quit while tasks are running?": "Вийти, поки виконуються завдання?", "Exporting contact sheet": "Експорт аркуша мініатюр", @@ -2356,5 +2354,6 @@ "Finish Lightroom catalog import before adding photos": "Завершіть імпорт каталогу Lightroom, перш ніж додавати фото", "Queued: it starts when the task ahead of it ends": "У черзі: почнеться, коли завершиться попереднє завдання", "Another library was opened: nothing was done": "Відкрито іншу бібліотеку: нічого не зроблено", + "Photos of the folder changed while it was read: nothing was done": "Фотографії в теці змінилися під час читання: нічого не зроблено", "Starts next": "Почнеться наступним" } diff --git a/crates/ui-egui/locales/vi-formats.json b/crates/ui-egui/locales/vi-formats.json index c03c61896f1..14bb4142c36 100644 --- a/crates/ui-egui/locales/vi-formats.json +++ b/crates/ui-egui/locales/vi-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Nhập danh mục Lightroom «{catalog}» vào đâu?", "Merge into the open library “{library}” ({count} photo{})": "Gộp vào thư viện đang mở «{library}» ({count} ảnh{:.0})", "Queued: it starts after {n} more": "Trong hàng đợi: bắt đầu sau {n} tác vụ nữa", - "{n} more missing, left alone: synchronize again to review them": "Còn {n} mục bị thiếu được giữ nguyên: hãy đồng bộ hóa lại để xem xét", + "Left alone: {n} (synchronize again to review them)": "Để nguyên: {n} (đồng bộ lại để xem xét)", "Starts after {n} more": "Bắt đầu sau {n} tác vụ nữa", "Remove from Queue: {label}": "Xóa khỏi hàng đợi: {label}" } diff --git a/crates/ui-egui/locales/vi.json b/crates/ui-egui/locales/vi.json index 9d127ff71a1..4bc0e984d81 100644 --- a/crates/ui-egui/locales/vi.json +++ b/crates/ui-egui/locales/vi.json @@ -26,7 +26,6 @@ "A blank template keeps the original names.": "Mẫu trống giữ tên gốc.", "A change that can't be saved to disk (full or unplugged drive) is no longer silent: the command reports": "Thay đổi không thể lưu ra đĩa (đĩa đầy hoặc đã rút) không còn im lặng: lệnh báo", "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Bộ lọc đang ẩn ảnh trong chế độ xem này: đổi bộ lọc hoặc xóa (Xem → Xóa bộ lọc)", - "A folder is being synchronized": "Một thư mục đang được đồng bộ", "A keyword set needs a name": "Bộ từ khóa cần một tên", "A library is open in one program at a time (issue #99): opening a library that LightCraft or `lightcraft-cli` already": "Một thư viện chỉ mở trong một chương trình tại một thời điểm (issue #99): mở thư viện mà LightCraft hoặc `lightcraft-cli` đã", "A one-time download of about": "Tải một lần khoảng", @@ -1958,7 +1957,6 @@ "Visualize range": "Hiển thị dải", "Vivid": "Rực rỡ", "Vivid Pop": "Bật rực", - "Wait for the import to finish": "Đợi nhập hoàn tất", "Waiting to start…": "Đang chờ bắt đầu…", "Warm Film": "Phim ấm", "Warm Glow": "Ánh ấm", @@ -2237,5 +2235,6 @@ "Import dropped files without review": "Nhập các tệp đã thả mà không xem lại", "Queued: it starts when the task ahead of it ends": "Trong hàng đợi: bắt đầu khi tác vụ trước nó kết thúc", "Another library was opened: nothing was done": "Đã mở thư viện khác: không có gì được thực hiện", + "Photos of the folder changed while it was read: nothing was done": "Ảnh trong thư mục đã thay đổi trong lúc đọc: không có gì được thực hiện", "Starts next": "Bắt đầu tiếp theo" } diff --git a/crates/ui-egui/locales/zh-hans-formats.json b/crates/ui-egui/locales/zh-hans-formats.json index 4bb13622240..fa961db45e2 100644 --- a/crates/ui-egui/locales/zh-hans-formats.json +++ b/crates/ui-egui/locales/zh-hans-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Lightroom 目录“{catalog}”要导入到哪里?", "Merge into the open library “{library}” ({count} photo{})": "合并到当前打开的图库“{library}”({count} 张照片){:.0}", "Queued: it starts after {n} more": "已加入队列:再过 {n} 个后开始", - "{n} more missing, left alone: synchronize again to review them": "还有 {n} 个缺失,未作处理:再次同步以检查它们", + "Left alone: {n} (synchronize again to review them)": "未处理:{n}(再次同步以查看)", "Starts after {n} more": "再过 {n} 个后开始", "Remove from Queue: {label}": "从队列中移除:{label}" } diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.json index afdb746b3f8..2fc62f58bd2 100644 --- a/crates/ui-egui/locales/zh-hans.json +++ b/crates/ui-egui/locales/zh-hans.json @@ -1918,8 +1918,6 @@ "Stopped": "已停止", "Stopped by an error (see the log)": "因错误而停止(见日志)", "Not saved": "未保存", - "A folder is being synchronized": "正在同步文件夹", - "Wait for the import to finish": "请等待导入完成", "Appearance": "外观", "Appearance Mode": "外观模式", "Sync with System": "与系统同步", @@ -2202,5 +2200,6 @@ "Finish Lightroom catalog import before adding photos": "添加照片前,请先完成 Lightroom 目录的导入", "Queued: it starts when the task ahead of it ends": "已加入队列:前一个任务结束后开始", "Another library was opened: nothing was done": "已打开另一个图库:未执行任何操作", + "Photos of the folder changed while it was read: nothing was done": "读取期间文件夹中的照片发生了变化:未执行任何操作", "Starts next": "接下来开始" } diff --git a/crates/ui-egui/locales/zh-hant-formats.json b/crates/ui-egui/locales/zh-hant-formats.json index 35a436c7c26..b40a6592281 100644 --- a/crates/ui-egui/locales/zh-hant-formats.json +++ b/crates/ui-egui/locales/zh-hant-formats.json @@ -307,7 +307,7 @@ "Where should the Lightroom catalog “{catalog}” go?": "Lightroom 目錄「{catalog}」要匯入到哪裡?", "Merge into the open library “{library}” ({count} photo{})": "合併到目前開啟的照片庫「{library}」({count} 張照片){:.0}", "Queued: it starts after {n} more": "已加入佇列:再過 {n} 個後開始", - "{n} more missing, left alone: synchronize again to review them": "還有 {n} 個遺失,未作處理:再次同步以檢查它們", + "Left alone: {n} (synchronize again to review them)": "未處理:{n}(再次同步以檢視)", "Starts after {n} more": "再過 {n} 個後開始", "Remove from Queue: {label}": "從佇列中移除:{label}" } diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.json index 006e49fc447..2a99cb4b941 100644 --- a/crates/ui-egui/locales/zh-hant.json +++ b/crates/ui-egui/locales/zh-hant.json @@ -1924,8 +1924,6 @@ "Stopped": "已停止", "Stopped by an error (see the log)": "因錯誤而停止(請見記錄)", "Not saved": "未儲存", - "A folder is being synchronized": "正在同步資料夾", - "Wait for the import to finish": "請等待匯入完成", "Appearance": "外觀", "Appearance Mode": "外觀模式", "Sync with System": "與系統同步", @@ -2159,5 +2157,6 @@ "Finish Lightroom catalog import before adding photos": "新增照片前,請先完成 Lightroom 目錄的匯入", "Queued: it starts when the task ahead of it ends": "已加入佇列:前一個工作結束後開始", "Another library was opened: nothing was done": "已開啟另一個圖庫:未執行任何操作", + "Photos of the folder changed while it was read: nothing was done": "讀取期間資料夾中的照片發生了變化:未執行任何操作", "Starts next": "接下來開始" } diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 04874c8cc6a..51593276eaf 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -89,21 +89,9 @@ impl LightcraftApp { if now - self.ui.auto_import_at >= 3.0 && !import::library_busy(self) && self.lightroom.is_none() && !self.tasks.is_running(LABEL) { self.ui.auto_import_at = now; let work = move || lightcraft_engine::cmd::library::list_auto_import_folder(&folder); - let done = |app: &mut LightcraftApp, _ctx: &egui::Context, listing: Result, String>| { - let listing = match listing { - Ok(l) => l, - Err(e) => return log::debug!("auto import: {e}"), - }; - let p = serde_json::json!({"listing": listing, "start": false}); - let Ok(r) = app.session.execute("library.autoImportScan", &p) else { return }; - let Some(mut params) = r.get("import").cloned().filter(|_| !import::library_busy(app)) else { return }; - let paths: Vec = - params["paths"].as_array().into_iter().flatten().filter_map(|v| v.as_str().map(str::to_string)).collect(); - if let Some(o) = params.as_object_mut() { - o.remove("paths"); - } - let undo0 = app.session.undo.len(); - app.import = Some(import::ImportTask::new(paths, params, undo0, false).auto()); + let done = |app: &mut LightcraftApp, _ctx: &egui::Context, listing: Result, String>| match listing { + Ok(listing) => import::auto_import_listed(app, listing), + Err(e) => log::debug!("auto import: {e}"), }; // listed every few seconds: quiet, no row in the activity stack if let Err(e) = tasks::spawn(self, LABEL, None, work, done) { diff --git a/crates/ui-egui/src/dialogs/import.rs b/crates/ui-egui/src/dialogs/import.rs index bfddcc35503..ab1f856e8d3 100644 --- a/crates/ui-egui/src/dialogs/import.rs +++ b/crates/ui-egui/src/dialogs/import.rs @@ -36,7 +36,7 @@ pub(crate) use body::{DIALOG_SIZE, note_dialog_bottom}; pub(crate) use scan::library_busy; pub use scan::{IMPORT_REQUEST, ScanTask, browse, drop_blocked, open, poll_scan, running}; #[cfg(not(target_arch = "wasm32"))] -pub(crate) use scan::cards_seen; +pub(crate) use scan::{auto_import_listed, cards_seen}; #[cfg(test)] pub(crate) use scan::{stall_scan, stall_scan_of}; pub(crate) use tags::{tag_field_width, tag_help, tag_toggle, unknown_tags_warning}; diff --git a/crates/ui-egui/src/dialogs/import/scan.rs b/crates/ui-egui/src/dialogs/import/scan.rs index 43edb41ae91..5f1661a585e 100644 --- a/crates/ui-egui/src/dialogs/import/scan.rs +++ b/crates/ui-egui/src/dialogs/import/scan.rs @@ -28,8 +28,8 @@ fn scan_guard(app: &LightcraftApp, progress: &ScanProgress, browse: bool) -> lig /// `library.import` params. pub const IMPORT_REQUEST: &str = "app:import"; -fn import_request(paths: &[String], params: &Value) -> Request { - Request { command: IMPORT_REQUEST.into(), params: json!({"paths": paths, "params": params}) } +fn import_request(paths: &[String], params: &Value, auto: bool) -> Request { + Request { command: IMPORT_REQUEST.into(), params: json!({"paths": paths, "params": params, "auto": auto}) } } /// The library lane is taken: an import (or the reading of a Local folder) or a Synchronize Folder runs, or waits @@ -44,13 +44,42 @@ pub(crate) fn library_busy(app: &LightcraftApp) -> bool { || app.session.activity.lane_waiting(Lane::Library) } -/// Put an import of `paths` with `params` in line behind what runs in the library lane, and say so. -pub(super) fn wait_in_line(app: &mut LightcraftApp, paths: &[String], params: &Value) -> Result { - let (id, place) = app.session.activity.enqueue("import", "Importing", import_request(paths, params))?; - app.queued_toast(place as u64); +/// Put an import of `paths` with `params` in line behind what runs in the library lane, and say so (an Auto Import +/// quietly: nobody asked for it). +pub(super) fn wait_in_line(app: &mut LightcraftApp, paths: &[String], params: &Value, auto: bool) -> Result { + let (id, place) = app.session.activity.enqueue("import", "Importing", import_request(paths, params, auto))?; + if !auto { + app.queued_toast(place as u64); + } Ok(json!({"queued": id, "place": place})) } +/// The watched folder was listed (Auto Import): import what is new in it, as an Auto Import. The engine has noted +/// those files as tried by now, so while the library lane is taken (it was free when the listing began) they wait in +/// line instead of being dropped. +#[cfg(not(target_arch = "wasm32"))] +pub(crate) fn auto_import_listed(app: &mut LightcraftApp, listing: Vec<(String, u64)>) { + // no room in the line: leave the folder to its next listing, because the scan below notes its files as tried + if library_busy(app) && app.session.activity.waiting().len() >= lightcraft_engine::activity::MAX_WAITING { + return; + } + let p = json!({"listing": listing, "start": false}); + let Ok(r) = app.session.execute("library.autoImportScan", &p) else { return }; + let Some(mut params) = r.get("import").cloned() else { return }; + let paths: Vec = params["paths"].as_array().into_iter().flatten().filter_map(|v| v.as_str().map(str::to_string)).collect(); + if let Some(o) = params.as_object_mut() { + o.remove("paths"); + } + if library_busy(app) { + if let Err(e) = wait_in_line(app, &paths, ¶ms, true) { + log::warn!("auto import: {e}"); + } + return; + } + let undo0 = app.session.undo.len(); + app.import = Some(ImportTask::new(paths, params, undo0, false).auto()); +} + /// Settings → Import → "Show the import review when a camera or card is connected", called with /// each device scan while it's on. The first look only notes the cards already in. A card that /// shows up after that opens Import from Device once nothing else is open, and a card that is diff --git a/crates/ui-egui/src/dialogs/import/task.rs b/crates/ui-egui/src/dialogs/import/task.rs index a66dfe9cd08..c38c221fc82 100644 --- a/crates/ui-egui/src/dialogs/import/task.rs +++ b/crates/ui-egui/src/dialogs/import/task.rs @@ -201,10 +201,6 @@ pub fn start(app: &mut LightcraftApp, d: &ImportDialog) -> Result if !d.in_library(app) { return Err("another library was opened since the photos were scanned: nothing was imported".into()); } - // a browse scan that finishes starts its own import, replacing this one - if app.scan.as_ref().is_some_and(|t| t.browse) { - return Err(crate::i18n::tr("An import is running").to_string()); - } let queue = d.selected_paths(); if queue.is_empty() { return Err("no photos selected".into()); @@ -257,7 +253,7 @@ pub fn start(app: &mut LightcraftApp, d: &ImportDialog) -> Result // the review's thumbnails are done with, whether it runs now or later app.renderer.forget_imports(); if waits { - return wait_in_line(app, &queue, ¶ms); + return wait_in_line(app, &queue, ¶ms, false); } let total = queue.len(); app.import = Some(ImportTask::new(queue, params, undo0, false)); @@ -272,7 +268,7 @@ pub fn start_paths(app: &mut LightcraftApp, paths: Vec) -> Result String { + if task.waiting { tr_format!("Remove from Queue: {label}", label = tr(&task.label)) } else { tr("Cancel").to_string() } +} + /// One task: name and ✕, the bar, the detail line (a waiting one: name and ✕, when it starts). True when ✕ was clicked. fn row(ui: &mut egui::Ui, t: &Tokens, task: &TaskInfo, width: f32) -> bool { let mut clicked = false; @@ -133,7 +138,7 @@ fn row(ui: &mut egui::Ui, t: &Tokens, task: &TaskInfo, width: f32) -> bool { }); if cross { let (rect, resp) = ui.allocate_exact_size(vec2(CROSS, CROSS), Sense::click()); - let name = if task.waiting { tr_format!("Remove from Queue: {label}", label = tr(&task.label)) } else { tr("Cancel").to_string() }; + let name = cross_name(task); crate::widgets::announce(&resp, name.clone()); paint(ui.painter(), rect.shrink(2.0), Icon::Close, if resp.hovered() { t.text } else { t.icon }); register(ui, format!("activity:cancel:{}", task.id), rect); diff --git a/crates/ui-egui/src/sync.rs b/crates/ui-egui/src/sync.rs index 254db3d52a9..db48585c6f3 100644 --- a/crates/ui-egui/src/sync.rs +++ b/crates/ui-egui/src/sync.rs @@ -6,8 +6,9 @@ //! //! A Synchronize asked for while an import or another synchronize runs waits in line behind it (the library lane, //! [`lightcraft_engine::activity::Lane::Library`]). When its turn comes it scans the folder again ([`SyncRescan`]) and -//! then runs as it was asked, but it removes or relinks only the photos its dialog showed: one that went missing -//! meanwhile was never shown to the person, so it is left alone, and the end says so. +//! then runs as it was asked, but it removes, relinks or reads sidecars of only the photos its dialog showed: one that +//! went missing, moved or got a sidecar update meanwhile was never shown to the person, so it is left alone, and the +//! end says so. use std::sync::Arc; use std::sync::atomic::Ordering; @@ -242,19 +243,23 @@ pub fn confirm(app: &mut LightcraftApp, dlg: &Dialog) -> Result { let choice = SyncChoice { import_new: *import_new, relink_moved: *relink_moved, remove_missing: *remove_missing, read_metadata: *read_metadata }; // (an import readies its files against the library as it was: both could add the same file) if crate::import::library_busy(app) { - // what the dialog showed: only these are removed or relinked, whenever the run comes + // what the dialog showed: only these are removed, relinked or read, whenever the run comes let shown = app .session .folder_changes .as_ref() .filter(|c| lightcraft_catalog::query::folder_key(&c.path) == lightcraft_catalog::query::folder_key(path)); - let (missing, moved): (Vec, Vec) = - shown.map(|c| (c.missing.iter().map(|m| m.id).collect(), c.moved.iter().map(|m| m.id).collect())).unwrap_or_default(); - let request = sync_request(path, name, *disk, choice, &missing, &moved); + let shown = shown.map(|c| Shown { + missing: c.missing.iter().map(|m| m.id).collect(), + moved: c.moved.iter().map(|m| m.id).collect(), + metadata: c.metadata.iter().map(|m| m.id).collect(), + }); + let request = sync_request(path, name, *disk, choice, &shown.unwrap_or_default()); + // (the dialog's scan is let go only once the line has room: refused, the dialog stays open holding it) + let (id, place) = app.session.activity.enqueue("sync", "Synchronizing folder", request)?; if std::mem::take(&mut app.sync_owns_changes) { app.session.folder_changes = None; } - let (id, place) = app.session.activity.enqueue("sync", "Synchronizing folder", request)?; app.queued_toast(place as u64); return Ok(json!({"queued": id, "place": place})); } @@ -284,7 +289,7 @@ pub fn confirm(app: &mut LightcraftApp, dlg: &Dialog) -> Result { } /// Hand the work of a synchronize to a worker thread, its steps committed between frames ([`poll_run`]). `left_alone`: -/// photos found missing (or moved) that its dialog never showed, said at the end. +/// photos found missing, moved or with a sidecar update that its dialog never showed, said at the end. fn run( app: &mut LightcraftApp, name: &str, @@ -324,15 +329,23 @@ fn run( /// The command of a Synchronize Folder's request ([`Request`]): the app runs it ([`start_request`]). pub const SYNC_REQUEST: &str = "app:synchronize"; -/// What a synchronize was asked, to run it later in line or again: the folder, the dialog's choices, and the missing -/// and moved photos it showed (the only ones it may remove or relink). -fn sync_request(path: &str, name: &str, disk: bool, choice: SyncChoice, missing: &[u64], moved: &[u64]) -> Request { +/// The photos a Synchronize Folder dialog listed: the only ones its run may act on if it waits in line. +#[derive(Default)] +struct Shown { + missing: Vec, + moved: Vec, + metadata: Vec, +} + +/// What a synchronize was asked, to run it later in line or again: the folder, the dialog's choices, and the missing, +/// moved and metadata-updated photos it showed (the only ones it may remove, relink or read). +fn sync_request(path: &str, name: &str, disk: bool, choice: SyncChoice, shown: &Shown) -> Request { Request { command: SYNC_REQUEST.into(), params: json!({ "path": path, "name": name, "disk": disk, "importNew": choice.import_new, "relinkMoved": choice.relink_moved, "removeMissing": choice.remove_missing, "readMetadata": choice.read_metadata, - "missing": missing, "moved": moved, + "missing": shown.missing, "moved": shown.moved, "metadata": shown.metadata, }), } } @@ -341,9 +354,10 @@ fn sync_request(path: &str, name: &str, disk: bool, choice: SyncChoice, missing: pub struct SyncRescan { name: String, choice: SyncChoice, - /// The missing and moved photos its dialog showed. + /// The missing, moved and metadata-updated photos its dialog showed. missing: std::collections::HashSet, moved: std::collections::HashSet, + metadata: std::collections::HashSet, /// The library it was asked in ([`lightcraft_engine::Session::library_generation`]): its photo ids mean nothing in /// another one. library: u64, @@ -381,23 +395,28 @@ pub fn start_request(app: &mut LightcraftApp, _ctx: &egui::Context, request: &Re let guard = app.session.activity.start("sync", "Synchronizing folder", Cancel::Flag(progress.files.cancel.clone())); guard.detail(&name); let library = app.session.library_generation(); - app.sync_queued = Some(SyncRescan { name, choice, missing: ids("missing"), moved: ids("moved"), library, progress, rx, guard }); + app.sync_queued = + Some(SyncRescan { name, choice, missing: ids("missing"), moved: ids("moved"), metadata: ids("metadata"), library, progress, rx, guard }); Ok(()) } -/// Run the waiting synchronize once its scan is in (called every frame): only the missing and moved photos its dialog -/// showed are acted on. +/// Run the waiting synchronize once its scan is in (called every frame): only the missing, moved and metadata-updated +/// photos its dialog showed are acted on. pub fn poll_rescan(app: &mut LightcraftApp, ctx: &egui::Context) { let Some(task) = app.sync_queued.as_ref() else { return }; - let (done, total) = task.progress.counts(); - task.guard.progress(done as u64, total as u64); + // (how many folders and files were listed first: a count stuck at "0 of N" looks like a scan that stopped) + let (done, total, detail) = scan_row(&task.progress, &task.name); + task.guard.progress(done, total); + task.guard.detail(&detail); ctx.request_repaint_after(std::time::Duration::from_millis(100)); let got = task.rx.try_recv(); - if matches!(got, Err(std::sync::mpsc::TryRecvError::Empty)) && !task.guard.is_cancelled() { + // (another library opened: it ends at once, not when a scan of the old library's folder is done) + let stale = task.library != app.session.library_generation(); + if matches!(got, Err(std::sync::mpsc::TryRecvError::Empty)) && !task.guard.is_cancelled() && !stale { return; } let Some(task) = app.sync_queued.take() else { return }; - let SyncRescan { name, choice, missing, moved, library, progress, guard, .. } = task; + let SyncRescan { name, choice, missing, moved, metadata, library, progress, guard, .. } = task; if library != app.session.library_generation() { // another library was opened while it scanned: its photos are not these progress.files.cancel.store(true, Ordering::Relaxed); @@ -421,12 +440,20 @@ pub fn poll_rescan(app: &mut LightcraftApp, ctx: &egui::Context) { app.toast(ctx, format!("{name}: {why}")); return; } - // only what the person saw is removed or relinked; what they would have been asked about is said - let (missing_before, moved_before) = (changes.missing.len(), changes.moved.len()); + // (the library moved on while the folder was read, on a share that can take minutes: a photo it relinked or edited + // since is not removed or overwritten from a scan that did not see it) + if !app.session.scan_is_current(&changes) { + app.toast(ctx, format!("{name}: {}", crate::i18n::tr("Photos of the folder changed while it was read: nothing was done"))); + return; + } + // only what the person saw is removed, relinked or read; what they would have been asked about is said + let (missing_before, moved_before, metadata_before) = (changes.missing.len(), changes.moved.len(), changes.metadata.len()); changes.missing.retain(|m| missing.contains(&m.id)); changes.moved.retain(|m| moved.contains(&m.id)); + changes.metadata.retain(|m| metadata.contains(&m.id)); let left_alone = if choice.remove_missing { missing_before - changes.missing.len() } else { 0 } - + if choice.relink_moved { moved_before - changes.moved.len() } else { 0 }; + + if choice.relink_moved { moved_before - changes.moved.len() } else { 0 } + + if choice.read_metadata { metadata_before - changes.metadata.len() } else { 0 }; match SyncJob::start(&mut app.session, changes, choice) { Ok((work, commit)) => { // (a fresh count, the same ✕: its row's flag stops the run as it stopped the scan) @@ -457,7 +484,8 @@ pub struct SyncRun { stopping: bool, /// Its row in the activity stack (its ✕ is Cancel). guard: TaskGuard, - /// Photos found missing or moved that its dialog never showed (a run that waited in line): left alone, and said. + /// Photos found missing, moved or with a sidecar update that its dialog never showed (a run that waited in line): + /// left alone, and said. left_alone: usize, } @@ -571,7 +599,7 @@ pub fn poll_run(app: &mut LightcraftApp, ctx: &egui::Context) { parts.push(format!("{}: {e}", crate::i18n::tr("Not saved"))); } if left_alone > 0 { - parts.push(crate::i18n::tr_format!("{n} more missing, left alone: synchronize again to review them", n = left_alone)); + parts.push(crate::i18n::tr_format!("Left alone: {n} (synchronize again to review them)", n = left_alone)); } let text = if parts.is_empty() { crate::i18n::tr("The library is up to date with this folder.").to_string() } else { parts.join(" · ") }; if not_saved.is_empty() && !crashed { diff --git a/crates/ui-egui/src/tests/activity.rs b/crates/ui-egui/src/tests/activity.rs index 02505025d9c..411a8419169 100644 --- a/crates/ui-egui/src/tests/activity.rs +++ b/crates/ui-egui/src/tests/activity.rs @@ -559,6 +559,10 @@ fn a_task_waiting_in_line_has_a_row_and_starts_when_the_lane_frees() { has(&h, &format!("activity:row:{waiting}")) && has(&h, &format!("activity:cancel:{waiting}")) && rows(&h) == 2, "a waiting task draws a row with ✕" ); + let info = h.app.session.activity.waiting().remove(0); + assert_eq!(crate::panels::activity::cross_name(&info), "Remove from Queue: Building previews"); + let running_row = h.app.session.activity.list().into_iter().find(|t| !t.waiting).expect("the running build"); + assert_eq!(crate::panels::activity::cross_name(&running_row), "Cancel"); // the lane frees with no command asked: the frame loop starts it build.finished.store(true, Ordering::Release); drop(running); diff --git a/crates/ui-egui/src/tests/drop_import.rs b/crates/ui-egui/src/tests/drop_import.rs index 76e1e28450e..09689ac59c9 100644 --- a/crates/ui-egui/src/tests/drop_import.rs +++ b/crates/ui-egui/src/tests/drop_import.rs @@ -831,6 +831,72 @@ fn a_waiting_review_never_replaces_a_running_import() { assert_eq!(photos(&h), 3, "the running import's photo arrives, then the review's two"); } +/// Given a Local folder being read, when an import review is confirmed, then its OK waits in line like any import +/// asked for while the lane is taken (it is not refused with "An import is running"), and runs when the read ends. +#[test] +fn a_review_confirmed_while_a_local_folder_is_read_waits_in_line() { + let dir = Scratch::new("review-browse"); + let mut h = app(&dir); + crate::import::open(&mut h.app, vec![dir.path("trip")]).unwrap(); + assert!(h.step_until(SETTLE, |h| h.app.scan.is_none()), "the scan ends"); + h.step(); + let Some(review) = h.app.ui.dialog.clone() else { panic!("the review is open") }; + let _browse = crate::import::stall_scan_of(&mut h.app, true); + let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &review); + assert!(r.as_ref().is_ok_and(|v| v["queued"].as_u64().is_some()), "the review's OK waits in line: {r:?}"); + h.app.scan = None; + assert!(h.step_until(SETTLE, |h| h.app.import.is_none() && h.app.session.activity.list().is_empty()), "it ran"); + assert_eq!(photos(&h), 2, "the review's two photos"); +} + +/// Given Auto Import's folder listing that comes in while another import runs, then what it found waits in line and +/// is imported when that import ends: the files are not offered again (the engine has noted them as tried). +#[test] +fn an_auto_import_that_finds_files_while_an_import_runs_waits_in_line() { + let dir = Scratch::new("auto-waits"); + let mut h = app(&dir); + write_png(&dir.path("watched/w.png"), 7); + let watched = dir.path("watched"); + h.app.session.import_defaults.auto_folder = Some(watched.clone()); + let listing = || lightcraft_engine::cmd::library::list_auto_import_folder(&watched).unwrap(); + // (a file is taken once its size has stayed the same between two listings) + crate::import::auto_import_listed(&mut h.app, listing()); + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + crate::import::auto_import_listed(&mut h.app, listing()); + assert_eq!(h.app.session.activity.waiting().iter().map(|t| t.kind).collect::>(), vec!["import"], "it waits in line"); + assert!(h.app.ui.toast.is_none(), "an Auto Import is quiet: {:?}", h.app.ui.toast); + drop(hold); + assert!(h.step_until(SETTLE, |h| h.app.import.is_none() && h.app.session.activity.list().is_empty()), "it ran"); + assert_eq!(photos(&h), 1, "w.png came in"); +} + +/// Given a line that is full, when Auto Import's listing comes in while an import runs, then the folder is left to its +/// next listing (its files aren't noted as tried), and imported once there is room. +#[test] +fn an_auto_import_with_no_room_in_line_is_left_for_the_next_listing() { + use lightcraft_engine::activity::{Cancel, MAX_WAITING, Request}; + let dir = Scratch::new("auto-full"); + let mut h = app(&dir); + write_png(&dir.path("watched/w.png"), 7); + let watched = dir.path("watched"); + h.app.session.import_defaults.auto_folder = Some(watched.clone()); + let listing = || lightcraft_engine::cmd::library::list_auto_import_folder(&watched).unwrap(); + let hold = h.app.session.activity.start("import", "Importing", Cancel::Yes); + for _ in 0..MAX_WAITING { + h.app.session.activity.enqueue("import", "Importing", Request { command: "app:import".into(), params: json!({}) }).unwrap(); + } + crate::import::auto_import_listed(&mut h.app, listing()); + crate::import::auto_import_listed(&mut h.app, listing()); + assert_eq!(h.app.session.activity.waiting().len(), MAX_WAITING, "no room: nothing was added"); + h.app.session.activity.cancel_all(); + crate::import::auto_import_listed(&mut h.app, listing()); + crate::import::auto_import_listed(&mut h.app, listing()); + assert_eq!(h.app.session.activity.waiting().iter().map(|t| t.kind).collect::>(), vec!["import"], "now it waits in line"); + drop(hold); + assert!(h.step_until(SETTLE, |h| h.app.import.is_none() && h.app.session.activity.list().is_empty()), "it ran"); + assert_eq!(photos(&h), 1, "w.png came in"); +} + /// Given an import that runs, when photos are dropped directly on the window, then they are not refused: they wait in /// line behind it and are imported when it ends. #[test] diff --git a/crates/ui-egui/src/tests/sync.rs b/crates/ui-egui/src/tests/sync.rs index 362f4c1a7f9..d0d6bdbb380 100644 --- a/crates/ui-egui/src/tests/sync.rs +++ b/crates/ui-egui/src/tests/sync.rs @@ -21,8 +21,8 @@ //! * A Synchronize Folder and an import never run at once: one asked for while the other runs waits in line behind it //! and starts by itself, planning its work then (an import checks for duplicates against the library as it is //! when it starts; a synchronize scans the folder again). -//! * A synchronize that waited removes or relinks only the photos its dialog showed: a photo that went missing while -//! it waited stays, and the end says so. +//! * A synchronize that waited removes, relinks or reads sidecars of only the photos its dialog showed: a photo that +//! went missing, moved or got a sidecar update while it waited stays as it is, and the end says so. //! * The dialog's own scan doesn't hold up an import: it only reads. use std::time::Duration; @@ -366,7 +366,72 @@ fn a_waiting_synchronize_removes_only_the_missing_photos_its_dialog_showed() { assert!(h.step_until(SETTLE, idle), "it ran"); assert_eq!(in_library(&h), vec!["a.png", "c.png"], "b (shown) was removed, a (gone since) was not"); let said = h.app.ui.toast.iter().map(|t| t.0.clone()).collect::(); - assert!(said.contains("1 more missing"), "{said}"); + assert!(said.contains("Left alone: 1"), "{said}"); +} + +/// A sidecar dated an hour from now, so that it is newer than the photo whatever the clock's grain. +fn write_sidecar(png: &str, rating: u8) { + let xmp = std::path::Path::new(png).with_extension("xmp"); + let body = format!( + r#" + +"# + ); + std::fs::write(&xmp, body).unwrap(); + let f = std::fs::File::options().write(true).open(&xmp).unwrap(); + f.set_modified(std::time::SystemTime::now() + Duration::from_secs(3600)).unwrap(); +} + +fn rating_of(h: &Headless, file: &str) -> u8 { + h.app.session.catalog.photos().find(|p| p.file_name == file).map(|p| p.rating).unwrap_or_else(|| panic!("no {file}")) +} + +/// Given a synchronize that will read the one sidecar update its dialog showed (a), waiting behind an import, when +/// another photo's sidecar (b) changes while it waits, then at its turn it reads a's sidecar only: reading replaces a +/// photo's rating, labels, metadata and edits, which nobody agreed to for b. The end says one more was left alone. +#[test] +fn a_waiting_synchronize_reads_only_the_sidecars_its_dialog_showed() { + let dir = Scratch::new("reviewed-meta"); + let mut h = imported_folder(&dir, || write_sidecar(&dir.path("trip/a.png"), 4)); + open_and_scan(&mut h, &dir.path("trip")); + assert_eq!(counts(&h).metadata, 1, "the dialog shows a's update"); + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + let mut dlg = h.app.ui.dialog.take().expect("the dialog is open"); + if let Dialog::SynchronizeFolder { read_metadata, .. } = &mut dlg { + *read_metadata = true; + } + let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &dlg); + assert!(r.as_ref().is_ok_and(|v| v.get("queued").is_some()), "it waits for the import: {r:?}"); + write_sidecar(&dir.path("trip/b.png"), 5); + drop(hold); + assert!(h.step_until(SETTLE, idle), "it ran"); + assert_eq!((rating_of(&h, "a.png"), rating_of(&h, "b.png")), (4, 0), "a (shown) was read, b (changed since) was not"); + let said = h.app.ui.toast.iter().map(|t| t.0.clone()).collect::(); + assert!(said.contains("Left alone: 1"), "{said}"); +} + +/// Given a line that is full, when a synchronize is confirmed while an import runs, then it is refused with the dialog +/// still holding what it showed: confirmed again once there is room, it removes the missing photo it listed. +#[test] +fn a_synchronize_refused_for_a_full_line_keeps_what_its_dialog_showed() { + use lightcraft_engine::activity::{MAX_WAITING, Request}; + let dir = Scratch::new("full-line"); + let mut h = changed_folder(&dir); + open_and_scan(&mut h, &dir.path("trip")); + tick_remove_missing(&mut h); + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + for _ in 0..MAX_WAITING { + h.app.session.activity.enqueue("import", "Importing", Request { command: "app:import".into(), params: json!({}) }).unwrap(); + } + let dlg = h.app.ui.dialog.take().expect("the dialog is open"); + assert!(crate::panels::dialogs::confirm_dialog(&mut h.app, &dlg).is_err(), "no room in the line"); + h.app.session.activity.cancel_all(); + assert!(h.app.session.activity.waiting().is_empty()); + let r = crate::panels::dialogs::confirm_dialog(&mut h.app, &dlg); + assert!(r.as_ref().is_ok_and(|v| v.get("queued").is_some()), "now it waits: {r:?}"); + drop(hold); + assert!(h.step_until(SETTLE, idle), "it ran"); + assert_eq!(in_library(&h), vec!["a.png", "c.png"], "b, which the dialog showed missing, was removed"); } /// Given a Local folder being read, when a synchronize is confirmed, then it waits: the read becomes an import when @@ -403,6 +468,28 @@ fn a_waiting_synchronize_never_acts_on_another_library() { assert!(said.contains("Another library was opened"), "{said}"); } +/// Given a waiting synchronize that has started scanning its folder again, when a photo of the folder changes before the +/// scan is in (the scan did not see it), then nothing is done and it says so: what the scan saw is not what is there. +#[test] +fn a_waiting_synchronize_does_nothing_on_a_scan_the_library_moved_past() { + let dir = Scratch::new("moved-past"); + let mut h = changed_folder(&dir); + open_and_scan(&mut h, &dir.path("trip")); + tick_remove_missing(&mut h); + let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); + let dlg = h.app.ui.dialog.take().expect("the dialog is open"); + assert!(crate::panels::dialogs::confirm_dialog(&mut h.app, &dlg).is_ok_and(|v| v["queued"].as_u64().is_some()), "it waits"); + drop(hold); + assert!(h.step_until(T, |h| h.app.sync_queued.is_some()), "it started scanning again"); + let a = h.app.session.catalog.photos().find(|p| p.file_name == "a.png").unwrap().id; + let r = h.request("engine.execute", json!({"command": "photo.rate", "params": {"ids": [a.0], "rating": 3}}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(SETTLE, idle), "it ended"); + assert_eq!(in_library(&h), vec!["a.png", "b.png"], "the missing b stays, c did not come in"); + let said = h.app.ui.toast.iter().map(|t| t.0.clone()).collect::(); + assert!(said.contains("Photos of the folder changed while it was read"), "{said}"); +} + /// Given a synchronize waiting in line, when its folder is gone by its turn, then it ends saying so and changes /// nothing. #[test] diff --git a/docs/background-tasks.md b/docs/background-tasks.md index bbfc90ea45a..3fb29c840fb 100644 --- a/docs/background-tasks.md +++ b/docs/background-tasks.md @@ -58,14 +58,16 @@ Jobs that must not run side by side share a lane (`activity::Lane`). There are t Each plans its work against the library as it is when it starts, so two side by side could add the same file. An import asked for while the lane is taken is not refused any more: it waits and checks for duplicates against the library as it is when its turn comes. A Synchronize Folder that waits scans its folder again at its turn, then - removes or relinks only the photos its dialog showed: one that went missing while it waited was never shown, so it - is left alone and the end says so ("1 more missing, left alone: synchronize again to review them"). If another - library is opened while it scans, or its folder is gone, it stops without doing anything and a toast says so. A - toast says it was queued when it was put in line. The dialog's own scan ("Looking for changes", kind `scan`) only + removes, relinks or reads the sidecars of only the photos its dialog showed: one that went missing, moved or got a + sidecar update while it waited was never shown, so it is left alone and the end says so ("Left alone: 1 + (synchronize again to review them)"). If another library is opened while it scans, or its folder is gone, it stops + without doing anything and a toast says so (at once for a new library, even if the old folder's scan is still going). + A toast says it was queued when it was put in line. The dialog's own scan ("Looking for changes", kind `scan`) only reads and holds up nothing. These requests are the app's (`app:import`, `app:synchronize`): the app starts them (`LightcraftApp::start_waiting`, every frame), and the engine leaves them alone (`Activity::take_ready_if`). Auto - Import waits until nothing runs, rescans or waits in this lane. A drop while an import's review is open or a scan - runs is still refused. + Import lists its folder only when nothing runs, rescans or waits in this lane; files it finds after something + started meanwhile wait in line, quietly. A drop while a scan runs or an import's review waits behind a dialog is + still refused. A call that sets `queue: true` while its lane is busy does not fail: `Activity::enqueue` keeps what it was asked (`Request`: the command and its parameters, with the photos written out) diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 74e1529d8a6..e81674d5534 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -959,4 +959,4 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-23 | patch | LR-BEHAV-ACCESS: the name field of New Album, New Smart Album, Rename and the other one-field dialogs takes the keyboard focus once when the dialog opens instead of every frame, so Tab and Shift+Tab reach the check box, Cancel and OK; status unchanged (🟡) | | 2026-10-22 | minor | LR-CROP-AUTO: Auto straighten turns by at most 10° and only on at least 3 agreeing lines, and says when it finds nothing to level by; measured on 68 photos straightened by hand and 300 left as shot, unwanted turns of more than 1° fell from 79 to 19 of the 300. Downgraded ✅ → 🟡: it still leaves most tilted photos alone | | 2026-10-23 | patch | LRC-LIB-FILTERBAR: showing an album (`library.source`) while the filter holds an album drops the filter's album, as showing a library folder already dropped its folder filter; before, the old album stayed in the filter unseen (the filter bar has no album chip) and narrowed the next source such as All Photos; the row's note says so; status unchanged (✅) | -| 2026-10-24 | minor | LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder share the library lane: one asked for while the other runs waits in line instead of being refused; a waiting Synchronize Folder scans again and acts only on the photos its dialog showed; every waiting task has a row in the activity stack (when it starts, ✕ to remove it); status unchanged (✅) | +| 2026-10-24 | minor | LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder share the library lane: one asked for while the other runs waits in line instead of being refused; a waiting Synchronize Folder scans again and removes, relinks or reads only the photos its dialog showed; every waiting task has a row in the activity stack (when it starts, ✕ to remove it); status unchanged (✅) | diff --git a/docs/whats-new.md b/docs/whats-new.md index f9e11d5d19c..4a8488ea4e6 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -7,11 +7,14 @@ confirmed while an import runs, now waits in line and starts by itself when the other ends, with a message that it was queued. Before, it was refused ("Wait for the import to finish", "A folder is being synchronized"). - Photos dropped on the window, or an import review confirmed, while another import runs also wait in line instead of - being refused with "An import is running"; a drop is still refused while a folder is being scanned for the review. -- A task waiting in line shows in the activity stack at once: its name, "Starts next" or "Starts after N more", and ✕ to take it out of the line, so a mistaken one can be withdrawn. This holds for a waiting preview build too. + being refused with "An import is running"; a drop is still refused while a folder is being scanned for the review or + read for the Local view, or while a finished scan's review waits behind another dialog. +- A task waiting in line shows in the activity stack at once: its name, "Starts next" or "Starts after N more", and ✕ + to take it out of the line, so a mistaken one can be withdrawn. This holds for a waiting preview build too. - A waiting import checks for duplicates against the library as it is when its turn comes, so nothing is added twice. -- A waiting Synchronize Folder looks at its folder again when its turn comes. It removes or relinks only the photos - its dialog showed: one that went missing while it waited is left alone, and the message at the end says so. +- A waiting Synchronize Folder looks at its folder again when its turn comes. It removes, relinks or reads sidecars of + only the photos its dialog showed: one that went missing, moved or got a sidecar update while it waited is left + alone, and the message at the end says how many ("Left alone: 1 (synchronize again to review them)"). - Nothing waits across another library: a Synchronize Folder that is still scanning when another library opens does nothing. From c20afd9df2c2a84bb83ffa1d1657bd3ee1f6edbf Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sun, 25 Oct 2026 23:46:07 -0400 Subject: [PATCH 09/11] LR-BEHAV-BG-TASKS: control-protocol.md says a waiting task has a row at once, with a way to take it out of the line --- docs/background-tasks.md | 6 ++++-- docs/control-protocol.md | 2 +- docs/parity-checklist.md | 4 ++-- docs/whats-new.md | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/background-tasks.md b/docs/background-tasks.md index 3fb29c840fb..ca59147aab7 100644 --- a/docs/background-tasks.md +++ b/docs/background-tasks.md @@ -60,8 +60,10 @@ Jobs that must not run side by side share a lane (`activity::Lane`). There are t library as it is when its turn comes. A Synchronize Folder that waits scans its folder again at its turn, then removes, relinks or reads the sidecars of only the photos its dialog showed: one that went missing, moved or got a sidecar update while it waited was never shown, so it is left alone and the end says so ("Left alone: 1 - (synchronize again to review them)"). If another library is opened while it scans, or its folder is gone, it stops - without doing anything and a toast says so (at once for a new library, even if the old folder's scan is still going). + (synchronize again to review them)"). If another library is opened while it scans, its folder is gone, or a photo of the + folder is changed in the library (a rating, an edit) while it scans, it stops without doing anything and a toast says + so (at once for a new library, even if the old folder's scan is still going). The focus points and face regions the + background searches add don't count as changes. A toast says it was queued when it was put in line. The dialog's own scan ("Looking for changes", kind `scan`) only reads and holds up nothing. These requests are the app's (`app:import`, `app:synchronize`): the app starts them (`LightcraftApp::start_waiting`, every frame), and the engine leaves them alone (`Activity::take_ready_if`). Auto diff --git a/docs/control-protocol.md b/docs/control-protocol.md index b7f0e0c7e07..7bfd2bd0217 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -79,7 +79,7 @@ filmstrip is visible. | `engine.commands` | — | Engine + UI commands: id, label, menu, shortcut, params doc, enabled | | `ui.menu.list` | — | Menu entries (flat: id, label, menu path, shortcut, enabled) | | `ui.menu.tree` | — | The menu bar as shown (File … Help): items `{id, params?, label, shortcut?, enabled, checked?}`, separators, submenus — the model behind the native macOS menu bar and the in-window menus | -| `ui.inspect` | — | UI state, window, `loupe` (`source`, `pending`, `failed` = why its render failed, else `null`, and `region: {full, window, pending}` when a zoomed view also renders the window on screen at no more than 100 % — `full` is the frame it is cut from, `window` its `[x, y, w, h]` — and `regionBefore` for the Before side of a Before/After view), canvas/image rects, `scroll: {grid, filmstrip}` (scroll offsets in points, `null` until drawn), active photo, selection, perf (`frameMs` = layout, `logicMs` = per-frame logic before it, `updateMs` = both, `maxUpdateMs`, `fps`, render queue …, `gpu` = adapter in use, `gpuReason` = why renders don't use the GPU, `gpuFallback` = latest render redone on the CPU and why — see `docs/gpu-pipeline.md`), status, memory (bytes per cache, see `library.memory`; plus stage caches — `budgetBytes`, `trimmed`, `sharedSourceBytes` (the one device copy of a big original) — and textures), `export: {running: {total, done, current} \| null, last}`, `notices` (warnings waiting to be shown, e.g. a damaged settings file; OK = `button:noticeOk`), `quitPrompt` (why quitting was stopped: tasks that would be cut short are running — `button:quitAnyway` cancels them and quits, `button:quitCancel` keeps working — or unsaved changes: `button:quitRetry` / `button:quitAnyway` / `button:quitCancel`), `import: {done, total, imported, cancelled} \| null` (an import runs on a worker thread), `tasks` (other background work: `Find Missing Photos`, `Auto Import`), `activity` (every long-running task in flight, same shape as `activity.list` (including tasks waiting in line, which have no row); the activity stack in the top-left corner shows the running ones, and a row appears once its task is 0.5 s old, ids `activity:row:`, ✕ = `activity:cancel:`, `activity:more` expands past 3 rows), `fileDialogs` (commands waiting on a native file dialog, which runs off the UI thread; they run again with the answer when it closes), `copied` (the text the UI last put on the clipboard, `null` until something is copied) | +| `ui.inspect` | — | UI state, window, `loupe` (`source`, `pending`, `failed` = why its render failed, else `null`, and `region: {full, window, pending}` when a zoomed view also renders the window on screen at no more than 100 % — `full` is the frame it is cut from, `window` its `[x, y, w, h]` — and `regionBefore` for the Before side of a Before/After view), canvas/image rects, `scroll: {grid, filmstrip}` (scroll offsets in points, `null` until drawn), active photo, selection, perf (`frameMs` = layout, `logicMs` = per-frame logic before it, `updateMs` = both, `maxUpdateMs`, `fps`, render queue …, `gpu` = adapter in use, `gpuReason` = why renders don't use the GPU, `gpuFallback` = latest render redone on the CPU and why — see `docs/gpu-pipeline.md`), status, memory (bytes per cache, see `library.memory`; plus stage caches — `budgetBytes`, `trimmed`, `sharedSourceBytes` (the one device copy of a big original) — and textures), `export: {running: {total, done, current} \| null, last}`, `notices` (warnings waiting to be shown, e.g. a damaged settings file; OK = `button:noticeOk`), `quitPrompt` (why quitting was stopped: tasks that would be cut short are running — `button:quitAnyway` cancels them and quits, `button:quitCancel` keeps working — or unsaved changes: `button:quitRetry` / `button:quitAnyway` / `button:quitCancel`), `import: {done, total, imported, cancelled} \| null` (an import runs on a worker thread), `tasks` (other background work: `Find Missing Photos`, `Auto Import`), `activity` (every long-running task in flight, same shape as `activity.list`, including tasks waiting in line; the activity stack in the top-left corner shows a running task once it is 0.5 s old and a waiting task at once (no bar, "Starts next" / "Starts after N more"), ids `activity:row:`, ✕ = `activity:cancel:` (on a waiting row: Remove from Queue), `activity:more` expands past 3 rows), `fileDialogs` (commands waiting on a native file dialog, which runs off the UI thread; they run again with the answer when it closes), `copied` (the text the UI last put on the clipboard, `null` until something is copied) | | `ui.widgets` | `{filter?}` | On-screen widgets `{id, rect: [x, y, w, h]}` (screen points) | | `ui.clickWidget` / `ui.dragWidget` / `ui.hoverWidget` | `{id, count?, button?, fx?, fy?}` (`button: "right"` right-clicks; `count` is capped at 16) / `{id, toX?, toY?, dx?, dy?, steps?}` (steps are capped at 1000) / `{id, fx?, fy?}` | Real egui input on a widget (hover: the pointer rests on it, e.g. for preset/profile previews). `fx`/`fy` are fractions of the registered rect and may lie outside `[0,1]`; the resulting point must still be inside egui's clipped interaction rect, and a non-finite fraction or resolved point is rejected before any input is queued. Geometry comes from the latest completed layout; if the widget moves before the first event or before a press, or its latest clipped rect no longer contains the point, the request fails with an error instead of clicking another widget or retargeting. A target below an ordinary modal dialog may succeed as a no-op or a backdrop click, because egui routes that input to the dialog; a target covered by a non-modal overlay fails. The blocking library-problem/launch-list window is explicit: its dim takes the modal layer, but a background target fails instead of reporting a no-op success, and only that window's own controls (`button:library…`) pass. Its creation frame is shielded and redrawn with empty input like a prompt's, so background text/pointer input cannot act while the new modal areas settle. A quit prompt or settings notice is a real egui modal scope with a foreground backdrop. Only its own buttons (`button:quit…`, `button:noticeOk`) accept a `ui.clickWidget`; background targets fail, and background keystrokes, text/clipboard input, wheel/zoom input and AccessKit actions are dropped before panels see them. The prompt itself takes Tab/Shift+Tab, Enter/Space on the focused button, and Escape/Enter for the safe default Cancel; AccessKit Focus/Click works when targeted at a prompt button. Its first creation frame (including a Tasks→Unsaved or notice→next-notice transition) is shielded and redrawn with empty input, so a press/release in that frame, or a held press from before it, cannot act underneath it; a synthetic drag already in progress is canceled. Once settled, raw `ui.click`/`ui.drag`/`ui.pointer` and backdrop clicks are still delivered to the prompt backdrop as no-ops, and the prompt's own button clicks work normally. The area/layer check cannot see a different widget covering the point in the same layer. A `ui.clickWidget` whose widget disappears before its release also fails, after canceling the pointer press without a click or drag (the same rules apply when a click spans several host frames) | | `ui.move` / `ui.click` / `ui.drag` | `{x, y, count?, button?}` / `{x, y, toX, toY, steps?}` | Raw pointer input, screen points (the same click and step caps apply) | diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index e81674d5534..becf361d7ee 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -70,7 +70,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | Id | Feature | Tier | Status | Evidence | Missing / notes | |---|---|---|---|---|---| | LR-IMP-ADD-DIALOG | Add photos/folders | P0 | ✅ | `cmd:file.addPhotos`, `cmd:library.importPreview`, `cmd:library.import` (`mode`, `album`, `albumName`, `preset`, `keywords`), `crates/ui-egui/src/dialogs/import.rs` | review dialog (Import Photos): the scanned source (a scanned folder is not added to Local), candidate grid with thumbnails and checkboxes (duplicates by path/content marked and unchecked; with several file types, a toggle per type checks or unchecks all of its files, e.g. the raws without the JPEGs beside them, issue #344) filling a resizable window (issue #337), transfer mode (add in place / copy / move, each explained), album (existing/new): the destination picker follows the sidebar folder hierarchy and order, searches full paths, and distinguishes duplicate names by their folder path; folders navigate and smart albums are excluded, with None, New album and album-context preselection retained (#2362; `crates/ui-egui/src/widgets/album_picker.rs`, `crates/ui-egui/src/tests/album_picker.rs`); preset, keywords; the folder scan runs on a background thread, shown in the activity stack with ✕ to cancel (a NAS folder no longer freezes the window); the import itself (probing, sidecars, copying / moving files) runs on a worker thread and its batches join the library between frames, shown in the activity stack with ✕ to cancel; one undo step. Drag-and-drop goes through the same background import. File dialogs list the importable extensions (`lightcraft_engine::import::EXTENSIONS`) in any letter case on Linux, where GTK and the desktop portal match globs case-sensitively (`apps/lightcraft/src/dialog_filter.rs`, issue #342; 0.4.0 hid `.JPG` / `.NEF`, issue #705). The folder scan, Browse Folder, drag-and-drop and the sidecar lookup match extensions in any case (`crates/engine/src/tests/import.rs`) | -| LR-IMP-DRAGDROP | Drop files/folders to import | P0 | ✅ | `crates/ui-egui/src/lib.rs` (dropped files → the import review), `crates/ui-egui/src/drop_overlay.rs`, `crates/ui-egui/src/tests/drop_import.rs` | while files are dragged over the window a veil and a card say what dropping does (review N items for import, import N presets, open the face model; a note to close the open dialog first when one is open); photos and folders open the import review as File ▸ Import does (Settings ▸ Import ▸ Import dropped files without review imports them at once; the web build always does); with no library open on the desktop (the launch list, a library that couldn't open) photos wait for the library opened and presets are refused, and the card says so; a drop while a dialog is open (also in the web build) or while an import is running is refused with a toast, and the card says so; a finished scan waits for an open dialog to close before its review opens; the control channel's `ui.dropFiles` hovers or drops files for scripts; dropping onto a specific album not supported | +| LR-IMP-DRAGDROP | Drop files/folders to import | P0 | ✅ | `crates/ui-egui/src/lib.rs` (dropped files → the import review), `crates/ui-egui/src/drop_overlay.rs`, `crates/ui-egui/src/tests/drop_import.rs` | while files are dragged over the window a veil and a card say what dropping does (review N items for import, import N presets, open the face model; a note to close the open dialog first when one is open); photos and folders open the import review as File ▸ Import does (Settings ▸ Import ▸ Import dropped files without review imports them at once; the web build always does); with no library open on the desktop (the launch list, a library that couldn't open) photos wait for the library opened and presets are refused, and the card says so; a drop while a dialog is open (also in the web build), while a folder is scanned for the review or while a review waits to open is refused with a toast, and the card says so; a drop while an import or a Synchronize Folder runs waits in line; a finished scan waits for an open dialog to close before its review opens; the control channel's `ui.dropFiles` hovers or drops files for scripts; dropping onto a specific album not supported | | LR-IMP-DUPES | Skip duplicates by content | P1 | ✅ | `crates/engine/src/import.rs`, `crates/engine/src/tests/import.rs` | | | LR-IMP-DEVICE | Import from camera/card | P1 | ✅ | `cmd:library.devices`, `cmd:file.addFromDevice`, `crates/engine/src/devices.rs` | mounted volumes with a DCIM folder (macOS /Volumes, Linux /media and /run/media, Windows drive letters); File → Import from Device → the import review, copying into the library by default; menus serve the last scan and rescan in the background (never blocking a frame; hot-plugs repaint); copies are verified (a new file, synced, checked against the content hash the scan computed — byte compare with the source when there is none, issue #134; a bad copy is removed and reported as failed, never counted as imported; taken names get -1, -2…, never replaced — issue #96, `crates/engine/src/import_move.rs`); no PTP/MTP (cameras that don't mount as a disk); Settings → Import → Cameras and Cards can open the import review when a camera or card is connected (off by default; a card that was already in doesn't ask, and an open dialog or running import is finished first; `crates/ui-egui/src/dialogs/import.rs`) | | LR-IMP-AUTO | Watched-folder auto import | P2 | ✅ | `cmd:library.autoImport`, `cmd:library.autoImportScan`, `crates/ui-egui/src/dialogs/settings.rs` | Settings ▸ Import ▸ Auto Import: a watched folder whose new photos are added (in place or copied) once complete, into an optional album; scanned every 3 s | @@ -959,4 +959,4 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-23 | patch | LR-BEHAV-ACCESS: the name field of New Album, New Smart Album, Rename and the other one-field dialogs takes the keyboard focus once when the dialog opens instead of every frame, so Tab and Shift+Tab reach the check box, Cancel and OK; status unchanged (🟡) | | 2026-10-22 | minor | LR-CROP-AUTO: Auto straighten turns by at most 10° and only on at least 3 agreeing lines, and says when it finds nothing to level by; measured on 68 photos straightened by hand and 300 left as shot, unwanted turns of more than 1° fell from 79 to 19 of the 300. Downgraded ✅ → 🟡: it still leaves most tilted photos alone | | 2026-10-23 | patch | LRC-LIB-FILTERBAR: showing an album (`library.source`) while the filter holds an album drops the filter's album, as showing a library folder already dropped its folder filter; before, the old album stayed in the filter unseen (the filter bar has no album chip) and narrowed the next source such as All Photos; the row's note says so; status unchanged (✅) | -| 2026-10-24 | minor | LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder share the library lane: one asked for while the other runs waits in line instead of being refused; a waiting Synchronize Folder scans again and removes, relinks or reads only the photos its dialog showed; every waiting task has a row in the activity stack (when it starts, ✕ to remove it); status unchanged (✅) | +| 2026-10-25 | minor | LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder share the library lane: one asked for while the other runs waits in line instead of being refused; a waiting Synchronize Folder scans again and removes, relinks or reads only the photos its dialog showed; every waiting task has a row in the activity stack (when it starts, ✕ to remove it); status unchanged (✅) | diff --git a/docs/whats-new.md b/docs/whats-new.md index 4a8488ea4e6..bf1d93038b0 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -16,7 +16,8 @@ only the photos its dialog showed: one that went missing, moved or got a sidecar update while it waited is left alone, and the message at the end says how many ("Left alone: 1 (synchronize again to review them)"). - Nothing waits across another library: a Synchronize Folder that is still scanning when another library opens does - nothing. + nothing. It also does nothing, and says so, when a photo of its folder is changed in the library (a rating, an edit) + while it scans, because what it saw is no longer what is there. ### Relative-date filters and smart albums follow the clock - A current view or source count using “in the last” rules now refreshes when the session clock moves into a new From abc98ec6705fce175b0e574590549fe68ea2ebfa Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Tue, 27 Oct 2026 14:46:53 -0400 Subject: [PATCH 10/11] LR-BEHAV-BG-TASKS: tests: a waiting synchronize's scan is held open while the photo is changed Co-Authored-By: Claude --- crates/ui-egui/src/tests/sync.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/ui-egui/src/tests/sync.rs b/crates/ui-egui/src/tests/sync.rs index d0d6bdbb380..f50d5f2895e 100644 --- a/crates/ui-egui/src/tests/sync.rs +++ b/crates/ui-egui/src/tests/sync.rs @@ -479,11 +479,24 @@ fn a_waiting_synchronize_does_nothing_on_a_scan_the_library_moved_past() { let hold = h.app.session.activity.start("import", "Importing", lightcraft_engine::activity::Cancel::Yes); let dlg = h.app.ui.dialog.take().expect("the dialog is open"); assert!(crate::panels::dialogs::confirm_dialog(&mut h.app, &dlg).is_ok_and(|v| v["queued"].as_u64().is_some()), "it waits"); + // the scan reads the new file through a probe that waits for the gate: it starts before the rating and ends after it, + // however fast the machine is (a scan that ended within its first frame would run before the rating was made) + let gate = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(false)); + let g = gate.clone(); + h.app.session.media.file_probe = Some(std::sync::Arc::new(move |p: &str| { + let t0 = std::time::Instant::now(); + while !g.load(std::sync::atomic::Ordering::Acquire) && t0.elapsed() < Duration::from_secs(60) { + std::thread::sleep(Duration::from_millis(1)); + } + Ok(lightcraft_engine::media::ProbeInfo { width: 8, height: 8, format: "PNG".into(), content_hash: Some(p.to_string()), ..Default::default() }) + })); drop(hold); assert!(h.step_until(T, |h| h.app.sync_queued.is_some()), "it started scanning again"); let a = h.app.session.catalog.photos().find(|p| p.file_name == "a.png").unwrap().id; let r = h.request("engine.execute", json!({"command": "photo.rate", "params": {"ids": [a.0], "rating": 3}}), T); assert_eq!(r["ok"], true, "{r}"); + assert!(h.app.sync_queued.is_some(), "the scan is still going when the photo changed"); + gate.store(true, std::sync::atomic::Ordering::Release); assert!(h.step_until(SETTLE, idle), "it ended"); assert_eq!(in_library(&h), vec!["a.png", "b.png"], "the missing b stays, c did not come in"); let said = h.app.ui.toast.iter().map(|t| t.0.clone()).collect::(); From e1f1400601578b1bb3218b32ce9bf9a4d509bb67 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Sat, 24 Oct 2026 19:49:03 -0400 Subject: [PATCH 11/11] LR-BEHAV-BG-TASKS: queue a scanned folder without its review while the library lane is busy Base: library-lane-main-rows 7b400ba0c7 (#1943). While an import or Synchronize Folder runs or waits, the review scan's row in the activity stack has Queue without review: the folder goes in line, imported the way the last review was confirmed (add in place, or copy with the same destination, folders and names; never Move), and its waiting row says so and can still be reviewed. Co-Authored-By: Claude --- crates/ui-egui/locales/cs-formats.json | 3 +- crates/ui-egui/locales/cs.json | 8 +- crates/ui-egui/locales/de-formats.json | 3 +- crates/ui-egui/locales/de.json | 8 +- crates/ui-egui/locales/es-formats.json | 3 +- crates/ui-egui/locales/es.json | 8 +- crates/ui-egui/locales/fi-formats.json | 3 +- crates/ui-egui/locales/fi.json | 8 +- crates/ui-egui/locales/fr-formats.json | 3 +- crates/ui-egui/locales/fr.json | 8 +- crates/ui-egui/locales/id-formats.json | 3 +- crates/ui-egui/locales/id.json | 8 +- crates/ui-egui/locales/it-formats.json | 3 +- crates/ui-egui/locales/it.json | 8 +- crates/ui-egui/locales/ja-formats.json | 3 +- crates/ui-egui/locales/ja.json | 8 +- crates/ui-egui/locales/ka-formats.json | 3 +- crates/ui-egui/locales/ka.json | 8 +- crates/ui-egui/locales/pl-formats.json | 3 +- crates/ui-egui/locales/pl.json | 8 +- crates/ui-egui/locales/pt-br-formats.json | 3 +- crates/ui-egui/locales/pt-br.json | 8 +- crates/ui-egui/locales/ru-formats.json | 3 +- crates/ui-egui/locales/ru.json | 8 +- crates/ui-egui/locales/sv-formats.json | 3 +- crates/ui-egui/locales/sv.json | 8 +- crates/ui-egui/locales/uk-formats.json | 3 +- crates/ui-egui/locales/uk.json | 8 +- crates/ui-egui/locales/vi-formats.json | 3 +- crates/ui-egui/locales/vi.json | 8 +- crates/ui-egui/locales/zh-hans-formats.json | 3 +- crates/ui-egui/locales/zh-hans.json | 8 +- crates/ui-egui/locales/zh-hant-formats.json | 3 +- crates/ui-egui/locales/zh-hant.json | 8 +- crates/ui-egui/src/app.rs | 2 + crates/ui-egui/src/app/frame.rs | 2 + crates/ui-egui/src/dialogs/import.rs | 7 +- crates/ui-egui/src/dialogs/import/scan.rs | 117 +++++++- crates/ui-egui/src/dialogs/import/task.rs | 11 +- crates/ui-egui/src/import_queue.rs | 159 +++++++++++ crates/ui-egui/src/lib.rs | 5 + crates/ui-egui/src/panels/activity.rs | 61 ++++- crates/ui-egui/src/tests.rs | 1 + crates/ui-egui/src/tests/queue_no_review.rs | 284 ++++++++++++++++++++ docs/background-tasks.md | 6 + docs/control-protocol.md | 2 +- docs/parity-checklist.md | 5 +- docs/whats-new.md | 12 + 48 files changed, 815 insertions(+), 46 deletions(-) create mode 100644 crates/ui-egui/src/import_queue.rs create mode 100644 crates/ui-egui/src/tests/queue_no_review.rs diff --git a/crates/ui-egui/locales/cs-formats.json b/crates/ui-egui/locales/cs-formats.json index 0b49424366b..255911f30c8 100644 --- a/crates/ui-egui/locales/cs-formats.json +++ b/crates/ui-egui/locales/cs-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "Ve frontě: začne po dalších úlohách: {n}", "Left alone: {n} (synchronize again to review them)": "Ponecháno: {n} (pro kontrolu synchronizujte znovu)", "Starts after {n} more": "Začne po dalších úlohách: {n}", - "Remove from Queue: {label}": "Odebrat z fronty: {label}" + "Remove from Queue: {label}": "Odebrat z fronty: {label}", + "Without review: copy to {destination}": "Bez kontroly: kopírovat do {destination}" } diff --git a/crates/ui-egui/locales/cs.json b/crates/ui-egui/locales/cs.json index 5d83f25f8a5..9e4bf15376b 100644 --- a/crates/ui-egui/locales/cs.json +++ b/crates/ui-egui/locales/cs.json @@ -2409,5 +2409,11 @@ "Queued: it starts when the task ahead of it ends": "Ve frontě: začne, až skončí úloha před ní", "Another library was opened: nothing was done": "Byla otevřena jiná knihovna: nic se neprovedlo", "Photos of the folder changed while it was read: nothing was done": "Fotografie ve složce se během čtení změnily: nic se neprovedlo", - "Starts next": "Začne jako další" + "Starts next": "Začne jako další", + "Queue without review": "Zařadit do fronty bez kontroly", + "Review…": "Zkontrolovat…", + "A folder is already being scanned": "Jiná složka se již prohledává", + "Without review: add in place": "Bez kontroly: přidat ze současného umístění", + "Without review: copy into the library": "Bez kontroly: kopírovat do knihovny", + "Close the open dialog, then choose Review… again": "Zavřete otevřené okno, pak znovu zvolte Zkontrolovat…" } diff --git a/crates/ui-egui/locales/de-formats.json b/crates/ui-egui/locales/de-formats.json index 5b5b38fa33f..124524c589e 100644 --- a/crates/ui-egui/locales/de-formats.json +++ b/crates/ui-egui/locales/de-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "In der Warteschlange: startet nach {n} weiteren", "Left alone: {n} (synchronize again to review them)": "Unangetastet: {n} (zum Prüfen erneut synchronisieren)", "Starts after {n} more": "Startet nach {n} weiteren", - "Remove from Queue: {label}": "Aus der Warteschlange entfernen: {label}" + "Remove from Queue: {label}": "Aus der Warteschlange entfernen: {label}", + "Without review: copy to {destination}": "Ohne Prüfung: kopieren nach {destination}" } diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.json index 7038fcdeba9..cd025993baa 100644 --- a/crates/ui-egui/locales/de.json +++ b/crates/ui-egui/locales/de.json @@ -3441,5 +3441,11 @@ "Queued: it starts when the task ahead of it ends": "In der Warteschlange: startet, wenn die Aufgabe davor endet", "Another library was opened: nothing was done": "Eine andere Bibliothek wurde geöffnet: es wurde nichts getan", "Photos of the folder changed while it was read: nothing was done": "Fotos des Ordners haben sich beim Lesen geändert: es wurde nichts getan", - "Starts next": "Startet als Nächstes" + "Starts next": "Startet als Nächstes", + "Queue without review": "Ohne Prüfung einreihen", + "Review…": "Prüfen…", + "A folder is already being scanned": "Ein Ordner wird bereits durchsucht", + "Without review: add in place": "Ohne Prüfung: am Speicherort hinzufügen", + "Without review: copy into the library": "Ohne Prüfung: in die Bibliothek kopieren", + "Close the open dialog, then choose Review… again": "Schließe den geöffneten Dialog und wähle dann erneut Prüfen…" } diff --git a/crates/ui-egui/locales/es-formats.json b/crates/ui-egui/locales/es-formats.json index aad6ee5face..a6f7ba7054b 100644 --- a/crates/ui-egui/locales/es-formats.json +++ b/crates/ui-egui/locales/es-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "En cola: empieza tras {n} más", "Left alone: {n} (synchronize again to review them)": "Sin tocar: {n} (sincroniza de nuevo para revisarlos)", "Starts after {n} more": "Empieza tras {n} más", - "Remove from Queue: {label}": "Quitar de la cola: {label}" + "Remove from Queue: {label}": "Quitar de la cola: {label}", + "Without review: copy to {destination}": "Sin revisar: copiar en {destination}" } diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.json index 49d1d977d4c..09bd2a52608 100644 --- a/crates/ui-egui/locales/es.json +++ b/crates/ui-egui/locales/es.json @@ -2359,5 +2359,11 @@ "Queued: it starts when the task ahead of it ends": "En cola: empieza cuando termine la tarea anterior", "Another library was opened: nothing was done": "Se abrió otra biblioteca: no se hizo nada", "Photos of the folder changed while it was read: nothing was done": "Las fotos de la carpeta cambiaron mientras se leía: no se hizo nada", - "Starts next": "Empieza la siguiente" + "Starts next": "Empieza la siguiente", + "Queue without review": "Poner en cola sin revisar", + "Review…": "Revisar…", + "A folder is already being scanned": "Ya se está analizando una carpeta", + "Without review: add in place": "Sin revisar: añadir sin mover", + "Without review: copy into the library": "Sin revisar: copiar en la biblioteca", + "Close the open dialog, then choose Review… again": "Cierra el cuadro de diálogo abierto y elige Revisar… de nuevo" } diff --git a/crates/ui-egui/locales/fi-formats.json b/crates/ui-egui/locales/fi-formats.json index 8e85c136fb2..fcfd5b5b70c 100644 --- a/crates/ui-egui/locales/fi-formats.json +++ b/crates/ui-egui/locales/fi-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "Jonossa: alkaa {n} muun jälkeen", "Left alone: {n} (synchronize again to review them)": "Jätetty ennalleen: {n} (synkronoi uudelleen tarkistaaksesi)", "Starts after {n} more": "Alkaa {n} muun jälkeen", - "Remove from Queue: {label}": "Poista jonosta: {label}" + "Remove from Queue: {label}": "Poista jonosta: {label}", + "Without review: copy to {destination}": "Ilman tarkistusta: kopioi kohteeseen {destination}" } diff --git a/crates/ui-egui/locales/fi.json b/crates/ui-egui/locales/fi.json index 09b3a15bf54..e0d1a5301e2 100644 --- a/crates/ui-egui/locales/fi.json +++ b/crates/ui-egui/locales/fi.json @@ -2328,5 +2328,11 @@ "Queued: it starts when the task ahead of it ends": "Jonossa: alkaa, kun sen edellä oleva tehtävä päättyy", "Another library was opened: nothing was done": "Toinen kirjasto avattiin: mitään ei tehty", "Photos of the folder changed while it was read: nothing was done": "Kansion valokuvat muuttuivat lukemisen aikana: mitään ei tehty", - "Starts next": "Alkaa seuraavaksi" + "Starts next": "Alkaa seuraavaksi", + "Queue without review": "Lisää jonoon ilman tarkistusta", + "Review…": "Tarkista…", + "A folder is already being scanned": "Kansiota skannataan jo", + "Without review: add in place": "Ilman tarkistusta: lisää paikalleen", + "Without review: copy into the library": "Ilman tarkistusta: kopioi kirjastoon", + "Close the open dialog, then choose Review… again": "Sulje avoin valintaikkuna ja valitse sitten Tarkista… uudelleen" } diff --git a/crates/ui-egui/locales/fr-formats.json b/crates/ui-egui/locales/fr-formats.json index b8442d2131e..35281ebcffb 100644 --- a/crates/ui-egui/locales/fr-formats.json +++ b/crates/ui-egui/locales/fr-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "En file : démarre après {n} autre(s) tâche(s)", "Left alone: {n} (synchronize again to review them)": "Laissés tels quels : {n} (synchronisez à nouveau pour les examiner)", "Starts after {n} more": "Démarre après {n} autre(s) tâche(s)", - "Remove from Queue: {label}": "Retirer de la file : {label}" + "Remove from Queue: {label}": "Retirer de la file : {label}", + "Without review: copy to {destination}": "Sans vérification : copier vers {destination}" } diff --git a/crates/ui-egui/locales/fr.json b/crates/ui-egui/locales/fr.json index da8ab1885d1..7a78cbc121a 100644 --- a/crates/ui-egui/locales/fr.json +++ b/crates/ui-egui/locales/fr.json @@ -2391,5 +2391,11 @@ "Queued: it starts when the task ahead of it ends": "En file : démarre à la fin de la tâche précédente", "Another library was opened: nothing was done": "Une autre bibliothèque a été ouverte : rien n’a été fait", "Photos of the folder changed while it was read: nothing was done": "Les photos du dossier ont changé pendant la lecture : rien n’a été fait", - "Starts next": "Démarre ensuite" + "Starts next": "Démarre ensuite", + "Queue without review": "Mettre en file sans vérifier", + "Review…": "Vérifier…", + "A folder is already being scanned": "Un dossier est déjà en cours d'analyse", + "Without review: add in place": "Sans vérification : ajouter sur place", + "Without review: copy into the library": "Sans vérification : copier dans la bibliothèque", + "Close the open dialog, then choose Review… again": "Fermez la boîte de dialogue ouverte, puis choisissez à nouveau Vérifier…" } diff --git a/crates/ui-egui/locales/id-formats.json b/crates/ui-egui/locales/id-formats.json index c331f292705..094c34de262 100644 --- a/crates/ui-egui/locales/id-formats.json +++ b/crates/ui-egui/locales/id-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "Dalam antrean: dimulai setelah {n} lagi", "Left alone: {n} (synchronize again to review them)": "Dibiarkan: {n} (sinkronkan lagi untuk meninjau)", "Starts after {n} more": "Dimulai setelah {n} lagi", - "Remove from Queue: {label}": "Hapus dari antrean: {label}" + "Remove from Queue: {label}": "Hapus dari antrean: {label}", + "Without review: copy to {destination}": "Tanpa tinjauan: salin ke {destination}" } diff --git a/crates/ui-egui/locales/id.json b/crates/ui-egui/locales/id.json index 16131bb8e53..e2dbcbdd63d 100644 --- a/crates/ui-egui/locales/id.json +++ b/crates/ui-egui/locales/id.json @@ -2340,5 +2340,11 @@ "Queued: it starts when the task ahead of it ends": "Dalam antrean: dimulai saat tugas di depannya selesai", "Another library was opened: nothing was done": "Pustaka lain dibuka: tidak ada yang dilakukan", "Photos of the folder changed while it was read: nothing was done": "Foto di folder berubah saat dibaca: tidak ada yang dilakukan", - "Starts next": "Dimulai berikutnya" + "Starts next": "Dimulai berikutnya", + "Queue without review": "Antrekan tanpa tinjauan", + "Review…": "Tinjau…", + "A folder is already being scanned": "Sebuah folder sedang dipindai", + "Without review: add in place": "Tanpa tinjauan: tambahkan di lokasi asli", + "Without review: copy into the library": "Tanpa tinjauan: salin ke pustaka", + "Close the open dialog, then choose Review… again": "Tutup dialog yang terbuka, lalu pilih Tinjau… lagi" } diff --git a/crates/ui-egui/locales/it-formats.json b/crates/ui-egui/locales/it-formats.json index 52b73fc3788..a7199fedb01 100644 --- a/crates/ui-egui/locales/it-formats.json +++ b/crates/ui-egui/locales/it-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "In coda: parte dopo altre attività ({n})", "Left alone: {n} (synchronize again to review them)": "Lasciati invariati: {n} (sincronizza di nuovo per rivederli)", "Starts after {n} more": "Parte dopo altre attività ({n})", - "Remove from Queue: {label}": "Rimuovi dalla coda: {label}" + "Remove from Queue: {label}": "Rimuovi dalla coda: {label}", + "Without review: copy to {destination}": "Senza revisione: copia in {destination}" } diff --git a/crates/ui-egui/locales/it.json b/crates/ui-egui/locales/it.json index b467fadc7d7..c079b8ba38f 100644 --- a/crates/ui-egui/locales/it.json +++ b/crates/ui-egui/locales/it.json @@ -2362,5 +2362,11 @@ "Queued: it starts when the task ahead of it ends": "In coda: parte quando finisce l'attività precedente", "Another library was opened: nothing was done": "È stata aperta un'altra libreria: non è stato fatto nulla", "Photos of the folder changed while it was read: nothing was done": "Le foto della cartella sono cambiate durante la lettura: non è stato fatto nulla", - "Starts next": "Parte subito dopo" + "Starts next": "Parte subito dopo", + "Queue without review": "Metti in coda senza rivedere", + "Review…": "Rivedi…", + "A folder is already being scanned": "Una cartella è già in analisi", + "Without review: add in place": "Senza revisione: aggiungi sul posto", + "Without review: copy into the library": "Senza revisione: copia nella libreria", + "Close the open dialog, then choose Review… again": "Chiudi la finestra di dialogo aperta, poi scegli di nuovo Rivedi…" } diff --git a/crates/ui-egui/locales/ja-formats.json b/crates/ui-egui/locales/ja-formats.json index ff5030690b0..fdec6413dc7 100644 --- a/crates/ui-egui/locales/ja-formats.json +++ b/crates/ui-egui/locales/ja-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "キューに追加: あと {n} 件の後に開始します", "Left alone: {n} (synchronize again to review them)": "そのまま: {n} 件(再度同期して確認してください)", "Starts after {n} more": "あと {n} 件の後に開始します", - "Remove from Queue: {label}": "キューから削除: {label}" + "Remove from Queue: {label}": "キューから削除: {label}", + "Without review: copy to {destination}": "確認なし: {destination} にコピー" } diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.json index 6c97e1e93dd..fccfd73c098 100644 --- a/crates/ui-egui/locales/ja.json +++ b/crates/ui-egui/locales/ja.json @@ -2357,5 +2357,11 @@ "Queued: it starts when the task ahead of it ends": "キューに追加: 前のタスクが終わると開始します", "Another library was opened: nothing was done": "別のライブラリが開かれました: 何も行われていません", "Photos of the folder changed while it was read: nothing was done": "読み取り中にフォルダ内の写真が変更されました: 何も行われていません", - "Starts next": "次に開始します" + "Starts next": "次に開始します", + "Queue without review": "確認せずにキューに追加", + "Review…": "確認…", + "A folder is already being scanned": "別のフォルダをスキャン中です", + "Without review: add in place": "確認なし: 現在の場所から追加", + "Without review: copy into the library": "確認なし: ライブラリにコピー", + "Close the open dialog, then choose Review… again": "開いているダイアログを閉じてから、もう一度「確認…」を選んでください" } diff --git a/crates/ui-egui/locales/ka-formats.json b/crates/ui-egui/locales/ka-formats.json index ef610bd14cc..79905f21c98 100644 --- a/crates/ui-egui/locales/ka-formats.json +++ b/crates/ui-egui/locales/ka-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "რიგშია: დაიწყება კიდევ {n}-ის შემდეგ", "Left alone: {n} (synchronize again to review them)": "უცვლელი დარჩა: {n} (გადასახედად თავიდან დაასინქრონეთ)", "Starts after {n} more": "დაიწყება კიდევ {n}-ის შემდეგ", - "Remove from Queue: {label}": "რიგიდან ამოღება: {label}" + "Remove from Queue: {label}": "რიგიდან ამოღება: {label}", + "Without review: copy to {destination}": "გადახედვის გარეშე: კოპირება: {destination}" } diff --git a/crates/ui-egui/locales/ka.json b/crates/ui-egui/locales/ka.json index fc1bc2983f5..568763c4f05 100644 --- a/crates/ui-egui/locales/ka.json +++ b/crates/ui-egui/locales/ka.json @@ -2735,5 +2735,11 @@ "Queued: it starts when the task ahead of it ends": "რიგშია: დაიწყება, როცა წინა ამოცანა დასრულდება", "Another library was opened: nothing was done": "სხვა ბიბლიოთეკა გაიხსნა: არაფერი გაკეთებულა", "Photos of the folder changed while it was read: nothing was done": "საქაღალდის ფოტოები წაკითხვისას შეიცვალა: არაფერი გაკეთებულა", - "Starts next": "დაიწყება შემდეგი" + "Starts next": "დაიწყება შემდეგი", + "Queue without review": "რიგში დამატება გადახედვის გარეშე", + "Review…": "გადახედვა…", + "A folder is already being scanned": "საქაღალდე უკვე სკანირდება", + "Without review: add in place": "გადახედვის გარეშე: ადგილზე დამატება", + "Without review: copy into the library": "გადახედვის გარეშე: ბიბლიოთეკაში კოპირება", + "Close the open dialog, then choose Review… again": "დახურეთ გახსნილი დიალოგი და ხელახლა აირჩიეთ „გადახედვა…“" } diff --git a/crates/ui-egui/locales/pl-formats.json b/crates/ui-egui/locales/pl-formats.json index ad311891b51..b40f180c081 100644 --- a/crates/ui-egui/locales/pl-formats.json +++ b/crates/ui-egui/locales/pl-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "W kolejce: rozpocznie się po kolejnych zadaniach ({n})", "Left alone: {n} (synchronize again to review them)": "Pominięto: {n} (zsynchronizuj ponownie, aby je sprawdzić)", "Starts after {n} more": "Rozpocznie się po kolejnych zadaniach ({n})", - "Remove from Queue: {label}": "Usuń z kolejki: {label}" + "Remove from Queue: {label}": "Usuń z kolejki: {label}", + "Without review: copy to {destination}": "Bez sprawdzania: kopiuj do {destination}" } diff --git a/crates/ui-egui/locales/pl.json b/crates/ui-egui/locales/pl.json index 5195fa91cd1..7259c9f83da 100644 --- a/crates/ui-egui/locales/pl.json +++ b/crates/ui-egui/locales/pl.json @@ -2284,5 +2284,11 @@ "Queued: it starts when the task ahead of it ends": "W kolejce: rozpocznie się po zakończeniu poprzedniego zadania", "Another library was opened: nothing was done": "Otwarto inną bibliotekę: nic nie zrobiono", "Photos of the folder changed while it was read: nothing was done": "Zdjęcia w folderze zmieniły się podczas odczytu: nic nie zrobiono", - "Starts next": "Rozpocznie się jako następne" + "Starts next": "Rozpocznie się jako następne", + "Queue without review": "Dodaj do kolejki bez sprawdzania", + "Review…": "Sprawdź…", + "A folder is already being scanned": "Folder jest już skanowany", + "Without review: add in place": "Bez sprawdzania: dodaj bez kopiowania plików", + "Without review: copy into the library": "Bez sprawdzania: kopiuj do biblioteki", + "Close the open dialog, then choose Review… again": "Zamknij otwarte okno dialogowe, a potem ponownie wybierz Sprawdź…" } diff --git a/crates/ui-egui/locales/pt-br-formats.json b/crates/ui-egui/locales/pt-br-formats.json index 4960090f14f..171018391a0 100644 --- a/crates/ui-egui/locales/pt-br-formats.json +++ b/crates/ui-egui/locales/pt-br-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "Na fila: começa depois de mais {n}", "Left alone: {n} (synchronize again to review them)": "Deixados como estavam: {n} (sincronize de novo para revisá-los)", "Starts after {n} more": "Começa depois de mais {n}", - "Remove from Queue: {label}": "Remover da fila: {label}" + "Remove from Queue: {label}": "Remover da fila: {label}", + "Without review: copy to {destination}": "Sem revisão: copiar para {destination}" } diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.json index 8d58d8e1082..1bdbf9ecfc1 100644 --- a/crates/ui-egui/locales/pt-br.json +++ b/crates/ui-egui/locales/pt-br.json @@ -2203,5 +2203,11 @@ "Queued: it starts when the task ahead of it ends": "Na fila: começa quando a tarefa anterior terminar", "Another library was opened: nothing was done": "Outra biblioteca foi aberta: nada foi feito", "Photos of the folder changed while it was read: nothing was done": "As fotos da pasta mudaram durante a leitura: nada foi feito", - "Starts next": "Começa em seguida" + "Starts next": "Começa em seguida", + "Queue without review": "Enfileirar sem revisar", + "Review…": "Revisar…", + "A folder is already being scanned": "Uma pasta já está sendo analisada", + "Without review: add in place": "Sem revisão: adicionar no local", + "Without review: copy into the library": "Sem revisão: copiar para a biblioteca", + "Close the open dialog, then choose Review… again": "Feche a caixa de diálogo aberta e escolha Revisar… novamente" } diff --git a/crates/ui-egui/locales/ru-formats.json b/crates/ui-egui/locales/ru-formats.json index de63d603eac..29e1152847d 100644 --- a/crates/ui-egui/locales/ru-formats.json +++ b/crates/ui-egui/locales/ru-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "В очереди: начнётся после ещё {n}", "Left alone: {n} (synchronize again to review them)": "Оставлено без изменений: {n} (синхронизируйте снова, чтобы проверить)", "Starts after {n} more": "Начнётся после ещё {n}", - "Remove from Queue: {label}": "Убрать из очереди: {label}" + "Remove from Queue: {label}": "Убрать из очереди: {label}", + "Without review: copy to {destination}": "Без проверки: копировать в {destination}" } diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index dd87893628b..1b9784e1e86 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -2350,5 +2350,11 @@ "Queued: it starts when the task ahead of it ends": "В очереди: начнётся, когда закончится задача перед ней", "Another library was opened: nothing was done": "Открыта другая библиотека: ничего не сделано", "Photos of the folder changed while it was read: nothing was done": "Фотографии в папке изменились во время чтения: ничего не сделано", - "Starts next": "Начнётся следующей" + "Starts next": "Начнётся следующей", + "Queue without review": "Поставить в очередь без проверки", + "Review…": "Проверить…", + "A folder is already being scanned": "Папка уже сканируется", + "Without review: add in place": "Без проверки: добавить на месте", + "Without review: copy into the library": "Без проверки: копировать в библиотеку", + "Close the open dialog, then choose Review… again": "Закройте открытое окно и ещё раз выберите «Проверить…»" } diff --git a/crates/ui-egui/locales/sv-formats.json b/crates/ui-egui/locales/sv-formats.json index 1e71f5f9a6c..4c54698dcdc 100644 --- a/crates/ui-egui/locales/sv-formats.json +++ b/crates/ui-egui/locales/sv-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "I kö: startar efter {n} till", "Left alone: {n} (synchronize again to review them)": "Lämnade orörda: {n} (synkronisera igen för att granska dem)", "Starts after {n} more": "Startar efter {n} till", - "Remove from Queue: {label}": "Ta bort från kön: {label}" + "Remove from Queue: {label}": "Ta bort från kön: {label}", + "Without review: copy to {destination}": "Utan granskning: kopiera till {destination}" } diff --git a/crates/ui-egui/locales/sv.json b/crates/ui-egui/locales/sv.json index 9a6594fdad3..cff3455b3b4 100644 --- a/crates/ui-egui/locales/sv.json +++ b/crates/ui-egui/locales/sv.json @@ -2430,5 +2430,11 @@ "Queued: it starts when the task ahead of it ends": "I kö: startar när uppgiften före är klar", "Another library was opened: nothing was done": "Ett annat bibliotek öppnades: ingenting gjordes", "Photos of the folder changed while it was read: nothing was done": "Fotona i mappen ändrades medan den lästes: ingenting gjordes", - "Starts next": "Startar härnäst" + "Starts next": "Startar härnäst", + "Queue without review": "Köa utan granskning", + "Review…": "Granska…", + "A folder is already being scanned": "En mapp skannas redan", + "Without review: add in place": "Utan granskning: lägg till på plats", + "Without review: copy into the library": "Utan granskning: kopiera till biblioteket", + "Close the open dialog, then choose Review… again": "Stäng den öppna dialogrutan och välj sedan Granska… igen" } diff --git a/crates/ui-egui/locales/uk-formats.json b/crates/ui-egui/locales/uk-formats.json index 045d654b817..c2c7e860c72 100644 --- a/crates/ui-egui/locales/uk-formats.json +++ b/crates/ui-egui/locales/uk-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "У черзі: почнеться після ще {n}", "Left alone: {n} (synchronize again to review them)": "Залишено без змін: {n} (синхронізуйте знову, щоб переглянути)", "Starts after {n} more": "Почнеться після ще {n}", - "Remove from Queue: {label}": "Прибрати з черги: {label}" + "Remove from Queue: {label}": "Прибрати з черги: {label}", + "Without review: copy to {destination}": "Без перевірки: копіювати до {destination}" } diff --git a/crates/ui-egui/locales/uk.json b/crates/ui-egui/locales/uk.json index b4798a7feaf..52b04e0cf30 100644 --- a/crates/ui-egui/locales/uk.json +++ b/crates/ui-egui/locales/uk.json @@ -2355,5 +2355,11 @@ "Queued: it starts when the task ahead of it ends": "У черзі: почнеться, коли завершиться попереднє завдання", "Another library was opened: nothing was done": "Відкрито іншу бібліотеку: нічого не зроблено", "Photos of the folder changed while it was read: nothing was done": "Фотографії в теці змінилися під час читання: нічого не зроблено", - "Starts next": "Почнеться наступним" + "Starts next": "Почнеться наступним", + "Queue without review": "Поставити в чергу без перевірки", + "Review…": "Перевірити…", + "A folder is already being scanned": "Тека вже сканується", + "Without review: add in place": "Без перевірки: додати на місці", + "Without review: copy into the library": "Без перевірки: копіювати до бібліотеки", + "Close the open dialog, then choose Review… again": "Закрийте відкрите вікно та ще раз виберіть «Перевірити…»" } diff --git a/crates/ui-egui/locales/vi-formats.json b/crates/ui-egui/locales/vi-formats.json index 14bb4142c36..573343c2672 100644 --- a/crates/ui-egui/locales/vi-formats.json +++ b/crates/ui-egui/locales/vi-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "Trong hàng đợi: bắt đầu sau {n} tác vụ nữa", "Left alone: {n} (synchronize again to review them)": "Để nguyên: {n} (đồng bộ lại để xem xét)", "Starts after {n} more": "Bắt đầu sau {n} tác vụ nữa", - "Remove from Queue: {label}": "Xóa khỏi hàng đợi: {label}" + "Remove from Queue: {label}": "Xóa khỏi hàng đợi: {label}", + "Without review: copy to {destination}": "Không xem lại: sao chép tới {destination}" } diff --git a/crates/ui-egui/locales/vi.json b/crates/ui-egui/locales/vi.json index 4bc0e984d81..438358509ac 100644 --- a/crates/ui-egui/locales/vi.json +++ b/crates/ui-egui/locales/vi.json @@ -2236,5 +2236,11 @@ "Queued: it starts when the task ahead of it ends": "Trong hàng đợi: bắt đầu khi tác vụ trước nó kết thúc", "Another library was opened: nothing was done": "Đã mở thư viện khác: không có gì được thực hiện", "Photos of the folder changed while it was read: nothing was done": "Ảnh trong thư mục đã thay đổi trong lúc đọc: không có gì được thực hiện", - "Starts next": "Bắt đầu tiếp theo" + "Starts next": "Bắt đầu tiếp theo", + "Queue without review": "Đưa vào hàng đợi không xem lại", + "Review…": "Xem lại…", + "A folder is already being scanned": "Một thư mục đang được quét", + "Without review: add in place": "Không xem lại: thêm tại chỗ", + "Without review: copy into the library": "Không xem lại: sao chép vào thư viện", + "Close the open dialog, then choose Review… again": "Hãy đóng hộp thoại đang mở, rồi chọn lại Xem lại…" } diff --git a/crates/ui-egui/locales/zh-hans-formats.json b/crates/ui-egui/locales/zh-hans-formats.json index fa961db45e2..47a8cb76f7e 100644 --- a/crates/ui-egui/locales/zh-hans-formats.json +++ b/crates/ui-egui/locales/zh-hans-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "已加入队列:再过 {n} 个后开始", "Left alone: {n} (synchronize again to review them)": "未处理:{n}(再次同步以查看)", "Starts after {n} more": "再过 {n} 个后开始", - "Remove from Queue: {label}": "从队列中移除:{label}" + "Remove from Queue: {label}": "从队列中移除:{label}", + "Without review: copy to {destination}": "不经查看:拷贝到 {destination}" } diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.json index 2fc62f58bd2..6157a6bc0a0 100644 --- a/crates/ui-egui/locales/zh-hans.json +++ b/crates/ui-egui/locales/zh-hans.json @@ -2201,5 +2201,11 @@ "Queued: it starts when the task ahead of it ends": "已加入队列:前一个任务结束后开始", "Another library was opened: nothing was done": "已打开另一个图库:未执行任何操作", "Photos of the folder changed while it was read: nothing was done": "读取期间文件夹中的照片发生了变化:未执行任何操作", - "Starts next": "接下来开始" + "Starts next": "接下来开始", + "Queue without review": "不经查看直接加入队列", + "Review…": "查看…", + "A folder is already being scanned": "正在扫描另一个文件夹", + "Without review: add in place": "不经查看:在原位置添加", + "Without review: copy into the library": "不经查看:拷贝到图库", + "Close the open dialog, then choose Review… again": "请先关闭打开的对话框,然后再次选择“查看…”" } diff --git a/crates/ui-egui/locales/zh-hant-formats.json b/crates/ui-egui/locales/zh-hant-formats.json index b40a6592281..741c050c36f 100644 --- a/crates/ui-egui/locales/zh-hant-formats.json +++ b/crates/ui-egui/locales/zh-hant-formats.json @@ -309,5 +309,6 @@ "Queued: it starts after {n} more": "已加入佇列:再過 {n} 個後開始", "Left alone: {n} (synchronize again to review them)": "未處理:{n}(再次同步以檢視)", "Starts after {n} more": "再過 {n} 個後開始", - "Remove from Queue: {label}": "從佇列中移除:{label}" + "Remove from Queue: {label}": "從佇列中移除:{label}", + "Without review: copy to {destination}": "不經檢視:複製至 {destination}" } diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.json index 2a99cb4b941..9f8275258bd 100644 --- a/crates/ui-egui/locales/zh-hant.json +++ b/crates/ui-egui/locales/zh-hant.json @@ -2158,5 +2158,11 @@ "Queued: it starts when the task ahead of it ends": "已加入佇列:前一個工作結束後開始", "Another library was opened: nothing was done": "已開啟另一個圖庫:未執行任何操作", "Photos of the folder changed while it was read: nothing was done": "讀取期間資料夾中的照片發生了變化:未執行任何操作", - "Starts next": "接下來開始" + "Starts next": "接下來開始", + "Queue without review": "不經檢視直接加入佇列", + "Review…": "檢視…", + "A folder is already being scanned": "正在掃描另一個資料夾", + "Without review: add in place": "不經檢視:原地加入", + "Without review: copy into the library": "不經檢視:複製到照片庫", + "Close the open dialog, then choose Review… again": "請先關閉開啟的對話框,然後再次選擇「檢視…」" } diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 16060c29cb9..a00ba0c104c 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -102,6 +102,8 @@ impl LightcraftApp { merge: merge::MergeState::default(), import: None, scan: None, + last_import: None, + unreviewed: Vec::new(), sync: None, sync_owns_changes: false, sync_run: None, diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 51593276eaf..72a2757c4eb 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -255,6 +255,8 @@ impl LightcraftApp { return; } self.shown_library = Some(generation); + // (how a review of another library was confirmed is no guide for this one) + self.last_import = None; if let Some(l) = self.session.library.as_ref().filter(|l| l.on_disk) { let path = l.dir.to_string_lossy().into_owned(); panels::settings::remember_library(&mut self.ui.settings.recent_libraries, &path); diff --git a/crates/ui-egui/src/dialogs/import.rs b/crates/ui-egui/src/dialogs/import.rs index ab1f856e8d3..e65ec3a2a6d 100644 --- a/crates/ui-egui/src/dialogs/import.rs +++ b/crates/ui-egui/src/dialogs/import.rs @@ -18,6 +18,7 @@ use serde_json::{Value, json}; use std::sync::atomic::Ordering; use crate::LightcraftApp; +use crate::import_queue::{self, Remembered, Transfer}; use crate::render::Slot; use crate::theme::Tokens; use crate::widgets::register; @@ -34,11 +35,13 @@ use body::{DEFAULT_BELOW_GRID, badge_rect, dup_counts}; pub use body::{DEFAULT_FOLDER_TEMPLATE, body, example_destination, source_summary}; pub(crate) use body::{DIALOG_SIZE, note_dialog_bottom}; pub(crate) use scan::library_busy; -pub use scan::{IMPORT_REQUEST, ScanTask, browse, drop_blocked, open, poll_scan, running}; +pub use scan::{ + IMPORT_REQUEST, ScanTask, Unreviewed, browse, drop_blocked, open, poll_scan, prune_unreviewed, queue_scan, queueable_scan, review_queued, running, +}; #[cfg(not(target_arch = "wasm32"))] pub(crate) use scan::{auto_import_listed, cards_seen}; #[cfg(test)] -pub(crate) use scan::{stall_scan, stall_scan_of}; +pub(crate) use scan::{stall_scan, stall_scan_in, stall_scan_of}; pub(crate) use tags::{tag_field_width, tag_help, tag_toggle, unknown_tags_warning}; pub use task::{ImportTask, start, start_paths, start_request, tick}; diff --git a/crates/ui-egui/src/dialogs/import/scan.rs b/crates/ui-egui/src/dialogs/import/scan.rs index 5f1661a585e..687d03e34fe 100644 --- a/crates/ui-egui/src/dialogs/import/scan.rs +++ b/crates/ui-egui/src/dialogs/import/scan.rs @@ -1,5 +1,7 @@ use super::task::ImportTask; -use super::{ImportDialog, Lane, LightcraftApp, Ordering, Request, ScanInput, ScanOutput, ScanProgress, Value, json, scan_with}; +use super::{ + ImportDialog, Lane, LightcraftApp, Ordering, Request, ScanInput, ScanOutput, ScanProgress, Transfer, Value, import_queue, json, scan_with, +}; /// A folder scan running on a worker thread (a network share can take minutes to read; the /// window must keep answering meanwhile). @@ -14,6 +16,9 @@ pub struct ScanTask { pub(crate) browse: bool, /// What is being scanned (the review's source). sources: Vec, + /// The library it was started in ([`lightcraft_engine::Session::library_generation`]): an album id means nothing in + /// another one. + pub(crate) library: u64, /// The scan's row in the activity stack (its ✕ and `activity.cancel` set `progress.cancel`). guard: lightcraft_engine::activity::TaskGuard, } @@ -123,7 +128,7 @@ pub fn open(app: &mut LightcraftApp, paths: Vec) -> Result) -> #[cfg(target_arch = "wasm32")] job(); let guard = scan_guard(app, &progress, true); - app.scan = Some(ScanTask { progress, rx, copy: false, album: None, browse: true, sources: Vec::new(), guard }); + app.scan = Some(ScanTask { + progress, + rx, + copy: false, + album: None, + browse: true, + sources: Vec::new(), + library: app.session.library_generation(), + guard, + }); app.renderer.forget_imports(); Ok(json!({"path": dir_s, "subfolders": subfolders, "scanning": true})) } @@ -297,10 +311,16 @@ pub(crate) fn stall_scan(app: &mut LightcraftApp) -> Box { /// Tests: the same, for a Local folder browse scan (`browse`) instead of the review's scan. #[cfg(test)] pub(crate) fn stall_scan_of(app: &mut LightcraftApp, browse: bool) -> Box { + stall_scan_in(app, Vec::new(), browse) +} + +/// Tests: the same, of `sources` (what a folder queued without its review is made of). +#[cfg(test)] +pub(crate) fn stall_scan_in(app: &mut LightcraftApp, sources: Vec, browse: bool) -> Box { let progress = std::sync::Arc::new(ScanProgress::default()); let (tx, rx) = std::sync::mpsc::channel::(); let guard = scan_guard(app, &progress, false); - app.scan = Some(ScanTask { progress, rx, copy: false, album: None, browse, sources: Vec::new(), guard }); + app.scan = Some(ScanTask { progress, rx, copy: false, album: None, browse, sources, library: app.session.library_generation(), guard }); Box::new(tx) } @@ -318,6 +338,95 @@ pub fn drop_blocked(app: &LightcraftApp) -> bool { app.scan.is_some() || app.review_pending.is_some() } +/// An import queued without its review: what the waiting row needs to say how it comes in and to review it after all. +#[derive(Clone, Debug)] +pub struct Unreviewed { + /// Its task in the line. + pub id: u64, + sources: Vec, + /// Open the review with "copy into the library" checked (a camera / card). + card: bool, + /// The album the review would have offered. + album: Option, + /// How it brings its files in. + pub transfer: Transfer, +} + +/// The review scan's task id when it can be queued without its review: the library lane is taken, so the review +/// would wait in line anyway once confirmed (with a free lane the review simply opens when the scan is in). +pub fn queueable_scan(app: &LightcraftApp) -> Option { + app.scan.as_ref().filter(|t| !t.browse && !t.sources.is_empty() && library_busy(app)).map(|t| t.guard.id()) +} + +/// Stop the review scan and put its folder in line, to be imported as the last review was confirmed (see +/// [`import_queue::plan`]). Its row can still be reviewed ([`review_queued`]). +pub fn queue_scan(app: &mut LightcraftApp) -> Result { + if queueable_scan(app).is_none() { + return Err("no folder scan is waiting for the library".into()); + } + let Some(task) = app.scan.take() else { return Err("no folder scan is running".into()) }; + let plan = import_queue::plan(app.last_import.as_ref(), task.copy); + let mut params = plan.params; + // the album an Import into this album chose is part of what was asked (of this library: another one opened since + // has other albums under the same numbers, and no review shows the person which one) + if let Some(album) = task.album.filter(|id| { + task.library == app.session.library_generation() + && app.session.catalog.album(lightcraft_catalog::AlbumId(*id)).is_some_and(|a| !a.folder && !a.is_smart()) + }) { + params["album"] = json!(album); + } + let result = match wait_in_line(app, &task.sources, ¶ms, false) { + Ok(result) => result, + Err(e) => { + // (the line is full: the scan goes on, and the review opens when it is in) + app.scan = Some(task); + return Err(e); + } + }; + // (the worker stops at its next file: the scan is let go without a word, as one another replaced is) + task.progress.cancel.store(true, Ordering::Relaxed); + if let Some(id) = result["queued"].as_u64() { + app.unreviewed.push(Unreviewed { + id, + sources: task.sources.clone(), + card: task.copy, + album: params["album"].as_u64(), + transfer: plan.transfer, + }); + } + Ok(result) +} + +/// The waiting row's Review…: the folder leaves the line and its review scan starts, as if it had been opened now. +/// Refused (the row stays) while another folder is being scanned, or while its review waits for a dialog to close. +pub fn review_queued(app: &mut LightcraftApp, id: u64) -> Result<(), String> { + let Some(at) = app.unreviewed.iter().position(|u| u.id == id) else { return Err("it is no longer waiting".into()) }; + // (what `open` refuses too, checked before the folder leaves the line: else it would be neither waiting nor scanned) + if app.scan.is_some() { + return Err(crate::i18n::tr("A folder is already being scanned").to_string()); + } + if app.review_pending.is_some() { + return Err(crate::i18n::tr("Close the open dialog, then choose Review… again").to_string()); + } + app.session.activity.cancel(id)?; + let u = app.unreviewed.remove(at); + open(app, u.sources)?; + if let Some(t) = app.scan.as_mut() { + t.copy = u.card; + t.album = u.album; + } + Ok(()) +} + +/// Forget the queued-without-review notes of imports that have left the line. +pub fn prune_unreviewed(app: &mut LightcraftApp) { + if app.unreviewed.is_empty() { + return; + } + let waiting = app.session.activity.waiting(); + app.unreviewed.retain(|u| waiting.iter().any(|w| w.id == u.id)); +} + impl ScanTask { /// `{done, total}` for `ui.inspect` (total is 0 while the folders are still being listed). pub fn status(&self) -> Value { diff --git a/crates/ui-egui/src/dialogs/import/task.rs b/crates/ui-egui/src/dialogs/import/task.rs index c38c221fc82..57b5493702c 100644 --- a/crates/ui-egui/src/dialogs/import/task.rs +++ b/crates/ui-egui/src/dialogs/import/task.rs @@ -1,6 +1,7 @@ use super::scan::wait_in_line; use super::{ - ImportDialog, ImportUprightMode, ImportWarning, ImportWarningCode, LightcraftApp, Ordering, Request, Value, drop_blocked, json, library_busy, + ImportDialog, ImportUprightMode, ImportWarning, ImportWarningCode, LightcraftApp, Ordering, Remembered, Request, Value, drop_blocked, json, + library_busy, }; /// Files per batch in the browser build (each batch joins the catalog as it is ready, so the @@ -252,9 +253,15 @@ pub fn start(app: &mut LightcraftApp, d: &ImportDialog) -> Result } // the review's thumbnails are done with, whether it runs now or later app.renderer.forget_imports(); + // (what a folder queued without a review is asked: the way these files come in, never the batch's own choices; + // kept once the import is taken, not when the line is full) + let how = Remembered::of(¶ms); if waits { - return wait_in_line(app, &queue, ¶ms, false); + let queued = wait_in_line(app, &queue, ¶ms, false)?; + app.last_import = Some(how); + return Ok(queued); } + app.last_import = Some(how); let total = queue.len(); app.import = Some(ImportTask::new(queue, params, undo0, false)); Ok(json!({"importing": total})) diff --git a/crates/ui-egui/src/import_queue.rs b/crates/ui-egui/src/import_queue.rs new file mode 100644 index 00000000000..e0af997cf65 --- /dev/null +++ b/crates/ui-egui/src/import_queue.rs @@ -0,0 +1,159 @@ +//! "Queue without review": a folder added while the library lane is busy can go straight into the waiting line, with +//! the way the last review was confirmed, instead of waiting through its own review scan first (on a network share a +//! scan of a few thousand files takes minutes). This is the pure part: what a queued import is asked, and how its row +//! says so. The app side (the scan row's link, the waiting row's Review…) is in [`crate::import`]. + +use crate::i18n::{tr, tr_format}; +use serde_json::{Value, json}; + +/// How the last confirmed review brought its files in: what a folder queued without a review is asked to do. +/// Only the way the files are brought in is kept; an album, keywords and presets belong to one batch and would +/// be wrong for another folder (the engine's import defaults still apply to every import when it runs). +/// Never Move: a review that moved its originals is remembered as a copy, so a folder nobody looked at is never +/// emptied of its originals. +#[derive(Clone, Debug, Default, PartialEq)] +pub struct Remembered { + /// Copy into the library (else add in place). + copy: bool, + destination: Option, + organize: Option, + rename: Option, + dng: bool, +} + +/// A queued import's request, and how its row names the way it brings files in. +#[derive(Clone, Debug, PartialEq)] +pub struct Plan { + /// The `library.import` params (without `paths`). + pub params: Value, + pub transfer: Transfer, +} + +/// How a queued import brings its files in, as its row says it. +#[derive(Clone, Debug, PartialEq)] +pub enum Transfer { + InPlace, + /// Into the chosen folder, or the library's Originals when `None`. + Copy(Option), +} + +impl Remembered { + /// What `params` (a confirmed review's `library.import` params) bring in and where. + pub fn of(params: &Value) -> Self { + let text = |k: &str| params[k].as_str().map(str::to_string); + let copy = matches!(params["mode"].as_str(), Some("copy" | "move")); + if !copy { + return Remembered::default(); + } + Remembered { + copy, + destination: text("destination"), + organize: text("organize"), + rename: text("rename"), + // (a Move never converts: the dialog turns it off then) + dng: params["mode"] == "copy" && params["dng"].as_bool().unwrap_or(false), + } + } +} + +/// The request of a folder queued without a review: as the last review was confirmed (`last`); with none, as the +/// review opens (add in place), or for a card or camera (`card`) copied into the library, as its review opens. +pub fn plan(last: Option<&Remembered>, card: bool) -> Plan { + let fallback; + let how = match last { + Some(last) => last, + None => { + fallback = Remembered { copy: card, ..Default::default() }; + &fallback + } + }; + if !how.copy { + return Plan { params: json!({"mode": "add"}), transfer: Transfer::InPlace }; + } + let mut params = json!({"mode": "copy"}); + if let Some(d) = &how.destination { + params["destination"] = json!(d); + } + if let Some(o) = &how.organize { + params["organize"] = json!(o); + } + if let Some(r) = &how.rename { + params["rename"] = json!(r); + params["renameStart"] = json!(1); + } + if how.dng { + params["dng"] = json!(true); + } + Plan { params, transfer: Transfer::Copy(how.destination.clone()) } +} + +/// What a queued import's row says of how it brings its files in, so that nothing is added, copied or moved +/// without it being plain. +pub fn describe(transfer: &Transfer) -> String { + match transfer { + Transfer::InPlace => tr("Without review: add in place").to_string(), + Transfer::Copy(None) => tr("Without review: copy into the library").to_string(), + Transfer::Copy(Some(destination)) => tr_format!("Without review: copy to {destination}", destination = destination), + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn with_no_review_before_a_folder_is_added_in_place() { + let p = plan(None, false); + assert_eq!(p.params, json!({"mode": "add"})); + assert_eq!(p.transfer, Transfer::InPlace); + } + + #[test] + fn with_no_review_before_a_card_is_copied_into_the_library() { + let p = plan(None, true); + assert_eq!(p.params, json!({"mode": "copy"})); + assert_eq!(p.transfer, Transfer::Copy(None)); + } + + #[test] + fn a_folder_follows_the_last_review_that_added_in_place() { + let last = Remembered::of(&json!({"mode": "add", "keywords": ["x"], "album": 3})); + assert_eq!(plan(Some(&last), false).params, json!({"mode": "add"})); + // even a card: the person last chose to leave files where they are + assert_eq!(plan(Some(&last), true).transfer, Transfer::InPlace); + } + + #[test] + fn a_folder_follows_the_last_review_that_copied() { + let last = Remembered::of(&json!({ + "mode": "copy", "destination": "/Volumes/Photos", "organize": "month", "rename": "{date:%Y%m%d}_{seq}", "renameStart": 1, + "dng": true, "keywords": ["holiday"], "album": 9, "preset": "p1", "metadataPreset": "m1", "onDeleted": "restore" + })); + let p = plan(Some(&last), false); + assert_eq!( + p.params, + json!({ + "mode": "copy", "destination": "/Volumes/Photos", "organize": "month", "rename": "{date:%Y%m%d}_{seq}", "renameStart": 1, + "dng": true + }), + "the way files come in, never the batch's album, keywords or presets" + ); + assert_eq!(p.transfer, Transfer::Copy(Some("/Volumes/Photos".into()))); + } + + #[test] + fn a_review_that_moved_is_remembered_as_a_copy() { + let last = Remembered::of(&json!({"mode": "move", "destination": "/Volumes/Photos", "organize": "date"})); + let p = plan(Some(&last), false); + assert_eq!(p.params, json!({"mode": "copy", "destination": "/Volumes/Photos", "organize": "date"})); + assert!(p.params.get("dng").is_none()); + assert_eq!(p.transfer, Transfer::Copy(Some("/Volumes/Photos".into()))); + } + + #[test] + fn a_row_says_how_its_files_come_in() { + assert_eq!(describe(&Transfer::InPlace), "Without review: add in place"); + assert_eq!(describe(&Transfer::Copy(None)), "Without review: copy into the library"); + assert_eq!(describe(&Transfer::Copy(Some("/Volumes/Photos".into()))), "Without review: copy to /Volumes/Photos"); + } +} diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index d5d61a75fc1..b34d404dde2 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -28,6 +28,7 @@ mod frame_rate; pub mod headless; pub mod i18n; pub mod icons; +mod import_queue; pub mod lightroom_import; pub mod links; pub mod menus; @@ -298,6 +299,10 @@ pub struct LightcraftApp { pub import: Option, /// A folder scan in progress (feeds the import review). pub scan: Option, + /// How the last confirmed import review brought its files in (this run only): what "Queue without review" asks. + pub(crate) last_import: Option, + /// The imports waiting in line that were queued without a review, by their task id. + pub(crate) unreviewed: Vec, /// A Synchronize Folder scan in progress (feeds its dialog). pub sync: Option, /// `session.folder_changes` came from the Synchronize Folder dialog (and goes with it). diff --git a/crates/ui-egui/src/panels/activity.rs b/crates/ui-egui/src/panels/activity.rs index 9492c7a6e84..c314eb21374 100644 --- a/crates/ui-egui/src/panels/activity.rs +++ b/crates/ui-egui/src/panels/activity.rs @@ -2,7 +2,9 @@ //! top bar while something runs — a row each with its name, a progress bar, what it is working on, and ✕ for the ones //! that can be cancelled. A task waiting in line behind another of its lane has a row too, at once: its name, when it //! starts, and ✕ to take it out of the line. The tasks come from the engine's registry -//! ([`lightcraft_engine::activity`]); ✕ runs `activity.cancel` like any other frontend would. +//! ([`lightcraft_engine::activity`]); ✕ runs `activity.cancel` like any other frontend would. While the library lane +//! is busy, the row of the review's folder scan offers Queue without review, and a folder queued that way offers +//! Review… on its waiting row ([`crate::import`]). use egui::{Align, Layout, Margin, RichText, Sense, Stroke, pos2, vec2}; use lightcraft_engine::activity::{TaskInfo, Unit}; @@ -56,6 +58,7 @@ fn detail_line(t: &TaskInfo) -> String { /// Draw the stack (called every frame, after the panels and dialogs). pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) { + crate::import::prune_unreviewed(app); // (a task waiting in line has a row without a bar: its name, when it starts, and ✕) let all: Vec = app.session.activity.list(); if all.is_empty() { @@ -75,6 +78,9 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) { let max_height = (ctx.content_rect().height() - t.top_bar_h - 60.0).max(80.0); let mut cancel = None; let mut toggle = false; + let mut link_act = None; + let queue_scan = crate::import::queueable_scan(app); + let unreviewed: Vec<(u64, String)> = app.unreviewed.iter().map(|u| (u.id, crate::import_queue::describe(&u.transfer))).collect(); let frame = egui::Frame::NONE.fill(t.chrome).stroke(Stroke::new(1.0, t.field_border)).corner_radius(6).inner_margin(Margin::same(MARGIN)); egui::Area::new(egui::Id::unique("activity-stack")).order(egui::Order::Middle).fixed_pos(pos2(8.0, t.top_bar_h + 8.0)).show(ctx, |ui| { // An area lays out in the size it had last frame, and the scroll area would take that as all the room there @@ -93,6 +99,14 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) { if row(ui, &t, task, inner) { cancel = Some(task.id); } + if queue_scan == Some(task.id) && link(ui, &t, tr("Queue without review"), "activity:queueScan".into()) { + link_act = Some(Act::QueueScan); + } + if let Some((_, how)) = unreviewed.iter().find(|(id, _)| *id == task.id) + && let Some(id) = review_line(ui, &t, how, task.id, inner) + { + link_act = Some(Act::Review(id)); + } } }); if hidden > 0 || (app.activity_expanded && tasks.len() > MAX_ROWS) { @@ -107,11 +121,56 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) { if let Some(id) = cancel { self::cancel(app, id); } + match link_act { + Some(Act::QueueScan) => { + if let Err(e) = crate::import::queue_scan(app) { + app.toast(ctx, e); + } + } + Some(Act::Review(id)) => { + if let Err(e) = crate::import::review_queued(app, id) { + app.toast(ctx, e); + } + } + None => {} + } if toggle { app.activity_expanded = !app.activity_expanded; } } +/// What a link under a row asks for. +enum Act { + /// Put the folder being scanned in line without its review. + QueueScan, + /// Open the review of an import waiting in line. + Review(u64), +} + +/// A small link in the stack's accent color, registered as widget `id`. True when clicked. +fn link(ui: &mut egui::Ui, t: &Tokens, text: impl Into, id: String) -> bool { + let r = ui.add(egui::Label::new(RichText::new(text.into()).font(t.font(11.0)).color(t.accent)).sense(Sense::click())); + register(ui, id, r.rect); + r.clicked() +} + +/// The line under a waiting row of a folder queued without its review: how it brings its files in, and Review… +/// (the link is laid out first, from the right: a long destination is cut short, never the link). +fn review_line(ui: &mut egui::Ui, t: &Tokens, how: &str, id: u64, width: f32) -> Option { + let mut asked = None; + ui.allocate_ui_with_layout(vec2(width, 16.0), Layout::right_to_left(Align::Center), |ui| { + if link(ui, t, tr("Review…"), format!("activity:review:{id}")) { + asked = Some(id); + } + let room = ui.available_width(); + ui.allocate_ui_with_layout(vec2(room, 16.0), Layout::left_to_right(Align::Center), |ui| { + ui.set_width(room); + ui.add(egui::Label::new(RichText::new(how).font(t.font(11.0)).color(t.text_dim)).truncate()); + }); + }); + asked +} + /// ✕ on task `id`'s row. The task may have just finished or stopped being cancellable: nothing to tell the user then, /// so the command goes to the engine directly (`LightcraftApp::run` would put its error in the status bar). pub(crate) fn cancel(app: &mut LightcraftApp, id: u64) { diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 3a102a29a90..3aa0cb3683f 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -61,6 +61,7 @@ mod print; mod profile_menu; mod profiles_layout; mod progress; +mod queue_no_review; mod quit_unsaved; mod rating; mod recheck; diff --git a/crates/ui-egui/src/tests/queue_no_review.rs b/crates/ui-egui/src/tests/queue_no_review.rs new file mode 100644 index 00000000000..f1e7445a130 --- /dev/null +++ b/crates/ui-egui/src/tests/queue_no_review.rs @@ -0,0 +1,284 @@ +//! Queue without review: a folder whose review scan runs while the library lane is busy can go straight into the +//! waiting line, as the last review was confirmed, and its row can still be reviewed. Both are links in the activity +//! stack: under the scan's row, and under the waiting row. + +use std::time::Duration; + +use lightcraft_engine::activity::Cancel; +use serde_json::{Value, json}; + +use crate::headless::Headless; +use crate::import::ImportDialog; +use crate::{LightcraftApp, Services}; +use lightcraft_engine::import::ImportCandidate; + +const T: Duration = Duration::from_secs(60); + +fn demo() -> Headless { + let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }); + let mut h = Headless::new(app, [1200.0, 800.0], 1.0); + h.settle(T); + h +} + +fn has(h: &Headless, id: &str) -> bool { + h.app.widgets.iter().any(|(w, _)| w == id) +} + +/// Let the activity stack lay itself out (a running task shows in it once it is half a second old; a waiting one at once). +fn open_list(h: &mut Headless) { + std::thread::sleep(Duration::from_millis(600)); + for _ in 0..4 { + h.step(); + } +} + +fn click(h: &mut Headless, id: &str) { + // (the rows moved if the line changed: click where the widget is now) + h.step(); + h.step(); + assert_eq!(h.request("ui.clickWidget", json!({"id": id}), T)["ok"], true, "{id}"); + for _ in 0..4 { + h.step(); + } +} + +/// The library lane taken by an import that never ends while the guard lives. +fn busy(h: &Headless) -> lightcraft_engine::activity::TaskGuard { + h.app.session.activity.start("import", "Importing", Cancel::Yes) +} + +/// The request of the one task waiting in line (taking it out of the line, which needs the lane free). +fn waiting_params(h: &Headless) -> Value { + let w = h.app.session.activity.take_ready().expect("a task waits"); + w.request.params["params"].clone() +} + +/// A review confirmed for copying into a folder, as `import::start` asks for it while the lane is taken. +fn confirm_copy(h: &mut Headless, mode_move: bool) { + let mut d = ImportDialog::new(vec![ImportCandidate { path: "/nowhere/a.jpg".into(), ..Default::default() }]); + d.copy = true; + d.move_files = mode_move; + d.destination = "/Volumes/Photos".into(); + d.organize = "month".into(); + d.keywords = "holiday".into(); + let r = crate::import::start(&mut h.app, &d).unwrap(); + assert!(r.get("queued").is_some(), "it waits: {r}"); + let id = r["queued"].as_u64().unwrap(); + h.app.session.activity.cancel(id).unwrap(); +} + +/// Given a review scan while the lane is busy, when "Queue without review" is clicked, then the scan stops and the +/// folder waits in line to be added in place (nothing was confirmed before), with the row saying so. +#[test] +fn a_scanned_folder_queues_without_review_while_the_lane_is_busy() { + let mut h = demo(); + let _lane = busy(&h); + let _scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + open_list(&mut h); + click(&mut h, "activity:queueScan"); + assert!(h.app.scan.is_none(), "the scan was let go"); + let waiting = h.app.session.activity.waiting(); + assert_eq!(waiting.len(), 1, "{waiting:?}"); + assert!(h.app.ui.toast.as_ref().is_some_and(|t| t.0.starts_with("Queued")), "{:?}", h.app.ui.toast); + assert!(has(&h, &format!("activity:review:{}", waiting[0].id)), "its row can still be reviewed"); + let w = h.app.session.activity.take_ready(); + drop(_lane); + let w = w.or_else(|| h.app.session.activity.take_ready()).expect("the import waits"); + assert_eq!(w.request.params["params"], json!({"mode": "add"})); + assert_eq!(w.request.params["paths"], json!(["/nowhere/trip"])); +} + +/// Given no scan, or a scan while the lane is free, then there is no link: the review opens as usual. +#[test] +fn there_is_nothing_to_queue_while_the_lane_is_free() { + let mut h = demo(); + let _scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + open_list(&mut h); + let id = h.app.session.activity.list().iter().find(|t| t.kind == "scan").expect("its row").id; + assert!(has(&h, &format!("activity:row:{id}")), "the scan's row is drawn"); + assert!(!has(&h, "activity:queueScan")); +} + +/// The Local view's folder read is not a review: it has no link. +#[test] +fn reading_a_folder_for_the_local_view_has_no_link() { + let mut h = demo(); + let _lane = busy(&h); + let _scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], true); + open_list(&mut h); + let id = h.app.session.activity.list().iter().find(|t| t.kind == "scan").expect("its row").id; + assert!(has(&h, &format!("activity:row:{id}")), "the scan's row is drawn"); + assert!(!has(&h, "activity:queueScan")); +} + +/// Given the last review copied into a folder, then a folder queued without review is copied there the same way, +/// without the review's keywords. Given it moved, then the copy leaves the originals alone. +#[test] +fn a_folder_queued_without_review_follows_the_last_review_but_never_moves() { + for (moved, mode) in [(false, "copy"), (true, "copy")] { + let mut h = demo(); + let lane = busy(&h); + confirm_copy(&mut h, moved); + let _scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + open_list(&mut h); + click(&mut h, "activity:queueScan"); + drop(lane); + let params = waiting_params(&h); + assert_eq!(params, json!({"mode": mode, "destination": "/Volumes/Photos", "organize": "month"}), "moved: {moved}"); + } +} + +/// Given a folder that was queued without review, when Review… is clicked, then it leaves the line and its review +/// scan starts; while another review scan runs it is refused and stays. +#[test] +fn review_takes_a_queued_folder_out_of_the_line_and_scans_it() { + let mut h = demo(); + let lane = busy(&h); + let scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + open_list(&mut h); + click(&mut h, "activity:queueScan"); + let id = h.app.session.activity.waiting()[0].id; + // another folder is being scanned: refused, and the row stays + let other = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/other".into()], false); + click(&mut h, &format!("activity:review:{id}")); + assert_eq!(h.app.session.activity.waiting().len(), 1, "the row stays"); + assert_eq!(h.app.ui.toast.as_ref().map(|t| t.0.as_str()), Some("A folder is already being scanned")); + drop((other, scan)); + h.app.scan = None; + // (called, not clicked: the scan of a folder that isn't there ends within the frames a click plays out) + crate::import::review_queued(&mut h.app, id).unwrap(); + assert!(h.app.session.activity.waiting().is_empty(), "it left the line"); + assert!(h.app.scan.is_some(), "its review scan runs"); + assert!(h.app.unreviewed.is_empty()); + drop(lane); +} + +/// Given a folder queued without review that copies into a folder with a long path, then its row still shows +/// Review… inside the list (the long text is cut short, not the link). +#[test] +fn a_long_destination_never_pushes_review_out_of_the_row() { + let mut h = demo(); + let lane = busy(&h); + let mut d = ImportDialog::new(vec![ImportCandidate { path: "/nowhere/a.jpg".into(), ..Default::default() }]); + d.copy = true; + d.destination = "/Volumes/A very long name of a photo drive/Photos/Originals/Family and friends/Holidays".into(); + let r = crate::import::start(&mut h.app, &d).unwrap(); + h.app.session.activity.cancel(r["queued"].as_u64().unwrap()).unwrap(); + let _scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + open_list(&mut h); + click(&mut h, "activity:queueScan"); + let id = h.app.session.activity.waiting()[0].id; + h.step(); + h.step(); + let rect_of = |id: &str| h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("no widget {id}")); + let (link, row) = (rect_of(&format!("activity:review:{id}")), rect_of(&format!("activity:row:{id}"))); + assert!(link.right() <= row.right() + 1.0, "{link:?} is past the row's edge {row:?}"); + drop(lane); +} + +/// Given a full line, when Queue without review is clicked, then nothing is lost: the scan goes on and its row goes on (the refusal itself is the error `queue_scan` returns). +#[test] +fn a_full_line_leaves_the_scan_running() { + let mut h = demo(); + let lane = busy(&h); + let request = lightcraft_engine::activity::Request { command: crate::import::IMPORT_REQUEST.into(), params: json!({"paths": ["/x"]}) }; + while h.app.session.activity.enqueue("import", "Importing", request.clone()).is_ok() {} + let _scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + let r = crate::import::queue_scan(&mut h.app); + assert!(r.is_err(), "{r:?}"); + assert!(h.app.scan.is_some(), "the scan was kept"); + assert!(h.app.session.activity.list().iter().any(|t| t.kind == "scan" && !t.cancelling), "its row goes on"); + assert!(h.app.unreviewed.is_empty()); + drop(lane); +} + +/// An album an "Import into this album" scan chose (a plain one of the demo library). +fn plain_album(h: &Headless) -> u64 { + h.app.session.catalog.albums().find(|a| !a.folder && !a.is_smart()).expect("a plain album").id.0 +} + +/// Given a scan that was started for an album and a card, when it is queued without review, then the import asks for +/// that album, and when Review… is clicked the new scan has the album and the card setting back. Given another library +/// opened since the scan started, the album is not asked for (its number means another album there). +#[test] +fn the_album_and_the_card_of_a_scan_survive_queueing_and_review() { + let mut h = demo(); + let lane = busy(&h); + let album = plain_album(&h); + let scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + if let Some(t) = h.app.scan.as_mut() { + t.album = Some(album); + t.copy = true; + } + crate::import::queue_scan(&mut h.app).expect("queued"); + drop(scan); + let id = h.app.session.activity.waiting()[0].id; + crate::import::review_queued(&mut h.app, id).unwrap(); + let t = h.app.scan.as_ref().expect("its review scan runs"); + assert_eq!((t.album, t.copy), (Some(album), true)); + // the same, with the library replaced since the scan began + h.app.scan = None; + let scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + if let Some(t) = h.app.scan.as_mut() { + t.album = Some(album); + t.library = t.library.wrapping_add(1); + } + crate::import::queue_scan(&mut h.app).expect("queued"); + drop(scan); + drop(lane); + assert_eq!(waiting_params(&h)["album"], Value::Null, "no album of another library"); +} + +/// Given a finished scan's review that waits for a dialog to close, when Review… is called, then it is refused before +/// the folder leaves the line: the row stays. +#[test] +fn review_is_refused_while_another_review_waits_for_its_dialog() { + let mut h = demo(); + let lane = busy(&h); + let scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + open_list(&mut h); + click(&mut h, "activity:queueScan"); + let id = h.app.session.activity.waiting()[0].id; + drop(scan); + h.app.review_pending = Some(crate::state::Dialog::Import { opts: Box::new(ImportDialog::new(Vec::new())) }); + let r = crate::import::review_queued(&mut h.app, id); + assert_eq!(r, Err("Close the open dialog, then choose Review… again".to_string())); + assert_eq!(h.app.session.activity.waiting().len(), 1, "the row stays"); + assert_eq!(h.app.unreviewed.len(), 1); + drop(lane); +} + +/// Given a review confirmed in one library, when another library is shown, then a folder queued without review there +/// does not follow how that review brought its files in (it is added in place). +#[test] +fn another_library_does_not_inherit_how_the_last_review_brought_files_in() { + let mut h = demo(); + let lane = busy(&h); + confirm_copy(&mut h, false); + assert!(h.app.last_import.is_some()); + h.app.shown_library = Some(u64::MAX); + h.app.library_changed(&egui::Context::default()); + assert!(h.app.last_import.is_none()); + // a folder queued in the new library is added in place, as with no review before + let _scan = crate::import::stall_scan_in(&mut h.app, vec!["/nowhere/trip".into()], false); + open_list(&mut h); + click(&mut h, "activity:queueScan"); + drop(lane); + assert_eq!(waiting_params(&h), json!({"mode": "add"})); +} + +/// Given a confirmed review that cannot be queued because the line is full, then it is refused and not remembered as +/// the last confirmed review. +#[test] +fn a_review_the_full_line_refused_is_not_remembered() { + let mut h = demo(); + let _lane = busy(&h); + let request = lightcraft_engine::activity::Request { command: crate::import::IMPORT_REQUEST.into(), params: json!({"paths": ["/x"]}) }; + while h.app.session.activity.enqueue("import", "Importing", request.clone()).is_ok() {} + let mut d = ImportDialog::new(vec![ImportCandidate { path: "/nowhere/a.jpg".into(), ..Default::default() }]); + d.copy = true; + d.destination = "/Volumes/Photos".into(); + assert!(crate::import::start(&mut h.app, &d).is_err()); + assert!(h.app.last_import.is_none()); +} diff --git a/docs/background-tasks.md b/docs/background-tasks.md index ca59147aab7..0202be94e3a 100644 --- a/docs/background-tasks.md +++ b/docs/background-tasks.md @@ -70,6 +70,12 @@ Jobs that must not run side by side share a lane (`activity::Lane`). There are t Import lists its folder only when nothing runs, rescans or waits in this lane; files it finds after something started meanwhile wait in line, quietly. A drop while a scan runs or an import's review waits behind a dialog is still refused. + While this lane is busy, the stack's row of the review's folder scan (kind `scan`, "Scanning folder") has Queue + without review: the scan is let go and the folder waits as an import asked as the last confirmed review brought its + files in (`import_queue::plan`: add in place, or copy with its destination, folders, names and DNG conversion, never Move; with none, + add in place, or copy for a card). Its waiting row says so ("Without review: add in place", "…copy to ") and + has Review…, which takes it out of the line and scans it for the usual review, or is refused with a toast while + another folder is being scanned or a finished scan's review waits for a dialog to close. The notes of the last review and of the queued rows are kept in memory only. A call that sets `queue: true` while its lane is busy does not fail: `Activity::enqueue` keeps what it was asked (`Request`: the command and its parameters, with the photos written out) diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 7bfd2bd0217..cc9ceab6182 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -79,7 +79,7 @@ filmstrip is visible. | `engine.commands` | — | Engine + UI commands: id, label, menu, shortcut, params doc, enabled | | `ui.menu.list` | — | Menu entries (flat: id, label, menu path, shortcut, enabled) | | `ui.menu.tree` | — | The menu bar as shown (File … Help): items `{id, params?, label, shortcut?, enabled, checked?}`, separators, submenus — the model behind the native macOS menu bar and the in-window menus | -| `ui.inspect` | — | UI state, window, `loupe` (`source`, `pending`, `failed` = why its render failed, else `null`, and `region: {full, window, pending}` when a zoomed view also renders the window on screen at no more than 100 % — `full` is the frame it is cut from, `window` its `[x, y, w, h]` — and `regionBefore` for the Before side of a Before/After view), canvas/image rects, `scroll: {grid, filmstrip}` (scroll offsets in points, `null` until drawn), active photo, selection, perf (`frameMs` = layout, `logicMs` = per-frame logic before it, `updateMs` = both, `maxUpdateMs`, `fps`, render queue …, `gpu` = adapter in use, `gpuReason` = why renders don't use the GPU, `gpuFallback` = latest render redone on the CPU and why — see `docs/gpu-pipeline.md`), status, memory (bytes per cache, see `library.memory`; plus stage caches — `budgetBytes`, `trimmed`, `sharedSourceBytes` (the one device copy of a big original) — and textures), `export: {running: {total, done, current} \| null, last}`, `notices` (warnings waiting to be shown, e.g. a damaged settings file; OK = `button:noticeOk`), `quitPrompt` (why quitting was stopped: tasks that would be cut short are running — `button:quitAnyway` cancels them and quits, `button:quitCancel` keeps working — or unsaved changes: `button:quitRetry` / `button:quitAnyway` / `button:quitCancel`), `import: {done, total, imported, cancelled} \| null` (an import runs on a worker thread), `tasks` (other background work: `Find Missing Photos`, `Auto Import`), `activity` (every long-running task in flight, same shape as `activity.list`, including tasks waiting in line; the activity stack in the top-left corner shows a running task once it is 0.5 s old and a waiting task at once (no bar, "Starts next" / "Starts after N more"), ids `activity:row:`, ✕ = `activity:cancel:` (on a waiting row: Remove from Queue), `activity:more` expands past 3 rows), `fileDialogs` (commands waiting on a native file dialog, which runs off the UI thread; they run again with the answer when it closes), `copied` (the text the UI last put on the clipboard, `null` until something is copied) | +| `ui.inspect` | — | UI state, window, `loupe` (`source`, `pending`, `failed` = why its render failed, else `null`, and `region: {full, window, pending}` when a zoomed view also renders the window on screen at no more than 100 % — `full` is the frame it is cut from, `window` its `[x, y, w, h]` — and `regionBefore` for the Before side of a Before/After view), canvas/image rects, `scroll: {grid, filmstrip}` (scroll offsets in points, `null` until drawn), active photo, selection, perf (`frameMs` = layout, `logicMs` = per-frame logic before it, `updateMs` = both, `maxUpdateMs`, `fps`, render queue …, `gpu` = adapter in use, `gpuReason` = why renders don't use the GPU, `gpuFallback` = latest render redone on the CPU and why — see `docs/gpu-pipeline.md`), status, memory (bytes per cache, see `library.memory`; plus stage caches — `budgetBytes`, `trimmed`, `sharedSourceBytes` (the one device copy of a big original) — and textures), `export: {running: {total, done, current} \| null, last}`, `notices` (warnings waiting to be shown, e.g. a damaged settings file; OK = `button:noticeOk`), `quitPrompt` (why quitting was stopped: tasks that would be cut short are running — `button:quitAnyway` cancels them and quits, `button:quitCancel` keeps working — or unsaved changes: `button:quitRetry` / `button:quitAnyway` / `button:quitCancel`), `import: {done, total, imported, cancelled} \| null` (an import runs on a worker thread), `tasks` (other background work: `Find Missing Photos`, `Auto Import`), `activity` (every long-running task in flight, same shape as `activity.list`, including tasks waiting in line; the activity stack in the top-left corner shows a running task once it is 0.5 s old and a waiting task at once (no bar, "Starts next" / "Starts after N more"), ids `activity:row:`, ✕ = `activity:cancel:` (on a waiting row: Remove from Queue), `activity:queueScan` (the link under a review scan's row while the library lane is busy: Queue without review) and `activity:review:` (under the waiting row it made: Review…), `activity:more` expands past 3 rows), `fileDialogs` (commands waiting on a native file dialog, which runs off the UI thread; they run again with the answer when it closes), `copied` (the text the UI last put on the clipboard, `null` until something is copied) | | `ui.widgets` | `{filter?}` | On-screen widgets `{id, rect: [x, y, w, h]}` (screen points) | | `ui.clickWidget` / `ui.dragWidget` / `ui.hoverWidget` | `{id, count?, button?, fx?, fy?}` (`button: "right"` right-clicks; `count` is capped at 16) / `{id, toX?, toY?, dx?, dy?, steps?}` (steps are capped at 1000) / `{id, fx?, fy?}` | Real egui input on a widget (hover: the pointer rests on it, e.g. for preset/profile previews). `fx`/`fy` are fractions of the registered rect and may lie outside `[0,1]`; the resulting point must still be inside egui's clipped interaction rect, and a non-finite fraction or resolved point is rejected before any input is queued. Geometry comes from the latest completed layout; if the widget moves before the first event or before a press, or its latest clipped rect no longer contains the point, the request fails with an error instead of clicking another widget or retargeting. A target below an ordinary modal dialog may succeed as a no-op or a backdrop click, because egui routes that input to the dialog; a target covered by a non-modal overlay fails. The blocking library-problem/launch-list window is explicit: its dim takes the modal layer, but a background target fails instead of reporting a no-op success, and only that window's own controls (`button:library…`) pass. Its creation frame is shielded and redrawn with empty input like a prompt's, so background text/pointer input cannot act while the new modal areas settle. A quit prompt or settings notice is a real egui modal scope with a foreground backdrop. Only its own buttons (`button:quit…`, `button:noticeOk`) accept a `ui.clickWidget`; background targets fail, and background keystrokes, text/clipboard input, wheel/zoom input and AccessKit actions are dropped before panels see them. The prompt itself takes Tab/Shift+Tab, Enter/Space on the focused button, and Escape/Enter for the safe default Cancel; AccessKit Focus/Click works when targeted at a prompt button. Its first creation frame (including a Tasks→Unsaved or notice→next-notice transition) is shielded and redrawn with empty input, so a press/release in that frame, or a held press from before it, cannot act underneath it; a synthetic drag already in progress is canceled. Once settled, raw `ui.click`/`ui.drag`/`ui.pointer` and backdrop clicks are still delivered to the prompt backdrop as no-ops, and the prompt's own button clicks work normally. The area/layer check cannot see a different widget covering the point in the same layer. A `ui.clickWidget` whose widget disappears before its release also fails, after canceling the pointer press without a click or drag (the same rules apply when a click spans several host frames) | | `ui.move` / `ui.click` / `ui.drag` | `{x, y, count?, button?}` / `{x, y, toX, toY, steps?}` | Raw pointer input, screen points (the same click and step caps apply) | diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index becf361d7ee..8cc719b0b3c 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder wait for each other instead of refusing, and a waiting task shows in the activity stack with ✕ to remove it; earlier: LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-BEHAV-BG-TASKS: a folder scanned for the import review while the library lane is busy can be queued without its review, from the scan's row in the activity stack, and reviewed after all from its waiting row; earlier: LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder wait for each other instead of refusing, and a waiting task shows in the activity stack with ✕ to remove it; earlier: LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -461,7 +461,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | LR-BEHAV-BATCH | Batch apply to selection | P0 | ✅ | `cmd:photo.rate`, `cmd:develop.paste`, `cmd:preset.apply`, `cmd:app.export` | | | LR-BEHAV-PREVIEW-HOVER | Hover previews | P1 | ✅ | `crates/ui-egui/src/panels/presets.rs`, `crates/ui-egui/src/panels/profiles.rs`, `crates/ui-egui/src/panels/right.rs` (`versions`), `crates/ui-egui/src/panels/detail.rs` | presets, profile menu, profile browser and versions preview in the loupe | | LR-BEHAV-PROGRESSIVE | Progressive rendering | P0 | ✅ | `crates/engine/src/media.rs`, `crates/preview/src/lib.rs` | | -| LR-BEHAV-BG-TASKS | Background tasks | P0 | ✅ | `cmd:activity.list`, `cmd:activity.cancel`, `crates/engine/src/activity.rs`, `crates/ui-egui/src/panels/activity.rs`, `crates/ui-egui/src/widgets/progress.rs`, `docs/background-tasks.md`, `crates/preview/src/lib.rs` (`JobPool`) | renders off the UI thread; exports run several photos of a batch side by side (`export_parallelism`, memory-gated; files, names and order as one at a time, #496); one activity stack in the top-left corner under the top bar, as in Lightroom Classic (issue #345): imports, folder scans, exports (and the contact sheet PDF), Synchronize Folder (its scan and its run), Build / Smart Previews, Lightroom catalog inspect / import, Photo Merge, model downloads (SAM 3, face, AI Denoise), the face scan, AI Denoise, Find Missing Photos and Reload from Disk (`cmd:photo.reload`, its files decoded on a worker thread, cancellable; `wait: true` for agents) each show a row (name, progress bar or a sweep while the amount isn't known, count and current item) once 0.5 s old, three rows then "+N more"; ✕ cancels the jobs that can stop ("Stopping…" until they do); quitting asks while a cancellable task runs; agents and `ui.inspect` (`activity`) see the same list; an import and a Synchronize Folder never run at once: one asked for while the other runs waits in line and starts by itself (the library lane, `activity::Lane`); a task waiting in line has a row in the stack at once, with when it starts and ✕ (Remove from Queue) to take it out of the line. No pause (Lightroom can pause some tasks) | +| LR-BEHAV-BG-TASKS | Background tasks | P0 | ✅ | `cmd:activity.list`, `cmd:activity.cancel`, `crates/engine/src/activity.rs`, `crates/ui-egui/src/panels/activity.rs`, `crates/ui-egui/src/widgets/progress.rs`, `docs/background-tasks.md`, `crates/preview/src/lib.rs` (`JobPool`) | renders off the UI thread; exports run several photos of a batch side by side (`export_parallelism`, memory-gated; files, names and order as one at a time, #496); one activity stack in the top-left corner under the top bar, as in Lightroom Classic (issue #345): imports, folder scans, exports (and the contact sheet PDF), Synchronize Folder (its scan and its run), Build / Smart Previews, Lightroom catalog inspect / import, Photo Merge, model downloads (SAM 3, face, AI Denoise), the face scan, AI Denoise, Find Missing Photos and Reload from Disk (`cmd:photo.reload`, its files decoded on a worker thread, cancellable; `wait: true` for agents) each show a row (name, progress bar or a sweep while the amount isn't known, count and current item) once 0.5 s old, three rows then "+N more"; ✕ cancels the jobs that can stop ("Stopping…" until they do); quitting asks while a cancellable task runs; agents and `ui.inspect` (`activity`) see the same list; an import and a Synchronize Folder never run at once: one asked for while the other runs waits in line and starts by itself (the library lane, `activity::Lane`); a task waiting in line has a row in the stack at once, with when it starts and ✕ (Remove from Queue) to take it out of the line; while the library lane is busy, the review's folder scan row has Queue without review (the folder waits as the last review was confirmed, never Move, and its waiting row has Review…). No pause (Lightroom can pause some tasks) | | LR-BEHAV-OFFLINE | Offline editing | P1 | ✅ | | local-first: everything works offline | | LR-BEHAV-WEB-SAFETY | Library safety in the browser build | P1 | 🟡 | `cmd:file.backupLibrary`, `cmd:file.restoreLibrary`, `apps/lightcraft-web/src/safety.rs`, `apps/lightcraft-web/src/backup.rs`, `apps/lightcraft-web/src/files.rs` | web only (experimental): Back Up Library (zip of the catalog and every stored original) and a non-destructive Restore; failed saves show as unsaved and are retried; a photo that can't be stored isn't added; one tab per library (Web Locks); notices for storage that isn't persistent and for a library that can't open; `?reset` asks first; a panic shows a message. Missing: `?safe` start, deleting originals of removed photos, zip64 (backups > 4 GB) | | LR-BEHAV-GPU | GPU acceleration | P0 | ✅ | `crates/gpu/src/render.rs`, `cmd:app.gpu`, `docs/gpu-pipeline.md`, `crates/ui-egui/src/panels/notices.rs` | CPU fallback per render on device limits, out of memory, device errors / loss, incomplete or black results (`perf.gpuReason`, `perf.gpuFallback`; each render reports its own reason — `lightcraft_gpu::try_render`, `gpuFallback` per exported file — issue #675); short submissions for slow iGPUs; backend choice (DX12 only on Windows, `LIGHTCRAFT_GPU_BACKEND` / `WGPU_BACKEND`), device created after the window opens, crash sentinel (issue #136); a GPU lost while LightCraft runs (driver reset) stops it with that message and turns GPU rendering off for the next start, which says why (issue #1337; the window's renderer can't survive the lost device); quitting waits (up to 2 s) for renders in flight and starts no new GPU work, so none is inside the driver when the process exits (`crates/gpu/src/exit.rs`, issue #620; seen crashing only on Linux + NVIDIA, other drivers unverified); with GPU rendering on and no adapter found at all (e.g. no Vulkan loader on NixOS outside `nix develop`), the desktop app says once per session that it renders on the CPU and points to Help ▸ System Info (`gpu_notice`; not when the GPU is turned off or only a software adapter exists); no tiling beyond the buffer limit (CPU) | @@ -960,3 +960,4 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-22 | minor | LR-CROP-AUTO: Auto straighten turns by at most 10° and only on at least 3 agreeing lines, and says when it finds nothing to level by; measured on 68 photos straightened by hand and 300 left as shot, unwanted turns of more than 1° fell from 79 to 19 of the 300. Downgraded ✅ → 🟡: it still leaves most tilted photos alone | | 2026-10-23 | patch | LRC-LIB-FILTERBAR: showing an album (`library.source`) while the filter holds an album drops the filter's album, as showing a library folder already dropped its folder filter; before, the old album stayed in the filter unseen (the filter bar has no album chip) and narrowed the next source such as All Photos; the row's note says so; status unchanged (✅) | | 2026-10-25 | minor | LR-BEHAV-BG-TASKS, LR-IMP-DRAGDROP: imports and Synchronize Folder share the library lane: one asked for while the other runs waits in line instead of being refused; a waiting Synchronize Folder scans again and removes, relinks or reads only the photos its dialog showed; every waiting task has a row in the activity stack (when it starts, ✕ to remove it); status unchanged (✅) | +| 2026-10-24 | minor | LR-BEHAV-BG-TASKS: a folder whose review scan runs while the library lane is busy can be queued without its review (the scan row's Queue without review in the activity stack), imported as the last review was confirmed (never Move) and reviewed after all from its waiting row (Review…); status unchanged (✅) | diff --git a/docs/whats-new.md b/docs/whats-new.md index bf1d93038b0..e533d9a7af6 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -2,6 +2,18 @@ ## 2026-10-24 +### Queue a folder without waiting for its review +- While an import or Synchronize Folder runs (or waits), the "Scanning folder" row in the activity stack has Queue + without review. It stops the scan, which on a network share can take minutes, and puts the folder in line to be + imported the way your last import review was confirmed: added in place, or copied with the same destination, folders, + file names and DNG conversion. Before any review it is added in place; a camera or card is copied into the library. An album chosen + by Import into this album is kept. Keywords, presets and other albums are not: they belong to one batch. +- It never moves files. After a review that moved its originals the folder is copied instead, and the originals stay. +- The waiting row says how the folder comes in ("Without review: add in place", "…copy to ") and has Review…: + it takes the folder out of the line and scans it for the usual review. Review… is refused (the row stays) while + another folder is being scanned, or a finished scan's review waits for a dialog to close. With the library free there is nothing to queue: the review opens when the scan is in. +- What your last review chose is kept until you quit or open another library. + ### Imports and Synchronize Folder wait for each other - An import confirmed (or photos dropped on the window) while a Synchronize Folder runs, or a Synchronize Folder confirmed while an import runs, now waits in line and starts by itself when the other ends, with a message that it