LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Lightroom import: document the functions this change touches
Carlos Villanueva16417e2eca5a
diff --git a/crates/engine/src/lightroom_catalog.rs b/crates/engine/src/lightroom_catalog.rsindex d9517c56a..55acad4fb 100644--- a/crates/engine/src/lightroom_catalog.rs+++ b/crates/engine/src/lightroom_catalog.rs@@ -436,6 +436,9 @@ pub fn read(path: &Path) -> Result<CatalogImport, String> {read_with_progress(path, &cancel, &total, &done)}+/// Read a Lightroom Classic catalog for import, counting the tables read in `total` / `done` and+/// stopping when `cancel` is set. Images whose catalog records are incomplete are left out and+/// listed in [`CatalogImport::skipped`] instead of failing the read.pub fn read_with_progress(path: &Path, cancel: &AtomicBool, total: &AtomicUsize, done: &AtomicUsize) -> Result<CatalogImport, String> {// 13 catalog tables plus one validation stage; ImportJob adds one unit per original path.total.store(14, Ordering::Relaxed);@@ -850,6 +853,8 @@ pub(crate) struct ApplyPrepared<'a> {pub(crate) undo0: usize,}+/// Turn the read catalog into library records in one undo step and return the import report+/// (added, missing, failed, warnings and skipped images).pub(crate) fn apply_prepared(s: &mut crate::Session, mut data: CatalogImport, context: ApplyPrepared<'_>) -> crate::Result<AppliedImport> {let ApplyPrepared { update_existing, files, index, archive_path, missing_sources, undo0 } = context;// nothing but a file type LightCraft reads becomes a record, whichever route got here (#2135)@@ -1661,6 +1666,7 @@ mod tests {catalog}+ /// `tables` with each row as a one-row table, for [`native_catalog_rows`].fn one_row(tables: Vec<(&'static str, &'static str, Vec<SqlValue>)>) -> Vec<(&'static str, &'static str, Vec<Vec<SqlValue>>)> {tables.into_iter().map(|(name, columns, row)| (name, columns, vec![row])).collect()}diff --git a/crates/ui-egui/src/lightroom_import.rs b/crates/ui-egui/src/lightroom_import.rsindex fb7225140..2bda28cf4 100644--- a/crates/ui-egui/src/lightroom_import.rs+++ b/crates/ui-egui/src/lightroom_import.rs@@ -228,6 +228,8 @@ fn spawn_finalize(unsupported_wasm().map(|_| ())}+/// What `status` and the result window show for an inspected catalog: counts, missing originals,+/// warnings and skipped images.#[cfg(not(target_arch = "wasm32"))]fn inspect_report(data: lightcraft_engine::lightroom_catalog::CatalogImport) -> Value {json!({@@ -299,6 +301,8 @@ fn show_result(app: &mut LightcraftApp) {}}+/// The lasting result window for an inspect or import: counts, failures, missing originals, the+/// skipped images (one line, in the UI language) and at most eight warnings.fn result_dialog(value: &Value, summary: &str) -> crate::state::Dialog {let report = value.get("report").unwrap_or(value);let mut details = Vec::new();