From 9ede6e1fe43376399faa0baa9917d62f6c34fd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20S=C3=B6rng=C3=A5rd?= Date: Fri, 20 Sep 2024 16:15:04 +0200 Subject: [PATCH] Update iced to version 13 --- Cargo.lock | 570 ++++++++++++++++++++++++----------------------- codec/Cargo.toml | 4 +- codec/src/gui.rs | 320 +++++++++++++------------- 3 files changed, 448 insertions(+), 446 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4754b5..439c292 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "android-activity" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" +checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046" dependencies = [ "android-properties", "bitflags 2.6.0", @@ -335,32 +335,13 @@ dependencies = [ "generic-array", ] -[[package]] -name = "block-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7" -dependencies = [ - "objc-sys", -] - -[[package]] -name = "block2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" -dependencies = [ - "block-sys", - "objc2 0.4.1", -] - [[package]] name = "block2" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" dependencies = [ - "objc2 0.5.2", + "objc2", ] [[package]] @@ -416,23 +397,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" - -[[package]] -name = "calloop" -version = "0.12.4" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" -dependencies = [ - "bitflags 2.6.0", - "log", - "polling", - "rustix", - "slab", - "thiserror", -] +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "calloop" @@ -448,25 +415,13 @@ dependencies = [ "thiserror", ] -[[package]] -name = "calloop-wayland-source" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" -dependencies = [ - "calloop 0.12.4", - "rustix", - "wayland-backend", - "wayland-client 0.31.6", -] - [[package]] name = "calloop-wayland-source" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" dependencies = [ - "calloop 0.13.0", + "calloop", "rustix", "wayland-backend", "wayland-client 0.31.6", @@ -480,9 +435,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.20" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45bcde016d64c21da4be18b655631e5ab6d3107607e71a73a9f53eb48aae23fb" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ "jobserver", "libc", @@ -501,12 +456,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - [[package]] name = "cfg_aliases" version = "0.2.1" @@ -618,7 +567,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b7f4aaa047ba3c3630b080bb9860894732ff23e2aee290a418909aa6d5df38f" dependencies = [ - "objc2 0.5.2", + "objc2", "objc2-app-kit", "objc2-foundation", ] @@ -737,19 +686,21 @@ dependencies = [ [[package]] name = "cosmic-text" -version = "0.10.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75acbfb314aeb4f5210d379af45ed1ec2c98c7f1790bf57b8a4c562ac0c51b71" +checksum = "59fd57d82eb4bfe7ffa9b1cec0c05e2fd378155b47f255a67983cb4afe0e80c2" dependencies = [ + "bitflags 2.6.0", "fontdb", - "libm", "log", "rangemap", - "rustc-hash", + "rayon", + "rustc-hash 1.1.0", "rustybuzz", "self_cell", "swash", "sys-locale", + "ttf-parser 0.21.1", "unicode-bidi", "unicode-linebreak", "unicode-script", @@ -808,6 +759,25 @@ dependencies = [ "itertools", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -884,6 +854,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "dpi" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" + [[package]] name = "drm" version = "0.12.0" @@ -1072,16 +1048,16 @@ dependencies = [ [[package]] name = "fontdb" -version = "0.15.0" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020e203f177c0fb250fb19455a252e838d2bbbce1f80f25ecc42402aafa8cd38" +checksum = "b0299020c3ef3f60f526a4f64ab4a3d4ce116b1acbf24cdd22da0068e5d81dc3" dependencies = [ "fontconfig-parser", "log", - "memmap2 0.8.0", + "memmap2", "slotmap", "tinyvec", - "ttf-parser 0.19.2", + "ttf-parser 0.20.0", ] [[package]] @@ -1321,9 +1297,9 @@ dependencies = [ [[package]] name = "iced" -version = "0.12.1" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d4eb0fbbefb8c428b70680e77ed9013887b17c1d6be366b40f264f956d1a096" +checksum = "88acfabc84ec077eaf9ede3457ffa3a104626d79022a9bf7f296093b1d60c73f" dependencies = [ "iced_core", "iced_futures", @@ -1335,40 +1311,42 @@ dependencies = [ [[package]] name = "iced_core" -version = "0.12.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d7e6bbd197f311ed3d8b71651876b0ce01318fde52cda862a9a7a4373c9b930" +checksum = "afa341b914c93e1afc651c8b5c5b6c88aa68aa92e7d9923366b97a85a7f2ba46" dependencies = [ "bitflags 2.6.0", + "bytes", "glam", "log", "num-traits", + "once_cell", "palette", - "raw-window-handle", + "rustc-hash 2.0.0", "smol_str", "thiserror", "web-time", - "xxhash-rust", ] [[package]] name = "iced_futures" -version = "0.12.0" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "370bad88fb3832cbeeb3fa6c486b4701fb7e8da32a753b3101d4ce81fc1d9497" +checksum = "0c04a6745ba2e80f32cf01e034fd00d853aa4f4cd8b91888099cb7aaee0d5d7c" dependencies = [ "futures", "iced_core", "log", + "rustc-hash 2.0.0", "wasm-bindgen-futures", "wasm-timer", ] [[package]] name = "iced_graphics" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a044c193ef0840eacabfa05424717331d1fc5b3ecb9a89316200c75da2ba9a4" +checksum = "ba25a18cfa6d5cc160aca7e1b34f73ccdff21680fa8702168c09739767b6c66f" dependencies = [ "bitflags 2.6.0", "bytemuck", @@ -1379,17 +1357,16 @@ dependencies = [ "log", "once_cell", "raw-window-handle", - "rustc-hash", + "rustc-hash 2.0.0", "thiserror", "unicode-segmentation", - "xxhash-rust", ] [[package]] name = "iced_renderer" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c281e03001d566058f53dec9325bbe61c62da715341206d2627f57a3ecc7f69" +checksum = "73558208059f9e622df2bf434e044ee2f838ce75201a023cf0ca3e1244f46c2a" dependencies = [ "iced_graphics", "iced_tiny_skia", @@ -1399,87 +1376,68 @@ dependencies = [ [[package]] name = "iced_runtime" -version = "0.12.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a79f852c01cc6d61663c94379cb3974ac3ad315a28c504e847d573e094f46822" +checksum = "348b5b2c61c934d88ca3b0ed1ed913291e923d086a66fa288ce9669da9ef62b5" dependencies = [ + "bytes", "iced_core", "iced_futures", "raw-window-handle", "thiserror", ] -[[package]] -name = "iced_style" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ea42a740915d2a5a9ff9c3aa0bca28b16e9fb660bc8f675eed71d186cadb579" -dependencies = [ - "iced_core", - "once_cell", - "palette", -] - [[package]] name = "iced_tiny_skia" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2228781f4d381a1cbbd7905a9f077351aa8d37269094021d5d9e779f130aff" +checksum = "c625d368284fcc43b0b36b176f76eff1abebe7959dd58bd8ce6897d641962a50" dependencies = [ "bytemuck", "cosmic-text", "iced_graphics", "kurbo", "log", - "rustc-hash", + "rustc-hash 2.0.0", "softbuffer", "tiny-skia", - "xxhash-rust", ] [[package]] name = "iced_widget" -version = "0.12.3" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e01b2212adecf1cb80e2267f302c0e0c263e55f97812056949199ccf9f0b908" +checksum = "23eef161bcd216f3472916570919dc3542647285da9cc81085b8d5cb434dc870" dependencies = [ "iced_renderer", "iced_runtime", - "iced_style", "num-traits", + "once_cell", + "rustc-hash 2.0.0", "thiserror", "unicode-segmentation", ] [[package]] name = "iced_winit" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63f66831d0e399b93f631739121a6171780d344b275d56808b9504d8ca75c7d2" +checksum = "f44cd4e1c594b6334f409282937bf972ba14d31fedf03c23aa595d982a2fda28" dependencies = [ + "iced_futures", "iced_graphics", "iced_runtime", - "iced_style", "log", + "rustc-hash 2.0.0", "thiserror", "tracing", + "wasm-bindgen-futures", "web-sys", "winapi", "window_clipboard", "winit", ] -[[package]] -name = "icrate" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" -dependencies = [ - "block2 0.3.0", - "dispatch", - "objc2 0.4.1", -] - [[package]] name = "idna" version = "0.5.0" @@ -1661,15 +1619,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memmap2" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a5a03cefb0d953ec0be133036f14e109412fa594edc2f77227249db66cc3ed" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.9.5" @@ -1744,9 +1693,9 @@ dependencies = [ [[package]] name = "ndk" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" dependencies = [ "bitflags 2.6.0", "jni-sys", @@ -1765,9 +1714,9 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.5.0+25.2.9519653" +version = "0.6.0+11769913" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" dependencies = [ "jni-sys", ] @@ -1792,7 +1741,7 @@ checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" dependencies = [ "bitflags 2.6.0", "cfg-if", - "cfg_aliases 0.2.1", + "cfg_aliases", "libc", "memoffset 0.9.1", ] @@ -1873,16 +1822,6 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" -[[package]] -name = "objc2" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" -dependencies = [ - "objc-sys", - "objc2-encode 3.0.0", -] - [[package]] name = "objc2" version = "0.5.2" @@ -1890,7 +1829,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" dependencies = [ "objc-sys", - "objc2-encode 4.0.3", + "objc2-encode", ] [[package]] @@ -1900,15 +1839,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", + "block2", "libc", - "objc2 0.5.2", + "objc2", "objc2-core-data", "objc2-core-image", "objc2-foundation", "objc2-quartz-core", ] +[[package]] +name = "objc2-cloud-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-core-location", + "objc2-foundation", +] + +[[package]] +name = "objc2-contacts" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889" +dependencies = [ + "block2", + "objc2", + "objc2-foundation", +] + [[package]] name = "objc2-core-data" version = "0.2.2" @@ -1916,8 +1879,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", - "objc2 0.5.2", + "block2", + "objc2", "objc2-foundation", ] @@ -1927,17 +1890,23 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80" dependencies = [ - "block2 0.5.1", - "objc2 0.5.2", + "block2", + "objc2", "objc2-foundation", "objc2-metal", ] [[package]] -name = "objc2-encode" -version = "3.0.0" +name = "objc2-core-location" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" +checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781" +dependencies = [ + "block2", + "objc2", + "objc2-contacts", + "objc2-foundation", +] [[package]] name = "objc2-encode" @@ -1952,9 +1921,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", + "block2", + "dispatch", "libc", - "objc2 0.5.2", + "objc2", +] + +[[package]] +name = "objc2-link-presentation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398" +dependencies = [ + "block2", + "objc2", + "objc2-app-kit", + "objc2-foundation", ] [[package]] @@ -1964,8 +1946,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", - "objc2 0.5.2", + "block2", + "objc2", "objc2-foundation", ] @@ -1976,12 +1958,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a" dependencies = [ "bitflags 2.6.0", - "block2 0.5.1", - "objc2 0.5.2", + "block2", + "objc2", "objc2-foundation", "objc2-metal", ] +[[package]] +name = "objc2-symbols" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-image", + "objc2-core-location", + "objc2-foundation", + "objc2-link-presentation", + "objc2-quartz-core", + "objc2-symbols", + "objc2-uniform-type-identifiers", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-uniform-type-identifiers" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe" +dependencies = [ + "block2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3" +dependencies = [ + "bitflags 2.6.0", + "block2", + "objc2", + "objc2-core-location", + "objc2-foundation", +] + [[package]] name = "objc_id" version = "0.1.1" @@ -2154,6 +2191,26 @@ dependencies = [ "siphasher", ] +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "pin-project-lite" version = "0.2.14" @@ -2333,6 +2390,26 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "read-fonts" version = "0.20.0" @@ -2352,15 +2429,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2439,9 +2507,9 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c923eb995dc793cd26858a18f4bcce2df4b4a14a1ec767ea21a83b17b65f9aa" +checksum = "395027076c569819ea6035ee62e664f5e03d74e281744f55261dd1afd939212b" dependencies = [ "bytes", "hashbrown", @@ -2457,9 +2525,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fe1bd2d15adf4f037438696f8efe7ad1eae0b10d53bb0946d6a93faaf96051" +checksum = "09cb82b74b4810f07e460852c32f522e979787691b0b7b7439fe473e49d49b2f" dependencies = [ "proc-macro2", "quote", @@ -2478,6 +2546,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustix" version = "0.38.37" @@ -2493,15 +2567,15 @@ dependencies = [ [[package]] name = "rustybuzz" -version = "0.11.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee8fe2a8461a0854a37101fe7a1b13998d0cfa987e43248e81d2a5f4570f6fa" +checksum = "cfb9cf8877777222e4a3bc7eb247e398b56baba500c38c1c46842431adc8b55c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "bytemuck", "libm", "smallvec", - "ttf-parser 0.20.0", + "ttf-parser 0.21.1", "unicode-bidi-mirroring", "unicode-ccc", "unicode-properties", @@ -2537,14 +2611,14 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sctk-adwaita" -version = "0.8.3" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70b31447ca297092c5a9916fc3b955203157b37c19ca8edde4f52e9843e602c7" +checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" dependencies = [ "ab_glyph", "log", - "memmap2 0.9.5", - "smithay-client-toolkit 0.18.1", + "memmap2", + "smithay-client-toolkit", "tiny-skia", ] @@ -2669,31 +2743,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "smithay-client-toolkit" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" -dependencies = [ - "bitflags 2.6.0", - "calloop 0.12.4", - "calloop-wayland-source 0.2.0", - "cursor-icon", - "libc", - "log", - "memmap2 0.9.5", - "rustix", - "thiserror", - "wayland-backend", - "wayland-client 0.31.6", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols 0.31.2", - "wayland-protocols-wlr 0.2.0", - "wayland-scanner 0.31.5", - "xkeysym", -] - [[package]] name = "smithay-client-toolkit" version = "0.19.2" @@ -2701,12 +2750,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" dependencies = [ "bitflags 2.6.0", - "calloop 0.13.0", - "calloop-wayland-source 0.3.0", + "calloop", + "calloop-wayland-source", "cursor-icon", "libc", "log", - "memmap2 0.9.5", + "memmap2", "rustix", "thiserror", "wayland-backend", @@ -2714,7 +2763,7 @@ dependencies = [ "wayland-csd-frame", "wayland-cursor", "wayland-protocols 0.32.4", - "wayland-protocols-wlr 0.3.4", + "wayland-protocols-wlr", "wayland-scanner 0.31.5", "xkeysym", ] @@ -2726,7 +2775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc8216eec463674a0e90f29e0ae41a4db573ec5b56b1c6c1c71615d249b6d846" dependencies = [ "libc", - "smithay-client-toolkit 0.19.2", + "smithay-client-toolkit", "wayland-backend", ] @@ -2747,15 +2796,15 @@ checksum = "18051cdd562e792cad055119e0cdb2cfc137e44e3987532e0f9659a77931bb08" dependencies = [ "as-raw-xcb-connection", "bytemuck", - "cfg_aliases 0.2.1", + "cfg_aliases", "core-graphics 0.24.0", "drm", "fastrand", "foreign-types", "js-sys", "log", - "memmap2 0.9.5", - "objc2 0.5.2", + "memmap2", + "objc2", "objc2-foundation", "objc2-quartz-core", "raw-window-handle", @@ -2992,15 +3041,15 @@ dependencies = [ [[package]] name = "ttf-parser" -version = "0.19.2" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1" +checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" [[package]] name = "ttf-parser" -version = "0.20.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" +checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8" [[package]] name = "ttf-parser" @@ -3033,15 +3082,15 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-bidi-mirroring" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694" +checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86" [[package]] name = "unicode-ccc" -version = "0.1.2" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" +checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656" [[package]] name = "unicode-ident" @@ -3057,9 +3106,9 @@ checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] @@ -3072,9 +3121,9 @@ checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524" [[package]] name = "unicode-script" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d71f5726e5f285a935e9fe8edfd53f0491eb6e9a5774097fdabee7cd8c9cd" +checksum = "9fb421b350c9aff471779e262955939f565ec18b86c15364e6bdf0d662ca7c1f" [[package]] name = "unicode-segmentation" @@ -3297,18 +3346,6 @@ dependencies = [ "wayland-scanner 0.29.5", ] -[[package]] -name = "wayland-protocols" -version = "0.31.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client 0.31.6", - "wayland-scanner 0.31.5", -] - [[package]] name = "wayland-protocols" version = "0.32.4" @@ -3323,27 +3360,14 @@ dependencies = [ [[package]] name = "wayland-protocols-plasma" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client 0.31.6", - "wayland-protocols 0.31.2", - "wayland-scanner 0.31.5", -] - -[[package]] -name = "wayland-protocols-wlr" -version = "0.2.0" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" +checksum = "8a0a41a6875e585172495f7a96dfa42ca7e0213868f4f15c313f7c33221a7eff" dependencies = [ "bitflags 2.6.0", "wayland-backend", "wayland-client 0.31.6", - "wayland-protocols 0.31.2", + "wayland-protocols 0.32.4", "wayland-scanner 0.31.5", ] @@ -3405,9 +3429,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -3415,9 +3439,9 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -3693,47 +3717,51 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" -version = "0.29.15" +version = "0.30.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d59ad965a635657faf09c8f062badd885748428933dad8e8bdd64064d92e5ca" +checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67" dependencies = [ "ahash", "android-activity", "atomic-waker", "bitflags 2.6.0", + "block2", "bytemuck", - "calloop 0.12.4", - "cfg_aliases 0.1.1", + "calloop", + "cfg_aliases", + "concurrent-queue", "core-foundation 0.9.4", "core-graphics 0.23.2", "cursor-icon", - "icrate", + "dpi", "js-sys", "libc", - "log", - "memmap2 0.9.5", + "memmap2", "ndk", - "ndk-sys", - "objc2 0.4.1", - "once_cell", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", "orbclient", "percent-encoding", + "pin-project", "raw-window-handle", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix", "sctk-adwaita", - "smithay-client-toolkit 0.18.1", + "smithay-client-toolkit", "smol_str", + "tracing", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", "wayland-backend", "wayland-client 0.31.6", - "wayland-protocols 0.31.2", + "wayland-protocols 0.32.4", "wayland-protocols-plasma", "web-sys", "web-time", - "windows-sys 0.48.0", + "windows-sys 0.52.0", "x11-dl", "x11rb 0.13.1", "xkbcommon-dl", @@ -3870,12 +3898,6 @@ version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26" -[[package]] -name = "xxhash-rust" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" - [[package]] name = "yazi" version = "0.1.6" diff --git a/codec/Cargo.toml b/codec/Cargo.toml index 5321ad3..75f3aaf 100644 --- a/codec/Cargo.toml +++ b/codec/Cargo.toml @@ -15,7 +15,7 @@ description = "Convert an ASCII text string into a single unicode grapheme clust zalgo-codec-common = { version = "0.12.1", default-features = false } zalgo-codec-macro = { version = "0.1.29", optional = true } anyhow = { version = "1.0", default-features = false, optional = true } -iced = { version = "0.12", default-features = false, optional = true } +iced = { version = "0.13", default-features = false, features = ["tiny-skia"], optional = true } rfd = { version = "0.14", optional = true } cli-clipboard = { version = "0.4", default-features = false, optional = true } clap = { version = "4.5", default-features = false, features = ["derive"], optional = true } @@ -25,7 +25,7 @@ rand = { version = "0.8", default-features = false, features = ["alloc", "std", unicode-segmentation = { version = "1.11", features = ["no_std"] } [features] -default = ["macro", "std"] +default = ["macro", "std", "gui"] # Builds a binary that can be used to test out the codec. binary = ["std", "dep:clap", "dep:anyhow"] diff --git a/codec/src/gui.rs b/codec/src/gui.rs index 3242fde..ff32781 100644 --- a/codec/src/gui.rs +++ b/codec/src/gui.rs @@ -1,8 +1,9 @@ use cli_clipboard::set_contents; use iced::{ - self, executor, + self, widget::{button::Button, column, row, text::Text, text_input::TextInput, Space}, - Application, Command, Element, Length, Size, Theme, + window::Settings, + Element, Length, Size, Task, }; use rfd::FileDialog; use zalgo_codec_common::{zalgo_decode, zalgo_encode, zalgo_wrap_python}; @@ -36,203 +37,182 @@ enum ToplevelMessage { User(UserAction), } -#[derive(Debug)] +#[derive(Debug, Default)] struct ZalgoCodecGui { input_field: String, output_field: String, notifications: Vec, } -impl ZalgoCodecGui { - fn new() -> Self { - Self { - input_field: String::default(), - output_field: String::default(), - notifications: Vec::default(), +fn update(state: &mut ZalgoCodecGui, message: ToplevelMessage) -> Task { + match message { + ToplevelMessage::CodecFinished(result) => { + state.output_field = result; + Task::none() } - } -} - -impl Application for ZalgoCodecGui { - type Executor = executor::Default; - type Flags = (); - type Theme = Theme; - type Message = ToplevelMessage; - - fn new(_flags: Self::Flags) -> (Self, Command) { - (ZalgoCodecGui::new(), Command::none()) - } - - fn title(&self) -> String { - String::from("zalgo codec GUI") - } - - fn update(&mut self, message: Self::Message) -> Command { - match message { - Self::Message::CodecFinished(result) => { - self.output_field = result; - Command::none() - } - Self::Message::PushNotification(notification) => { - self.notifications.push(notification); - Command::perform( - async { std::thread::sleep(std::time::Duration::from_secs(5)) }, - |_| ToplevelMessage::TimerFinised(TimedAction::PopNotification), - ) + ToplevelMessage::PushNotification(notification) => { + state.notifications.push(notification); + Task::perform( + async { std::thread::sleep(std::time::Duration::from_secs(5)) }, + |_| ToplevelMessage::TimerFinised(TimedAction::PopNotification), + ) + } + ToplevelMessage::TimerFinised(action) => { + match action { + TimedAction::PopNotification => state.notifications.pop(), + }; + Task::none() + } + ToplevelMessage::User(action) => match action { + UserAction::EditedInputText(text) => { + state.input_field = text; + Task::none() } - Self::Message::TimerFinised(action) => { - match action { - TimedAction::PopNotification => self.notifications.pop(), - }; - Command::none() + UserAction::Pressed(GuiButton::Encode) => { + let input = state.input_field.clone(); + Task::perform(async move { zalgo_encode(&input) }, |res| match res { + Ok(encoded) => ToplevelMessage::CodecFinished(encoded), + Err(e) => ToplevelMessage::PushNotification(e.to_string()), + }) } - Self::Message::User(action) => match action { - UserAction::EditedInputText(text) => { - self.input_field = text; - Command::none() - } - UserAction::Pressed(GuiButton::Encode) => { - let input = self.input_field.clone(); - Command::perform(async move { zalgo_encode(&input) }, |res| match res { - Ok(encoded) => ToplevelMessage::CodecFinished(encoded), + UserAction::Pressed(GuiButton::Decode) => { + let input = state.input_field.clone(); + if input.is_empty() { + Task::perform( + async { String::from("the input string was empty") }, + ToplevelMessage::PushNotification, + ) + } else { + Task::perform(async move { zalgo_decode(&input) }, |res| match res { + Ok(decoded) => ToplevelMessage::CodecFinished(decoded), Err(e) => ToplevelMessage::PushNotification(e.to_string()), }) } - UserAction::Pressed(GuiButton::Decode) => { - let input = self.input_field.clone(); - if input.is_empty() { - Command::perform( - async { String::from("the input string was empty") }, - ToplevelMessage::PushNotification, - ) - } else { - Command::perform(async move { zalgo_decode(&input) }, |res| match res { - Ok(decoded) => ToplevelMessage::CodecFinished(decoded), - Err(e) => ToplevelMessage::PushNotification(e.to_string()), - }) - } + } + UserAction::Pressed(GuiButton::Wrap) => { + let input = state.input_field.clone(); + Task::perform(async move { zalgo_wrap_python(&input) }, |res| match res { + Ok(wrapped) => ToplevelMessage::CodecFinished(wrapped), + Err(e) => ToplevelMessage::PushNotification(e.to_string()), + }) + } + UserAction::Pressed(GuiButton::Unwrap) => { + let mut chars = state.input_field.chars(); + for _ in 0..3 { + chars.next(); } - UserAction::Pressed(GuiButton::Wrap) => { - let input = self.input_field.clone(); - Command::perform(async move { zalgo_wrap_python(&input) }, |res| match res { - Ok(wrapped) => ToplevelMessage::CodecFinished(wrapped), - Err(e) => ToplevelMessage::PushNotification(e.to_string()), - }) + for _ in 0..88 { + chars.next_back(); } - UserAction::Pressed(GuiButton::Unwrap) => { - let mut chars = self.input_field.chars(); - for _ in 0..3 { - chars.next(); - } - for _ in 0..88 { - chars.next_back(); - } - let encoded: String = chars.collect(); - Command::perform(async move { zalgo_decode(&encoded) }, |res| match res { - Ok(unwrapped) => ToplevelMessage::CodecFinished(unwrapped), - Err(e) => ToplevelMessage::PushNotification(e.to_string()), - }) + let encoded: String = chars.collect(); + Task::perform(async move { zalgo_decode(&encoded) }, |res| match res { + Ok(unwrapped) => ToplevelMessage::CodecFinished(unwrapped), + Err(e) => ToplevelMessage::PushNotification(e.to_string()), + }) + } + UserAction::Pressed(GuiButton::Copy) => { + if let Err(e) = set_contents(state.output_field.clone()) { + let s = e.to_string(); + Task::future(async { ToplevelMessage::PushNotification(s) }) + } else { + Task::none() } - UserAction::Pressed(GuiButton::Copy) => { - if let Err(e) = set_contents(self.output_field.clone()) { + } + UserAction::Pressed(GuiButton::SaveAs) => { + if let Some(path) = FileDialog::new().set_file_name("zalgo.txt").save_file() { + if let Err(e) = std::fs::write(path, &state.output_field) { let s = e.to_string(); - Command::perform(async {}, |_| ToplevelMessage::PushNotification(s)) + Task::future(async { ToplevelMessage::PushNotification(s) }) } else { - Command::none() + Task::none() } + } else { + Task::none() } - UserAction::Pressed(GuiButton::SaveAs) => { - if let Some(path) = FileDialog::new().set_file_name("zalgo.txt").save_file() { - if let Err(e) = std::fs::write(path, &self.output_field) { - let s = e.to_string(); - Command::perform(async {}, |_| ToplevelMessage::PushNotification(s)) - } else { - Command::none() - } - } else { - Command::none() - } - } - }, - } + } + }, } +} - fn view(&self) -> Element<'_, Self::Message> { - const BUTTON_WIDTH: f32 = 70.0; - const SPACE_HEIGHT: f32 = 10.0; - column![ - row![ - column![ - Space::with_height(Length::Fixed(SPACE_HEIGHT)), - TextInput::new("Type or paste text here!", &self.input_field) - .on_input(|s| ToplevelMessage::User(UserAction::EditedInputText(s))) - .on_paste(|s| ToplevelMessage::User(UserAction::EditedInputText(s))), - Space::with_height(Length::Fixed(SPACE_HEIGHT)), - Button::new("Encode") - .on_press(ToplevelMessage::User(UserAction::Pressed( - GuiButton::Encode, - ))) - .width(Length::Fixed(BUTTON_WIDTH)), - Space::with_height(Length::Fixed(SPACE_HEIGHT)), - Button::new("Decode") - .on_press(ToplevelMessage::User(UserAction::Pressed( - GuiButton::Decode, - ))) - .width(Length::Fixed(BUTTON_WIDTH)), - Space::with_height(Length::Fixed(SPACE_HEIGHT)), - Button::new("Wrap") - .on_press(ToplevelMessage::User(UserAction::Pressed(GuiButton::Wrap))) - .width(Length::Fixed(BUTTON_WIDTH)), - Space::with_height(Length::Fixed(SPACE_HEIGHT)), - Button::new("Unwrap") - .on_press(ToplevelMessage::User(UserAction::Pressed( - GuiButton::Unwrap - ))) - .width(Length::Fixed(BUTTON_WIDTH)), - ] - .width(Length::FillPortion(3)), - Space::with_width(Length::Fill), - column![ - Space::with_height(Length::Fixed(SPACE_HEIGHT)), - Text::new(&self.output_field), - Space::with_height(Length::Fixed(SPACE_HEIGHT)), - Button::new("Copy") - .on_press(ToplevelMessage::User(UserAction::Pressed(GuiButton::Copy))) - .width(Length::Fixed(BUTTON_WIDTH)), - Space::with_height(Length::Fixed(SPACE_HEIGHT)), - Button::new("Save as") - .on_press(ToplevelMessage::User(UserAction::Pressed( - GuiButton::SaveAs - ))) - .width(Length::Fixed(BUTTON_WIDTH)), - ] - .width(Length::FillPortion(3)), +fn view(state: &ZalgoCodecGui) -> Element { + const BUTTON_WIDTH: f32 = 80.0; + const SPACE_HEIGHT: f32 = 10.0; + column![ + row![ + column![ + Space::with_height(Length::Fixed(SPACE_HEIGHT)), + TextInput::new("Type or paste text here!", &state.input_field) + .on_input(|s| ToplevelMessage::User(UserAction::EditedInputText(s))) + .on_paste(|s| ToplevelMessage::User(UserAction::EditedInputText(s))), + Space::with_height(Length::Fixed(SPACE_HEIGHT)), + Button::new("Encode") + .on_press(ToplevelMessage::User(UserAction::Pressed( + GuiButton::Encode, + ))) + .width(Length::Fixed(BUTTON_WIDTH)), + Space::with_height(Length::Fixed(SPACE_HEIGHT)), + Button::new("Decode") + .on_press(ToplevelMessage::User(UserAction::Pressed( + GuiButton::Decode, + ))) + .width(Length::Fixed(BUTTON_WIDTH)), + Space::with_height(Length::Fixed(SPACE_HEIGHT)), + Button::new("Wrap") + .on_press(ToplevelMessage::User(UserAction::Pressed(GuiButton::Wrap))) + .width(Length::Fixed(BUTTON_WIDTH)), + Space::with_height(Length::Fixed(SPACE_HEIGHT)), + Button::new("Unwrap") + .on_press(ToplevelMessage::User(UserAction::Pressed( + GuiButton::Unwrap + ))) + .width(Length::Fixed(BUTTON_WIDTH)), ] - .width(Length::Fill), - Space::with_height(SPACE_HEIGHT), - Text::new( - self.notifications - .iter() - .rev() - .fold(String::new(), |toast, msg| format!("{toast}\n{msg}")) - ) - .width(Length::Fill) - .height(Length::Fill), + .width(Length::FillPortion(3)), + Space::with_width(Length::Fill), + column![ + Space::with_height(Length::Fixed(SPACE_HEIGHT)), + Text::new(&state.output_field), + Space::with_height(Length::Fixed(SPACE_HEIGHT)), + Button::new("Copy") + .on_press(ToplevelMessage::User(UserAction::Pressed(GuiButton::Copy))) + .width(Length::Fixed(BUTTON_WIDTH)), + Space::with_height(Length::Fixed(SPACE_HEIGHT)), + Button::new("Save as") + .on_press(ToplevelMessage::User(UserAction::Pressed( + GuiButton::SaveAs + ))) + .width(Length::Fixed(BUTTON_WIDTH)), + ] + .width(Length::FillPortion(3)), ] + .width(Length::Fill), + Space::with_height(SPACE_HEIGHT), + Text::new( + state + .notifications + .iter() + .rev() + .fold(String::new(), |toast, msg| format!("{toast}\n{msg}")) + ) .width(Length::Fill) - .into() - } + .height(Length::Fill), + ] + .width(Length::Fill) + .into() } /// Runs the GUI version of the application and then exits. pub fn run_gui() -> ! { - match ZalgoCodecGui::run(iced::Settings { - window: iced::window::Settings { - size: Size::new(500.0, 300.0), + match iced::application("zalgo codec GUI", update, view) + .window(Settings { + size: Size { + width: 500.0, + height: 300.0, + }, ..Default::default() - }, - ..Default::default() - }) { + }) + .run() + { Ok(()) => std::process::exit(0), Err(e) => { eprintln!("GUI failed with error: {e}");