Enhance adjustments with sliders/effects, add undo toast, compress AVIF/progressive
This commit is contained in:
@@ -1128,9 +1128,30 @@ fn show_results(
|
||||
} else {
|
||||
format!("{} images processed", result.succeeded)
|
||||
};
|
||||
let toast = adw::Toast::new(&savings);
|
||||
toast.set_timeout(5);
|
||||
ui.toast_overlay.add_toast(toast.clone());
|
||||
// Undo toast with savings info
|
||||
let undo_toast = adw::Toast::new(&savings);
|
||||
undo_toast.set_button_label(Some("Undo"));
|
||||
undo_toast.set_timeout(10);
|
||||
{
|
||||
let output_dir = ui.state.output_dir.borrow().clone();
|
||||
undo_toast.connect_button_clicked(move |t| {
|
||||
if let Some(ref dir) = output_dir {
|
||||
let mut trashed = 0;
|
||||
if let Ok(entries) = std::fs::read_dir(dir) {
|
||||
for entry in entries.flatten() {
|
||||
let gfile = gtk::gio::File::for_path(entry.path());
|
||||
if gfile.trash(gtk::gio::Cancellable::NONE).is_ok() {
|
||||
trashed += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
t.dismiss();
|
||||
// Will show a new toast from the caller
|
||||
let _ = trashed;
|
||||
}
|
||||
});
|
||||
}
|
||||
ui.toast_overlay.add_toast(undo_toast);
|
||||
|
||||
// Desktop notification (if enabled in settings)
|
||||
let config_store = pixstrip_core::storage::ConfigStore::new();
|
||||
|
||||
Reference in New Issue
Block a user