File Info: Photoshop field order and labels (#6125, #6126)

This commit is contained in:
highperfocused committed 2026-10-15 15:35:49 +02:00
1 parent 33372650fe
commit 1d2ebfdc1f
22 files changed
+106 -2

No files matched your search

+3
View File
@@ -2792,6 +2792,9 @@ cameraData Lens Objektiv
Cooling80 Ochlazovací 80
Cooling82 Ochlazovací 82
Copyright Status Stav autorských práv
Copyright Info URL URL informace o autorských právech
Copyright Notice Oznámení autorských práv
Document Title Název dokumentu
Copyrighted Chráněno autorským právem
Correct C A Korigovat chromatickou aberaci
Correct Distortion Korigovat zkreslení
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -2812,6 +2812,9 @@ curves Smooth Glätten
# Document Info and color profiles
Author Title Position des Urhebers
Copyright Status Urheberrechtsstatus
Copyright Info URL URL für Urheberrechtsinfo
Copyright Notice Urheberrechtsvermerk
Document Title Dokumenttitel
Unknown Unbekannt
Copyrighted Urheberrechtlich geschützt
Public Domain Gemeinfrei
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -995,6 +995,8 @@
Keywords Λέξεις-κλειδιά
Copyright Info URL Σύνδεσμος πληροφοριών πνευματικών δικαιωμάτων
Copyright Status Κατάσταση πνευματικών δικαιωμάτων
Copyright Notice Σημείωση πνευματικών δικαιωμάτων
Document Title Τίτλος εγγράφου
Copyrighted Προστατεύεται από πνευματικά δικαιώματα
Public Domain Κοινό κτήμα
Unknown Άγνωστο
1 # Greek (el) PhotoCraft interface catalog.
995
996
997
998
999
1000
1001
1002
+2
View File
@@ -2990,6 +2990,8 @@ curves Smooth Suavizar
Keywords Palabras clave
Copyright Info URL URL de información de copyright
Copyright Status Estado del copyright
Copyright Notice Aviso de copyright
Document Title Título del documento
Copyrighted Con copyright
Public Domain Dominio público
Unknown Desconocido
Can't render this file because it contains an unexpected character in line 4 and column 47.
+2
View File
@@ -2431,6 +2431,8 @@
Keywords Mots-clés
Copyright Info URL URL des informations de copyright
Copyright Status Statut du copyright
Copyright Notice Mention de copyright
Document Title Titre du document
Copyrighted Protégé par copyright
Public Domain Domaine public
Unknown Inconnu
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -3140,6 +3140,8 @@ cameraRaw Yellow Sárga
Convert to Profile Átalakítás profilra
Convert to srgb Átalakítás sRGB-re
Copyright Status Szerzői jogi állapot
Copyright Notice Szerzői jogi értesítés
Document Title Dokumentum címe
Corner radius Sarokkerekítés sugara
Correct C A Kromatikus aberráció javítása
Correct Distortion Torzítás javítása
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -2422,6 +2422,8 @@
Keywords Kata Kunci
Copyright Info URL URL Info Hak Cipta
Copyright Status Status Hak Cipta
Copyright Notice Pemberitahuan Hak Cipta
Document Title Judul Dokumen
Copyrighted Berhak Cipta
Public Domain Domain Publik
Unknown Tidak Diketahui
Can't render this file because it contains an unexpected character in line 4 and column 47.
+2
View File
@@ -2982,6 +2982,8 @@ curves Smooth Leviga
Keywords Parole chiave
Copyright Info URL URL info copyright
Copyright Status Stato copyright
Copyright Notice Avviso sul copyright
Document Title Titolo documento
Copyrighted Protetto da copyright
Public Domain Pubblico dominio
Unknown Sconosciuto
Can't render this file because it contains an unexpected character in line 2654 and column 53.
+2
View File
@@ -3043,6 +3043,8 @@ fontWeight Italic 斜体
Cooling80 寒色フィルター (80)
Cooling82 寒色フィルター (82)
Copyright Status 著作権の状態
Copyright Notice 著作権表示
Document Title ドキュメントタイトル
Copyrighted 著作権あり
Corners 角
Correct C A 色収差を補正
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -969,6 +969,9 @@
Copper 구리
Copyright 저작권
Copyright and Contact Info 저작권 및 연락처 정보
Copyright Info URL 저작권 정보 URL
Copyright Notice 저작권 고지
Document Title 문서 제목
Corner Crop Marks 모서리 자르기 표시
Corner radius 모서리 반경
Correction 보정
1 # Korean (ko) catalog. UTF-8: context<TAB>English source<TAB>translation.
969
970
971
972
973
974
975
976
977
+2
View File
@@ -2831,6 +2831,8 @@ cameraRaw Color Kleur
Keywords Trefwoorden
Copyright Info URL URL copyrightinformatie
Copyright Status Copyrightstatus
Copyright Notice Copyrightvermelding
Document Title Documenttitel
Copyrighted Auteursrechtelijk beschermd
Public Domain Publiek domein
Unknown Onbekend
Can't render this file because it contains an unexpected character in line 8 and column 34.
+2
View File
@@ -2454,6 +2454,8 @@
Keywords Słowa kluczowe
Copyright Info URL Adres URL informacji o prawach autorskich
Copyright Status Status praw autorskich
Copyright Notice Informacja o prawach autorskich
Document Title Tytuł dokumentu
Copyrighted Chronione prawem autorskim
Public Domain Domena publiczna
Unknown Nieznany
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -2426,6 +2426,8 @@
Keywords Palavras-chave
Copyright Info URL URL das informações de direitos autorais
Copyright Status Status dos direitos autorais
Copyright Notice Aviso de copyright
Document Title Título do documento
Copyrighted Protegido por direitos autorais
Public Domain Domínio público
Unknown Desconhecido
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -1339,6 +1339,8 @@
Keywords Ключевые слова
Copyright Info URL URL сведений об авторских правах
Copyright Status Статус авторских прав
Copyright Notice Уведомление об авторских правах
Document Title Название документа
Copyrighted Охраняется авторским правом
Public Domain Общественное достояние
Unknown Неизвестно
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -2408,6 +2408,8 @@
Keywords Ključne reči
Copyright Info URL URL informacija o autorskim pravima
Copyright Status Status autorskih prava
Copyright Notice Obaveštenje o autorskim pravima
Document Title Naslov dokumenta
Copyrighted Zaštićeno autorskim pravima
Public Domain Javno dobro
Unknown Nepoznato
Can't render this file because it contains an unexpected character in line 6 and column 47.
+2
View File
@@ -2801,6 +2801,8 @@ cameraRaw Color Renk
Keywords Anahtar Kelimeler
Copyright Info URL Telif Hakkı Bilgisi URL'si
Copyright Status Telif Hakkı Durumu
Copyright Notice Telif hakkı bildirimi
Document Title Belge başlığı
Copyrighted Telif hakkıyla korunuyor
Public Domain Kamu Alanı
Unknown Bilinmiyor
Can't render this file because it contains an unexpected character in line 8 and column 34.
+2
View File
@@ -1314,6 +1314,8 @@
Keywords Ключові слова
Copyright Info URL URL інформації про авторське право
Copyright Status Статус авторського права
Copyright Notice Застереження про авторські права
Document Title Назва документа
Copyrighted Захищено авторським правом
Public Domain Суспільне надбання
Unknown Невідомо
1 # Ukrainian (uk) catalog. UTF-8: context<TAB>English source<TAB>translation.
1314
1315
1316
1317
1318
1319
1320
1321
+3
View File
@@ -2981,6 +2981,9 @@ cameraData Lens Ống kính
Cooling80 Lạnh80
Cooling82 Lạnh82
Copyright Status Trạng thái bản quyền
Copyright Info URL URL thông tin bản quyền
Copyright Notice Thông báo bản quyền
Document Title Tiêu đề tài liệu
Copyrighted Được bảo vệ bản quyền
Correct C A Hiệu chỉnh C A
Correct Distortion Hiệu chỉnh độ méo
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -997,6 +997,9 @@
Copper 铜色
Copyright 版权
Copyright and Contact Info 版权与联系信息
Copyright Info URL 版权信息 URL
Copyright Notice 版权声明
Document Title 文档标题
Corner Crop Marks 角落裁剪标记
Corner radius 圆角半径
Correction 校正
1 # Simplified Chinese (zh-hans) catalog. UTF-8, TAB-separated columns:
997
998
999
1000
1001
1002
1003
1004
1005
+3
View File
@@ -1001,6 +1001,9 @@
Copper 銅色
Copyright 版權
Copyright and Contact Info 版權與聯絡資訊
Copyright Info URL 版權資訊 URL
Copyright Notice 版權聲明
Document Title 文件標題
Corner Crop Marks 角落裁切標記
Corner radius 圓角半徑
Correction 校正
Can't render this file because it contains an unexpected character in line 6 and column 47.
+35 -2
View File
@@ -1059,6 +1059,23 @@ mod form_reset_tests {
}
}
/// Display order of a `__form` dialog's field keys. `__order` lists them the way Photoshop
/// shows them (e.g. File Info); keys it omits keep their catalogue order after it.
pub fn form_keys(f: &Map<String, Value>) -> Vec<String> {
let mut keys: Vec<String> = f
.get("__order")
.and_then(Value::as_array)
.into_iter()
.flatten()
.filter_map(Value::as_str)
.filter(|k| !k.starts_with("__") && f.contains_key(*k))
.map(str::to_string)
.collect();
let rest: Vec<String> = f.keys().filter(|k| !k.starts_with("__") && !keys.contains(k)).cloned().collect();
keys.extend(rest);
keys
}
/// Body of a `__form` dialog: text fields, number fields, checkboxes and `__choices` dropdowns.
pub fn form_body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
let choices = f.get("__choices").cloned().unwrap_or(Value::Null);
@@ -1066,7 +1083,7 @@ pub fn form_body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
// come from `__labels` verbatim; everything else goes through the catalogue.
let labels = f.get("__labels").cloned().unwrap_or(Value::Null);
let label = |k: &str| labels.get(k).and_then(Value::as_str).map_or_else(|| label_of(k), str::to_string);
let keys: Vec<String> = f.keys().filter(|k| !k.starts_with("__")).cloned().collect();
let keys = form_keys(f);
egui::Grid::new("form-dialog").num_columns(2).spacing([12.0, 6.0]).show(ui, |ui| {
for k in keys {
let v = f.get(&k).cloned().unwrap_or(Value::Null);
@@ -1245,7 +1262,23 @@ fn front(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: &Value)
let kw = info["keywords"].as_array().map(|a| a.iter().filter_map(Value::as_str).collect::<Vec<_>>().join("; ")).unwrap_or_default();
dialog(
app,
json!({"title": info["title"], "author": info["author"], "authorTitle": info["authorTitle"], "description": info["description"], "keywords": kw, "copyright": info["copyright"], "copyrightStatus": info["copyrightStatus"], "copyrightUrl": info["copyrightUrl"], "__camera": info["camera"]}),
json!({
"title": info["title"],
"author": info["author"],
"authorTitle": info["authorTitle"],
"description": info["description"],
"keywords": kw,
"copyrightStatus": info["copyrightStatus"],
"copyright": info["copyright"],
"copyrightUrl": info["copyrightUrl"],
"__order": ["title", "author", "authorTitle", "description", "keywords", "copyrightStatus", "copyright", "copyrightUrl"],
"__labels": {
"title": tl!("Document Title"),
"copyright": tl!("Copyright Notice"),
"copyrightUrl": tl!("Copyright Info URL"),
},
"__camera": info["camera"]
}),
json!({"copyrightStatus": ["unknown", "copyrighted", "publicDomain"]}),
)
}
+25
View File
@@ -506,3 +506,28 @@ fn esc_leaves_full_screen_modes_unless_something_else_owns_it() {
assert_eq!(app.ui.view.screen_mode, "standard");
assert!(app.session.active().unwrap().doc.selection.is_some());
}
#[test]
fn file_info_dialog_matches_photoshop_field_order_and_labels() {
crate::i18n::with_language(crate::i18n::Lang::EN, || {
let (mut app, ctx) = app_with(1);
let d = menu(&mut app, &ctx, "file.fileInfo", json!({})).unwrap()["dialog"].as_u64().unwrap();
let fields = app.ui.dialog_mut(d).unwrap().fields.clone();
assert_eq!(
form_keys(&fields).iter().map(String::as_str).collect::<Vec<_>>(),
["title", "author", "authorTitle", "description", "keywords", "copyrightStatus", "copyright", "copyrightUrl"]
);
let labels = fields["__labels"].as_object().unwrap();
assert_eq!(labels["title"], "Document Title");
assert_eq!(labels["copyright"], "Copyright Notice");
assert_eq!(labels["copyrightUrl"], "Copyright Info URL");
});
}
#[test]
fn form_keys_orders_by_order_then_catalogue() {
let f = json!({"zeta": "", "alpha": "", "mid": "", "__order": ["mid", "zeta", "ghost"]}).as_object().unwrap().clone();
assert_eq!(form_keys(&f).iter().map(String::as_str).collect::<Vec<_>>(), ["mid", "zeta", "alpha"]);
let f = json!({"zeta": "", "alpha": ""}).as_object().unwrap().clone();
assert_eq!(form_keys(&f).iter().map(String::as_str).collect::<Vec<_>>(), ["alpha", "zeta"]);
}