LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LRC-LIB-LIBFOLDERS: The listing row counts folders and files as labels, so one reads right
Nathaniel Ledford80fcab83b0c7
diff --git a/crates/engine/src/sync.rs b/crates/engine/src/sync.rsindex 4691e1512..eab923e5e 100644--- a/crates/engine/src/sync.rs+++ b/crates/engine/src/sync.rs@@ -78,8 +78,10 @@ impl SyncProgress {/// While a scan lists the folder (before any file can be checked): the folders and files/// listed so far. `None` once the listing is over.pub fn listing(&self) -> Option<(usize, usize)> {- use std::sync::atomic::Ordering::Relaxed;- (!self.listed.load(Relaxed)).then(|| (self.folders_listed.load(Relaxed), self.files_listed.load(Relaxed)))+ use std::sync::atomic::Ordering::{Acquire, Relaxed};+ // (Acquire pairs with the Release store of `listed`: once the listing is seen to be+ // over, so is what was stored before it, and the counts that follow are the final ones)+ (!self.listed.load(Acquire)).then(|| (self.folders_listed.load(Relaxed), self.files_listed.load(Relaxed)))}}@@ -209,7 +211,7 @@ pub fn scan_with(input: SyncInput, progress: &SyncProgress) -> FolderChanges {let SyncInput { folder, scan, ids, naming, labels } = input;let seen: Vec<Arc<Photo>> = ids.iter().filter_map(|id| labels.photo(*id)).map(Arc::clone).collect();if !cfg!(target_arch = "wasm32") && !Path::new(&folder).is_dir() {- progress.listed.store(true, std::sync::atomic::Ordering::Relaxed);+ progress.listed.store(true, std::sync::atomic::Ordering::Release);return FolderChanges { path: folder, seen, offline: true, ..Default::default() };}// (how each photo's sidecar is named: a pass over the library, made here and not while the@@ -239,7 +241,7 @@ pub fn scan_with(input: SyncInput, progress: &SyncProgress) -> FolderChanges {!progress.files.cancel.load(Relaxed)}),);- progress.listed.store(true, std::sync::atomic::Ordering::Relaxed);+ progress.listed.store(true, std::sync::atomic::Ordering::Release);let listing = &listing;// (no threads on the web: one after the other there)#[cfg(target_arch = "wasm32")]diff --git a/crates/ui-egui/locales/cs-formats.json b/crates/ui-egui/locales/cs-formats.jsonindex 60ce63b07..8a50d38f1 100644--- a/crates/ui-egui/locales/cs-formats.json+++ b/crates/ui-egui/locales/cs-formats.json@@ -296,6 +296,6 @@"Already in “{}”": "Již v „{}“","Move {n} photo{} to “{}”": "Přesunout do „{1}“ fotografie: {n}{0:.0}","Move {n} photo{} to “{}”?": "Přesunout do „{1}“ fotografie: {n}{0:.0}?",- "Listing folders: {folders} folders, {files} files": "Procházení složek – složky: {folders}, soubory: {files}",+ "Listing folders — folders: {folders}, files: {files}": "Procházení složek – složky: {folders}, soubory: {files}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "Do „{1}“ přesunuto fotografií: {n}{0:.0}. Úpravy → Zpět je vrátí."}diff --git a/crates/ui-egui/locales/de-formats.json b/crates/ui-egui/locales/de-formats.jsonindex d7d2049be..af29f7134 100644--- a/crates/ui-egui/locales/de-formats.json+++ b/crates/ui-egui/locales/de-formats.json@@ -296,6 +296,6 @@"Already in “{}”": "Bereits in „{}“","Move {n} photo{} to “{}”": "{n} Foto{0} nach „{1}“ verschieben","Move {n} photo{} to “{}”?": "{n} Foto{0} nach „{1}“ verschieben?",- "Listing folders: {folders} folders, {files} files": "Ordner werden aufgelistet: {folders} Ordner, {files} Dateien",+ "Listing folders — folders: {folders}, files: {files}": "Ordner werden aufgelistet – Ordner: {folders}, Dateien: {files}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "{n} Foto{0} nach „{1}“ verschoben. Bearbeiten → Rückgängig holt sie zurück."}diff --git a/crates/ui-egui/locales/es-formats.json b/crates/ui-egui/locales/es-formats.jsonindex e4e069ba6..fd1540169 100644--- a/crates/ui-egui/locales/es-formats.json+++ b/crates/ui-egui/locales/es-formats.json@@ -296,6 +296,6 @@"Already in “{}”": "Ya está en “{}”","Move {n} photo{} to “{}”": "Mover {n} foto{0} a “{1}”","Move {n} photo{} to “{}”?": "¿Mover {n} foto{0} a “{1}”?",- "Listing folders: {folders} folders, {files} files": "Listando carpetas: {folders} carpetas, {files} archivos",+ "Listing folders — folders: {folders}, files: {files}": "Listando carpetas — carpetas: {folders}, archivos: {files}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "{n} foto{0} movida{0} a “{1}”. Editar → Deshacer las devuelve."}diff --git a/crates/ui-egui/locales/fr-formats.json b/crates/ui-egui/locales/fr-formats.jsonindex 7706d7d2b..ae2b77872 100644--- a/crates/ui-egui/locales/fr-formats.json+++ b/crates/ui-egui/locales/fr-formats.json@@ -296,6 +296,6 @@"Already in “{}”": "Déjà dans « {} »","Move {n} photo{} to “{}”": "Déplacer {n} photo{} vers « {} »","Move {n} photo{} to “{}”?": "Déplacer {n} photo{} vers « {} » ?",- "Listing folders: {folders} folders, {files} files": "Liste des dossiers : {folders} dossiers, {files} fichiers",+ "Listing folders — folders: {folders}, files: {files}": "Liste des dossiers — dossiers : {folders}, fichiers : {files}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "{n} photo{} déplacée(s) vers « {} ». Modifier → Annuler les remet en place."}diff --git a/crates/ui-egui/locales/it-formats.json b/crates/ui-egui/locales/it-formats.jsonindex 571de1aeb..ccd01e6a7 100644--- a/crates/ui-egui/locales/it-formats.json+++ b/crates/ui-egui/locales/it-formats.json@@ -297,5 +297,5 @@"Move {n} photo{} to “{}”": "Sposta foto in “{1}” ({n}){0:.0}","Move {n} photo{} to “{}”?": "Spostare le foto in “{1}” ({n})?{0:.0}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "Foto spostate in “{1}”: {n}{0:.0}. Modifica → Annulla le riporta indietro.",- "Listing folders: {folders} folders, {files} files": "Elenco delle cartelle: {folders} cartelle, {files} file"+ "Listing folders — folders: {folders}, files: {files}": "Elenco delle cartelle — cartelle: {folders}, file: {files}"}diff --git a/crates/ui-egui/locales/ja-formats.json b/crates/ui-egui/locales/ja-formats.jsonindex 12efa24ad..ce56500b5 100644--- a/crates/ui-egui/locales/ja-formats.json+++ b/crates/ui-egui/locales/ja-formats.json@@ -296,6 +296,6 @@"Renames {n} face{} across the library. The files are not changed.": "ライブラリ全体で{n}件の顔の名前を変更します。ファイルは変更されません。{:.0}","“{to}” is already a person. Combining them makes one person; Undo separates them again.": "「{to}」はすでに別の人物です。まとめると1人になり、元に戻すと再び分かれます。","{what} merge added at {mp}: its full size, {full}, needs more memory than this computer has": "{what}合成を{mp}で追加しました:フルサイズ({full})にはこのコンピューターのメモリが足りません",- "Listing folders: {folders} folders, {files} files": "フォルダーを一覧中:フォルダー {folders} 個、ファイル {files} 個",+ "Listing folders — folders: {folders}, files: {files}": "フォルダーを一覧中 — フォルダー:{folders}、ファイル:{files}","{what} merge added at {mp}, the largest a panorama can be (its full size is {full})": "{what}合成を{mp}で追加しました。パノラマの最大サイズです(フルサイズ:{full})"}diff --git a/crates/ui-egui/locales/ka-formats.json b/crates/ui-egui/locales/ka-formats.jsonindex 9c46658cb..c3b48ef62 100644--- a/crates/ui-egui/locales/ka-formats.json+++ b/crates/ui-egui/locales/ka-formats.json@@ -296,6 +296,6 @@"Already in “{}”": "Already in “{}”","Move {n} photo{} to “{}”": "Move {n} photo{} to “{}”","Move {n} photo{} to “{}”?": "Move {n} photo{} to “{}”?",- "Listing folders: {folders} folders, {files} files": "საქაღალდეების ჩამოთვლა: საქაღალდე — {folders}, ფაილი — {files}",+ "Listing folders — folders: {folders}, files: {files}": "საქაღალდეების ჩამოთვლა — საქაღალდეები: {folders}, ფაილები: {files}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "Moved {n} photo{} to “{}”. Edit → Undo moves them back."}diff --git a/crates/ui-egui/locales/pl-formats.json b/crates/ui-egui/locales/pl-formats.jsonindex 29903f6b4..e3ce316a0 100644--- a/crates/ui-egui/locales/pl-formats.json+++ b/crates/ui-egui/locales/pl-formats.json@@ -296,6 +296,6 @@"Already in “{}”": "Już w „{}”","Move {n} photo{} to “{}”": "Przenieś do „{1}” — zdjęcia: {n}{0:.0}","Move {n} photo{} to “{}”?": "Przenieść do „{1}” — zdjęcia: {n}{0:.0}?",- "Listing folders: {folders} folders, {files} files": "Przeglądanie folderów — foldery: {folders}, pliki: {files}",+ "Listing folders — folders: {folders}, files: {files}": "Przeglądanie folderów — foldery: {folders}, pliki: {files}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "Przeniesiono do „{1}” — zdjęcia: {n}{0:.0}. Edytuj → Cofnij przywróci je."}diff --git a/crates/ui-egui/locales/pt-br-formats.json b/crates/ui-egui/locales/pt-br-formats.jsonindex 4618ba5f9..bab81a368 100644--- a/crates/ui-egui/locales/pt-br-formats.json+++ b/crates/ui-egui/locales/pt-br-formats.json@@ -296,6 +296,6 @@"Renames {n} face{} across the library. The files are not changed.": "Renomeia {n} rosto{} na biblioteca. Os arquivos não são alterados.","“{to}” is already a person. Combining them makes one person; Undo separates them again.": "“{to}” já é uma pessoa. Combiná-las deixa uma só; Desfazer as separa de novo.","{what} merge added at {mp}: its full size, {full}, needs more memory than this computer has": "{what} mesclagem adicionada em {mp}: o tamanho completo, {full}, precisa de mais memória do que este computador tem",- "Listing folders: {folders} folders, {files} files": "Listando pastas: {folders} pastas, {files} arquivos",+ "Listing folders — folders: {folders}, files: {files}": "Listando pastas — pastas: {folders}, arquivos: {files}","{what} merge added at {mp}, the largest a panorama can be (its full size is {full})": "{what} mesclagem adicionada em {mp}, o maior tamanho possível para um panorama (tamanho completo: {full})"}diff --git a/crates/ui-egui/locales/ru-formats.json b/crates/ui-egui/locales/ru-formats.jsonindex ffeac91cc..1efc30268 100644--- a/crates/ui-egui/locales/ru-formats.json+++ b/crates/ui-egui/locales/ru-formats.json@@ -296,6 +296,6 @@"Already in “{}”": "Уже в «{}»","Move {n} photo{} to “{}”": "Переместить в «{1}» фото: {n}{0:.0}","Move {n} photo{} to “{}”?": "Переместить в «{1}» фото: {n}{0:.0}?",- "Listing folders: {folders} folders, {files} files": "Просмотр папок — папок: {folders}, файлов: {files}",+ "Listing folders — folders: {folders}, files: {files}": "Просмотр папок — папок: {folders}, файлов: {files}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "В «{1}» перемещено фото: {n}{0:.0}. Правка → Отменить вернёт их."}diff --git a/crates/ui-egui/locales/uk-formats.json b/crates/ui-egui/locales/uk-formats.jsonindex 3891cc0f8..0ada44e08 100644--- a/crates/ui-egui/locales/uk-formats.json+++ b/crates/ui-egui/locales/uk-formats.json@@ -296,6 +296,6 @@"Already in “{}”": "Уже в «{}»","Move {n} photo{} to “{}”": "Перемістити до «{1}» фото: {n}{0:.0}","Move {n} photo{} to “{}”?": "Перемістити до «{1}» фото: {n}{0:.0}?",- "Listing folders: {folders} folders, {files} files": "Перегляд тек — тек: {folders}, файлів: {files}",+ "Listing folders — folders: {folders}, files: {files}": "Перегляд тек — тек: {folders}, файлів: {files}","Moved {n} photo{} to “{}”. Edit → Undo moves them back.": "До «{1}» переміщено фото: {n}{0:.0}. Редагування → Скасувати поверне їх."}diff --git a/crates/ui-egui/locales/zh-hans-formats.json b/crates/ui-egui/locales/zh-hans-formats.jsonindex 7f4bd425a..a28b07d2c 100644--- a/crates/ui-egui/locales/zh-hans-formats.json+++ b/crates/ui-egui/locales/zh-hans-formats.json@@ -296,6 +296,6 @@"Renames {n} face{} across the library. The files are not changed.": "在整个图库中重命名 {n} 张面孔。不会改动文件。{:.0}","“{to}” is already a person. Combining them makes one person; Undo separates them again.": "“{to}”已经是另一个人。合并后成为一个人;撤销会再把他们分开。","{what} merge added at {mp}: its full size, {full}, needs more memory than this computer has": "已添加 {what} 合并({mp}):完整尺寸({full})所需的内存超出了这台电脑的内存",- "Listing folders: {folders} folders, {files} files": "正在列出文件夹:{folders} 个文件夹,{files} 个文件",+ "Listing folders — folders: {folders}, files: {files}": "正在列出文件夹 — 文件夹:{folders},文件:{files}","{what} merge added at {mp}, the largest a panorama can be (its full size is {full})": "已添加 {what} 合并({mp}),这是全景图的最大尺寸(完整尺寸:{full})"}diff --git a/crates/ui-egui/locales/zh-hant-formats.json b/crates/ui-egui/locales/zh-hant-formats.jsonindex ffe70708a..119272225 100644--- a/crates/ui-egui/locales/zh-hant-formats.json+++ b/crates/ui-egui/locales/zh-hant-formats.json@@ -296,6 +296,6 @@"Renames {n} face{} across the library. The files are not changed.": "在整個照片庫中重新命名 {n} 張面孔。不會改動檔案。{:.0}","“{to}” is already a person. Combining them makes one person; Undo separates them again.": "「{to}」已經是另一個人。合併後成為一個人;還原會再把他們分開。","{what} merge added at {mp}: its full size, {full}, needs more memory than this computer has": "已新增{what}合併照片({mp}):完整尺寸({full})所需的記憶體超過這台電腦的記憶體",- "Listing folders: {folders} folders, {files} files": "正在列出資料夾:{folders} 個資料夾,{files} 個檔案",+ "Listing folders — folders: {folders}, files: {files}": "正在列出資料夾 — 資料夾:{folders},檔案:{files}","{what} merge added at {mp}, the largest a panorama can be (its full size is {full})": "已新增{what}合併照片({mp}),這是全景圖的最大尺寸(完整尺寸:{full})"}diff --git a/crates/ui-egui/src/sync.rs b/crates/ui-egui/src/sync.rsindex 100a35088..67053787a 100644--- a/crates/ui-egui/src/sync.rs+++ b/crates/ui-egui/src/sync.rs@@ -41,7 +41,7 @@ pub(crate) fn scan_row(progress: &SyncProgress, name: &str) -> (u64, u64, String}fn listing_text(folders: usize, files: usize) -> String {- crate::i18n::tr_format!("Listing folders: {folders} folders, {files} files", folders = folders, files = files)+ crate::i18n::tr_format!("Listing folders — folders: {folders}, files: {files}", folders = folders, files = files)}/// Open the dialog for folder `path` (called `name` in it) and start scanning.diff --git a/crates/ui-egui/src/tests_sync.rs b/crates/ui-egui/src/tests_sync.rsindex a0a830f20..bc37d4eab 100644--- a/crates/ui-egui/src/tests_sync.rs+++ b/crates/ui-egui/src/tests_sync.rs@@ -356,7 +356,7 @@ fn while_the_folder_is_listed_its_row_says_what_was_listed_and_its_bar_moves_on_p.files_listed.store(18402, Relaxed);let (done, total, detail) = crate::sync::scan_row(&p, "photos/Various");assert_eq!((done, total), (0, 0), "a bar that moves on its own, not 0 of 64085");- assert_eq!(detail, "Listing folders: 312 folders, 18402 files · photos/Various");+ assert_eq!(detail, "Listing folders — folders: 312, files: 18402 · photos/Various");// the listing is over: the files and photos checked, of how manyp.listed.store(true, Relaxed);p.checked.store(10, Relaxed);