Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/ui-egui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ lightcraft-develop = { workspace = true }
lightcraft-pipeline = { workspace = true }
lightcraft-catalog = { workspace = true }
web-time = { workspace = true }
# file names are shortened between letters, not inside one (readout::elide_middle); the engine has it already
unicode-segmentation = "1.13"
lightcraft-engine = { workspace = true }
lightcraft-slideshow = { workspace = true }
lightcraft-preview = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/ui-egui/locales/de-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"{stage}… {:.0}%": "{stage}… {:.0}%",
"{verb} {n} Photo{}": "{verb}: {n} Foto{}",
"{weekday}, {day}": "{weekday}, {day}.",
"{weekday}, {day} {month} {year}": "{weekday}, {day}.{month:02}.{year}",
"{weekday}, {day} {month} {year}": "{weekday}, {day:02}.{month:02}.{year}",
"{what} merge added": "{what}-Zusammenfügung hinzugefügt",
"{what} merge failed: {e}": "{what}-Zusammenfügung fehlgeschlagen: {e}",
"{year}": "{year}",
Expand Down
16 changes: 9 additions & 7 deletions crates/ui-egui/src/dialogs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ fn whats_new_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) {
let l = line.trim_end();
if let Some(h) = l.strip_prefix("### ") {
ui.add_space(6.0);
ui.label(egui::RichText::new(crate::i18n::tr(h)).font(t.semibold(12.5)).color(t.text));
ui.label(egui::RichText::new(crate::i18n::tr(h)).font(t.body_strong()).color(t.text));
} else if let Some(h) = l.strip_prefix("## ") {
ui.add_space(8.0);
ui.label(egui::RichText::new(crate::i18n::tr(h)).font(t.semibold(14.0)).color(t.text));
Expand Down Expand Up @@ -696,7 +696,7 @@ fn all_metadata_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) {
}
for (g, list) in &groups {
ui.add_space(6.0);
ui.label(egui::RichText::new(g).font(t.semibold(12.5)).color(t.text));
ui.label(egui::RichText::new(g).font(t.body_strong()).color(t.text));
egui::Grid::new(format!("meta-{g}")).num_columns(2).spacing([16.0, 3.0]).striped(true).show(ui, |ui| {
for (n, v) in list {
ui.label(egui::RichText::new(n).color(t.text_dim));
Expand Down Expand Up @@ -740,7 +740,7 @@ fn smart_rules_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg:
.color(t.text_dim),
);
} else {
ui.label(egui::RichText::new(crate::i18n::tr("Fix the marked rules to save this album.")).color(t.caution));
ui.label(egui::RichText::new(crate::i18n::tr("Fix the marked rules to save this album.")).color(t.text_caution()));
}
}

Expand Down Expand Up @@ -952,7 +952,7 @@ fn rename_person_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, co
*confirm = true;
}
if let Some(why) = plan.block {
ui.label(egui::RichText::new(crate::i18n::tr(why)).color(t.caution));
ui.label(egui::RichText::new(crate::i18n::tr(why)).color(t.text_caution()));
} else {
ui.label(
egui::RichText::new(crate::i18n::tr_format!(
Expand All @@ -969,7 +969,7 @@ fn rename_person_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, co
"“{to}” is already a person. Combining them makes one person; Undo separates them again.",
to = to.trim()
))
.color(t.caution),
.color(t.text_caution()),
);
let r = ui.checkbox(merge, crate::i18n::tr("Combine with the existing person"));
crate::widgets::register(ui, "check:personMerge", r.rect);
Expand Down Expand Up @@ -1473,7 +1473,9 @@ fn export_apple_photos_rows(ui: &mut egui::Ui, t: &Tokens, opts: &mut ExportOpti
)
});
ui.label(
egui::RichText::new(crate::i18n::tr("The first time, macOS asks whether LightCraft may control Photos.")).size(11.0).color(t.text_dim),
egui::RichText::new(crate::i18n::tr("The first time, macOS asks whether LightCraft may control Photos."))
.font(t.caption())
.color(t.text_dim),
);
}
}
Expand Down Expand Up @@ -1728,7 +1730,7 @@ fn about_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut
1 => crate::credits::contributors_ui(app, ui),
2 => crate::credits::models_ui(ui),
_ => {
ui.label(egui::RichText::new("LightCraft").font(t.semibold(20.0)).color(t.text));
ui.label(egui::RichText::new("LightCraft").font(t.display_strong()).color(t.text));
ui.label(crate::i18n::tr_format!("Version {} — a clean-room, pure-Rust photo library and raw developer.", env!("CARGO_PKG_VERSION")));
ui.label(crate::i18n::tr_format!(
"MIT OR Apache-2.0. Fonts: {} (OFL). Icons: original.",
Expand Down
24 changes: 12 additions & 12 deletions crates/ui-egui/src/dialogs/faces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ pub fn setup_banner(app: &mut LightcraftApp, ui: &mut egui::Ui) {
let t = Tokens::get(ui.ctx());
egui::Frame::NONE.inner_margin(egui::Margin::symmetric(12, 6)).show(ui, |ui| {
ui.horizontal_wrapped(|ui| {
ui.label(RichText::new(message).font(t.font(12.5)).color(t.text_dim));
ui.label(RichText::new(message).font(t.label()).color(t.text_dim));
let r = ui.button(button);
register(ui, "faces:setup", r.rect);
if r.clicked() {
Expand Down Expand Up @@ -299,7 +299,7 @@ pub fn settings_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
});
// what is wrong with the user's own catalog (catalog.json in the models folder), if anything
for e in list["catalog"]["errors"].as_array().into_iter().flatten().filter_map(Value::as_str).take(3) {
ui.add(egui::Label::new(RichText::new(format!("catalog.json: {e}")).font(t.font(11.5)).color(t.caution)).wrap());
ui.add(egui::Label::new(RichText::new(format!("catalog.json: {e}")).font(t.caption()).color(t.text_caution())).wrap());
}
if let Some(d) = all.iter().find(|m| m["role"] == "detector") {
ui.add_space(4.0);
Expand Down Expand Up @@ -335,15 +335,15 @@ fn model_row(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, m: &Value,
ui.label(RichText::new(size).color(t.text_dim));
}
if selected {
ui.label(RichText::new(crate::i18n::tr("in use")).color(t.accent));
ui.label(RichText::new(crate::i18n::tr("in use")).color(t.text_link()));
} else if installed {
ui.label(RichText::new(crate::i18n::tr("installed")).color(t.text_dim));
}
});
ui.label(RichText::new(licence_line(m)).font(t.font(11.5)).color(if m["licence"]["commercial"] == "yes" {
ui.label(RichText::new(licence_line(m)).font(t.caption()).color(if m["licence"]["commercial"] == "yes" {
t.text_dim
} else {
t.caution
t.text_caution()
}));
// how fast it is, as times faster than a ResNet-100 model (milliseconds would depend on the computer),
// with whether it passed its test when it has been installed
Expand All @@ -356,7 +356,7 @@ fn model_row(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, m: &Value,
None => (speed.map(str::to_string), true),
};
if let Some(line) = line {
ui.label(RichText::new(line).font(t.font(11.5)).color(if ok { t.text_dim } else { t.caution }));
ui.label(RichText::new(line).font(t.caption()).color(if ok { t.text_dim } else { t.text_caution() }));
}
match (dl_state, dl) {
(Some("running"), Some(d)) => {
Expand All @@ -375,12 +375,12 @@ fn model_row(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, m: &Value,
(Some("done"), _) => {
ui.horizontal(|ui| {
crate::progress::spinner(ui, 12.0);
ui.label(RichText::new(crate::i18n::tr("Downloaded and checked. Installing…")).font(t.font(11.5)).color(t.text_dim));
ui.label(RichText::new(crate::i18n::tr("Downloaded and checked. Installing…")).font(t.caption()).color(t.text_dim));
});
}
(Some("failed"), Some(d)) => {
let why = sentence(d["error"].as_str().unwrap_or("The download failed"));
ui.add(egui::Label::new(RichText::new(why).font(t.font(11.5)).color(t.caution)).wrap());
ui.add(egui::Label::new(RichText::new(why).font(t.caption()).color(t.text_caution())).wrap());
}
_ => {}
}
Expand Down Expand Up @@ -450,7 +450,7 @@ pub fn model_dialog(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, info
let kind = info["kind"].as_str().unwrap_or("unsupported");
let file = info["fileName"].as_str().unwrap_or("");
if kind == "unsupported" {
ui.label(RichText::new(crate::i18n::tr("This file cannot be used yet")).font(t.semibold(13.5)).color(t.caution));
ui.label(RichText::new(crate::i18n::tr("This file cannot be used yet")).font(t.body_strong()).color(t.text_caution()));
ui.add(
egui::Label::new(
RichText::new(sentence(info["reason"].as_str().unwrap_or("It is not a face recognition model LightCraft understands")))
Expand Down Expand Up @@ -485,7 +485,7 @@ pub fn model_dialog(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, info
);
}
let commercial = m["licence"]["commercial"].as_str().unwrap_or("unknown");
ui.label(RichText::new(licence_line(m)).font(t.semibold(12.5)).color(if commercial == "yes" { t.text } else { t.caution }));
ui.label(RichText::new(licence_line(m)).font(t.body_strong()).color(if commercial == "yes" { t.text } else { t.text_caution() }));
let notice = m["licence"]["notice"].as_str().unwrap_or("");
if !notice.is_empty() {
ui.add(egui::Label::new(RichText::new(notice).color(t.text_label)).wrap());
Expand Down Expand Up @@ -517,7 +517,7 @@ pub fn model_dialog(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, info
} else {
"The model is kept on this computer only. LightCraft never uploads or shares it."
};
ui.label(RichText::new(closing).font(t.font(11.5)).color(t.text_dim));
ui.label(RichText::new(closing).font(t.caption()).color(t.text_dim));
}

/// Pressing Download: the model's terms first, in the same dialog as a model file. Accepting them starts the download;
Expand Down Expand Up @@ -683,7 +683,7 @@ pub fn name_editor(
}
}
if let Some(label) = setup.short() {
let b = ui.add(egui::Button::new(RichText::new(label).font(t.font(12.0)).color(t.accent)).frame(false));
let b = ui.add(egui::Button::new(RichText::new(label).font(t.font(12.0)).color(t.text_link())).frame(false));
register(ui, "faces:setup", b.rect);
if b.clicked() {
outcome = Editor::Setup;
Expand Down
9 changes: 5 additions & 4 deletions crates/ui-egui/src/dialogs/import/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ pub fn body(app: &mut LightcraftApp, ui: &mut egui::Ui, d: &mut ImportDialog) {
}
_ => "Add in place: the library references the files where they are; nothing is copied or moved.",
}))
.color(if d.copy && d.move_files { t.caution } else { t.text_dim })
.color(if d.copy && d.move_files { t.text_caution() } else { t.text_dim })
.small(),
);
register(ui, "label:importModeHelp", r.rect);
Expand Down Expand Up @@ -224,7 +224,7 @@ pub fn body(app: &mut LightcraftApp, ui: &mut egui::Ui, d: &mut ImportDialog) {
let t = Tokens::get(ui.ctx());
match lightcraft_engine::rename::folder_template_error(&d.folder_template) {
Some(e) => {
ui.label(egui::RichText::new(e).color(t.caution));
ui.label(egui::RichText::new(e).color(t.text_caution()));
}
None => unknown_tags_warning(ui, &d.folder_template),
}
Expand Down Expand Up @@ -437,8 +437,9 @@ fn candidate_cell(app: &mut LightcraftApp, ui: &mut egui::Ui, d: &mut ImportDial
p.rect_filled(br, 3.0, Color32::from_rgba_unmultiplied(170, 60, 50, 220));
p.galley(br.min + vec2(4.0, 2.0), g, Color32::WHITE);
}
let name = if c.name.chars().count() > 18 { format!("{}…", c.name.chars().take(17).collect::<String>()) } else { c.name.clone() };
p.text(pos2(rect.left() + 2.0, img.bottom() + 9.0), Align2::LEFT_CENTER, name, t.font(10.5), if ok { t.text_label } else { t.text_dim });
// (shortened in the middle to the cell's width: the end of a name is the number of the frame)
let name = crate::readout::elide_middle(&c.name, rect.width() - 4.0, |s| p.layout_no_wrap(s.to_string(), t.caption(), t.text_label).size().x);
p.text(pos2(rect.left() + 2.0, img.bottom() + 9.0), Align2::LEFT_CENTER, name, t.caption(), if ok { t.text_label } else { t.text_dim });
let tip = format!(
"{}\n{} × {} · {} · {:.1} MB{}",
c.path,
Expand Down
4 changes: 2 additions & 2 deletions crates/ui-egui/src/dialogs/import/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use super::{Tokens, register};
/// Reserve the actual translated tag button width beside a template field.
pub(crate) fn tag_field_width(ui: &egui::Ui) -> f32 {
let t = Tokens::get(ui.ctx());
let galley = ui.painter().layout_no_wrap(crate::i18n::tr("Tags").to_string(), t.semibold(11.5), t.text);
let galley = ui.painter().layout_no_wrap(crate::i18n::tr("Tags").to_string(), t.caption_strong(), t.text);
(ui.available_width() - (galley.size().x + 18.0).max(37.0) - ui.spacing().item_spacing.x).max(80.0)
}

Expand Down Expand Up @@ -32,7 +32,7 @@ pub(crate) fn unknown_tags_warning(ui: &mut egui::Ui, template: &str) {
if unknown.len() == 1 { "s" } else { "" },
s = s
);
ui.label(egui::RichText::new(text).color(Tokens::get(ui.ctx()).caution));
ui.label(egui::RichText::new(text).color(Tokens::get(ui.ctx()).text_caution()));
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/ui-egui/src/dialogs/keymap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {
d.insert_temp(search_id, search.clone());
d.insert_temp(all_id, show_all);
});
ui.label(RichText::new(crate::i18n::tr("Click a shortcut, then press the new keys (Esc cancels).")).size(11.0).color(t.text_dim));
ui.label(RichText::new(crate::i18n::tr("Click a shortcut, then press the new keys (Esc cancels).")).font(t.caption()).color(t.text_dim));
ui.add_space(4.0);

let needle = search.trim().to_lowercase();
Expand Down Expand Up @@ -129,7 +129,7 @@ fn row(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, b: &Bindable, sc:
apply(app, ui.ctx(), serde_json::json!({"id": b.id, "reset": true}));
}
});
ui.label(RichText::new(b.id).size(10.5).color(t.text_dim));
ui.label(RichText::new(b.id).font(t.caption()).color(t.text_dim));
ui.end_row();
}

Expand Down Expand Up @@ -177,7 +177,7 @@ fn fixed_keys(app: &LightcraftApp, ui: &mut egui::Ui, t: &Tokens, mac: bool, nee
return;
}
ui.add_space(8.0);
ui.label(RichText::new(crate::i18n::tr("Fixed keys")).font(t.semibold(12.5)).color(t.text));
ui.label(RichText::new(crate::i18n::tr("Fixed keys")).font(t.body_strong()).color(t.text));
// keys saved for commands this build knows: an entry for an unknown command takes no key
let taken: Vec<_> = shortcuts::saved_keys(&app.ui.settings.keymap).map(|(_, k)| k).collect();
egui::Grid::new("shortcuts-fixed").striped(true).num_columns(2).spacing([12.0, 4.0]).show(ui, |ui| {
Expand Down
4 changes: 2 additions & 2 deletions crates/ui-egui/src/dialogs/print_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ fn preview(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, pu: &mut PrintUi, s
let painter = ui.painter_at(area);
painter.rect_filled(area, 4.0, t.canvas);
let Ok((pw, ph)) = st.layout.page_size() else {
painter.text(area.center(), Align2::CENTER_CENTER, crate::i18n::tr("This page setup is not valid"), t.font(13.0), t.caution);
painter.text(area.center(), Align2::CENTER_CENTER, crate::i18n::tr("This page setup is not valid"), t.font(13.0), t.text_caution());
return;
};
let g = &st.guides;
Expand Down Expand Up @@ -692,7 +692,7 @@ fn preview(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, pu: &mut PrintUi, s
if package {
ui.label(egui::RichText::new(format!("{} {}", st.layout.cells.len(), crate::i18n::tr("cells"))).color(t.text_dim));
if st.layout.has_overlaps() {
ui.label(egui::RichText::new(crate::i18n::tr("cells overlap")).color(t.caution));
ui.label(egui::RichText::new(crate::i18n::tr("cells overlap")).color(t.text_caution()));
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion crates/ui-egui/src/dialogs/rules_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ fn small_button_width(ui: &egui::Ui, text: &str) -> f32 {
fn problem_note(ui: &mut egui::Ui, problem: Option<&Problem>, salt: &str) {
let Some(p) = problem else { return };
let t = Tokens::get(ui.ctx());
let r = ui.label(RichText::new(format!("⚠ {}", crate::i18n::problem_text(p))).color(t.caution).small());
let r = ui.label(RichText::new(format!("⚠ {}", crate::i18n::problem_text(p))).color(t.text_caution()).small());
register(ui, format!("ruleProblem:{salt}"), r.rect);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/ui-egui/src/dialogs/settings/appearance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn theme_card<V: PartialEq + Copy>(ui: &mut egui::Ui, t: &Tokens, card: ThemeCar
ui.horizontal(|ui| {
ui.label(RichText::new(crate::i18n::tr(title)).font(t.semibold(12.0)).color(t.text));
if active {
ui.label(RichText::new(crate::i18n::tr("In Use")).size(11.0).color(t.accent));
ui.label(RichText::new(crate::i18n::tr("In Use")).font(t.caption()).color(t.text_link()));
}
});
let shown = options.iter().find(|(v, _)| v == value).or(options.first()).map(|(_, k)| *k).unwrap_or_default();
Expand Down
6 changes: 3 additions & 3 deletions crates/ui-egui/src/dialogs/settings/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ pub(super) fn display_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens
}
});
if let Some(e) = &app.display_error {
ui.label(RichText::new(e).size(11.0).color(t.reject));
ui.label(RichText::new(e).font(t.caption()).color(t.text_error()));
}
if let Some(d) = &current {
let info = d.describe();
if !screen {
row(ui, t, crate::i18n::tr("File"), |ui| {
path_label(ui, "settingsDisplayFile", &d.path, egui::FontId::proportional(11.0), t.text_dim, 0.0);
path_label(ui, "settingsDisplayFile", &d.path, t.caption(), t.text_dim, 0.0);
});
}
row(ui, t, crate::i18n::tr("Type"), |ui| {
Expand All @@ -61,7 +61,7 @@ pub(super) fn display_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens
let p = &info["primaries"];
let xy = |(k, l): (&str, &str)| format!("{l} {:.3}, {:.3}", p[k][0].as_f64().unwrap_or(0.0), p[k][1].as_f64().unwrap_or(0.0));
let text = [("red", "R"), ("green", "G"), ("blue", "B")].map(xy).join(" ");
ui.label(RichText::new(text).size(11.0).color(t.text_dim));
ui.label(RichText::new(text).font(t.caption()).color(t.text_dim));
});
}
hint(
Expand Down
Loading
Loading