Batch 32: cargo fmt

This commit is contained in:
bflatastic committed 2026-10-13 11:04:18 +07:00
1 parent 1c473ed64c
commit 95d519ae64
4 files changed
+59 -21

No files matched your search

+35 -9
View File
@@ -160,7 +160,17 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
let r = crate::widgets::dropdown(ui, "profile", crate::i18n::profile_label(&d.profile.id, name), t.font(15.0), t.text_label);
egui::Popup::menu(&r).show(|ui| profile_menu(app, ui, &d));
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
if crate::widgets::icon_button(ui, "profileBrowser", Icon::ProfileGrid, vec2(28.0, 28.0), false, true, crate::i18n::tr("Browse Profiles")).clicked() {
if crate::widgets::icon_button(
ui,
"profileBrowser",
Icon::ProfileGrid,
vec2(28.0, 28.0),
false,
true,
crate::i18n::tr("Browse Profiles"),
)
.clicked()
{
let _ = app.run("panel.profiles", json!({}));
}
});
@@ -230,8 +240,16 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
});
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
let active = app.ui.tool == "wbPicker";
if crate::widgets::icon_button(ui, "wbPicker", Icon::Picker, vec2(28.0, 28.0), active, true, crate::i18n::tr("White Balance Selector (W)"))
.clicked()
if crate::widgets::icon_button(
ui,
"wbPicker",
Icon::Picker,
vec2(28.0, 28.0),
active,
true,
crate::i18n::tr("White Balance Selector (W)"),
)
.clicked()
{
if active {
app.ui.tool.clear();
@@ -1226,8 +1244,16 @@ fn point_color(app: &mut LightcraftApp, ui: &mut egui::Ui, d: &DevelopSettings)
ui.spacing_mut().item_spacing.x = 5.0;
let active = app.ui.tool == "pointColor";
let full = n >= lightcraft_develop::MAX_POINT_COLORS;
if crate::widgets::icon_button(ui, "pointColorPicker", Icon::Picker, vec2(26.0, 26.0), active, !full, crate::i18n::tr("Sample a colour on the photo"))
.clicked()
if crate::widgets::icon_button(
ui,
"pointColorPicker",
Icon::Picker,
vec2(26.0, 26.0),
active,
!full,
crate::i18n::tr("Sample a colour on the photo"),
)
.clicked()
{
app.ui.tool = if active { String::new() } else { "pointColor".into() };
}
@@ -1311,7 +1337,9 @@ fn grading(app: &mut LightcraftApp, ui: &mut egui::Ui, d: &DevelopSettings, phot
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 4.0;
for (key, tip, icon) in GRADING_TABS {
if crate::widgets::icon_button(ui, &format!("grading-{key}"), icon, vec2(28.0, 28.0), key == mode, true, crate::i18n::tr(tip)).clicked() {
if crate::widgets::icon_button(ui, &format!("grading-{key}"), icon, vec2(28.0, 28.0), key == mode, true, crate::i18n::tr(tip))
.clicked()
{
app.ui.grading_mode = key.to_string();
}
}
@@ -1519,9 +1547,7 @@ mod curve_histogram_tests {
#[test]
fn curve_backdrop_tracks_luma_and_selected_channel() {
let img = lightcraft_raster::Rgba8::from_fn(64, 32, |x, _| {
if x < 32 { [32, 100, 32, 255] } else { [224, 100, 224, 255] }
});
let img = lightcraft_raster::Rgba8::from_fn(64, 32, |x, _| if x < 32 { [32, 100, 32, 255] } else { [224, 100, 224, 255] });
let h = lightcraft_raster::Histogram::of_srgb8(&img);
let red = curve_histogram_profile(&h, "red");
let green = curve_histogram_profile(&h, "green");
+3 -6
View File
@@ -1284,12 +1284,9 @@ mod tests {
fn library_context_menu_labels_have_french_translations() {
let saved = crate::i18n::language();
crate::i18n::set_language(crate::i18n::Locale::Fr);
for (label, expected) in [
("Pick", "Sélectionnée"),
("Reject", "Rejeter"),
("Group into Stack", "Regrouper en pile"),
("HDR Panorama…", "Panorama HDR…"),
] {
for (label, expected) in
[("Pick", "Sélectionnée"), ("Reject", "Rejeter"), ("Group into Stack", "Regrouper en pile"), ("HDR Panorama…", "Panorama HDR…")]
{
assert_eq!(crate::i18n::tr(label), expected);
}
crate::i18n::set_language(saved);
+18 -5
View File
@@ -38,9 +38,10 @@ impl AppliedPreset {
&& self.commits == session.commits()
&& session.interaction.is_none()
&& session.redo.is_empty()
&& session.undo.last().is_some_and(|entry| {
session.presets.iter().any(|preset| preset.id == self.id && entry.label == format!("Preset: {}", preset.name))
})
&& session
.undo
.last()
.is_some_and(|entry| session.presets.iter().any(|preset| preset.id == self.id && entry.label == format!("Preset: {}", preset.name)))
}
}
@@ -55,7 +56,17 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
.max_rect(Rect::from_min_max(pos2(hr.right() - 80.0, hr.top()), hr.right_bottom()))
.layout(egui::Layout::right_to_left(egui::Align::Center)),
);
if icon_button(&mut hdr, "presetCreate", Icon::Plus, vec2(28.0, 28.0), false, app.session.active().is_some(), crate::i18n::tr("Create Preset…")).clicked() {
if icon_button(
&mut hdr,
"presetCreate",
Icon::Plus,
vec2(28.0, 28.0),
false,
app.session.active().is_some(),
crate::i18n::tr("Create Preset…"),
)
.clicked()
{
app.ui.dialog = Some(crate::state::Dialog::create_preset());
}
let more = icon_button(&mut hdr, "presetMore", Icon::More, vec2(28.0, 28.0), false, true, crate::i18n::tr("More preset options"));
@@ -88,7 +99,9 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
track: Track::Plain,
};
let out = slider(ui, &spec, last.amount, true, None);
if let Some(v) = out.value && app.run("edit.undo", json!({})).is_ok() {
if let Some(v) = out.value
&& app.run("edit.undo", json!({})).is_ok()
{
// Only replace the most recent preset; never undo intervening edits.
if app.run("preset.apply", json!({"id": &last.id, "amount": v})).is_ok() {
ui.data_mut(|d| d.insert_temp(amt_id, AppliedPreset::new(&app.session, last.id, v)));
+3 -1
View File
@@ -63,7 +63,9 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
let search_left = full.center().x - sw / 2.0;
ui.horizontal_centered(|ui| {
ui.spacing_mut().item_spacing.x = 4.0;
if icon_button(ui, "sidebar", Icon::Sidebar, vec2(30.0, 30.0), app.ui.left_panel, true, crate::i18n::tr("Show/hide My Photos panel")).clicked() {
if icon_button(ui, "sidebar", Icon::Sidebar, vec2(30.0, 30.0), app.ui.left_panel, true, crate::i18n::tr("Show/hide My Photos panel"))
.clicked()
{
let _ = app.run("view.leftPanel", json!({}));
}
ui.add_space(8.0);