LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Update prompt shows the app icon and accent color instead of a letter (#3362)
Dylan M. Taylor445dd3106ef0
diff --git a/Cargo.lock b/Cargo.lockindex fc59452fb..4abbe1b89 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -1238,13 +1238,14 @@ dependencies = [[[package]]name = "craft-update"version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"+source = "git+https://github.com/storytold/craft-libs?rev=1065653e75854e9c17e1ff563acdd344c1b185f0#1065653e75854e9c17e1ff563acdd344c1b185f0"dependencies = ["chrono","dunce","egui","flate2","getrandom 0.3.4",+ "image","log","plist","semver",diff --git a/Cargo.toml b/Cargo.tomlindex 2056f3e49..87f730e31 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -12,7 +12,8 @@ repository = "https://github.com/storytold/lightcraft"[workspace.dependencies]craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["serde"] }craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" }-craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] }+# craft-update with storytold/craft-libs#434: the update prompt shows the app's icon, accent and developer.+craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "1065653e75854e9c17e1ff563acdd344c1b185f0", features = ["egui"] }craft-window = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] }# internallightcraft-denoise-core = { path = "crates/denoise-core" }diff --git a/apps/lightcraft/src/main.rs b/apps/lightcraft/src/main.rsindex 7b572fa0e..f87f0dc72 100644--- a/apps/lightcraft/src/main.rs+++ b/apps/lightcraft/src/main.rs@@ -136,7 +136,7 @@ const EXIT_WAIT: std::time::Duration = std::time::Duration::from_secs(2);fn main() -> eframe::Result {// Windows: the update helper is a copy of this program started with `--finish-update`.#[cfg(windows)]- if let Some(result) = craft_update::self_update::finish(&craft_update::suite::LIGHTCRAFT, &std::env::args_os().skip(1).collect::<Vec<_>>()) {+ if let Some(result) = craft_update::self_update::finish(&lightcraft_ui_egui::UPDATE_APP, &std::env::args_os().skip(1).collect::<Vec<_>>()) {std::process::exit(i32::from(result.is_err()));}// First, so every start-up record is kept for the log file (`logging`).diff --git a/crates/engine/src/cmd/export.rs b/crates/engine/src/cmd/export.rsindex 949c08f1b..9af0606d9 100644--- a/crates/engine/src/cmd/export.rs+++ b/crates/engine/src/cmd/export.rs@@ -38,7 +38,7 @@ impl Session {}// the preset's depth is judged against the format written, known only now (`path`); a// depth the call passes itself is the caller's, and validated as such- if !p.get("bitDepth").is_some_and(|d| !d.is_null()) {+ if p.get("bitDepth").is_none_or(|d| d.is_null()) {crate::export::ExportOptions::drop_unfit_depth(&mut out, fallback);}Ok(out)diff --git a/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs b/crates/ui-egui/src/dialogs/rules_editor/rules_move.rsindex de5ccc2ef..8506a2826 100644--- a/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs+++ b/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs@@ -154,7 +154,7 @@ pub fn move_node(rs: &mut RuleSet, from: &[usize], dest: &[usize]) -> Option<Vec}let mut chain = from.get(..from.len().checked_sub(1)?)?.to_vec();// (a group the row is going into stays, however empty it is for now)- while !chain.is_empty() && !(dest.len() > chain.len() && dest.starts_with(&chain)) && list_at(&next, &chain).is_some_and(|l| l.rules.is_empty()) {+ while !(chain.is_empty() || dest.len() > chain.len() && dest.starts_with(&chain)) && list_at(&next, &chain).is_some_and(|l| l.rules.is_empty()) {remove_at(&mut next, &chain)?;if !shift_after_removal(&mut dest, &chain) {return None;diff --git a/crates/ui-egui/src/dialogs/updates_ui.rs b/crates/ui-egui/src/dialogs/updates_ui.rsindex 5e159a0f4..bdd2a81eb 100644--- a/crates/ui-egui/src/dialogs/updates_ui.rs+++ b/crates/ui-egui/src/dialogs/updates_ui.rs@@ -26,7 +26,7 @@ impl Default for Runtime {fn default() -> Self {Self {#[cfg(not(target_arch = "wasm32"))]- updater: Updater::new(&craft_update::suite::LIGHTCRAFT, env!("CARGO_PKG_VERSION")),+ updater: Updater::new(&crate::UPDATE_APP, env!("CARGO_PKG_VERSION")),#[cfg(not(target_arch = "wasm32"))]startup_check: false,#[cfg(not(target_arch = "wasm32"))]diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex 9db7035c1..8bf57b341 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -6,6 +6,15 @@#![forbid(unsafe_code)]#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]+/// LightCraft as craft-update knows it, with its 128 px icon and accent colour: the update+/// prompt shows both, and an AppImage's menu entry gets the icon.+#[cfg(not(target_arch = "wasm32"))]+pub const UPDATE_APP: craft_update::app::App = craft_update::app::App {+ icon_png: Some(include_bytes!("../../../assets/app-icon/hicolor/128x128/apps/ai.storyteller.lightcraft.png")),+ accent: Some([0xf2, 0xa5, 0x16]),+ ..craft_update::suite::LIGHTCRAFT+};+pub mod brush_live;pub mod canvas_keys;mod command_error;diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rsindex 2b58595d2..6840afdf0 100644--- a/crates/ui-egui/src/panels/detail.rs+++ b/crates/ui-egui/src/panels/detail.rs@@ -450,7 +450,7 @@ fn draw_wipe_before(app: &LightcraftApp, p: &egui::Painter, id: PhotoId, img_rec/// view render cached) so stepping to them is instant.fn prefetch_neighbours(app: &mut LightcraftApp, id: PhotoId, main_area: Rect, ppp: f32, texture_side: usize, with_crop: bool) {// only once this photo is on screen- if app.renderer.is_pending(Slot::Main) || !app.renderer.textures.get(&Slot::Main).is_some_and(|t| t.photo == id) {+ if app.renderer.is_pending(Slot::Main) || app.renderer.textures.get(&Slot::Main).is_none_or(|t| t.photo != id) {return;}let ids = app.session.visible_cloned();