mirror of
https://github.com/storytold/lightcraft.git
synced 2026-12-04 07:51:17 -05:00
Merge pull request #2164 from nledford/thumb-overlay
LR-VIEW-FILMSTRIP: filmstrip and grid thumbnails share one overlay, and it degrades on narrow tiles
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
"+{} more": "+{} dalších",
|
||||
", {failed} file{} not readable": ", nečitelné soubory: {failed}{:.0}",
|
||||
", {} label": ", štítek: {}",
|
||||
", {} star{}": ", hvězdičky: {}{:.0}",
|
||||
"1 task is still running: {names}. Quitting stops it.": "Stále běží 1 úloha: {names}. Ukončení aplikace ji zastaví.",
|
||||
"; {kept} already had a location": "; {kept} již mělo polohu",
|
||||
"; {n} gained synonyms": "; {n} získalo synonyma",
|
||||
@@ -326,5 +325,6 @@
|
||||
"View › Detail View ({keys}).": "Zobrazení › Zobrazení detailu ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Soubor › Exportovat… · Soubor › Tisk… ({keys}).",
|
||||
"{n} folder{} could not be read": "Složky, které se nepodařilo přečíst: {n}{:.0}",
|
||||
"{n} file{} skipped (not a supported photo type)": "Přeskočené soubory (nejde o podporovaný typ fotografie): {n}{:.0}"
|
||||
"{n} file{} skipped (not a supported photo type)": "Přeskočené soubory (nejde o podporovaný typ fotografie): {n}{:.0}",
|
||||
", rating {} of 5": ", hodnocení: {} z 5"
|
||||
}
|
||||
|
||||
@@ -2047,7 +2047,8 @@
|
||||
"We": "St",
|
||||
"Wednesday": "Středa",
|
||||
"What's New": "Co je nového",
|
||||
"When rated or hovered": "Při hodnocení nebo najetí myší",
|
||||
"Stars on hover": "Hvězdy při najetí",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Hvězdy při najetí: vlajky a barevné štítky jsou vidět vždy; hvězdy a značka úprav se zobrazí, když je fotka pod myší nebo vybraná.",
|
||||
"White Balance": "Vyvážení bílé",
|
||||
"White Balance Selector": "Kapátko vyvážení bílé",
|
||||
"White Balance Selector (W)": "Kapátko vyvážení bílé (W)",
|
||||
@@ -2503,5 +2504,10 @@
|
||||
"Welcome": "Vítejte",
|
||||
"Next": "Další",
|
||||
"Get Started": "Začít",
|
||||
"Stopped at the scan limit: there may be more photos": "Zastaveno na limitu skenování: je možné, že existují další fotografie"
|
||||
"Stopped at the scan limit: there may be more photos": "Zastaveno na limitu skenování: je možné, že existují další fotografie",
|
||||
"Stack — click to expand (S)": "Sada — kliknutím rozbalíte (S)",
|
||||
"Stack — click to collapse (S)": "Sada — kliknutím sbalíte (S)",
|
||||
"Virtual copy": "Virtuální kopie",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Klikněte pravým tlačítkem → Najít chybějící soubor… a najděte jej znovu.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Klikněte pravým tlačítkem → Znovu načíst z disku a zkuste to znovu."
|
||||
}
|
||||
|
||||
@@ -204,7 +204,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "Ähnliche Fotos: {n}{:.0} · Ansicht → Filter löschen zeigt alle Fotos",
|
||||
"Moved; {} photo(s) relinked": "Verschoben; {} Foto(s) neu verknüpft",
|
||||
"{} label (click more labels to show any of them)": "Farbmarkierung {} (weitere Farbmarkierungen auswählen, um alle passenden Fotos zu zeigen)",
|
||||
", {} star{}": ", Sterne: {}{:.0}",
|
||||
", {} label": ", Farbmarkierung: {}",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Lädt von {host} herunter. Sobald es angekommen und geprüft ist, installiert LightCraft es und {after}.",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "{name} ist installiert und in Gebrauch: Gesichtserkennung ist eingeschaltet",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "Fotos holen Sie mit Datei › Fotos importieren… ({keys}) in die Bibliothek.",
|
||||
"View › Detail View ({keys}).": "Ansicht › Detailansicht ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Datei › Exportieren… · Datei › Drucken… ({keys})."
|
||||
"File › Export… · File › Print… ({keys}).": "Datei › Exportieren… · Datei › Drucken… ({keys}).",
|
||||
", rating {} of 5": ", Bewertung: {} von 5"
|
||||
}
|
||||
|
||||
@@ -1652,7 +1652,8 @@
|
||||
"Watermark": "Wasserzeichen",
|
||||
"Wednesday": "Mittwoch",
|
||||
"What's New": "Neuigkeiten",
|
||||
"When rated or hovered": "Bei Bewertung oder unter dem Mauszeiger",
|
||||
"Stars on hover": "Sterne beim Überfahren",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Sterne beim Überfahren: Flaggen und Farbmarkierungen sind immer sichtbar; die Sterne und das Bearbeitet-Zeichen erscheinen, solange ein Foto überfahren oder ausgewählt ist.",
|
||||
"White Balance": "Weißabgleich",
|
||||
"White Balance Selector": "Weißabgleich-Pipette",
|
||||
"White Balance Selector (W)": "Weißabgleich-Pipette (W)",
|
||||
@@ -3538,5 +3539,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Starten Sie die App mit --control 7980 (oder LIGHTCRAFT_CONTROL_PORT), dann verbindet lightcraft-cli mcp --connect einen Agenten mit ihr.",
|
||||
"Welcome": "Willkommen",
|
||||
"Next": "Weiter",
|
||||
"Get Started": "Loslegen"
|
||||
"Get Started": "Loslegen",
|
||||
"Stack — click to expand (S)": "Stapel — Klicken zum Aufklappen (S)",
|
||||
"Stack — click to collapse (S)": "Stapel — Klicken zum Zuklappen (S)",
|
||||
"Virtual copy": "Virtuelle Kopie",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Rechtsklick → Fehlende Datei suchen…, um sie wiederzufinden.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Rechtsklick → Vom Datenträger neu laden, um es erneut zu versuchen."
|
||||
}
|
||||
|
||||
@@ -205,7 +205,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "Fotos similares: {n}{:.0} · Vista → Borrar filtros para ver todas",
|
||||
"Moved; {} photo(s) relinked": "Movida; {} foto(s) vinculada(s) de nuevo",
|
||||
"{} label (click more labels to show any of them)": "Etiqueta {} (hacer clic en más etiquetas para mostrar cualquiera de ellas)",
|
||||
", {} star{}": ", {} estrella{}",
|
||||
", {} label": ", etiqueta {}",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Se descarga desde {host}. Cuando llega y se comprueba, LightCraft lo instala y {after}.",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "{name} está instalado y en uso: el reconocimiento facial está activado",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "Importa fotos con Archivo › Importar fotos… ({keys}).",
|
||||
"View › Detail View ({keys}).": "Vista › Vista de detalle ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Archivo › Exportar… · Archivo › Imprimir… ({keys})."
|
||||
"File › Export… · File › Print… ({keys}).": "Archivo › Exportar… · Archivo › Imprimir… ({keys}).",
|
||||
", rating {} of 5": ", valoración: {} de 5"
|
||||
}
|
||||
|
||||
@@ -1760,7 +1760,8 @@
|
||||
"Watermark": "Marca de agua",
|
||||
"Wednesday": "Miércoles",
|
||||
"What's New": "Novedades",
|
||||
"When rated or hovered": "Al valorar o pasar el puntero",
|
||||
"Stars on hover": "Estrellas al pasar el puntero",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Estrellas al pasar el puntero: las marcas y las etiquetas de color se ven siempre; las estrellas y la marca de edición aparecen mientras una foto está bajo el puntero o seleccionada.",
|
||||
"White Balance": "Balance de blancos",
|
||||
"White Balance Selector": "Selector de balance de blancos",
|
||||
"White Balance Selector (W)": "Selector de balance de blancos (W)",
|
||||
@@ -2457,5 +2458,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Inicia la aplicación con --control 7980 (o LIGHTCRAFT_CONTROL_PORT), y lightcraft-cli mcp --connect conecta un agente a ella.",
|
||||
"Welcome": "Bienvenido",
|
||||
"Next": "Siguiente",
|
||||
"Get Started": "Empezar"
|
||||
"Get Started": "Empezar",
|
||||
"Stack — click to expand (S)": "Pila — clic para expandir (S)",
|
||||
"Stack — click to collapse (S)": "Pila — clic para contraer (S)",
|
||||
"Virtual copy": "Copia virtual",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Clic derecho → Localizar archivo que falta… para encontrarlo de nuevo.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Clic derecho → Recargar desde el disco para intentarlo de nuevo."
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
"+{} more": "+{} lisää",
|
||||
", {failed} file{} not readable": ", ei luettavissa olevia tiedostoja: {failed}{:.0}",
|
||||
", {} label": ", {} merkintä",
|
||||
", {} star{}": ", tähtiä {}{:.0}",
|
||||
"1 task is still running: {names}. Quitting stops it.": "1 tehtävä on yhä käynnissä: {names}. Lopettaminen pysäyttää sen.",
|
||||
"; {kept} already had a location": "; jo sijaintitiedolliset: {kept}",
|
||||
"; {n} gained synonyms": "; {n} sai synonyymejä",
|
||||
@@ -323,5 +322,6 @@
|
||||
"View › Detail View ({keys}).": "Näytä › Tarkastelunäkymä ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Tiedosto › Vie… · Tiedosto › Tulosta… ({keys}).",
|
||||
"{n} folder{} could not be read": "Kansiot, joita ei voitu lukea: {n}{:.0}",
|
||||
"{n} file{} skipped (not a supported photo type)": "Ohitetut tiedostot (ei tuettu valokuvatyyppi): {n}{:.0}"
|
||||
"{n} file{} skipped (not a supported photo type)": "Ohitetut tiedostot (ei tuettu valokuvatyyppi): {n}{:.0}",
|
||||
", rating {} of 5": ", luokitus: {} / 5"
|
||||
}
|
||||
|
||||
@@ -2193,7 +2193,6 @@
|
||||
"Wednesday": "keskiviikko",
|
||||
"What's New": "Mitä uutta",
|
||||
"When pins show on the photo (Shift+H cycles)": "Milloin nastat näkyvät kuvassa (Shift+H vaihtaa)",
|
||||
"When rated or hovered": "Luokiteltaessa tai osoitettaessa",
|
||||
"White Balance": "Valkotasapaino",
|
||||
"White Balance Selector": "Valkotasapainon valitsin",
|
||||
"White Balance Selector (W)": "Valkotasapainon valitsin (W)",
|
||||
@@ -2414,5 +2413,12 @@
|
||||
"Top bar": "Yläpalkki",
|
||||
"Tool strip": "Työkalupalkki",
|
||||
"Bottom bar": "Alapalkki",
|
||||
"Stopped at the scan limit: there may be more photos": "Skannauksen raja saavutettiin: valokuvia voi olla lisää"
|
||||
"Stopped at the scan limit: there may be more photos": "Skannauksen raja saavutettiin: valokuvia voi olla lisää",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Napsauta hiiren kakkospainikkeella → Paikanna puuttuva tiedosto… löytääksesi sen uudelleen.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Napsauta hiiren kakkospainikkeella → Lataa levyltä uudelleen yrittääksesi uudelleen.",
|
||||
"Stack — click to collapse (S)": "Pino — napsauta tiivistääksesi (S)",
|
||||
"Stack — click to expand (S)": "Pino — napsauta laajentaaksesi (S)",
|
||||
"Stars on hover": "Tähdet osoitettaessa",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Tähdet osoitettaessa: liput ja värimerkinnät näkyvät aina; tähdet ja muokattu-merkki näkyvät, kun kuvaa osoitetaan tai se on valittuna.",
|
||||
"Virtual copy": "Virtuaalikopio"
|
||||
}
|
||||
|
||||
@@ -205,7 +205,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "{n} photo{} similaire(s) · Affichage → Effacer les filtres pour tout voir",
|
||||
"Moved; {} photo(s) relinked": "Déplacé ; {} photo(s) de nouveau associée(s)",
|
||||
"{} label (click more labels to show any of them)": "Étiquette {} (cliquez sur « autres étiquettes » pour afficher celles de votre choix)",
|
||||
", {} star{}": ", {} étoile{}",
|
||||
", {} label": ", étiquette {}",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Téléchargement depuis {host}. Une fois le téléchargement terminé et vérifié, LightCraft l’installe, {after}.",
|
||||
"{:.1} MB": "{:.1} Mo",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "{name} est installé et utilisé : la reconnaissance des visages est activée",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "Importez des photos avec Fichier › Importer des photos… ({keys}).",
|
||||
"View › Detail View ({keys}).": "Affichage › Vue de détail ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Fichier › Exporter… · Fichier › Imprimer… ({keys})."
|
||||
"File › Export… · File › Print… ({keys}).": "Fichier › Exporter… · Fichier › Imprimer… ({keys}).",
|
||||
", rating {} of 5": ", note : {} sur 5"
|
||||
}
|
||||
|
||||
@@ -1580,7 +1580,8 @@
|
||||
"Watermark": "Filigrane",
|
||||
"Wednesday": "Mercredi",
|
||||
"What's New": "Nouveautés",
|
||||
"When rated or hovered": "Lors de la notation ou du survol",
|
||||
"Stars on hover": "Étoiles au survol",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Étoiles au survol : les drapeaux et les étiquettes de couleur sont toujours visibles ; les étoiles et la marque de retouche apparaissent quand une photo est survolée ou sélectionnée.",
|
||||
"White Balance": "Balance des blancs",
|
||||
"White Balance Selector": "Sélecteur de balance des blancs",
|
||||
"White Balance Selector (W)": "Sélecteur de balance des blancs (W)",
|
||||
@@ -3640,5 +3641,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Démarrez l'application avec --control 7980 (ou LIGHTCRAFT_CONTROL_PORT), puis lightcraft-cli mcp --connect y connecte un agent.",
|
||||
"Welcome": "Bienvenue",
|
||||
"Next": "Suivant",
|
||||
"Get Started": "Commencer"
|
||||
"Get Started": "Commencer",
|
||||
"Stack — click to expand (S)": "Pile — cliquer pour déplier (S)",
|
||||
"Stack — click to collapse (S)": "Pile — cliquer pour replier (S)",
|
||||
"Virtual copy": "Copie virtuelle",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Clic droit → Localiser le fichier manquant… pour le retrouver.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Clic droit → Recharger depuis le disque pour réessayer."
|
||||
}
|
||||
|
||||
@@ -206,7 +206,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "{n} foto serupa{:.0} · Tampilan → Hapus filter untuk melihat semua",
|
||||
"Moved; {} photo(s) relinked": "Dipindahkan; {} foto ditautkan ulang",
|
||||
"{} label (click more labels to show any of them)": "Label {} (klik label lain untuk ikut menampilkan foto berlabel tersebut)",
|
||||
", {} star{}": ", {} bintang{:.0}",
|
||||
", {} label": ", label {}",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Diunduh dari {host}. Setelah selesai diunduh dan lolos pemeriksaan, LightCraft akan menginstalnya, {after}.",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -326,5 +325,6 @@
|
||||
"View › Detail View ({keys}).": "Tampilan › Tampilan Detail ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "File › Ekspor… · File › Cetak… ({keys}).",
|
||||
"{n} folder{} could not be read": "Folder yang tidak bisa dibaca: {n}{:.0}",
|
||||
"{n} file{} skipped (not a supported photo type)": "File yang dilewati (bukan jenis foto yang didukung): {n}{:.0}"
|
||||
"{n} file{} skipped (not a supported photo type)": "File yang dilewati (bukan jenis foto yang didukung): {n}{:.0}",
|
||||
", rating {} of 5": ", rating: {} dari 5"
|
||||
}
|
||||
|
||||
@@ -2186,7 +2186,6 @@
|
||||
"We": "Rb",
|
||||
"Wednesday": "Rabu",
|
||||
"What's New": "Yang baru",
|
||||
"When rated or hovered": "Saat diberi rating atau saat kursor di atasnya",
|
||||
"White Balance": "Keseimbangan putih",
|
||||
"White Balance Selector": "Pemilih keseimbangan putih",
|
||||
"White Balance Selector (W)": "Pemilih keseimbangan putih (W)",
|
||||
@@ -2428,5 +2427,12 @@
|
||||
"Top bar": "Bilah atas",
|
||||
"Tool strip": "Bilah alat",
|
||||
"Bottom bar": "Bilah bawah",
|
||||
"Stopped at the scan limit: there may be more photos": "Berhenti pada batas pemindaian: mungkin masih ada foto"
|
||||
"Stopped at the scan limit: there may be more photos": "Berhenti pada batas pemindaian: mungkin masih ada foto",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Klik kanan → Temukan file hilang… untuk menemukannya lagi.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Klik kanan → Muat ulang dari disk untuk mencoba lagi.",
|
||||
"Stack — click to collapse (S)": "Tumpukan — klik untuk menciutkan (S)",
|
||||
"Stack — click to expand (S)": "Tumpukan — klik untuk meluaskan (S)",
|
||||
"Stars on hover": "Bintang saat kursor di atas",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Bintang saat kursor di atas: bendera dan label warna selalu tampil; bintang dan tanda telah diedit muncul saat kursor berada di atas foto atau foto dipilih.",
|
||||
"Virtual copy": "Salinan virtual"
|
||||
}
|
||||
|
||||
@@ -199,7 +199,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "Foto simili: {n}{:.0} · Visualizza → Cancella filtri per vederle tutte",
|
||||
"Moved; {} photo(s) relinked": "Spostata; foto ricollegate: {}",
|
||||
"{} label (click more labels to show any of them)": "Etichetta {} (fai clic su altre etichette per mostrarne una qualsiasi)",
|
||||
", {} star{}": ", stelle: {}{:.0}",
|
||||
", {} label": ", etichetta {}",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Scaricato da {host}. Quando è arrivato ed è stato verificato, LightCraft lo installa e {after}.",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -326,5 +325,6 @@
|
||||
"View › Detail View ({keys}).": "Visualizza › Vista dettaglio ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "File › Esporta… · File › Stampa… ({keys}).",
|
||||
"{n} folder{} could not be read": "Cartelle non leggibili: {n}{:.0}",
|
||||
"{n} file{} skipped (not a supported photo type)": "File saltati (non è un tipo di foto supportato): {n}{:.0}"
|
||||
"{n} file{} skipped (not a supported photo type)": "File saltati (non è un tipo di foto supportato): {n}{:.0}",
|
||||
", rating {} of 5": ", valutazione: {} su 5"
|
||||
}
|
||||
|
||||
@@ -1611,7 +1611,8 @@
|
||||
"Watermark": "Filigrana",
|
||||
"Wednesday": "Mercoledì",
|
||||
"What's New": "Novità",
|
||||
"When rated or hovered": "Quando ha una valutazione o è sotto il puntatore",
|
||||
"Stars on hover": "Stelle al passaggio",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Stelle al passaggio: i contrassegni e le etichette colore sono sempre visibili; le stelle e il segno di modifica compaiono quando la foto è sotto il puntatore o selezionata.",
|
||||
"White Balance": "Bilanciamento del bianco",
|
||||
"White Balance Selector": "Selettore del bilanciamento del bianco",
|
||||
"White Balance Selector (W)": "Selettore del bilanciamento del bianco (W)",
|
||||
@@ -2621,5 +2622,10 @@
|
||||
"Welcome": "Benvenuto",
|
||||
"Next": "Avanti",
|
||||
"Get Started": "Inizia",
|
||||
"Stopped at the scan limit: there may be more photos": "Fermati al limite di scansione: potrebbero esserci altre foto"
|
||||
"Stopped at the scan limit: there may be more photos": "Fermati al limite di scansione: potrebbero esserci altre foto",
|
||||
"Stack — click to expand (S)": "Pila — clic per espandere (S)",
|
||||
"Stack — click to collapse (S)": "Pila — clic per comprimere (S)",
|
||||
"Virtual copy": "Copia virtuale",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Clic destro → Trova file mancante… per ritrovarlo.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Clic destro → Ricarica dal disco per riprovare."
|
||||
}
|
||||
|
||||
@@ -209,7 +209,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "似た写真{n}枚{:.0}・すべて表示するには「表示 → フィルターを解除」",
|
||||
"Moved; {} photo(s) relinked": "移動しました。{}枚の写真の参照先を更新しました",
|
||||
"{} label (click more labels to show any of them)": "{}ラベル(ほかのラベルもクリックすると、いずれかに一致する写真を表示)",
|
||||
", {} star{}": "、星{}つ{:.0}",
|
||||
", {} label": "、{}ラベル",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "{host} からダウンロードします。届いて確認が済むと、LightCraft がインストールし、{after}。",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "{name} をインストールして使用中です:顔認識はオンです",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "ファイル › 写真を読み込む… ({keys}) で写真を読み込みます。",
|
||||
"View › Detail View ({keys}).": "表示 › 詳細表示 ({keys})。",
|
||||
"File › Export… · File › Print… ({keys}).": "ファイル › 書き出す… · ファイル › 印刷… ({keys})。"
|
||||
"File › Export… · File › Print… ({keys}).": "ファイル › 書き出す… · ファイル › 印刷… ({keys})。",
|
||||
", rating {} of 5": "、評価: 5段階中{}"
|
||||
}
|
||||
|
||||
@@ -1507,7 +1507,8 @@
|
||||
"Watched folder": "監視フォルダ",
|
||||
"Watermark": "透かし",
|
||||
"What's New": "新着情報",
|
||||
"When rated or hovered": "評価時またはカーソルを合わせたとき",
|
||||
"Stars on hover": "星はカーソルを合わせたとき",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "星はカーソルを合わせたとき:フラグとカラーラベルは常に表示され、星と編集済みマークは写真にカーソルを合わせたか選択したときに表示されます。",
|
||||
"White Balance": "ホワイトバランス",
|
||||
"White Balance Selector": "ホワイトバランス選択",
|
||||
"White Balance Selector (W)": "ホワイトバランス選択(W)",
|
||||
@@ -2455,5 +2456,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "アプリを --control 7980 (または LIGHTCRAFT_CONTROL_PORT) で起動してから、lightcraft-cli mcp --connect でエージェントを接続できます。",
|
||||
"Welcome": "ようこそ",
|
||||
"Next": "次へ",
|
||||
"Get Started": "始める"
|
||||
"Get Started": "始める",
|
||||
"Stack — click to expand (S)": "スタック — クリックして展開 (S)",
|
||||
"Stack — click to collapse (S)": "スタック — クリックして折りたたむ (S)",
|
||||
"Virtual copy": "仮想コピー",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "右クリック → 見つからないファイルを指定… で、ファイルをもう一度指定できます。",
|
||||
"Right-click ▸ Reload from Disk to try again.": "右クリック → ディスクから再読み込み で、もう一度試せます。"
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
"+{} more": "+ კიდევ {}",
|
||||
", {failed} file{} not readable": ", ვერ იკითხება ფაილი: {failed}{:.0}",
|
||||
", {} label": ", იარლიყი: {}",
|
||||
", {} star{}": ", ვარსკვლავი: {}{:.0}",
|
||||
"1 task is still running: {names}. Quitting stops it.": "ჯერ კიდევ მიმდინარეობს 1 ამოცანა: {names}. გასვლა მას შეწყვეტს.",
|
||||
"; {kept} already had a location": "; მდებარეობა უკვე ჰქონდა: {kept}",
|
||||
"; {n} gained synonyms": "; სინონიმები დაემატა: {n}",
|
||||
@@ -329,5 +328,6 @@
|
||||
"View › Detail View ({keys}).": "ხედი › დეტალური ხედი ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "ფაილი › ექსპორტი… · ფაილი › დაბეჭდვა… ({keys}).",
|
||||
"{n} folder{} could not be read": "საქაღალდეები, რომლებიც ვერ წაიკითხა: {n}{:.0}",
|
||||
"{n} file{} skipped (not a supported photo type)": "გამოტოვებული ფაილები (მხარდაუჭერელი ფოტოს ტიპია): {n}{:.0}"
|
||||
"{n} file{} skipped (not a supported photo type)": "გამოტოვებული ფაილები (მხარდაუჭერელი ფოტოს ტიპია): {n}{:.0}",
|
||||
", rating {} of 5": ", შეფასება: {} 5-დან"
|
||||
}
|
||||
|
||||
@@ -2283,7 +2283,8 @@
|
||||
"What's New": "რა არის ახალი",
|
||||
"When GPU rendering is on but no graphics processor can be found, LightCraft now says so once at start-up instead": "როცა GPU რენდერი ჩართულია, მაგრამ გრაფიკული პროცესორი ვერ მოიძებნა, LightCraft ახლა ამას გაშვებისას ერთხელ გეუბნებათ, ნაცვლად იმისა,",
|
||||
"When a folder holds several file types, the Import Photos review has a toggle per type (`ARW · 120`, `JPG · 120`):": "როცა საქაღალდეში რამდენიმე ტიპის ფაილია, ფოტოების იმპორტის მიმოხილვას თითო ტიპზე გადამრთველი აქვს (`ARW · 120`, `JPG · 120`):",
|
||||
"When rated or hovered": "შეფასებისას ან კურსორის მიტანისას",
|
||||
"Stars on hover": "ვარსკვლავები კურსორის მიტანისას",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "ვარსკვლავები კურსორის მიტანისას: დროშები და ფერადი ჭდეები ყოველთვის ჩანს; ვარსკვლავები და რედაქტირების ნიშანი ჩნდება, როცა ფოტო კურსორის ქვეშაა ან მონიშნულია.",
|
||||
"White Balance": "თეთრის ბალანსი",
|
||||
"White Balance Selector": "თეთრის ბალანსის ამრჩევი",
|
||||
"White Balance Selector (W)": "თეთრის ბალანსის ამრჩევი (W)",
|
||||
@@ -3723,5 +3724,10 @@
|
||||
"Tool strip": "ხელსაწყოების ზოლი",
|
||||
"Bottom bar": "ქვედა ზოლი",
|
||||
"Prevent G-SYNC/FreeSync flicker (applies at next launch)": "G-SYNC/FreeSync-ის ციმციმის თავიდან აცილება (ამოქმედდება შემდეგი გაშვებისას)",
|
||||
"Stopped at the scan limit: there may be more photos": "სკანირების ლიმიტზე გაჩერდა: შესაძლოა სხვა ფოტოებიც არის"
|
||||
"Stopped at the scan limit: there may be more photos": "სკანირების ლიმიტზე გაჩერდა: შესაძლოა სხვა ფოტოებიც არის",
|
||||
"Stack — click to expand (S)": "დასტა — დააწკაპუნეთ გასაშლელად (S)",
|
||||
"Stack — click to collapse (S)": "დასტა — დააწკაპუნეთ ჩასაკეცად (S)",
|
||||
"Virtual copy": "ვირტუალური ასლი",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "მარჯვენა დაწკაპუნება → დაკარგული ფაილის მოძებნა… ფაილის ხელახლა საპოვნელად.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "მარჯვენა დაწკაპუნება → დისკიდან ხელახლა ჩატვირთვა, ხელახლა საცდელად."
|
||||
}
|
||||
|
||||
@@ -190,7 +190,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "Podobne zdjęcia: {n}{:.0} · Widok → Wyczyść filtry, aby zobaczyć wszystkie",
|
||||
"Moved; {} photo(s) relinked": "Przeniesiono; ponownie powiązane zdjęcia: {}",
|
||||
"{} label (click more labels to show any of them)": "{} etykieta (kliknij kolejne etykiety, aby wyświetlić dowolną z nich)",
|
||||
", {} star{}": ", gwiazdki: {}{:.0}",
|
||||
", {} label": ", {} etykieta",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Pobieranie z {host}. Po pobraniu i weryfikacji LightCraft zainstaluje plik, {after}.",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -326,5 +325,6 @@
|
||||
"View › Detail View ({keys}).": "Widok › Widok szczegółów ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Plik › Eksportuj… · Plik › Drukuj… ({keys}).",
|
||||
"{n} folder{} could not be read": "Nie udało się odczytać folderów: {n}{:.0}",
|
||||
"{n} file{} skipped (not a supported photo type)": "Pominięte pliki (nieobsługiwany typ zdjęcia): {n}{:.0}"
|
||||
"{n} file{} skipped (not a supported photo type)": "Pominięte pliki (nieobsługiwany typ zdjęcia): {n}{:.0}",
|
||||
", rating {} of 5": ", ocena: {} na 5"
|
||||
}
|
||||
|
||||
@@ -1545,7 +1545,8 @@
|
||||
"Watermark": "Znak wodny",
|
||||
"Wednesday": "Środa",
|
||||
"What's New": "Co nowego",
|
||||
"When rated or hovered": "Po ocenieniu lub wskazaniu kursorem",
|
||||
"Stars on hover": "Gwiazdki po wskazaniu",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Gwiazdki po wskazaniu: flagi i kolorowe etykiety są widoczne zawsze; gwiazdki i znak edycji pojawiają się, gdy zdjęcie jest wskazane kursorem lub zaznaczone.",
|
||||
"White Balance": "Balans bieli",
|
||||
"White Balance Selector": "Próbnik balansu bieli",
|
||||
"White Balance Selector (W)": "Próbnik balansu bieli (W)",
|
||||
@@ -2380,5 +2381,10 @@
|
||||
"Welcome": "Witamy",
|
||||
"Next": "Dalej",
|
||||
"Get Started": "Zaczynamy",
|
||||
"Stopped at the scan limit: there may be more photos": "Zatrzymano na limicie skanowania: możliwe, że jest więcej zdjęć"
|
||||
"Stopped at the scan limit: there may be more photos": "Zatrzymano na limicie skanowania: możliwe, że jest więcej zdjęć",
|
||||
"Stack — click to expand (S)": "Stos — kliknij, aby rozwinąć (S)",
|
||||
"Stack — click to collapse (S)": "Stos — kliknij, aby zwinąć (S)",
|
||||
"Virtual copy": "Kopia wirtualna",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Kliknij prawym przyciskiem → Znajdź brakujący plik…, aby go odnaleźć ponownie.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Kliknij prawym przyciskiem → Wczytaj ponownie z dysku, aby spróbować jeszcze raz."
|
||||
}
|
||||
|
||||
@@ -209,7 +209,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "{n} foto{0} semelhante{0} · Exibir → Limpar filtros para ver todas",
|
||||
"Moved; {} photo(s) relinked": "Movida; {} foto(s) vinculada(s) novamente",
|
||||
"{} label (click more labels to show any of them)": "Rótulo {} (clique em mais rótulos para mostrar qualquer um deles)",
|
||||
", {} star{}": ", {} estrela{}",
|
||||
", {} label": ", rótulo {}",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Faz o download de {host}. Depois que chegar e for verificado, o LightCraft o instala e {after}.",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "{name} está instalado e em uso: o reconhecimento facial está ativado",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "Traga fotos com Arquivo › Importar fotos… ({keys}).",
|
||||
"View › Detail View ({keys}).": "Exibir › Exibição de detalhe ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Arquivo › Exportar… · Arquivo › Imprimir… ({keys})."
|
||||
"File › Export… · File › Print… ({keys}).": "Arquivo › Exportar… · Arquivo › Imprimir… ({keys}).",
|
||||
", rating {} of 5": ", avaliação: {} de 5"
|
||||
}
|
||||
|
||||
@@ -1604,7 +1604,8 @@
|
||||
"Watermark": "Marca d'água",
|
||||
"Wednesday": "Quarta-feira",
|
||||
"What's New": "Novidades",
|
||||
"When rated or hovered": "Ao avaliar ou passar o mouse",
|
||||
"Stars on hover": "Estrelas ao passar o mouse",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Estrelas ao passar o mouse: sinalizadores e etiquetas de cor sempre aparecem; as estrelas e a marca de edição aparecem enquanto a foto está sob o mouse ou selecionada.",
|
||||
"White Balance": "Balanço de branco",
|
||||
"White Balance Selector": "Seletor de balanço de branco",
|
||||
"White Balance Selector (W)": "Seletor de balanço de branco (W)",
|
||||
@@ -2301,5 +2302,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Inicie o aplicativo com --control 7980 (ou LIGHTCRAFT_CONTROL_PORT) e o lightcraft-cli mcp --connect conecta um agente a ele.",
|
||||
"Welcome": "Bem-vindo",
|
||||
"Next": "Próximo",
|
||||
"Get Started": "Começar"
|
||||
"Get Started": "Começar",
|
||||
"Stack — click to expand (S)": "Pilha — clique para expandir (S)",
|
||||
"Stack — click to collapse (S)": "Pilha — clique para recolher (S)",
|
||||
"Virtual copy": "Cópia virtual",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Clique com o botão direito → Localizar arquivo ausente… para encontrá-lo de novo.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Clique com o botão direito → Recarregar do disco para tentar de novo."
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
"+{} more": "+{} ещё",
|
||||
", {failed} file{} not readable": ", не читается файлов: {failed}{:.0}",
|
||||
", {} label": ", метка: {}",
|
||||
", {} star{}": ", звёзд: {}{:.0}",
|
||||
"; {kept} already had a location": "; уже имели местоположение: {kept}",
|
||||
"; {outside} outside its time range": "; вне временного диапазона трека: {outside}",
|
||||
"@{}: {} PRs, {} commits, +{} / −{} lines (Δ {}), +{} / −{} binary assets, {} – {}": "@{}: PR: {}, коммитов: {}, строк: +{} / −{} (Δ {}), бинарных файлов: +{} / −{}, {} – {}",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "Модель {name} установлена и используется: распознавание лиц включено",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "Фотографии добавляются через Файл › Импорт фото… ({keys}).",
|
||||
"View › Detail View ({keys}).": "Вид › Режим детализации ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Файл › Экспорт… · Файл › Печать… ({keys})."
|
||||
"File › Export… · File › Print… ({keys}).": "Файл › Экспорт… · Файл › Печать… ({keys}).",
|
||||
", rating {} of 5": ", оценка: {} из 5"
|
||||
}
|
||||
|
||||
@@ -1560,7 +1560,8 @@
|
||||
"Watermark": "Водяной знак",
|
||||
"Wednesday": "Среда",
|
||||
"What's New": "Что нового",
|
||||
"When rated or hovered": "При оценке или наведении",
|
||||
"Stars on hover": "Звёзды при наведении",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Звёзды при наведении: флаги и цветные метки видны всегда; звёзды и значок правки появляются, пока фото под курсором или выбрано.",
|
||||
"White Balance": "Баланс белого",
|
||||
"White Balance Selector": "Пипетка баланса белого",
|
||||
"White Balance Selector (W)": "Пипетка баланса белого (W)",
|
||||
@@ -2663,5 +2664,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Запустите приложение с --control 7980 (или LIGHTCRAFT_CONTROL_PORT), и команда lightcraft-cli mcp --connect подключит к нему одного агента.",
|
||||
"Welcome": "Добро пожаловать",
|
||||
"Next": "Далее",
|
||||
"Get Started": "Начать"
|
||||
"Get Started": "Начать",
|
||||
"Stack — click to expand (S)": "Стопка — щёлкните, чтобы развернуть (S)",
|
||||
"Stack — click to collapse (S)": "Стопка — щёлкните, чтобы свернуть (S)",
|
||||
"Virtual copy": "Виртуальная копия",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Щёлкните правой кнопкой → Указать отсутствующий файл…, чтобы найти его снова.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Щёлкните правой кнопкой → Перезагрузить с диска, чтобы повторить попытку."
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
"+{} more": "+{} till",
|
||||
", {failed} file{} not readable": ", {failed} fil{} kunde inte läsas",
|
||||
", {} label": ", {} etikett",
|
||||
", {} star{}": ", {} stjärna{}",
|
||||
"1 task is still running: {names}. Quitting stops it.": "1 uppgift körs fortfarande: {names}. Om du avslutar stoppas den.",
|
||||
"; {kept} already had a location": "; {kept} hade redan en plats",
|
||||
"; {n} gained synonyms": "; {n} fick synonymer",
|
||||
@@ -326,5 +325,6 @@
|
||||
"View › Detail View ({keys}).": "Visa › Detaljvy ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Fil › Exportera… · Fil › Skriv ut… ({keys}).",
|
||||
"{n} folder{} could not be read": "Mappar som inte gick att läsa: {n}{:.0}",
|
||||
"{n} file{} skipped (not a supported photo type)": "Hoppade över filer (fotoformat som inte stöds): {n}{:.0}"
|
||||
"{n} file{} skipped (not a supported photo type)": "Hoppade över filer (fotoformat som inte stöds): {n}{:.0}",
|
||||
", rating {} of 5": ", betyg: {} av 5"
|
||||
}
|
||||
|
||||
@@ -2380,7 +2380,6 @@
|
||||
"were missing, without touching anything already set.": "saknades, utan att röra något som redan var angivet.",
|
||||
"What's New": "Nyheter",
|
||||
"When pins show on the photo (Shift+H cycles)": "När nålar visas på fotot (Shift+H växlar)",
|
||||
"When rated or hovered": "När det har betyg eller pekaren är över",
|
||||
"when the browser may evict the library. Hosting: the sample cache headers no longer mark the (unhashed) files": "när webbläsaren kan rensa bort biblioteket. Webbhotell: exemplets cache-huvuden markerar inte längre de (ohashade) filerna",
|
||||
"whether originals are there is checked on a worker thread (grid thumbnails, the Info panel, the photo menu, Missing": "om originalen finns kontrolleras i en arbetstråd (rutnätsminiatyrer, panelen Info, fotomenyn, Saknas",
|
||||
"White Balance": "Vitbalans",
|
||||
@@ -2518,5 +2517,12 @@
|
||||
"Top bar": "Övre fältet",
|
||||
"Tool strip": "Verktygsfält",
|
||||
"Bottom bar": "Nedre fältet",
|
||||
"Stopped at the scan limit: there may be more photos": "Stoppade vid skanningsgränsen: det kan finnas fler foton"
|
||||
"Stopped at the scan limit: there may be more photos": "Stoppade vid skanningsgränsen: det kan finnas fler foton",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Högerklicka → Leta upp saknad fil… för att hitta den igen.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Högerklicka → Läs in igen från disk för att försöka igen.",
|
||||
"Stack — click to collapse (S)": "Stapel — klicka för att komprimera (S)",
|
||||
"Stack — click to expand (S)": "Stapel — klicka för att expandera (S)",
|
||||
"Stars on hover": "Stjärnor vid pekaren",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Stjärnor vid pekaren: flaggor och färgetiketter visas alltid; stjärnorna och märket för redigerad visas när pekaren är över ett foto eller när det är markerat.",
|
||||
"Virtual copy": "Virtuell kopia"
|
||||
}
|
||||
|
||||
@@ -205,7 +205,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "Подібних фото: {n}{:.0} · Вигляд → Скинути фільтри, щоб побачити всі",
|
||||
"Moved; {} photo(s) relinked": "Переміщено; повторно пов’язано фото: {}",
|
||||
"{} label (click more labels to show any of them)": "Мітка «{}» (клацніть інші мітки, щоб показати фото з будь-якою з них)",
|
||||
", {} star{}": ", зірок: {}{:.0}",
|
||||
", {} label": ", мітка: {}",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Завантажується з {host}. Після отримання й перевірки LightCraft установлює модель, {after}.",
|
||||
"{:.1} MB": "{:.1} МБ",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "{name} установлено й використовується: розпізнавання облич увімкнено",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "Фотографії імпортуйте через Файл › Імпортувати фото… ({keys}).",
|
||||
"View › Detail View ({keys}).": "Вигляд › Детальне подання ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Файл › Експортувати… · Файл › Друк… ({keys})."
|
||||
"File › Export… · File › Print… ({keys}).": "Файл › Експортувати… · Файл › Друк… ({keys}).",
|
||||
", rating {} of 5": ", оцінка: {} з 5"
|
||||
}
|
||||
|
||||
@@ -1537,7 +1537,8 @@
|
||||
"Watched folder": "Відстежувана тека",
|
||||
"Watermark": "Водяний знак",
|
||||
"What's New": "Що нового",
|
||||
"When rated or hovered": "Після оцінювання або наведення",
|
||||
"Stars on hover": "Зірки при наведенні",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Зірки при наведенні: прапорці й кольорові мітки видно завжди; зірки та позначка редагування з’являються, поки фото під курсором або вибране.",
|
||||
"White Balance": "Баланс білого",
|
||||
"White Balance Selector": "Вибір балансу білого",
|
||||
"White Balance Selector (W)": "Вибір балансу білого (W)",
|
||||
@@ -2453,5 +2454,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "Запустіть програму з --control 7980 (або LIGHTCRAFT_CONTROL_PORT), і lightcraft-cli mcp --connect під'єднає до неї одного агента.",
|
||||
"Welcome": "Ласкаво просимо",
|
||||
"Next": "Далі",
|
||||
"Get Started": "Почати"
|
||||
"Get Started": "Почати",
|
||||
"Stack — click to expand (S)": "Стос — клацніть, щоб розгорнути (S)",
|
||||
"Stack — click to collapse (S)": "Стос — клацніть, щоб згорнути (S)",
|
||||
"Virtual copy": "Віртуальна копія",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Клацніть правою кнопкою → Знайти відсутній файл…, щоб знайти його знову.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Клацніть правою кнопкою → Перезавантажити з диска, щоб спробувати ще раз."
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
"+{} more": "+{} nữa",
|
||||
", {failed} file{} not readable": ", {failed} tệp{:.0} không đọc được",
|
||||
", {} label": ", nhãn {}",
|
||||
", {} star{}": ", {} sao{:.0}",
|
||||
"1 task is still running: {names}. Quitting stops it.": "Còn 1 tác vụ đang chạy: {names}. Thoát sẽ dừng tác vụ.",
|
||||
"; {kept} already had a location": "; {kept} đã có vị trí",
|
||||
"; {n} gained synonyms": "; {n} có thêm từ đồng nghĩa",
|
||||
@@ -323,5 +322,6 @@
|
||||
"View › Detail View ({keys}).": "Xem › Chế độ xem chi tiết ({keys}).",
|
||||
"File › Export… · File › Print… ({keys}).": "Tệp › Xuất… · Tệp › In… ({keys}).",
|
||||
"{n} folder{} could not be read": "Thư mục không đọc được: {n}{:.0}",
|
||||
"{n} file{} skipped (not a supported photo type)": "Đã bỏ qua tệp (không phải loại ảnh được hỗ trợ): {n}{:.0}"
|
||||
"{n} file{} skipped (not a supported photo type)": "Đã bỏ qua tệp (không phải loại ảnh được hỗ trợ): {n}{:.0}",
|
||||
", rating {} of 5": ", xếp hạng: {} trên 5"
|
||||
}
|
||||
|
||||
@@ -2003,7 +2003,6 @@
|
||||
"We": "T4",
|
||||
"Wednesday": "Thứ Tư",
|
||||
"What's New": "Có gì mới",
|
||||
"When rated or hovered": "Khi đã xếp hạng hoặc rê chuột",
|
||||
"White Balance": "Cân bằng trắng",
|
||||
"White Balance Selector": "Bộ chọn cân bằng trắng",
|
||||
"White Balance Selector (W)": "Bộ chọn cân bằng trắng (W)",
|
||||
@@ -2742,5 +2741,12 @@
|
||||
"Top bar": "Thanh trên cùng",
|
||||
"Tool strip": "Thanh công cụ",
|
||||
"Bottom bar": "Thanh dưới cùng",
|
||||
"Stopped at the scan limit: there may be more photos": "Đã dừng ở giới hạn quét: có thể còn ảnh khác"
|
||||
"Stopped at the scan limit: there may be more photos": "Đã dừng ở giới hạn quét: có thể còn ảnh khác",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "Nhấp chuột phải → Định vị tệp bị thiếu… để tìm lại.",
|
||||
"Right-click ▸ Reload from Disk to try again.": "Nhấp chuột phải → Tải lại từ đĩa để thử lại.",
|
||||
"Stack — click to collapse (S)": "Chồng — nhấp để thu gọn (S)",
|
||||
"Stack — click to expand (S)": "Chồng — nhấp để mở rộng (S)",
|
||||
"Stars on hover": "Sao khi rê chuột",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "Sao khi rê chuột: cờ và nhãn màu luôn hiển thị; sao và dấu đã chỉnh sửa xuất hiện khi ảnh được rê chuột qua hoặc được chọn.",
|
||||
"Virtual copy": "Bản sao ảo"
|
||||
}
|
||||
|
||||
@@ -209,7 +209,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "{n} 张相似照片{0:.0} · 选择“视图 → 清除过滤器”可查看全部",
|
||||
"Moved; {} photo(s) relinked": "已移动;已重新链接 {0} 张照片",
|
||||
"{} label (click more labels to show any of them)": "{0}标签(单击更多标签可显示符合其中任一标签的照片)",
|
||||
", {} star{}": ",{0} 星{1:.0}",
|
||||
", {} label": ",{0}标签",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "从 {host} 下载。下载完成并通过校验后,LightCraft 会进行安装,{after}。",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "{name} 已安装并在使用:人脸识别已开启",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "通过 文件 › 导入照片… ({keys}) 导入照片。",
|
||||
"View › Detail View ({keys}).": "视图 › 详细视图 ({keys})。",
|
||||
"File › Export… · File › Print… ({keys}).": "文件 › 导出… · 文件 › 打印… ({keys})。"
|
||||
"File › Export… · File › Print… ({keys}).": "文件 › 导出… · 文件 › 打印… ({keys})。",
|
||||
", rating {} of 5": ",评分:{}/5"
|
||||
}
|
||||
|
||||
@@ -1580,7 +1580,8 @@
|
||||
"Watermark": "水印",
|
||||
"Wednesday": "星期三",
|
||||
"What's New": "新功能",
|
||||
"When rated or hovered": "评级或悬停时",
|
||||
"Stars on hover": "悬停时显示星级",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "悬停时显示星级:旗标和颜色标签始终显示;星级和已编辑标记在照片被悬停或选中时显示。",
|
||||
"White Balance": "白平衡",
|
||||
"White Balance Selector": "白平衡选择器",
|
||||
"White Balance Selector (W)": "白平衡选择器 (W)",
|
||||
@@ -2456,5 +2457,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "先以 --control 7980 (或 LIGHTCRAFT_CONTROL_PORT) 启动应用,lightcraft-cli mcp --connect 即可将一个智能体接入其中。",
|
||||
"Welcome": "欢迎",
|
||||
"Next": "下一步",
|
||||
"Get Started": "开始使用"
|
||||
"Get Started": "开始使用",
|
||||
"Stack — click to expand (S)": "堆叠 — 单击展开 (S)",
|
||||
"Stack — click to collapse (S)": "堆叠 — 单击折叠 (S)",
|
||||
"Virtual copy": "虚拟副本",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "右键单击 → 定位缺失的文件…,即可重新找到它。",
|
||||
"Right-click ▸ Reload from Disk to try again.": "右键单击 → 从磁盘重新读取,即可重试。"
|
||||
}
|
||||
|
||||
@@ -209,7 +209,6 @@
|
||||
"{n} similar photo{} · View ▸ Clear Filters to see all": "{n} 張相似照片{:.0} · 選擇「檢視 → 清除篩選條件」可查看全部",
|
||||
"Moved; {} photo(s) relinked": "已移動;已重新連結 {} 張照片",
|
||||
"{} label (click more labels to show any of them)": "{}標籤(點擊更多標籤可顯示符合其中任一標籤的照片)",
|
||||
", {} star{}": ",{} 顆星{:.0}",
|
||||
", {} label": ",{}標籤",
|
||||
"Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.": "Downloads from {host}. Once it has arrived and checked out, LightCraft installs it, {after}.",
|
||||
"{:.1} MB": "{:.1} MB",
|
||||
@@ -327,5 +326,6 @@
|
||||
"{name} is installed and in use: face recognition is on": "{name} 已安裝並在使用中:臉部辨識已開啟",
|
||||
"Bring photos in with File › Import Photos… ({keys}).": "透過 檔案 › 匯入照片… ({keys}) 匯入照片。",
|
||||
"View › Detail View ({keys}).": "檢視 › 詳細檢視 ({keys})。",
|
||||
"File › Export… · File › Print… ({keys}).": "檔案 › 匯出… · 檔案 › 列印… ({keys})。"
|
||||
"File › Export… · File › Print… ({keys}).": "檔案 › 匯出… · 檔案 › 列印… ({keys})。",
|
||||
", rating {} of 5": ",評分:{}/5"
|
||||
}
|
||||
|
||||
@@ -1586,7 +1586,8 @@
|
||||
"Watermark": "浮水印",
|
||||
"Wednesday": "星期三",
|
||||
"What's New": "新增功能",
|
||||
"When rated or hovered": "評分或游標停留時",
|
||||
"Stars on hover": "游標停留時顯示星級",
|
||||
"Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.": "游標停留時顯示星級:旗標和顏色標籤一律顯示;星級和已編輯標記在照片被游標停留或選取時顯示。",
|
||||
"White Balance": "白平衡",
|
||||
"White Balance Selector": "白平衡選取器",
|
||||
"White Balance Selector (W)": "白平衡選取器(W)",
|
||||
@@ -2457,5 +2458,10 @@
|
||||
"Start the app with --control 7980 (or LIGHTCRAFT_CONTROL_PORT), then lightcraft-cli mcp --connect attaches one to it.": "先以 --control 7980 (或 LIGHTCRAFT_CONTROL_PORT) 啟動應用程式,lightcraft-cli mcp --connect 即可將一個代理程式連接到其中。",
|
||||
"Welcome": "歡迎",
|
||||
"Next": "下一步",
|
||||
"Get Started": "開始使用"
|
||||
"Get Started": "開始使用",
|
||||
"Stack — click to expand (S)": "堆疊 — 按一下以展開 (S)",
|
||||
"Stack — click to collapse (S)": "堆疊 — 按一下以收合 (S)",
|
||||
"Virtual copy": "虛擬副本",
|
||||
"Right-click ▸ Locate Missing File… to find it again.": "按右鍵 → 尋找遺失的檔案…,即可重新找到它。",
|
||||
"Right-click ▸ Reload from Disk to try again.": "按右鍵 → 從磁碟重新載入,即可重試。"
|
||||
}
|
||||
|
||||
@@ -86,10 +86,11 @@ pub(super) fn interface_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Toke
|
||||
choices(
|
||||
ui,
|
||||
"settingsGridBadges",
|
||||
&[(GridBadges::Auto, "When rated or hovered"), (GridBadges::Always, "Always"), (GridBadges::Never, "Never")],
|
||||
&[(GridBadges::Auto, "Stars on hover"), (GridBadges::Always, "Always"), (GridBadges::Never, "Never")],
|
||||
&mut app.ui.settings.grid_badges,
|
||||
);
|
||||
});
|
||||
hint(ui, t, "Stars on hover: flags and colour labels always show; the stars and the edited mark appear while a photo is hovered or selected.");
|
||||
check(ui, "settings.showFilenames", &mut app.ui.show_filenames, "Square Grid: show file names and formats");
|
||||
heading(ui, t, crate::i18n::tr("Keywords"));
|
||||
row(ui, t, crate::i18n::tr("Keywords of the selection"), |ui| {
|
||||
|
||||
@@ -106,6 +106,10 @@ pub enum Icon {
|
||||
Sun,
|
||||
/// Appearance Mode ▸ Dark: a crescent moon.
|
||||
Moon,
|
||||
/// A render failed: a triangle with an exclamation mark.
|
||||
Warning,
|
||||
/// A virtual copy: a page with a folded corner.
|
||||
VirtualCopy,
|
||||
}
|
||||
|
||||
struct Pen<'a> {
|
||||
@@ -347,6 +351,16 @@ fn paint_with(p: &Painter, rect: Rect, icon: Icon, color: Color32, turn: Option<
|
||||
pen.line(&[(10.0, 9.0), (10.0, 14.0)]);
|
||||
pen.dot(10.0, 6.3, 0.9);
|
||||
}
|
||||
Warning => {
|
||||
pen.closed(&[(10.0, 3.0), (17.5, 16.5), (2.5, 16.5)]);
|
||||
pen.line(&[(10.0, 8.0), (10.0, 11.8)]);
|
||||
pen.dot(10.0, 14.1, 0.9);
|
||||
}
|
||||
VirtualCopy => {
|
||||
// a page whose top right corner is folded down
|
||||
pen.line(&[(11.0, 3.0), (5.0, 3.0), (5.0, 17.0), (15.0, 17.0), (15.0, 7.0)]);
|
||||
pen.line(&[(11.0, 3.0), (15.0, 7.0), (11.0, 7.0), (11.0, 3.0)]);
|
||||
}
|
||||
GridPhoto => {
|
||||
pen.rect_fill(3.0, 4.0, 10.0, 9.5, 0.5);
|
||||
pen.rect_fill(11.0, 4.0, 17.0, 9.5, 0.5);
|
||||
|
||||
@@ -52,6 +52,7 @@ pub mod state;
|
||||
pub mod sync;
|
||||
pub mod tasks;
|
||||
pub mod theme;
|
||||
mod thumb;
|
||||
pub mod widgets;
|
||||
pub mod window_place;
|
||||
|
||||
|
||||
@@ -120,47 +120,34 @@ pub(crate) fn filmstrip(app: &mut LightcraftApp, ui: &mut egui::Ui, r: Rect) {
|
||||
}
|
||||
let img_area = Rect::from_min_max(cr.min + vec2(10.0, 22.0), cr.max - vec2(10.0, 8.0));
|
||||
crate::panels::grid::request_thumb(app, *id, (256.0 * ppp.min(2.0) / 2.0) as usize * 2, 8);
|
||||
let thumb = app.renderer.thumb(*id);
|
||||
if thumb.is_none() {
|
||||
p.rect_filled(img_area, 0.0, t.skeleton);
|
||||
if failed {
|
||||
p.text(img_area.center(), Align2::CENTER_CENTER, "!", t.semibold(14.0), t.text);
|
||||
}
|
||||
}
|
||||
if let Some(tex) = thumb {
|
||||
let [tw, th] = tex.size;
|
||||
let s = (img_area.width() / tw as f32).min(img_area.height() / th as f32);
|
||||
let fr = Rect::from_center_size(img_area.center(), vec2(tw as f32 * s, th as f32 * s));
|
||||
p.image(tex.id(), fr, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
|
||||
crate::panels::grid::selection_ring(p, &t, fr, state);
|
||||
if app.ui.settings.film_badges
|
||||
&& let Some(ph) = app.session.catalog.photo(*id)
|
||||
{
|
||||
film_badges(p, &t, fr, ph);
|
||||
}
|
||||
if let Some(st) = app.session.catalog.stack_of(*id) {
|
||||
let collapsed = st.collapsed;
|
||||
let text =
|
||||
if collapsed { st.photos.len().to_string() } else { format!("{}/{}", st.position(*id).unwrap_or(0) + 1, st.photos.len()) };
|
||||
let g = p.layout_no_wrap(text, t.semibold(9.5), Color32::WHITE);
|
||||
let br = Rect::from_min_size(fr.min + vec2(3.0, 3.0), vec2(g.size().x + 22.0, 15.0));
|
||||
// like the grid's badge: a click expands / collapses the stack
|
||||
let badge = ui.interact(br, egui::Id::unique(("film-stack-badge", id.0)), Sense::click()).on_hover_text(if collapsed {
|
||||
"Stack — click to expand"
|
||||
} else {
|
||||
"Stack — click to collapse"
|
||||
});
|
||||
crate::widgets::announce(&badge, crate::i18n::tr(if collapsed { "Expand Stack" } else { "Collapse Stack" }));
|
||||
register(ui, format!("filmstack:{}", id.0), br);
|
||||
let p = ui.painter();
|
||||
let fill = if badge.hovered() { Color32::from_black_alpha(230) } else { Color32::from_black_alpha(170) };
|
||||
p.rect_filled(br, 7.5, fill);
|
||||
crate::icons::paint(p, Rect::from_min_size(br.min + vec2(4.0, 2.0), vec2(11.0, 11.0)), crate::icons::Icon::Stack, Color32::WHITE);
|
||||
p.galley(pos2(br.min.x + 17.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE);
|
||||
if badge.clicked() {
|
||||
crate::panels::grid::toggle_stack(app, ui.ctx(), *id);
|
||||
}
|
||||
}
|
||||
let mut badge = None;
|
||||
if let Some(photo) = app.session.catalog.photo(*id).cloned() {
|
||||
let (photo_rect, failure) = if let Some(tex) = app.renderer.thumb(*id) {
|
||||
let [tw, th] = tex.size;
|
||||
let s = (img_area.width() / tw as f32).min(img_area.height() / th as f32);
|
||||
let fr = Rect::from_center_size(img_area.center(), vec2(tw as f32 * s, th as f32 * s));
|
||||
p.image(tex.id(), fr, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
|
||||
crate::panels::grid::selection_ring(p, &t, fr, state);
|
||||
(fr, None)
|
||||
} else {
|
||||
let ph = crate::thumb::placeholder_rect(img_area, crate::panels::grid::photo_aspect(Some(&*photo)));
|
||||
crate::thumb::paint_placeholder(p, ph, &t);
|
||||
crate::panels::grid::selection_ring(p, &t, ph, state);
|
||||
(ph, app.renderer.failure(crate::render::Slot::Thumb(*id)).map(str::to_owned))
|
||||
};
|
||||
let stack = app.session.catalog.stack_of(*id).map(|st| (st.id, st.position(*id).unwrap_or(0)));
|
||||
let overlay = crate::thumb::Thumb {
|
||||
surface: crate::thumb::Surface::Film,
|
||||
photo: &photo,
|
||||
rect: photo_rect,
|
||||
stack,
|
||||
marks: app.ui.settings.film_badges,
|
||||
extras: app.ui.settings.film_badges,
|
||||
hot: false,
|
||||
failure,
|
||||
surround: true,
|
||||
};
|
||||
badge = crate::thumb::overlay(app, ui, &overlay);
|
||||
}
|
||||
if resp.clicked() {
|
||||
let m = ui.input(|i| i.modifiers);
|
||||
@@ -197,6 +184,9 @@ pub(crate) fn filmstrip(app: &mut LightcraftApp, ui: &mut egui::Ui, r: Rect) {
|
||||
}
|
||||
// the same photo actions as the grid and loupe (Restore / Delete Permanently in Recently Deleted)
|
||||
crate::widgets::context_menu(&resp, |ui| crate::panels::grid::context_menu(app, ui, *id));
|
||||
if let Some(badge) = badge {
|
||||
crate::widgets::context_menu(&badge, |ui| crate::panels::grid::context_menu(app, ui, *id));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -211,26 +201,3 @@ pub(crate) fn film_spoken(file_name: &str, failed: bool) -> String {
|
||||
(false, true) => format!("{file_name}, {}", crate::i18n::tr("This photo can't be opened")),
|
||||
}
|
||||
}
|
||||
|
||||
/// Rating, flag and edited badges along a filmstrip thumbnail's bottom edge (Settings → Interface).
|
||||
fn film_badges(p: &egui::Painter, t: &Tokens, fr: Rect, ph: &lightcraft_catalog::Photo) {
|
||||
use crate::icons::{Icon, paint};
|
||||
use lightcraft_catalog::Flag;
|
||||
let edited = ph.is_edited();
|
||||
if ph.rating == 0 && ph.flag == Flag::None && !edited {
|
||||
return;
|
||||
}
|
||||
let bar = Rect::from_min_max(pos2(fr.left(), fr.bottom() - 15.0), fr.right_bottom());
|
||||
p.rect_filled(bar, 0.0, Color32::from_black_alpha(130));
|
||||
let y = bar.center().y;
|
||||
let mut x = bar.left() + 3.0;
|
||||
x += crate::rating::paint_rating(p, pos2(x, y), ph.rating, crate::rating::RatingSize::Small, t.star) + 2.0;
|
||||
match ph.flag {
|
||||
Flag::Pick => paint(p, Rect::from_min_size(pos2(x, y - 5.0), vec2(10.0, 10.0)), Icon::FlagPickFilled, t.pick),
|
||||
Flag::Reject => paint(p, Rect::from_min_size(pos2(x, y - 5.0), vec2(10.0, 10.0)), Icon::FlagReject, t.reject),
|
||||
Flag::None => {}
|
||||
}
|
||||
if edited {
|
||||
paint(p, Rect::from_min_size(pos2(bar.right() - 13.0, y - 5.0), vec2(10.0, 10.0)), Icon::Sliders, t.text_label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use std::collections::{HashMap, HashSet};
|
||||
use std::sync::Arc;
|
||||
|
||||
use egui::{Align2, Color32, Rect, Sense, Stroke, StrokeKind, pos2, vec2};
|
||||
use lightcraft_catalog::{Catalog, ColorLabel, DateRun, Flag, GroupBy, PhotoId, SortKey, StackId};
|
||||
use lightcraft_catalog::{Catalog, ColorLabel, DateRun, GroupBy, PhotoId, SortKey, StackId};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::LightcraftApp;
|
||||
@@ -271,9 +271,13 @@ pub(crate) fn import_way_in(keymap: &crate::shortcuts::Keymap, mac: bool) -> (&'
|
||||
(way, crate::shortcuts::shortcut_of(keymap, "file.addPhotos").map(|sc| crate::menubar::shortcut_text(sc, mac)))
|
||||
}
|
||||
|
||||
/// Width / height of a photo's cell: its cropped, oriented shape.
|
||||
/// [`photo_aspect`] of photo `id` of the catalog.
|
||||
pub(crate) fn shape_of(cat: &Catalog, id: PhotoId) -> f32 {
|
||||
let p = cat.photo(id);
|
||||
photo_aspect(cat.photo(id).map(|p| &**p))
|
||||
}
|
||||
|
||||
/// Width / height of a photo's cell: its cropped, oriented shape.
|
||||
pub(crate) fn photo_aspect(p: Option<&lightcraft_catalog::Photo>) -> f32 {
|
||||
let (w, h) = p.map(|p| (p.width.max(1) as f32, p.height.max(1) as f32)).unwrap_or((3.0, 2.0));
|
||||
let swap = p.is_some_and(|p| p.develop.orientation.swaps_axes());
|
||||
let crop = p.map(|p| p.develop.crop.geometry.rect).unwrap_or(lightcraft_geom::Rect::UNIT);
|
||||
@@ -411,10 +415,7 @@ fn show_inner(app: &mut LightcraftApp, ui: &mut egui::Ui) {
|
||||
visible_ids.insert(id);
|
||||
let r = rect.translate(origin.to_vec2());
|
||||
let onscreen = rect.intersects(viewport);
|
||||
cell(app, ui, id, r, square, onscreen, ppp);
|
||||
if let Some((sid, pos)) = stacks.get(&id) {
|
||||
stack_badge(app, ui, id, *sid, *pos, r, square);
|
||||
}
|
||||
cell(app, ui, id, r, CellView { square, onscreen, ppp, stack: stacks.get(&id).copied() });
|
||||
}
|
||||
}
|
||||
// date headers (top to bottom); the current group's header sticks to the top while its
|
||||
@@ -774,7 +775,8 @@ pub(crate) fn skips_the_real_render(embedded_is_final: bool, from_embedded: bool
|
||||
/// Rendered thumbnails replacing embedded previews: after everything on screen.
|
||||
pub const BACKGROUND_THUMB_PRIORITY: u32 = 3;
|
||||
|
||||
fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square: bool, onscreen: bool, ppp: f32) {
|
||||
fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, view: CellView) {
|
||||
let CellView { square, onscreen, ppp, stack } = view;
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let Some(photo) = app.session.catalog.photo(id).cloned() else { return };
|
||||
let resp = ui.interact(r, egui::Id::unique(("cell", id.0)), Sense::click_and_drag());
|
||||
@@ -791,26 +793,37 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square
|
||||
} else {
|
||||
r
|
||||
};
|
||||
let photo_rect = paint_cell_thumbnail(app, p, &t, id, img_rect, ThumbFlags { square, state, onscreen, ppp });
|
||||
let flags = ThumbFlags { state, onscreen, ppp, aspect: photo_aspect(Some(&*photo)) };
|
||||
let (photo_rect, failure) = paint_cell_thumbnail(app, p, &t, id, img_rect, flags);
|
||||
// labels and badges
|
||||
paint_cell_caption(app, p, &t, &photo, r, square);
|
||||
paint_cell_badges(app, p, &t, &photo, photo_rect, BadgeFlags { square, selected, hovered: resp.hovered() });
|
||||
if let Some(name) = &photo.copy_name {
|
||||
paint_copy_tag(p, &t, name, img_rect, square);
|
||||
}
|
||||
if let Some(why) = &photo.preview_only {
|
||||
paint_preview_pill(ui, p, &t, id, why, photo_rect);
|
||||
}
|
||||
if photo.flag == Flag::Reject {
|
||||
p.rect_filled(img_rect, 0.0, Color32::from_black_alpha(110));
|
||||
}
|
||||
cell_interaction(app, ui, &resp, id, &photo);
|
||||
// Stars on hover: the decision marks (flag, colour label) always show; the stars and the edited
|
||||
// mark only while the photo is hovered or selected, so a mostly rated library stays clean.
|
||||
let engaged = resp.hovered() || selected;
|
||||
let (show_marks, show_extras) = match app.ui.settings.grid_badges {
|
||||
crate::state::GridBadges::Auto => (true, engaged),
|
||||
crate::state::GridBadges::Always => (true, true),
|
||||
crate::state::GridBadges::Never => (false, false),
|
||||
};
|
||||
let overlay = crate::thumb::Thumb {
|
||||
surface: crate::thumb::Surface::Grid,
|
||||
photo: &photo,
|
||||
rect: photo_rect,
|
||||
stack,
|
||||
marks: show_marks,
|
||||
extras: show_extras,
|
||||
hot: engaged,
|
||||
failure,
|
||||
surround: square,
|
||||
};
|
||||
let badge = crate::thumb::overlay(app, ui, &overlay);
|
||||
cell_interaction(app, ui, &resp, id, &photo, badge);
|
||||
}
|
||||
|
||||
pub(crate) fn cell_description(app: &LightcraftApp, photo: &lightcraft_catalog::Photo) -> String {
|
||||
let mut spoken = photo.file_name.clone();
|
||||
if photo.rating > 0 {
|
||||
spoken.push_str(&crate::i18n::tr_format!(", {} star{}", photo.rating, if photo.rating == 1 { "" } else { "s" }));
|
||||
spoken.push_str(&crate::thumb::spoken_rating(photo.rating));
|
||||
}
|
||||
match photo.flag {
|
||||
lightcraft_catalog::Flag::Pick => spoken.push_str(crate::i18n::tr(", picked")),
|
||||
@@ -823,28 +836,32 @@ pub(crate) fn cell_description(app: &LightcraftApp, photo: &lightcraft_catalog::
|
||||
spoken
|
||||
}
|
||||
|
||||
fn paint_cell_thumbnail(app: &mut LightcraftApp, p: &egui::Painter, t: &Tokens, id: PhotoId, img_rect: Rect, flags: ThumbFlags) -> Rect {
|
||||
let ThumbFlags { square, state, onscreen, ppp } = flags;
|
||||
fn paint_cell_thumbnail(
|
||||
app: &mut LightcraftApp,
|
||||
p: &egui::Painter,
|
||||
t: &Tokens,
|
||||
id: PhotoId,
|
||||
img_rect: Rect,
|
||||
flags: ThumbFlags,
|
||||
) -> (Rect, Option<String>) {
|
||||
let ThumbFlags { state, onscreen, ppp, aspect } = flags;
|
||||
let size = thumb_px(img_rect.width().max(img_rect.height()), ppp);
|
||||
request_thumb(app, id, size, if onscreen { 10 } else { 5 });
|
||||
if let Some(tex) = app.renderer.thumb(id) {
|
||||
let (photo_rect, failure) = if let Some(tex) = app.renderer.thumb(id) {
|
||||
let [tw, th] = tex.size;
|
||||
// Preserve the decoded preview's ratio when it differs from the catalog dimensions.
|
||||
let fit = super::detail::fit_texture_rect(img_rect, [tw, th]);
|
||||
p.image(tex.id(), fit, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE);
|
||||
selection_ring(p, t, fit, state);
|
||||
fit
|
||||
(fit, None)
|
||||
} else {
|
||||
let ph = img_rect.shrink(if square { 20.0 } else { 0.0 });
|
||||
p.rect_filled(ph, 0.0, t.skeleton);
|
||||
let ph = crate::thumb::placeholder_rect(img_rect, aspect);
|
||||
crate::thumb::paint_placeholder(p, ph, t);
|
||||
// not drawn yet (or unreadable): the selection is still visible
|
||||
selection_ring(p, t, ph, state);
|
||||
if app.renderer.failure(Slot::Thumb(id)).is_some() {
|
||||
// unreadable / missing file
|
||||
p.text(ph.center(), Align2::CENTER_CENTER, "!", t.semibold(18.0), t.text);
|
||||
}
|
||||
ph
|
||||
}
|
||||
(ph, app.renderer.failure(Slot::Thumb(id)).map(str::to_owned))
|
||||
};
|
||||
(photo_rect, failure)
|
||||
}
|
||||
|
||||
fn paint_cell_caption(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, photo: &lightcraft_catalog::Photo, r: Rect, square: bool) {
|
||||
@@ -877,83 +894,14 @@ fn paint_cell_caption(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, photo:
|
||||
}
|
||||
}
|
||||
|
||||
/// The 24-pixel band the badges sit in, on the photo itself: a portrait's fitted rect is
|
||||
/// narrower than the cell's image area and a landscape's is shorter, so a band sized from
|
||||
/// the image area sticks out past the photo and crosses its selection frame (#3601). A photo
|
||||
/// shorter than the band keeps its own top edge.
|
||||
fn photo_badge_bar(photo_rect: Rect) -> Rect {
|
||||
Rect::from_min_max(pos2(photo_rect.left(), (photo_rect.bottom() - 24.0).max(photo_rect.top())), photo_rect.right_bottom())
|
||||
}
|
||||
|
||||
fn paint_cell_badges(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, photo: &lightcraft_catalog::Photo, photo_rect: Rect, flags: BadgeFlags) {
|
||||
let BadgeFlags { square, selected, hovered } = flags;
|
||||
let show_badges = match app.ui.settings.grid_badges {
|
||||
crate::state::GridBadges::Auto => hovered || selected || photo.rating > 0 || photo.flag != Flag::None || photo.label.is_some(),
|
||||
crate::state::GridBadges::Always => true,
|
||||
crate::state::GridBadges::Never => false,
|
||||
};
|
||||
let badge_bar = photo_badge_bar(photo_rect);
|
||||
if !square && photo.label.is_some() {
|
||||
// Justified photos fill the whole cell, so the label shows as a translucent tinted footer
|
||||
// over the photo's bottom edge (opaque, it would hide 24 px of every labelled photo).
|
||||
p.rect_filled(badge_bar, 0.0, crate::theme::label_background(t.cell, photo.label, selected).gamma_multiply(0.7));
|
||||
}
|
||||
if show_badges {
|
||||
let bar = badge_bar;
|
||||
if (hovered || selected) && (square || photo.label.is_none()) {
|
||||
p.rect_filled(bar, 0.0, Color32::from_black_alpha(120));
|
||||
}
|
||||
let mut x = bar.left() + 6.0;
|
||||
x += crate::rating::paint_rating(p, pos2(x, bar.center().y), photo.rating, crate::rating::RatingSize::Medium, t.star) + 4.0;
|
||||
match photo.flag {
|
||||
Flag::Pick => paint(p, Rect::from_min_size(pos2(x, bar.center().y - 7.0), vec2(14.0, 14.0)), Icon::FlagPickFilled, t.pick),
|
||||
Flag::Reject => paint(p, Rect::from_min_size(pos2(x, bar.center().y - 7.0), vec2(14.0, 14.0)), Icon::FlagReject, t.reject),
|
||||
Flag::None => {}
|
||||
}
|
||||
let mut right = bar.right();
|
||||
if photo.is_edited() {
|
||||
paint(p, Rect::from_min_size(pos2(right - 20.0, bar.center().y - 7.0), vec2(14.0, 14.0)), Icon::Sliders, t.text_label);
|
||||
right -= 20.0;
|
||||
}
|
||||
if let Some(l) = photo.label {
|
||||
p.circle(pos2(right - 12.0, bar.center().y), 5.0, label_color(l), Stroke::new(1.0, Color32::from_black_alpha(120)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn paint_copy_tag(p: &egui::Painter, t: &Tokens, name: &str, img_rect: Rect, square: bool) {
|
||||
// virtual copy: a folded-corner tag at the top right
|
||||
let g = p.layout_no_wrap(name.to_string(), t.semibold(10.5), Color32::WHITE);
|
||||
let tr = if square { img_rect.right_top() + vec2(-6.0, 6.0) } else { img_rect.right_top() + vec2(-5.0, 5.0) };
|
||||
let br = Rect::from_min_max(pos2(tr.x - g.size().x - 26.0, tr.y), pos2(tr.x, tr.y + 20.0));
|
||||
p.rect_filled(br, 10.0, Color32::from_black_alpha(165));
|
||||
let c = pos2(br.left() + 13.0, br.center().y);
|
||||
let s = 5.0;
|
||||
p.add(egui::Shape::convex_polygon(
|
||||
vec![c + vec2(-s, -s), c + vec2(s * 0.3, -s), c + vec2(s, -s * 0.3), c + vec2(s, s), c + vec2(-s, s)],
|
||||
Color32::TRANSPARENT,
|
||||
Stroke::new(1.2, Color32::WHITE),
|
||||
));
|
||||
p.line_segment([c + vec2(s * 0.3, -s), c + vec2(s * 0.3, -s * 0.3)], Stroke::new(1.2, Color32::WHITE));
|
||||
p.line_segment([c + vec2(s * 0.3, -s * 0.3), c + vec2(s, -s * 0.3)], Stroke::new(1.2, Color32::WHITE));
|
||||
p.galley(pos2(br.left() + 22.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE);
|
||||
}
|
||||
|
||||
fn paint_preview_pill(ui: &egui::Ui, p: &egui::Painter, t: &Tokens, id: PhotoId, why: &str, photo_rect: Rect) {
|
||||
// a raw shown from its embedded JPEG: a small amber "Preview" pill at the photo's bottom
|
||||
// left, above the badge bar (always shown: it changes what editing does)
|
||||
let g = p.layout_no_wrap(crate::i18n::tr("Preview").into(), t.semibold(9.5), Color32::WHITE);
|
||||
let at = pos2(photo_rect.left() + 6.0, photo_rect.bottom() - 30.0 - 16.0);
|
||||
let br = Rect::from_min_size(at, vec2(g.size().x + 24.0, 16.0));
|
||||
p.rect_filled(br, 8.0, Color32::from_black_alpha(170));
|
||||
paint(p, Rect::from_center_size(pos2(br.left() + 9.0, br.center().y), vec2(12.0, 12.0)), Icon::Info, t.caution);
|
||||
p.galley(pos2(br.left() + 17.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE);
|
||||
register(ui, format!("badge:previewOnly:{}", id.0), br);
|
||||
ui.interact(br, egui::Id::unique(("preview-only-badge", id.0)), Sense::hover())
|
||||
.on_hover_text(crate::i18n::tr_format!("Preview only — {}", crate::widgets::preview_only_explanation(why)));
|
||||
}
|
||||
|
||||
fn cell_interaction(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, id: PhotoId, photo: &lightcraft_catalog::Photo) {
|
||||
fn cell_interaction(
|
||||
app: &mut LightcraftApp,
|
||||
ui: &mut egui::Ui,
|
||||
resp: &egui::Response,
|
||||
id: PhotoId,
|
||||
photo: &lightcraft_catalog::Photo,
|
||||
badge: Option<egui::Response>,
|
||||
) {
|
||||
if let Some(k) = app.ui.keyword_painter.clone() {
|
||||
// painting: a click toggles the keyword on this photo
|
||||
if resp.hovered() {
|
||||
@@ -986,19 +934,25 @@ fn cell_interaction(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Res
|
||||
begin_photo_drag(app, id);
|
||||
}
|
||||
crate::widgets::context_menu(resp, |ui| context_menu(app, ui, id));
|
||||
// (the stack badge covers part of the cell: it opens the same menu)
|
||||
if let Some(badge) = badge {
|
||||
crate::widgets::context_menu(&badge, |ui| context_menu(app, ui, id));
|
||||
}
|
||||
}
|
||||
|
||||
struct ThumbFlags {
|
||||
square: bool,
|
||||
state: lightcraft_engine::SelectionState,
|
||||
onscreen: bool,
|
||||
ppp: f32,
|
||||
aspect: f32,
|
||||
}
|
||||
|
||||
struct BadgeFlags {
|
||||
/// How `cell` is drawn: the layout, whether it is on screen, the pixel scale, and the photo's stack position.
|
||||
struct CellView {
|
||||
square: bool,
|
||||
selected: bool,
|
||||
hovered: bool,
|
||||
onscreen: bool,
|
||||
ppp: f32,
|
||||
stack: Option<(lightcraft_catalog::StackId, usize)>,
|
||||
}
|
||||
|
||||
/// The header of a library view (All Photos, an album, a library folder…): the source's title and
|
||||
@@ -1260,38 +1214,6 @@ pub fn label_param(l: Option<ColorLabel>) -> String {
|
||||
l.map_or_else(|| "none".to_string(), |l| format!("{l:?}").to_lowercase())
|
||||
}
|
||||
|
||||
/// Stack badge at the cell's top-left: the photo count on a collapsed stack's top, `i/n` on the
|
||||
/// members of an expanded stack. Clicking or double-clicking it expands/collapses the stack.
|
||||
pub fn stack_badge(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, sid: lightcraft_catalog::StackId, pos: usize, r: Rect, square: bool) {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let Some(st) = app.session.catalog.stack(sid) else { return };
|
||||
let n = st.photos.len();
|
||||
let collapsed = st.collapsed;
|
||||
let text = if collapsed { n.to_string() } else { format!("{}/{n}", pos + 1) };
|
||||
let p = ui.painter();
|
||||
let g = p.layout_no_wrap(text, t.semibold(11.0), Color32::WHITE);
|
||||
let origin = if square { r.min + vec2(10.0, 26.0) } else { r.min + vec2(5.0, 5.0) };
|
||||
let br = Rect::from_min_size(origin, vec2(g.size().x + 30.0, 20.0));
|
||||
let resp = ui.interact(br, egui::Id::unique(("stack-badge", id.0)), Sense::click()).on_hover_text(if collapsed {
|
||||
"Stack — click to expand (S)"
|
||||
} else {
|
||||
"Stack — click to collapse (S)"
|
||||
});
|
||||
crate::widgets::announce(&resp, crate::i18n::tr(if collapsed { "Expand Stack" } else { "Collapse Stack" }));
|
||||
register(ui, format!("stack:{}", id.0), br);
|
||||
let fill = if resp.hovered() { Color32::from_black_alpha(220) } else { Color32::from_black_alpha(165) };
|
||||
p.rect_filled(br, 10.0, fill);
|
||||
if pos == 0 && !collapsed {
|
||||
p.rect_stroke(br, 10.0, Stroke::new(1.0, t.accent), StrokeKind::Inside);
|
||||
}
|
||||
paint(p, Rect::from_min_size(br.min + vec2(6.0, 3.0), vec2(14.0, 14.0)), Icon::Stack, Color32::WHITE);
|
||||
p.galley(pos2(br.min.x + 24.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE);
|
||||
// a double-click (Lightroom's way) toggles once: its second click would undo the first
|
||||
if resp.clicked() && !resp.double_clicked() {
|
||||
toggle_stack(app, ui.ctx(), id);
|
||||
}
|
||||
}
|
||||
|
||||
/// A click on a stack badge (grid or filmstrip): expand / collapse that photo's stack, selected or
|
||||
/// not. The selection stays as it is (Compare keeps its pair).
|
||||
pub fn toggle_stack(app: &mut LightcraftApp, ctx: &egui::Context, id: PhotoId) {
|
||||
@@ -1679,27 +1601,4 @@ mod tests {
|
||||
assert_eq!(resolve_group(GroupBy::None, 220.0), GroupBy::None);
|
||||
assert_eq!(resolve_group(GroupBy::Year, 400.0), GroupBy::Year);
|
||||
}
|
||||
|
||||
/// The badge band sits on the photo itself — a portrait's fitted rect is narrower than the
|
||||
/// cell's image area, a landscape's is shorter — so it never sticks out past the photo or
|
||||
/// crosses its selection frame (#3601).
|
||||
#[test]
|
||||
fn the_badge_band_stays_on_the_photo() {
|
||||
let cell = Rect::from_min_size(pos2(10.0, 24.0), vec2(180.0, 180.0));
|
||||
// A photo that fills the image area: the band is the usual 24 px footer
|
||||
let full = photo_badge_bar(cell);
|
||||
assert!((full.height() - 24.0).abs() < 0.01, "{full:?}");
|
||||
assert!((full.bottom() - cell.bottom()).abs() < 0.01);
|
||||
assert!((full.left() - cell.left()).abs() < 0.01 && (full.right() - cell.right()).abs() < 0.01);
|
||||
// A portrait photo fitted inside it: the band is no wider than the photo
|
||||
let portrait = Rect::from_min_size(pos2(cell.left() + 55.0, cell.top()), vec2(70.0, 180.0));
|
||||
let bar = photo_badge_bar(portrait);
|
||||
assert!(bar.left() >= portrait.left() && bar.right() <= portrait.right(), "{bar:?}");
|
||||
assert!((bar.height() - 24.0).abs() < 0.01);
|
||||
// A landscape photo shorter than the band: its own top edge, never a negative rect
|
||||
let wide = Rect::from_min_size(pos2(cell.left(), cell.top() + 80.0), vec2(180.0, 20.0));
|
||||
let bar = photo_badge_bar(wide);
|
||||
assert!((bar.top() - wide.top()).abs() < 0.01, "{bar:?}");
|
||||
assert!(bar.bottom() <= wide.bottom() + 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ pub enum LaunchLibrary {
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum GridBadges {
|
||||
/// On hover, on the selection, and on rated or flagged photos.
|
||||
/// Flags and colour labels always; stars and the edited mark on hover and on the selection.
|
||||
#[default]
|
||||
Auto,
|
||||
Always,
|
||||
|
||||
@@ -51,6 +51,7 @@ mod focus_point;
|
||||
mod folder_drop;
|
||||
mod grading;
|
||||
mod grid;
|
||||
mod grid_badges;
|
||||
mod grid_drag;
|
||||
mod guided_guides;
|
||||
mod histogram_drag;
|
||||
@@ -108,6 +109,7 @@ mod sync;
|
||||
mod tallies;
|
||||
mod temp_slider;
|
||||
mod text_prompt;
|
||||
mod thumb;
|
||||
mod titlebar;
|
||||
mod tool_overlay;
|
||||
mod unsaved;
|
||||
|
||||
@@ -46,7 +46,7 @@ fn filmstrip_stack_badge_expands_and_collapses_the_stack() {
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
assert!(h.settle(SETTLE), "the filmstrip settles before clicking its stack badge");
|
||||
assert!(!h.app.session.visible_cloned().contains(&member), "collapsed: only the top shows");
|
||||
let badge = format!("filmstack:{}", top.0);
|
||||
let badge = format!("film:stack:{}", top.0);
|
||||
let r = h.request("ui.clickWidget", json!({"id": badge}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
assert!(h.settle(SETTLE), "the expanded stack settles");
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
//! Grid badges under Settings ▸ Interface ▸ Grid: Auto keeps a mostly rated library clean (the
|
||||
//! stars and the edited mark show on hover and selection), while the decision marks (flag, colour
|
||||
//! label) stay visible; Always shows everything, Never nothing.
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use lightcraft_catalog::{ColorLabel, Flag, Op, Photo, PhotoId, Source};
|
||||
use lightcraft_engine::Session;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::headless::Headless;
|
||||
use crate::state::{GridBadges, ViewMode};
|
||||
use crate::{LightcraftApp, Services};
|
||||
|
||||
const T: Duration = Duration::from_secs(30);
|
||||
const SETTLE: Duration = Duration::from_secs(60);
|
||||
|
||||
const RATED: PhotoId = PhotoId(1);
|
||||
const PICKED: PhotoId = PhotoId(2);
|
||||
const REJECTED: PhotoId = PhotoId(3);
|
||||
const EDITED: PhotoId = PhotoId(4);
|
||||
const PLAIN: PhotoId = PhotoId(5);
|
||||
const UNRATED_PICK: PhotoId = PhotoId(6);
|
||||
|
||||
fn library() -> Session {
|
||||
let mut s = Session::new();
|
||||
for i in 1..=6u64 {
|
||||
let name = format!("IMG_{i:03}.jpg");
|
||||
let mut p = Photo::new(
|
||||
PhotoId(i),
|
||||
Source::File { path: format!("/lightcraft-badges-test/{name}") },
|
||||
&name,
|
||||
"JPEG",
|
||||
6000,
|
||||
4000,
|
||||
"2026-01-01T00:00:00",
|
||||
);
|
||||
match PhotoId(i) {
|
||||
RATED => p.rating = 4,
|
||||
PICKED => {
|
||||
p.rating = 5;
|
||||
p.flag = Flag::Pick;
|
||||
p.label = Some(ColorLabel::Red);
|
||||
}
|
||||
REJECTED => {
|
||||
p.flag = Flag::Reject;
|
||||
p.label = Some(ColorLabel::Blue);
|
||||
}
|
||||
EDITED => Arc::make_mut(&mut p.develop).light.exposure = 1.0,
|
||||
UNRATED_PICK => p.flag = Flag::Pick,
|
||||
_ => {}
|
||||
}
|
||||
s.catalog.apply(Op::AddPhoto { photo: Box::new(p) }).unwrap();
|
||||
}
|
||||
s
|
||||
}
|
||||
|
||||
/// The grid with `badges`, the plain photo selected and the pointer away from every tile.
|
||||
fn grid(badges: GridBadges) -> Headless {
|
||||
let app = LightcraftApp::new(library(), Services { png: None, ..Default::default() });
|
||||
let mut h = Headless::new(app, [1200.0, 800.0], 1.0);
|
||||
h.app.ui.view = ViewMode::PhotoGrid;
|
||||
h.app.ui.settings.grid_badges = badges;
|
||||
let r = h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [PLAIN.0]}}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
move_to(&mut h, egui::pos2(1.0, 1.0));
|
||||
h
|
||||
}
|
||||
|
||||
fn move_to(h: &mut Headless, at: egui::Pos2) {
|
||||
h.request("ui.move", json!({"x": at.x, "y": at.y}), T);
|
||||
h.settle(SETTLE);
|
||||
h.step();
|
||||
}
|
||||
|
||||
fn hover(h: &mut Headless, id: PhotoId) {
|
||||
let r = h.request("ui.hoverWidget", json!({"id": format!("thumb:{}", id.0)}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
h.step();
|
||||
}
|
||||
|
||||
/// Which marks are drawn on the photo's tile, in a fixed order.
|
||||
fn marks(h: &Headless, id: PhotoId) -> Vec<&'static str> {
|
||||
["stars", "flag", "label", "edited"].into_iter().filter(|m| h.app.widgets.iter().any(|(w, _)| *w == format!("badge:{m}:{}", id.0))).collect()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn auto_hides_the_stars_of_a_photo_that_is_neither_hovered_nor_selected() {
|
||||
let h = grid(GridBadges::Auto);
|
||||
assert_eq!(marks(&h, RATED), Vec::<&str>::new());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn auto_shows_the_stars_while_the_photo_is_hovered_or_selected() {
|
||||
let mut h = grid(GridBadges::Auto);
|
||||
hover(&mut h, RATED);
|
||||
assert_eq!(marks(&h, RATED), ["stars"], "hovered");
|
||||
move_to(&mut h, egui::pos2(1.0, 1.0));
|
||||
assert_eq!(marks(&h, RATED), Vec::<&str>::new(), "the pointer left");
|
||||
let r = h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [RATED.0]}}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
assert_eq!(marks(&h, RATED), ["stars"], "selected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn auto_always_shows_the_flag_and_the_colour_label() {
|
||||
let mut h = grid(GridBadges::Auto);
|
||||
assert_eq!(marks(&h, PICKED), ["flag", "label"], "the stars of a picked photo stay hidden");
|
||||
assert_eq!(marks(&h, REJECTED), ["flag", "label"]);
|
||||
hover(&mut h, PICKED);
|
||||
assert_eq!(marks(&h, PICKED), ["stars", "flag", "label"], "hover adds the stars to the marks");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn always_shows_everything_and_never_shows_nothing() {
|
||||
let h = grid(GridBadges::Always);
|
||||
assert_eq!(marks(&h, RATED), ["stars"]);
|
||||
assert_eq!(marks(&h, PICKED), ["stars", "flag", "label"]);
|
||||
assert_eq!(marks(&h, EDITED), ["edited"]);
|
||||
// (the setting is about ratings and flags: the justified grid has no surround to tint with a
|
||||
// colour label, so the label's dot stays, #2164)
|
||||
let h = grid(GridBadges::Never);
|
||||
for id in [RATED, EDITED] {
|
||||
assert_eq!(marks(&h, id), Vec::<&str>::new(), "photo {}", id.0);
|
||||
}
|
||||
for id in [PICKED, REJECTED] {
|
||||
assert_eq!(marks(&h, id), ["label"], "photo {}", id.0);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn auto_shows_the_edited_mark_with_the_stars() {
|
||||
let mut h = grid(GridBadges::Auto);
|
||||
assert_eq!(marks(&h, EDITED), Vec::<&str>::new());
|
||||
hover(&mut h, EDITED);
|
||||
assert_eq!(marks(&h, EDITED), ["edited"]);
|
||||
}
|
||||
|
||||
fn rect(h: &Headless, id: String) -> egui::Rect {
|
||||
h.app.widgets.iter().find(|(w, _)| *w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("no widget {id}"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn auto_puts_the_flag_at_the_left_when_the_stars_are_hidden() {
|
||||
let mut h = grid(GridBadges::Auto);
|
||||
let cell = rect(&h, format!("thumb:{}", PICKED.0));
|
||||
let flag = rect(&h, format!("badge:flag:{}", PICKED.0));
|
||||
assert!(flag.left() - cell.left() < 12.0, "no gap for stars that aren't drawn: flag {flag:?} in {cell:?}");
|
||||
hover(&mut h, PICKED);
|
||||
let flag = rect(&h, format!("badge:flag:{}", PICKED.0));
|
||||
let stars = rect(&h, format!("badge:stars:{}", PICKED.0));
|
||||
assert!(flag.left() >= stars.right(), "the flag follows the stars: {flag:?} after {stars:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_unrated_photos_flag_does_not_move_on_hover() {
|
||||
let mut h = grid(GridBadges::Auto);
|
||||
let before = rect(&h, format!("badge:flag:{}", UNRATED_PICK.0));
|
||||
hover(&mut h, UNRATED_PICK);
|
||||
assert_eq!(rect(&h, format!("badge:flag:{}", UNRATED_PICK.0)), before);
|
||||
}
|
||||
@@ -45,8 +45,19 @@ fn label_tints_grid_and_filmstrip_chrome_without_changing_photo_pixels() {
|
||||
let mut h = app(view);
|
||||
let widget = if view == ViewMode::Detail { "film:1" } else { "thumb:1" };
|
||||
let cell = rect(&h, widget);
|
||||
// (the photo grid's label is the dot in the marks row: no band is laid over its pixels; the
|
||||
// square grid and the filmstrip also tint their surround)
|
||||
let sample = if view == ViewMode::PhotoGrid {
|
||||
egui::pos2(cell.right() - 40.0, cell.bottom() - 8.0)
|
||||
h.app.run("photo.label", json!({"label": "red"})).unwrap();
|
||||
h.step();
|
||||
let red = crate::theme::label_color(lightcraft_catalog::ColorLabel::Red);
|
||||
let dot = h.view.painted_shapes().into_iter().find_map(|s| match s {
|
||||
egui::epaint::Shape::Circle(c) if c.fill == red && cell.contains(c.center) => Some(c.center),
|
||||
_ => None,
|
||||
});
|
||||
h.app.run("photo.label", json!({"label": "none"})).unwrap();
|
||||
h.step();
|
||||
dot.expect("the label dot")
|
||||
} else {
|
||||
egui::pos2(cell.left() + 4.0, cell.center().y)
|
||||
};
|
||||
@@ -59,7 +70,7 @@ fn label_tints_grid_and_filmstrip_chrome_without_changing_photo_pixels() {
|
||||
h.step();
|
||||
let image = h.paint();
|
||||
let c = pixel(&image, sample);
|
||||
assert_ne!(c, pixel(&neutral, sample), "{view:?} {label} must tint the thumbnail surround/footer");
|
||||
assert_ne!(c, pixel(&neutral, sample), "{view:?} {label} must tint the thumbnail surround/label dot");
|
||||
assert!(!colours.contains(&c), "each label has a distinct tint: {view:?} {label}");
|
||||
colours.push(c);
|
||||
assert_eq!(pixel(&image, cell.center()), centre, "{view:?} {label} must not tint image pixels");
|
||||
|
||||
@@ -17,11 +17,14 @@ const T: Duration = Duration::from_secs(60);
|
||||
const PHOTOS: u64 = 40;
|
||||
|
||||
/// Photos `IMG_0000` … on a share; the first ten are gone. The existence check waits for `open`
|
||||
/// (a share that answers slowly), at most `guard`, and counts its calls, and those made on the UI thread.
|
||||
/// (a share that answers slowly), at most `guard`, and counts its calls, those made on the UI thread,
|
||||
/// and those of the missing check's own walk: a failed thumbnail's badge asks about its file too
|
||||
/// (`Availability`'s worker thread), which is a question of the moment, not a walk of the share.
|
||||
struct Share {
|
||||
open: Arc<AtomicBool>,
|
||||
on_ui: Arc<AtomicUsize>,
|
||||
calls: Arc<AtomicUsize>,
|
||||
walks: Arc<AtomicUsize>,
|
||||
}
|
||||
|
||||
fn app_on_a_slow_share(guard: Duration) -> (Headless, Share) {
|
||||
@@ -31,14 +34,23 @@ fn app_on_a_slow_share(guard: Duration) -> (Headless, Share) {
|
||||
let p = Photo::new(PhotoId(i + 1), Source::File { path }, &format!("IMG_{i:04}.jpg"), "JPEG", 60, 40, "2026-01-01T00:00:00");
|
||||
app.session.catalog.apply(Op::AddPhoto { photo: Box::new(p) }).unwrap();
|
||||
}
|
||||
let share = Share { open: Arc::new(AtomicBool::new(false)), on_ui: Arc::new(AtomicUsize::new(0)), calls: Arc::new(AtomicUsize::new(0)) };
|
||||
let (ui, open, on_ui, calls) = (std::thread::current().id(), share.open.clone(), share.on_ui.clone(), share.calls.clone());
|
||||
let share = Share {
|
||||
open: Arc::new(AtomicBool::new(false)),
|
||||
on_ui: Arc::new(AtomicUsize::new(0)),
|
||||
calls: Arc::new(AtomicUsize::new(0)),
|
||||
walks: Arc::new(AtomicUsize::new(0)),
|
||||
};
|
||||
let (ui, open, on_ui, calls, walks) =
|
||||
(std::thread::current().id(), share.open.clone(), share.on_ui.clone(), share.calls.clone(), share.walks.clone());
|
||||
let deadline = Instant::now() + guard;
|
||||
app.session.media.availability.set_probe(Arc::new(move |f| {
|
||||
calls.fetch_add(1, Ordering::SeqCst);
|
||||
if std::thread::current().id() == ui {
|
||||
let thread = std::thread::current();
|
||||
if thread.id() == ui {
|
||||
on_ui.fetch_add(1, Ordering::SeqCst);
|
||||
} else if thread.name() != Some("lc-availability") {
|
||||
walks.fetch_add(1, Ordering::SeqCst);
|
||||
}
|
||||
calls.fetch_add(1, Ordering::SeqCst);
|
||||
// (a hang guard: the check goes on after it, so a regression fails the test instead of hanging it)
|
||||
while !open.load(Ordering::SeqCst) && Instant::now() < deadline {
|
||||
std::thread::sleep(Duration::from_millis(1));
|
||||
@@ -143,17 +155,17 @@ fn an_answer_nobody_waited_for_is_given_to_the_next_request() {
|
||||
drop(gave_up);
|
||||
share.open.store(true, Ordering::SeqCst);
|
||||
assert!(h.step_until(T, |h| h.app.tasks.is_empty()), "the check ends without a caller");
|
||||
assert_eq!(share.calls.load(Ordering::SeqCst), PHOTOS as usize);
|
||||
assert_eq!(share.walks.load(Ordering::SeqCst), PHOTOS as usize);
|
||||
|
||||
let again = ask(&mut h);
|
||||
let reply = answer(&mut h, &again);
|
||||
assert_eq!(reply["ok"], true, "{reply}");
|
||||
assert_eq!(reply["result"].as_array().map(Vec::len), Some(10), "{reply}");
|
||||
assert_eq!(share.calls.load(Ordering::SeqCst), PHOTOS as usize, "no second walk of the share");
|
||||
assert_eq!(share.walks.load(Ordering::SeqCst), PHOTOS as usize, "no second walk of the share");
|
||||
// given once: the next request checks again
|
||||
let third = ask(&mut h);
|
||||
assert_eq!(answer(&mut h, &third)["ok"], true);
|
||||
assert_eq!(share.calls.load(Ordering::SeqCst), 2 * PHOTOS as usize);
|
||||
assert_eq!(share.walks.load(Ordering::SeqCst), 2 * PHOTOS as usize);
|
||||
}
|
||||
|
||||
/// A check that panics is a failure told to the caller, not a request left waiting for its timeout.
|
||||
|
||||
@@ -0,0 +1,251 @@
|
||||
//! Headless tests of the thumbnail overlay the grid (justified and square) and the filmstrip share:
|
||||
//! the virtual-copy tag, the stack badge, the placeholder and the failure mark, and the one way a
|
||||
//! colour label shows.
|
||||
|
||||
use std::{cell::Cell, rc::Rc, time::Duration};
|
||||
|
||||
use egui::epaint::Shape;
|
||||
use egui::{Color32, Rect};
|
||||
use lightcraft_catalog::{ColorLabel, PhotoId};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::headless::{Headless, RenderGate};
|
||||
use crate::i18n::Locale;
|
||||
use crate::render::Slot;
|
||||
use crate::state::ViewMode;
|
||||
use crate::{LightcraftApp, Services};
|
||||
|
||||
const T: Duration = Duration::from_secs(20);
|
||||
const SETTLE: Duration = Duration::from_secs(120);
|
||||
|
||||
fn demo() -> Headless {
|
||||
let mut app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() });
|
||||
app.ui.view = ViewMode::PhotoGrid;
|
||||
Headless::new(app, [1400.0, 900.0], 1.0)
|
||||
}
|
||||
|
||||
fn run(h: &mut Headless, command: &str, params: serde_json::Value) {
|
||||
let r = h.request("engine.execute", json!({"command": command, "params": params}), T);
|
||||
assert_eq!(r["ok"], true, "{command}: {r}");
|
||||
}
|
||||
|
||||
fn widget(h: &Headless, id: &str) -> Option<Rect> {
|
||||
h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r)
|
||||
}
|
||||
|
||||
fn first_photos(h: &mut Headless, n: usize) -> Vec<PhotoId> {
|
||||
h.app.session.visible_cloned().into_iter().take(n).collect()
|
||||
}
|
||||
|
||||
/// Hover `id` and wait for a tooltip text that satisfies `says`.
|
||||
fn hover_says(h: &mut Headless, id: &str, says: impl Fn(&str) -> bool) -> bool {
|
||||
let r = h.request("ui.hoverWidget", json!({"id": id}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.step_until(Duration::from_secs(5), |h| h.painted_text().iter().any(|t| says(t)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_virtual_copy_is_tagged_in_the_filmstrip_as_it_is_in_the_grid() {
|
||||
let mut h = demo();
|
||||
// (a landscape photo: a copy in a stack on a narrow portrait one has no room for its tag beside the
|
||||
// stack badge in the filmstrip, which then leaves it out by design)
|
||||
let master = first_photos(&mut h, 12)
|
||||
.into_iter()
|
||||
.find(|id| h.app.session.catalog.photo(*id).is_some_and(|p| p.width > p.height))
|
||||
.expect("a landscape photo");
|
||||
run(&mut h, "photo.virtualCopy", json!({"ids": [master.0]}));
|
||||
let copy = h.app.session.catalog.photos().find(|p| p.copy_name.is_some()).map(|p| p.id).expect("a virtual copy");
|
||||
h.settle(SETTLE);
|
||||
assert!(widget(&h, &format!("copy:{}", copy.0)).is_some(), "the grid tags the copy");
|
||||
assert!(widget(&h, &format!("copy:{}", master.0)).is_none(), "the master is not tagged");
|
||||
let r = h.request("ui.set", json!({"view": "detail"}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
assert!(widget(&h, &format!("film:copy:{}", copy.0)).is_some(), "the filmstrip tags the copy too");
|
||||
assert!(widget(&h, &format!("film:copy:{}", master.0)).is_none(), "and not the master");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_filmstrip_stack_badge_toggles_its_stack_like_the_grid_s() {
|
||||
let mut h = demo();
|
||||
let ids = first_photos(&mut h, 2);
|
||||
run(&mut h, "stack.group", json!({"ids": [ids[0].0, ids[1].0], "collapsed": false}));
|
||||
h.request("ui.set", json!({"view": "detail"}), T);
|
||||
h.settle(SETTLE);
|
||||
let collapsed = |h: &Headless| h.app.session.catalog.stack_of(ids[0]).map(|s| s.collapsed);
|
||||
assert_eq!(collapsed(&h), Some(false));
|
||||
let r = h.request("ui.clickWidget", json!({"id": format!("film:stack:{}", ids[0].0)}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
assert_eq!(collapsed(&h), Some(true), "a click on the filmstrip's badge collapses the stack");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_stack_badge_tooltip_is_translated_in_the_grid_and_the_filmstrip() {
|
||||
let mut h = demo();
|
||||
let ids = first_photos(&mut h, 2);
|
||||
run(&mut h, "stack.group", json!({"ids": [ids[0].0, ids[1].0], "collapsed": false}));
|
||||
h.settle(SETTLE);
|
||||
let r = h.request("ui.set", json!({"language": "de"}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
let german = Locale::De.tr("Stack — click to collapse (S)");
|
||||
let said = |t: &str| t == german;
|
||||
assert!(hover_says(&mut h, &format!("stack:{}", ids[0].0), said), "{:?}", h.painted_text());
|
||||
h.request("ui.move", json!({"x": 1, "y": 1}), T);
|
||||
h.request("ui.set", json!({"view": "detail"}), T);
|
||||
h.settle(SETTLE);
|
||||
assert!(hover_says(&mut h, &format!("film:stack:{}", ids[0].0), said), "{:?}", h.painted_text());
|
||||
crate::i18n::set_language(Locale::En);
|
||||
}
|
||||
|
||||
fn placeholder_in(h: &Headless, cell: Rect) -> bool {
|
||||
let skeleton = crate::theme::Tokens::get(&h.view.ctx).skeleton;
|
||||
h.view.painted_shapes().iter().any(|s| matches!(s, Shape::Rect(r) if r.fill == skeleton && cell.expand(1.0).contains_rect(r.rect)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_thumbnail_that_is_not_drawn_yet_has_the_same_placeholder_in_the_filmstrip_and_the_grid() {
|
||||
let mut h = demo();
|
||||
// renders wait: no thumbnail exists
|
||||
h.app.renderer.set_offload(Box::new(RenderGate::new(Rc::new(Cell::new(false)))));
|
||||
let id = first_photos(&mut h, 1)[0];
|
||||
for _ in 0..10 {
|
||||
h.step();
|
||||
}
|
||||
let grid = widget(&h, &format!("thumb:{}", id.0)).expect("grid cell");
|
||||
assert!(placeholder_in(&h, grid), "the grid's placeholder");
|
||||
h.request("ui.set", json!({"view": "detail"}), T);
|
||||
for _ in 0..10 {
|
||||
h.step();
|
||||
}
|
||||
let film = widget(&h, &format!("film:{}", id.0)).expect("filmstrip cell");
|
||||
assert!(placeholder_in(&h, film), "the filmstrip draws the grid's placeholder too");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_failed_thumbnail_shows_a_mark_that_explains_itself_in_the_grid_and_the_filmstrip() {
|
||||
let mut h = demo();
|
||||
h.app.renderer.set_offload(Box::new(RenderGate::failing(Rc::new(Cell::new(true)), |s| matches!(s, Slot::Thumb(_)))));
|
||||
let id = first_photos(&mut h, 1)[0];
|
||||
let (grid_mark, film_mark) = (format!("badge:failed:{}", id.0), format!("film:failed:{}", id.0));
|
||||
assert!(h.step_until(SETTLE, |h| widget(h, &grid_mark).is_some()), "the grid's mark is a widget");
|
||||
assert!(!h.painted_text().iter().any(|t| t == "!"), "drawn as an icon, not a glyph");
|
||||
let says = |t: &str| t.contains("This photo can't be opened") && t.contains("no decoder for this raw") && t.contains("Reload from Disk");
|
||||
assert!(hover_says(&mut h, &grid_mark, says), "{:?}", h.painted_text());
|
||||
h.request("ui.move", json!({"x": 1, "y": 1}), T);
|
||||
h.request("ui.set", json!({"view": "detail"}), T);
|
||||
assert!(h.step_until(SETTLE, |h| widget(h, &film_mark).is_some()), "the filmstrip draws the mark");
|
||||
assert!(hover_says(&mut h, &film_mark, says), "{:?}", h.painted_text());
|
||||
}
|
||||
|
||||
fn label_dot_in(h: &Headless, cell: Rect) -> bool {
|
||||
let red = crate::theme::label_color(ColorLabel::Red);
|
||||
h.view.painted_shapes().iter().any(|s| matches!(s, Shape::Circle(c) if c.fill == red && cell.contains(c.center)))
|
||||
}
|
||||
|
||||
/// A band along a cell's lower edge the width of the cell: the footer a label once tinted over
|
||||
/// the justified grid's photo.
|
||||
fn footer_band_in(h: &Headless, cell: Rect) -> bool {
|
||||
h.view.painted_shapes().iter().any(|s| {
|
||||
matches!(s, Shape::Rect(r) if (r.rect.width() - cell.width()).abs() < 0.5 && (r.rect.height() - 24.0).abs() < 0.5 && (r.rect.bottom() - cell.bottom()).abs() < 0.5 && r.fill.a() > 0 && r.fill != Color32::from_black_alpha(120))
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_label_is_the_dot_in_the_marks_row_on_every_surface_and_no_footer_covers_the_photo() {
|
||||
let mut h = demo();
|
||||
let id = first_photos(&mut h, 1)[0];
|
||||
run(&mut h, "photo.label", json!({"ids": [id.0], "label": "red"}));
|
||||
// not selected, not hovered: the footer would show on its own
|
||||
let other = first_photos(&mut h, 2)[1];
|
||||
run(&mut h, "library.select", json!({"ids": [other.0]}));
|
||||
h.step();
|
||||
for (view, cell) in [(ViewMode::PhotoGrid, "thumb"), (ViewMode::SquareGrid, "thumb"), (ViewMode::Detail, "film")] {
|
||||
h.app.ui.view = view;
|
||||
h.settle(SETTLE);
|
||||
let r = widget(&h, &format!("{cell}:{}", id.0)).unwrap_or_else(|| panic!("{view:?}: the photo's cell"));
|
||||
assert!(label_dot_in(&h, r), "{view:?}: the label dot");
|
||||
assert!(!footer_band_in(&h, r), "{view:?}: no tinted footer over the photo");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_ratings_and_flags_off_the_justified_grid_still_shows_the_label() {
|
||||
let mut h = demo();
|
||||
let ids = first_photos(&mut h, 2);
|
||||
run(&mut h, "photo.label", json!({"ids": [ids[0].0], "label": "red"}));
|
||||
run(&mut h, "library.select", json!({"ids": [ids[1].0]}));
|
||||
h.app.ui.settings.grid_badges = crate::state::GridBadges::Never;
|
||||
h.settle(SETTLE);
|
||||
let cell = widget(&h, &format!("thumb:{}", ids[0].0)).expect("the photo's cell");
|
||||
assert!(label_dot_in(&h, cell), "the label is not a rating or a flag: it stays, the grid has no surround to tint");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn right_clicking_the_filmstrips_stack_badge_opens_the_photo_menu() {
|
||||
let mut h = demo();
|
||||
let ids = first_photos(&mut h, 2);
|
||||
run(&mut h, "stack.group", json!({"ids": [ids[0].0, ids[1].0], "collapsed": false}));
|
||||
h.request("ui.set", json!({"view": "detail"}), T);
|
||||
h.settle(SETTLE);
|
||||
assert!(!egui::Popup::is_any_open(&h.view.ctx));
|
||||
let r = h.request("ui.clickWidget", json!({"id": format!("film:stack:{}", ids[0].0), "button": "right"}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
assert!(egui::Popup::is_any_open(&h.view.ctx), "the photo's menu, as on the rest of the cell");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn right_clicking_the_grids_stack_badge_opens_the_photo_menu() {
|
||||
let mut h = demo();
|
||||
let ids = first_photos(&mut h, 2);
|
||||
run(&mut h, "stack.group", json!({"ids": [ids[0].0, ids[1].0], "collapsed": false}));
|
||||
h.settle(SETTLE);
|
||||
assert!(!egui::Popup::is_any_open(&h.view.ctx));
|
||||
let r = h.request("ui.clickWidget", json!({"id": format!("stack:{}", ids[0].0), "button": "right"}), T);
|
||||
assert_eq!(r["ok"], true, "{r}");
|
||||
h.settle(SETTLE);
|
||||
assert!(egui::Popup::is_any_open(&h.view.ctx), "the photo's menu, as on the rest of the cell");
|
||||
}
|
||||
|
||||
/// The overlay's wiring: a photo with no marks drawn has nothing for the pill to dodge, so on a
|
||||
/// short 16:9 cell of the square grid at 90 pt (70 x 39) the pill keeps its word.
|
||||
#[test]
|
||||
fn the_preview_pill_keeps_its_word_on_a_short_photo_with_no_marks() {
|
||||
let mut h = demo();
|
||||
let id = first_photos(&mut h, 1)[0];
|
||||
run(&mut h, "photo.rate", json!({"ids": [id.0], "rating": 0}));
|
||||
run(&mut h, "photo.flag", json!({"ids": [id.0], "flag": "none"}));
|
||||
run(&mut h, "photo.label", json!({"ids": [id.0], "label": "none"}));
|
||||
let other = first_photos(&mut h, 2)[1];
|
||||
run(&mut h, "library.select", json!({"ids": [other.0]}));
|
||||
let p = h.app.session.catalog.photo(id).expect("photo").clone();
|
||||
let op = lightcraft_catalog::Op::SetContent {
|
||||
id,
|
||||
width: 1600,
|
||||
height: 900,
|
||||
file_size: p.file_size,
|
||||
content_hash: p.content_hash.clone(),
|
||||
preview_only: Some("Cr3 files are not decoded yet".into()),
|
||||
preview_checked: "0.5.0".into(),
|
||||
};
|
||||
h.app.session.catalog.apply(op).unwrap();
|
||||
// Let every render already under way finish first. The photo's thumbnail was requested on the
|
||||
// job pool before the gate below, and a pool job keeps its request: while it is pending the
|
||||
// grid asks for nothing new, so it lands whenever the worker is done and draws the picture
|
||||
// (on a loaded runner after any fixed number of frames).
|
||||
assert!(h.settle(SETTLE), "the renders started before the gate finish");
|
||||
// no thumbnail: the photo is its placeholder, 16:9. A thumbnail the demo already rendered
|
||||
// would be drawn at the picture's own shape instead (a portrait one leaves the pill no room).
|
||||
h.app.renderer.set_offload(Box::new(RenderGate::new(Rc::new(Cell::new(false)))));
|
||||
h.app.renderer.textures.remove(&Slot::Thumb(id));
|
||||
h.app.renderer.textures.remove(&Slot::ThumbQuick(id));
|
||||
h.app.ui.view = ViewMode::SquareGrid;
|
||||
h.app.ui.thumb_size = 90.0;
|
||||
for _ in 0..10 {
|
||||
h.step();
|
||||
}
|
||||
assert!(h.app.renderer.thumb(id).is_none(), "the photo is still its placeholder");
|
||||
let pill = widget(&h, &format!("badge:previewOnly:{}", id.0)).expect("the pill is drawn");
|
||||
assert!(pill.width() > 30.0, "its word is there, not the icon alone: {pill:?}");
|
||||
}
|
||||
@@ -0,0 +1,926 @@
|
||||
//! The overlay a thumbnail wears, drawn the same way in the justified grid, the square grid and the
|
||||
//! filmstrip: the stack badge (top left), the virtual-copy tag (top right), the failure mark, the
|
||||
//! preview-only pill and the marks row along the photo's lower edge (rating, flag, edited, colour
|
||||
//! label).
|
||||
//!
|
||||
//! Everything is laid out against the picture itself, not its cell, and painted clipped to it: on
|
||||
//! a narrow tile (a portrait photo at the smallest thumbnail size) the marks degrade instead of
|
||||
//! running over the photo's edge (see [`bar_layout`], [`copy_tag_layout`], [`stack_layout`] and
|
||||
//! [`preview_pill_place`], pure functions of the room on offer).
|
||||
|
||||
use egui::{Align2, Color32, Painter, Rect, Sense, Stroke, pos2, vec2};
|
||||
use lightcraft_catalog::{Flag, Photo, PhotoId, StackId};
|
||||
|
||||
use crate::{
|
||||
LightcraftApp,
|
||||
icons::{Icon, paint},
|
||||
theme::Tokens,
|
||||
widgets::register,
|
||||
};
|
||||
|
||||
/// Where a thumbnail is drawn: its marks keep the proportions of the surface.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub(crate) enum Surface {
|
||||
/// The justified and the square grid.
|
||||
Grid,
|
||||
/// The strip under the loupe.
|
||||
Film,
|
||||
}
|
||||
|
||||
/// The sizes, in points, of a surface's marks.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(crate) struct Metrics {
|
||||
/// A star's side and the distance between two, and the shared rating drawing of that size (its
|
||||
/// side and step are the same numbers).
|
||||
star: f32,
|
||||
star_pitch: f32,
|
||||
rating: crate::rating::RatingSize,
|
||||
/// The room a digit takes in a compact rating.
|
||||
digit: f32,
|
||||
/// The flag's icon, and the room it takes (a gap to what is left of it included).
|
||||
flag_icon: f32,
|
||||
flag: f32,
|
||||
/// The edited mark's icon and room.
|
||||
edited_icon: f32,
|
||||
edited: f32,
|
||||
/// The label dot's radius and room.
|
||||
dot: f32,
|
||||
label: f32,
|
||||
/// The marks row's height, its padding at each end and the gap between its two groups.
|
||||
bar: f32,
|
||||
pad: f32,
|
||||
gap: f32,
|
||||
/// How far the corner badges sit from the photo's corner, and how high they are.
|
||||
inset: f32,
|
||||
badge: f32,
|
||||
/// What a stack badge adds to its text (icon and padding), and what a copy tag adds to its
|
||||
/// name; a copy tag without its name is `copy_icon` wide.
|
||||
stack_extra: f32,
|
||||
copy_extra: f32,
|
||||
copy_icon: f32,
|
||||
/// What the preview pill adds to its text; without its text it is `pill_icon` wide.
|
||||
pill_extra: f32,
|
||||
pill_icon: f32,
|
||||
font: f32,
|
||||
micro: f32,
|
||||
/// Whether a band darkens the row under any marks (the filmstrip's), not only under the pointer
|
||||
/// and on a chosen photo (the grid's).
|
||||
band: bool,
|
||||
}
|
||||
|
||||
impl Surface {
|
||||
pub(crate) fn metrics(self) -> Metrics {
|
||||
match self {
|
||||
Surface::Grid => Metrics {
|
||||
star: 12.0,
|
||||
star_pitch: 13.0,
|
||||
rating: crate::rating::RatingSize::Medium,
|
||||
digit: 7.0,
|
||||
flag_icon: 14.0,
|
||||
flag: 18.0,
|
||||
edited_icon: 14.0,
|
||||
edited: 20.0,
|
||||
dot: 5.0,
|
||||
label: 14.0,
|
||||
bar: 24.0,
|
||||
pad: 4.0,
|
||||
gap: 6.0,
|
||||
inset: 5.0,
|
||||
badge: 20.0,
|
||||
stack_extra: 30.0,
|
||||
copy_extra: 26.0,
|
||||
copy_icon: 20.0,
|
||||
pill_extra: 24.0,
|
||||
pill_icon: 16.0,
|
||||
font: 11.0,
|
||||
micro: 9.5,
|
||||
band: false,
|
||||
},
|
||||
Surface::Film => Metrics {
|
||||
star: 8.0,
|
||||
star_pitch: 9.0,
|
||||
rating: crate::rating::RatingSize::Small,
|
||||
digit: 5.0,
|
||||
flag_icon: 10.0,
|
||||
flag: 12.0,
|
||||
edited_icon: 10.0,
|
||||
edited: 14.0,
|
||||
dot: 3.5,
|
||||
label: 10.0,
|
||||
bar: 15.0,
|
||||
pad: 3.0,
|
||||
gap: 4.0,
|
||||
inset: 3.0,
|
||||
badge: 15.0,
|
||||
stack_extra: 22.0,
|
||||
copy_extra: 20.0,
|
||||
copy_icon: 16.0,
|
||||
pill_extra: 20.0,
|
||||
pill_icon: 14.0,
|
||||
font: 9.5,
|
||||
micro: 8.5,
|
||||
band: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// The widget ids of a surface: the grid's keep their names, the filmstrip's start with `film:`.
|
||||
fn widget(self, kind: Mark, id: PhotoId) -> String {
|
||||
let (grid, film) = match kind {
|
||||
Mark::Stack => ("stack", "film:stack"),
|
||||
Mark::Copy => ("copy", "film:copy"),
|
||||
Mark::Preview => ("badge:previewOnly", "film:previewOnly"),
|
||||
Mark::Failed => ("badge:failed", "film:failed"),
|
||||
};
|
||||
format!("{}:{}", if self == Surface::Grid { grid } else { film }, id.0)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
enum Mark {
|
||||
Stack,
|
||||
Copy,
|
||||
Preview,
|
||||
Failed,
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------ the marks row
|
||||
|
||||
/// What a photo carries along its lower edge.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub(crate) struct Marks {
|
||||
pub rating: u8,
|
||||
pub flag: bool,
|
||||
pub edited: bool,
|
||||
pub label: bool,
|
||||
}
|
||||
|
||||
impl Marks {
|
||||
pub(crate) fn of(photo: &Photo) -> Self {
|
||||
Marks { rating: photo.rating.min(5), flag: photo.flag != Flag::None, edited: photo.is_edited(), label: photo.label.is_some() }
|
||||
}
|
||||
}
|
||||
|
||||
/// How the rating is drawn.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub(crate) enum Stars {
|
||||
#[default]
|
||||
None,
|
||||
/// One star per point of the rating.
|
||||
Row(u8),
|
||||
/// One star and the number: "★3".
|
||||
Compact(u8),
|
||||
}
|
||||
|
||||
/// Which marks a row draws.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub(crate) struct BarLayout {
|
||||
pub stars: Stars,
|
||||
pub flag: bool,
|
||||
pub edited: bool,
|
||||
pub label: bool,
|
||||
}
|
||||
|
||||
impl BarLayout {
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
*self == BarLayout::default()
|
||||
}
|
||||
|
||||
/// The width the row takes, its padding included; 0 for an empty row.
|
||||
pub(crate) fn width(&self, m: &Metrics) -> f32 {
|
||||
let stars = match self.stars {
|
||||
Stars::None => 0.0,
|
||||
Stars::Row(n) => f32::from(n) * m.star_pitch,
|
||||
Stars::Compact(_) => m.star + 1.0 + m.digit,
|
||||
};
|
||||
let left = stars + if self.flag { m.flag } else { 0.0 };
|
||||
let right = if self.edited { m.edited } else { 0.0 } + if self.label { m.label } else { 0.0 };
|
||||
if left + right == 0.0 {
|
||||
return 0.0;
|
||||
}
|
||||
left + right + if left > 0.0 && right > 0.0 { m.gap } else { 0.0 } + 2.0 * m.pad
|
||||
}
|
||||
|
||||
fn fits(&self, width: f32, m: &Metrics) -> bool {
|
||||
self.width(m) <= width
|
||||
}
|
||||
}
|
||||
|
||||
/// The marks a photo `width` points wide has room for, as the tile narrows: first all of them;
|
||||
/// then without the edited mark; then the stars as one star and the number; then only what fits
|
||||
/// whole, by importance: the flag, the rating, the label. Where the surface has no surround to
|
||||
/// tint (`label_first`) the label is the only sign of the label, so it comes first.
|
||||
pub(crate) fn bar_layout(width: f32, marks: Marks, m: &Metrics, label_first: bool) -> BarLayout {
|
||||
let stars = if marks.rating > 0 { Stars::Row(marks.rating) } else { Stars::None };
|
||||
let full = BarLayout { stars, flag: marks.flag, edited: marks.edited, label: marks.label };
|
||||
if full.fits(width, m) {
|
||||
return full;
|
||||
}
|
||||
let plain = BarLayout { edited: false, ..full };
|
||||
if plain.fits(width, m) {
|
||||
return plain;
|
||||
}
|
||||
// (one star is already as small as a rating gets)
|
||||
let compact = if marks.rating > 1 { Stars::Compact(marks.rating) } else { stars };
|
||||
let squeezed = BarLayout { stars: compact, ..plain };
|
||||
if squeezed.fits(width, m) {
|
||||
return squeezed;
|
||||
}
|
||||
#[derive(Clone, Copy)]
|
||||
enum Item {
|
||||
Flag,
|
||||
Stars,
|
||||
Label,
|
||||
}
|
||||
let order = if label_first { [Item::Label, Item::Flag, Item::Stars] } else { [Item::Flag, Item::Stars, Item::Label] };
|
||||
let mut out = BarLayout::default();
|
||||
for item in order {
|
||||
let next = match item {
|
||||
Item::Flag if marks.flag => BarLayout { flag: true, ..out },
|
||||
Item::Stars if compact != Stars::None => BarLayout { stars: compact, ..out },
|
||||
Item::Label if marks.label => BarLayout { label: true, ..out },
|
||||
_ => continue,
|
||||
};
|
||||
if next.fits(width, m) {
|
||||
out = next;
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------ the corner badges
|
||||
|
||||
/// How the virtual-copy tag is drawn.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum CopyTag {
|
||||
/// The icon and the copy's name.
|
||||
Full,
|
||||
/// The icon alone.
|
||||
IconOnly,
|
||||
/// No room: the stack badge, or the photo's edge, is in the way.
|
||||
Hidden,
|
||||
}
|
||||
|
||||
/// The least clear space between the stack badge and the copy tag.
|
||||
const COPY_GAP: f32 = 4.0;
|
||||
|
||||
/// The copy tag for a photo `width` wide whose name is `name_w` wide, next to a stack badge
|
||||
/// `stack_w` wide (if it has one): the tag gives up its name before it would run into the badge
|
||||
/// or over the photo's edge, and then gives up its icon.
|
||||
pub(crate) fn copy_tag_layout(width: f32, stack_w: Option<f32>, name_w: f32, m: &Metrics) -> CopyTag {
|
||||
let room = width - 2.0 * m.inset - stack_w.map_or(0.0, |w| w + COPY_GAP);
|
||||
if name_w + m.copy_extra <= room {
|
||||
CopyTag::Full
|
||||
} else if m.copy_icon <= room {
|
||||
CopyTag::IconOnly
|
||||
} else {
|
||||
CopyTag::Hidden
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the preview-only pill goes.
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub(crate) struct PillPlace {
|
||||
pub rect: Rect,
|
||||
/// With its word, else the icon alone.
|
||||
pub full: bool,
|
||||
}
|
||||
|
||||
/// Where the preview-only pill goes on `photo`: above the marks row if that is clear, else below
|
||||
/// the stack badge `stack`, else beside it as the icon alone. `hard` are what it must never cover
|
||||
/// (the stack badge, the copy tag), `soft` what it may sit over when nothing else is clear (the
|
||||
/// marks strip, whose marks are drawn at its ends). Order: a spot clear of both, then one clear of
|
||||
/// `hard`, then, as it changes what editing does and so is never hidden, the icon at the first
|
||||
/// spot. The word goes before the icon.
|
||||
pub(crate) fn preview_pill_place(photo: Rect, text_w: f32, stack: Option<Rect>, hard: &[Rect], soft: &[Rect], m: &Metrics) -> PillPlace {
|
||||
let h = m.pill_icon;
|
||||
let x = photo.left() + m.inset;
|
||||
let above = (photo.bottom() - m.bar - 4.0 - h).max(photo.top() + m.inset);
|
||||
let mut tries = vec![(pos2(x, above), true), (pos2(x, above), false)];
|
||||
if let Some(s) = stack {
|
||||
let below = s.bottom() + 3.0;
|
||||
tries.extend([(pos2(x, below), true), (pos2(x, below), false), (pos2(s.right() + 3.0, s.top()), false)]);
|
||||
}
|
||||
let overlap = |a: Rect, b: Rect| a.min.x < b.max.x && b.min.x < a.max.x && a.min.y < b.max.y && b.min.y < a.max.y;
|
||||
let spots: Vec<PillPlace> = tries
|
||||
.into_iter()
|
||||
.map(|(at, full)| PillPlace { rect: Rect::from_min_size(at, vec2(if full { text_w + m.pill_extra } else { h }, h)), full })
|
||||
.filter(|p| {
|
||||
let r = p.rect;
|
||||
r.left() >= photo.left() && r.right() <= photo.right() - m.inset && r.top() >= photo.top() && r.bottom() <= photo.bottom()
|
||||
})
|
||||
.collect();
|
||||
let clear = |p: &&PillPlace, of: &[&[Rect]]| !of.iter().any(|set| set.iter().any(|o| overlap(p.rect, *o)));
|
||||
spots
|
||||
.iter()
|
||||
.find(|p| clear(p, &[hard, soft]))
|
||||
.or_else(|| spots.iter().find(|p| clear(p, &[hard])))
|
||||
.copied()
|
||||
.unwrap_or(PillPlace { rect: Rect::from_min_size(pos2(x, above), vec2(h, h)), full: false })
|
||||
}
|
||||
|
||||
/// The strip the marks row covers: `None` when it draws nothing (no marks that fit, and no band
|
||||
/// under the pointer or on a chosen photo), so that nothing else keeps clear of it.
|
||||
pub(crate) fn marks_extent(rect: Rect, marks: Marks, hot: bool, only_label: bool, label_first: bool, m: &Metrics) -> Option<Rect> {
|
||||
let layout = bar_layout(rect.width(), marks, m, label_first);
|
||||
(!layout.is_empty() || (!only_label && hot)).then(|| marks_bar(rect, m))
|
||||
}
|
||||
|
||||
/// How the stack badge is drawn.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum StackShape {
|
||||
/// Icon and `i/n` (or the count on a collapsed stack's top).
|
||||
Full,
|
||||
/// `i/n` without the icon.
|
||||
NoIcon,
|
||||
/// The count alone.
|
||||
CountOnly,
|
||||
}
|
||||
|
||||
/// The stack badge for `room` points (the photo's width less its two insets), whose text is
|
||||
/// `full_w` wide and its count alone `count_w`: the shape and the width. The count alone is the
|
||||
/// last shape; when even it is wider than the room the badge is drawn clipped to the photo.
|
||||
pub(crate) fn stack_layout(room: f32, full_w: f32, count_w: f32, m: &Metrics) -> (StackShape, f32) {
|
||||
let pad = 2.0 * m.pad + 2.0;
|
||||
let full = full_w + m.stack_extra;
|
||||
let bare = full_w + pad;
|
||||
if full <= room {
|
||||
(StackShape::Full, full)
|
||||
} else if bare <= room {
|
||||
(StackShape::NoIcon, bare)
|
||||
} else {
|
||||
(StackShape::CountOnly, count_w + pad)
|
||||
}
|
||||
}
|
||||
|
||||
/// The marks row's strip along the photo's lower edge.
|
||||
fn marks_bar(rect: Rect, m: &Metrics) -> Rect {
|
||||
Rect::from_min_max(pos2(rect.left(), (rect.bottom() - m.bar).max(rect.top())), rect.right_bottom())
|
||||
}
|
||||
|
||||
/// The overlay's painter: nothing is painted outside the photo.
|
||||
fn clipped(ui: &egui::Ui, th: &Thumb) -> Painter {
|
||||
let p = ui.painter();
|
||||
p.with_clip_rect(th.rect.intersect(p.clip_rect()))
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------ texts
|
||||
|
||||
/// What a screen reader says of a rating: the number follows its label, so that it reads right in
|
||||
/// every language whatever its plural forms (no "star"/"stars" suffix to pick).
|
||||
pub(crate) fn spoken_rating(rating: u8) -> String {
|
||||
crate::i18n::tr_format!(", rating {} of 5", rating)
|
||||
}
|
||||
|
||||
/// What the failure mark says on hover: why the photo has no thumbnail, in plain words, where to
|
||||
/// go from there, and the error itself. (The loupe's pill uses the same two headlines.)
|
||||
pub(crate) fn failure_text(offline: bool, error: &str) -> String {
|
||||
let (head, hint) = if offline {
|
||||
(crate::i18n::tr("Original offline · no smart preview"), crate::i18n::tr("Right-click ▸ Locate Missing File… to find it again."))
|
||||
} else {
|
||||
(crate::i18n::tr("This photo can't be opened"), crate::i18n::tr("Right-click ▸ Reload from Disk to try again."))
|
||||
};
|
||||
format!("{head}\n{hint}\n{error}")
|
||||
}
|
||||
|
||||
fn stack_tip(collapsed: bool) -> &'static str {
|
||||
crate::i18n::tr(if collapsed { "Stack — click to expand (S)" } else { "Stack — click to collapse (S)" })
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------ placeholder
|
||||
|
||||
/// Where a photo of `aspect` (width / height) sits in `area`, when its thumbnail is not drawn yet.
|
||||
pub(crate) fn placeholder_rect(area: Rect, aspect: f32) -> Rect {
|
||||
let aspect = if aspect.is_finite() && aspect > 0.0 { aspect } else { 1.5 };
|
||||
let (w, h) = if area.width() / aspect <= area.height() { (area.width(), area.width() / aspect) } else { (area.height() * aspect, area.height()) };
|
||||
Rect::from_center_size(area.center(), vec2(w, h))
|
||||
}
|
||||
|
||||
/// The picture's stand-in: the theme's skeleton color (firmer than the cell on the light themes).
|
||||
pub(crate) fn paint_placeholder(p: &Painter, rect: Rect, t: &Tokens) {
|
||||
p.rect_filled(rect, 0.0, t.skeleton);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------ the overlay
|
||||
|
||||
/// One thumbnail to put the overlay on.
|
||||
pub(crate) struct Thumb<'a> {
|
||||
pub surface: Surface,
|
||||
pub photo: &'a Photo,
|
||||
/// The picture (or the placeholder standing for it) on screen.
|
||||
pub rect: Rect,
|
||||
/// The photo's stack and its place in it.
|
||||
pub stack: Option<(StackId, usize)>,
|
||||
/// Whether the marks row is drawn (Settings → Interface).
|
||||
pub marks: bool,
|
||||
/// Whether the stars and the edited mark are in it (the grid's Stars on hover shows only the
|
||||
/// flag and the colour label until the photo is hovered or chosen).
|
||||
pub extras: bool,
|
||||
/// The pointer is over the cell, or it is chosen: the row's band shows even without marks.
|
||||
pub hot: bool,
|
||||
/// Why the thumbnail could not be drawn, when it could not.
|
||||
pub failure: Option<String>,
|
||||
/// Whether the surface tints the cell around the photo with its colour label (the square grid
|
||||
/// and the filmstrip do; the justified grid has no surround).
|
||||
pub surround: bool,
|
||||
}
|
||||
|
||||
/// Draws the overlay; returns the stack badge's response, which covers part of the cell, so that
|
||||
/// its caller can give it the cell's context menu.
|
||||
pub(crate) fn overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, th: &Thumb) -> Option<egui::Response> {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let m = th.surface.metrics();
|
||||
let photo = th.photo;
|
||||
let p = clipped(ui, th);
|
||||
let rect = th.rect;
|
||||
// (a rejected photo is dimmed under its marks, not over them)
|
||||
if photo.flag == Flag::Reject {
|
||||
p.rect_filled(rect, 0.0, Color32::from_black_alpha(110));
|
||||
}
|
||||
if let Some(error) = &th.failure {
|
||||
failure_mark(app, ui, th, &t, error);
|
||||
}
|
||||
let bar = if th.marks {
|
||||
marks_row(ui.ctx(), &p, &t, &m, th, false)
|
||||
} else if !th.surround && photo.label.is_some() {
|
||||
// the setting is about ratings and flags: where no tinted surround says the label, its dot stays
|
||||
marks_row(ui.ctx(), &p, &t, &m, th, true)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let stack = th.stack.and_then(|(sid, pos)| stack_badge(app, ui, th, &t, sid, pos));
|
||||
let stack_rect = stack.as_ref().map(|(r, _)| *r);
|
||||
let mut hard: Vec<Rect> = stack_rect.into_iter().collect();
|
||||
if let Some(name) = &photo.copy_name {
|
||||
hard.extend(copy_tag(ui, th, &t, name, stack_rect.map(|r| r.width())));
|
||||
}
|
||||
if let Some(why) = &photo.preview_only {
|
||||
preview_pill(ui, th, &t, why, stack_rect, &hard, bar.as_slice());
|
||||
}
|
||||
stack.map(|(_, r)| r)
|
||||
}
|
||||
|
||||
fn failure_mark(app: &LightcraftApp, ui: &mut egui::Ui, th: &Thumb, t: &Tokens, error: &str) {
|
||||
let id = th.photo.id;
|
||||
let side = (th.rect.width().min(th.rect.height()) * 0.4).clamp(12.0, 22.0);
|
||||
let icon = Rect::from_center_size(th.rect.center(), vec2(side, side));
|
||||
// (the text colour: it stands 3:1 on every theme's placeholder, which the amber does not on the light ones)
|
||||
paint(&clipped(ui, th), icon, Icon::Warning, t.text);
|
||||
let target = icon.expand(4.0).intersect(th.rect);
|
||||
register(ui, th.surface.widget(Mark::Failed, id), target);
|
||||
let offline = matches!(&th.photo.source, lightcraft_catalog::Source::File { path } if app.session.media.availability.is_offline(path));
|
||||
let text = failure_text(offline, error);
|
||||
let resp = ui.interact(target, egui::Id::unique((th.surface, "thumb-failed", id.0)), Sense::hover()).on_hover_text(&text);
|
||||
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Label, true, text.replace('\n', ": ")));
|
||||
}
|
||||
|
||||
/// Draws the marks row; returns the strip it covers, if it drew anything.
|
||||
fn marks_row(ctx: &egui::Context, p: &Painter, t: &Tokens, m: &Metrics, th: &Thumb, only_label: bool) -> Option<Rect> {
|
||||
let (photo, rect) = (th.photo, th.rect);
|
||||
// (each mark drawn is registered as `badge:{name}:{id}`, in the filmstrip `film:badge:…`)
|
||||
let mark = |name: &str, at: Rect| {
|
||||
let prefix = if th.surface == Surface::Grid { "badge" } else { "film:badge" };
|
||||
// painted only, nothing here takes a click: geometry, not a widget
|
||||
crate::widgets::register_geometry(ctx, format!("{prefix}:{name}:{}", photo.id.0), at);
|
||||
};
|
||||
let marks = if only_label {
|
||||
Marks { label: true, ..Marks::default() }
|
||||
} else if th.extras {
|
||||
Marks::of(photo)
|
||||
} else {
|
||||
Marks { rating: 0, edited: false, ..Marks::of(photo) }
|
||||
};
|
||||
let layout = bar_layout(rect.width(), marks, m, !th.surround);
|
||||
let bar = marks_extent(rect, marks, th.hot, only_label, !th.surround, m)?;
|
||||
if !only_label && (th.hot || m.band) {
|
||||
p.rect_filled(bar, 0.0, Color32::from_black_alpha(120));
|
||||
}
|
||||
let y = bar.center().y;
|
||||
let mut x = bar.left() + m.pad;
|
||||
match layout.stars {
|
||||
Stars::None => {}
|
||||
Stars::Row(n) => {
|
||||
let width = crate::rating::paint_rating(p, pos2(x, y), n, m.rating, t.star);
|
||||
mark("stars", Rect::from_min_size(pos2(x, y - m.star / 2.0), vec2(width, m.star)));
|
||||
x += width;
|
||||
}
|
||||
Stars::Compact(n) => {
|
||||
paint(p, Rect::from_min_size(pos2(x, y - m.star / 2.0), vec2(m.star, m.star)), Icon::StarFilled, t.star);
|
||||
p.text(pos2(x + m.star + 1.0, y), Align2::LEFT_CENTER, n.to_string(), t.semibold(m.font), t.star);
|
||||
mark("stars", Rect::from_min_size(pos2(x, y - m.star / 2.0), vec2(m.star + 1.0 + m.digit, m.star)));
|
||||
x += m.star + 1.0 + m.digit;
|
||||
}
|
||||
}
|
||||
if layout.flag {
|
||||
let at = Rect::from_min_size(pos2(x + m.flag - m.flag_icon, y - m.flag_icon / 2.0), vec2(m.flag_icon, m.flag_icon));
|
||||
match photo.flag {
|
||||
Flag::Pick => paint(p, at, Icon::FlagPickFilled, t.pick),
|
||||
Flag::Reject => paint(p, at, Icon::FlagReject, t.reject),
|
||||
Flag::None => {}
|
||||
}
|
||||
mark("flag", at);
|
||||
}
|
||||
let mut right = bar.right() - m.pad;
|
||||
if layout.label
|
||||
&& let Some(l) = photo.label
|
||||
{
|
||||
p.circle(pos2(right - m.label / 2.0, y), m.dot, crate::theme::label_color(l), Stroke::new(1.0, Color32::from_black_alpha(120)));
|
||||
mark("label", Rect::from_center_size(pos2(right - m.label / 2.0, y), vec2(m.label, m.label)));
|
||||
right -= m.label;
|
||||
}
|
||||
if layout.edited {
|
||||
let at = Rect::from_center_size(pos2(right - m.edited / 2.0, y), vec2(m.edited_icon, m.edited_icon));
|
||||
paint(p, at, Icon::Sliders, t.text_label);
|
||||
mark("edited", at);
|
||||
}
|
||||
Some(bar)
|
||||
}
|
||||
|
||||
/// The stack badge at the photo's top left: the number of photos on a collapsed stack's top,
|
||||
/// `i/n` on the members of an expanded one; a click collapses or expands the stack. It gives up
|
||||
/// its icon, then the `i/` of `i/n`, on a narrow photo, and is never painted outside the photo.
|
||||
/// Returns the badge's rectangle (as laid out, before clipping) and its response.
|
||||
fn stack_badge(app: &mut LightcraftApp, ui: &mut egui::Ui, th: &Thumb, t: &Tokens, sid: StackId, pos: usize) -> Option<(Rect, egui::Response)> {
|
||||
let m = th.surface.metrics();
|
||||
let st = app.session.catalog.stack(sid)?;
|
||||
let (n, collapsed) = (st.photos.len(), st.collapsed);
|
||||
let id = th.photo.id;
|
||||
let p = clipped(ui, th);
|
||||
let count = p.layout_no_wrap(n.to_string(), t.semibold(m.font), Color32::WHITE);
|
||||
let full = if collapsed { count.clone() } else { p.layout_no_wrap(format!("{}/{n}", pos + 1), t.semibold(m.font), Color32::WHITE) };
|
||||
let (shape, w) = stack_layout(th.rect.width() - 2.0 * m.inset, full.size().x, count.size().x, &m);
|
||||
let br = Rect::from_min_size(th.rect.min + vec2(m.inset, m.inset), vec2(w, m.badge));
|
||||
let hit = br.intersect(th.rect);
|
||||
let resp = ui.interact(hit, egui::Id::unique((th.surface, "stack-badge", id.0)), Sense::click()).on_hover_text(stack_tip(collapsed));
|
||||
// a button to assistive technology, named as its tooltip (the click is handled by the caller)
|
||||
resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, stack_tip(collapsed)));
|
||||
register(ui, th.surface.widget(Mark::Stack, id), hit);
|
||||
let fill = if resp.hovered() { Color32::from_black_alpha(220) } else { Color32::from_black_alpha(165) };
|
||||
p.rect_filled(br, m.badge / 2.0, fill);
|
||||
if pos == 0 && !collapsed {
|
||||
p.rect_stroke(br, m.badge / 2.0, Stroke::new(1.0, t.accent), egui::StrokeKind::Inside);
|
||||
}
|
||||
let text = if shape == StackShape::CountOnly { count } else { full };
|
||||
match shape {
|
||||
StackShape::Full => {
|
||||
let icon = m.badge - 6.0;
|
||||
paint(&p, Rect::from_min_size(br.min + vec2(m.badge * 0.3, 3.0), vec2(icon, icon)), Icon::Stack, Color32::WHITE);
|
||||
p.galley(pos2(br.min.x + m.stack_extra - 6.0, br.center().y - text.size().y / 2.0), text, Color32::WHITE);
|
||||
}
|
||||
StackShape::NoIcon | StackShape::CountOnly => {
|
||||
p.galley(br.center() - text.size() / 2.0, text, Color32::WHITE);
|
||||
}
|
||||
}
|
||||
// a double-click (Lightroom's way) toggles once: its second click would undo the first
|
||||
if resp.clicked() && !resp.double_clicked() {
|
||||
crate::panels::grid::toggle_stack(app, ui.ctx(), id);
|
||||
}
|
||||
Some((br, resp))
|
||||
}
|
||||
|
||||
/// The virtual-copy tag at the photo's top right, so that a copy and its master tell apart.
|
||||
/// Returns where it is, when it is drawn.
|
||||
fn copy_tag(ui: &mut egui::Ui, th: &Thumb, t: &Tokens, name: &str, stack_w: Option<f32>) -> Option<Rect> {
|
||||
let m = th.surface.metrics();
|
||||
let p = clipped(ui, th);
|
||||
let g = p.layout_no_wrap(name.to_string(), t.semibold(m.micro + 1.0), Color32::WHITE);
|
||||
let mode = copy_tag_layout(th.rect.width(), stack_w, g.size().x, &m);
|
||||
let w = match mode {
|
||||
CopyTag::Full => g.size().x + m.copy_extra,
|
||||
CopyTag::IconOnly => m.copy_icon,
|
||||
CopyTag::Hidden => return None,
|
||||
};
|
||||
let br = Rect::from_min_size(pos2(th.rect.right() - m.inset - w, th.rect.top() + m.inset), vec2(w, m.badge));
|
||||
p.rect_filled(br, m.badge / 2.0, Color32::from_black_alpha(165));
|
||||
let icon = m.badge * 0.55;
|
||||
let at = if mode == CopyTag::Full { pos2(br.left() + m.badge * 0.65, br.center().y) } else { br.center() };
|
||||
paint(&p, Rect::from_center_size(at, vec2(icon, icon)), Icon::VirtualCopy, Color32::WHITE);
|
||||
if mode == CopyTag::Full {
|
||||
p.galley(pos2(br.left() + m.copy_extra - 4.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE);
|
||||
}
|
||||
let id = th.photo.id;
|
||||
register(ui, th.surface.widget(Mark::Copy, id), br);
|
||||
let tip = format!("{}: {name}", crate::i18n::tr("Virtual copy"));
|
||||
ui.interact(br, egui::Id::unique((th.surface, "copy-tag", id.0)), Sense::hover())
|
||||
.on_hover_text(&tip)
|
||||
.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Label, true, &tip));
|
||||
Some(br)
|
||||
}
|
||||
|
||||
/// A raw shown from its embedded JPEG: a small amber "Preview" pill above the marks row, always
|
||||
/// shown (it changes what editing does) wherever it fits clear of the other marks.
|
||||
fn preview_pill(ui: &mut egui::Ui, th: &Thumb, t: &Tokens, why: &str, stack: Option<Rect>, hard: &[Rect], soft: &[Rect]) {
|
||||
let m = th.surface.metrics();
|
||||
let p = clipped(ui, th);
|
||||
let g = p.layout_no_wrap(crate::i18n::tr("Preview").into(), t.semibold(m.micro), Color32::WHITE);
|
||||
let place = preview_pill_place(th.rect, g.size().x, stack, hard, soft, &m);
|
||||
let (br, full, h) = (place.rect, place.full, place.rect.height());
|
||||
p.rect_filled(br, h / 2.0, Color32::from_black_alpha(170));
|
||||
let icon = h - 4.0;
|
||||
let centre = if full { pos2(br.left() + h * 0.55, br.center().y) } else { br.center() };
|
||||
paint(&p, Rect::from_center_size(centre, vec2(icon, icon)), Icon::Info, t.caution);
|
||||
if full {
|
||||
p.galley(pos2(br.left() + h * 0.55 + icon / 2.0 + 2.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE);
|
||||
}
|
||||
let id = th.photo.id;
|
||||
register(ui, th.surface.widget(Mark::Preview, id), br);
|
||||
ui.interact(br, egui::Id::unique((th.surface, "preview-only-badge", id.0)), Sense::hover())
|
||||
.on_hover_text(crate::i18n::tr_format!("Preview only — {}", crate::widgets::preview_only_explanation(why)));
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// The marks band sits on the photo itself — a portrait's fitted rect is narrower than the
|
||||
/// cell's image area, a landscape's is shorter — so it never sticks out past the photo or
|
||||
/// crosses its selection frame (#3601).
|
||||
#[test]
|
||||
fn the_marks_band_stays_on_the_photo() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let cell = Rect::from_min_size(pos2(10.0, 24.0), vec2(180.0, 180.0));
|
||||
// A photo that fills the image area: the band is the usual footer
|
||||
let full = marks_bar(cell, &m);
|
||||
assert!((full.height() - m.bar).abs() < 0.01, "{full:?}");
|
||||
assert!((full.bottom() - cell.bottom()).abs() < 0.01);
|
||||
assert!((full.left() - cell.left()).abs() < 0.01 && (full.right() - cell.right()).abs() < 0.01);
|
||||
// A portrait photo fitted inside it: the band is no wider than the photo
|
||||
let portrait = Rect::from_min_size(pos2(cell.left() + 55.0, cell.top()), vec2(70.0, 180.0));
|
||||
let bar = marks_bar(portrait, &m);
|
||||
assert!(bar.left() >= portrait.left() && bar.right() <= portrait.right(), "{bar:?}");
|
||||
assert!((bar.height() - m.bar).abs() < 0.01);
|
||||
// A landscape photo shorter than the band: its own top edge, never a negative rect
|
||||
let wide = Rect::from_min_size(pos2(cell.left(), cell.top() + 80.0), vec2(180.0, 20.0));
|
||||
let bar = marks_bar(wide, &m);
|
||||
assert!((bar.top() - wide.top()).abs() < 0.01, "{bar:?}");
|
||||
assert!(bar.bottom() <= wide.bottom() + 0.01);
|
||||
}
|
||||
|
||||
fn all_marks() -> Vec<Marks> {
|
||||
let mut out = Vec::new();
|
||||
for rating in 0..=5 {
|
||||
for bits in 0..8u8 {
|
||||
out.push(Marks { rating, flag: bits & 1 != 0, edited: bits & 2 != 0, label: bits & 4 != 0 });
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_wide_tile_draws_every_mark() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let marks = Marks { rating: 5, flag: true, edited: true, label: true };
|
||||
let l = bar_layout(300.0, marks, &m, false);
|
||||
assert_eq!(l, BarLayout { stars: Stars::Row(5), flag: true, edited: true, label: true });
|
||||
}
|
||||
|
||||
/// As the photo narrows, the edited mark goes first, then the stars shrink to one star and the
|
||||
/// number, and the rest is kept only as far as it fits whole.
|
||||
#[test]
|
||||
fn marks_degrade_in_order_as_the_tile_narrows() {
|
||||
for surface in [Surface::Grid, Surface::Film] {
|
||||
let m = surface.metrics();
|
||||
let marks = Marks { rating: 5, flag: true, edited: true, label: true };
|
||||
let full = bar_layout(1000.0, marks, &m, false);
|
||||
let w_full = full.width(&m);
|
||||
let no_edit = bar_layout(w_full - 0.5, marks, &m, false);
|
||||
assert_eq!(no_edit, BarLayout { edited: false, ..full }, "{surface:?}: the edited mark goes first");
|
||||
let w_plain = no_edit.width(&m);
|
||||
let compact = bar_layout(w_plain - 0.5, marks, &m, false);
|
||||
assert_eq!(compact.stars, Stars::Compact(5), "{surface:?}: then the stars collapse");
|
||||
assert!(compact.flag && compact.label && !compact.edited, "{surface:?}: and nothing else is lost yet: {compact:?}");
|
||||
let w_compact = compact.width(&m);
|
||||
let fewer = bar_layout(w_compact - 0.5, marks, &m, false);
|
||||
assert!(fewer.width(&m) <= w_compact - 0.5, "{surface:?}: what is drawn fits");
|
||||
assert!(fewer.flag, "{surface:?}: the flag outlasts the label: {fewer:?}");
|
||||
assert!(!fewer.label, "{surface:?}: the label is the first to go: {fewer:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Whatever is drawn is drawn whole: the row never needs more than the photo's width.
|
||||
#[test]
|
||||
fn the_marks_row_never_outgrows_the_photo() {
|
||||
for surface in [Surface::Grid, Surface::Film] {
|
||||
let m = surface.metrics();
|
||||
for marks in all_marks() {
|
||||
for w in 0..400 {
|
||||
let first = bar_layout(w as f32, marks, &m, true);
|
||||
assert!(first.width(&m) <= w as f32, "{surface:?} {marks:?} at {w} (label first): {first:?}");
|
||||
let l = bar_layout(w as f32, marks, &m, false);
|
||||
assert!(l.width(&m) <= w as f32, "{surface:?} {marks:?} at {w}: {l:?} needs {}", l.width(&m));
|
||||
if l.edited {
|
||||
assert!(marks.edited && l == bar_layout(1000.0, marks, &m, false), "the edited mark only shows alongside all the others");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A portrait photo at the smallest thumbnail size with five stars and a flag: the case that
|
||||
/// ran over the photo's edge.
|
||||
#[test]
|
||||
fn a_narrow_portrait_with_five_stars_and_a_flag_keeps_what_fits() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let marks = Marks { rating: 5, flag: true, edited: false, label: false };
|
||||
// justified rows 90 pt high: a 2:3 portrait is 60 wide
|
||||
let l = bar_layout(60.0, marks, &m, false);
|
||||
assert_eq!(l, BarLayout { stars: Stars::Compact(5), flag: true, edited: false, label: false });
|
||||
// a square cell 90 pt wide leaves a 70 × 56 area for the photo: 37 wide
|
||||
let narrow = bar_layout(56.0 * 2.0 / 3.0, marks, &m, false);
|
||||
assert!(narrow.width(&m) <= 56.0 * 2.0 / 3.0 && narrow.flag, "{narrow:?}");
|
||||
assert_ne!(narrow.stars, Stars::Row(5), "five whole stars (65 pt) cannot fit 37");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn one_star_stays_one_star() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let marks = Marks { rating: 1, flag: false, edited: false, label: false };
|
||||
assert_eq!(bar_layout(m.star_pitch + 2.0 * m.pad, marks, &m, false).stars, Stars::Row(1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_copy_tag_gives_up_its_name_then_its_icon_before_it_meets_the_stack_badge() {
|
||||
for surface in [Surface::Grid, Surface::Film] {
|
||||
let m = surface.metrics();
|
||||
let (stack_w, name_w) = (44.0, 50.0);
|
||||
let mut seen = Vec::new();
|
||||
for w in (0..300).step_by(1) {
|
||||
let width = w as f32;
|
||||
let mode = copy_tag_layout(width, Some(stack_w), name_w, &m);
|
||||
let tag_w = match mode {
|
||||
CopyTag::Full => name_w + m.copy_extra,
|
||||
CopyTag::IconOnly => m.copy_icon,
|
||||
CopyTag::Hidden => 0.0,
|
||||
};
|
||||
if mode != CopyTag::Hidden {
|
||||
// stack badge from the left inset, the tag to the right inset: they leave a gap
|
||||
let (stack_right, tag_left) = (m.inset + stack_w, width - m.inset - tag_w);
|
||||
assert!(stack_right < tag_left, "{surface:?} at {width}: {mode:?} meets the badge");
|
||||
assert!(tag_left >= m.inset, "{surface:?} at {width}: {mode:?} leaves the photo");
|
||||
}
|
||||
if seen.last() != Some(&mode) {
|
||||
seen.push(mode);
|
||||
}
|
||||
}
|
||||
assert_eq!(seen, [CopyTag::Hidden, CopyTag::IconOnly, CopyTag::Full], "{surface:?}: as the tile widens");
|
||||
}
|
||||
}
|
||||
|
||||
/// The real case: "Copy 1" (34 pt of text) beside a "2/2" badge (18 pt of text) on a 124 pt
|
||||
/// justified tile fitted with 2 pt to spare on main. The tag keeps its name while it clears the
|
||||
/// badge by 4 pt, and is the icon alone just below that.
|
||||
#[test]
|
||||
fn the_copy_tag_keeps_its_name_when_it_clears_the_badge_by_four_points() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let (name_w, stack_w) = (34.0, 18.0 + m.stack_extra);
|
||||
let edge = 2.0 * m.inset + stack_w + 4.0 + name_w + m.copy_extra;
|
||||
assert_eq!(copy_tag_layout(124.0, Some(stack_w), name_w, &m), CopyTag::Full);
|
||||
assert_eq!(copy_tag_layout(edge, Some(stack_w), name_w, &m), CopyTag::Full);
|
||||
assert_eq!(copy_tag_layout(edge - 0.5, Some(stack_w), name_w, &m), CopyTag::IconOnly);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn without_a_stack_badge_the_copy_tag_keeps_its_name_longer() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let width = 2.0 * m.inset + 50.0 + m.copy_extra + 1.0;
|
||||
assert_eq!(copy_tag_layout(width, None, 50.0, &m), CopyTag::Full);
|
||||
assert_eq!(copy_tag_layout(width, Some(30.0), 50.0, &m), CopyTag::IconOnly);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_preview_pill_shrinks_to_its_icon_on_a_narrow_tile() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let photo = |w: f32| Rect::from_min_size(pos2(0.0, 0.0), vec2(w, 80.0));
|
||||
assert!(preview_pill_place(photo(120.0), 40.0, None, &[], &[], &m).full);
|
||||
let narrow = preview_pill_place(photo(60.0), 40.0, None, &[], &[], &m);
|
||||
assert!(!narrow.full);
|
||||
}
|
||||
|
||||
/// A wide stacked photo in the filmstrip, a 3:2 one in the square grid at 90 pt: the pill's
|
||||
/// usual place meets the stack badge, so it moves below it, beside it, or goes.
|
||||
#[test]
|
||||
fn the_preview_pill_keeps_clear_of_the_stack_badge() {
|
||||
for (surface, w, h, badge_w) in [(Surface::Film, 100.0, 50.0, 30.0), (Surface::Grid, 70.0, 47.0, 40.0)] {
|
||||
let m = surface.metrics();
|
||||
let photo = Rect::from_min_size(pos2(0.0, 0.0), vec2(w, h));
|
||||
let badge = Rect::from_min_size(pos2(m.inset, m.inset), vec2(badge_w, m.badge));
|
||||
let bar = marks_bar(photo, &m);
|
||||
let p = preview_pill_place(photo, 30.0, Some(badge), &[badge], &[bar], &m);
|
||||
let free = |r: Rect| !(r.min.x < badge.max.x && badge.min.x < r.max.x && r.min.y < badge.max.y && badge.min.y < r.max.y);
|
||||
assert!(
|
||||
free(p.rect) && photo.contains_rect(p.rect) && p.rect.bottom() <= bar.top() + 0.01,
|
||||
"{surface:?}: {p:?} meets the badge {badge:?}"
|
||||
);
|
||||
// without the badge it sits where it always did
|
||||
let alone = preview_pill_place(photo, 30.0, None, &[], &[bar], &m);
|
||||
assert_eq!(alone.rect.top(), (h - m.bar - 4.0 - m.pill_icon).max(m.inset), "{surface:?}");
|
||||
}
|
||||
// a photo too small for the pill anywhere clear of the badge: nothing else fits, so the
|
||||
// icon is drawn at its first spot, over the badge, rather than not at all
|
||||
let m = Surface::Film.metrics();
|
||||
let tiny = Rect::from_min_size(pos2(0.0, 0.0), vec2(40.0, 30.0));
|
||||
let badge = Rect::from_min_size(pos2(m.inset, m.inset), vec2(34.0, m.badge));
|
||||
let last = preview_pill_place(tiny, 30.0, Some(badge), &[badge], &[marks_bar(tiny, &m)], &m);
|
||||
assert!(!last.full, "the icon alone");
|
||||
assert_eq!(last.rect.min, pos2(m.inset, (tiny.bottom() - m.bar - 4.0 - m.pill_icon).max(m.inset)), "at its first spot");
|
||||
assert!(last.rect.intersects(badge), "over the badge: the last resort");
|
||||
}
|
||||
|
||||
/// A short photo with a collapsed stack's badge and a marks band (hovered, or rated): the spot
|
||||
/// beside the badge overlaps the band, which is allowed (its marks sit at its ends), the badge
|
||||
/// is not.
|
||||
#[test]
|
||||
fn the_pill_may_sit_over_the_marks_band_but_never_over_the_badge() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let photo = Rect::from_min_size(pos2(0.0, 0.0), vec2(70.0, 39.0));
|
||||
let badge = Rect::from_min_size(pos2(m.inset, m.inset), vec2(34.0, m.badge));
|
||||
let band = marks_bar(photo, &m);
|
||||
let p = preview_pill_place(photo, 30.0, Some(badge), &[badge], &[band], &m);
|
||||
let overlap = |a: Rect, b: Rect| a.min.x < b.max.x && b.min.x < a.max.x && a.min.y < b.max.y && b.min.y < a.max.y;
|
||||
assert!(!overlap(p.rect, badge), "{p:?} is over the badge {badge:?}");
|
||||
assert!(photo.contains_rect(p.rect), "{p:?}");
|
||||
assert!(p.rect.left() >= badge.right(), "beside the badge: {p:?}");
|
||||
}
|
||||
|
||||
/// A square-grid 16:9 photo at 90 pt is 70 x 39: with no marks to draw the row covers nothing,
|
||||
/// and the pill sits where it always did instead of dodging a strip that is not there.
|
||||
#[test]
|
||||
fn a_short_photo_without_marks_leaves_the_pill_its_place() {
|
||||
for (surface, w, h) in [(Surface::Grid, 70.0, 39.0), (Surface::Film, 100.0, 30.0)] {
|
||||
let m = surface.metrics();
|
||||
let photo = Rect::from_min_size(pos2(0.0, 0.0), vec2(w, h));
|
||||
let bar = marks_extent(photo, Marks::default(), false, false, false, &m);
|
||||
assert_eq!(bar, None, "{surface:?}: nothing drawn, nothing to avoid");
|
||||
let obstacles: Vec<Rect> = bar.into_iter().collect();
|
||||
let place = preview_pill_place(photo, 30.0, None, &[], &obstacles, &m);
|
||||
assert!(photo.contains_rect(place.rect) && place.full, "{surface:?}: {place:?}");
|
||||
// under the pointer the band is there, and the row covers its strip
|
||||
assert_eq!(marks_extent(photo, Marks::default(), true, false, false, &m), Some(marks_bar(photo, &m)));
|
||||
}
|
||||
}
|
||||
|
||||
/// "12/120" on a 60 pt photo, "3/12" on a 42 pt filmstrip photo: the badge sheds its icon, then
|
||||
/// the `i/`, and what is left is drawn clipped to the photo rather than onto its neighbour.
|
||||
#[test]
|
||||
fn the_stack_badge_degrades_on_a_narrow_photo() {
|
||||
for surface in [Surface::Grid, Surface::Film] {
|
||||
let m = surface.metrics();
|
||||
let (full_w, count_w) = (34.0, 20.0);
|
||||
let room = |w: f32| w - 2.0 * m.inset;
|
||||
let (s, w) = stack_layout(room(300.0), full_w, count_w, &m);
|
||||
assert_eq!((s, w), (StackShape::Full, full_w + m.stack_extra));
|
||||
let (s, w) = stack_layout(room(full_w + m.stack_extra + 2.0 * m.inset - 1.0), full_w, count_w, &m);
|
||||
assert_eq!(s, StackShape::NoIcon, "{surface:?}: the icon goes first");
|
||||
assert!(w <= full_w + m.stack_extra);
|
||||
let (s, w) = stack_layout(room(w + 2.0 * m.inset - 1.0), full_w, count_w, &m);
|
||||
assert_eq!(s, StackShape::CountOnly, "{surface:?}: then the i/");
|
||||
assert!(w < full_w);
|
||||
// nothing fits: still the count, and the caller clips it
|
||||
assert_eq!(stack_layout(0.0, full_w, count_w, &m).0, StackShape::CountOnly);
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the label has no surround to say it, it outlasts the stars and the flag.
|
||||
#[test]
|
||||
fn on_a_surfaceless_tile_the_label_is_kept_before_the_stars() {
|
||||
let m = Surface::Grid.metrics();
|
||||
let marks = Marks { rating: 5, flag: true, edited: false, label: true };
|
||||
let with_surround = bar_layout(60.0, marks, &m, false);
|
||||
assert!(!with_surround.label, "{with_surround:?}");
|
||||
let without = bar_layout(60.0, marks, &m, true);
|
||||
assert!(without.label && without.width(&m) <= 60.0, "{without:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_placeholder_has_the_photo_s_shape() {
|
||||
let area = Rect::from_min_size(pos2(10.0, 10.0), vec2(70.0, 56.0));
|
||||
let portrait = placeholder_rect(area, 2.0 / 3.0);
|
||||
assert!(
|
||||
(portrait.width() / portrait.height() - 2.0 / 3.0).abs() < 1e-4 && area.contains_rect(portrait) && portrait.center() == area.center()
|
||||
);
|
||||
let wide = placeholder_rect(area, 3.0);
|
||||
assert!((wide.width() - 70.0).abs() < 1e-4 && wide.height() < 56.0);
|
||||
let unknown = placeholder_rect(area, f32::NAN);
|
||||
assert!((unknown.width() / unknown.height() - 1.5).abs() < 1e-4);
|
||||
}
|
||||
|
||||
/// Italian says "valutazione: 1 su 5", "valutazione: 2 su 5"…: no English plural suffix to
|
||||
/// pick, so no number reads wrong.
|
||||
#[test]
|
||||
fn a_spoken_rating_needs_no_plural_suffix() {
|
||||
crate::i18n::set_language(crate::i18n::Locale::It);
|
||||
let said: Vec<String> = (1..=5).map(spoken_rating).collect();
|
||||
crate::i18n::set_language(crate::i18n::Locale::En);
|
||||
assert!(said.iter().all(|s| !s.contains("star")), "{said:?}");
|
||||
assert_eq!(said[1], said[0].replacen('1', "2", 1), "only the number changes: {said:?}");
|
||||
assert_eq!(spoken_rating(1), ", rating 1 of 5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_missing_original_points_at_locate_and_anything_else_at_reload() {
|
||||
let missing = failure_text(true, "No such file");
|
||||
assert!(missing.contains("Original offline") && missing.contains("Locate Missing File") && missing.ends_with("No such file"), "{missing}");
|
||||
let broken = failure_text(false, "bad header");
|
||||
assert!(broken.contains("can't be opened") && broken.contains("Reload from Disk") && !broken.contains("Locate"), "{broken}");
|
||||
}
|
||||
}
|
||||
@@ -49,5 +49,5 @@ fn the_photo_in_detail_says_its_rating_and_flag_as_the_grid_does() {
|
||||
h.state_mut().run("photo.flag", serde_json::json!({"flag": "pick"})).expect("flags");
|
||||
h.run_steps(4);
|
||||
let names = photo_names(&h);
|
||||
assert!(names.len() == 1 && names[0].ends_with(", 4 stars, picked"), "{names:?}");
|
||||
assert!(names.len() == 1 && names[0].ends_with(", rating 4 of 5, picked"), "{names:?}");
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
+23
-1
@@ -305,7 +305,7 @@
|
||||
|
||||
### The photo in Detail is named with its file for screen readers
|
||||
- With VoiceOver, the photo in Detail view is now announced with its file name, rating, flag and colour label ("Photo:
|
||||
IMG_0042.JPG, 4 stars, picked") instead of only "Photo", as the grid names the same photo.
|
||||
IMG_0042.JPG, rating 4 of 5, picked") instead of only "Photo", as the grid names the same photo.
|
||||
|
||||
### The grid's thumbnail size slider is a slider to screen readers
|
||||
- With VoiceOver, the Thumbnail size control at the right of the grid's bottom bar is now announced as a slider with its
|
||||
@@ -841,6 +841,12 @@
|
||||
the full count took about 14 s instead of about 23 s on a heavily loaded machine; the rest is the text rules of
|
||||
the albums themselves. The counts are the same as before, including for albums that loop through each other.
|
||||
|
||||
### Cleaner thumbnails in the grid
|
||||
- With Settings ▸ Interface ▸ Grid ▸ Ratings & flags set to Stars on hover (the default, which used to read "When rated
|
||||
or hovered"), a photo now shows its stars and its edited mark only while the pointer is on it or it is selected.
|
||||
Before, every rated photo wore the badge bar, which in a mostly rated library made it look like Always. Pick and
|
||||
reject flags and colour labels stay on every thumbnail. Always and Never work as before.
|
||||
|
||||
### Selection rings you can see in the light themes
|
||||
- The active photo's white outline vanished on Silver and Paper's light grid, and told the active photo from the other
|
||||
selected ones by lightness alone. Now the active photo has a heavier ring (3 pt, with a thin line against the photo so
|
||||
@@ -869,6 +875,22 @@
|
||||
in Recently Deleted apart, since they are restored and their files stay where they are: "Move 2 Photos · Restore 1
|
||||
Photo".
|
||||
|
||||
### The same marks on every thumbnail
|
||||
- The filmstrip's thumbnails now carry what the grid's do: a virtual copy has its "Copy N" tag, so a copy and its
|
||||
master tell apart; the stack badge can be clicked to expand or collapse the stack, with the same tooltip (now
|
||||
translated); the colour label is a dot, and the grid's photo-shaped placeholder stands in until the picture is drawn.
|
||||
- A thumbnail that can't be drawn shows a warning icon instead of a bare "!". Hover it to read why, and where to go:
|
||||
right-click ▸ Locate Missing File… when the original is gone, Reload from Disk otherwise.
|
||||
- In the Photo Grid a colour label is no longer a tinted band over the bottom of the picture; it is the dot in the
|
||||
row of marks, as in the Square Grid and the filmstrip.
|
||||
- On a narrow thumbnail (a portrait photo at the smallest size) the marks no longer run over the photo's edge: the
|
||||
copy tag drops its name, the edited mark goes, five stars become one star and the number, and what still doesn't fit is left out;
|
||||
the stack badge sheds its icon and then the "1/" of "1/12". Nothing is painted outside the photo. The Preview pill sits
|
||||
above the marks on the filmstrip too, and steps aside for the stack badge. In the Photo Grid, which has no tinted
|
||||
surround, the label dot is kept before the stars on a narrow photo and stays when ratings and flags are turned off.
|
||||
- The filmstrip now dims rejected photos as the grid does, and in the grid the dim sits under the marks, so the red
|
||||
reject flag stays clear. Right-clicking the stack badge opens the photo's menu.
|
||||
- Screen readers say "rating 3 of 5" in every language, instead of building "stars" from an English plural.
|
||||
|
||||
### Sharper resampling in HDR and panorama merges
|
||||
- Merged photos (HDR and panorama) are resampled with a sharper filter (Lanczos-3 instead of bilinear). Moving a
|
||||
|
||||
Reference in New Issue
Block a user