From 32857d273016a803142ec70eb99a2134a83c24d0 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Wed, 13 Mar 2024 10:27:27 +0000 Subject: [PATCH 01/12] updates to widgets --- Cargo.lock | 1374 +++++++++++++++++++++--- crates/core/Cargo.toml | 16 +- crates/widgets/Cargo.toml | 10 +- crates/widgets/src/widget/header.rs | 719 ++++++------- crates/widgets/src/widget/table_row.rs | 639 +++++------ src/gui/element/wallet/setup/init.rs | 3 + 6 files changed, 1951 insertions(+), 810 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8416ce1..008615e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -99,6 +99,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" dependencies = [ "cfg-if 1.0.0", + "getrandom 0.2.12", "once_cell", "version_check", "zerocopy", @@ -137,12 +138,33 @@ dependencies = [ "jni-sys", "libc", "log", - "ndk", + "ndk 0.7.0", "ndk-context", - "ndk-sys", + "ndk-sys 0.4.1+23.1.7779620", "num_enum 0.6.1", ] +[[package]] +name = "android-activity" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" +dependencies = [ + "android-properties", + "bitflags 2.4.2", + "cc", + "cesu8", + "jni", + "jni-sys", + "libc", + "log", + "ndk 0.8.0", + "ndk-context", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum 0.7.2", + "thiserror", +] + [[package]] name = "android-properties" version = "0.2.2" @@ -237,6 +259,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "as-raw-xcb-connection" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b" + [[package]] name = "ascii" version = "1.1.0" @@ -648,7 +676,16 @@ version = "0.1.0-beta.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" dependencies = [ - "objc-sys", + "objc-sys 0.2.0-beta.2", +] + +[[package]] +name = "block-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7" +dependencies = [ + "objc-sys 0.3.2", ] [[package]] @@ -657,8 +694,18 @@ version = "0.2.0-alpha.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" dependencies = [ - "block-sys", - "objc2-encode", + "block-sys 0.1.0-beta.1", + "objc2-encode 2.0.0-pre.2", +] + +[[package]] +name = "block2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" +dependencies = [ + "block-sys 0.2.1", + "objc2 0.4.1", ] [[package]] @@ -851,6 +898,12 @@ dependencies = [ "libc", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cfg-expr" version = "0.8.1" @@ -878,6 +931,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +[[package]] +name = "cfg_aliases" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77e53693616d3075149f4ead59bdeecd204ac6b8192d8969757601b74bddf00f" + [[package]] name = "chacha20" version = "0.8.2" @@ -949,11 +1008,20 @@ version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" dependencies = [ - "error-code", + "error-code 2.3.1", "str-buf", "winapi 0.3.9", ] +[[package]] +name = "clipboard-win" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9a0700e0127ba15d1d52dd742097f821cd9c65939303a44d970465040a297" +dependencies = [ + "error-code 3.2.0", +] + [[package]] name = "clipboard_macos" version = "0.1.0" @@ -1003,8 +1071,24 @@ dependencies = [ "block", "cocoa-foundation", "core-foundation 0.9.4", - "core-graphics", - "foreign-types", + "core-graphics 0.22.3", + "foreign-types 0.3.2", + "libc", + "objc", +] + +[[package]] +name = "cocoa" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6140449f97a6e97f9511815c5632d84c8aacf8ac271ad77c559218161a1373c" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation 0.9.4", + "core-graphics 0.23.1", + "foreign-types 0.5.0", "libc", "objc", ] @@ -1039,12 +1123,53 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "com" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e17887fd17353b65b1b2ef1c526c83e26cd72e74f598a8dc1bee13a48f3d9f6" +dependencies = [ + "com_macros", +] + [[package]] name = "com-rs" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" +[[package]] +name = "com_macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5" +dependencies = [ + "com_macros_support", + "proc-macro2 1.0.78", + "syn 1.0.109", +] + +[[package]] +name = "com_macros_support" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c" +dependencies = [ + "proc-macro2 1.0.78", + "quote 1.0.35", + "syn 1.0.109", +] + +[[package]] +name = "combine" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +dependencies = [ + "bytes 1.5.0", + "memchr", +] + [[package]] name = "concurrent-queue" version = "2.4.0" @@ -1113,7 +1238,20 @@ dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.4", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "970a29baf4110c26fedbc7f82107d42c23f7e88e404c4577ed73fe99ff85a212" +dependencies = [ + "bitflags 1.3.2", + "core-foundation 0.9.4", + "core-graphics-types", + "foreign-types 0.5.0", "libc", ] @@ -1135,8 +1273,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" dependencies = [ "core-foundation 0.9.4", - "core-graphics", - "foreign-types", + "core-graphics 0.22.3", + "foreign-types 0.3.2", "libc", ] @@ -1147,11 +1285,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b0b68966c2543609f8d92f9d33ac3b719b2a67529b0c6c0b3e025637b477eef9" dependencies = [ "aliasable", - "fontdb", + "fontdb 0.14.1", + "libm", + "log", + "rangemap", + "rustybuzz 0.8.0", + "swash", + "sys-locale", + "unicode-bidi", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", +] + +[[package]] +name = "cosmic-text" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75acbfb314aeb4f5210d379af45ed1ec2c98c7f1790bf57b8a4c562ac0c51b71" +dependencies = [ + "fontdb 0.15.0", "libm", "log", "rangemap", - "rustybuzz", + "rustc-hash", + "rustybuzz 0.11.0", + "self_cell 1.0.3", "swash", "sys-locale", "unicode-bidi", @@ -1278,6 +1437,16 @@ dependencies = [ "sct", ] +[[package]] +name = "ctor" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" +dependencies = [ + "quote 1.0.35", + "syn 2.0.50", +] + [[package]] name = "cty" version = "0.2.2" @@ -1358,6 +1527,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "d3d12" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" +dependencies = [ + "bitflags 2.4.2", + "libloading 0.8.1", + "winapi 0.3.9", +] + [[package]] name = "darling" version = "0.13.4" @@ -1555,6 +1735,45 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "drm" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde" +dependencies = [ + "bitflags 2.4.2", + "bytemuck", + "drm-ffi", + "drm-fourcc", + "rustix 0.38.31", +] + +[[package]] +name = "drm-ffi" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41334f8405792483e32ad05fbb9c5680ff4e84491883d2947a4757dc54cb2ac6" +dependencies = [ + "drm-sys", + "rustix 0.38.31", +] + +[[package]] +name = "drm-fourcc" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aafbcdb8afc29c1a7ee5fbe53b5d62f4565b35a042a662ca9fecd0b54dae6f4" + +[[package]] +name = "drm-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d09ff881f92f118b11105ba5e34ff8f4adf27b30dae8f12e28c193af1c83176" +dependencies = [ + "libc", + "linux-raw-sys 0.6.4", +] + [[package]] name = "dwrote" version = "0.11.0" @@ -1684,6 +1903,12 @@ dependencies = [ "str-buf", ] +[[package]] +name = "error-code" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b" + [[package]] name = "etagere" version = "0.2.10" @@ -1915,7 +2140,7 @@ dependencies = [ "bitflags 1.3.2", "byteorder", "core-foundation 0.9.4", - "core-graphics", + "core-graphics 0.22.3", "core-text", "dirs-next 2.0.0", "dwrote", @@ -1937,6 +2162,15 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bd7f3ea17572640b606b35df42cfb6ecdf003704b062580e59918692190b73d" +[[package]] +name = "fontconfig-parser" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a595cb550439a117696039dfc69830492058211b771a2a165379f2a1a53d84d" +dependencies = [ + "roxmltree", +] + [[package]] name = "fontdb" version = "0.14.1" @@ -1950,13 +2184,48 @@ dependencies = [ "ttf-parser 0.19.2", ] +[[package]] +name = "fontdb" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020e203f177c0fb250fb19455a252e838d2bbbce1f80f25ecc42402aafa8cd38" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2 0.8.0", + "slotmap", + "tinyvec", + "ttf-parser 0.19.2", +] + [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared", + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2 1.0.78", + "quote 1.0.35", + "syn 2.0.50", ] [[package]] @@ -1965,6 +2234,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -2309,12 +2584,29 @@ dependencies = [ "url", ] +[[package]] +name = "gl_generator" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +dependencies = [ + "khronos_api", + "log", + "xml-rs", +] + [[package]] name = "glam" version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5418c17512bdf42730f9032c74e1ae39afc408745ebb2acf72fbc4691c17945" +[[package]] +name = "glam" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "151665d9be52f9bb40fc7966565d39666f2d1e69233571b71b87791c7e0528b3" + [[package]] name = "glib-sys" version = "0.14.0" @@ -2355,16 +2647,49 @@ dependencies = [ "web-sys", ] +[[package]] +name = "glow" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd348e04c43b32574f2de31c8bb397d96c9fcfa1371bd4ca6d8bdc464ab121b1" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead" +dependencies = [ + "gl_generator", +] + [[package]] name = "glyphon" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e87caa7459145f5e5f167bf34db4532901404c679e62339fb712a0e3ccf722a" dependencies = [ - "cosmic-text", + "cosmic-text 0.9.0", "etagere", - "lru", - "wgpu", + "lru 0.11.1", + "wgpu 0.16.3", +] + +[[package]] +name = "glyphon" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a62d0338e4056db6a73221c2fb2e30619452f6ea9651bac4110f51b0f7a7581" +dependencies = [ + "cosmic-text 0.10.0", + "etagere", + "lru 0.12.3", + "wgpu 0.19.3", ] [[package]] @@ -2385,7 +2710,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22beaafc29b38204457ea030f6fb7a84c9e4dd1b86e311ba0542533453d87f62" dependencies = [ "bitflags 1.3.2", - "gpu-alloc-types", + "gpu-alloc-types 0.2.0", +] + +[[package]] +name = "gpu-alloc" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" +dependencies = [ + "bitflags 2.4.2", + "gpu-alloc-types 0.3.0", ] [[package]] @@ -2397,6 +2732,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "gpu-alloc-types" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" +dependencies = [ + "bitflags 2.4.2", +] + [[package]] name = "gpu-allocator" version = "0.22.0" @@ -2407,7 +2751,20 @@ dependencies = [ "log", "thiserror", "winapi 0.3.9", - "windows", + "windows 0.44.0", +] + +[[package]] +name = "gpu-allocator" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f56f6318968d03c18e1bcf4857ff88c61157e9da8e47c5f29055d60e1228884" +dependencies = [ + "log", + "presser", + "thiserror", + "winapi 0.3.9", + "windows 0.52.0", ] [[package]] @@ -2442,12 +2799,12 @@ dependencies = [ "fuzzy-matcher", "grin-gui-core", "grin-gui-widgets", - "iced", - "iced_aw", - "iced_core", - "iced_futures", - "iced_renderer", - "iced_style", + "iced 0.10.0", + "iced_aw 0.6.0", + "iced_core 0.10.0", + "iced_futures 0.7.0", + "iced_renderer 0.1.0", + "iced_style 0.9.0", "image 0.23.14", "isahc 0.9.14", "isolang", @@ -2505,13 +2862,13 @@ dependencies = [ "grin_wallet_impls", "grin_wallet_libwallet", "grin_wallet_util", - "iced", - "iced_aw", - "iced_core", - "iced_futures", - "iced_graphics", - "iced_renderer", - "iced_style", + "iced 0.12.1", + "iced_aw 0.8.0", + "iced_core 0.12.3", + "iced_futures 0.12.0", + "iced_graphics 0.12.1", + "iced_renderer 0.12.1", + "iced_style 0.12.1", "isahc 1.7.2", "lazy_static", "log", @@ -2539,11 +2896,11 @@ dependencies = [ name = "grin-gui-widgets" version = "0.1.0-alpha.6" dependencies = [ - "iced", - "iced_core", - "iced_graphics", - "iced_style", - "iced_wgpu", + "iced 0.12.1", + "iced_core 0.12.3", + "iced_graphics 0.12.1", + "iced_style 0.12.1", + "iced_wgpu 0.12.1", ] [[package]] @@ -3094,6 +3451,21 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "hassle-rs" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" +dependencies = [ + "bitflags 2.4.2", + "com", + "libc", + "libloading 0.8.1", + "thiserror", + "widestring", + "winapi 0.3.9", +] + [[package]] name = "heck" version = "0.3.3" @@ -3445,11 +3817,25 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c708807ec86f99dd729dc4d42db5239acf118cec14d3c5f57679dcfdbbc472b1" dependencies = [ - "iced_core", - "iced_futures", - "iced_renderer", - "iced_widget", - "iced_winit", + "iced_core 0.10.0", + "iced_futures 0.7.0", + "iced_renderer 0.1.0", + "iced_widget 0.1.3", + "iced_winit 0.10.1", + "thiserror", +] + +[[package]] +name = "iced" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d4eb0fbbefb8c428b70680e77ed9013887b17c1d6be366b40f264f956d1a096" +dependencies = [ + "iced_core 0.12.3", + "iced_futures 0.12.0", + "iced_renderer 0.12.1", + "iced_widget 0.12.3", + "iced_winit 0.12.2", "thiserror", ] @@ -3459,7 +3845,17 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "842ee223a09cf7f874b9e2d6f5a1aa54f3642c31f7ff5e26c43f1546232b127b" dependencies = [ - "iced_widget", + "iced_widget 0.1.3", +] + +[[package]] +name = "iced_aw" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "129deba9897243dd59c2038e2267a691e392c94e569680066ee63b1164429490" +dependencies = [ + "cfg-if 1.0.0", + "iced 0.12.1", ] [[package]] @@ -3476,6 +3872,24 @@ dependencies = [ "twox-hash", ] +[[package]] +name = "iced_core" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d7e6bbd197f311ed3d8b71651876b0ce01318fde52cda862a9a7a4373c9b930" +dependencies = [ + "bitflags 2.4.2", + "glam 0.25.0", + "log", + "num-traits 0.2.18", + "palette", + "raw-window-handle 0.6.0", + "smol_str", + "thiserror", + "web-time", + "xxhash-rust", +] + [[package]] name = "iced_futures" version = "0.7.0" @@ -3484,7 +3898,22 @@ checksum = "14dab0054a9c7a1cbce227a8cd9ee4a094497b3d06094551ac6c1488d563802e" dependencies = [ "async-std", "futures 0.3.30", - "iced_core", + "iced_core 0.10.0", + "log", + "tokio 1.36.0", + "wasm-bindgen-futures", + "wasm-timer", +] + +[[package]] +name = "iced_futures" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "370bad88fb3832cbeeb3fa6c486b4701fb7e8da32a753b3101d4ce81fc1d9497" +dependencies = [ + "async-std", + "futures 0.3.30", + "iced_core 0.12.3", "log", "tokio 1.36.0", "wasm-bindgen-futures", @@ -3499,26 +3928,60 @@ checksum = "67ff14447a221e9e9205a13d84d7bbdf0636a3b1daa02cfca690ed09689c4d2b" dependencies = [ "bitflags 1.3.2", "bytemuck", - "glam", + "glam 0.24.2", "half", - "iced_core", + "iced_core 0.10.0", "log", "lyon_path", "raw-window-handle 0.5.2", "thiserror", ] +[[package]] +name = "iced_graphics" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a044c193ef0840eacabfa05424717331d1fc5b3ecb9a89316200c75da2ba9a4" +dependencies = [ + "bitflags 2.4.2", + "bytemuck", + "cosmic-text 0.10.0", + "half", + "iced_core 0.12.3", + "iced_futures 0.12.0", + "log", + "once_cell", + "raw-window-handle 0.6.0", + "rustc-hash", + "thiserror", + "unicode-segmentation", + "xxhash-rust", +] + [[package]] name = "iced_renderer" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1033385b0db0099a0d13178c9ff93c1ce11e7d0177522acf578bf79febdb2af8" dependencies = [ - "iced_graphics", - "iced_tiny_skia", - "iced_wgpu", + "iced_graphics 0.9.0", + "iced_tiny_skia 0.1.0", + "iced_wgpu 0.11.1", + "log", + "raw-window-handle 0.5.2", + "thiserror", +] + +[[package]] +name = "iced_renderer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c281e03001d566058f53dec9325bbe61c62da715341206d2627f57a3ecc7f69" +dependencies = [ + "iced_graphics 0.12.1", + "iced_tiny_skia 0.12.1", + "iced_wgpu 0.12.1", "log", - "raw-window-handle 0.5.2", "thiserror", ] @@ -3528,8 +3991,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c6c89853e1250c6fac82c5015fa2144517be9b33d4b8e456f10e198b23e28bd" dependencies = [ - "iced_core", - "iced_futures", + "iced_core 0.10.0", + "iced_futures 0.7.0", + "thiserror", +] + +[[package]] +name = "iced_runtime" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a79f852c01cc6d61663c94379cb3974ac3ad315a28c504e847d573e094f46822" +dependencies = [ + "iced_core 0.12.3", + "iced_futures 0.12.0", + "raw-window-handle 0.6.0", "thiserror", ] @@ -3539,7 +4014,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d85c47d9d13e2281f75ddf98c865daf2101632bd2b855c401dd0b1c8b81a31a0" dependencies = [ - "iced_core", + "iced_core 0.10.0", + "once_cell", + "palette", +] + +[[package]] +name = "iced_style" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea42a740915d2a5a9ff9c3aa0bca28b16e9fb660bc8f675eed71d186cadb579" +dependencies = [ + "iced_core 0.12.3", "once_cell", "palette", ] @@ -3551,17 +4037,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7715f6222c9470bbbd75a39f70478fa0d1bdfb81a377a34fd1b090ffccc480b" dependencies = [ "bytemuck", - "cosmic-text", - "iced_graphics", - "kurbo", + "cosmic-text 0.9.0", + "iced_graphics 0.9.0", + "kurbo 0.9.5", "log", "raw-window-handle 0.5.2", "rustc-hash", - "softbuffer", + "softbuffer 0.2.1", "tiny-skia 0.10.0", "twox-hash", ] +[[package]] +name = "iced_tiny_skia" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2228781f4d381a1cbbd7905a9f077351aa8d37269094021d5d9e779f130aff" +dependencies = [ + "bytemuck", + "cosmic-text 0.10.0", + "iced_graphics 0.12.1", + "kurbo 0.10.4", + "log", + "rustc-hash", + "softbuffer 0.4.1", + "tiny-skia 0.11.4", + "xxhash-rust", +] + [[package]] name = "iced_wgpu" version = "0.11.1" @@ -3571,17 +4074,35 @@ dependencies = [ "bitflags 1.3.2", "bytemuck", "futures 0.3.30", - "glam", - "glyphon", + "glam 0.24.2", + "glyphon 0.3.0", "guillotiere", - "iced_graphics", + "iced_graphics 0.9.0", "log", "lyon", "once_cell", "raw-window-handle 0.5.2", "rustc-hash", "twox-hash", - "wgpu", + "wgpu 0.16.3", +] + +[[package]] +name = "iced_wgpu" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c243b6700452886aac1ee1987e84d9fb43b56b53fea9a1eb67713fd0fde244" +dependencies = [ + "bitflags 2.4.2", + "bytemuck", + "futures 0.3.30", + "glam 0.25.0", + "glyphon 0.5.0", + "guillotiere", + "iced_graphics 0.12.1", + "log", + "once_cell", + "wgpu 0.19.3", ] [[package]] @@ -3590,9 +4111,23 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a177219ae51c3ba08f228ab932354b360cc669e94aec50c01e7c9b675f074c7c" dependencies = [ - "iced_renderer", - "iced_runtime", - "iced_style", + "iced_renderer 0.1.0", + "iced_runtime 0.1.1", + "iced_style 0.9.0", + "num-traits 0.2.18", + "thiserror", + "unicode-segmentation", +] + +[[package]] +name = "iced_widget" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e01b2212adecf1cb80e2267f302c0e0c263e55f97812056949199ccf9f0b908" +dependencies = [ + "iced_renderer 0.12.1", + "iced_runtime 0.12.1", + "iced_style 0.12.1", "num-traits 0.2.18", "ouroboros", "thiserror", @@ -3605,16 +4140,45 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad0c884bcb14722a57192b40a5ef6b5e170fa2f01fe2ff28d6cdd9efe37acf70" dependencies = [ - "iced_graphics", - "iced_runtime", - "iced_style", + "iced_graphics 0.9.0", + "iced_runtime 0.1.1", + "iced_style 0.9.0", "log", "raw-window-handle 0.5.2", "thiserror", "web-sys", "winapi 0.3.9", - "window_clipboard", - "winit", + "window_clipboard 0.3.0", + "winit 0.28.7", +] + +[[package]] +name = "iced_winit" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63f66831d0e399b93f631739121a6171780d344b275d56808b9504d8ca75c7d2" +dependencies = [ + "iced_graphics 0.12.1", + "iced_runtime 0.12.1", + "iced_style 0.12.1", + "log", + "thiserror", + "tracing", + "web-sys", + "winapi 0.3.9", + "window_clipboard 0.4.1", + "winit 0.29.14", +] + +[[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]] @@ -3829,6 +4393,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.8" @@ -3841,6 +4414,22 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if 1.0.0", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -3925,6 +4514,23 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "khronos-egl" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" +dependencies = [ + "libc", + "libloading 0.8.1", + "pkg-config", +] + +[[package]] +name = "khronos_api" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" + [[package]] name = "kurbo" version = "0.9.5" @@ -3934,6 +4540,16 @@ dependencies = [ "arrayvec 0.7.4", ] +[[package]] +name = "kurbo" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1618d4ebd923e97d67e7cd363d80aef35fe961005cbbbb3d2dad8bdd1bc63440" +dependencies = [ + "arrayvec 0.7.4", + "smallvec", +] + [[package]] name = "kv-log-macro" version = "1.0.7" @@ -4076,6 +4692,12 @@ version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +[[package]] +name = "linux-raw-sys" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0b5399f6804fbab912acbd8878ed3532d506b7c951b8f9f164ef90fef39e3f4" + [[package]] name = "lmdb-zero" version = "0.4.4" @@ -4167,6 +4789,15 @@ dependencies = [ "hashbrown 0.14.3", ] +[[package]] +name = "lru" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" +dependencies = [ + "hashbrown 0.14.3", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -4271,6 +4902,15 @@ dependencies = [ "libc", ] +[[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.4" @@ -4307,9 +4947,24 @@ dependencies = [ "bitflags 1.3.2", "block", "core-graphics-types", - "foreign-types", + "foreign-types 0.3.2", + "log", + "objc", +] + +[[package]] +name = "metal" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" +dependencies = [ + "bitflags 2.4.2", + "block", + "core-graphics-types", + "foreign-types 0.5.0", "log", "objc", + "paste", ] [[package]] @@ -4468,7 +5123,27 @@ dependencies = [ "log", "num-traits 0.2.18", "rustc-hash", - "spirv", + "spirv 0.2.0+1.5.4", + "termcolor", + "thiserror", + "unicode-xid 0.2.4", +] + +[[package]] +name = "naga" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e3524642f53d9af419ab5e8dd29d3ba155708267667c2f3f06c88c9e130843" +dependencies = [ + "bit-set", + "bitflags 2.4.2", + "codespan-reporting", + "hexf-parse", + "indexmap 2.2.3", + "log", + "num-traits 0.2.18", + "rustc-hash", + "spirv 0.3.0+sdk-1.3.268.0", "termcolor", "thiserror", "unicode-xid 0.2.4", @@ -4480,7 +5155,7 @@ version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "716291d444588158221ce5b7836ead33e0d1e053157735d277212eff029cb7d6" dependencies = [ - "cocoa", + "cocoa 0.24.1", "dirs-next 2.0.0", "objc", "objc-foundation", @@ -4501,7 +5176,7 @@ checksum = "1bbf55edb2747e4e4b3a9cd3989194b88aae32274b4422635dcf98aa6e84197b" dependencies = [ "ascii", "block", - "cocoa", + "cocoa 0.24.1", "dirs-next 2.0.0", "objc", "objc-foundation", @@ -4540,12 +5215,27 @@ checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ "bitflags 1.3.2", "jni-sys", - "ndk-sys", + "ndk-sys 0.4.1+23.1.7779620", "num_enum 0.5.11", "raw-window-handle 0.5.2", "thiserror", ] +[[package]] +name = "ndk" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" +dependencies = [ + "bitflags 2.4.2", + "jni-sys", + "log", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum 0.7.2", + "raw-window-handle 0.6.0", + "thiserror", +] + [[package]] name = "ndk-context" version = "0.1.1" @@ -4561,6 +5251,15 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "ndk-sys" +version = "0.5.0+25.2.9519653" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" +dependencies = [ + "jni-sys", +] + [[package]] name = "net2" version = "0.2.39" @@ -4782,6 +5481,15 @@ dependencies = [ "num_enum_derive 0.6.1", ] +[[package]] +name = "num_enum" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" +dependencies = [ + "num_enum_derive 0.7.2", +] + [[package]] name = "num_enum_derive" version = "0.5.11" @@ -4806,6 +5514,18 @@ dependencies = [ "syn 2.0.50", ] +[[package]] +name = "num_enum_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.78", + "quote 1.0.35", + "syn 2.0.50", +] + [[package]] name = "objc" version = "0.2.7" @@ -4833,15 +5553,31 @@ version = "0.2.0-beta.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" +[[package]] +name = "objc-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c71324e4180d0899963fc83d9d241ac39e699609fc1025a850aadac8257459" + [[package]] name = "objc2" version = "0.3.0-beta.3.patch-leaks.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" dependencies = [ - "block2", - "objc-sys", - "objc2-encode", + "block2 0.2.0-alpha.6", + "objc-sys 0.2.0-beta.2", + "objc2-encode 2.0.0-pre.2", +] + +[[package]] +name = "objc2" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" +dependencies = [ + "objc-sys 0.3.2", + "objc2-encode 3.0.0", ] [[package]] @@ -4850,9 +5586,15 @@ version = "2.0.0-pre.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" dependencies = [ - "objc-sys", + "objc-sys 0.2.0-beta.2", ] +[[package]] +name = "objc2-encode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" + [[package]] name = "objc_exception" version = "0.1.2" @@ -4931,7 +5673,7 @@ checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ "bitflags 2.4.2", "cfg-if 1.0.0", - "foreign-types", + "foreign-types 0.3.2", "libc", "once_cell", "openssl-macros", @@ -4987,9 +5729,9 @@ dependencies = [ [[package]] name = "ouroboros" -version = "0.17.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2ba07320d39dfea882faa70554b4bd342a5f273ed59ba7c1c6b4c840492c954" +checksum = "97b7be5a8a3462b752f4be3ff2b2bf2f7f1d00834902e46be2a4d68b87b0573c" dependencies = [ "aliasable", "ouroboros_macro", @@ -4998,13 +5740,14 @@ dependencies = [ [[package]] name = "ouroboros_macro" -version = "0.17.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec4c6225c69b4ca778c0aea097321a64c421cf4577b331c61b229267edabb6f8" +checksum = "b645dcde5f119c2c454a92d0dfa271a2a3b205da92e4292a68ead4bdbfde1f33" dependencies = [ "heck 0.4.1", - "proc-macro-error", + "itertools 0.12.1", "proc-macro2 1.0.78", + "proc-macro2-diagnostics", "quote 1.0.35", "syn 2.0.50", ] @@ -5142,6 +5885,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + [[package]] name = "path-slash" version = "0.1.5" @@ -5389,8 +6138,8 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b533be9c5ba7d80b7fd619fd5226c58bcae53db2c24b447fa82be25865c117e6" dependencies = [ - "iced_graphics", - "iced_widget", + "iced_graphics 0.9.0", + "iced_widget 0.1.3", "once_cell", "plotters", "plotters-backend", @@ -5477,6 +6226,12 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "presser" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" + [[package]] name = "prettytable-rs" version = "0.10.0" @@ -5543,6 +6298,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proc-macro2-diagnostics" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" +dependencies = [ + "proc-macro2 1.0.78", + "quote 1.0.35", + "syn 2.0.50", + "version_check", + "yansi", +] + [[package]] name = "profiling" version = "1.0.15" @@ -5824,6 +6592,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" +[[package]] +name = "raw-window-handle" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" + [[package]] name = "rayon" version = "1.8.1" @@ -6090,6 +6864,12 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "roxmltree" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f" + [[package]] name = "rpassword" version = "4.0.5" @@ -6263,10 +7043,27 @@ dependencies = [ "bytemuck", "libm", "smallvec", - "ttf-parser 0.19.2", + "ttf-parser 0.19.2", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-general-category", + "unicode-script", +] + +[[package]] +name = "rustybuzz" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee8fe2a8461a0854a37101fe7a1b13998d0cfa987e43248e81d2a5f4570f6fa" +dependencies = [ + "bitflags 1.3.2", + "bytemuck", + "libm", + "smallvec", + "ttf-parser 0.20.0", "unicode-bidi-mirroring", "unicode-ccc", - "unicode-general-category", + "unicode-properties", "unicode-script", ] @@ -6381,6 +7178,19 @@ dependencies = [ "tiny-skia 0.8.4", ] +[[package]] +name = "sctk-adwaita" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b2eaf3a5b264a521b988b2e73042e742df700c4f962cde845d1541adb46550" +dependencies = [ + "ab_glyph", + "log", + "memmap2 0.9.4", + "smithay-client-toolkit 0.18.1", + "tiny-skia 0.11.4", +] + [[package]] name = "secrecy" version = "0.6.0" @@ -6757,6 +7567,15 @@ dependencies = [ "wayland-backend 0.3.3", ] +[[package]] +name = "smol_str" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6845563ada680337a52d43bb0b29f396f2d911616f6573012645b9e3d048a49" +dependencies = [ + "serde", +] + [[package]] name = "socket2" version = "0.3.19" @@ -6795,11 +7614,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2b953f6ba7285f0af131eb748aabd8ddaf53e0b81dda3ba5d803b0847d6559f" dependencies = [ "bytemuck", - "cfg_aliases", - "cocoa", - "core-graphics", + "cfg_aliases 0.1.1", + "cocoa 0.24.1", + "core-graphics 0.22.3", "fastrand 1.9.0", - "foreign-types", + "foreign-types 0.3.2", "log", "nix 0.26.4", "objc", @@ -6816,6 +7635,37 @@ dependencies = [ "x11rb 0.11.1", ] +[[package]] +name = "softbuffer" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071916a85d1db274b4ed57af3a14afb66bd836ae7f82ebb6f1fd3455107830d9" +dependencies = [ + "as-raw-xcb-connection", + "bytemuck", + "cfg_aliases 0.2.0", + "cocoa 0.25.0", + "core-graphics 0.23.1", + "drm", + "fastrand 2.0.1", + "foreign-types 0.5.0", + "js-sys", + "log", + "memmap2 0.9.4", + "objc", + "raw-window-handle 0.6.0", + "redox_syscall 0.4.1", + "rustix 0.38.31", + "tiny-xlib", + "wasm-bindgen", + "wayland-backend 0.3.3", + "wayland-client 0.31.2", + "wayland-sys 0.31.1", + "web-sys", + "windows-sys 0.52.0", + "x11rb 0.13.0", +] + [[package]] name = "spin" version = "0.5.2" @@ -6841,6 +7691,15 @@ dependencies = [ "num-traits 0.2.18", ] +[[package]] +name = "spirv" +version = "0.3.0+sdk-1.3.268.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" +dependencies = [ + "bitflags 2.4.2", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -7059,7 +7918,7 @@ dependencies = [ "anyhow", "cfg-expr", "heck 0.3.3", - "itertools", + "itertools 0.10.5", "pkg-config", "strum 0.21.0", "strum_macros 0.21.1", @@ -7254,6 +8113,21 @@ dependencies = [ "tiny-skia-path 0.10.0", ] +[[package]] +name = "tiny-skia" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" +dependencies = [ + "arrayref", + "arrayvec 0.7.4", + "bytemuck", + "cfg-if 1.0.0", + "log", + "png 0.17.13", + "tiny-skia-path 0.11.4", +] + [[package]] name = "tiny-skia-path" version = "0.8.4" @@ -7276,6 +8150,29 @@ dependencies = [ "strict-num", ] +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", +] + +[[package]] +name = "tiny-xlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4098d49269baa034a8d1eae9bd63e9fa532148d772121dace3bcd6a6c98eb6d" +dependencies = [ + "as-raw-xcb-connection", + "ctor", + "libloading 0.8.1", + "tracing", +] + [[package]] name = "tinystr" version = "0.7.5" @@ -7700,6 +8597,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-properties" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4259d9d4425d9f0661581b804cb85fe66a4c631cadd8f490d1c13a35d5d9291" + [[package]] name = "unicode-script" version = "0.5.6" @@ -8096,6 +8999,19 @@ dependencies = [ "wayland-scanner 0.31.1", ] +[[package]] +name = "wayland-protocols-plasma" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" +dependencies = [ + "bitflags 2.4.2", + "wayland-backend 0.3.3", + "wayland-client 0.31.2", + "wayland-protocols 0.31.2", + "wayland-scanner 0.31.1", +] + [[package]] name = "wayland-protocols-wlr" version = "0.2.0" @@ -8179,9 +9095,19 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.68" +version = "0.3.67" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" +checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" dependencies = [ "js-sys", "wasm-bindgen", @@ -8232,7 +9158,7 @@ dependencies = [ "cfg-if 1.0.0", "js-sys", "log", - "naga", + "naga 0.12.3", "parking_lot 0.12.1", "profiling", "raw-window-handle 0.5.2", @@ -8241,9 +9167,34 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", + "wgpu-core 0.16.1", + "wgpu-hal 0.16.2", + "wgpu-types 0.16.1", +] + +[[package]] +name = "wgpu" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4b1213b52478a7631d6e387543ed8f642bc02c578ef4e3b49aca2a29a7df0cb" +dependencies = [ + "arrayvec 0.7.4", + "cfg-if 1.0.0", + "cfg_aliases 0.1.1", + "js-sys", + "log", + "naga 0.19.2", + "parking_lot 0.12.1", + "profiling", + "raw-window-handle 0.6.0", + "smallvec", + "static_assertions", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core 0.19.3", + "wgpu-hal 0.19.3", + "wgpu-types 0.19.2", ] [[package]] @@ -8257,7 +9208,7 @@ dependencies = [ "bitflags 2.4.2", "codespan-reporting", "log", - "naga", + "naga 0.12.3", "parking_lot 0.12.1", "profiling", "raw-window-handle 0.5.2", @@ -8265,8 +9216,34 @@ dependencies = [ "smallvec", "thiserror", "web-sys", - "wgpu-hal", - "wgpu-types", + "wgpu-hal 0.16.2", + "wgpu-types 0.16.1", +] + +[[package]] +name = "wgpu-core" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f6b033c2f00ae0bc8ea872c5989777c60bc241aac4e58b24774faa8b391f78" +dependencies = [ + "arrayvec 0.7.4", + "bit-vec", + "bitflags 2.4.2", + "cfg_aliases 0.1.1", + "codespan-reporting", + "indexmap 2.2.3", + "log", + "naga 0.19.2", + "once_cell", + "parking_lot 0.12.1", + "profiling", + "raw-window-handle 0.6.0", + "rustc-hash", + "smallvec", + "thiserror", + "web-sys", + "wgpu-hal 0.19.3", + "wgpu-types 0.19.2", ] [[package]] @@ -8282,20 +9259,20 @@ dependencies = [ "bitflags 2.4.2", "block", "core-graphics-types", - "d3d12", - "foreign-types", - "glow", - "gpu-alloc", - "gpu-allocator", + "d3d12 0.6.0", + "foreign-types 0.3.2", + "glow 0.12.3", + "gpu-alloc 0.5.4", + "gpu-allocator 0.22.0", "gpu-descriptor", - "hassle-rs", + "hassle-rs 0.10.0", "js-sys", - "khronos-egl", + "khronos-egl 4.1.0", "libc", "libloading 0.8.1", "log", - "metal", - "naga", + "metal 0.24.0", + "naga 0.12.3", "objc", "parking_lot 0.12.1", "profiling", @@ -8307,7 +9284,52 @@ dependencies = [ "thiserror", "wasm-bindgen", "web-sys", - "wgpu-types", + "wgpu-types 0.16.1", + "winapi 0.3.9", +] + +[[package]] +name = "wgpu-hal" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f972c280505ab52ffe17e94a7413d9d54b58af0114ab226b9fc4999a47082e" +dependencies = [ + "android_system_properties", + "arrayvec 0.7.4", + "ash", + "bit-set", + "bitflags 2.4.2", + "block", + "cfg_aliases 0.1.1", + "core-graphics-types", + "d3d12 0.19.0", + "glow 0.13.1", + "glutin_wgl_sys", + "gpu-alloc 0.6.0", + "gpu-allocator 0.25.0", + "gpu-descriptor", + "hassle-rs 0.11.0", + "js-sys", + "khronos-egl 6.0.0", + "libc", + "libloading 0.8.1", + "log", + "metal 0.27.0", + "naga 0.19.2", + "ndk-sys 0.5.0+25.2.9519653", + "objc", + "once_cell", + "parking_lot 0.12.1", + "profiling", + "range-alloc", + "raw-window-handle 0.6.0", + "renderdoc-sys", + "rustc-hash", + "smallvec", + "thiserror", + "wasm-bindgen", + "web-sys", + "wgpu-types 0.19.2", "winapi 0.3.9", ] @@ -8322,6 +9344,17 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wgpu-types" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b671ff9fb03f78b46ff176494ee1ebe7d603393f42664be55b64dc8d53969805" +dependencies = [ + "bitflags 2.4.2", + "js-sys", + "web-sys", +] + [[package]] name = "which" version = "4.4.2" @@ -8398,7 +9431,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63287c9c4396ccf5346d035a9b0fcaead9e18377637f5eaa78b7ac65c873ff7d" dependencies = [ - "clipboard-win", + "clipboard-win 4.5.0", "clipboard_macos", "clipboard_wayland", "clipboard_x11", @@ -8406,6 +9439,20 @@ dependencies = [ "thiserror", ] +[[package]] +name = "window_clipboard" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d692d46038c433f9daee7ad8757e002a4248c20b0a3fbc991d99521d3bcb6d" +dependencies = [ + "clipboard-win 5.2.0", + "clipboard_macos", + "clipboard_wayland", + "clipboard_x11", + "raw-window-handle 0.6.0", + "thiserror", +] + [[package]] name = "windows" version = "0.44.0" @@ -8415,6 +9462,16 @@ dependencies = [ "windows-targets 0.42.2", ] +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.3", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -8628,24 +9685,24 @@ version = "0.28.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" dependencies = [ - "android-activity", + "android-activity 0.4.3", "bitflags 1.3.2", - "cfg_aliases", + "cfg_aliases 0.1.1", "core-foundation 0.9.4", - "core-graphics", + "core-graphics 0.22.3", "dispatch", "instant", "libc", "log", "mio 0.8.10", - "ndk", - "objc2", + "ndk 0.7.0", + "objc2 0.3.0-beta.3.patch-leaks.3", "once_cell", "orbclient", "percent-encoding", "raw-window-handle 0.5.2", "redox_syscall 0.3.5", - "sctk-adwaita", + "sctk-adwaita 0.5.4", "smithay-client-toolkit 0.16.1", "wasm-bindgen", "wayland-client 0.29.5", @@ -8657,6 +9714,54 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "winit" +version = "0.29.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a3db69ffbe53a9babec7804da7a90f21020fcce1f2f5e5291e2311245b993d" +dependencies = [ + "ahash", + "android-activity 0.5.2", + "atomic-waker", + "bitflags 2.4.2", + "bytemuck", + "calloop 0.12.4", + "cfg_aliases 0.1.1", + "core-foundation 0.9.4", + "core-graphics 0.23.1", + "cursor-icon", + "icrate", + "js-sys", + "libc", + "log", + "memmap2 0.9.4", + "ndk 0.8.0", + "ndk-sys 0.5.0+25.2.9519653", + "objc2 0.4.1", + "once_cell", + "orbclient", + "percent-encoding", + "raw-window-handle 0.6.0", + "redox_syscall 0.3.5", + "rustix 0.38.31", + "sctk-adwaita 0.8.1", + "smithay-client-toolkit 0.18.1", + "smol_str", + "unicode-segmentation", + "wasm-bindgen", + "wasm-bindgen-futures", + "wayland-backend 0.3.3", + "wayland-client 0.31.2", + "wayland-protocols 0.31.2", + "wayland-protocols-plasma", + "web-sys", + "web-time", + "windows-sys 0.48.0", + "x11-dl", + "x11rb 0.13.0", + "xkbcommon-dl", +] + [[package]] name = "winnow" version = "0.5.40" @@ -8755,7 +9860,11 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" dependencies = [ + "as-raw-xcb-connection", "gethostname 0.4.3", + "libc", + "libloading 0.8.1", + "once_cell", "rustix 0.38.31", "x11rb-protocol 0.13.0", ] @@ -8814,6 +9923,19 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a0ccd7b4a5345edfcd0c3535718a4e9ff7798ffc536bb5b5a0e26ff84732911" +[[package]] +name = "xkbcommon-dl" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" +dependencies = [ + "bitflags 2.4.2", + "dlib", + "log", + "once_cell", + "xkeysym", +] + [[package]] name = "xkeysym" version = "0.2.0" @@ -8826,6 +9948,12 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" +[[package]] +name = "xxhash-rust" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" + [[package]] name = "yaml-rust" version = "0.3.5" @@ -8841,6 +9969,12 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + [[package]] name = "yazi" version = "0.1.6" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index b971d14..ffe7f68 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -45,7 +45,6 @@ grin_wallet_controller = { git = "https://github.com/mimblewimble/grin-wallet", grin_wallet_api = { git = "https://github.com/mimblewimble/grin-wallet", branch = "contracts" } grin_wallet_impls = { git = "https://github.com/mimblewimble/grin-wallet", branch = "contracts" } grin_wallet_libwallet = { git = "https://github.com/mimblewimble/grin-wallet", branch = "contracts" } -grin-gui-widgets = { path = "../widgets" } ############ Local testing ################ @@ -66,6 +65,7 @@ grin-gui-widgets = { path = "../widgets" } #grin_wallet_impls = { path = "../../../grin-wallet/impls"} #grin_wallet_libwallet = { path = "../../../grin-wallet/libwallet"} +grin-gui-widgets = { path = "../widgets" } regex = "1.4.3" fancy-regex = "0.5.0" # Regex with backtracking async-std = { version = "1.9.0", features = ["unstable"] } @@ -100,13 +100,13 @@ backtrace = "0.3" lazy_static = "1" uuid = "0.8.2" -iced = { version = "0.10", features = ["advanced", "tokio"] } -iced_futures = { version = "0.7", features = ["async-std"] } -iced_core = { version = "0.10" } -iced_style = "0.9" -iced_graphics = { version = "0.9" } -iced_renderer = { version = "0.1", features = ["wgpu"] } -iced_aw = { version = "0.6", default-features = false, features = ["card", "modal"]} +iced = { version = "0.12", features = ["advanced", "tokio"] } +iced_futures = { version = "0.12", features = ["async-std"] } +iced_core = { version = "0.12" } +iced_style = "0.12" +iced_graphics = { version = "0.12" } +iced_renderer = { version = "0.12", features = ["wgpu"] } +iced_aw = { version = "0.8", default-features = false, features = ["card", "modal"]} [dev-dependencies] tempfile = "3.2.0" diff --git a/crates/widgets/Cargo.toml b/crates/widgets/Cargo.toml index 443ee90..cee0b48 100644 --- a/crates/widgets/Cargo.toml +++ b/crates/widgets/Cargo.toml @@ -14,8 +14,8 @@ wgpu = ["iced_wgpu"] #opengl = ["iced_glow"] [dependencies] -iced = { version = "0.10", features = ["advanced", "lazy", "tokio"] } -iced_graphics = { version = "0.9" } -iced_core = { version = "0.10" } -iced_wgpu = { version = "0.11", optional = true } -iced_style = "0.9" +iced = { version = "0.12", features = ["advanced", "lazy", "tokio"] } +iced_graphics = { version = "0.12" } +iced_core = { version = "0.12" } +iced_wgpu = { version = "0.12", optional = true } +iced_style = "0.12" diff --git a/crates/widgets/src/widget/header.rs b/crates/widgets/src/widget/header.rs index 21b7ffa..d87791c 100644 --- a/crates/widgets/src/widget/header.rs +++ b/crates/widgets/src/widget/header.rs @@ -1,387 +1,388 @@ #![allow(clippy::type_complexity)] use crate::style::header::StyleSheet; use iced_core::{ - event, layout, mouse, - widget::{self, Tree}, - Alignment, Clipboard, Element, Event, Layout, Length, Padding, Rectangle, Shell, Widget, + event, layout, mouse, + widget::{self, Tree}, + Alignment, Clipboard, Element, Event, Layout, Length, Padding, Rectangle, Shell, Widget, }; -use iced::widget::{space::Space, Container}; +use iced::{ + widget::{space::Space, Container}, + Size, +}; mod state; pub use state::State; -pub struct Header<'a, Message, Renderer> +pub struct Header<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> where - Renderer: 'a + iced_core::Renderer, - Renderer::Theme: StyleSheet, - Message: 'a, + Renderer: 'a + iced_core::Renderer, + Theme: StyleSheet, + Message: 'a, { - spacing: u16, - width: Length, - height: Length, - state: State, - leeway: u16, - on_resize: Option<(u16, Box Message + 'a>)>, - children: Vec>, - left_margin: bool, - right_margin: bool, - names: Vec, - style: ::Style, + spacing: u16, + width: Length, + height: Length, + state: State, + leeway: u16, + on_resize: Option<(u16, Box Message + 'a>)>, + children: Vec>, + left_margin: bool, + right_margin: bool, + names: Vec, + style: ::Style, } -impl<'a, Message, Renderer> Header<'a, Message, Renderer> +impl<'a, Message, Theme, Renderer> Header<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, - Renderer::Theme: StyleSheet, - Message: 'a, + Renderer: 'a + iced_core::Renderer, + Theme: StyleSheet, + Message: 'a, { - pub fn new( - state: State, - headers: Vec<(String, Container<'a, Message, Renderer>)>, - left_margin: Option, - right_margin: Option, - ) -> Self - where - ::Theme: iced::widget::container::StyleSheet, - { - let mut names = vec![]; - let mut left = false; - let mut right = false; - - let mut children = vec![]; - - if let Some(margin) = left_margin { - children.push(Space::with_width(margin).into()); - left = true; - } - - for (key, container) in headers { - names.push(key); - - // add container to children - children.push(container.into()); - } - - if let Some(margin) = right_margin { - children.push(Space::with_width(margin).into()); - right = true; - } - - Self { - spacing: 0, - width: Length::Fill, - height: Length::Fill, - leeway: 0, - state, - on_resize: None, - children, - left_margin: left, - right_margin: right, - names, - style: Default::default(), - } - } - - pub fn spacing(mut self, units: u16) -> Self { - self.spacing = units; - self - } - - pub fn width(mut self, width: Length) -> Self { - self.width = width; - self - } - - pub fn height(mut self, height: Length) -> Self { - self.height = height; - self - } - - pub fn on_resize(mut self, leeway: u16, f: F) -> Self - where - F: 'a + Fn(ResizeEvent) -> Message, - { - self.leeway = leeway; - self.on_resize = Some((leeway, Box::new(f))); - self - } - - fn trigger_resize( - &self, - left_name: String, - left_width: u16, - right_name: String, - right_width: u16, - shell: &mut Shell<'_, Message>, - ) { - if let Some((_, on_resize)) = &self.on_resize { - //TODO: Update - shell.publish(on_resize(ResizeEvent::ResizeColumn { - left_name, - left_width, - right_name, - right_width, - })); - } - } - - fn trigger_finished(&self, shell: &mut Shell<'_, Message>) { - if let Some((_, on_resize)) = &self.on_resize { - shell.publish(on_resize(ResizeEvent::Finished)); - } - } + pub fn new( + state: State, + headers: Vec<(String, Container<'a, Message, Renderer>)>, + left_margin: Option, + right_margin: Option, + ) -> Self + where + Theme: StyleSheet, + { + let mut names = vec![]; + let mut left = false; + let mut right = false; + + let mut children = vec![]; + + if let Some(margin) = left_margin { + children.push(Space::with_width(margin).into()); + left = true; + } + + for (key, container) in headers { + names.push(key); + + // add container to children + children.push(container.into()); + } + + if let Some(margin) = right_margin { + children.push(Space::with_width(margin).into()); + right = true; + } + + Self { + spacing: 0, + width: Length::Fill, + height: Length::Fill, + leeway: 0, + state, + on_resize: None, + children, + left_margin: left, + right_margin: right, + names, + style: Default::default(), + } + } + + pub fn spacing(mut self, units: u16) -> Self { + self.spacing = units; + self + } + + pub fn width(mut self, width: Length) -> Self { + self.width = width; + self + } + + pub fn height(mut self, height: Length) -> Self { + self.height = height; + self + } + + pub fn on_resize(mut self, leeway: u16, f: F) -> Self + where + F: 'a + Fn(ResizeEvent) -> Message, + { + self.leeway = leeway; + self.on_resize = Some((leeway, Box::new(f))); + self + } + + fn trigger_resize( + &self, + left_name: String, + left_width: u16, + right_name: String, + right_width: u16, + shell: &mut Shell<'_, Message>, + ) { + if let Some((_, on_resize)) = &self.on_resize { + //TODO: Update + shell.publish(on_resize(ResizeEvent::ResizeColumn { + left_name, + left_width, + right_name, + right_width, + })); + } + } + + fn trigger_finished(&self, shell: &mut Shell<'_, Message>) { + if let Some((_, on_resize)) = &self.on_resize { + shell.publish(on_resize(ResizeEvent::Finished)); + } + } } -impl<'a, Message, Renderer> Widget for Header<'a, Message, Renderer> +impl<'a, Message, Theme, Renderer> Widget + for Header<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, - Renderer::Theme: StyleSheet, - Message: 'a, + Renderer: 'a + iced_core::Renderer, + Theme: StyleSheet, + Message: 'a, { - fn children(&self) -> Vec { - self.children.iter().map(Tree::new).collect() - } - - fn diff(&self, tree: &mut Tree) { - tree.diff_children(&self.children); - } - - fn width(&self) -> Length { - self.width - } - - fn height(&self) -> Length { - self.height - } - - fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> layout::Node { - let limits = limits.width(self.width).height(self.height); - - layout::flex::resolve( - layout::flex::Axis::Horizontal, - renderer, - &limits, - Padding::ZERO, - self.spacing as f32, - Alignment::Start, - &self.children, - ) - } - - fn on_event( - &mut self, - tree: &mut Tree, - event: Event, - layout: Layout<'_>, - cursor: mouse::Cursor, - renderer: &Renderer, - clipboard: &mut dyn Clipboard, - shell: &mut Shell<'_, Message>, - viewport: &Rectangle, - ) -> event::Status { - let cursor_position = cursor.position().unwrap_or_default(); - let in_bounds = layout.bounds().contains(cursor_position); - - if self.state.resizing || in_bounds { - let child_len = self.children.len(); - let start_offset = if self.left_margin { 1 } else { 0 }; - let end_offset = if self.right_margin { 1 } else { 0 }; - - let dividers = self - .children - .iter() - .enumerate() - .zip(layout.children()) - .filter_map(|((idx, _), layout)| { - if idx >= start_offset && idx < (child_len - 1 - end_offset) { - Some((idx, layout.position().x + layout.bounds().width)) - } else { - None - } - }) - .collect::>(); - - if self.on_resize.is_some() { - if !self.state.resizing { - self.state.resize_hovering = false; - } - - for (idx, divider) in dividers.iter() { - if cursor_position.x > (divider - self.leeway as f32) - && cursor_position.x < (divider + self.leeway as f32) - { - if !self.state.resize_hovering { - self.state.resizing_idx = *idx; - } - - self.state.resize_hovering = true; - } - } - } - - match event { - Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => { - if self.state.resize_hovering { - self.state.resizing = true; - self.state.starting_cursor_pos = Some(cursor_position); - self.state.starting_left_width = layout - .children() - .nth(self.state.resizing_idx) - .unwrap() - .bounds() - .width; - self.state.starting_right_width = layout - .children() - .nth(self.state.resizing_idx + 1) - .unwrap() - .bounds() - .width; - return event::Status::Captured; - } - } - Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => { - if self.state.resizing { - self.state.resizing = false; - self.state.starting_cursor_pos.take(); - // TODO: UPDATE - //shell.publish(messages); - return event::Status::Captured; - } - } - Event::Mouse(mouse::Event::CursorMoved { position }) => { - if self.state.resizing { - let delta = position.x - self.state.starting_cursor_pos.unwrap().x; - - let left_width = self.state.starting_left_width; - let right_width = self.state.starting_right_width; - - let max_width = left_width + right_width - 30.0; - - let left_width = (left_width + delta).max(30.0).min(max_width) as u16; - let left_name = &self.names[self.state.resizing_idx - start_offset]; - let right_width = (right_width - delta).max(30.0).min(max_width) as u16; - let right_name = &self.names[self.state.resizing_idx + 1 - start_offset]; - - self.trigger_resize( - left_name.clone(), - left_width, - right_name.clone(), - right_width, - shell, - ); - return event::Status::Captured; - } - } - _ => {} - } - } else { - self.state.resize_hovering = false; - } - - self.children - .iter_mut() - .zip(&mut tree.children) - .zip(layout.children()) - .map(|((child, state), layout)| { - child.as_widget_mut().on_event( - state, - event.clone(), - layout, - cursor, - renderer, - clipboard, - shell, - viewport - ) - }) - .fold(event::Status::Ignored, event::Status::merge) - } - - fn draw( - &self, - tree: &Tree, - renderer: &mut Renderer, - theme: &Renderer::Theme, - style: &iced_core::renderer::Style, - layout: Layout<'_>, - cursor: mouse::Cursor, - viewport: &Rectangle, - ) { - for ((child, state), layout) in self - .children - .iter() - .zip(&tree.children) - .zip(layout.children()) - { - child.as_widget().draw( - state, - renderer, - theme, - style, - layout, - cursor, - viewport, - ); - } - } - - fn mouse_interaction( - &self, - tree: &Tree, - layout: Layout<'_>, - cursor: mouse::Cursor, - viewport: &Rectangle, - renderer: &Renderer, - ) -> mouse::Interaction { - let bounds = layout.bounds(); - let cursor_position = cursor.position().unwrap_or_default(); - let is_mouse_over = bounds.contains(cursor_position); - - if is_mouse_over { - mouse::Interaction::Pointer - } else { - mouse::Interaction::default() - } - } - - /*fn hash_layout(&self, state: &mut Hasher) { - use std::hash::Hash; - - struct Marker; - std::any::TypeId::of::().hash(state); - - self.width.hash(state); - self.height.hash(state); - self.spacing.hash(state); - self.left_margin.hash(state); - self.right_margin.hash(state); - self.leeway.hash(state); - - for child in &self.children { - child.hash_layout(state); - } - }*/ + fn children(&self) -> Vec { + self.children.iter().map(Tree::new).collect() + } + + fn diff(&self, tree: &mut Tree) { + tree.diff_children(&self.children); + } + + fn size(&self) -> Size { + Size { + width: self.width, + height: self.height, + } + } + + fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> layout::Node { + let limits = limits.width(self.width).height(self.height); + + layout::flex::resolve( + layout::flex::Axis::Horizontal, + renderer, + &limits, + self.width, + self.height, + Padding::ZERO, + self.spacing as f32, + Alignment::Start, + &self.children, + self.children.iter.map(Tree::new), + ) + } + + fn on_event( + &mut self, + tree: &mut Tree, + event: Event, + layout: Layout<'_>, + cursor: mouse::Cursor, + renderer: &Renderer, + clipboard: &mut dyn Clipboard, + shell: &mut Shell<'_, Message>, + viewport: &Rectangle, + ) -> event::Status { + let cursor_position = cursor.position().unwrap_or_default(); + let in_bounds = layout.bounds().contains(cursor_position); + + if self.state.resizing || in_bounds { + let child_len = self.children.len(); + let start_offset = if self.left_margin { 1 } else { 0 }; + let end_offset = if self.right_margin { 1 } else { 0 }; + + let dividers = self + .children + .iter() + .enumerate() + .zip(layout.children()) + .filter_map(|((idx, _), layout)| { + if idx >= start_offset && idx < (child_len - 1 - end_offset) { + Some((idx, layout.position().x + layout.bounds().width)) + } else { + None + } + }) + .collect::>(); + + if self.on_resize.is_some() { + if !self.state.resizing { + self.state.resize_hovering = false; + } + + for (idx, divider) in dividers.iter() { + if cursor_position.x > (divider - self.leeway as f32) + && cursor_position.x < (divider + self.leeway as f32) + { + if !self.state.resize_hovering { + self.state.resizing_idx = *idx; + } + + self.state.resize_hovering = true; + } + } + } + + match event { + Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => { + if self.state.resize_hovering { + self.state.resizing = true; + self.state.starting_cursor_pos = Some(cursor_position); + self.state.starting_left_width = layout + .children() + .nth(self.state.resizing_idx) + .unwrap() + .bounds() + .width; + self.state.starting_right_width = layout + .children() + .nth(self.state.resizing_idx + 1) + .unwrap() + .bounds() + .width; + return event::Status::Captured; + } + } + Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => { + if self.state.resizing { + self.state.resizing = false; + self.state.starting_cursor_pos.take(); + // TODO: UPDATE + //shell.publish(messages); + return event::Status::Captured; + } + } + Event::Mouse(mouse::Event::CursorMoved { position }) => { + if self.state.resizing { + let delta = position.x - self.state.starting_cursor_pos.unwrap().x; + + let left_width = self.state.starting_left_width; + let right_width = self.state.starting_right_width; + + let max_width = left_width + right_width - 30.0; + + let left_width = (left_width + delta).max(30.0).min(max_width) as u16; + let left_name = &self.names[self.state.resizing_idx - start_offset]; + let right_width = (right_width - delta).max(30.0).min(max_width) as u16; + let right_name = &self.names[self.state.resizing_idx + 1 - start_offset]; + + self.trigger_resize( + left_name.clone(), + left_width, + right_name.clone(), + right_width, + shell, + ); + return event::Status::Captured; + } + } + _ => {} + } + } else { + self.state.resize_hovering = false; + } + + self.children + .iter_mut() + .zip(&mut tree.children) + .zip(layout.children()) + .map(|((child, state), layout)| { + child.as_widget_mut().on_event( + state, + event.clone(), + layout, + cursor, + renderer, + clipboard, + shell, + viewport, + ) + }) + .fold(event::Status::Ignored, event::Status::merge) + } + + fn draw( + &self, + tree: &Tree, + renderer: &mut Renderer, + theme: &Theme, + style: &iced_core::renderer::Style, + layout: Layout<'_>, + cursor: mouse::Cursor, + viewport: &Rectangle, + ) { + for ((child, state), layout) in self + .children + .iter() + .zip(&tree.children) + .zip(layout.children()) + { + child + .as_widget() + .draw(state, renderer, theme, style, layout, cursor, viewport); + } + } + + fn mouse_interaction( + &self, + tree: &Tree, + layout: Layout<'_>, + cursor: mouse::Cursor, + viewport: &Rectangle, + renderer: &Renderer, + ) -> mouse::Interaction { + let bounds = layout.bounds(); + let cursor_position = cursor.position().unwrap_or_default(); + let is_mouse_over = bounds.contains(cursor_position); + + if is_mouse_over { + mouse::Interaction::Pointer + } else { + mouse::Interaction::default() + } + } + + /*fn hash_layout(&self, state: &mut Hasher) { + use std::hash::Hash; + + struct Marker; + std::any::TypeId::of::().hash(state); + + self.width.hash(state); + self.height.hash(state); + self.spacing.hash(state); + self.left_margin.hash(state); + self.right_margin.hash(state); + self.leeway.hash(state); + + for child in &self.children { + child.hash_layout(state); + } + }*/ } -impl<'a, Message, Renderer> From> for Element<'a, Message, Renderer> +impl<'a, Message, Theme, Renderer> From> + for Element<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, - Renderer::Theme: StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, - Message: 'a, + Renderer: 'a + iced_core::Renderer, + Theme: StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, + Message: 'a, { - fn from(header: Header<'a, Message, Renderer>) -> Element<'a, Message, Renderer> { - Element::new(header) - } + fn from(header: Header<'a, Message, Renderer>) -> Element<'a, Message, Theme, Renderer> { + Element::new(header) + } } #[derive(Debug, Clone)] pub enum ResizeEvent { - ResizeColumn { - left_name: String, - left_width: u16, - right_name: String, - right_width: u16, - }, - Finished, + ResizeColumn { + left_name: String, + left_width: u16, + right_name: String, + right_width: u16, + }, + Finished, } diff --git a/crates/widgets/src/widget/table_row.rs b/crates/widgets/src/widget/table_row.rs index 6b466d6..7c9d263 100644 --- a/crates/widgets/src/widget/table_row.rs +++ b/crates/widgets/src/widget/table_row.rs @@ -1,339 +1,342 @@ #![allow(clippy::type_complexity)] use crate::style::table_row::StyleSheet; use iced_core::{ - event, layout, mouse, overlay, renderer, widget, widget::Tree, Alignment, Clipboard, Element, - Event, Layout, Length, Padding, Point, Rectangle, Shell, Widget, + event, layout, mouse, overlay, renderer, widget, widget::Tree, Alignment, Clipboard, Element, + Event, Layout, Length, Padding, Point, Rectangle, Shell, Widget, }; +use iced::Size; + #[allow(missing_debug_implementations)] -pub struct TableRow<'a, Message, Renderer> +pub struct TableRow<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> where - Renderer: 'a + iced_core::Renderer, - Renderer::Theme: StyleSheet, - Message: 'a, + Renderer: 'a + iced_core::Renderer, + Theme: StyleSheet, + Message: 'a, { - padding: Padding, - width: Length, - height: Length, - max_width: u32, - max_height: u32, - inner_row_height: u32, - horizontal_alignment: Alignment, - vertical_alignment: Alignment, - style: ::Style, - content: Element<'a, Message, Renderer>, - on_press: Option Message + 'a>>, + padding: Padding, + width: Length, + height: Length, + max_width: u32, + max_height: u32, + inner_row_height: u32, + horizontal_alignment: Alignment, + vertical_alignment: Alignment, + style: ::Style, + content: Element<'a, Message, Theme, Renderer>, + on_press: Option Message + 'a>>, } -impl<'a, Message, Renderer> TableRow<'a, Message, Renderer> +impl<'a, Message, Theme, Renderer> TableRow<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, - Renderer::Theme: StyleSheet, - Message: 'a, + Renderer: 'a + iced_core::Renderer, + Theme: StyleSheet, + Message: 'a, { - /// Creates an empty [`TableRow`]. - pub fn new(content: T) -> Self - where - T: Into>, - { - TableRow { - padding: Padding::ZERO, - width: Length::Shrink, - height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, - inner_row_height: u32::MAX, - horizontal_alignment: Alignment::Start, - vertical_alignment: Alignment::Start, - style: Default::default(), - content: content.into(), - on_press: None, - } - } - - /// Sets the style of the [`TableRow`]. - pub fn style(mut self, style: impl Into<::Style>) -> Self { - self.style = style.into(); - self - } - - /// Sets the width of the [`TableRow`]. - pub fn width(mut self, width: Length) -> Self { - self.width = width; - self - } - - /// Sets the height of the [`TableRow`]. - pub fn height(mut self, height: Length) -> Self { - self.height = height; - self - } - - /// Sets the maximum width of the [`TableRow`]. - pub fn max_width(mut self, max_width: u32) -> Self { - self.max_width = max_width; - self - } - - /// Sets the maximum height of the [`TableRow`] in pixels. - pub fn max_height(mut self, max_height: u32) -> Self { - self.max_height = max_height; - self - } - - /// Sets the height of the area that will be used to define the event capture area of [`TableRow`] in pixels. - pub fn inner_row_height(mut self, inner_row_height: u32) -> Self { - self.inner_row_height = inner_row_height; - self - } - - /// Sets the content alignment for the horizontal axis of the [`TableRow`]. - pub fn align_x(mut self, alignment: Alignment) -> Self { - self.horizontal_alignment = alignment; - self - } - - /// Sets the content alignment for the vertical axis of the [`TableRow`]. - pub fn align_y(mut self, alignment: Alignment) -> Self { - self.vertical_alignment = alignment; - self - } - - /// Centers the contents in the horizontal axis of the [`TableRow`]. - pub fn center_x(mut self) -> Self { - self.horizontal_alignment = Alignment::Center; - self - } - - /// Centers the contents in the vertical axis of the [`TableRow`]. - pub fn center_y(mut self) -> Self { - self.vertical_alignment = Alignment::Center; - self - } - - /// Sets the message that will be produced when the [`TableRow`] is pressed. - pub fn on_press(mut self, f: T) -> Self - where - T: 'a + Fn(Event) -> Message, - { - self.on_press = Some(Box::new(f)); - self - } - - pub fn padding(mut self, p: Padding) -> Self { - self.padding = p; - self - } + /// Creates an empty [`TableRow`]. + pub fn new(content: T) -> Self + where + T: Into>, + { + TableRow { + padding: Padding::ZERO, + width: Length::Shrink, + height: Length::Shrink, + max_width: u32::MAX, + max_height: u32::MAX, + inner_row_height: u32::MAX, + horizontal_alignment: Alignment::Start, + vertical_alignment: Alignment::Start, + style: Default::default(), + content: content.into(), + on_press: None, + } + } + + /// Sets the style of the [`TableRow`]. + pub fn style(mut self, style: impl Into<::Style>) -> Self { + self.style = style.into(); + self + } + + /// Sets the width of the [`TableRow`]. + pub fn width(mut self, width: Length) -> Self { + self.width = width; + self + } + + /// Sets the height of the [`TableRow`]. + pub fn height(mut self, height: Length) -> Self { + self.height = height; + self + } + + /// Sets the maximum width of the [`TableRow`]. + pub fn max_width(mut self, max_width: u32) -> Self { + self.max_width = max_width; + self + } + + /// Sets the maximum height of the [`TableRow`] in pixels. + pub fn max_height(mut self, max_height: u32) -> Self { + self.max_height = max_height; + self + } + + /// Sets the height of the area that will be used to define the event capture area of [`TableRow`] in pixels. + pub fn inner_row_height(mut self, inner_row_height: u32) -> Self { + self.inner_row_height = inner_row_height; + self + } + + /// Sets the content alignment for the horizontal axis of the [`TableRow`]. + pub fn align_x(mut self, alignment: Alignment) -> Self { + self.horizontal_alignment = alignment; + self + } + + /// Sets the content alignment for the vertical axis of the [`TableRow`]. + pub fn align_y(mut self, alignment: Alignment) -> Self { + self.vertical_alignment = alignment; + self + } + + /// Centers the contents in the horizontal axis of the [`TableRow`]. + pub fn center_x(mut self) -> Self { + self.horizontal_alignment = Alignment::Center; + self + } + + /// Centers the contents in the vertical axis of the [`TableRow`]. + pub fn center_y(mut self) -> Self { + self.vertical_alignment = Alignment::Center; + self + } + + /// Sets the message that will be produced when the [`TableRow`] is pressed. + pub fn on_press(mut self, f: T) -> Self + where + T: 'a + Fn(Event) -> Message, + { + self.on_press = Some(Box::new(f)); + self + } + + pub fn padding(mut self, p: Padding) -> Self { + self.padding = p; + self + } } -impl<'a, Message, Renderer> Widget for TableRow<'a, Message, Renderer> +impl<'a, Message, Theme, Renderer> Widget + for TableRow<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, - Renderer::Theme: StyleSheet, - Message: 'a, + Renderer: 'a + iced_core::Renderer, + Theme: StyleSheet, + Message: 'a, { - fn width(&self) -> Length { - self.width - } - - fn height(&self) -> Length { - self.height - } - - fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> layout::Node { - let limits = limits - .loose() - .width(self.width) - .height(self.height) - .pad(self.padding); - - let mut content = self.content.as_widget().layout(renderer, &limits.loose()); - let size = limits.resolve(content.size()); - - // TODO: MODIFIED COORDINATES, CHECK - content.move_to(Point::new( - self.padding.top as f32, - self.padding.left as f32, - )); - content.align(self.horizontal_alignment, self.vertical_alignment, size); - - layout::Node::with_children(size.pad(self.padding), vec![content]) - } - - fn draw( - &self, - _tree: &Tree, - renderer: &mut Renderer, - theme: &Renderer::Theme, - style: &renderer::Style, - layout: Layout<'_>, - cursor: mouse::Cursor, - viewport: &Rectangle, - ) { - let cursor_position = cursor.position().unwrap_or_default(); - let bounds = layout.bounds(); - let mut custom_bounds = layout.bounds(); - let tree = Tree::new(&self.content); - - // inner_row_height set? - if self.inner_row_height != u32::MAX { - custom_bounds.height = self.inner_row_height as f32; - } - - let is_mouse_over = custom_bounds.contains(cursor_position); - let content_layout = layout.children().next().unwrap(); - - let appearance = if is_mouse_over { - theme.hovered(&self.style) - } else { - theme.appearance(&self.style) - }; - - let background = iced_core::renderer::Quad { - bounds: Rectangle { - x: bounds.x + appearance.offset_left as f32, - y: bounds.y, - width: bounds.width - appearance.offset_right as f32, - height: custom_bounds.height, - }, - border_radius: appearance.border_radius.into(), - border_width: appearance.border_width, - border_color: appearance.border_color, - }; - - renderer.fill_quad( - background.into(), - appearance - .background.unwrap() - //.unwrap_or(Background::Color(Color::TRANSPARENT)), - ); - - self.content.as_widget().draw( - &tree, - renderer, - theme, - style, - content_layout, - cursor, - viewport, - ); - } - - fn mouse_interaction( - &self, - _tree: &Tree, - layout: Layout<'_>, - cursor: mouse::Cursor, - viewport: &Rectangle, - renderer: &Renderer, - ) -> mouse::Interaction { - let cursor_position = cursor.position().unwrap_or_default(); - let bounds = layout.bounds(); - let is_mouse_over = bounds.contains(cursor_position); - - let mut mouse_interaction = if is_mouse_over { - mouse::Interaction::Pointer - } else { - mouse::Interaction::default() - }; - - let children = layout.children(); - - for layout in children { - let is_mouse_over = layout.bounds().contains(cursor_position); - let new_mouse_interaction = if is_mouse_over { - mouse::Interaction::Pointer - } else { - mouse::Interaction::default() - }; - - if new_mouse_interaction > mouse_interaction { - mouse_interaction = new_mouse_interaction; - } - } - - mouse_interaction - } - - /*fn hash_layout(&self, state: &mut Hasher) { - struct Marker; - std::any::TypeId::of::().hash(state); - - self.padding.hash(state); - self.width.hash(state); - self.height.hash(state); - self.max_width.hash(state); - self.max_height.hash(state); - self.inner_row_height.hash(state); - - self.content.hash_layout(state); - }*/ - - fn on_event( - &mut self, - _tree: &mut Tree, - event: Event, - layout: Layout<'_>, - cursor: mouse::Cursor, - renderer: &Renderer, - clipboard: &mut dyn Clipboard, - shell: &mut Shell<'_, Message>, - viewport: &Rectangle, - ) -> event::Status { - let cursor_position = cursor.position().unwrap_or_default(); - let mut tree = Tree::new(&self.content); - let status_from_content = self.content.as_widget_mut().on_event( - &mut tree, - event.clone(), - layout.children().next().unwrap(), - cursor, - renderer, - clipboard, - shell, - viewport, - ); - match status_from_content { - event::Status::Ignored => { - if let Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) = event { - if let Some(on_press) = &self.on_press { - let mut bounds = layout.bounds(); - - // was inner row height set? - if self.inner_row_height != u32::MAX { - //We can face issues if the row is expanded, so we manage it by having a reduced bounds area to check for pointer - bounds.height = self.inner_row_height as f32; - } - - if bounds.contains(cursor_position) { - shell.publish(on_press(event)); - } - } - } - status_from_content - }, - _ => status_from_content, - } - } - - fn overlay<'b>( - &'b mut self, - tree: &'b mut Tree, - layout: Layout<'_>, - renderer: &Renderer, - ) -> Option> { - self.content - .as_widget_mut() - .overlay(tree, layout.children().next().unwrap(), renderer) - } + fn size(&self) -> Size { + Size { + width: self.width, + height: self.height, + } + } + + fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> layout::Node { + let limits = limits + .loose() + .width(self.width) + .height(self.height) + .pad(self.padding); + + let mut content = self.content.as_widget().layout(renderer, &limits.loose()); + let size = limits.resolve(content.size()); + + // TODO: MODIFIED COORDINATES, CHECK + content.move_to(Point::new( + self.padding.top as f32, + self.padding.left as f32, + )); + content.align(self.horizontal_alignment, self.vertical_alignment, size); + + layout::Node::with_children(size.pad(self.padding), vec![content]) + } + + fn draw( + &self, + _tree: &Tree, + renderer: &mut Renderer, + theme: &Theme, + style: &renderer::Style, + layout: Layout<'_>, + cursor: mouse::Cursor, + viewport: &Rectangle, + ) { + let cursor_position = cursor.position().unwrap_or_default(); + let bounds = layout.bounds(); + let mut custom_bounds = layout.bounds(); + let tree = Tree::new(&self.content); + + // inner_row_height set? + if self.inner_row_height != u32::MAX { + custom_bounds.height = self.inner_row_height as f32; + } + + let is_mouse_over = custom_bounds.contains(cursor_position); + let content_layout = layout.children().next().unwrap(); + + let appearance = if is_mouse_over { + theme.hovered(&self.style) + } else { + theme.appearance(&self.style) + }; + + let background = iced_core::renderer::Quad { + bounds: Rectangle { + x: bounds.x + appearance.offset_left as f32, + y: bounds.y, + width: bounds.width - appearance.offset_right as f32, + height: custom_bounds.height, + }, + border_radius: appearance.border_radius.into(), + border_width: appearance.border_width, + border_color: appearance.border_color, + }; + + renderer.fill_quad( + background.into(), + appearance.background.unwrap(), //.unwrap_or(Background::Color(Color::TRANSPARENT)), + ); + + self.content.as_widget().draw( + &tree, + renderer, + theme, + style, + content_layout, + cursor, + viewport, + ); + } + + fn mouse_interaction( + &self, + _tree: &Tree, + layout: Layout<'_>, + cursor: mouse::Cursor, + viewport: &Rectangle, + renderer: &Renderer, + ) -> mouse::Interaction { + let cursor_position = cursor.position().unwrap_or_default(); + let bounds = layout.bounds(); + let is_mouse_over = bounds.contains(cursor_position); + + let mut mouse_interaction = if is_mouse_over { + mouse::Interaction::Pointer + } else { + mouse::Interaction::default() + }; + + let children = layout.children(); + + for layout in children { + let is_mouse_over = layout.bounds().contains(cursor_position); + let new_mouse_interaction = if is_mouse_over { + mouse::Interaction::Pointer + } else { + mouse::Interaction::default() + }; + + if new_mouse_interaction > mouse_interaction { + mouse_interaction = new_mouse_interaction; + } + } + + mouse_interaction + } + + /*fn hash_layout(&self, state: &mut Hasher) { + struct Marker; + std::any::TypeId::of::().hash(state); + + self.padding.hash(state); + self.width.hash(state); + self.height.hash(state); + self.max_width.hash(state); + self.max_height.hash(state); + self.inner_row_height.hash(state); + + self.content.hash_layout(state); + }*/ + + fn on_event( + &mut self, + _tree: &mut Tree, + event: Event, + layout: Layout<'_>, + cursor: mouse::Cursor, + renderer: &Renderer, + clipboard: &mut dyn Clipboard, + shell: &mut Shell<'_, Message>, + viewport: &Rectangle, + ) -> event::Status { + let cursor_position = cursor.position().unwrap_or_default(); + let mut tree = Tree::new(&self.content); + let status_from_content = self.content.as_widget_mut().on_event( + &mut tree, + event.clone(), + layout.children().next().unwrap(), + cursor, + renderer, + clipboard, + shell, + viewport, + ); + match status_from_content { + event::Status::Ignored => { + if let Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) = event { + if let Some(on_press) = &self.on_press { + let mut bounds = layout.bounds(); + + // was inner row height set? + if self.inner_row_height != u32::MAX { + //We can face issues if the row is expanded, so we manage it by having a reduced bounds area to check for pointer + bounds.height = self.inner_row_height as f32; + } + + if bounds.contains(cursor_position) { + shell.publish(on_press(event)); + } + } + } + status_from_content + } + _ => status_from_content, + } + } + + fn overlay<'b>( + &'b mut self, + tree: &'b mut Tree, + layout: Layout<'_>, + renderer: &Renderer, + ) -> Option> { + self.content + .as_widget_mut() + .overlay(tree, layout.children().next().unwrap(), renderer) + } } -impl<'a, Message, Renderer> From> for Element<'a, Message, Renderer> +impl<'a, Message, Theme, Renderer> From> + for Element<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, - Renderer::Theme: StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, - Message: 'a, + Renderer: 'a + iced_core::Renderer, + Theme: StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, + Message: 'a, { - fn from(table_row: TableRow<'a, Message, Renderer>) -> Element<'a, Message, Renderer> { - Element::new(table_row) - } + fn from( + table_row: TableRow<'a, Message, Theme, Renderer>, + ) -> Element<'a, Message, Theme, Renderer> { + Element::new(table_row) + } } diff --git a/src/gui/element/wallet/setup/init.rs b/src/gui/element/wallet/setup/init.rs index 1f71b28..6090b4a 100644 --- a/src/gui/element/wallet/setup/init.rs +++ b/src/gui/element/wallet/setup/init.rs @@ -64,6 +64,9 @@ pub fn handle_message( state.mode = super::Mode::CreateWallet(wallet_display_name); } + /*LocalViewInteraction::WalletSetupRestore => { + //state.mode = super::Mode::RestoreWallet; + },*/ LocalViewInteraction::WalletList => state.mode = super::Mode::ListWallets, } Ok(Command::none()) From b079297b5edcd2f7197b9930bdedb25cdc3f083d Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Wed, 13 Mar 2024 13:56:28 +0000 Subject: [PATCH 02/12] update header crates for iced-rs 0.12.1 --- Cargo.lock | 13 - Cargo.toml | 1 - crates/core/Cargo.toml | 4 - crates/core/src/lib.rs | 12 +- crates/core/src/style/header.rs | 58 + crates/{widgets => core}/src/style/mod.rs | 0 crates/core/src/style/table_row.rs | 134 +++ crates/core/src/theme/button.rs | 282 +++-- crates/core/src/theme/card.rs | 38 +- crates/core/src/theme/checkbox.rs | 65 +- crates/core/src/theme/container.rs | 171 +-- crates/core/src/theme/header.rs | 36 - crates/core/src/theme/mod.rs | 1060 ++++++++--------- crates/core/src/theme/modal.rs | 30 +- crates/core/src/theme/picklist.rs | 126 +- crates/core/src/theme/scrollable.rs | 90 +- crates/core/src/theme/table_row.rs | 112 -- crates/core/src/theme/text_input.rs | 166 +-- crates/{widgets => core}/src/widget/header.rs | 18 +- crates/core/src/widget/header/state.rs | 11 + crates/{widgets => core}/src/widget/mod.rs | 0 .../{widgets => core}/src/widget/table_row.rs | 0 crates/widgets/Cargo.toml | 21 - crates/widgets/src/lib.rs | 9 - crates/widgets/src/style/header.rs | 25 - crates/widgets/src/style/table_row.rs | 24 - crates/widgets/src/widget/header/state.rs | 11 - 27 files changed, 1244 insertions(+), 1273 deletions(-) create mode 100644 crates/core/src/style/header.rs rename crates/{widgets => core}/src/style/mod.rs (100%) create mode 100644 crates/core/src/style/table_row.rs delete mode 100644 crates/core/src/theme/header.rs delete mode 100644 crates/core/src/theme/table_row.rs rename crates/{widgets => core}/src/widget/header.rs (95%) create mode 100644 crates/core/src/widget/header/state.rs rename crates/{widgets => core}/src/widget/mod.rs (100%) rename crates/{widgets => core}/src/widget/table_row.rs (100%) delete mode 100644 crates/widgets/Cargo.toml delete mode 100644 crates/widgets/src/lib.rs delete mode 100644 crates/widgets/src/style/header.rs delete mode 100644 crates/widgets/src/style/table_row.rs delete mode 100644 crates/widgets/src/widget/header/state.rs diff --git a/Cargo.lock b/Cargo.lock index 008615e..dfc47a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2798,7 +2798,6 @@ dependencies = [ "futures 0.3.30", "fuzzy-matcher", "grin-gui-core", - "grin-gui-widgets", "iced 0.10.0", "iced_aw 0.6.0", "iced_core 0.10.0", @@ -2848,7 +2847,6 @@ dependencies = [ "flate2", "futures 0.3.30", "glob", - "grin-gui-widgets", "grin_chain", "grin_config", "grin_core", @@ -2892,17 +2890,6 @@ dependencies = [ "zstd", ] -[[package]] -name = "grin-gui-widgets" -version = "0.1.0-alpha.6" -dependencies = [ - "iced 0.12.1", - "iced_core 0.12.3", - "iced_graphics 0.12.1", - "iced_style 0.12.1", - "iced_wgpu 0.12.1", -] - [[package]] name = "grin_api" version = "5.3.0-alpha.1" diff --git a/Cargo.toml b/Cargo.toml index 5934778..266bf25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ debug = ["iced/debug"] [dependencies] grin-gui-core = { version = "0.1.0-alpha.6", path = "crates/core", features = ["wgpu"]} -grin-gui-widgets = { version = "0.1.0-alpha.6", path = "crates/widgets" } iced = { version = "0.10", features = ["canvas", "tokio"] } iced_futures = { version = "0.7", features = ["async-std"] } diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index ffe7f68..4e79570 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -35,8 +35,6 @@ grin_servers = { git = "https://github.com/mimblewimble/grin", branch = "master" grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "master"} grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "master"} - - ### Wallet grin_wallet = { git = "https://github.com/mimblewimble/grin-wallet", branch = "contracts" } grin_wallet_config = { git = "https://github.com/mimblewimble/grin-wallet", branch = "contracts" } @@ -46,7 +44,6 @@ grin_wallet_api = { git = "https://github.com/mimblewimble/grin-wallet", branch grin_wallet_impls = { git = "https://github.com/mimblewimble/grin-wallet", branch = "contracts" } grin_wallet_libwallet = { git = "https://github.com/mimblewimble/grin-wallet", branch = "contracts" } - ############ Local testing ################ ### Node # grin_config = { path = "../../../grin/config" } @@ -65,7 +62,6 @@ grin_wallet_libwallet = { git = "https://github.com/mimblewimble/grin-wallet", b #grin_wallet_impls = { path = "../../../grin-wallet/impls"} #grin_wallet_libwallet = { path = "../../../grin-wallet/libwallet"} -grin-gui-widgets = { path = "../widgets" } regex = "1.4.3" fancy-regex = "0.5.0" # Regex with backtracking async-std = { version = "1.9.0", features = ["unstable"] } diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index bbddbc0..fc743ad 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -4,15 +4,17 @@ pub mod backup; pub mod config; -pub mod wallet; -pub mod logger; -pub mod node; pub mod error; pub mod fs; -pub mod theme; +pub mod logger; pub mod network; +pub mod node; +pub mod style; +pub mod theme; #[cfg(feature = "wgpu")] pub mod utility; +pub mod wallet; +pub mod widget; #[macro_use] extern crate lazy_static; @@ -21,5 +23,5 @@ extern crate lazy_static; extern crate log; // Re-exports -pub use grin_util::logger::{LoggingConfig, LogEntry}; pub use grin_core::consensus::GRIN_BASE; +pub use grin_util::logger::{LogEntry, LoggingConfig}; diff --git a/crates/core/src/style/header.rs b/crates/core/src/style/header.rs new file mode 100644 index 0000000..2ca4500 --- /dev/null +++ b/crates/core/src/style/header.rs @@ -0,0 +1,58 @@ +use iced::Theme; +use iced_core::{Background, Color}; + +/// The appearance of a header. +#[derive(Debug, Clone, Copy)] +pub struct Appearance { + pub text_color: Option, + pub background: Option, + pub border_radius: f32, + pub border_width: f32, + pub border_color: Color, + pub offset_left: f32, + pub offset_right: f32, +} + +/// A set of rules that dictate the style of a header. +pub trait StyleSheet { + type Style: std::default::Default + Copy; + + /// Produces the style of a header. + fn appearance(&self, style: &Self::Style) -> Appearance; + + /// Produces the a hovered appearance for header. + fn hovered(&self, style: &Self::Style) -> Appearance; +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub enum HeaderStyle { + #[default] + Default, +} + +impl StyleSheet for Theme { + type Style = HeaderStyle; + + fn appearance(&self, style: &Self::Style) -> Appearance { + match style { + HeaderStyle::Default => Appearance { + //text_color: Some(self.palette.bright.surface), + text_color: None, + background: Some(Background::Color(self.palette().primary)), + border_radius: 0.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_right: 0.0, + offset_left: 0.0, + }, + } + } + + fn hovered(&self, style: &Self::Style) -> Appearance { + let appearance = self.appearance(style); + Appearance { + background: None, + ..appearance + } + } +} diff --git a/crates/widgets/src/style/mod.rs b/crates/core/src/style/mod.rs similarity index 100% rename from crates/widgets/src/style/mod.rs rename to crates/core/src/style/mod.rs diff --git a/crates/core/src/style/table_row.rs b/crates/core/src/style/table_row.rs new file mode 100644 index 0000000..9acec48 --- /dev/null +++ b/crates/core/src/style/table_row.rs @@ -0,0 +1,134 @@ +use iced::Theme; +use iced::{Background, Color}; + +/// The appearance of a table row. +#[derive(Debug, Clone, Copy, Default)] +pub struct Appearance { + pub text_color: Option, + pub background: Option, + pub border_radius: f32, + pub border_width: f32, + pub border_color: Color, + pub offset_left: f32, + pub offset_right: f32, +} + +/// A set of rules that dictate the style of a table row. +pub trait StyleSheet { + type Style: std::default::Default + Copy; + + /// Produces the default appearance of a table row. + fn appearance(&self, style: &Self::Style) -> Appearance; + + /// Produces the hovered appearance table row. + fn hovered(&self, style: &Self::Style) -> Appearance; +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub enum TableRowStyle { + #[default] + Default, + TableRowAlternate, + TableRowHighlife, + TableRowLowlife, + TableRowSelected, +} + +impl StyleSheet for Theme { + type Style = TableRowStyle; + + fn appearance(&self, style: &Self::Style) -> Appearance { + match style { + TableRowStyle::Default => Appearance { + text_color: Some(self.palette().primary), + background: Some(Background::Color(self.palette().primary)), + border_radius: 0.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + // offset_left: 10.0, + // offset_right: 25.0, + offset_left: 0.0, + offset_right: 0.0, + }, + TableRowStyle::TableRowAlternate => Appearance { + background: Some(Background::Color(Color { + a: 0.50, + ..self.palette().primary + })), + ..Appearance::default() + }, + TableRowStyle::TableRowHighlife => Appearance { + text_color: Some(self.palette().primary), + background: Some(Background::Color(Color { + a: 0.30, + ..self.palette().primary + })), + border_radius: 0.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + TableRowStyle::TableRowLowlife => Appearance { + text_color: Some(self.palette().primary), + background: Some(Background::Color(Color::TRANSPARENT)), + border_radius: 0.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + TableRowStyle::TableRowSelected => Appearance { + text_color: Some(self.palette().primary), + background: Some(Background::Color(self.palette().primary)), + border_radius: 0.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + } + } + + fn hovered(&self, style: &Self::Style) -> Appearance { + let appearance = self.appearance(style); + + match style { + TableRowStyle::Default => Appearance { + background: Some(Background::Color(Color { + a: 0.60, + ..self.palette().primary + })), + ..appearance + }, + TableRowStyle::TableRowAlternate => Appearance { + background: Some(Background::Color(Color { + a: 0.25, + ..self.palette().primary + })), + ..appearance + }, + TableRowStyle::TableRowHighlife => Appearance { + background: Some(Background::Color(Color { + a: 0.60, + ..self.palette().primary + })), + ..appearance + }, + TableRowStyle::TableRowLowlife => Appearance { + background: Some(Background::Color(Color { + a: 0.60, + ..self.palette().primary + })), + ..appearance + }, + TableRowStyle::TableRowSelected => Appearance { + background: Some(Background::Color(Color { + a: 0.60, + ..self.palette().primary + })), + ..appearance + }, + } + } +} diff --git a/crates/core/src/theme/button.rs b/crates/core/src/theme/button.rs index ce665f2..96cbb1e 100644 --- a/crates/core/src/theme/button.rs +++ b/crates/core/src/theme/button.rs @@ -1,144 +1,164 @@ use iced::widget::button; -use iced::{Color, Background}; +use iced::{Background, Color}; +use iced_core::Border; use super::Theme; #[derive(Debug, Clone, Copy, Default)] pub enum ButtonStyle { - #[default] - Default, - Bordered, - ColumnHeader, - Primary, - Selected, - SelectedColumn, - NormalText, + #[default] + Default, + Bordered, + ColumnHeader, + Primary, + Selected, + SelectedColumn, + NormalText, } impl button::StyleSheet for Theme { - type Style = ButtonStyle; + type Style = ButtonStyle; - fn active(&self, style: &Self::Style) -> button::Appearance { - match style { - ButtonStyle::Default => button::Appearance::default(), - ButtonStyle::Bordered => button::Appearance { - border_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - border_width: 1.0, - border_radius: 2.0.into(), - text_color: self.palette.bright.primary, - ..button::Appearance::default() - }, - ButtonStyle::Primary => button::Appearance { - text_color: self.palette.bright.primary, - border_radius: 2.0.into(), - ..Default::default() - }, - ButtonStyle::Selected => button::Appearance { - background: Some(Background::Color(self.palette.normal.primary)), - text_color: self.palette.bright.primary, - border_radius: 2.0.into(), - ..button::Appearance::default() - }, - ButtonStyle::NormalText => button::Appearance { - text_color: self.palette.normal.surface, - border_radius: 2.0.into(), - ..button::Appearance::default() - }, - ButtonStyle::SelectedColumn => button::Appearance { - background: Some(Background::Color(self.palette.base.background)), - text_color: Color { - ..self.palette.bright.primary - }, - border_radius: 2.0.into(), - ..button::Appearance::default() - }, - ButtonStyle::ColumnHeader => button::Appearance { - background: Some(Background::Color(self.palette.base.background)), - text_color: Color { - ..self.palette.bright.surface - }, - border_radius: 2.0.into(), - ..button::Appearance::default() - }, - } - } + fn active(&self, style: &Self::Style) -> button::Appearance { + match style { + ButtonStyle::Default => button::Appearance::default(), + ButtonStyle::Bordered => button::Appearance { + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + text_color: self.palette.bright.primary, + ..button::Appearance::default() + }, + ButtonStyle::Primary => button::Appearance { + text_color: self.palette.bright.primary, + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + ..Default::default() + }, + ButtonStyle::Selected => button::Appearance { + background: Some(Background::Color(self.palette.normal.primary)), + text_color: self.palette.bright.primary, + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + ..button::Appearance::default() + }, + ButtonStyle::NormalText => button::Appearance { + text_color: self.palette.normal.surface, + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + ..button::Appearance::default() + }, + ButtonStyle::SelectedColumn => button::Appearance { + background: Some(Background::Color(self.palette.base.background)), + text_color: Color { + ..self.palette.bright.primary + }, + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + ..button::Appearance::default() + }, + ButtonStyle::ColumnHeader => button::Appearance { + background: Some(Background::Color(self.palette.base.background)), + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + text_color: Color { + ..self.palette.bright.surface + }, + ..button::Appearance::default() + }, + } + } - fn hovered(&self, style: &Self::Style) -> button::Appearance { - match style { - ButtonStyle::Default => button::Appearance::default(), - ButtonStyle::Bordered => button::Appearance { - background: Some(Background::Color(Color { - a: 0.25, - ..self.palette.normal.primary - })), - text_color: self.palette.bright.primary, - ..self.active(style) - }, - ButtonStyle::Primary => button::Appearance { - background: Some(Background::Color(Color { - a: 0.25, - ..self.palette.normal.primary - })), - text_color: self.palette.bright.primary, - ..self.active(style) - }, - ButtonStyle::Selected => button::Appearance { - background: Some(Background::Color(self.palette.normal.primary)), - text_color: self.palette.bright.primary, - ..self.active(style) - }, - ButtonStyle::NormalText => button::Appearance { - background: Some(Background::Color(Color::TRANSPARENT)), - text_color: self.palette.bright.primary, - ..self.active(style) - }, - ButtonStyle::SelectedColumn => button::Appearance { - background: Some(Background::Color(Color { - a: 0.25, - ..self.palette.normal.primary - })), - text_color: self.palette.bright.primary, - ..self.active(style) - }, - ButtonStyle::ColumnHeader => button::Appearance { - background: Some(Background::Color(Color { - a: 0.15, - ..self.palette.normal.primary - })), - text_color: self.palette.bright.primary, - ..self.active(style) - }, - } - } + fn hovered(&self, style: &Self::Style) -> button::Appearance { + match style { + ButtonStyle::Default => button::Appearance::default(), + ButtonStyle::Bordered => button::Appearance { + background: Some(Background::Color(Color { + a: 0.25, + ..self.palette.normal.primary + })), + text_color: self.palette.bright.primary, + ..self.active(style) + }, + ButtonStyle::Primary => button::Appearance { + background: Some(Background::Color(Color { + a: 0.25, + ..self.palette.normal.primary + })), + text_color: self.palette.bright.primary, + ..self.active(style) + }, + ButtonStyle::Selected => button::Appearance { + background: Some(Background::Color(self.palette.normal.primary)), + text_color: self.palette.bright.primary, + ..self.active(style) + }, + ButtonStyle::NormalText => button::Appearance { + background: Some(Background::Color(Color::TRANSPARENT)), + text_color: self.palette.bright.primary, + ..self.active(style) + }, + ButtonStyle::SelectedColumn => button::Appearance { + background: Some(Background::Color(Color { + a: 0.25, + ..self.palette.normal.primary + })), + text_color: self.palette.bright.primary, + ..self.active(style) + }, + ButtonStyle::ColumnHeader => button::Appearance { + background: Some(Background::Color(Color { + a: 0.15, + ..self.palette.normal.primary + })), + text_color: self.palette.bright.primary, + ..self.active(style) + }, + } + } - fn disabled(&self, style: &Self::Style) -> button::Appearance { - match style { - ButtonStyle::Default => button::Appearance::default(), - ButtonStyle::Bordered => button::Appearance { - background: Some(Background::Color(Color { - a: 0.05, - ..self.palette.normal.primary - })), - text_color: Color { - a: 0.50, - ..self.palette.normal.primary - }, - ..self.active(style) - }, - ButtonStyle::Primary => button::Appearance { - text_color: Color { - a: 0.25, - ..self.palette.normal.surface - }, - ..self.active(style) - }, - ButtonStyle::Selected => button::Appearance { - ..self.active(style) - }, - _ => self.disabled(style), - } - } + fn disabled(&self, style: &Self::Style) -> button::Appearance { + match style { + ButtonStyle::Default => button::Appearance::default(), + ButtonStyle::Bordered => button::Appearance { + background: Some(Background::Color(Color { + a: 0.05, + ..self.palette.normal.primary + })), + text_color: Color { + a: 0.50, + ..self.palette.normal.primary + }, + ..self.active(style) + }, + ButtonStyle::Primary => button::Appearance { + text_color: Color { + a: 0.25, + ..self.palette.normal.surface + }, + ..self.active(style) + }, + ButtonStyle::Selected => button::Appearance { + ..self.active(style) + }, + _ => self.disabled(style), + } + } } diff --git a/crates/core/src/theme/card.rs b/crates/core/src/theme/card.rs index 616ab12..19274cd 100644 --- a/crates/core/src/theme/card.rs +++ b/crates/core/src/theme/card.rs @@ -6,27 +6,27 @@ use super::Theme; #[derive(Debug, Clone, Copy, Default)] pub enum CardStyle { - #[default] - Default, - Normal, + #[default] + Default, + Normal, } impl card::StyleSheet for Theme { - type Style = CardStyle; + type Style = CardStyle; - fn active(&self, style: Self::Style) -> Appearance { - match style { - CardStyle::Default => iced_aw::style::card::Appearance::default(), - CardStyle::Normal => Appearance { - background: Background::Color(self.palette.base.background), - head_background: Background::Color(self.palette.normal.primary), - head_text_color: self.palette.bright.surface, - border_color: self.palette.normal.primary, - body_text_color: self.palette.normal.surface, - border_radius: 3.0, - border_width: 0.5, - ..card::Appearance::default() - }, - } - } + fn active(&self, style: &Self::Style) -> Appearance { + match style { + CardStyle::Default => iced_aw::style::card::Appearance::default(), + CardStyle::Normal => Appearance { + background: Background::Color(self.palette.base.background), + head_background: Background::Color(self.palette.normal.primary), + head_text_color: self.palette.bright.surface, + border_color: self.palette.normal.primary, + body_text_color: self.palette.normal.surface, + border_radius: 3.0, + border_width: 0.5, + ..card::Appearance::default() + }, + } + } } diff --git a/crates/core/src/theme/checkbox.rs b/crates/core/src/theme/checkbox.rs index 17726b7..9beb83d 100644 --- a/crates/core/src/theme/checkbox.rs +++ b/crates/core/src/theme/checkbox.rs @@ -1,42 +1,47 @@ use super::Theme; use iced::widget::checkbox; use iced::Background; +use iced_core::Border; #[derive(Debug, Clone, Copy, Default)] pub enum CheckboxStyle { - #[default] - Default, - Normal, + #[default] + Default, + Normal, } impl checkbox::StyleSheet for Theme { - type Style = CheckboxStyle; + type Style = CheckboxStyle; - fn active(&self, style: &Self::Style, is_checked: bool) -> checkbox::Appearance { - match style { - CheckboxStyle::Normal => checkbox::Appearance { - background: Background::Color(self.palette.base.background), - icon_color: self.palette.bright.primary, - border_radius: 2.0.into(), - border_width: 1.0, - border_color: self.palette.normal.primary, - text_color: Some(self.palette.normal.surface), - }, - _ => todo!("default"), - } - } + fn active(&self, style: &Self::Style, is_checked: bool) -> checkbox::Appearance { + match style { + CheckboxStyle::Normal => checkbox::Appearance { + background: Background::Color(self.palette.base.background), + icon_color: self.palette.bright.primary, + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + text_color: Some(self.palette.normal.surface), + }, + _ => todo!("default"), + } + } - fn hovered(&self, style: &Self::Style, is_checked: bool) -> checkbox::Appearance { - match style { - CheckboxStyle::Normal => checkbox::Appearance { - background: Background::Color(self.palette.base.foreground), - icon_color: self.palette.bright.primary, - border_radius: 2.0.into(), - border_width: 2.0, - border_color: self.palette.bright.primary, - text_color: Some(self.palette.normal.surface), - }, - _ => todo!("default"), - } - } + fn hovered(&self, style: &Self::Style, is_checked: bool) -> checkbox::Appearance { + match style { + CheckboxStyle::Normal => checkbox::Appearance { + background: Background::Color(self.palette.base.foreground), + icon_color: self.palette.bright.primary, + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + text_color: Some(self.palette.normal.surface), + }, + _ => todo!("default"), + } + } } diff --git a/crates/core/src/theme/container.rs b/crates/core/src/theme/container.rs index fc7918e..a3c3ee6 100644 --- a/crates/core/src/theme/container.rs +++ b/crates/core/src/theme/container.rs @@ -1,90 +1,101 @@ +use super::Theme; use iced::widget::container; use iced::{Background, Color}; -use super::Theme; +use iced_core::{Border, Shadow, Vector}; #[derive(Debug, Clone, Copy, Default)] pub enum ContainerStyle { - #[default] - Default, - BrightForeground, - BrightBackground, - ErrorForeground, - NormalBackground, - HoverableForeground, - HoverableBrightForeground, - SuccessBackground, - Segmented, - PanelBordered, - PanelForeground, + #[default] + Default, + BrightForeground, + BrightBackground, + ErrorForeground, + NormalBackground, + HoverableForeground, + HoverableBrightForeground, + SuccessBackground, + Segmented, + PanelBordered, + PanelForeground, } impl container::StyleSheet for Theme { - type Style = ContainerStyle; + type Style = ContainerStyle; - fn appearance(&self, style: &Self::Style) -> container::Appearance { - match style { - ContainerStyle::Default => container::Appearance::default(), - ContainerStyle::BrightBackground => container::Appearance { - background: Some(Background::Color(self.palette.base.background)), - text_color: Some(self.palette.bright.surface), - ..container::Appearance::default() - }, - ContainerStyle::BrightForeground => container::Appearance { - background: Some(Background::Color(self.palette.base.foreground)), - text_color: Some(self.palette.bright.surface), - ..container::Appearance::default() - }, - ContainerStyle::ErrorForeground => container::Appearance { - background: Some(Background::Color(self.palette.base.foreground)), - text_color: Some(self.palette.normal.surface), - ..container::Appearance::default() - }, - ContainerStyle::NormalBackground => container::Appearance { - background: Some(Background::Color(self.palette.base.background)), - text_color: Some(self.palette.normal.surface), - ..container::Appearance::default() - }, - ContainerStyle::Segmented => container::Appearance { - border_radius: 2.0.into(), - border_width: 1.0, - border_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - ..container::Appearance::default() - }, - ContainerStyle::HoverableForeground => container::Appearance { - background: None, - text_color: Some(self.palette.normal.surface), - ..container::Appearance::default() - }, - ContainerStyle::HoverableBrightForeground => container::Appearance { - background: None, - text_color: Some(self.palette.bright.primary), - ..container::Appearance::default() - }, - ContainerStyle::SuccessBackground => container::Appearance { - background: Some(Background::Color(self.palette.base.foreground)), - text_color: Some(self.palette.normal.surface), - ..container::Appearance::default() - }, - ContainerStyle::PanelForeground => container::Appearance { - background: Some(Background::Color(self.palette.base.foreground)), - text_color: Some(self.palette.bright.primary), - border_radius: 2.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - }, - ContainerStyle::PanelBordered => container::Appearance { - background: Some(Background::Color(Color::TRANSPARENT)), - text_color: Some(self.palette.bright.primary), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - }, - } - } + fn appearance(&self, style: &Self::Style) -> container::Appearance { + match style { + ContainerStyle::Default => container::Appearance::default(), + ContainerStyle::BrightBackground => container::Appearance { + background: Some(Background::Color(self.palette.base.background)), + text_color: Some(self.palette.bright.surface), + ..container::Appearance::default() + }, + ContainerStyle::BrightForeground => container::Appearance { + background: Some(Background::Color(self.palette.base.foreground)), + text_color: Some(self.palette.bright.surface), + ..container::Appearance::default() + }, + ContainerStyle::ErrorForeground => container::Appearance { + background: Some(Background::Color(self.palette.base.foreground)), + text_color: Some(self.palette.normal.surface), + ..container::Appearance::default() + }, + ContainerStyle::NormalBackground => container::Appearance { + background: Some(Background::Color(self.palette.base.background)), + text_color: Some(self.palette.normal.surface), + ..container::Appearance::default() + }, + ContainerStyle::Segmented => container::Appearance { + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + ..container::Appearance::default() + }, + ContainerStyle::HoverableForeground => container::Appearance { + background: None, + text_color: Some(self.palette.normal.surface), + ..container::Appearance::default() + }, + ContainerStyle::HoverableBrightForeground => container::Appearance { + background: None, + text_color: Some(self.palette.bright.primary), + ..container::Appearance::default() + }, + ContainerStyle::SuccessBackground => container::Appearance { + background: Some(Background::Color(self.palette.base.foreground)), + text_color: Some(self.palette.normal.surface), + ..container::Appearance::default() + }, + ContainerStyle::PanelForeground => container::Appearance { + background: Some(Background::Color(self.palette.base.foreground)), + text_color: Some(self.palette.bright.primary), + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + shadow: Shadow { + offset: Vector::new(0.0, 1.0), + blur_radius: 1.0, + color: Color::TRANSPARENT, + }, + }, + ContainerStyle::PanelBordered => container::Appearance { + background: Some(Background::Color(Color::TRANSPARENT)), + text_color: Some(self.palette.bright.primary), + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + shadow: Shadow { + offset: Vector::new(0.0, 1.0), + blur_radius: 1.0, + color: Color::TRANSPARENT, + }, + }, + } + } } diff --git a/crates/core/src/theme/header.rs b/crates/core/src/theme/header.rs deleted file mode 100644 index 03ece76..0000000 --- a/crates/core/src/theme/header.rs +++ /dev/null @@ -1,36 +0,0 @@ -use super::Theme; -use grin_gui_widgets::style::header::{Appearance, StyleSheet}; -use iced::{Color, Background}; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum HeaderStyle { - #[default] - Default, -} - -impl StyleSheet for Theme { - type Style = HeaderStyle; - - fn appearance(&self, style: &Self::Style) -> Appearance { - match style { - HeaderStyle::Default => Appearance { - //text_color: Some(self.palette.bright.surface), - text_color: None, - background: Some(Background::Color(self.palette.base.foreground)), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - offset_right: 0.0, - offset_left: 0.0, - }, - } - } - - fn hovered(&self, style: &Self::Style) -> Appearance { - let appearance = self.appearance(style); - Appearance { - background: None, - ..appearance - } - } -} diff --git a/crates/core/src/theme/mod.rs b/crates/core/src/theme/mod.rs index 9340434..bfc4956 100644 --- a/crates/core/src/theme/mod.rs +++ b/crates/core/src/theme/mod.rs @@ -8,7 +8,7 @@ use iced_renderer::Renderer as IRenderer; #[cfg(feature = "opengl")] use iced_glow::Renderer as IRenderer; -// TODO +// TODO // finish carryover from original stylesheet here: https://github.com/ajour/ajour/blob/master/src/gui/style.rs pub mod application; pub mod button; @@ -16,13 +16,11 @@ pub mod card; pub mod checkbox; pub mod container; pub mod modal; -pub mod header; pub mod picklist; pub mod radio; pub mod scrollable; pub mod text; pub mod text_input; -pub mod table_row; pub use button::ButtonStyle; pub use card::CardStyle; @@ -33,23 +31,20 @@ pub use picklist::PickListStyle; pub use radio::RadioStyle; pub use scrollable::ScrollableStyle; pub use text_input::TextInputStyle; -pub use table_row::TableRowStyle; -pub use header::HeaderStyle; pub async fn load_user_themes() -> Vec { - log::debug!("loading user themes"); + log::debug!("loading user themes"); - fs::load_user_themes().await + fs::load_user_themes().await } #[derive(Debug, Clone, Default, Deserialize, Serialize)] pub struct Theme { - - pub name: String, - pub palette: ColorPalette, + pub name: String, + pub palette: ColorPalette, } -pub type Renderer = IRenderer; +pub type Renderer = IRenderer; pub type Element<'a, Message> = iced::Element<'a, Message, Renderer>; pub type Container<'a, Message> = iced::widget::Container<'a, Message, Renderer>; pub type Column<'a, Message> = iced::widget::Column<'a, Message, Renderer>; @@ -58,575 +53,574 @@ pub type Text<'a> = iced::widget::Text<'a, Renderer>; pub type TextInput<'a, Message> = iced::widget::TextInput<'a, Message, Renderer>; pub type Button<'a, Message> = iced::widget::Button<'a, Message, Renderer>; pub type Scrollable<'a, Message> = iced::widget::Scrollable<'a, Message, Renderer>; -pub type PickList<'a, T, Message> = iced::widget::PickList<'a, T, Message, Renderer>; +pub type PickList<'a, T, Message> = iced::widget::PickList<'a, T, Message, Theme, Renderer>; pub type Radio = iced::widget::Radio; -pub type Card<'a, Message> = iced_aw::native::Card<'a, Message, Renderer>; +pub type Card<'a, Message> = iced_aw::native::Card<'a, Message, Theme, Renderer>; pub type Modal<'a, Content, Message> = iced_aw::modal::Modal<'a, Content, Message>; -pub type Header<'a, Message> = grin_gui_widgets::widget::header::Header<'a, Message, Renderer>; -pub type TableRow<'a, Message> = grin_gui_widgets::widget::table_row::TableRow<'a, Message, Renderer>; - +pub type Header<'a, Message> = crate::widget::header::Header<'a, Message, Theme, Renderer>; +pub type TableRow<'a, Message> = crate::widget::table_row::TableRow<'a, Message, Theme, Renderer>; #[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)] pub struct BaseColors { - #[serde(with = "serde_color")] - pub background: iced::Color, - #[serde(with = "serde_color")] - pub foreground: iced::Color, + #[serde(with = "serde_color")] + pub background: iced::Color, + #[serde(with = "serde_color")] + pub foreground: iced::Color, } #[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)] pub struct NormalColors { - #[serde(with = "serde_color")] - pub primary: iced::Color, - #[serde(with = "serde_color")] - pub secondary: iced::Color, - #[serde(with = "serde_color")] - pub surface: iced::Color, - #[serde(with = "serde_color")] - pub error: iced::Color, + #[serde(with = "serde_color")] + pub primary: iced::Color, + #[serde(with = "serde_color")] + pub secondary: iced::Color, + #[serde(with = "serde_color")] + pub surface: iced::Color, + #[serde(with = "serde_color")] + pub error: iced::Color, } #[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)] pub struct BrightColors { - #[serde(with = "serde_color")] - pub primary: iced::Color, - #[serde(with = "serde_color")] - pub secondary: iced::Color, - #[serde(with = "serde_color")] - pub surface: iced::Color, - #[serde(with = "serde_color")] - pub error: iced::Color, + #[serde(with = "serde_color")] + pub primary: iced::Color, + #[serde(with = "serde_color")] + pub secondary: iced::Color, + #[serde(with = "serde_color")] + pub surface: iced::Color, + #[serde(with = "serde_color")] + pub error: iced::Color, } #[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)] pub struct ColorPalette { - pub base: BaseColors, - pub normal: NormalColors, - pub bright: BrightColors, + pub base: BaseColors, + pub normal: NormalColors, + pub bright: BrightColors, } impl Theme { - pub fn all() -> Vec<(String, Theme)> { - vec![ - ("Alliance".to_string(), Theme::alliance()), - ("Ayu".to_string(), Theme::ayu()), - ("Dark".to_string(), Theme::dark()), - ("Dracula".to_string(), Theme::dracula()), - ("Ferra".to_string(), Theme::ferra()), - ("Forest Night".to_string(), Theme::forest_night()), - ("Gruvbox".to_string(), Theme::gruvbox()), - ("Horde".to_string(), Theme::horde()), - ("Light".to_string(), Theme::light()), - ("Nord".to_string(), Theme::nord()), - ("One Dark".to_string(), Theme::one_dark()), - ("Outrun".to_string(), Theme::outrun()), - ("Solarized Dark".to_string(), Theme::solarized_dark()), - ("Solarized Light".to_string(), Theme::solarized_light()), - ("Sort".to_string(), Theme::sort()), - ] - } - - pub fn dark() -> Theme { - Theme { - name: "Dark".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#111111").unwrap(), - foreground: hex_to_color("#1C1C1C").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#3f2b56").unwrap(), - secondary: hex_to_color("#4a3c1c").unwrap(), - surface: hex_to_color("#828282").unwrap(), - error: hex_to_color("#992B2B").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#BA84FC").unwrap(), - secondary: hex_to_color("#ffd03c").unwrap(), - surface: hex_to_color("#E0E0E0").unwrap(), - error: hex_to_color("#C13047").unwrap(), - }, - }, - } - } - - pub fn light() -> Theme { - Theme { - name: "Light".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#ffffff").unwrap(), - foreground: hex_to_color("#F5F5F5").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#DFDBFF").unwrap(), - secondary: hex_to_color("#F9D659").unwrap(), - surface: hex_to_color("#828282").unwrap(), - error: hex_to_color("#992B2B").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#9580ff").unwrap(), - secondary: hex_to_color("#EAA326").unwrap(), - surface: hex_to_color("#000000").unwrap(), - error: hex_to_color("#C13047").unwrap(), - }, - }, - } - } - - pub fn alliance() -> Theme { - Theme { - name: "Alliance".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#011930").unwrap(), - foreground: hex_to_color("#022242").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#3e3523").unwrap(), - secondary: hex_to_color("#3e3523").unwrap(), - surface: hex_to_color("#7F8387").unwrap(), - error: hex_to_color("#5b3a5e").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#ac8a1b").unwrap(), - secondary: hex_to_color("#ac8a1b").unwrap(), - surface: hex_to_color("#B4B9BF").unwrap(), - error: hex_to_color("#953e43").unwrap(), - }, - }, - } - } - - pub fn horde() -> Theme { - Theme { - name: "Horde".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#161313").unwrap(), - foreground: hex_to_color("#211C1C").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#331E1F").unwrap(), - secondary: hex_to_color("#542A18").unwrap(), - surface: hex_to_color("#5E5B5A").unwrap(), - error: hex_to_color("#44282a").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#953e43").unwrap(), - secondary: hex_to_color("#e27342").unwrap(), - surface: hex_to_color("#9B9897").unwrap(), - error: hex_to_color("#953e43").unwrap(), - }, - }, - } - } - - pub fn ayu() -> Theme { - Theme { - name: "Ayu".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#1f2430").unwrap(), - foreground: hex_to_color("#232834").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#987a47").unwrap(), - secondary: hex_to_color("#315e6b").unwrap(), - surface: hex_to_color("#60697a").unwrap(), - error: hex_to_color("#712a34").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#ffcc66").unwrap(), - secondary: hex_to_color("#5ccfe6").unwrap(), - surface: hex_to_color("#cbccc6").unwrap(), - error: hex_to_color("#ff3333").unwrap(), - }, - }, - } - } - - pub fn dracula() -> Theme { - Theme { - name: "Dracula".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#282a36").unwrap(), - foreground: hex_to_color("#353746").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#483e61").unwrap(), - secondary: hex_to_color("#386e50").unwrap(), - surface: hex_to_color("#a2a4a3").unwrap(), - error: hex_to_color("#A13034").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#bd94f9").unwrap(), - secondary: hex_to_color("#49eb7a").unwrap(), - surface: hex_to_color("#f4f8f3").unwrap(), - error: hex_to_color("#ff7ac6").unwrap(), - }, - }, - } - } - - pub fn forest_night() -> Theme { - Theme { - name: "Forest Night".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#323d43").unwrap(), - foreground: hex_to_color("#3c474d").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#505a60").unwrap(), - secondary: hex_to_color("#465258").unwrap(), - surface: hex_to_color("#999f93").unwrap(), - error: hex_to_color("#74484c").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#a7c080").unwrap(), - secondary: hex_to_color("#83b6af").unwrap(), - surface: hex_to_color("#d8caac").unwrap(), - error: hex_to_color("#e68183").unwrap(), - }, - }, - } - } - - pub fn gruvbox() -> Theme { - Theme { - name: "Gruvbox".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#282828").unwrap(), - foreground: hex_to_color("#3c3836").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#63612f").unwrap(), - secondary: hex_to_color("#695133").unwrap(), - surface: hex_to_color("#928374").unwrap(), - error: hex_to_color("#81302e").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#98971a").unwrap(), - secondary: hex_to_color("#d79921").unwrap(), - surface: hex_to_color("#ebdbb2").unwrap(), - error: hex_to_color("#cc241d").unwrap(), - }, - }, - } - } - - pub fn nord() -> Theme { - Theme { - name: "Nord".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#2e3440").unwrap(), - foreground: hex_to_color("#3b4252").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#485b60").unwrap(), - secondary: hex_to_color("#425066").unwrap(), - surface: hex_to_color("#9196a1").unwrap(), - error: hex_to_color("#894f5a").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#8fbcbb").unwrap(), - secondary: hex_to_color("#5e81ac").unwrap(), - surface: hex_to_color("#eceff4").unwrap(), - error: hex_to_color("#bf616a").unwrap(), - }, - }, - } - } - - pub fn outrun() -> Theme { - Theme { - name: "Outrun".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#0d0821").unwrap(), - foreground: hex_to_color("#110A2B").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#330442").unwrap(), - secondary: hex_to_color("#6e3e2e").unwrap(), - surface: hex_to_color("#484e81").unwrap(), - error: hex_to_color("#671a30").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#ff00ff").unwrap(), - secondary: hex_to_color("#ff963a").unwrap(), - surface: hex_to_color("#757dc8").unwrap(), - error: hex_to_color("#db2c3e").unwrap(), - }, - }, - } - } - - pub fn solarized_dark() -> Theme { - Theme { - name: "Solarized Dark".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#012b36").unwrap(), - foreground: hex_to_color("#093642").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#1A615B").unwrap(), - secondary: hex_to_color("#523F09").unwrap(), - surface: hex_to_color("#63797e").unwrap(), - error: hex_to_color("#b80f15").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#2aa096").unwrap(), - secondary: hex_to_color("#a37f12").unwrap(), - surface: hex_to_color("#93a1a1").unwrap(), - error: hex_to_color("#EE2F36").unwrap(), - }, - }, - } - } - - pub fn solarized_light() -> Theme { - Theme { - name: "Solarized Light".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#fdf6e3").unwrap(), - foreground: hex_to_color("#eee8d5").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#BCCCC3").unwrap(), - secondary: hex_to_color("#ccbd9e").unwrap(), - surface: hex_to_color("#95a3a2").unwrap(), - error: hex_to_color("#b80f15").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#2aa096").unwrap(), - secondary: hex_to_color("#a37f12").unwrap(), - surface: hex_to_color("#4C5D63").unwrap(), - error: hex_to_color("#EE2F36").unwrap(), - }, - }, - } - } - - pub fn sort() -> Theme { - Theme { - name: "Sort".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#000000").unwrap(), - foreground: hex_to_color("#101010").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#525252").unwrap(), - secondary: hex_to_color("#525252").unwrap(), - surface: hex_to_color("#525252").unwrap(), - error: hex_to_color("#525252").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#A3A3A3").unwrap(), - secondary: hex_to_color("#A3A3A3").unwrap(), - surface: hex_to_color("#A3A3A3").unwrap(), - error: hex_to_color("#A3A3A3").unwrap(), - }, - }, - } - } - - pub fn ferra() -> Theme { - Theme { - name: "Ferra".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#211f22").unwrap(), - foreground: hex_to_color("#2b292d").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#664A50").unwrap(), - secondary: hex_to_color("#855859").unwrap(), - surface: hex_to_color("#816961").unwrap(), - error: hex_to_color("#713f47").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#b4838d").unwrap(), - secondary: hex_to_color("#e5989b").unwrap(), - surface: hex_to_color("#fecdb2").unwrap(), - error: hex_to_color("#e06b75").unwrap(), - }, - }, - } - } - - pub fn one_dark() -> Theme { - Theme { - name: "One Dark".to_string(), - palette: ColorPalette { - base: BaseColors { - background: hex_to_color("#282c34").unwrap(), - foreground: hex_to_color("#2c323c").unwrap(), - }, - normal: NormalColors { - primary: hex_to_color("#385c7c").unwrap(), - secondary: hex_to_color("#654473").unwrap(), - surface: hex_to_color("#5b626e").unwrap(), - error: hex_to_color("#713f47").unwrap(), - }, - bright: BrightColors { - primary: hex_to_color("#61afef").unwrap(), - secondary: hex_to_color("#c679dd").unwrap(), - surface: hex_to_color("#a6adba").unwrap(), - error: hex_to_color("#e06b75").unwrap(), - }, - }, - } - } + pub fn all() -> Vec<(String, Theme)> { + vec![ + ("Alliance".to_string(), Theme::alliance()), + ("Ayu".to_string(), Theme::ayu()), + ("Dark".to_string(), Theme::dark()), + ("Dracula".to_string(), Theme::dracula()), + ("Ferra".to_string(), Theme::ferra()), + ("Forest Night".to_string(), Theme::forest_night()), + ("Gruvbox".to_string(), Theme::gruvbox()), + ("Horde".to_string(), Theme::horde()), + ("Light".to_string(), Theme::light()), + ("Nord".to_string(), Theme::nord()), + ("One Dark".to_string(), Theme::one_dark()), + ("Outrun".to_string(), Theme::outrun()), + ("Solarized Dark".to_string(), Theme::solarized_dark()), + ("Solarized Light".to_string(), Theme::solarized_light()), + ("Sort".to_string(), Theme::sort()), + ] + } + + pub fn dark() -> Theme { + Theme { + name: "Dark".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#111111").unwrap(), + foreground: hex_to_color("#1C1C1C").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#3f2b56").unwrap(), + secondary: hex_to_color("#4a3c1c").unwrap(), + surface: hex_to_color("#828282").unwrap(), + error: hex_to_color("#992B2B").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#BA84FC").unwrap(), + secondary: hex_to_color("#ffd03c").unwrap(), + surface: hex_to_color("#E0E0E0").unwrap(), + error: hex_to_color("#C13047").unwrap(), + }, + }, + } + } + + pub fn light() -> Theme { + Theme { + name: "Light".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#ffffff").unwrap(), + foreground: hex_to_color("#F5F5F5").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#DFDBFF").unwrap(), + secondary: hex_to_color("#F9D659").unwrap(), + surface: hex_to_color("#828282").unwrap(), + error: hex_to_color("#992B2B").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#9580ff").unwrap(), + secondary: hex_to_color("#EAA326").unwrap(), + surface: hex_to_color("#000000").unwrap(), + error: hex_to_color("#C13047").unwrap(), + }, + }, + } + } + + pub fn alliance() -> Theme { + Theme { + name: "Alliance".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#011930").unwrap(), + foreground: hex_to_color("#022242").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#3e3523").unwrap(), + secondary: hex_to_color("#3e3523").unwrap(), + surface: hex_to_color("#7F8387").unwrap(), + error: hex_to_color("#5b3a5e").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#ac8a1b").unwrap(), + secondary: hex_to_color("#ac8a1b").unwrap(), + surface: hex_to_color("#B4B9BF").unwrap(), + error: hex_to_color("#953e43").unwrap(), + }, + }, + } + } + + pub fn horde() -> Theme { + Theme { + name: "Horde".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#161313").unwrap(), + foreground: hex_to_color("#211C1C").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#331E1F").unwrap(), + secondary: hex_to_color("#542A18").unwrap(), + surface: hex_to_color("#5E5B5A").unwrap(), + error: hex_to_color("#44282a").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#953e43").unwrap(), + secondary: hex_to_color("#e27342").unwrap(), + surface: hex_to_color("#9B9897").unwrap(), + error: hex_to_color("#953e43").unwrap(), + }, + }, + } + } + + pub fn ayu() -> Theme { + Theme { + name: "Ayu".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#1f2430").unwrap(), + foreground: hex_to_color("#232834").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#987a47").unwrap(), + secondary: hex_to_color("#315e6b").unwrap(), + surface: hex_to_color("#60697a").unwrap(), + error: hex_to_color("#712a34").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#ffcc66").unwrap(), + secondary: hex_to_color("#5ccfe6").unwrap(), + surface: hex_to_color("#cbccc6").unwrap(), + error: hex_to_color("#ff3333").unwrap(), + }, + }, + } + } + + pub fn dracula() -> Theme { + Theme { + name: "Dracula".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#282a36").unwrap(), + foreground: hex_to_color("#353746").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#483e61").unwrap(), + secondary: hex_to_color("#386e50").unwrap(), + surface: hex_to_color("#a2a4a3").unwrap(), + error: hex_to_color("#A13034").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#bd94f9").unwrap(), + secondary: hex_to_color("#49eb7a").unwrap(), + surface: hex_to_color("#f4f8f3").unwrap(), + error: hex_to_color("#ff7ac6").unwrap(), + }, + }, + } + } + + pub fn forest_night() -> Theme { + Theme { + name: "Forest Night".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#323d43").unwrap(), + foreground: hex_to_color("#3c474d").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#505a60").unwrap(), + secondary: hex_to_color("#465258").unwrap(), + surface: hex_to_color("#999f93").unwrap(), + error: hex_to_color("#74484c").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#a7c080").unwrap(), + secondary: hex_to_color("#83b6af").unwrap(), + surface: hex_to_color("#d8caac").unwrap(), + error: hex_to_color("#e68183").unwrap(), + }, + }, + } + } + + pub fn gruvbox() -> Theme { + Theme { + name: "Gruvbox".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#282828").unwrap(), + foreground: hex_to_color("#3c3836").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#63612f").unwrap(), + secondary: hex_to_color("#695133").unwrap(), + surface: hex_to_color("#928374").unwrap(), + error: hex_to_color("#81302e").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#98971a").unwrap(), + secondary: hex_to_color("#d79921").unwrap(), + surface: hex_to_color("#ebdbb2").unwrap(), + error: hex_to_color("#cc241d").unwrap(), + }, + }, + } + } + + pub fn nord() -> Theme { + Theme { + name: "Nord".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#2e3440").unwrap(), + foreground: hex_to_color("#3b4252").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#485b60").unwrap(), + secondary: hex_to_color("#425066").unwrap(), + surface: hex_to_color("#9196a1").unwrap(), + error: hex_to_color("#894f5a").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#8fbcbb").unwrap(), + secondary: hex_to_color("#5e81ac").unwrap(), + surface: hex_to_color("#eceff4").unwrap(), + error: hex_to_color("#bf616a").unwrap(), + }, + }, + } + } + + pub fn outrun() -> Theme { + Theme { + name: "Outrun".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#0d0821").unwrap(), + foreground: hex_to_color("#110A2B").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#330442").unwrap(), + secondary: hex_to_color("#6e3e2e").unwrap(), + surface: hex_to_color("#484e81").unwrap(), + error: hex_to_color("#671a30").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#ff00ff").unwrap(), + secondary: hex_to_color("#ff963a").unwrap(), + surface: hex_to_color("#757dc8").unwrap(), + error: hex_to_color("#db2c3e").unwrap(), + }, + }, + } + } + + pub fn solarized_dark() -> Theme { + Theme { + name: "Solarized Dark".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#012b36").unwrap(), + foreground: hex_to_color("#093642").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#1A615B").unwrap(), + secondary: hex_to_color("#523F09").unwrap(), + surface: hex_to_color("#63797e").unwrap(), + error: hex_to_color("#b80f15").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#2aa096").unwrap(), + secondary: hex_to_color("#a37f12").unwrap(), + surface: hex_to_color("#93a1a1").unwrap(), + error: hex_to_color("#EE2F36").unwrap(), + }, + }, + } + } + + pub fn solarized_light() -> Theme { + Theme { + name: "Solarized Light".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#fdf6e3").unwrap(), + foreground: hex_to_color("#eee8d5").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#BCCCC3").unwrap(), + secondary: hex_to_color("#ccbd9e").unwrap(), + surface: hex_to_color("#95a3a2").unwrap(), + error: hex_to_color("#b80f15").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#2aa096").unwrap(), + secondary: hex_to_color("#a37f12").unwrap(), + surface: hex_to_color("#4C5D63").unwrap(), + error: hex_to_color("#EE2F36").unwrap(), + }, + }, + } + } + + pub fn sort() -> Theme { + Theme { + name: "Sort".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#000000").unwrap(), + foreground: hex_to_color("#101010").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#525252").unwrap(), + secondary: hex_to_color("#525252").unwrap(), + surface: hex_to_color("#525252").unwrap(), + error: hex_to_color("#525252").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#A3A3A3").unwrap(), + secondary: hex_to_color("#A3A3A3").unwrap(), + surface: hex_to_color("#A3A3A3").unwrap(), + error: hex_to_color("#A3A3A3").unwrap(), + }, + }, + } + } + + pub fn ferra() -> Theme { + Theme { + name: "Ferra".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#211f22").unwrap(), + foreground: hex_to_color("#2b292d").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#664A50").unwrap(), + secondary: hex_to_color("#855859").unwrap(), + surface: hex_to_color("#816961").unwrap(), + error: hex_to_color("#713f47").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#b4838d").unwrap(), + secondary: hex_to_color("#e5989b").unwrap(), + surface: hex_to_color("#fecdb2").unwrap(), + error: hex_to_color("#e06b75").unwrap(), + }, + }, + } + } + + pub fn one_dark() -> Theme { + Theme { + name: "One Dark".to_string(), + palette: ColorPalette { + base: BaseColors { + background: hex_to_color("#282c34").unwrap(), + foreground: hex_to_color("#2c323c").unwrap(), + }, + normal: NormalColors { + primary: hex_to_color("#385c7c").unwrap(), + secondary: hex_to_color("#654473").unwrap(), + surface: hex_to_color("#5b626e").unwrap(), + error: hex_to_color("#713f47").unwrap(), + }, + bright: BrightColors { + primary: hex_to_color("#61afef").unwrap(), + secondary: hex_to_color("#c679dd").unwrap(), + surface: hex_to_color("#a6adba").unwrap(), + error: hex_to_color("#e06b75").unwrap(), + }, + }, + } + } } fn hex_to_color(hex: &str) -> Option { - if hex.len() == 7 { - let hash = &hex[0..1]; - let r = u8::from_str_radix(&hex[1..3], 16); - let g = u8::from_str_radix(&hex[3..5], 16); - let b = u8::from_str_radix(&hex[5..7], 16); - - return match (hash, r, g, b) { - ("#", Ok(r), Ok(g), Ok(b)) => Some(iced::Color { - r: r as f32 / 255.0, - g: g as f32 / 255.0, - b: b as f32 / 255.0, - a: 1.0, - }), - _ => None, - }; - } - - None + if hex.len() == 7 { + let hash = &hex[0..1]; + let r = u8::from_str_radix(&hex[1..3], 16); + let g = u8::from_str_radix(&hex[3..5], 16); + let b = u8::from_str_radix(&hex[5..7], 16); + + return match (hash, r, g, b) { + ("#", Ok(r), Ok(g), Ok(b)) => Some(iced::Color { + r: r as f32 / 255.0, + g: g as f32 / 255.0, + b: b as f32 / 255.0, + a: 1.0, + }), + _ => None, + }; + } + + None } fn color_to_hex(color: &iced::Color) -> String { - let mut color_str = String::from("#"); + let mut color_str = String::from("#"); - let iced::Color { r, g, b, .. } = color; - color_str.push_str(&format!("{:02X}", (r * 255.0) as u8)); - color_str.push_str(&format!("{:02X}", (g * 255.0) as u8)); - color_str.push_str(&format!("{:02X}", (b * 255.0) as u8)); + let iced::Color { r, g, b, .. } = color; + color_str.push_str(&format!("{:02X}", (r * 255.0) as u8)); + color_str.push_str(&format!("{:02X}", (g * 255.0) as u8)); + color_str.push_str(&format!("{:02X}", (b * 255.0) as u8)); - color_str + color_str } impl PartialEq for Theme { - fn eq(&self, other: &Self) -> bool { - self.name == other.name - } + fn eq(&self, other: &Self) -> bool { + self.name == other.name + } } impl PartialOrd for Theme { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.name.cmp(&other.name)) - } + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.name.cmp(&other.name)) + } } impl Eq for Theme {} impl Ord for Theme { - fn cmp(&self, other: &Self) -> Ordering { - self.name.cmp(&other.name) - } + fn cmp(&self, other: &Self) -> Ordering { + self.name.cmp(&other.name) + } } // Newtype on iced::Color so we can impl Deserialzer for it struct Color(iced::Color); mod serde_color { - use super::{color_to_hex, hex_to_color, Color}; - use serde::de::{self, Error, Unexpected, Visitor}; - use serde::ser; - use std::fmt; - - pub(crate) fn deserialize<'de, D>(deserializer: D) -> Result - where - D: de::Deserializer<'de>, - { - struct ColorVisitor; - - impl<'de> Visitor<'de> for ColorVisitor { - type Value = Color; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("a hex string in the format of '#09ACDF'") - } - - #[allow(clippy::unnecessary_unwrap)] - fn visit_str(self, s: &str) -> Result - where - E: Error, - { - if let Some(color) = hex_to_color(s) { - return Ok(Color(color)); - } - - Err(de::Error::invalid_value(Unexpected::Str(s), &self)) - } - } - - deserializer.deserialize_any(ColorVisitor).map(|c| c.0) - } - - pub(crate) fn serialize(color: &iced::Color, serializer: S) -> Result - where - S: ser::Serializer, - { - serializer.serialize_str(&color_to_hex(color)) - } + use super::{color_to_hex, hex_to_color, Color}; + use serde::de::{self, Error, Unexpected, Visitor}; + use serde::ser; + use std::fmt; + + pub(crate) fn deserialize<'de, D>(deserializer: D) -> Result + where + D: de::Deserializer<'de>, + { + struct ColorVisitor; + + impl<'de> Visitor<'de> for ColorVisitor { + type Value = Color; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("a hex string in the format of '#09ACDF'") + } + + #[allow(clippy::unnecessary_unwrap)] + fn visit_str(self, s: &str) -> Result + where + E: Error, + { + if let Some(color) = hex_to_color(s) { + return Ok(Color(color)); + } + + Err(de::Error::invalid_value(Unexpected::Str(s), &self)) + } + } + + deserializer.deserialize_any(ColorVisitor).map(|c| c.0) + } + + pub(crate) fn serialize(color: &iced::Color, serializer: S) -> Result + where + S: ser::Serializer, + { + serializer.serialize_str(&color_to_hex(color)) + } } #[cfg(test)] mod tests { - use super::{serde_color::deserialize, Theme}; - use serde::de::value::{Error, StrDeserializer}; - use serde::de::IntoDeserializer; - - #[test] - fn test_hex_color_deser() { - let colors = [ - "AABBCC", "AABBCG", "#AABBCG", "#AABB091", "#AABBCC", "#AABB09", - ]; - - for (idx, color_str) in colors.iter().enumerate() { - let deserializer: StrDeserializer = color_str.into_deserializer(); - - let color = deserialize(deserializer); - - if idx < 4 { - assert!(color.is_err()); - } else { - assert!(color.is_ok()); - } - } - } - - #[test] - fn test_hex_color_ser() { - let color = super::NormalColors { - primary: iced::Color::from_rgb(1.0, 1.0, 1.0), - secondary: iced::Color::from_rgb(0.5, 0.6, 0.75789), - surface: iced::Color::from_rgb(0.1, 0.2, 0.3), - error: iced::Color::from_rgb(0.0, 0.0, 0.0), - }; - - let ser = serde_yaml::to_string(&color).unwrap(); - - dbg!(&ser); - } - - #[test] - fn test_theme_yml_deser() { - let theme_str = "--- + use super::{serde_color::deserialize, Theme}; + use serde::de::value::{Error, StrDeserializer}; + use serde::de::IntoDeserializer; + + #[test] + fn test_hex_color_deser() { + let colors = [ + "AABBCC", "AABBCG", "#AABBCG", "#AABB091", "#AABBCC", "#AABB09", + ]; + + for (idx, color_str) in colors.iter().enumerate() { + let deserializer: StrDeserializer = color_str.into_deserializer(); + + let color = deserialize(deserializer); + + if idx < 4 { + assert!(color.is_err()); + } else { + assert!(color.is_ok()); + } + } + } + + #[test] + fn test_hex_color_ser() { + let color = super::NormalColors { + primary: iced::Color::from_rgb(1.0, 1.0, 1.0), + secondary: iced::Color::from_rgb(0.5, 0.6, 0.75789), + surface: iced::Color::from_rgb(0.1, 0.2, 0.3), + error: iced::Color::from_rgb(0.0, 0.0, 0.0), + }; + + let ser = serde_yaml::to_string(&color).unwrap(); + + dbg!(&ser); + } + + #[test] + fn test_theme_yml_deser() { + let theme_str = "--- name: Test palette: base: @@ -644,6 +638,6 @@ mod tests { error: '#484793' "; - serde_yaml::from_str::(theme_str).unwrap(); - } + serde_yaml::from_str::(theme_str).unwrap(); + } } diff --git a/crates/core/src/theme/modal.rs b/crates/core/src/theme/modal.rs index 863fe47..da36042 100644 --- a/crates/core/src/theme/modal.rs +++ b/crates/core/src/theme/modal.rs @@ -4,23 +4,23 @@ use iced_aw::style::modal::Appearance; #[derive(Clone, Copy, Debug, Default)] pub enum ModalStyle { - #[default] - Default, - Normal, + #[default] + Default, + Normal, } impl iced_aw::modal::StyleSheet for Theme { - type Style = ModalStyle; + type Style = ModalStyle; - fn active(&self, style: Self::Style) -> Appearance { - match style { - ModalStyle::Normal => Appearance { - background: Background::Color(Color { - a: 0.9, - ..self.palette.base.foreground - }), - }, - _ => Appearance::default() - } - } + fn active(&self, style: &Self::Style) -> Appearance { + match style { + ModalStyle::Normal => Appearance { + background: Background::Color(Color { + a: 0.9, + ..self.palette.base.foreground + }), + }, + _ => Appearance::default(), + } + } } diff --git a/crates/core/src/theme/picklist.rs b/crates/core/src/theme/picklist.rs index 4e78e75..b2d2aac 100644 --- a/crates/core/src/theme/picklist.rs +++ b/crates/core/src/theme/picklist.rs @@ -1,78 +1,76 @@ - - -use iced_style::{pick_list, menu}; -use iced::{Background, Color}; use super::Theme; +use iced::{Background, Color}; +use iced_core::{Border, Shadow}; +use iced_style::{menu, pick_list}; #[derive(Debug, Clone, Copy, Default)] pub enum PickListStyle { - #[default] - Default, - Primary, + #[default] + Default, + Primary, } impl pick_list::StyleSheet for Theme { - type Style = PickListStyle; + type Style = PickListStyle; - fn active(&self, style: &Self::Style) -> pick_list::Appearance { - match style { - PickListStyle::Primary => pick_list::Appearance { - text_color: self.palette.bright.surface, - background: self.palette.base.background.into(), - border_width: 1.0, - border_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - border_radius: 2.0.into(), - handle_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - placeholder_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - }, - _ => todo!("default") - } - } + fn active(&self, style: &Self::Style) -> pick_list::Appearance { + match style { + PickListStyle::Primary => pick_list::Appearance { + text_color: self.palette.bright.surface, + background: self.palette.base.background.into(), + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + handle_color: Color { + a: 0.5, + ..self.palette.normal.primary + }, + placeholder_color: Color { + a: 0.5, + ..self.palette.normal.primary + }, + }, + _ => todo!("default"), + } + } - fn hovered(&self, style: &Self::Style) -> pick_list::Appearance { - match style { - PickListStyle::Primary => { - let active = self.active(style); + fn hovered(&self, style: &Self::Style) -> pick_list::Appearance { + match style { + PickListStyle::Primary => { + let active = self.active(style); - pick_list::Appearance { - text_color: self.palette.bright.primary, - ..active - } - }, - _ => todo!("default") - } - } + pick_list::Appearance { + text_color: self.palette.bright.primary, + ..active + } + } + _ => todo!("default"), + } + } } - impl menu::StyleSheet for Theme { - type Style = PickListStyle; - - fn appearance(&self, style: &Self::Style) -> menu::Appearance { - match style { - PickListStyle::Primary => menu::Appearance { - text_color: self.palette.bright.surface, - background: Background::Color(self.palette.base.foreground), - border_width: 1.0, - border_radius: 2.0.into(), - border_color: self.palette.base.background, - selected_background: Background::Color(Color { - a: 0.15, - ..self.palette.normal.primary - }), - selected_text_color: self.palette.bright.primary, - }, - _ => todo!("default") + type Style = PickListStyle; - } - } -} \ No newline at end of file + fn appearance(&self, style: &Self::Style) -> menu::Appearance { + match style { + PickListStyle::Primary => menu::Appearance { + text_color: self.palette.bright.surface, + background: Background::Color(self.palette.base.foreground), + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + selected_background: Background::Color(Color { + a: 0.15, + ..self.palette.normal.primary + }), + selected_text_color: self.palette.bright.primary, + }, + _ => todo!("default"), + } + } +} diff --git a/crates/core/src/theme/scrollable.rs b/crates/core/src/theme/scrollable.rs index d613a51..3fd545e 100644 --- a/crates/core/src/theme/scrollable.rs +++ b/crates/core/src/theme/scrollable.rs @@ -1,61 +1,47 @@ +use super::Theme; use iced::widget::scrollable; use iced::{Background, Color}; -use super::Theme; +use iced_style::scrollable::Appearance; #[derive(Debug, Clone, Copy, Default)] pub enum ScrollableStyle { - #[default] - Default, - Primary, + #[default] + Default, + Primary, } impl scrollable::StyleSheet for Theme { - type Style = ScrollableStyle; - - fn active(&self, style: &Self::Style) -> scrollable::Scrollbar { - match style { - ScrollableStyle::Default => scrollable::Scrollbar { - background: Some(Background::Color(Color::TRANSPARENT)), - border_radius: 0.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - scroller: scrollable::Scroller { - color: Color::TRANSPARENT, - border_radius: 2.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - }, - }, - - ScrollableStyle::Primary => scrollable::Scrollbar { - background: Some(Background::Color(self.palette.base.background)), - border_radius: 0.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - scroller: scrollable::Scroller { - color: self.palette.base.foreground, - border_radius: 2.0.into(), - border_width: 0.0, - border_color: Color::TRANSPARENT, - }, - }, - } - } - - fn hovered(&self, style: &Self::Style, _is_mouse_over_scrollbar: bool) -> scrollable::Scrollbar { - let active = self.active(style); - scrollable::Scrollbar { - scroller: scrollable::Scroller { ..active.scroller }, - ..active - } - } - - fn dragging(&self, style: &Self::Style) -> scrollable::Scrollbar { - let hovered = self.hovered(style, true); - scrollable::Scrollbar { - scroller: scrollable::Scroller { ..hovered.scroller }, - ..hovered - } - } -} + type Style = ScrollableStyle; + + fn active(&self, style: &Self::Style) -> Appearance { + let mut appearance = self.active(style); + + match style { + ScrollableStyle::Default => { + appearance.background = Some(Background::Color(Color::TRANSPARENT)); + appearance.border_radius = 0.0.into(); + appearance.border_width = 0.0.into(); + appearance.border_color = Color::TRANSPARENT; + } + ScrollableStyle::Primary => { + appearance.background = Some(Background::Color(self.palette.base.background)); + appearance.border_radius = 0.0.into(); + appearance.border_width = 0.0.into(); + appearance.border_color = Color::TRANSPARENT; + } + } + + appearance + } + + fn hovered(&self, style: &Self::Style, _is_mouse_over_scrollbar: bool) -> Appearance { + let active = self.active(style); + active + } + + fn dragging(&self, style: &Self::Style) -> Appearance { + let hovered = self.hovered(style, true); + hovered + } +} diff --git a/crates/core/src/theme/table_row.rs b/crates/core/src/theme/table_row.rs deleted file mode 100644 index 8d53c08..0000000 --- a/crates/core/src/theme/table_row.rs +++ /dev/null @@ -1,112 +0,0 @@ -use grin_gui_widgets::style::table_row::{StyleSheet, Appearance}; -use iced::{Background, Color}; -use super::Theme; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum TableRowStyle { - #[default] - Default, - TableRowAlternate, - TableRowHighlife, - TableRowLowlife, - TableRowSelected, -} - -impl StyleSheet for Theme { - type Style = TableRowStyle; - - fn appearance(&self, style: &Self::Style) -> Appearance { - match style { - TableRowStyle::Default => Appearance { - text_color: Some(self.palette.normal.primary), - background: Some(Background::Color(self.palette.base.foreground)), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - // offset_left: 10.0, - // offset_right: 25.0, - offset_left: 0.0, - offset_right: 0.0, - }, - TableRowStyle::TableRowAlternate => Appearance { - background: Some(Background::Color(Color { - a: 0.50, - ..self.palette.base.foreground - })), - ..Appearance::default() - }, - TableRowStyle::TableRowHighlife => Appearance { - text_color: Some(self.palette.normal.primary), - background: Some(Background::Color(Color { - a: 0.30, - ..self.palette.base.foreground - })), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - offset_left: 0.0, - offset_right: 0.0, - }, - TableRowStyle::TableRowLowlife => Appearance { - text_color: Some(self.palette.normal.primary), - background: Some(Background::Color(Color::TRANSPARENT)), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - offset_left: 0.0, - offset_right: 0.0, - }, - TableRowStyle::TableRowSelected => Appearance { - text_color: Some(self.palette.normal.primary), - background: Some(Background::Color(self.palette.normal.primary)), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - offset_left: 0.0, - offset_right: 0.0, - }, - } - } - - fn hovered(&self, style: &Self::Style) -> Appearance { - let appearance = self.appearance(style); - - match style { - TableRowStyle::Default => Appearance { - background: Some(Background::Color(Color { - a: 0.60, - ..self.palette.normal.primary - })), - ..appearance - }, - TableRowStyle::TableRowAlternate => Appearance { - background: Some(Background::Color(Color { - a: 0.25, - ..self.palette.normal.primary - })), - ..appearance - }, - TableRowStyle::TableRowHighlife => Appearance { - background: Some(Background::Color(Color { - a: 0.60, - ..self.palette.normal.primary - })), - ..appearance - }, - TableRowStyle::TableRowLowlife => Appearance { - background: Some(Background::Color(Color { - a: 0.60, - ..self.palette.normal.primary - })), - ..appearance - }, - TableRowStyle::TableRowSelected => Appearance { - background: Some(Background::Color(Color { - a: 0.60, - ..self.palette.normal.primary - })), - ..appearance - }, - } - } -} \ No newline at end of file diff --git a/crates/core/src/theme/text_input.rs b/crates/core/src/theme/text_input.rs index 499a062..ad80ecb 100644 --- a/crates/core/src/theme/text_input.rs +++ b/crates/core/src/theme/text_input.rs @@ -1,101 +1,101 @@ use super::Theme; use iced::widget::text_input; use iced::{Background, Color}; +use iced_core::Border; #[derive(Debug, Clone, Copy, Default)] pub enum TextInputStyle { - #[default] - Default, - AddonsQuery, + #[default] + Default, + AddonsQuery, } impl text_input::StyleSheet for Theme { - type Style = TextInputStyle; + type Style = TextInputStyle; - /// Produces the style of an active text input. - fn active(&self, style: &Self::Style) -> text_input::Appearance { - match style { - TextInputStyle::AddonsQuery => text_input::Appearance { - background: Background::Color(self.palette.base.foreground), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: self.palette.base.foreground, - icon_color: self.palette.base.foreground, - }, - _ => todo!("default"), - } - } + /// Produces the style of an active text input. + fn active(&self, style: &Self::Style) -> text_input::Appearance { + match style { + TextInputStyle::AddonsQuery => text_input::Appearance { + background: Background::Color(self.palette.base.foreground), + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + icon_color: self.palette.base.foreground, + }, + _ => todo!("default"), + } + } - /// Produces the style of a focused text input. - fn focused(&self, style: &Self::Style) -> text_input::Appearance { - match style { - TextInputStyle::AddonsQuery => text_input::Appearance { - background: Background::Color(self.palette.base.foreground), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - icon_color: Color { - a: 1.0, - ..self.palette.normal.primary - } - }, - _ => todo!("default"), - } - } + /// Produces the style of a focused text input. + fn focused(&self, style: &Self::Style) -> text_input::Appearance { + match style { + TextInputStyle::AddonsQuery => text_input::Appearance { + background: Background::Color(self.palette.base.foreground), + border: Border { + color: self.palette.bright.primary, + width: 1.0, + radius: 2.0.into(), + }, + icon_color: Color { + a: 1.0, + ..self.palette.normal.primary + }, + }, + _ => todo!("default"), + } + } - fn disabled(&self, style: &Self::Style) -> text_input::Appearance { - match style { - TextInputStyle::AddonsQuery => text_input::Appearance { - background: Background::Color(self.palette.base.foreground), - border_radius: 2.0.into(), - border_width: 1.0, - border_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - icon_color: Color { - a: 1.0, - ..self.palette.normal.primary - } - }, - _ => todo!("default"), - } - } + fn disabled(&self, style: &Self::Style) -> text_input::Appearance { + match style { + TextInputStyle::AddonsQuery => text_input::Appearance { + background: Background::Color(self.palette.base.foreground), + border: Border { + color: self.palette.normal.primary, + width: 1.0, + radius: 2.0.into(), + }, + icon_color: Color { + a: 1.0, + ..self.palette.normal.primary + }, + }, + _ => todo!("default"), + } + } + fn placeholder_color(&self, style: &Self::Style) -> Color { + match style { + TextInputStyle::AddonsQuery => self.palette.normal.surface, + _ => todo!("default"), + } + } - fn placeholder_color(&self, style: &Self::Style) -> Color { - match style { - TextInputStyle::AddonsQuery => self.palette.normal.surface, - _ => todo!("default"), - } - } + fn value_color(&self, style: &Self::Style) -> Color { + match style { + TextInputStyle::AddonsQuery => self.palette.bright.primary, + _ => todo!("default"), + } + } - fn value_color(&self, style: &Self::Style) -> Color { - match style { - TextInputStyle::AddonsQuery => self.palette.bright.primary, - _ => todo!("default"), - } - } + fn selection_color(&self, style: &Self::Style) -> Color { + match style { + TextInputStyle::AddonsQuery => self.palette.bright.secondary, + _ => todo!("default"), + } + } - fn selection_color(&self, style: &Self::Style) -> Color { - match style { - TextInputStyle::AddonsQuery => self.palette.bright.secondary, - _ => todo!("default"), - } - } + fn disabled_color(&self, style: &Self::Style) -> Color { + match style { + TextInputStyle::AddonsQuery => self.palette.normal.secondary, + _ => todo!("default"), + } + } - fn disabled_color(&self, style: &Self::Style) -> Color { - match style { - TextInputStyle::AddonsQuery => self.palette.normal.secondary, - _ => todo!("default"), - } - } - - /// Produces the style of an hovered text input. - fn hovered(&self, style: &Self::Style) -> text_input::Appearance { - self.focused(style) - } + /// Produces the style of an hovered text input. + fn hovered(&self, style: &Self::Style) -> text_input::Appearance { + self.focused(style) + } } diff --git a/crates/widgets/src/widget/header.rs b/crates/core/src/widget/header.rs similarity index 95% rename from crates/widgets/src/widget/header.rs rename to crates/core/src/widget/header.rs index d87791c..30218c0 100644 --- a/crates/widgets/src/widget/header.rs +++ b/crates/core/src/widget/header.rs @@ -41,12 +41,14 @@ where { pub fn new( state: State, - headers: Vec<(String, Container<'a, Message, Renderer>)>, + headers: Vec<(String, Container<'a, Message, Theme, Renderer>)>, left_margin: Option, right_margin: Option, ) -> Self where - Theme: StyleSheet, + Theme: iced_style::container::StyleSheet, + Renderer: 'a + iced_core::Renderer, + Message: 'a, { let mut names = vec![]; let mut left = false; @@ -158,8 +160,14 @@ where } } - fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> layout::Node { + fn layout( + &self, + tree: &mut Tree, + renderer: &Renderer, + limits: &layout::Limits, + ) -> layout::Node { let limits = limits.width(self.width).height(self.height); + let mut trees = self.children(); layout::flex::resolve( layout::flex::Axis::Horizontal, @@ -171,7 +179,7 @@ where self.spacing as f32, Alignment::Start, &self.children, - self.children.iter.map(Tree::new), + &mut trees, ) } @@ -371,7 +379,7 @@ where Theme: StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, Message: 'a, { - fn from(header: Header<'a, Message, Renderer>) -> Element<'a, Message, Theme, Renderer> { + fn from(header: Header<'a, Message, Theme, Renderer>) -> Element<'a, Message, Theme, Renderer> { Element::new(header) } } diff --git a/crates/core/src/widget/header/state.rs b/crates/core/src/widget/header/state.rs new file mode 100644 index 0000000..4fdc052 --- /dev/null +++ b/crates/core/src/widget/header/state.rs @@ -0,0 +1,11 @@ +use iced_core::Point; + +#[derive(Clone, Debug, Default)] +pub struct State { + pub resize_hovering: bool, + pub resizing: bool, + pub starting_cursor_pos: Option, + pub starting_left_width: f32, + pub starting_right_width: f32, + pub resizing_idx: usize, +} diff --git a/crates/widgets/src/widget/mod.rs b/crates/core/src/widget/mod.rs similarity index 100% rename from crates/widgets/src/widget/mod.rs rename to crates/core/src/widget/mod.rs diff --git a/crates/widgets/src/widget/table_row.rs b/crates/core/src/widget/table_row.rs similarity index 100% rename from crates/widgets/src/widget/table_row.rs rename to crates/core/src/widget/table_row.rs diff --git a/crates/widgets/Cargo.toml b/crates/widgets/Cargo.toml deleted file mode 100644 index cee0b48..0000000 --- a/crates/widgets/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "grin-gui-widgets" -description = "Widget library for Grin Core GUI" -version = "0.1.0-alpha.6" -authors = ["Yeastplume", "Casper Rogild Storm", "tarkah "] -license = "GPL-3.0" -homepage = "https://github.com/mimblewimble/grin-gui" -repository = "https://github.com/mimblewimble/grin-gui" -edition = "2018" - -[features] -default = ["wgpu"] -wgpu = ["iced_wgpu"] -#opengl = ["iced_glow"] - -[dependencies] -iced = { version = "0.12", features = ["advanced", "lazy", "tokio"] } -iced_graphics = { version = "0.12" } -iced_core = { version = "0.12" } -iced_wgpu = { version = "0.12", optional = true } -iced_style = "0.12" diff --git a/crates/widgets/src/lib.rs b/crates/widgets/src/lib.rs deleted file mode 100644 index bf16527..0000000 --- a/crates/widgets/src/lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![allow(dead_code)] -#![allow(unused_variables)] - -pub mod style; -pub mod widget; - -pub use widget::header; -pub use widget::table_row; - diff --git a/crates/widgets/src/style/header.rs b/crates/widgets/src/style/header.rs deleted file mode 100644 index d37b3a9..0000000 --- a/crates/widgets/src/style/header.rs +++ /dev/null @@ -1,25 +0,0 @@ -use iced_core::{Background, Color}; - -/// The appearance of a header. -#[derive(Debug, Clone, Copy)] -pub struct Appearance { - pub text_color: Option, - pub background: Option, - pub border_radius: f32, - pub border_width: f32, - pub border_color: Color, - pub offset_left: f32, - pub offset_right: f32, -} - -/// A set of rules that dictate the style of a header. -pub trait StyleSheet { - type Style: std::default::Default + Copy; - - /// Produces the style of a header. - fn appearance(&self, style: &Self::Style) -> Appearance; - - /// Produces the a hovered appearance for header. - fn hovered(&self, style: &Self::Style) -> Appearance; - -} \ No newline at end of file diff --git a/crates/widgets/src/style/table_row.rs b/crates/widgets/src/style/table_row.rs deleted file mode 100644 index 466395b..0000000 --- a/crates/widgets/src/style/table_row.rs +++ /dev/null @@ -1,24 +0,0 @@ -use iced::{Background, Color}; - -/// The appearance of a table row. -#[derive(Debug, Clone, Copy, Default)] -pub struct Appearance { - pub text_color: Option, - pub background: Option, - pub border_radius: f32, - pub border_width: f32, - pub border_color: Color, - pub offset_left: f32, - pub offset_right: f32, -} - -/// A set of rules that dictate the style of a table row. -pub trait StyleSheet { - type Style: std::default::Default + Copy; - - /// Produces the default appearance of a table row. - fn appearance(&self, style: &Self::Style) -> Appearance; - - /// Produces the hovered appearance table row. - fn hovered(&self, style: &Self::Style) -> Appearance; -} diff --git a/crates/widgets/src/widget/header/state.rs b/crates/widgets/src/widget/header/state.rs deleted file mode 100644 index c3ea9a3..0000000 --- a/crates/widgets/src/widget/header/state.rs +++ /dev/null @@ -1,11 +0,0 @@ -use iced_core::Point; - -#[derive(Clone, Debug, Default)] -pub struct State { - pub resize_hovering: bool, - pub resizing: bool, - pub starting_cursor_pos: Option, - pub starting_left_width: f32, - pub starting_right_width: f32, - pub resizing_idx: usize, -} From 08788aad951f36e701310663410b43dfd455288b Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Tue, 19 Mar 2024 11:39:12 +0000 Subject: [PATCH 03/12] core crate compilation --- crates/core/src/backup.rs | 177 +++++---- crates/core/src/config/mod.rs | 479 ++++++++++++------------ crates/core/src/config/wallet.rs | 56 +-- crates/core/src/fs/backup.rs | 206 +++++------ crates/core/src/fs/mod.rs | 60 ++-- crates/core/src/fs/save.rs | 80 ++--- crates/core/src/fs/theme.rs | 96 ++--- crates/core/src/logger.rs | 520 +++++++++++++-------------- crates/core/src/network.rs | 137 ++++--- crates/core/src/node/mod.rs | 494 ++++++++++++------------- crates/core/src/node/subscriber.rs | 107 +++--- crates/core/src/theme/application.rs | 18 +- crates/core/src/theme/picklist.rs | 2 +- crates/core/src/theme/radio.rs | 107 +++--- crates/core/src/theme/scrollable.rs | 32 +- crates/core/src/theme/text.rs | 27 +- crates/core/src/utility.rs | 402 ++++++++++----------- crates/core/src/widget/header.rs | 4 +- crates/core/src/widget/table_row.rs | 64 ++-- 19 files changed, 1535 insertions(+), 1533 deletions(-) diff --git a/crates/core/src/backup.rs b/crates/core/src/backup.rs index 9b15ee9..1e92d09 100644 --- a/crates/core/src/backup.rs +++ b/crates/core/src/backup.rs @@ -12,141 +12,140 @@ use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Hash, PartialOrd, Ord, Deserialize)] pub enum CompressionFormat { - Zip, - Zstd, + Zip, + Zstd, } impl CompressionFormat { - pub const ALL: [CompressionFormat; 2] = [CompressionFormat::Zip, CompressionFormat::Zstd]; - - pub(crate) const fn file_ext(&self) -> &'static str { - match self { - CompressionFormat::Zip => "zip", - CompressionFormat::Zstd => "tar.zst", - } - } + pub const ALL: [CompressionFormat; 2] = [CompressionFormat::Zip, CompressionFormat::Zstd]; + + pub(crate) const fn file_ext(&self) -> &'static str { + match self { + CompressionFormat::Zip => "zip", + CompressionFormat::Zstd => "tar.zst", + } + } } impl Default for CompressionFormat { - fn default() -> CompressionFormat { - CompressionFormat::Zip - } + fn default() -> CompressionFormat { + CompressionFormat::Zip + } } impl Display for CompressionFormat { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - CompressionFormat::Zip => f.write_str("Zip"), - CompressionFormat::Zstd => f.write_str("Zstd"), - } - } + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + CompressionFormat::Zip => f.write_str("Zip"), + CompressionFormat::Zstd => f.write_str("Zstd"), + } + } } impl FromStr for CompressionFormat { - type Err = &'static str; - - fn from_str(s: &str) -> Result { - match s { - "zip" | "Zip" => Ok(CompressionFormat::Zip), - "zstd" | "Zstd" => Ok(CompressionFormat::Zstd), - _ => Err("valid values are: zip, zstd"), - } - } + type Err = &'static str; + + fn from_str(s: &str) -> Result { + match s { + "zip" | "Zip" => Ok(CompressionFormat::Zip), + "zstd" | "Zstd" => Ok(CompressionFormat::Zstd), + _ => Err("valid values are: zip, zstd"), + } + } } - /// Creates a .zip archive from the list of source folders and /// saves it to the dest folder. pub async fn backup_folders( - src_folders: Vec, - mut dest: PathBuf, - compression: CompressionFormat, - zstd_level: i32, + src_folders: Vec, + mut dest: PathBuf, + compression: CompressionFormat, + zstd_level: i32, ) -> Result { - let now = Local::now(); + let now = Local::now(); - dest.push(format!( - "grin_gui_backup_{}.{}", - now.format("%Y-%m-%d_%H-%M-%S"), - compression.file_ext(), - )); + dest.push(format!( + "grin_gui_backup_{}.{}", + now.format("%Y-%m-%d_%H-%M-%S"), + compression.file_ext(), + )); - match compression { - CompressionFormat::Zip => ZipBackup::new(src_folders, &dest).backup()?, - CompressionFormat::Zstd => ZstdBackup::new(src_folders, &dest, zstd_level).backup()?, - } + match compression { + CompressionFormat::Zip => ZipBackup::new(src_folders, &dest).backup()?, + CompressionFormat::Zstd => ZstdBackup::new(src_folders, &dest, zstd_level).backup()?, + } - // Won't fail since we pass it the correct format - let as_of = Archive::try_from(dest).unwrap().as_of; + // Won't fail since we pass it the correct format + let as_of = Archive::try_from(dest).unwrap().as_of; - Ok(as_of) + Ok(as_of) } /// Finds the latest archive in the supplied backup folder and returns /// the datetime it was saved pub async fn latest_backup(backup_dir: PathBuf) -> Option { - let zip_pattern = format!("{}/grin_gui_backup_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9].zip", backup_dir.display()); - let zstd_pattern = format!("{}/grin_gui_backup_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9].tar.zst", backup_dir.display()); - - let mut backups = vec![]; - - for path in glob::glob(&zip_pattern) - .unwrap() - .chain(glob::glob(&zstd_pattern).unwrap()) - .flatten() - { - if let Ok(archive) = Archive::try_from(path) { - backups.push(archive.as_of); - } - } - - // Apparently NaiveDateTime sorts in Desc order by default, no need to reverse - backups.sort(); - backups.pop() + let zip_pattern = format!("{}/grin_gui_backup_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9].zip", backup_dir.display()); + let zstd_pattern = format!("{}/grin_gui_backup_[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]_[0-9][0-9]-[0-9][0-9]-[0-9][0-9].tar.zst", backup_dir.display()); + + let mut backups = vec![]; + + for path in glob::glob(&zip_pattern) + .unwrap() + .chain(glob::glob(&zstd_pattern).unwrap()) + .flatten() + { + if let Ok(archive) = Archive::try_from(path) { + backups.push(archive.as_of); + } + } + + // Apparently NaiveDateTime sorts in Desc order by default, no need to reverse + backups.sort(); + backups.pop() } /// Specifies a folder that we want backed up. `prefix` will get stripped out of /// the path of each entry in the archive. pub struct BackupFolder { - pub path: PathBuf, - pub prefix: PathBuf, + pub path: PathBuf, + pub prefix: PathBuf, } impl BackupFolder { - pub fn new(path: impl AsRef, prefix: impl AsRef) -> BackupFolder { - BackupFolder { - path: path.as_ref().to_owned(), - prefix: prefix.as_ref().to_owned(), - } - } + pub fn new(path: impl AsRef, prefix: impl AsRef) -> BackupFolder { + BackupFolder { + path: path.as_ref().to_owned(), + prefix: prefix.as_ref().to_owned(), + } + } } /// Metadata for our archive saved on the filesystem. Converted from a `PathBuf` with /// the correct naming convention struct Archive { - pub as_of: NaiveDateTime, + pub as_of: NaiveDateTime, } impl TryFrom for Archive { - type Error = chrono::ParseError; + type Error = chrono::ParseError; - fn try_from(path: PathBuf) -> Result { - let mut file_stem = path.file_stem().unwrap().to_str().unwrap(); + fn try_from(path: PathBuf) -> Result { + let mut file_stem = path.file_stem().unwrap().to_str().unwrap(); - // in the case of "file.tar.zst" path.file_stem() will return "file.tar", we still need to - // drop the extension - if let Some(i) = file_stem.find('.') { - file_stem = file_stem.split_at(i).0; - } + // in the case of "file.tar.zst" path.file_stem() will return "file.tar", we still need to + // drop the extension + if let Some(i) = file_stem.find('.') { + file_stem = file_stem.split_at(i).0; + } - let date_str = format!( - "{} {}", - file_stem.split('_').nth(2).unwrap_or_default(), - file_stem.split('_').nth(3).unwrap_or_default() - ); + let date_str = format!( + "{} {}", + file_stem.split('_').nth(2).unwrap_or_default(), + file_stem.split('_').nth(3).unwrap_or_default() + ); - let as_of = NaiveDateTime::parse_from_str(&date_str, "%Y-%m-%d %H-%M-%S")?; + let as_of = NaiveDateTime::parse_from_str(&date_str, "%Y-%m-%d %H-%M-%S")?; - Ok(Archive { as_of }) - } + Ok(Archive { as_of }) + } } diff --git a/crates/core/src/config/mod.rs b/crates/core/src/config/mod.rs index e794b83..965fabf 100644 --- a/crates/core/src/config/mod.rs +++ b/crates/core/src/config/mod.rs @@ -1,7 +1,6 @@ use crate::backup::CompressionFormat; use crate::error::FilesystemError; use serde::{Deserialize, Serialize}; -use std::f32::consts::E; use std::fmt::{self, Display, Formatter}; use std::path::PathBuf; @@ -14,344 +13,342 @@ pub use crate::config::wallet::Wallet; /// Config struct. #[derive(Deserialize, Serialize, Debug, PartialEq, Default, Clone)] pub struct Config { - /// Configured wallet definitions - #[serde(default)] - pub wallets: Vec, + /// Configured wallet definitions + #[serde(default)] + pub wallets: Vec, - /// Current wallet - pub current_wallet_index: Option, - - /// MWMixnet Keys - pub mixnet_keys: Option>, + /// Current wallet + pub current_wallet_index: Option, - /// Current theme of GUI - pub theme: Option, + /// MWMixnet Keys + pub mixnet_keys: Option>, - /// User preferred currency - pub currency: Currency, + /// Current theme of GUI + pub theme: Option, - #[serde(default)] - pub tx_column_config: ColumnConfig, + /// User preferred currency + pub currency: Currency, - pub window_size: Option<(u32, u32)>, + #[serde(default)] + pub tx_column_config: ColumnConfig, - pub scale: Option, + pub window_size: Option<(u32, u32)>, - pub backup_directory: Option, + pub scale: Option, - #[serde(default)] - pub self_update_channel: SelfUpdateChannel, + pub backup_directory: Option, - #[serde(default = "default_true")] - pub alternating_row_colors: bool, + #[serde(default)] + pub self_update_channel: SelfUpdateChannel, - #[serde(default = "default_true")] - pub is_keybindings_enabled: bool, + #[serde(default = "default_true")] + pub alternating_row_colors: bool, - #[serde(default)] - pub language: Language, + #[serde(default = "default_true")] + pub is_keybindings_enabled: bool, - #[serde(default)] - pub auto_update: bool, + #[serde(default)] + pub language: Language, - #[serde(default)] - pub compression_format: CompressionFormat, + #[serde(default)] + pub auto_update: bool, - #[serde(default)] - pub zstd_compression_level: i32, + #[serde(default)] + pub compression_format: CompressionFormat, - #[serde(default)] - #[cfg(target_os = "windows")] - pub close_to_tray: bool, + #[serde(default)] + pub zstd_compression_level: i32, - #[serde(default)] - #[cfg(target_os = "windows")] - pub autostart: bool, + #[serde(default)] + #[cfg(target_os = "windows")] + pub close_to_tray: bool, - #[serde(default)] - #[cfg(target_os = "windows")] - pub start_closed_to_tray: bool, + #[serde(default)] + #[cfg(target_os = "windows")] + pub autostart: bool, - #[serde(default)] - pub tx_method: TxMethod, + #[serde(default)] + #[cfg(target_os = "windows")] + pub start_closed_to_tray: bool, + + #[serde(default)] + pub tx_method: TxMethod, } impl Config { - pub fn add_wallet(&mut self, wallet: Wallet) -> usize { - self.wallets.push(wallet); - self.wallets.len() - 1 - } - - pub fn get_wallet_slatepack_dir(&self) -> Option { - if let Some(i) = self.current_wallet_index.as_ref() { - if let Some(ref tld) = self.wallets[*i].tld { - let slate_dir = format!("{}/{}", tld.as_os_str().to_str().unwrap(), "slatepack"); - let _ = std::fs::create_dir_all(slate_dir.clone()); - Some(slate_dir) - } else { - None - } - } else { - None - } - } + pub fn add_wallet(&mut self, wallet: Wallet) -> usize { + self.wallets.push(wallet); + self.wallets.len() - 1 + } + + pub fn get_wallet_slatepack_dir(&self) -> Option { + if let Some(i) = self.current_wallet_index.as_ref() { + if let Some(ref tld) = self.wallets[*i].tld { + let slate_dir = format!("{}/{}", tld.as_os_str().to_str().unwrap(), "slatepack"); + let _ = std::fs::create_dir_all(slate_dir.clone()); + Some(slate_dir) + } else { + None + } + } else { + None + } + } } impl PersistentData for Config { - fn relative_path() -> PathBuf { - PathBuf::from("grin-gui.yml") - } + fn relative_path() -> PathBuf { + PathBuf::from("grin-gui.yml") + } } #[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] pub enum ColumnConfig { - V1 { - local_version_width: u16, - remote_version_width: u16, - status_width: u16, - }, - V2 { - columns: Vec, - }, - V3 { - my_addons_columns: Vec, - catalog_columns: Vec, - #[serde(default)] - aura_columns: Vec, - }, + V1 { + local_version_width: u16, + remote_version_width: u16, + status_width: u16, + }, + V2 { + columns: Vec, + }, + V3 { + my_addons_columns: Vec, + catalog_columns: Vec, + #[serde(default)] + aura_columns: Vec, + }, } #[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] pub struct ColumnConfigV2 { - pub key: String, - pub width: Option, - pub hidden: bool, + pub key: String, + pub width: Option, + pub hidden: bool, } impl Default for ColumnConfig { - fn default() -> Self { - ColumnConfig::V1 { - local_version_width: 150, - remote_version_width: 150, - status_width: 85, - } - } + fn default() -> Self { + ColumnConfig::V1 { + local_version_width: 150, + remote_version_width: 150, + status_width: 85, + } + } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] pub enum SelfUpdateChannel { - Stable, - Beta, + Stable, + Beta, } impl SelfUpdateChannel { - pub const fn all() -> [Self; 2] { - [SelfUpdateChannel::Stable, SelfUpdateChannel::Beta] - } + pub const fn all() -> [Self; 2] { + [SelfUpdateChannel::Stable, SelfUpdateChannel::Beta] + } } impl Default for SelfUpdateChannel { - fn default() -> Self { - SelfUpdateChannel::Stable - } + fn default() -> Self { + SelfUpdateChannel::Stable + } } impl Display for SelfUpdateChannel { - fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - let s = match self { - SelfUpdateChannel::Stable => "Stable", - SelfUpdateChannel::Beta => "Beta", - }; - - write!(f, "{}", s) - } + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + let s = match self { + SelfUpdateChannel::Stable => "Stable", + SelfUpdateChannel::Beta => "Beta", + }; + + write!(f, "{}", s) + } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Hash, PartialOrd, Ord)] pub enum Language { - English, - German, + English, + German, } impl std::fmt::Display for Language { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{}", - match self { - Language::English => "English", - Language::German => "Deutsch", - } - ) - } + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + Language::English => "English", + Language::German => "Deutsch", + } + ) + } } impl Language { - // Alphabetically sorted based on their local name (@see `impl Display`). - pub const ALL: [Language; 2] = [Language::German, Language::English]; - - pub const fn language_code(self) -> &'static str { - match self { - Language::English => "en_US", - Language::German => "de_DE", - } - } + // Alphabetically sorted based on their local name (@see `impl Display`). + pub const ALL: [Language; 2] = [Language::German, Language::English]; + + pub const fn language_code(self) -> &'static str { + match self { + Language::English => "en_US", + Language::German => "de_DE", + } + } } impl Default for Language { - fn default() -> Language { - Language::English - } + fn default() -> Language { + Language::English + } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Hash, PartialOrd, Ord)] pub enum TxMethod { - Legacy, - Contracts, + Legacy, + Contracts, } impl TxMethod { - // Alphabetically sorted based on their local name (@see `impl Display`). - pub const ALL: [TxMethod; 2] = [TxMethod::Legacy, TxMethod::Contracts]; + // Alphabetically sorted based on their local name (@see `impl Display`). + pub const ALL: [TxMethod; 2] = [TxMethod::Legacy, TxMethod::Contracts]; } - impl std::fmt::Display for TxMethod { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{}", - match self { - TxMethod::Legacy => "Legacy", - TxMethod::Contracts => "Contracts", - } - ) - } + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + TxMethod::Legacy => "Legacy", + TxMethod::Contracts => "Contracts", + } + ) + } } impl Default for TxMethod { - fn default() -> TxMethod { - TxMethod::Legacy - } + fn default() -> TxMethod { + TxMethod::Legacy + } } - #[derive( - Default, Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Hash, PartialOrd, Ord, + Default, Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Hash, PartialOrd, Ord, )] pub enum Currency { - #[default] - GRIN, - BTC, - USD, + #[default] + GRIN, + BTC, + USD, } impl std::fmt::Display for Currency { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{}", - match self { - Currency::BTC => "Bitcoin", - Currency::USD => "US Dollar", - Currency::GRIN => "Grin", - } - ) - } + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + Currency::BTC => "Bitcoin", + Currency::USD => "US Dollar", + Currency::GRIN => "Grin", + } + ) + } } impl Currency { - // Alphabetically sorted based on their local name (@see `impl Display`). - pub const ALL: [Currency; 3] = [Currency::BTC, Currency::GRIN, Currency::USD]; - - pub fn shortname(&self) -> String { - match *self { - Currency::BTC => "btc".to_owned(), - Currency::GRIN => "grin".to_owned(), - Currency::USD => "usd".to_owned(), - } - } - - pub fn symbol(&self) -> String { - match *self { - Currency::BTC => "â‚¿".to_owned(), - Currency::GRIN => "".to_owned(), - Currency::USD => "$".to_owned(), - } - } - - pub fn precision(&self) -> usize { - match *self { - Currency::BTC => 8, - Currency::GRIN => 9, - Currency::USD => 4, - } - } + // Alphabetically sorted based on their local name (@see `impl Display`). + pub const ALL: [Currency; 3] = [Currency::BTC, Currency::GRIN, Currency::USD]; + + pub fn shortname(&self) -> String { + match *self { + Currency::BTC => "btc".to_owned(), + Currency::GRIN => "grin".to_owned(), + Currency::USD => "usd".to_owned(), + } + } + + pub fn symbol(&self) -> String { + match *self { + Currency::BTC => "â‚¿".to_owned(), + Currency::GRIN => "".to_owned(), + Currency::USD => "$".to_owned(), + } + } + + pub fn precision(&self) -> usize { + match *self { + Currency::BTC => 8, + Currency::GRIN => 9, + Currency::USD => 4, + } + } } /// Returns a Config. /// /// This functions handles the initialization of a Config. pub async fn load_config() -> Result { - log::debug!("loading config"); + log::debug!("loading config"); - Ok(Config::load_or_default()?) + Ok(Config::load_or_default()?) } const fn default_true() -> bool { - true + true } #[cfg(test)] mod test { - /// This method will take a relative path and make a case insentitive pattern - // For some reason the case insensitive pattern doesn't work - // unless we add an actual pattern symbol, hence the `?`. - fn get_pattern_format(relative_path: &str) -> String { - let splitted_string = relative_path.split('/'); - let mut return_string: Vec = vec![]; - for path in splitted_string { - let mut to_lower_case = path.to_lowercase(); - to_lower_case.replace_range(0..1, "?"); - return_string.push(to_lower_case); - } - return_string.join("/") - } - - #[test] - fn test_get_format_interface_addons() { - assert_eq!( - get_pattern_format("Interface/Addons"), - String::from("?nterface/?ddons") - ); - assert_eq!( - get_pattern_format("iNtErFaCe/aDdoNs"), - String::from("?nterface/?ddons") - ); - } - - #[test] - fn test_get_format_wtf() { - assert_eq!(get_pattern_format("WTF"), String::from("?tf")); - assert_eq!(get_pattern_format("wTF"), String::from("?tf")); - assert_eq!(get_pattern_format("Wtf"), String::from("?tf")); - assert_eq!(get_pattern_format("wTf"), String::from("?tf")); - } - - #[test] - fn test_get_format_screenshots() { - assert_eq!( - get_pattern_format("Screenshots"), - String::from("?creenshots") - ); - assert_eq!( - get_pattern_format("sCREENSHOTS"), - String::from("?creenshots") - ); - assert_eq!( - get_pattern_format("ScreeNShots"), - String::from("?creenshots") - ); - } + /// This method will take a relative path and make a case insentitive pattern + // For some reason the case insensitive pattern doesn't work + // unless we add an actual pattern symbol, hence the `?`. + fn get_pattern_format(relative_path: &str) -> String { + let splitted_string = relative_path.split('/'); + let mut return_string: Vec = vec![]; + for path in splitted_string { + let mut to_lower_case = path.to_lowercase(); + to_lower_case.replace_range(0..1, "?"); + return_string.push(to_lower_case); + } + return_string.join("/") + } + + #[test] + fn test_get_format_interface_addons() { + assert_eq!( + get_pattern_format("Interface/Addons"), + String::from("?nterface/?ddons") + ); + assert_eq!( + get_pattern_format("iNtErFaCe/aDdoNs"), + String::from("?nterface/?ddons") + ); + } + + #[test] + fn test_get_format_wtf() { + assert_eq!(get_pattern_format("WTF"), String::from("?tf")); + assert_eq!(get_pattern_format("wTF"), String::from("?tf")); + assert_eq!(get_pattern_format("Wtf"), String::from("?tf")); + assert_eq!(get_pattern_format("wTf"), String::from("?tf")); + } + + #[test] + fn test_get_format_screenshots() { + assert_eq!( + get_pattern_format("Screenshots"), + String::from("?creenshots") + ); + assert_eq!( + get_pattern_format("sCREENSHOTS"), + String::from("?creenshots") + ); + assert_eq!( + get_pattern_format("ScreeNShots"), + String::from("?creenshots") + ); + } } diff --git a/crates/core/src/config/wallet.rs b/crates/core/src/config/wallet.rs index 6b7bf7d..cdb2d9a 100644 --- a/crates/core/src/config/wallet.rs +++ b/crates/core/src/config/wallet.rs @@ -1,41 +1,41 @@ +use grin_core::global::ChainTypes; use serde::{Deserialize, Serialize}; use std::path::PathBuf; -use grin_core::global::ChainTypes; /// Struct for settings related to World of Warcraft. #[derive(Deserialize, Serialize, Clone, Debug, PartialEq)] #[serde(default)] pub struct Wallet { - #[serde(default)] - #[allow(deprecated)] - /// Top-level directory. Should (but not always) contain grin_wallet.toml file - pub tld: Option, - /// Display name in wallet selection - pub display_name: String, - /// If true, override the grin_wallet.toml configured node and use the internal one - pub use_embedded_node: bool, - /// Chain type of wallet - pub chain_type: ChainTypes, + #[serde(default)] + #[allow(deprecated)] + /// Top-level directory. Should (but not always) contain grin_wallet.toml file + pub tld: Option, + /// Display name in wallet selection + pub display_name: String, + /// If true, override the grin_wallet.toml configured node and use the internal one + pub use_embedded_node: bool, + /// Chain type of wallet + pub chain_type: ChainTypes, } impl Wallet { - pub fn new(tld: Option, display_name: String, chain_type: ChainTypes) -> Self { - Self { - tld, - display_name, - use_embedded_node: true, - chain_type, - } - } + pub fn new(tld: Option, display_name: String, chain_type: ChainTypes) -> Self { + Self { + tld, + display_name, + use_embedded_node: true, + chain_type, + } + } } impl Default for Wallet { - fn default() -> Self { - Wallet { - tld: None, - display_name: "Default".to_owned(), - use_embedded_node: true, - chain_type: ChainTypes::Mainnet, - } - } -} \ No newline at end of file + fn default() -> Self { + Wallet { + tld: None, + display_name: "Default".to_owned(), + use_embedded_node: true, + chain_type: ChainTypes::Mainnet, + } + } +} diff --git a/crates/core/src/fs/backup.rs b/crates/core/src/fs/backup.rs index 12de347..bbb6245 100644 --- a/crates/core/src/fs/backup.rs +++ b/crates/core/src/fs/backup.rs @@ -11,139 +11,139 @@ use zip::{write::FileOptions, CompressionMethod, ZipWriter}; /// A trait defining a way to back things up to the fs pub trait Backup { - fn backup(&self) -> Result<()>; + fn backup(&self) -> Result<()>; } /// Back up folders to a zip archive and save on the fs pub struct ZipBackup { - src: Vec, - dest: PathBuf, + src: Vec, + dest: PathBuf, } impl ZipBackup { - pub(crate) fn new(src: Vec, dest: impl AsRef) -> ZipBackup { - ZipBackup { - src, - dest: dest.as_ref().to_owned(), - } - } + pub(crate) fn new(src: Vec, dest: impl AsRef) -> ZipBackup { + ZipBackup { + src, + dest: dest.as_ref().to_owned(), + } + } } impl Backup for ZipBackup { - fn backup(&self) -> Result<()> { - let output = BufWriter::new(File::create(&self.dest)?); + fn backup(&self) -> Result<()> { + let output = BufWriter::new(File::create(&self.dest)?); - let mut zip_writer = ZipWriter::new(output); - let options = FileOptions::default() - .compression_method(CompressionMethod::Deflated) - .unix_permissions(0o755); + let mut zip_writer = ZipWriter::new(output); + let options = FileOptions::default() + .compression_method(CompressionMethod::Deflated) + .unix_permissions(0o755); - let mut buffer = vec![]; + let mut buffer = vec![]; - for folder in &self.src { - let prefix = &folder.prefix; - let path = &folder.path; + for folder in &self.src { + let prefix = &folder.prefix; + let path = &folder.path; - zip_write(path, prefix, &mut buffer, &mut zip_writer, options)?; + zip_write(path, prefix, &mut buffer, &mut zip_writer, options)?; - for entry in WalkDir::new(path) - .into_iter() - .filter_map(std::result::Result::ok) - { - let path = entry.path(); + for entry in WalkDir::new(path) + .into_iter() + .filter_map(std::result::Result::ok) + { + let path = entry.path(); - zip_write(path, prefix, &mut buffer, &mut zip_writer, options)?; - } - } + zip_write(path, prefix, &mut buffer, &mut zip_writer, options)?; + } + } - zip_writer.finish()?; + zip_writer.finish()?; - Ok(()) - } + Ok(()) + } } /// Write each path to the zip archive fn zip_write( - path: &Path, - prefix: &Path, - buffer: &mut Vec, - writer: &mut ZipWriter>, - options: FileOptions, + path: &Path, + prefix: &Path, + buffer: &mut Vec, + writer: &mut ZipWriter>, + options: FileOptions, ) -> Result<()> { - if !path.exists() { - return Err(FilesystemError::FileDoesntExist { - path: path.to_owned(), - }); - } - - // On windows, convers `\` to `/` - let normalized_path = path - .to_slash() - .ok_or(FilesystemError::NormalizingPathSlash { - path: path.to_path_buf(), - })?; - let normalized_prefix = prefix - .to_slash() - .ok_or(FilesystemError::NormalizingPathSlash { - path: prefix.to_path_buf(), - })?; - - // Strip prefix from path name and remove leading slash - let name = normalized_path - .strip_prefix(&normalized_prefix) - .ok_or(FilesystemError::StripPrefix { - prefix: normalized_prefix, - from: normalized_path.clone(), - })? - .trim_start_matches('/'); - - if path.is_dir() { - writer.add_directory(name, options)?; - } else { - writer.start_file(name, options)?; - - let mut file = File::open(path)?; - file.read_to_end(buffer)?; - - writer.write_all(buffer)?; - buffer.clear(); - } - - Ok(()) + if !path.exists() { + return Err(FilesystemError::FileDoesntExist { + path: path.to_owned(), + }); + } + + // On windows, convers `\` to `/` + let normalized_path = path + .to_slash() + .ok_or(FilesystemError::NormalizingPathSlash { + path: path.to_path_buf(), + })?; + let normalized_prefix = prefix + .to_slash() + .ok_or(FilesystemError::NormalizingPathSlash { + path: prefix.to_path_buf(), + })?; + + // Strip prefix from path name and remove leading slash + let name = normalized_path + .strip_prefix(&normalized_prefix) + .ok_or(FilesystemError::StripPrefix { + prefix: normalized_prefix, + from: normalized_path.clone(), + })? + .trim_start_matches('/'); + + if path.is_dir() { + writer.add_directory(name, options)?; + } else { + writer.start_file(name, options)?; + + let mut file = File::open(path)?; + file.read_to_end(buffer)?; + + writer.write_all(buffer)?; + buffer.clear(); + } + + Ok(()) } pub struct ZstdBackup { - src: Vec, - dest: PathBuf, - level: i32, + src: Vec, + dest: PathBuf, + level: i32, } impl ZstdBackup { - pub(crate) fn new(src: Vec, dest: impl AsRef, level: i32) -> ZstdBackup { - ZstdBackup { - src, - dest: dest.as_ref().to_owned(), - level, - } - } + pub(crate) fn new(src: Vec, dest: impl AsRef, level: i32) -> ZstdBackup { + ZstdBackup { + src, + dest: dest.as_ref().to_owned(), + level, + } + } } impl Backup for ZstdBackup { - fn backup(&self) -> Result<()> { - use zstd::stream::write::Encoder as ZstdEncoder; - - let output = File::create(&self.dest)?; - let mut enc = ZstdEncoder::new(output, self.level)?; - enc.multithread(num_cpus::get() as u32)?; - let mut tar = tar::Builder::new(enc.auto_finish()); - - for folder in &self.src { - let path = folder.path.strip_prefix(&folder.prefix).unwrap(); - let src_path = folder.prefix.join(&folder.path); - tar.append_dir_all(path, src_path)?; - } - tar.finish()?; - - Ok(()) - } + fn backup(&self) -> Result<()> { + use zstd::stream::write::Encoder as ZstdEncoder; + + let output = File::create(&self.dest)?; + let mut enc = ZstdEncoder::new(output, self.level)?; + enc.multithread(num_cpus::get() as u32)?; + let mut tar = tar::Builder::new(enc.auto_finish()); + + for folder in &self.src { + let path = folder.path.strip_prefix(&folder.prefix).unwrap(); + let src_path = folder.prefix.join(&folder.path); + tar.append_dir_all(path, src_path)?; + } + tar.finish()?; + + Ok(()) + } } diff --git a/crates/core/src/fs/mod.rs b/crates/core/src/fs/mod.rs index d016e37..6746926 100644 --- a/crates/core/src/fs/mod.rs +++ b/crates/core/src/fs/mod.rs @@ -17,41 +17,41 @@ pub use save::PersistentData; pub use theme::{import_theme, load_user_themes}; pub static CONFIG_DIR: Lazy> = Lazy::new(|| { - // Returns the location of the config directory. Will create if it doesn't - // exist. - // - // $HOME/.config/grin_gui - #[cfg(not(windows))] - { - let home = env::var("HOME").expect("user home directory not found."); - let config_dir = PathBuf::from(&home).join(".grin/gui"); - - Mutex::new(config_dir) - } - - // Returns the location of the config directory. Will create if it doesn't - // exist. - // - // %HOME%\grin_gui - #[cfg(windows)] - { - let config_dir = dirs_next::home_dir() - .map(|path| path.join(".grin")) - .map(|path| path.join("gui")) - .expect("user home directory not found."); - - Mutex::new(config_dir) - } + // Returns the location of the config directory. Will create if it doesn't + // exist. + // + // $HOME/.config/grin_gui + #[cfg(not(windows))] + { + let home = env::var("HOME").expect("user home directory not found."); + let config_dir = PathBuf::from(&home).join(".grin/gui"); + + Mutex::new(config_dir) + } + + // Returns the location of the config directory. Will create if it doesn't + // exist. + // + // %HOME%\grin_gui + #[cfg(windows)] + { + let config_dir = dirs_next::home_dir() + .map(|path| path.join(".grin")) + .map(|path| path.join("gui")) + .expect("user home directory not found."); + + Mutex::new(config_dir) + } }); pub fn config_dir() -> PathBuf { - let config_dir = CONFIG_DIR.lock().unwrap().clone(); + let config_dir = CONFIG_DIR.lock().unwrap().clone(); - if !config_dir.exists() { - let _ = fs::create_dir_all(&config_dir); - } + if !config_dir.exists() { + let _ = fs::create_dir_all(&config_dir); + } - config_dir + config_dir } type Result = std::result::Result; diff --git a/crates/core/src/fs/save.rs b/crates/core/src/fs/save.rs index 6783c22..e71d839 100644 --- a/crates/core/src/fs/save.rs +++ b/crates/core/src/fs/save.rs @@ -6,61 +6,61 @@ use std::path::PathBuf; /// Defines a serializable struct that should persist on the filesystem inside the /// Grin Gui config directory. pub trait PersistentData: DeserializeOwned + Serialize { - /// Only method required to implement PersistentData on an object. Always relative to - /// the config folder for Grin GUi - fn relative_path() -> PathBuf; + /// Only method required to implement PersistentData on an object. Always relative to + /// the config folder for Grin GUi + fn relative_path() -> PathBuf; - /// Returns the full file path. Will create any parent directories that don't - /// exist. - fn path() -> Result { - let path = config_dir().join(Self::relative_path()); + /// Returns the full file path. Will create any parent directories that don't + /// exist. + fn path() -> Result { + let path = config_dir().join(Self::relative_path()); - if let Some(dir) = path.parent() { - std::fs::create_dir_all(dir)?; - } + if let Some(dir) = path.parent() { + std::fs::create_dir_all(dir)?; + } - Ok(path) - } + Ok(path) + } - /// Load from `PersistentData::path()`. - fn load() -> Result { - let path = Self::path()?; + /// Load from `PersistentData::path()`. + fn load() -> Result { + let path = Self::path()?; - if path.exists() { - let file = fs::File::open(&path)?; + if path.exists() { + let file = fs::File::open(&path)?; - Ok(serde_yaml::from_reader(&file)?) - } else { - Err(FilesystemError::FileDoesntExist { path }) - } - } + Ok(serde_yaml::from_reader(&file)?) + } else { + Err(FilesystemError::FileDoesntExist { path }) + } + } - /// Load from `PersistentData::path()`. If file doesn't exist, save it to the filesystem as `Default` - /// and return that object. - fn load_or_default() -> Result { - let load_result = ::load(); + /// Load from `PersistentData::path()`. If file doesn't exist, save it to the filesystem as `Default` + /// and return that object. + fn load_or_default() -> Result { + let load_result = ::load(); - match load_result { - Ok(deser) => Ok(deser), - _ => Ok(get_default_and_save()?), - } - } + match load_result { + Ok(deser) => Ok(deser), + _ => Ok(get_default_and_save()?), + } + } - /// Save to `PersistentData::path()` - fn save(&self) -> Result<()> { - let contents = serde_yaml::to_string(&self)?; + /// Save to `PersistentData::path()` + fn save(&self) -> Result<()> { + let contents = serde_yaml::to_string(&self)?; - fs::write(Self::path()?, contents)?; + fs::write(Self::path()?, contents)?; - Ok(()) - } + Ok(()) + } } /// Get `Default` and save it. fn get_default_and_save() -> Result { - let data = Default::default(); + let data = Default::default(); - ::save(&data)?; + ::save(&data)?; - Ok(data) + Ok(data) } diff --git a/crates/core/src/fs/theme.rs b/crates/core/src/fs/theme.rs index 850ce03..ff749f9 100644 --- a/crates/core/src/fs/theme.rs +++ b/crates/core/src/fs/theme.rs @@ -12,71 +12,71 @@ use isahc::http::Uri; /// folder. Will only return themes that succesfully deserialize /// from yaml format to `Theme`. pub async fn load_user_themes() -> Vec { - let mut themes = vec![]; + let mut themes = vec![]; - let theme_dir = config_dir().join("themes"); + let theme_dir = config_dir().join("themes"); - if !theme_dir.exists() { - let _ = create_dir_all(&theme_dir).await; - } + if !theme_dir.exists() { + let _ = create_dir_all(&theme_dir).await; + } - if let Ok(mut dir_entries) = read_dir(theme_dir).await { - while let Some(entry) = dir_entries.next().await { - if let Ok(item) = entry { - let path = item.path(); + if let Ok(mut dir_entries) = read_dir(theme_dir).await { + while let Some(entry) = dir_entries.next().await { + if let Ok(item) = entry { + let path = item.path(); - let extension = path.extension().unwrap_or_default(); + let extension = path.extension().unwrap_or_default(); - if extension == "yaml" || extension == "yml" { - if let Ok(theme_str) = read_to_string(path).await { - if let Ok(theme) = serde_yaml::from_str(&theme_str) { - themes.push(theme); - } - } - } - } - } - } + if extension == "yaml" || extension == "yml" { + if let Ok(theme_str) = read_to_string(path).await { + if let Ok(theme) = serde_yaml::from_str(&theme_str) { + themes.push(theme); + } + } + } + } + } + } - log::debug!("loaded {} user themes", themes.len()); + log::debug!("loaded {} user themes", themes.len()); - themes + themes } pub async fn import_theme(url: String) -> Result<(String, Vec), ThemeError> { - let uri = Uri::from_str(&url)?; + let uri = Uri::from_str(&url)?; - let query = uri.query().ok_or(ThemeError::MissingQuery)?; + let query = uri.query().ok_or(ThemeError::MissingQuery)?; - let theme = serde_urlencoded::from_str::>(query)? - .into_iter() - .find(|(name, _)| name == "theme") - .map(|(_, theme_json)| serde_json::from_str::(&theme_json)) - .ok_or(ThemeError::MissingQuery)??; + let theme = serde_urlencoded::from_str::>(query)? + .into_iter() + .find(|(name, _)| name == "theme") + .map(|(_, theme_json)| serde_json::from_str::(&theme_json)) + .ok_or(ThemeError::MissingQuery)??; - let name = &theme.name; + let name = &theme.name; - let theme_dir = config_dir().join("themes"); + let theme_dir = config_dir().join("themes"); - let current_themes = load_user_themes().await; - let shipped_themes = Theme::all(); + let current_themes = load_user_themes().await; + let shipped_themes = Theme::all(); - // Check if theme name / filename collision - if current_themes.iter().any(|t| &t.name == name) - || shipped_themes.iter().any(|(t, _)| t == name) - || theme_dir.join(format!("{}.yml", name)).exists() - || theme_dir.join(format!("{}.yaml", name)).exists() - { - return Err(ThemeError::NameCollision { name: name.clone() }); - } + // Check if theme name / filename collision + if current_themes.iter().any(|t| &t.name == name) + || shipped_themes.iter().any(|(t, _)| t == name) + || theme_dir.join(format!("{}.yml", name)).exists() + || theme_dir.join(format!("{}.yaml", name)).exists() + { + return Err(ThemeError::NameCollision { name: name.clone() }); + } - fs::write( - theme_dir.join(format!("{}.yml", name)), - &serde_yaml::to_vec(&theme)?, - ) - .await?; + fs::write( + theme_dir.join(format!("{}.yml", name)), + &serde_yaml::to_vec(&theme)?, + ) + .await?; - let new_themes = load_user_themes().await; + let new_themes = load_user_themes().await; - Ok((name.clone(), new_themes)) + Ok((name.clone(), new_themes)) } diff --git a/crates/core/src/logger.rs b/crates/core/src/logger.rs index f0432c5..bb96f7d 100644 --- a/crates/core/src/logger.rs +++ b/crates/core/src/logger.rs @@ -21,9 +21,9 @@ use log::{LevelFilter, Record}; use log4rs::append::console::ConsoleAppender; use log4rs::append::file::FileAppender; use log4rs::append::rolling_file::{ - policy::compound::roll::fixed_window::FixedWindowRoller, - policy::compound::trigger::size::SizeTrigger, policy::compound::CompoundPolicy, - RollingFileAppender, + policy::compound::roll::fixed_window::FixedWindowRoller, + policy::compound::trigger::size::SizeTrigger, policy::compound::CompoundPolicy, + RollingFileAppender, }; use log4rs::append::Append; use log4rs::config::{Appender, Config, Root}; @@ -38,36 +38,36 @@ use std::sync::mpsc::SyncSender; use crate::{LogEntry, LoggingConfig}; pub enum LogArea { - Gui, - Node, - Wallet, + Gui, + Node, + Wallet, } pub struct LogAreaConfig { - area: LogArea, - config: Option, + area: LogArea, + config: Option, } lazy_static! { - /// Flag to observe whether logging was explicitly initialised (don't output otherwise) - static ref WAS_INIT: Mutex = Mutex::new(false); - /// Static logging configurations for GUI, Wallet, Node - static ref LOGGING_CONFIGS: Mutex> = Mutex::new(vec![ - LogAreaConfig{ - area: LogArea::Gui, - config: None, - }, - LogAreaConfig{ - area: LogArea::Node, - config: None, - }, - LogAreaConfig{ - area: LogArea::Wallet, - config: None, - } - ]); - /// Handle to logger to change it at runtime - static ref LOGGER_HANDLE: Mutex> = Mutex::new(None); + /// Flag to observe whether logging was explicitly initialised (don't output otherwise) + static ref WAS_INIT: Mutex = Mutex::new(false); + /// Static logging configurations for GUI, Wallet, Node + static ref LOGGING_CONFIGS: Mutex> = Mutex::new(vec![ + LogAreaConfig{ + area: LogArea::Gui, + config: None, + }, + LogAreaConfig{ + area: LogArea::Node, + config: None, + }, + LogAreaConfig{ + area: LogArea::Wallet, + config: None, + } + ]); + /// Handle to logger to change it at runtime + static ref LOGGER_HANDLE: Mutex> = Mutex::new(None); } const LOGGING_PATTERN: &str = "{d(%Y%m%d %H:%M:%S%.3f)} {h({l})} {M} - {m}{n}"; @@ -80,17 +80,17 @@ const DEFAULT_ROTATE_LOG_FILES: u32 = 32 as u32; struct GrinGuiFilter; impl Filter for GrinGuiFilter { - fn filter(&self, record: &Record<'_>) -> Response { - if let Some(module_path) = record.module_path() { - if module_path.starts_with("grin_gui") - && !module_path.starts_with("grin_gui_core::node") - && !module_path.starts_with("grin_gui_core::wallet") - { - return Response::Neutral; - } - } - Response::Reject - } + fn filter(&self, record: &Record<'_>) -> Response { + if let Some(module_path) = record.module_path() { + if module_path.starts_with("grin_gui") + && !module_path.starts_with("grin_gui_core::node") + && !module_path.starts_with("grin_gui_core::wallet") + { + return Response::Neutral; + } + } + Response::Reject + } } /// This filter is rejecting messages that doesn't start with "grin" @@ -99,18 +99,18 @@ impl Filter for GrinGuiFilter { struct GrinFilter; impl Filter for GrinFilter { - fn filter(&self, record: &Record<'_>) -> Response { - if let Some(module_path) = record.module_path() { - if (module_path.starts_with("grin") - && !module_path.starts_with("grin_gui") - && !module_path.starts_with("grin_wallet")) - || module_path.starts_with("grin_gui_core::node") - { - return Response::Neutral; - } - } - Response::Reject - } + fn filter(&self, record: &Record<'_>) -> Response { + if let Some(module_path) = record.module_path() { + if (module_path.starts_with("grin") + && !module_path.starts_with("grin_gui") + && !module_path.starts_with("grin_wallet")) + || module_path.starts_with("grin_gui_core::node") + { + return Response::Neutral; + } + } + Response::Reject + } } /// This filter is rejecting messages that doesn't start with "grin" @@ -119,237 +119,237 @@ impl Filter for GrinFilter { struct GrinWalletFilter; impl Filter for GrinWalletFilter { - fn filter(&self, record: &Record<'_>) -> Response { - if let Some(module_path) = record.module_path() { - if module_path.starts_with("grin_wallet") - || module_path.starts_with("grin_gui_core::wallet") - { - return Response::Neutral; - } - } - Response::Reject - } + fn filter(&self, record: &Record<'_>) -> Response { + if let Some(module_path) = record.module_path() { + if module_path.starts_with("grin_wallet") + || module_path.starts_with("grin_gui_core::wallet") + { + return Response::Neutral; + } + } + Response::Reject + } } #[derive(Debug)] struct ChannelAppender { - output: Mutex>, - encoder: Box, + output: Mutex>, + encoder: Box, } impl Append for ChannelAppender { - fn append(&self, record: &Record) -> Result<(), Box> { - let mut writer = SimpleWriter(Vec::new()); - self.encoder.encode(&mut writer, record)?; + fn append(&self, record: &Record) -> Result<(), Box> { + let mut writer = SimpleWriter(Vec::new()); + self.encoder.encode(&mut writer, record)?; - let log = String::from_utf8_lossy(writer.0.as_slice()).to_string(); + let log = String::from_utf8_lossy(writer.0.as_slice()).to_string(); - let _ = self.output.lock().try_send(LogEntry { - log, - level: record.level(), - }); + let _ = self.output.lock().try_send(LogEntry { + log, + level: record.level(), + }); - Ok(()) - } + Ok(()) + } - fn flush(&self) {} + fn flush(&self) {} } /// Update a logging config, and reinitialize loggers with new config pub fn update_logging_config(area: LogArea, config: LoggingConfig) { - { - let mut configs_ref = LOGGING_CONFIGS.lock(); - match area { - LogArea::Gui => configs_ref[0].config = Some(config), - LogArea::Node => configs_ref[1].config = Some(config), - LogArea::Wallet => configs_ref[2].config = Some(config), - }; - } - init_loggers(None) + { + let mut configs_ref = LOGGING_CONFIGS.lock(); + match area { + LogArea::Gui => configs_ref[0].config = Some(config), + LogArea::Node => configs_ref[1].config = Some(config), + LogArea::Wallet => configs_ref[2].config = Some(config), + }; + } + init_loggers(None) } /// Initialize the logger with the given configuration pub fn init_loggers(_logs_tx: Option>) { - let configs_ref = LOGGING_CONFIGS.lock(); - - // Determine minimum logging level for Root logger - let mut level_minimum = LevelFilter::Off; - - for la in &(*configs_ref) { - if let Some(c) = &la.config { - let level_stdout = c.stdout_log_level.to_level_filter(); - let level_file = c.file_log_level.to_level_filter(); - if level_stdout > level_minimum { - level_minimum = level_stdout; - } - if level_file > level_minimum { - level_minimum = level_file; - } - } - } - - let mut root = Root::builder(); - let mut appenders = vec![]; - let mut info_string = "".to_owned(); - - for la in &(*configs_ref) { - if let Some(c) = &la.config { - // Start logger - let stdout = ConsoleAppender::builder() - .encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN))) - .build(); - - let level_stdout = c.stdout_log_level.to_level_filter(); - let level_file = c.file_log_level.to_level_filter(); - - if c.log_to_stdout { - let mut builder = - Appender::builder().filter(Box::new(ThresholdFilter::new(level_stdout))); - let name = match la.area { - LogArea::Gui => { - builder = builder.filter(Box::new(GrinGuiFilter)); - "gui-stdout" - } - LogArea::Node => { - builder = builder.filter(Box::new(GrinFilter)); - "node-stdout" - } - LogArea::Wallet => { - builder = builder.filter(Box::new(GrinWalletFilter)); - "wallet-stdout" - } - }; - appenders.push(builder.build(name, Box::new(stdout))); - root = root.appender(name); - info_string = format!("{} {} - {},", info_string, name, level_stdout); - } - - if c.log_to_file { - // If maximum log size is specified, use rolling file appender - // or use basic one otherwise - let filter = Box::new(ThresholdFilter::new(level_file)); - let file: Box = { - if let Some(size) = c.log_max_size { - let count = c.log_max_files.unwrap_or_else(|| DEFAULT_ROTATE_LOG_FILES); - let roller = FixedWindowRoller::builder() - .build(&format!("{}.{{}}.gz", c.log_file_path), count) - .unwrap(); - let trigger = SizeTrigger::new(size); - - let policy = CompoundPolicy::new(Box::new(trigger), Box::new(roller)); - - Box::new( - RollingFileAppender::builder() - .append(c.log_file_append) - .encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN))) - .build(c.log_file_path.clone(), Box::new(policy)) - .expect("Failed to create logfile"), - ) - } else { - Box::new( - FileAppender::builder() - .append(c.log_file_append) - .encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN))) - .build(c.log_file_path.clone()) - .expect("Failed to create logfile"), - ) - } - }; - - let mut builder = Appender::builder().filter(filter); - let name = match la.area { - LogArea::Gui => { - builder = builder.filter(Box::new(GrinGuiFilter)); - "gui-file" - } - LogArea::Node => { - builder = builder.filter(Box::new(GrinFilter)); - "node-file" - } - LogArea::Wallet => { - builder = builder.filter(Box::new(GrinWalletFilter)); - "wallet-file" - } - }; - - appenders.push(builder.build(name, file)); - root = root.appender(name); - info_string = format!("{} {} - {},", info_string, name, level_file); - } - } - } - - let config = Config::builder() - .appenders(appenders) - .build(root.build(level_minimum)); - - // Init or update config via handle - match config { - Ok(c) => { - // Lock handle - let mut log_handle = LOGGER_HANDLE.lock(); - if let Some(l) = &*log_handle { - l.set_config(c); - info!( - "log4rs configuration changed - {} min level: {}", - info_string, level_minimum - ); - } else { - match log4rs::init_config(c) { - Ok(h) => { - *log_handle = Some(h); - info!( - "log4rs configuration init - {} min level: {}", - info_string, level_minimum - ); - } - Err(e) => error!("Unable to create logger: {:?}", e), - } - } - } - Err(e) => error!("Unable to create logging config: {:?}", e), - } - - send_panic_to_log(); + let configs_ref = LOGGING_CONFIGS.lock(); + + // Determine minimum logging level for Root logger + let mut level_minimum = LevelFilter::Off; + + for la in &(*configs_ref) { + if let Some(c) = &la.config { + let level_stdout = c.stdout_log_level.to_level_filter(); + let level_file = c.file_log_level.to_level_filter(); + if level_stdout > level_minimum { + level_minimum = level_stdout; + } + if level_file > level_minimum { + level_minimum = level_file; + } + } + } + + let mut root = Root::builder(); + let mut appenders = vec![]; + let mut info_string = "".to_owned(); + + for la in &(*configs_ref) { + if let Some(c) = &la.config { + // Start logger + let stdout = ConsoleAppender::builder() + .encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN))) + .build(); + + let level_stdout = c.stdout_log_level.to_level_filter(); + let level_file = c.file_log_level.to_level_filter(); + + if c.log_to_stdout { + let mut builder = + Appender::builder().filter(Box::new(ThresholdFilter::new(level_stdout))); + let name = match la.area { + LogArea::Gui => { + builder = builder.filter(Box::new(GrinGuiFilter)); + "gui-stdout" + } + LogArea::Node => { + builder = builder.filter(Box::new(GrinFilter)); + "node-stdout" + } + LogArea::Wallet => { + builder = builder.filter(Box::new(GrinWalletFilter)); + "wallet-stdout" + } + }; + appenders.push(builder.build(name, Box::new(stdout))); + root = root.appender(name); + info_string = format!("{} {} - {},", info_string, name, level_stdout); + } + + if c.log_to_file { + // If maximum log size is specified, use rolling file appender + // or use basic one otherwise + let filter = Box::new(ThresholdFilter::new(level_file)); + let file: Box = { + if let Some(size) = c.log_max_size { + let count = c.log_max_files.unwrap_or_else(|| DEFAULT_ROTATE_LOG_FILES); + let roller = FixedWindowRoller::builder() + .build(&format!("{}.{{}}.gz", c.log_file_path), count) + .unwrap(); + let trigger = SizeTrigger::new(size); + + let policy = CompoundPolicy::new(Box::new(trigger), Box::new(roller)); + + Box::new( + RollingFileAppender::builder() + .append(c.log_file_append) + .encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN))) + .build(c.log_file_path.clone(), Box::new(policy)) + .expect("Failed to create logfile"), + ) + } else { + Box::new( + FileAppender::builder() + .append(c.log_file_append) + .encoder(Box::new(PatternEncoder::new(&LOGGING_PATTERN))) + .build(c.log_file_path.clone()) + .expect("Failed to create logfile"), + ) + } + }; + + let mut builder = Appender::builder().filter(filter); + let name = match la.area { + LogArea::Gui => { + builder = builder.filter(Box::new(GrinGuiFilter)); + "gui-file" + } + LogArea::Node => { + builder = builder.filter(Box::new(GrinFilter)); + "node-file" + } + LogArea::Wallet => { + builder = builder.filter(Box::new(GrinWalletFilter)); + "wallet-file" + } + }; + + appenders.push(builder.build(name, file)); + root = root.appender(name); + info_string = format!("{} {} - {},", info_string, name, level_file); + } + } + } + + let config = Config::builder() + .appenders(appenders) + .build(root.build(level_minimum)); + + // Init or update config via handle + match config { + Ok(c) => { + // Lock handle + let mut log_handle = LOGGER_HANDLE.lock(); + if let Some(l) = &*log_handle { + l.set_config(c); + info!( + "log4rs configuration changed - {} min level: {}", + info_string, level_minimum + ); + } else { + match log4rs::init_config(c) { + Ok(h) => { + *log_handle = Some(h); + info!( + "log4rs configuration init - {} min level: {}", + info_string, level_minimum + ); + } + Err(e) => error!("Unable to create logger: {:?}", e), + } + } + } + Err(e) => error!("Unable to create logging config: {:?}", e), + } + + send_panic_to_log(); } /// hook to send panics to logs as well as stderr fn send_panic_to_log() { - panic::set_hook(Box::new(|info| { - let backtrace = Backtrace::new(); - - let thread = thread::current(); - let thread = thread.name().unwrap_or("unnamed"); - - let msg = match info.payload().downcast_ref::<&'static str>() { - Some(s) => *s, - None => match info.payload().downcast_ref::() { - Some(s) => &**s, - None => "Box", - }, - }; - - match info.location() { - Some(location) => { - error!( - "\nthread '{}' panicked at '{}': {}:{}{:?}\n\n", - thread, - msg, - location.file(), - location.line(), - backtrace - ); - } - None => error!("thread '{}' panicked at '{}'{:?}", thread, msg, backtrace), - } - //also print to stderr - let configs_ref = LOGGING_CONFIGS.lock(); - - if let Some(c) = &configs_ref[0].config { - eprintln!( - "Thread '{}' panicked with message:\n\"{}\"\nSee {} for further details.", - thread, msg, c.log_file_path - ); - } - })); + panic::set_hook(Box::new(|info| { + let backtrace = Backtrace::new(); + + let thread = thread::current(); + let thread = thread.name().unwrap_or("unnamed"); + + let msg = match info.payload().downcast_ref::<&'static str>() { + Some(s) => *s, + None => match info.payload().downcast_ref::() { + Some(s) => &**s, + None => "Box", + }, + }; + + match info.location() { + Some(location) => { + error!( + "\nthread '{}' panicked at '{}': {}:{}{:?}\n\n", + thread, + msg, + location.file(), + location.line(), + backtrace + ); + } + None => error!("thread '{}' panicked at '{}'{:?}", thread, msg, backtrace), + } + //also print to stderr + let configs_ref = LOGGING_CONFIGS.lock(); + + if let Some(c) = &configs_ref[0].config { + eprintln!( + "Thread '{}' panicked with message:\n\"{}\"\nSee {} for further details.", + thread, msg, c.log_file_path + ); + } + })); } diff --git a/crates/core/src/network.rs b/crates/core/src/network.rs index 4703866..ccfae32 100644 --- a/crates/core/src/network.rs +++ b/crates/core/src/network.rs @@ -1,8 +1,5 @@ use crate::error::DownloadError; -use async_std::{ - fs::File, - io::copy, -}; +use async_std::{fs::File, io::copy}; use isahc::config::RedirectPolicy; use isahc::http::header::CONTENT_LENGTH; use isahc::prelude::*; @@ -13,107 +10,107 @@ use std::path::Path; /// Shared `HttpClient`. static HTTP_CLIENT: Lazy = Lazy::new(|| { - HttpClient::builder() - .redirect_policy(RedirectPolicy::Follow) - .max_connections_per_host(6) - .build() - .unwrap() + HttpClient::builder() + .redirect_policy(RedirectPolicy::Follow) + .max_connections_per_host(6) + .build() + .unwrap() }); /// Grin Gui user-agent. fn user_agent() -> String { - format!("grin_gui/{}", env!("CARGO_PKG_VERSION")) + format!("grin_gui/{}", env!("CARGO_PKG_VERSION")) } /// Generic request function. pub async fn request_async( - url: T, - headers: Vec<(&str, &str)>, - timeout: Option, + url: T, + headers: Vec<(&str, &str)>, + timeout: Option, ) -> Result, DownloadError> { - // Sometimes a download url has a space. - let url = url.to_string().replace(" ", "%20"); + // Sometimes a download url has a space. + let url = url.to_string().replace(" ", "%20"); - let mut request = Request::builder().uri(url); + let mut request = Request::builder().uri(url); - for (name, value) in headers { - request = request.header(name, value); - } + for (name, value) in headers { + request = request.header(name, value); + } - request = request.header("user-agent", &user_agent()); + request = request.header("user-agent", &user_agent()); - if let Some(timeout) = timeout { - request = request.timeout(std::time::Duration::from_secs(timeout)); - } + if let Some(timeout) = timeout { + request = request.timeout(std::time::Duration::from_secs(timeout)); + } - Ok(HTTP_CLIENT.send_async(request.body(())?).await?) + Ok(HTTP_CLIENT.send_async(request.body(())?).await?) } // Generic function for posting Json data pub(crate) async fn _post_json_async( - url: T, - data: D, - headers: Vec<(&str, &str)>, - timeout: Option, + url: T, + data: D, + headers: Vec<(&str, &str)>, + timeout: Option, ) -> Result, DownloadError> { - let mut request = Request::builder() - .method("POST") - .uri(url.to_string()) - .header("content-type", "application/json"); + let mut request = Request::builder() + .method("POST") + .uri(url.to_string()) + .header("content-type", "application/json"); - for (name, value) in headers { - request = request.header(name, value); - } + for (name, value) in headers { + request = request.header(name, value); + } - request = request.header("user-agent", &user_agent()); + request = request.header("user-agent", &user_agent()); - if let Some(timeout) = timeout { - request = request.timeout(std::time::Duration::from_secs(timeout)); - } + if let Some(timeout) = timeout { + request = request.timeout(std::time::Duration::from_secs(timeout)); + } - Ok(HTTP_CLIENT - .send_async(request.body(serde_json::to_vec(&data)?)?) - .await?) + Ok(HTTP_CLIENT + .send_async(request.body(serde_json::to_vec(&data)?)?) + .await?) } /// Download a file from the internet pub(crate) async fn download_file( - url: T, - dest_file: &Path, + url: T, + dest_file: &Path, ) -> Result<(), DownloadError> { - let url = url.to_string(); + let url = url.to_string(); - log::debug!("downloading file from {}", &url); + log::debug!("downloading file from {}", &url); - let resp = request_async(&url, vec![("ACCEPT", "application/octet-stream")], None).await?; - let (parts, mut body) = resp.into_parts(); + let resp = request_async(&url, vec![("ACCEPT", "application/octet-stream")], None).await?; + let (parts, mut body) = resp.into_parts(); - // If response length doesn't equal content length, full file wasn't downloaded - // so error out - { - let content_length = parts - .headers - .get(CONTENT_LENGTH) - .map(|v| v.to_str().unwrap_or_default()) - .unwrap_or_default() - .parse::() - .unwrap_or_default(); + // If response length doesn't equal content length, full file wasn't downloaded + // so error out + { + let content_length = parts + .headers + .get(CONTENT_LENGTH) + .map(|v| v.to_str().unwrap_or_default()) + .unwrap_or_default() + .parse::() + .unwrap_or_default(); - let body_length = body.len().unwrap_or_default(); + let body_length = body.len().unwrap_or_default(); - if body_length != content_length { - return Err(DownloadError::ContentLength { - content_length, - body_length, - }); - } - } + if body_length != content_length { + return Err(DownloadError::ContentLength { + content_length, + body_length, + }); + } + } - let mut file = File::create(&dest_file).await?; + let mut file = File::create(&dest_file).await?; - copy(&mut body, &mut file).await?; + copy(&mut body, &mut file).await?; - log::debug!("file saved as {:?}", &dest_file); + log::debug!("file saved as {:?}", &dest_file); - Ok(()) + Ok(()) } diff --git a/crates/core/src/node/mod.rs b/crates/core/src/node/mod.rs index abf548e..5cef49b 100644 --- a/crates/core/src/node/mod.rs +++ b/crates/core/src/node/mod.rs @@ -26,9 +26,9 @@ pub mod subscriber; // Re-exports pub use grin_chain::types::SyncStatus; +pub use grin_core::core::{amount_from_hr_string, amount_to_hr_string}; pub use grin_keychain::Identifier; pub use grin_servers::ServerStats; -pub use grin_core::core::{amount_to_hr_string, amount_from_hr_string}; /// TODO - this differs from the default directory in 5.x, /// need to reconcile this with existing installs somehow @@ -46,280 +46,280 @@ pub const API_SECRET_FILE_NAME: &str = ".api_secret"; pub const FOREIGN_API_SECRET_FILE_NAME: &str = ".foreign_api_secret"; fn get_grin_node_default_path(chain_type: &global::ChainTypes) -> PathBuf { - // Check if grin dir exists - let mut grin_path = match dirs::home_dir() { - Some(p) => p, - None => PathBuf::new(), - }; - grin_path.push(GRIN_HOME); - grin_path.push(chain_type.shortname()); - grin_path.push(GRIN_TOP_LEVEL_DIR); - grin_path.push(GRIN_DEFAULT_DIR); - - if !grin_path.exists() { - if let Err(e) = fs::create_dir_all(grin_path.clone()) { - panic!("Unable to create default node path: {}", e); - } - } - - grin_path + // Check if grin dir exists + let mut grin_path = match dirs::home_dir() { + Some(p) => p, + None => PathBuf::new(), + }; + grin_path.push(GRIN_HOME); + grin_path.push(chain_type.shortname()); + grin_path.push(GRIN_TOP_LEVEL_DIR); + grin_path.push(GRIN_DEFAULT_DIR); + + if !grin_path.exists() { + if let Err(e) = fs::create_dir_all(grin_path.clone()) { + panic!("Unable to create default node path: {}", e); + } + } + + grin_path } // include build information pub mod built_info { - include!(concat!(env!("OUT_DIR"), "/built.rs")); + include!(concat!(env!("OUT_DIR"), "/built.rs")); } pub fn info_strings() -> (String, String) { - ( - format!( - "This is Grin version {}{}, built for {} by {}.", - built_info::PKG_VERSION, - built_info::GIT_VERSION.map_or_else(|| "".to_owned(), |v| format!(" (git {})", v)), - built_info::TARGET, - built_info::RUSTC_VERSION, - ), - format!( - "Built with profile \"{}\", features \"{}\".", - built_info::PROFILE, - built_info::FEATURES_STR, - ), - ) + ( + format!( + "This is Grin version {}{}, built for {} by {}.", + built_info::PKG_VERSION, + built_info::GIT_VERSION.map_or_else(|| "".to_owned(), |v| format!(" (git {})", v)), + built_info::TARGET, + built_info::RUSTC_VERSION, + ), + format!( + "Built with profile \"{}\", features \"{}\".", + built_info::PROFILE, + built_info::FEATURES_STR, + ), + ) } fn log_build_info() { - let (basic_info, detailed_info) = info_strings(); - info!("{}", basic_info); - debug!("{}", detailed_info); + let (basic_info, detailed_info) = info_strings(); + info!("{}", basic_info); + debug!("{}", detailed_info); } fn log_feature_flags() { - info!("Feature: NRD kernel enabled: {}", global::is_nrd_enabled()); + info!("Feature: NRD kernel enabled: {}", global::is_nrd_enabled()); } pub struct Controller<'a> { - logs_rx: mpsc::Receiver, - controller_rx: &'a mpsc::Receiver, - ui_tx: iced_mpsc::Sender, + logs_rx: mpsc::Receiver, + controller_rx: &'a mpsc::Receiver, + ui_tx: iced_mpsc::Sender, } pub enum ControllerMessage { - Shutdown, + Shutdown, } /// This needs to provide the interface in to the server, bridging between the UI and /// server instance impl<'a> Controller<'a> { - /// Create a new controller - pub fn new( - logs_rx: mpsc::Receiver, - ui_tx: iced_mpsc::Sender, - controller_rx: &'a mpsc::Receiver, - ) -> Self { - Self { - logs_rx, - controller_rx, - ui_tx, - } - } - - /// Run the controller - pub fn run(&mut self, server: Server, chain_type: global::ChainTypes) { - let stat_update_interval = 1; - let mut next_stat_update = Utc::now().timestamp() + stat_update_interval; - let delay = Duration::from_millis(50); - - warn!("Running {:?}", chain_type); - - loop { - if let Some(message) = self.controller_rx.try_iter().next() { - match message { - ControllerMessage::Shutdown => { - warn!("Shutdown {:?} in progress, please wait", chain_type); - // TODO this may hang on some errors - server.stop(); - return; - } - } - } - - if Utc::now().timestamp() > next_stat_update { - next_stat_update = Utc::now().timestamp() + stat_update_interval; - if let Ok(stats) = server.get_server_stats() { - if let Err(e) = self.ui_tx.try_send(UIMessage::UpdateStatus(stats)) { - error!("Unable to send stat message to UI: {}", e); - } - } - } - thread::sleep(delay); - } - } + /// Create a new controller + pub fn new( + logs_rx: mpsc::Receiver, + ui_tx: iced_mpsc::Sender, + controller_rx: &'a mpsc::Receiver, + ) -> Self { + Self { + logs_rx, + controller_rx, + ui_tx, + } + } + + /// Run the controller + pub fn run(&mut self, server: Server, chain_type: global::ChainTypes) { + let stat_update_interval = 1; + let mut next_stat_update = Utc::now().timestamp() + stat_update_interval; + let delay = Duration::from_millis(50); + + warn!("Running {:?}", chain_type); + + loop { + if let Some(message) = self.controller_rx.try_iter().next() { + match message { + ControllerMessage::Shutdown => { + warn!("Shutdown {:?} in progress, please wait", chain_type); + // TODO this may hang on some errors + server.stop(); + return; + } + } + } + + if Utc::now().timestamp() > next_stat_update { + next_stat_update = Utc::now().timestamp() + stat_update_interval; + if let Ok(stats) = server.get_server_stats() { + if let Err(e) = self.ui_tx.try_send(UIMessage::UpdateStatus(stats)) { + error!("Unable to send stat message to UI: {}", e); + } + } + } + thread::sleep(delay); + } + } } pub struct NodeInterface { - pub chain_type: Option, - pub config: Option, - pub ui_sender: Option>, //pub ui_rx: mpsc::Receiver, - pub node_started: bool, - controller_tx: Option>, - handle: Option>, + pub chain_type: Option, + pub config: Option, + pub ui_sender: Option>, //pub ui_rx: mpsc::Receiver, + pub node_started: bool, + controller_tx: Option>, + handle: Option>, } impl NodeInterface { - pub fn new() -> Self { - NodeInterface { - chain_type: None, - config: None, - ui_sender: None, - node_started: false, - controller_tx: None, - handle: None, - } - } - - pub fn set_ui_sender(&mut self, ui_sender: iced_mpsc::Sender) { - self.ui_sender = Some(ui_sender) - } - - /// Check that the api secret files exist and are valid - fn check_api_secret_files(&self, chain_type: &global::ChainTypes, secret_file_name: &str) { - let grin_path = get_grin_node_default_path(&chain_type); - let mut api_secret_path = grin_path; - api_secret_path.push(secret_file_name); - if !api_secret_path.exists() { - config::init_api_secret(&api_secret_path); - } else { - config::check_api_secret(&api_secret_path); - } - } - - fn load_or_create_default_config(&mut self, chain_type: global::ChainTypes) -> GlobalConfig { - self.check_api_secret_files(&chain_type, API_SECRET_FILE_NAME); - self.check_api_secret_files(&chain_type, FOREIGN_API_SECRET_FILE_NAME); - - let grin_path = get_grin_node_default_path(&chain_type); - - // Get path to default config file - let mut config_path = grin_path.clone(); - config_path.push(SERVER_CONFIG_FILE_NAME); - - // Spit it out if it doesn't exist - if !config_path.exists() { - let mut default_config = GlobalConfig::for_chain(&chain_type); - // update paths relative to current dir - default_config.update_paths(&grin_path); - if let Err(e) = default_config.write_to_file(config_path.to_str().unwrap()) { - panic!("Unable to write default node config file: {}", e); - } - } - - GlobalConfig::new(config_path.to_str().unwrap()).unwrap() - } - - pub fn shutdown_server(&mut self, join: bool) { - if let Some(handle) = self.handle.take() { - self.controller_tx - .clone() - .unwrap() - .send(ControllerMessage::Shutdown); - - if join { - handle.join().expect("could not join spawned thread"); - } - - self.node_started = false; - self.controller_tx = None; - } - } - - pub fn restart_server(&mut self, chain_type: global::ChainTypes) { - self.shutdown_server(false); - self.start_server(chain_type); - } - - pub fn start_server(&mut self, chain_type: global::ChainTypes) { - self.chain_type = Some(chain_type); - global::set_global_chain_type(chain_type); - - let node_config = self.load_or_create_default_config(chain_type); - - self.config = Some(node_config.clone()); - - let config = node_config.clone(); - let mut logging_config = config.members.as_ref().unwrap().logging.clone().unwrap(); - logging_config.tui_running = Some(false); - - let api_chan: &'static mut (oneshot::Sender<()>, oneshot::Receiver<()>) = - Box::leak(Box::new(oneshot::channel::<()>())); - - // TODO logs_tx needs to be used for something?? - let (_logs_tx, logs_rx) = { - let (logs_tx, logs_rx) = mpsc::sync_channel::(200); - (Some(logs_tx), Some(logs_rx)) - }; - - logger::update_logging_config(logger::LogArea::Node, logging_config); - - if let Some(file_path) = &config.config_file_path { - info!( - "Using configuration file at {}", - file_path.to_str().unwrap() - ); - } else { - info!("Node configuration file not found, using default"); - }; - - log_build_info(); - info!("Chain: {:?}", global::get_chain_type()); - match chain_type { - ChainTypes::Mainnet => { - // Set various mainnet specific feature flags. - global::set_global_nrd_enabled(false); - } - _ => { - // Set various non-mainnet feature flags. - global::set_global_nrd_enabled(true); - } - } - let afb = config - .members - .as_ref() - .unwrap() - .server - .pool_config - .accept_fee_base; - global::set_global_accept_fee_base(afb); - info!("Accept Fee Base: {:?}", global::get_accept_fee_base()); - global::set_global_future_time_limit(config.members.unwrap().server.future_time_limit); - info!("Future Time Limit: {:?}", global::get_future_time_limit()); - log_feature_flags(); - - let server_config = node_config.members.as_ref().unwrap().server.clone(); - - let ui_sender = self.ui_sender.as_ref().unwrap().clone(); - self.node_started = true; - - let (controller_tx, controller_rx) = mpsc::channel::(); - self.controller_tx = Some(controller_tx); - - let handle = thread::Builder::new() - .name("node_runner".to_string()) - .spawn(move || { - // TODO handle start up errors due to corrupt data - servers::Server::start( - server_config, - logs_rx, - |serv: servers::Server, logs_rx: Option>| { - let mut controller = - Controller::new(logs_rx.unwrap(), ui_sender.clone(), &controller_rx); - controller.run(serv, chain_type); - }, - None, - api_chan, - ); - }) - .unwrap(); - - self.handle = Some(handle); - } + pub fn new() -> Self { + NodeInterface { + chain_type: None, + config: None, + ui_sender: None, + node_started: false, + controller_tx: None, + handle: None, + } + } + + pub fn set_ui_sender(&mut self, ui_sender: iced_mpsc::Sender) { + self.ui_sender = Some(ui_sender) + } + + /// Check that the api secret files exist and are valid + fn check_api_secret_files(&self, chain_type: &global::ChainTypes, secret_file_name: &str) { + let grin_path = get_grin_node_default_path(&chain_type); + let mut api_secret_path = grin_path; + api_secret_path.push(secret_file_name); + if !api_secret_path.exists() { + config::init_api_secret(&api_secret_path); + } else { + config::check_api_secret(&api_secret_path); + } + } + + fn load_or_create_default_config(&mut self, chain_type: global::ChainTypes) -> GlobalConfig { + self.check_api_secret_files(&chain_type, API_SECRET_FILE_NAME); + self.check_api_secret_files(&chain_type, FOREIGN_API_SECRET_FILE_NAME); + + let grin_path = get_grin_node_default_path(&chain_type); + + // Get path to default config file + let mut config_path = grin_path.clone(); + config_path.push(SERVER_CONFIG_FILE_NAME); + + // Spit it out if it doesn't exist + if !config_path.exists() { + let mut default_config = GlobalConfig::for_chain(&chain_type); + // update paths relative to current dir + default_config.update_paths(&grin_path); + if let Err(e) = default_config.write_to_file(config_path.to_str().unwrap()) { + panic!("Unable to write default node config file: {}", e); + } + } + + GlobalConfig::new(config_path.to_str().unwrap()).unwrap() + } + + pub fn shutdown_server(&mut self, join: bool) { + if let Some(handle) = self.handle.take() { + self.controller_tx + .clone() + .unwrap() + .send(ControllerMessage::Shutdown); + + if join { + handle.join().expect("could not join spawned thread"); + } + + self.node_started = false; + self.controller_tx = None; + } + } + + pub fn restart_server(&mut self, chain_type: global::ChainTypes) { + self.shutdown_server(false); + self.start_server(chain_type); + } + + pub fn start_server(&mut self, chain_type: global::ChainTypes) { + self.chain_type = Some(chain_type); + global::set_global_chain_type(chain_type); + + let node_config = self.load_or_create_default_config(chain_type); + + self.config = Some(node_config.clone()); + + let config = node_config.clone(); + let mut logging_config = config.members.as_ref().unwrap().logging.clone().unwrap(); + logging_config.tui_running = Some(false); + + let api_chan: &'static mut (oneshot::Sender<()>, oneshot::Receiver<()>) = + Box::leak(Box::new(oneshot::channel::<()>())); + + // TODO logs_tx needs to be used for something?? + let (_logs_tx, logs_rx) = { + let (logs_tx, logs_rx) = mpsc::sync_channel::(200); + (Some(logs_tx), Some(logs_rx)) + }; + + logger::update_logging_config(logger::LogArea::Node, logging_config); + + if let Some(file_path) = &config.config_file_path { + info!( + "Using configuration file at {}", + file_path.to_str().unwrap() + ); + } else { + info!("Node configuration file not found, using default"); + }; + + log_build_info(); + info!("Chain: {:?}", global::get_chain_type()); + match chain_type { + ChainTypes::Mainnet => { + // Set various mainnet specific feature flags. + global::set_global_nrd_enabled(false); + } + _ => { + // Set various non-mainnet feature flags. + global::set_global_nrd_enabled(true); + } + } + let afb = config + .members + .as_ref() + .unwrap() + .server + .pool_config + .accept_fee_base; + global::set_global_accept_fee_base(afb); + info!("Accept Fee Base: {:?}", global::get_accept_fee_base()); + global::set_global_future_time_limit(config.members.unwrap().server.future_time_limit); + info!("Future Time Limit: {:?}", global::get_future_time_limit()); + log_feature_flags(); + + let server_config = node_config.members.as_ref().unwrap().server.clone(); + + let ui_sender = self.ui_sender.as_ref().unwrap().clone(); + self.node_started = true; + + let (controller_tx, controller_rx) = mpsc::channel::(); + self.controller_tx = Some(controller_tx); + + let handle = thread::Builder::new() + .name("node_runner".to_string()) + .spawn(move || { + // TODO handle start up errors due to corrupt data + servers::Server::start( + server_config, + logs_rx, + |serv: servers::Server, logs_rx: Option>| { + let mut controller = + Controller::new(logs_rx.unwrap(), ui_sender.clone(), &controller_rx); + controller.run(serv, chain_type); + }, + None, + api_chan, + ); + }) + .unwrap(); + + self.handle = Some(handle); + } } diff --git a/crates/core/src/node/subscriber.rs b/crates/core/src/node/subscriber.rs index f56d9af..37d16e6 100644 --- a/crates/core/src/node/subscriber.rs +++ b/crates/core/src/node/subscriber.rs @@ -1,8 +1,9 @@ +use iced_core::Hasher; use iced_futures::{ - self, - futures::{channel::mpsc, stream::StreamExt}, subscription, + self, + futures::{channel::mpsc, stream::StreamExt}, + subscription, }; -use iced_core::Hasher; use std::hash::Hash; pub use grin_servers::ServerStats; @@ -11,73 +12,65 @@ pub use grin_servers::ServerStats; #[derive(Clone, Debug)] pub enum UIMessage { - None, - UpdateStatus(ServerStats), + None, + UpdateStatus(ServerStats), } pub enum State { - Ready, - Listening { receiver: mpsc::Receiver }, - Finished, + Ready, + Listening { receiver: mpsc::Receiver }, + Finished, } -pub fn subscriber(id: I) -> iced::Subscription<(I, UIMessage, Option>)> { - iced::Subscription::from_recipe(NodeSubscriber{ - id - }) +pub fn subscriber( + id: I, +) -> iced::Subscription<(I, UIMessage, Option>)> { + iced::Subscription::from_recipe(NodeSubscriber { id }) } pub struct NodeSubscriber { - id: I, + id: I, } impl iced_futures::subscription::Recipe for NodeSubscriber where - T: 'static + Hash + Copy + Send, + T: 'static + Hash + Copy + Send, { - type Output = (T, UIMessage, Option>); + type Output = (T, UIMessage, Option>); - fn hash(&self, state: &mut Hasher) { - struct Marker; - std::any::TypeId::of::().hash(state); - self.id.hash(state); - } + fn hash(&self, state: &mut Hasher) { + struct Marker; + std::any::TypeId::of::().hash(state); + self.id.hash(state); + } - fn stream( - self: Box, - _input: subscription::EventStream, - ) -> futures::stream::BoxStream<'static, Self::Output> { - let id = self.id; - Box::pin(futures::stream::unfold( - State::Ready, - move |state| async move { - match state { - State::Ready => { - let (sender, receiver) = mpsc::channel::(0); - Some(( - (id, UIMessage::None, Some(sender)), - State::Listening { receiver }, - )) - } - State::Listening { mut receiver } => match receiver.next().await { - Some(msg) => { - Some(( - (id, msg, None), - State::Listening { receiver }, - )) - } - _ => Some(( - (id, UIMessage::None, None), - State::Listening { receiver }, - )), - }, - State::Finished => { - // Don't let the stream die? - let _: () = iced::futures::future::pending().await; - None - } - } - }, - )) - } + fn stream( + self: Box, + _input: subscription::EventStream, + ) -> futures::stream::BoxStream<'static, Self::Output> { + let id = self.id; + Box::pin(futures::stream::unfold( + State::Ready, + move |state| async move { + match state { + State::Ready => { + let (sender, receiver) = mpsc::channel::(0); + Some(( + (id, UIMessage::None, Some(sender)), + State::Listening { receiver }, + )) + } + State::Listening { mut receiver } => match receiver.next().await { + Some(msg) => Some(((id, msg, None), State::Listening { receiver })), + _ => Some(((id, UIMessage::None, None), State::Listening { receiver })), + }, + State::Finished => { + // Don't let the stream die? + let _: () = iced::futures::future::pending().await; + None + } + } + }, + )) + } } diff --git a/crates/core/src/theme/application.rs b/crates/core/src/theme/application.rs index d526684..2c7df37 100644 --- a/crates/core/src/theme/application.rs +++ b/crates/core/src/theme/application.rs @@ -1,13 +1,13 @@ -use iced::{application}; use super::Theme; +use iced::application; impl application::StyleSheet for Theme { - type Style = iced_style::theme::Application; + type Style = iced_style::theme::Application; - fn appearance(&self, style: &Self::Style) -> application::Appearance { - application::Appearance { - background_color: self.palette.base.background, - text_color: self.palette.normal.primary, - } - } -} \ No newline at end of file + fn appearance(&self, style: &Self::Style) -> application::Appearance { + application::Appearance { + background_color: self.palette.base.background, + text_color: self.palette.normal.primary, + } + } +} diff --git a/crates/core/src/theme/picklist.rs b/crates/core/src/theme/picklist.rs index b2d2aac..3ff9807 100644 --- a/crates/core/src/theme/picklist.rs +++ b/crates/core/src/theme/picklist.rs @@ -1,6 +1,6 @@ use super::Theme; use iced::{Background, Color}; -use iced_core::{Border, Shadow}; +use iced_core::Border; use iced_style::{menu, pick_list}; #[derive(Debug, Clone, Copy, Default)] diff --git a/crates/core/src/theme/radio.rs b/crates/core/src/theme/radio.rs index e3540f6..67d8556 100644 --- a/crates/core/src/theme/radio.rs +++ b/crates/core/src/theme/radio.rs @@ -1,70 +1,67 @@ - - -use iced_style::{radio, menu}; -use iced::{Background, Color, widget::Radio}; use super::Theme; +use iced::Color; +use iced_style::radio; #[derive(Debug, Clone, Copy, Default)] pub enum RadioStyle { - #[default] - Default, - Primary, + #[default] + Default, + Primary, } impl radio::StyleSheet for Theme { - type Style = RadioStyle; + type Style = RadioStyle; - fn active(&self, style: &Self::Style, is_selected: bool) -> radio::Appearance { - match style { - RadioStyle::Primary => radio::Appearance { - text_color: Some(self.palette.bright.surface), - background: self.palette.base.background.into(), - dot_color: self.palette.bright.surface, - border_width: 1.0, - border_color: Color { - a: 0.5, - ..self.palette.normal.primary - }, - }, - _ => todo!("default") - } - } + fn active(&self, style: &Self::Style, is_selected: bool) -> radio::Appearance { + match style { + RadioStyle::Primary => radio::Appearance { + text_color: Some(self.palette.bright.surface), + background: self.palette.base.background.into(), + dot_color: self.palette.bright.surface, + border_width: 1.0, + border_color: Color { + a: 0.5, + ..self.palette.normal.primary + }, + }, + _ => todo!("default"), + } + } - fn hovered(&self, style: &Self::Style, is_selected: bool) -> radio::Appearance { - match style { - RadioStyle::Primary => { - let active = self.active(style, is_selected); + fn hovered(&self, style: &Self::Style, is_selected: bool) -> radio::Appearance { + match style { + RadioStyle::Primary => { + let active = self.active(style, is_selected); - radio::Appearance { - text_color: Some(self.palette.bright.primary), - ..active - } - }, - _ => todo!("default") - } - } + radio::Appearance { + text_color: Some(self.palette.bright.primary), + ..active + } + } + _ => todo!("default"), + } + } } - /*impl menu::StyleSheet for Theme { - type Style = PickListStyle; + type Style = PickListStyle; - fn appearance(&self, style: &Self::Style) -> menu::Appearance { - match style { - PickListStyle::Primary => menu::Appearance { - text_color: self.palette.bright.surface, - background: Background::Color(self.palette.base.foreground), - border_width: 1.0, - border_radius: 2.0.into(), - border_color: self.palette.base.background, - selected_background: Background::Color(Color { - a: 0.15, - ..self.palette.normal.primary - }), - selected_text_color: self.palette.bright.primary, - }, - _ => todo!("default") + fn appearance(&self, style: &Self::Style) -> menu::Appearance { + match style { + PickListStyle::Primary => menu::Appearance { + text_color: self.palette.bright.surface, + background: Background::Color(self.palette.base.foreground), + border_width: 1.0, + border_radius: 2.0.into(), + border_color: self.palette.base.background, + selected_background: Background::Color(Color { + a: 0.15, + ..self.palette.normal.primary + }), + selected_text_color: self.palette.bright.primary, + }, + _ => todo!("default") - } - } -}*/ \ No newline at end of file + } + } +}*/ diff --git a/crates/core/src/theme/scrollable.rs b/crates/core/src/theme/scrollable.rs index 3fd545e..a0c4bf7 100644 --- a/crates/core/src/theme/scrollable.rs +++ b/crates/core/src/theme/scrollable.rs @@ -1,7 +1,7 @@ use super::Theme; use iced::widget::scrollable; use iced::{Background, Color}; -use iced_style::scrollable::Appearance; +use iced_style::scrollable::{Appearance, Scrollbar, Scroller}; #[derive(Debug, Clone, Copy, Default)] pub enum ScrollableStyle { @@ -14,21 +14,33 @@ impl scrollable::StyleSheet for Theme { type Style = ScrollableStyle; fn active(&self, style: &Self::Style) -> Appearance { - let mut appearance = self.active(style); + let mut appearance = Appearance { + container: Default::default(), + scrollbar: Scrollbar { + background: None, + border: Default::default(), + scroller: Scroller { + color: self.palette.base.background, + border: Default::default(), + }, + }, + gap: None, + }; match style { ScrollableStyle::Default => { - appearance.background = Some(Background::Color(Color::TRANSPARENT)); - appearance.border_radius = 0.0.into(); - appearance.border_width = 0.0.into(); - appearance.border_color = Color::TRANSPARENT; + appearance.scrollbar.background = Some(Background::Color(Color::TRANSPARENT)); + appearance.scrollbar.border.radius = 0.0.into(); + appearance.scrollbar.border.width = 0.0.into(); + appearance.scrollbar.border.color = Color::TRANSPARENT; } ScrollableStyle::Primary => { - appearance.background = Some(Background::Color(self.palette.base.background)); - appearance.border_radius = 0.0.into(); - appearance.border_width = 0.0.into(); - appearance.border_color = Color::TRANSPARENT; + appearance.scrollbar.background = + Some(Background::Color(self.palette.base.background)); + appearance.scrollbar.border.radius = 0.0.into(); + appearance.scrollbar.border.width = 0.0.into(); + appearance.scrollbar.border.color = Color::TRANSPARENT; } } diff --git a/crates/core/src/theme/text.rs b/crates/core/src/theme/text.rs index da691c7..935add9 100644 --- a/crates/core/src/theme/text.rs +++ b/crates/core/src/theme/text.rs @@ -3,23 +3,20 @@ use iced::widget::text; #[derive(Debug, Clone, Copy, Default)] pub enum TextStyle { - #[default] - Default, - Warning, + #[default] + Default, + Warning, } - impl text::StyleSheet for Theme { - type Style = TextStyle; + type Style = TextStyle; - fn appearance(&self, style: Self::Style) -> text::Appearance { - match style { - TextStyle::Warning => { - text::Appearance{ - color: Some(self.palette.bright.error) - } - } - TextStyle::Default => Default::default(), - } - } + fn appearance(&self, style: Self::Style) -> text::Appearance { + match style { + TextStyle::Warning => text::Appearance { + color: Some(self.palette.bright.error), + }, + TextStyle::Default => Default::default(), + } + } } diff --git a/crates/core/src/utility.rs b/crates/core/src/utility.rs index 10c93ea..b5953fe 100644 --- a/crates/core/src/utility.rs +++ b/crates/core/src/utility.rs @@ -18,16 +18,16 @@ use std::path::{Path, PathBuf}; /// /// Eg. 90001 would be 9.0.1. pub fn format_interface_into_game_version(interface: &str) -> String { - if interface.len() == 5 { - let major = interface[..1].parse::(); - let minor = interface[1..3].parse::(); - let patch = interface[3..5].parse::(); - if let (Ok(major), Ok(minor), Ok(patch)) = (major, minor, patch) { - return format!("{}.{}.{}", major, minor, patch); - } - } - - interface.to_owned() + if interface.len() == 5 { + let major = interface[..1].parse::(); + let minor = interface[1..3].parse::(); + let patch = interface[3..5].parse::(); + if let (Ok(major), Ok(minor), Ok(patch)) = (major, minor, patch) { + return format!("{}.{}.{}", major, minor, patch); + } + } + + interface.to_owned() } /// Takes a `&str` and strips any non-digit. @@ -36,174 +36,174 @@ pub fn format_interface_into_game_version(interface: &str) -> String { /// A string looking like 213r323 would return 213323. /// A string looking like Rematch_4_10_15.zip would return 41015. pub(crate) fn _strip_non_digits(string: &str) -> String { - let re = Regex::new(r"[\D]").unwrap(); - let stripped = re.replace_all(string, "").to_string(); - stripped + let re = Regex::new(r"[\D]").unwrap(); + let stripped = re.replace_all(string, "").to_string(); + stripped } #[derive(Debug, Deserialize, Clone)] pub struct Release { - pub tag_name: String, - pub prerelease: bool, - pub assets: Vec, - pub body: String, + pub tag_name: String, + pub prerelease: bool, + pub assets: Vec, + pub body: String, } #[derive(Debug, Deserialize, Clone)] pub struct ReleaseAsset { - pub name: String, - #[serde(rename = "browser_download_url")] - pub download_url: String, + pub name: String, + #[serde(rename = "browser_download_url")] + pub download_url: String, } #[cfg(feature = "no-self-update")] pub async fn get_latest_release(_channel: SelfUpdateChannel) -> Option { - None + None } #[cfg(not(feature = "no-self-update"))] pub async fn get_latest_release(channel: SelfUpdateChannel) -> Option { - use crate::network::request_async; - use isahc::AsyncReadResponseExt; - - log::debug!("checking for application update"); - - let mut resp = request_async( - "https://api.github.com/repos/grin-gui/grin-gui/releases", - vec![], - None, - ) - .await - .ok()?; - - let releases: Vec = resp.json().await.ok()?; - - releases.into_iter().find(|r| { - if channel == SelfUpdateChannel::Beta { - // If beta, always want latest release - true - } else { - // Otherwise ONLY non-prereleases - !r.prerelease - } - }) + use crate::network::request_async; + use isahc::AsyncReadResponseExt; + + log::debug!("checking for application update"); + + let mut resp = request_async( + "https://api.github.com/repos/grin-gui/grin-gui/releases", + vec![], + None, + ) + .await + .ok()?; + + let releases: Vec = resp.json().await.ok()?; + + releases.into_iter().find(|r| { + if channel == SelfUpdateChannel::Beta { + // If beta, always want latest release + true + } else { + // Otherwise ONLY non-prereleases + !r.prerelease + } + }) } /// Downloads the latest release file that matches `bin_name`, renames the current /// executable to a temp path, renames the new version as the original file name, /// then returns both the original file name (new version) and temp path (old version) pub async fn download_update_to_temp_file( - bin_name: String, - release: Release, + bin_name: String, + release: Release, ) -> Result<(PathBuf, PathBuf), DownloadError> { - #[cfg(not(target_os = "linux"))] - let current_bin_path = std::env::current_exe()?; - - #[cfg(target_os = "linux")] - let current_bin_path = PathBuf::from( - std::env::var("APPIMAGE").map_err(|_| DownloadError::SelfUpdateLinuxNonAppImage)?, - ); - - // Path to download the new version to - let download_path = current_bin_path - .parent() - .unwrap() - .join(&format!("tmp_{}", bin_name)); - - // Path to temporarily force rename current process to, se we can then - // rename `download_path` to `current_bin_path` and then launch new version - // cleanly as `current_bin_path` - let tmp_path = current_bin_path - .parent() - .unwrap() - .join(&format!("tmp2_{}", bin_name)); - - // On macos, we actually download an archive with the new binary inside. Let's extract - // that file and remove the archive. - #[cfg(target_os = "macos")] - { - let asset_name = format!("{}-macos.tar.gz", bin_name); - - let asset = release - .assets - .iter() - .find(|a| a.name == asset_name) - .cloned() - .ok_or(DownloadError::MissingSelfUpdateRelease { bin_name })?; - - let archive_path = current_bin_path.parent().unwrap().join(&asset_name); - - download_file(&asset.download_url, &archive_path).await?; - - extract_binary_from_tar(&archive_path, &download_path, "grin-gui")?; - - std::fs::remove_file(&archive_path)?; - } - - // For windows & linux, we download the new binary directly - #[cfg(not(target_os = "macos"))] - { - let asset = release - .assets - .iter() - .find(|a| a.name == bin_name) - .cloned() - .ok_or(DownloadError::MissingSelfUpdateRelease { bin_name })?; - - download_file(&asset.download_url, &download_path).await?; - } - - // Make executable - #[cfg(not(target_os = "windows"))] - { - use async_std::fs; - use std::os::unix::fs::PermissionsExt; - - let mut permissions = fs::metadata(&download_path).await?.permissions(); - permissions.set_mode(0o755); - fs::set_permissions(&download_path, permissions).await?; - } - - rename(¤t_bin_path, &tmp_path)?; - - rename(&download_path, ¤t_bin_path)?; - - Ok((current_bin_path, tmp_path)) + #[cfg(not(target_os = "linux"))] + let current_bin_path = std::env::current_exe()?; + + #[cfg(target_os = "linux")] + let current_bin_path = PathBuf::from( + std::env::var("APPIMAGE").map_err(|_| DownloadError::SelfUpdateLinuxNonAppImage)?, + ); + + // Path to download the new version to + let download_path = current_bin_path + .parent() + .unwrap() + .join(&format!("tmp_{}", bin_name)); + + // Path to temporarily force rename current process to, se we can then + // rename `download_path` to `current_bin_path` and then launch new version + // cleanly as `current_bin_path` + let tmp_path = current_bin_path + .parent() + .unwrap() + .join(&format!("tmp2_{}", bin_name)); + + // On macos, we actually download an archive with the new binary inside. Let's extract + // that file and remove the archive. + #[cfg(target_os = "macos")] + { + let asset_name = format!("{}-macos.tar.gz", bin_name); + + let asset = release + .assets + .iter() + .find(|a| a.name == asset_name) + .cloned() + .ok_or(DownloadError::MissingSelfUpdateRelease { bin_name })?; + + let archive_path = current_bin_path.parent().unwrap().join(&asset_name); + + download_file(&asset.download_url, &archive_path).await?; + + extract_binary_from_tar(&archive_path, &download_path, "grin-gui")?; + + std::fs::remove_file(&archive_path)?; + } + + // For windows & linux, we download the new binary directly + #[cfg(not(target_os = "macos"))] + { + let asset = release + .assets + .iter() + .find(|a| a.name == bin_name) + .cloned() + .ok_or(DownloadError::MissingSelfUpdateRelease { bin_name })?; + + download_file(&asset.download_url, &download_path).await?; + } + + // Make executable + #[cfg(not(target_os = "windows"))] + { + use async_std::fs; + use std::os::unix::fs::PermissionsExt; + + let mut permissions = fs::metadata(&download_path).await?.permissions(); + permissions.set_mode(0o755); + fs::set_permissions(&download_path, permissions).await?; + } + + rename(¤t_bin_path, &tmp_path)?; + + rename(&download_path, ¤t_bin_path)?; + + Ok((current_bin_path, tmp_path)) } /// Extracts the Grin Gui binary from a `tar.gz` archive to temp_file path #[cfg(target_os = "macos")] fn extract_binary_from_tar( - archive_path: &Path, - temp_file: &Path, - bin_name: &str, + archive_path: &Path, + temp_file: &Path, + bin_name: &str, ) -> Result<(), FilesystemError> { - use flate2::read::GzDecoder; - use std::fs::File; - use std::io::copy; - use tar::Archive; + use flate2::read::GzDecoder; + use std::fs::File; + use std::io::copy; + use tar::Archive; - let mut archive = Archive::new(GzDecoder::new(File::open(&archive_path)?)); + let mut archive = Archive::new(GzDecoder::new(File::open(&archive_path)?)); - let mut temp_file = File::create(temp_file)?; + let mut temp_file = File::create(temp_file)?; - for file in archive.entries()? { - let mut file = file?; + for file in archive.entries()? { + let mut file = file?; - let path = file.path()?; + let path = file.path()?; - if let Some(name) = path.to_str() { - if name == bin_name { - copy(&mut file, &mut temp_file)?; + if let Some(name) = path.to_str() { + if name == bin_name { + copy(&mut file, &mut temp_file)?; - return Ok(()); - } - } - } + return Ok(()); + } + } + } - Err(FilesystemError::BinMissingFromTar { - bin_name: bin_name.to_owned(), - }) + Err(FilesystemError::BinMissingFromTar { + bin_name: bin_name.to_owned(), + }) } /// Rename a file or directory to a new name, retrying if the operation fails because of permissions @@ -212,28 +212,28 @@ fn extract_binary_from_tar( /// and other automated operations to complete. pub fn rename(from: F, to: T) -> io::Result<()> where - F: AsRef, - T: AsRef, + F: AsRef, + T: AsRef, { - // 21 Fibonacci steps starting at 1 ms is ~28 seconds total - // See https://github.com/rust-lang/rustup/pull/1873 where this was used by Rustup to work around - // virus scanning file locks - let from = from.as_ref(); - let to = to.as_ref(); - - retry(Fibonacci::from_millis(1).take(21), || { - match fs::rename(from, to) { - Ok(_) => OperationResult::Ok(()), - Err(e) => match e.kind() { - io::ErrorKind::PermissionDenied => OperationResult::Retry(e), - _ => OperationResult::Err(e), - }, - } - }) - .map_err(|e| match e { - RetryError::Operation { error, .. } => error, - RetryError::Internal(message) => io::Error::new(io::ErrorKind::Other, message), - }) + // 21 Fibonacci steps starting at 1 ms is ~28 seconds total + // See https://github.com/rust-lang/rustup/pull/1873 where this was used by Rustup to work around + // virus scanning file locks + let from = from.as_ref(); + let to = to.as_ref(); + + retry(Fibonacci::from_millis(1).take(21), || { + match fs::rename(from, to) { + Ok(_) => OperationResult::Ok(()), + Err(e) => match e.kind() { + io::ErrorKind::PermissionDenied => OperationResult::Retry(e), + _ => OperationResult::Err(e), + }, + } + }) + .map_err(|e| match e { + RetryError::Operation { error, .. } => error, + RetryError::Internal(message) => io::Error::new(io::ErrorKind::Other, message), + }) } /// Remove a file, retrying if the operation fails because of permissions @@ -242,60 +242,60 @@ where /// and other automated operations to complete. pub fn remove_file

(path: P) -> io::Result<()> where - P: AsRef, + P: AsRef, { - // 21 Fibonacci steps starting at 1 ms is ~28 seconds total - // See https://github.com/rust-lang/rustup/pull/1873 where this was used by Rustup to work around - // virus scanning file locks - let path = path.as_ref(); - - retry( - Fibonacci::from_millis(1).take(21), - || match fs::remove_file(path) { - Ok(_) => OperationResult::Ok(()), - Err(e) => match e.kind() { - io::ErrorKind::PermissionDenied => OperationResult::Retry(e), - _ => OperationResult::Err(e), - }, - }, - ) - .map_err(|e| match e { - RetryError::Operation { error, .. } => error, - RetryError::Internal(message) => io::Error::new(io::ErrorKind::Other, message), - }) + // 21 Fibonacci steps starting at 1 ms is ~28 seconds total + // See https://github.com/rust-lang/rustup/pull/1873 where this was used by Rustup to work around + // virus scanning file locks + let path = path.as_ref(); + + retry( + Fibonacci::from_millis(1).take(21), + || match fs::remove_file(path) { + Ok(_) => OperationResult::Ok(()), + Err(e) => match e.kind() { + io::ErrorKind::PermissionDenied => OperationResult::Retry(e), + _ => OperationResult::Err(e), + }, + }, + ) + .map_err(|e| match e { + RetryError::Operation { error, .. } => error, + RetryError::Internal(message) => io::Error::new(io::ErrorKind::Other, message), + }) } pub(crate) fn _truncate(s: &str, max_chars: usize) -> &str { - match s.char_indices().nth(max_chars) { - None => s, - Some((idx, _)) => &s[..idx], - } + match s.char_indices().nth(max_chars) { + None => s, + Some((idx, _)) => &s[..idx], + } } pub(crate) fn _regex_html_tags_to_newline() -> Regex { - regex::Regex::new(r"
|#.\s").unwrap() + regex::Regex::new(r"
|#.\s").unwrap() } pub(crate) fn _regex_html_tags_to_space() -> Regex { - regex::Regex::new(r"<[^>]*>|&#?\w+;|[gl]t;").unwrap() + regex::Regex::new(r"<[^>]*>|&#?\w+;|[gl]t;").unwrap() } #[cfg(test)] mod tests { - use super::*; + use super::*; - #[test] - fn test_interface() { - let interface = "90001"; - assert_eq!("9.0.1", format_interface_into_game_version(interface)); + #[test] + fn test_interface() { + let interface = "90001"; + assert_eq!("9.0.1", format_interface_into_game_version(interface)); - let interface = "11305"; - assert_eq!("1.13.5", format_interface_into_game_version(interface)); + let interface = "11305"; + assert_eq!("1.13.5", format_interface_into_game_version(interface)); - let interface = "100000"; - assert_eq!("100000", format_interface_into_game_version(interface)); + let interface = "100000"; + assert_eq!("100000", format_interface_into_game_version(interface)); - let interface = "9.0.1"; - assert_eq!("9.0.1", format_interface_into_game_version(interface)); - } + let interface = "9.0.1"; + assert_eq!("9.0.1", format_interface_into_game_version(interface)); + } } diff --git a/crates/core/src/widget/header.rs b/crates/core/src/widget/header.rs index 30218c0..3a9622e 100644 --- a/crates/core/src/widget/header.rs +++ b/crates/core/src/widget/header.rs @@ -36,7 +36,7 @@ where impl<'a, Message, Theme, Renderer> Header<'a, Message, Theme, Renderer> where Renderer: 'a + iced_core::Renderer, - Theme: StyleSheet, + Theme: StyleSheet + 'a, Message: 'a, { pub fn new( @@ -372,7 +372,7 @@ where }*/ } -impl<'a, Message, Theme, Renderer> From> +impl<'a, Message, Theme: 'a, Renderer> From> for Element<'a, Message, Theme, Renderer> where Renderer: 'a + iced_core::Renderer, diff --git a/crates/core/src/widget/table_row.rs b/crates/core/src/widget/table_row.rs index 7c9d263..8123cd0 100644 --- a/crates/core/src/widget/table_row.rs +++ b/crates/core/src/widget/table_row.rs @@ -5,7 +5,7 @@ use iced_core::{ Event, Layout, Length, Padding, Point, Rectangle, Shell, Widget, }; -use iced::Size; +use iced::{Border, Size}; #[allow(missing_debug_implementations)] pub struct TableRow<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> @@ -54,17 +54,14 @@ where } /// Sets the style of the [`TableRow`]. - pub fn style(mut self, style: impl Into<::Style>) -> Self { + pub fn style(mut self, style: S) -> Self + where + S: Into<::Style>, + { self.style = style.into(); self } - /// Sets the width of the [`TableRow`]. - pub fn width(mut self, width: Length) -> Self { - self.width = width; - self - } - /// Sets the height of the [`TableRow`]. pub fn height(mut self, height: Length) -> Self { self.height = height; @@ -142,24 +139,30 @@ where } } - fn layout(&self, renderer: &Renderer, limits: &layout::Limits) -> layout::Node { - let limits = limits - .loose() - .width(self.width) - .height(self.height) - .pad(self.padding); - - let mut content = self.content.as_widget().layout(renderer, &limits.loose()); - let size = limits.resolve(content.size()); + fn layout( + &self, + tree: &mut Tree, + renderer: &Renderer, + limits: &layout::Limits, + ) -> layout::Node { + let limits = limits.loose().width(self.height).height(self.height); + //.padding(); + // TODO: Above? + + let mut content = self + .content + .as_widget() + .layout(tree, renderer, &limits.loose()); + let size = limits.resolve(self.width, self.height, content.size()); // TODO: MODIFIED COORDINATES, CHECK - content.move_to(Point::new( + content = content.move_to(Point::new( self.padding.top as f32, self.padding.left as f32, )); - content.align(self.horizontal_alignment, self.vertical_alignment, size); + content = content.align(self.horizontal_alignment, self.vertical_alignment, size); - layout::Node::with_children(size.pad(self.padding), vec![content]) + layout::Node::with_children(size.expand(self.padding), vec![content]) } fn draw( @@ -198,9 +201,12 @@ where width: bounds.width - appearance.offset_right as f32, height: custom_bounds.height, }, - border_radius: appearance.border_radius.into(), - border_width: appearance.border_width, - border_color: appearance.border_color, + border: Border { + width: appearance.border_width, + color: appearance.border_color, + radius: appearance.border_radius.into(), + }, + shadow: Default::default(), }; renderer.fill_quad( @@ -320,14 +326,18 @@ where tree: &'b mut Tree, layout: Layout<'_>, renderer: &Renderer, + cursor: iced_core::Vector, // Change the type of the `cursor` parameter ) -> Option> { - self.content - .as_widget_mut() - .overlay(tree, layout.children().next().unwrap(), renderer) + self.content.as_widget_mut().overlay( + tree, + layout.children().next().unwrap(), + renderer, + cursor, + ) } } -impl<'a, Message, Theme, Renderer> From> +impl<'a, Message, Theme: 'a, Renderer> From> for Element<'a, Message, Theme, Renderer> where Renderer: 'a + iced_core::Renderer, From 414fda12bb3044d472e0359f8ec3bcb849ca5b51 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Tue, 19 Mar 2024 14:24:12 +0000 Subject: [PATCH 04/12] more painful 0.12 update work --- Cargo.lock | 506 ++---------------- Cargo.toml | 12 +- crates/core/src/theme/mod.rs | 18 +- crates/core/src/widget/header.rs | 7 +- src/gui/element/menu.rs | 5 +- src/gui/element/node/embedded/mod.rs | 20 +- src/gui/element/node/embedded/summary.rs | 2 +- src/gui/element/node/mod.rs | 5 +- src/gui/element/wallet/mod.rs | 2 +- src/gui/element/wallet/operation/apply_tx.rs | 2 +- .../wallet/operation/apply_tx_confirm.rs | 2 +- src/gui/element/wallet/operation/create_tx.rs | 2 +- .../wallet/operation/create_tx_contracts.rs | 2 +- src/gui/element/wallet/operation/home.rs | 2 +- src/gui/element/wallet/operation/tx_detail.rs | 2 +- src/gui/element/wallet/operation/tx_list.rs | 9 +- .../wallet/operation/tx_list_display.rs | 2 +- src/gui/element/wallet/operation/tx_proof.rs | 2 +- src/gui/element/wallet/setup/wallet_list.rs | 11 +- src/gui/mod.rs | 4 +- 20 files changed, 106 insertions(+), 511 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dfc47a7..ad2ba01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -126,24 +126,6 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" -[[package]] -name = "android-activity" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" -dependencies = [ - "android-properties", - "bitflags 1.3.2", - "cc", - "jni-sys", - "libc", - "log", - "ndk 0.7.0", - "ndk-context", - "ndk-sys 0.4.1+23.1.7779620", - "num_enum 0.6.1", -] - [[package]] name = "android-activity" version = "0.5.2" @@ -158,10 +140,10 @@ dependencies = [ "jni-sys", "libc", "log", - "ndk 0.8.0", + "ndk", "ndk-context", - "ndk-sys 0.5.0+25.2.9519653", - "num_enum 0.7.2", + "ndk-sys", + "num_enum", "thiserror", ] @@ -670,32 +652,13 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "block-sys" -version = "0.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" -dependencies = [ - "objc-sys 0.2.0-beta.2", -] - [[package]] name = "block-sys" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7" dependencies = [ - "objc-sys 0.3.2", -] - -[[package]] -name = "block2" -version = "0.2.0-alpha.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" -dependencies = [ - "block-sys 0.1.0-beta.1", - "objc2-encode 2.0.0-pre.2", + "objc-sys", ] [[package]] @@ -704,8 +667,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ - "block-sys 0.2.1", - "objc2 0.4.1", + "block-sys", + "objc2", ] [[package]] @@ -831,20 +794,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "calloop" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" -dependencies = [ - "bitflags 1.3.2", - "log", - "nix 0.25.1", - "slotmap", - "thiserror", - "vec_map", -] - [[package]] name = "calloop" version = "0.12.4" @@ -865,7 +814,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ - "calloop 0.12.4", + "calloop", "rustix 0.38.31", "wayland-backend 0.3.3", "wayland-client 0.31.2", @@ -1002,24 +951,13 @@ dependencies = [ "yaml-rust 0.3.5", ] -[[package]] -name = "clipboard-win" -version = "4.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" -dependencies = [ - "error-code 2.3.1", - "str-buf", - "winapi 0.3.9", -] - [[package]] name = "clipboard-win" version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f9a0700e0127ba15d1d52dd742097f821cd9c65939303a44d970465040a297" dependencies = [ - "error-code 3.2.0", + "error-code", ] [[package]] @@ -1893,16 +1831,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "error-code" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" -dependencies = [ - "libc", - "str-buf", -] - [[package]] name = "error-code" version = "3.2.0" @@ -2798,12 +2726,12 @@ dependencies = [ "futures 0.3.30", "fuzzy-matcher", "grin-gui-core", - "iced 0.10.0", - "iced_aw 0.6.0", - "iced_core 0.10.0", - "iced_futures 0.7.0", - "iced_renderer 0.1.0", - "iced_style 0.9.0", + "iced", + "iced_aw", + "iced_core 0.12.3", + "iced_futures 0.12.0", + "iced_renderer 0.12.1", + "iced_style 0.12.1", "image 0.23.14", "isahc 0.9.14", "isolang", @@ -2860,8 +2788,8 @@ dependencies = [ "grin_wallet_impls", "grin_wallet_libwallet", "grin_wallet_util", - "iced 0.12.1", - "iced_aw 0.8.0", + "iced", + "iced_aw", "iced_core 0.12.3", "iced_futures 0.12.0", "iced_graphics 0.12.1", @@ -3798,20 +3726,6 @@ dependencies = [ "cc", ] -[[package]] -name = "iced" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c708807ec86f99dd729dc4d42db5239acf118cec14d3c5f57679dcfdbbc472b1" -dependencies = [ - "iced_core 0.10.0", - "iced_futures 0.7.0", - "iced_renderer 0.1.0", - "iced_widget 0.1.3", - "iced_winit 0.10.1", - "thiserror", -] - [[package]] name = "iced" version = "0.12.1" @@ -3822,19 +3736,10 @@ dependencies = [ "iced_futures 0.12.0", "iced_renderer 0.12.1", "iced_widget 0.12.3", - "iced_winit 0.12.2", + "iced_winit", "thiserror", ] -[[package]] -name = "iced_aw" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "842ee223a09cf7f874b9e2d6f5a1aa54f3642c31f7ff5e26c43f1546232b127b" -dependencies = [ - "iced_widget 0.1.3", -] - [[package]] name = "iced_aw" version = "0.8.0" @@ -3842,7 +3747,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "129deba9897243dd59c2038e2267a691e392c94e569680066ee63b1164429490" dependencies = [ "cfg-if 1.0.0", - "iced 0.12.1", + "iced", ] [[package]] @@ -3883,11 +3788,9 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14dab0054a9c7a1cbce227a8cd9ee4a094497b3d06094551ac6c1488d563802e" dependencies = [ - "async-std", "futures 0.3.30", "iced_core 0.10.0", "log", - "tokio 1.36.0", "wasm-bindgen-futures", "wasm-timer", ] @@ -3937,6 +3840,7 @@ dependencies = [ "iced_core 0.12.3", "iced_futures 0.12.0", "log", + "lyon_path", "once_cell", "raw-window-handle 0.6.0", "rustc-hash", @@ -4088,6 +3992,7 @@ dependencies = [ "guillotiere", "iced_graphics 0.12.1", "log", + "lyon", "once_cell", "wgpu 0.19.3", ] @@ -4121,24 +4026,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "iced_winit" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0c884bcb14722a57192b40a5ef6b5e170fa2f01fe2ff28d6cdd9efe37acf70" -dependencies = [ - "iced_graphics 0.9.0", - "iced_runtime 0.1.1", - "iced_style 0.9.0", - "log", - "raw-window-handle 0.5.2", - "thiserror", - "web-sys", - "winapi 0.3.9", - "window_clipboard 0.3.0", - "winit 0.28.7", -] - [[package]] name = "iced_winit" version = "0.12.2" @@ -4153,8 +4040,8 @@ dependencies = [ "tracing", "web-sys", "winapi 0.3.9", - "window_clipboard 0.4.1", - "winit 0.29.14", + "window_clipboard", + "winit", ] [[package]] @@ -4163,9 +4050,9 @@ version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" dependencies = [ - "block2 0.3.0", + "block2", "dispatch", - "objc2 0.4.1", + "objc2", ] [[package]] @@ -4244,9 +4131,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", ] [[package]] @@ -4871,15 +4755,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "memmap2" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.6.2" @@ -5031,7 +4906,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -5194,20 +5068,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ndk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" -dependencies = [ - "bitflags 1.3.2", - "jni-sys", - "ndk-sys 0.4.1+23.1.7779620", - "num_enum 0.5.11", - "raw-window-handle 0.5.2", - "thiserror", -] - [[package]] name = "ndk" version = "0.8.0" @@ -5217,8 +5077,8 @@ dependencies = [ "bitflags 2.4.2", "jni-sys", "log", - "ndk-sys 0.5.0+25.2.9519653", - "num_enum 0.7.2", + "ndk-sys", + "num_enum", "raw-window-handle 0.6.0", "thiserror", ] @@ -5229,15 +5089,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "ndk-sys" -version = "0.4.1+23.1.7779620" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" -dependencies = [ - "jni-sys", -] - [[package]] name = "ndk-sys" version = "0.5.0+25.2.9519653" @@ -5270,18 +5121,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags 1.3.2", - "cfg-if 1.0.0", - "libc", - "memoffset 0.6.5", -] - [[package]] name = "nix" version = "0.25.1" @@ -5450,55 +5289,13 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive 0.5.11", -] - -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive 0.6.1", -] - [[package]] name = "num_enum" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "num_enum_derive 0.7.2", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro-crate", - "proc-macro2 1.0.78", - "quote 1.0.35", - "syn 1.0.109", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate", - "proc-macro2 1.0.78", - "quote 1.0.35", - "syn 2.0.50", + "num_enum_derive", ] [[package]] @@ -5534,46 +5331,20 @@ dependencies = [ "objc_id", ] -[[package]] -name = "objc-sys" -version = "0.2.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" - [[package]] name = "objc-sys" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7c71324e4180d0899963fc83d9d241ac39e699609fc1025a850aadac8257459" -[[package]] -name = "objc2" -version = "0.3.0-beta.3.patch-leaks.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" -dependencies = [ - "block2 0.2.0-alpha.6", - "objc-sys 0.2.0-beta.2", - "objc2-encode 2.0.0-pre.2", -] - [[package]] name = "objc2" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" dependencies = [ - "objc-sys 0.3.2", - "objc2-encode 3.0.0", -] - -[[package]] -name = "objc2-encode" -version = "2.0.0-pre.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" -dependencies = [ - "objc-sys 0.2.0-beta.2", + "objc-sys", + "objc2-encode", ] [[package]] @@ -7152,19 +6923,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sctk-adwaita" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda4e97be1fd174ccc2aae81c8b694e803fa99b34e8fd0f057a9d70698e3ed09" -dependencies = [ - "ab_glyph", - "log", - "memmap2 0.5.10", - "smithay-client-toolkit 0.16.1", - "tiny-skia 0.8.4", -] - [[package]] name = "sctk-adwaita" version = "0.8.1" @@ -7174,7 +6932,7 @@ dependencies = [ "ab_glyph", "log", "memmap2 0.9.4", - "smithay-client-toolkit 0.18.1", + "smithay-client-toolkit", "tiny-skia 0.11.4", ] @@ -7499,25 +7257,6 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" -[[package]] -name = "smithay-client-toolkit" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870427e30b8f2cbe64bf43ec4b86e88fe39b0a84b3f15efd9c9c2d020bc86eb9" -dependencies = [ - "bitflags 1.3.2", - "calloop 0.10.6", - "dlib", - "lazy_static", - "log", - "memmap2 0.5.10", - "nix 0.24.3", - "pkg-config", - "wayland-client 0.29.5", - "wayland-cursor 0.29.5", - "wayland-protocols 0.29.5", -] - [[package]] name = "smithay-client-toolkit" version = "0.18.1" @@ -7525,7 +7264,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" dependencies = [ "bitflags 2.4.2", - "calloop 0.12.4", + "calloop", "calloop-wayland-source", "cursor-icon", "libc", @@ -7536,8 +7275,8 @@ dependencies = [ "wayland-backend 0.3.3", "wayland-client 0.31.2", "wayland-csd-frame", - "wayland-cursor 0.31.1", - "wayland-protocols 0.31.2", + "wayland-cursor", + "wayland-protocols", "wayland-protocols-wlr", "wayland-scanner 0.31.1", "xkeysym", @@ -7550,7 +7289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c091e7354ea8059d6ad99eace06dd13ddeedbb0ac72d40a9a6e7ff790525882d" dependencies = [ "libc", - "smithay-client-toolkit 0.18.1", + "smithay-client-toolkit", "wayland-backend 0.3.3", ] @@ -7693,12 +7432,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "str-buf" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" - [[package]] name = "strfmt" version = "0.1.6" @@ -8071,20 +7804,6 @@ dependencies = [ "chrono", ] -[[package]] -name = "tiny-skia" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" -dependencies = [ - "arrayref", - "arrayvec 0.7.4", - "bytemuck", - "cfg-if 1.0.0", - "png 0.17.13", - "tiny-skia-path 0.8.4", -] - [[package]] name = "tiny-skia" version = "0.10.0" @@ -8115,17 +7834,6 @@ dependencies = [ "tiny-skia-path 0.11.4", ] -[[package]] -name = "tiny-skia-path" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adbfb5d3f3dd57a0e11d12f4f13d4ebbbc1b5c15b7ab0a156d030b21da5f677c" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", -] - [[package]] name = "tiny-skia-path" version = "0.10.0" @@ -8877,22 +8585,6 @@ dependencies = [ "wayland-sys 0.31.1", ] -[[package]] -name = "wayland-client" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" -dependencies = [ - "bitflags 1.3.2", - "downcast-rs", - "libc", - "nix 0.24.3", - "scoped-tls", - "wayland-commons", - "wayland-scanner 0.29.5", - "wayland-sys 0.29.5", -] - [[package]] name = "wayland-client" version = "0.30.2" @@ -8917,18 +8609,6 @@ dependencies = [ "wayland-scanner 0.31.1", ] -[[package]] -name = "wayland-commons" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" -dependencies = [ - "nix 0.24.3", - "once_cell", - "smallvec", - "wayland-sys 0.29.5", -] - [[package]] name = "wayland-csd-frame" version = "0.3.0" @@ -8940,17 +8620,6 @@ dependencies = [ "wayland-backend 0.3.3", ] -[[package]] -name = "wayland-cursor" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" -dependencies = [ - "nix 0.24.3", - "wayland-client 0.29.5", - "xcursor", -] - [[package]] name = "wayland-cursor" version = "0.31.1" @@ -8962,18 +8631,6 @@ dependencies = [ "xcursor", ] -[[package]] -name = "wayland-protocols" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" -dependencies = [ - "bitflags 1.3.2", - "wayland-client 0.29.5", - "wayland-commons", - "wayland-scanner 0.29.5", -] - [[package]] name = "wayland-protocols" version = "0.31.2" @@ -8995,7 +8652,7 @@ dependencies = [ "bitflags 2.4.2", "wayland-backend 0.3.3", "wayland-client 0.31.2", - "wayland-protocols 0.31.2", + "wayland-protocols", "wayland-scanner 0.31.1", ] @@ -9008,21 +8665,10 @@ dependencies = [ "bitflags 2.4.2", "wayland-backend 0.3.3", "wayland-client 0.31.2", - "wayland-protocols 0.31.2", + "wayland-protocols", "wayland-scanner 0.31.1", ] -[[package]] -name = "wayland-scanner" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" -dependencies = [ - "proc-macro2 1.0.78", - "quote 1.0.35", - "xml-rs", -] - [[package]] name = "wayland-scanner" version = "0.30.1" @@ -9045,17 +8691,6 @@ dependencies = [ "quote 1.0.35", ] -[[package]] -name = "wayland-sys" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" -dependencies = [ - "dlib", - "lazy_static", - "pkg-config", -] - [[package]] name = "wayland-sys" version = "0.30.1" @@ -9303,7 +8938,7 @@ dependencies = [ "log", "metal 0.27.0", "naga 0.19.2", - "ndk-sys 0.5.0+25.2.9519653", + "ndk-sys", "objc", "once_cell", "parking_lot 0.12.1", @@ -9412,27 +9047,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "window_clipboard" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63287c9c4396ccf5346d035a9b0fcaead9e18377637f5eaa78b7ac65c873ff7d" -dependencies = [ - "clipboard-win 4.5.0", - "clipboard_macos", - "clipboard_wayland", - "clipboard_x11", - "raw-window-handle 0.5.2", - "thiserror", -] - [[package]] name = "window_clipboard" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6d692d46038c433f9daee7ad8757e002a4248c20b0a3fbc991d99521d3bcb6d" dependencies = [ - "clipboard-win 5.2.0", + "clipboard-win", "clipboard_macos", "clipboard_wayland", "clipboard_x11", @@ -9666,41 +9287,6 @@ version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" -[[package]] -name = "winit" -version = "0.28.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" -dependencies = [ - "android-activity 0.4.3", - "bitflags 1.3.2", - "cfg_aliases 0.1.1", - "core-foundation 0.9.4", - "core-graphics 0.22.3", - "dispatch", - "instant", - "libc", - "log", - "mio 0.8.10", - "ndk 0.7.0", - "objc2 0.3.0-beta.3.patch-leaks.3", - "once_cell", - "orbclient", - "percent-encoding", - "raw-window-handle 0.5.2", - "redox_syscall 0.3.5", - "sctk-adwaita 0.5.4", - "smithay-client-toolkit 0.16.1", - "wasm-bindgen", - "wayland-client 0.29.5", - "wayland-commons", - "wayland-protocols 0.29.5", - "wayland-scanner 0.29.5", - "web-sys", - "windows-sys 0.45.0", - "x11-dl", -] - [[package]] name = "winit" version = "0.29.14" @@ -9708,11 +9294,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a3db69ffbe53a9babec7804da7a90f21020fcce1f2f5e5291e2311245b993d" dependencies = [ "ahash", - "android-activity 0.5.2", + "android-activity", "atomic-waker", "bitflags 2.4.2", "bytemuck", - "calloop 0.12.4", + "calloop", "cfg_aliases 0.1.1", "core-foundation 0.9.4", "core-graphics 0.23.1", @@ -9722,24 +9308,24 @@ dependencies = [ "libc", "log", "memmap2 0.9.4", - "ndk 0.8.0", - "ndk-sys 0.5.0+25.2.9519653", - "objc2 0.4.1", + "ndk", + "ndk-sys", + "objc2", "once_cell", "orbclient", "percent-encoding", "raw-window-handle 0.6.0", "redox_syscall 0.3.5", "rustix 0.38.31", - "sctk-adwaita 0.8.1", - "smithay-client-toolkit 0.18.1", + "sctk-adwaita", + "smithay-client-toolkit", "smol_str", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", "wayland-backend 0.3.3", "wayland-client 0.31.2", - "wayland-protocols 0.31.2", + "wayland-protocols", "wayland-protocols-plasma", "web-sys", "web-time", diff --git a/Cargo.toml b/Cargo.toml index 266bf25..19fa411 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,12 +18,12 @@ debug = ["iced/debug"] [dependencies] grin-gui-core = { version = "0.1.0-alpha.6", path = "crates/core", features = ["wgpu"]} -iced = { version = "0.10", features = ["canvas", "tokio"] } -iced_futures = { version = "0.7", features = ["async-std"] } -iced_style = {version = "0.9"} -iced_renderer = { version = "0.1" } -iced_core = { version = "0.10" } -iced_aw = { version = "0.6", default-features = false, features = ["card", "modal"]} +iced = { version = "0.12", features = ["canvas", "tokio"] } +iced_futures = { version = "0.12", features = ["async-std"] } +iced_style = {version = "0.12"} +iced_renderer = { version = "0.12" } +iced_core = { version = "0.12" } +iced_aw = { version = "0.8", default-features = false, features = ["card", "modal"]} plotters-iced = "0.9.0" plotters="0.3" diff --git a/crates/core/src/theme/mod.rs b/crates/core/src/theme/mod.rs index bfc4956..2eb2810 100644 --- a/crates/core/src/theme/mod.rs +++ b/crates/core/src/theme/mod.rs @@ -45,16 +45,16 @@ pub struct Theme { } pub type Renderer = IRenderer; -pub type Element<'a, Message> = iced::Element<'a, Message, Renderer>; -pub type Container<'a, Message> = iced::widget::Container<'a, Message, Renderer>; -pub type Column<'a, Message> = iced::widget::Column<'a, Message, Renderer>; -pub type Row<'a, Message> = iced::widget::Row<'a, Message, Renderer>; -pub type Text<'a> = iced::widget::Text<'a, Renderer>; -pub type TextInput<'a, Message> = iced::widget::TextInput<'a, Message, Renderer>; -pub type Button<'a, Message> = iced::widget::Button<'a, Message, Renderer>; -pub type Scrollable<'a, Message> = iced::widget::Scrollable<'a, Message, Renderer>; +pub type Container<'a, Message> = iced::widget::Container<'a, Message, Theme, Renderer>; +pub type Element<'a, Message> = iced::Element<'a, Message, Theme, Renderer>; +pub type Column<'a, Message> = iced::widget::Column<'a, Message, Theme, Renderer>; +pub type Row<'a, Message> = iced::widget::Row<'a, Message, Theme, Renderer>; +pub type Text<'a> = iced::widget::Text<'a, Theme, Renderer>; +pub type TextInput<'a, Message> = iced::widget::TextInput<'a, Message, Theme, Renderer>; +pub type Button<'a, Message> = iced::widget::Button<'a, Message, Theme, Renderer>; +pub type Scrollable<'a, Message> = iced::widget::Scrollable<'a, Message, Theme, Renderer>; pub type PickList<'a, T, Message> = iced::widget::PickList<'a, T, Message, Theme, Renderer>; -pub type Radio = iced::widget::Radio; +pub type Radio = iced::widget::Radio; pub type Card<'a, Message> = iced_aw::native::Card<'a, Message, Theme, Renderer>; pub type Modal<'a, Content, Message> = iced_aw::modal::Modal<'a, Content, Message>; pub type Header<'a, Message> = crate::widget::header::Header<'a, Message, Theme, Renderer>; diff --git a/crates/core/src/widget/header.rs b/crates/core/src/widget/header.rs index 3a9622e..a445bf1 100644 --- a/crates/core/src/widget/header.rs +++ b/crates/core/src/widget/header.rs @@ -6,10 +6,7 @@ use iced_core::{ Alignment, Clipboard, Element, Event, Layout, Length, Padding, Rectangle, Shell, Widget, }; -use iced::{ - widget::{space::Space, Container}, - Size, -}; +use iced::{widget::space::Space, Size}; mod state; pub use state::State; @@ -41,7 +38,7 @@ where { pub fn new( state: State, - headers: Vec<(String, Container<'a, Message, Theme, Renderer>)>, + headers: Vec<(String, Element<'a, Message, Theme, Renderer>)>, left_margin: Option, right_margin: Option, ) -> Self diff --git a/src/gui/element/menu.rs b/src/gui/element/menu.rs index ef19687..403de86 100644 --- a/src/gui/element/menu.rs +++ b/src/gui/element/menu.rs @@ -1,10 +1,13 @@ +use iced_style::container::StyleSheet; use { super::{DEFAULT_FONT_SIZE, DEFAULT_PADDING, SMALLER_FONT_SIZE}, crate::gui::{GrinGui, Interaction, Message}, crate::localization::localized_string, crate::VERSION, grin_gui_core::theme::ColorPalette, - grin_gui_core::theme::{Button, Column, Container, Element, PickList, Row, Scrollable, Text}, + grin_gui_core::theme::{ + Button, Column, Container, Element, PickList, Row, Scrollable, Text, Theme, + }, iced::widget::{button, pick_list, scrollable, text_input, Checkbox, Space, TextInput}, iced::{alignment, Alignment, Command, Length}, serde::{Deserialize, Serialize}, diff --git a/src/gui/element/node/embedded/mod.rs b/src/gui/element/node/embedded/mod.rs index 151b76f..8c5c0be 100644 --- a/src/gui/element/node/embedded/mod.rs +++ b/src/gui/element/node/embedded/mod.rs @@ -1,4 +1,5 @@ use crate::gui::element::DEFAULT_PADDING; +use iced_style::container::StyleSheet; pub mod summary; @@ -8,9 +9,10 @@ use { grin_gui_core::node::ChainTypes, grin_gui_core::node::ServerStats, grin_gui_core::theme::ColorPalette, - grin_gui_core::theme::{Column, Container}, + grin_gui_core::theme::{Column, Container, Element}, iced::widget::container, - iced::{Command, Length}, + iced::Command, + iced_core::Length, }; pub struct StateContainer { @@ -55,7 +57,7 @@ pub fn data_container<'a>( Mode::Summary => { summary::data_container(&state.summary_state, &state.server_stats, chain_type) } - _ => Container::new(Column::new()), + _ => Container::new(Column::new()).into(), }; let column = Column::new().push(content); @@ -66,10 +68,10 @@ pub fn data_container<'a>( .width(Length::Fill) .height(Length::Fill) .style(grin_gui_core::theme::ContainerStyle::NormalBackground) - .padding(iced::Padding::from([ - DEFAULT_PADDING, // top - DEFAULT_PADDING, // right - DEFAULT_PADDING, // bottom - DEFAULT_PADDING, // left - ])) + .padding(iced::Padding { + top: DEFAULT_PADDING, // top + right: DEFAULT_PADDING, // right + bottom: DEFAULT_PADDING, // bottom + left: DEFAULT_PADDING, // left + }) } diff --git a/src/gui/element/node/embedded/summary.rs b/src/gui/element/node/embedded/summary.rs index a441ec6..0ff5abc 100644 --- a/src/gui/element/node/embedded/summary.rs +++ b/src/gui/element/node/embedded/summary.rs @@ -11,7 +11,7 @@ use { crate::Result, grin_gui_core::node::{ChainTypes, ServerStats, SyncStatus}, grin_gui_core::theme::ColorPalette, - grin_gui_core::theme::{Column, Container, Row, Scrollable, Text}, + grin_gui_core::theme::{Column, Container, Element, Row, Scrollable, Text}, iced::widget::{scrollable, Space}, iced::{alignment, Alignment, Command, Length}, }; diff --git a/src/gui/element/node/mod.rs b/src/gui/element/node/mod.rs index f12bf18..dd66c99 100644 --- a/src/gui/element/node/mod.rs +++ b/src/gui/element/node/mod.rs @@ -3,7 +3,10 @@ pub mod embedded; use { crate::gui::Message, grin_gui_core::theme::{Column, Container}, - grin_gui_core::{node::ChainTypes, theme::ColorPalette}, + grin_gui_core::{ + node::ChainTypes, + theme::{ColorPalette, Element}, + }, iced::Length, }; diff --git a/src/gui/element/wallet/mod.rs b/src/gui/element/wallet/mod.rs index 02ff775..f689de5 100644 --- a/src/gui/element/wallet/mod.rs +++ b/src/gui/element/wallet/mod.rs @@ -5,7 +5,7 @@ use { crate::gui::Message, grin_gui_core::config::Config, grin_gui_core::theme::ColorPalette, - grin_gui_core::theme::{Column, Container}, + grin_gui_core::theme::{Column, Container, Element, Theme}, iced::Length, }; diff --git a/src/gui/element/wallet/operation/apply_tx.rs b/src/gui/element/wallet/operation/apply_tx.rs index 269e2bc..8a22710 100644 --- a/src/gui/element/wallet/operation/apply_tx.rs +++ b/src/gui/element/wallet/operation/apply_tx.rs @@ -1,11 +1,11 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; +use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, wallet::{Slate, Slatepack, TxLogEntry, TxLogEntryType}, }; -use grin_gui_widgets::widget::header; use iced_aw::Card; use iced_core::Widget; use serde::de; diff --git a/src/gui/element/wallet/operation/apply_tx_confirm.rs b/src/gui/element/wallet/operation/apply_tx_confirm.rs index bc0fad3..eeffaca 100644 --- a/src/gui/element/wallet/operation/apply_tx_confirm.rs +++ b/src/gui/element/wallet/operation/apply_tx_confirm.rs @@ -1,6 +1,7 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; +use grin_gui_core::widget::header; use grin_gui_core::{ config::{Config, TxMethod}, wallet::{ @@ -8,7 +9,6 @@ use grin_gui_core::{ TxLogEntry, TxLogEntryType, }, }; -use grin_gui_widgets::widget::header; use iced_aw::Card; use iced_core::Widget; use std::fs::{self, File}; diff --git a/src/gui/element/wallet/operation/create_tx.rs b/src/gui/element/wallet/operation/create_tx.rs index 12d9a13..4f56804 100644 --- a/src/gui/element/wallet/operation/create_tx.rs +++ b/src/gui/element/wallet/operation/create_tx.rs @@ -1,12 +1,12 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; +use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, error::GrinWalletInterfaceError, wallet::{TxLogEntry, TxLogEntryType}, }; -use grin_gui_widgets::widget::header; use iced_aw::Card; use iced_core::Widget; use std::fs::File; diff --git a/src/gui/element/wallet/operation/create_tx_contracts.rs b/src/gui/element/wallet/operation/create_tx_contracts.rs index 6f33d4c..300aa48 100644 --- a/src/gui/element/wallet/operation/create_tx_contracts.rs +++ b/src/gui/element/wallet/operation/create_tx_contracts.rs @@ -1,6 +1,7 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; +use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, error::GrinWalletInterfaceError, @@ -9,7 +10,6 @@ use grin_gui_core::{ TxLogEntryType, }, }; -use grin_gui_widgets::widget::header; use iced_aw::Card; use iced_core::Widget; use std::fs::File; diff --git a/src/gui/element/wallet/operation/home.rs b/src/gui/element/wallet/operation/home.rs index 5586c29..eb35e21 100644 --- a/src/gui/element/wallet/operation/home.rs +++ b/src/gui/element/wallet/operation/home.rs @@ -9,11 +9,11 @@ use chrono::{DateTime, DurationRound, TimeZone, Utc}; use grin_gui_core::error::GrinWalletInterfaceError; use grin_gui_core::node::SyncStatus; use grin_gui_core::wallet::SlatepackAddress; +use grin_gui_core::widget::header; use grin_gui_core::{ config::{Config, Currency}, wallet::{InvoiceProof, RetrieveTxQueryArgs, TxLogEntry, TxLogEntryType}, }; -use grin_gui_widgets::widget::header; use iced::Point; use iced_aw::Card; use iced_core::Widget; diff --git a/src/gui/element/wallet/operation/tx_detail.rs b/src/gui/element/wallet/operation/tx_detail.rs index 6c01635..928590f 100644 --- a/src/gui/element/wallet/operation/tx_detail.rs +++ b/src/gui/element/wallet/operation/tx_detail.rs @@ -1,12 +1,12 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; +use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, error::GrinWalletInterfaceError, wallet::{TxLogEntry, TxLogEntryType}, }; -use grin_gui_widgets::widget::header; use iced_aw::Card; use iced_core::Widget; use std::fs::File; diff --git a/src/gui/element/wallet/operation/tx_list.rs b/src/gui/element/wallet/operation/tx_list.rs index 7146545..1607706 100644 --- a/src/gui/element/wallet/operation/tx_list.rs +++ b/src/gui/element/wallet/operation/tx_list.rs @@ -12,13 +12,13 @@ use { Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, TextInput, }, + grin_gui_core::widget::header, grin_gui_core::{ config::Config, node::amount_to_hr_string, theme::{ButtonStyle, ColorPalette, ContainerStyle}, wallet::{TxLogEntry, TxLogEntryType}, }, - grin_gui_widgets::widget::header, iced::widget::{button, pick_list, scrollable, text_input, Space}, iced::{alignment, Alignment, Command, Length}, serde::{Deserialize, Serialize}, @@ -895,7 +895,7 @@ pub fn titles_row_header<'a>( column_state: &'a [ColumnState], previous_column_key: Option, previous_sort_direction: Option, -) -> Header<'a, Message> { +) -> Container<'a, Message> { // A row containing titles above the addon rows. let mut row_titles = vec![]; @@ -1894,9 +1894,10 @@ pub fn data_row_container<'a, 'b>( }); if is_odd == Some(true) { - table_row = table_row.style(grin_gui_core::theme::TableRowStyle::TableRowAlternate) + table_row = + table_row.style(grin_gui_core::style::table_row::TableRowStyle::TableRowAlternate) } else { - table_row = table_row.style(grin_gui_core::theme::TableRowStyle::Default) + table_row = table_row.style(grin_gui_core::style::table_row::TableRowStyle::Default) } // Due to what feels like an iced-rs bug, don't put buttons within the actual row as they appear diff --git a/src/gui/element/wallet/operation/tx_list_display.rs b/src/gui/element/wallet/operation/tx_list_display.rs index 184f5a0..11f1b28 100644 --- a/src/gui/element/wallet/operation/tx_list_display.rs +++ b/src/gui/element/wallet/operation/tx_list_display.rs @@ -2,11 +2,11 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; use chrono::DurationRound; +use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, wallet::{TxLogEntry, TxLogEntryType}, }; -use grin_gui_widgets::widget::header; use iced_aw::Card; use iced_core::Widget; use std::{borrow::Borrow, path::PathBuf, str::FromStr}; diff --git a/src/gui/element/wallet/operation/tx_proof.rs b/src/gui/element/wallet/operation/tx_proof.rs index 397a233..7b73eb1 100644 --- a/src/gui/element/wallet/operation/tx_proof.rs +++ b/src/gui/element/wallet/operation/tx_proof.rs @@ -1,12 +1,12 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; +use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, error::GrinWalletInterfaceError, wallet::{InvoiceProof, SlatepackAddress, TxLogEntry, TxLogEntryType}, }; -use grin_gui_widgets::widget::header; use iced_aw::Card; use iced_core::Widget; use std::fs::File; diff --git a/src/gui/element/wallet/setup/wallet_list.rs b/src/gui/element/wallet/setup/wallet_list.rs index f0f770d..5fb56aa 100644 --- a/src/gui/element/wallet/setup/wallet_list.rs +++ b/src/gui/element/wallet/setup/wallet_list.rs @@ -22,7 +22,7 @@ use { std::sync::{Arc, RwLock}, }; -use grin_gui_widgets::widget::table_row; +use grin_gui_core::widget::table_row; use isahc::head; use crate::gui::element::DEFAULT_SUB_HEADER_FONT_SIZE; @@ -317,13 +317,16 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain if selected_wallet { // selected wallet should be highlighted - table_row = table_row.style(grin_gui_core::theme::TableRowStyle::TableRowSelected); + table_row = + table_row.style(grin_gui_core::style::table_row::TableRowStyle::TableRowSelected); } else { // contrast row styles to spice things up if pos % 2 == 0 { - table_row = table_row.style(grin_gui_core::theme::TableRowStyle::TableRowLowlife); + table_row = table_row + .style(grin_gui_core::style::table_row::TableRowStyle::TableRowLowlife); } else { - table_row = table_row.style(grin_gui_core::theme::TableRowStyle::TableRowHighlife); + table_row = table_row + .style(grin_gui_core::style::table_row::TableRowStyle::TableRowHighlife); } } diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 57226b6..340d046 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -145,9 +145,9 @@ impl Application for GrinGui { type Executor = iced::executor::Default; type Message = Message; type Flags = Config; - type Theme = Theme; + type Theme = iced::Theme; - fn theme(&self) -> Theme { + fn theme(&self) -> iced::Theme { self.theme.clone() } From 21f6ed5af1366e4e482c734f33ead9dd57c30a2a Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Wed, 20 Mar 2024 12:57:53 +0000 Subject: [PATCH 05/12] more updates --- Cargo.lock | 1463 +++++------------ Cargo.toml | 2 +- crates/core/src/theme/mod.rs | 5 +- src/gui/element/settings/general.rs | 28 +- .../wallet/operation/create_tx_contracts.rs | 15 +- src/gui/element/wallet/operation/open.rs | 2 +- src/gui/element/wallet/operation/tx_list.rs | 5 +- src/gui/mod.rs | 30 +- src/gui/update.rs | 36 +- 9 files changed, 458 insertions(+), 1128 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad2ba01..1217458 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -94,9 +94,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.9" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if 1.0.0", "getrandom 0.2.12", @@ -107,9 +107,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -133,7 +133,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" dependencies = [ "android-properties", - "bitflags 2.4.2", + "bitflags 2.5.0", "cc", "cesu8", "jni", @@ -179,9 +179,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.80" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" [[package]] name = "approx" @@ -200,9 +200,9 @@ checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" [[package]] name = "arc-swap" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" +checksum = "7b3d0060af21e8d11a926981cc00c6c1541aa91dd64b9f881985c3da1094425f" [[package]] name = "arrayref" @@ -280,7 +280,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 5.1.0", + "event-listener 5.2.0", "event-listener-strategy 0.5.0", "futures-core", "pin-project-lite 0.2.13", @@ -296,7 +296,7 @@ dependencies = [ "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "slab", ] @@ -308,10 +308,10 @@ checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel 2.2.0", "async-executor", - "async-io 2.3.1", + "async-io 2.3.2", "async-lock 3.3.0", "blocking", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "once_cell", ] @@ -337,18 +337,18 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65" +checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" dependencies = [ "async-lock 3.3.0", "cfg-if 1.0.0", "concurrent-queue", "futures-io", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "parking", "polling 3.5.0", - "rustix 0.38.31", + "rustix 0.38.32", "slab", "tracing", "windows-sys 0.52.0", @@ -387,7 +387,7 @@ dependencies = [ "cfg-if 1.0.0", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.31", + "rustix 0.38.32", "windows-sys 0.48.0", ] @@ -397,13 +397,13 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.3.1", + "async-io 2.3.2", "async-lock 2.8.0", "atomic-waker", "cfg-if 1.0.0", "futures-core", "futures-io", - "rustix 0.38.31", + "rustix 0.38.32", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -582,9 +582,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "blake2-rfc" @@ -682,7 +682,7 @@ dependencies = [ "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite 2.2.0", + "futures-lite 2.3.0", "piper", "tracing", ] @@ -705,9 +705,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.15.3" +version = "3.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" +checksum = "7ff69b9dd49fd426c69a0db9fc04dd934cdb6645ff000864d98f7e2af8830eaa" [[package]] name = "byte-tools" @@ -717,22 +717,22 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.14.3" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" +checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" +checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -800,10 +800,10 @@ version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "log", "polling 3.5.0", - "rustix 0.38.31", + "rustix 0.38.32", "slab", "thiserror", ] @@ -815,9 +815,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ "calloop", - "rustix 0.38.31", - "wayland-backend 0.3.3", - "wayland-client 0.31.2", + "rustix 0.38.32", + "wayland-backend", + "wayland-client", ] [[package]] @@ -840,10 +840,11 @@ checksum = "a2698f953def977c68f935bb0dfa959375ad4638570e969e2f1e9f433cbf1af6" [[package]] name = "cc" -version = "1.0.86" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9fa1897e4325be0d68d48df6aa1a71ac2ed4d27723887e7754192705350730" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" dependencies = [ + "jobserver", "libc", ] @@ -913,9 +914,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -923,7 +924,7 @@ dependencies = [ "num-traits 0.2.18", "serde", "wasm-bindgen", - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -953,9 +954,9 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f9a0700e0127ba15d1d52dd742097f821cd9c65939303a44d970465040a297" +checksum = "d517d4b86184dbb111d3556a10f1c8a04da7428d2987bf1081602bf11c3aa9ee" dependencies = [ "error-code", ] @@ -987,7 +988,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4274ea815e013e0f9f04a2633423e14194e408a0576c943ce3d14ca56c50031c" dependencies = [ "thiserror", - "x11rb 0.13.0", + "x11rb", ] [[package]] @@ -1070,12 +1071,6 @@ dependencies = [ "com_macros", ] -[[package]] -name = "com-rs" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" - [[package]] name = "com_macros" version = "0.6.0" @@ -1083,7 +1078,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d375883580a668c7481ea6631fc1a8863e33cc335bf56bfad8d7e6d4b04b13a5" dependencies = [ "com_macros_support", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "syn 1.0.109", ] @@ -1093,7 +1088,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad899a1087a9296d5644792d7cb72b8e34c1bec8e7d4fbc002230169a6e8710c" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", ] @@ -1216,38 +1211,18 @@ dependencies = [ "libc", ] -[[package]] -name = "cosmic-text" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0b68966c2543609f8d92f9d33ac3b719b2a67529b0c6c0b3e025637b477eef9" -dependencies = [ - "aliasable", - "fontdb 0.14.1", - "libm", - "log", - "rangemap", - "rustybuzz 0.8.0", - "swash", - "sys-locale", - "unicode-bidi", - "unicode-linebreak", - "unicode-script", - "unicode-segmentation", -] - [[package]] name = "cosmic-text" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75acbfb314aeb4f5210d379af45ed1ec2c98c7f1790bf57b8a4c562ac0c51b71" dependencies = [ - "fontdb 0.15.0", + "fontdb", "libm", "log", "rangemap", "rustc-hash", - "rustybuzz 0.11.0", + "rustybuzz", "self_cell 1.0.3", "swash", "sys-locale", @@ -1382,7 +1357,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -1454,25 +1429,14 @@ dependencies = [ "zeroize", ] -[[package]] -name = "d3d12" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da" -dependencies = [ - "bitflags 1.3.2", - "libloading 0.7.4", - "winapi 0.3.9", -] - [[package]] name = "d3d12" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" dependencies = [ - "bitflags 2.4.2", - "libloading 0.8.1", + "bitflags 2.5.0", + "libloading 0.8.3", "winapi 0.3.9", ] @@ -1494,7 +1458,7 @@ checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "strsim 0.10.0", "syn 1.0.109", @@ -1653,9 +1617,9 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -1664,7 +1628,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading 0.8.1", + "libloading 0.8.3", ] [[package]] @@ -1679,11 +1643,11 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0f8a69e60d75ae7dab4ef26a59ca99f2a89d4c142089b537775ae0c198bdcde" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "drm-ffi", "drm-fourcc", - "rustix 0.38.31", + "rustix 0.38.32", ] [[package]] @@ -1693,7 +1657,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41334f8405792483e32ad05fbb9c5680ff4e84491883d2947a4757dc54cb2ac6" dependencies = [ "drm-sys", - "rustix 0.38.31", + "rustix 0.38.32", ] [[package]] @@ -1886,9 +1850,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.1.0" +version = "5.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7ad6fd685ce13acd6d9541a30f6db6567a7a24c9ffd4ba2955d29e3f22c8b27" +checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" dependencies = [ "concurrent-queue", "parking", @@ -1911,7 +1875,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" dependencies = [ - "event-listener 5.1.0", + "event-listener 5.2.0", "pin-project-lite 0.2.13", ] @@ -2086,9 +2050,9 @@ dependencies = [ [[package]] name = "font-types" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd7f3ea17572640b606b35df42cfb6ecdf003704b062580e59918692190b73d" +checksum = "5b7f6040d337bd44434ab21fc6509154edf2cece88b23758d9d64654c4e7730b" [[package]] name = "fontconfig-parser" @@ -2099,19 +2063,6 @@ dependencies = [ "roxmltree", ] -[[package]] -name = "fontdb" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8d8cbea8f21307d7e84bca254772981296f058a1d36b461bf4d83a7499fc9e" -dependencies = [ - "log", - "memmap2 0.6.2", - "slotmap", - "tinyvec", - "ttf-parser 0.19.2", -] - [[package]] name = "fontdb" version = "0.15.0" @@ -2151,9 +2102,9 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -2302,9 +2253,9 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ "fastrand 2.0.1", "futures-core", @@ -2319,9 +2270,9 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -2418,16 +2369,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "gethostname" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" -dependencies = [ - "libc", - "winapi 0.3.9", -] - [[package]] name = "gethostname" version = "0.4.3" @@ -2523,12 +2464,6 @@ dependencies = [ "xml-rs", ] -[[package]] -name = "glam" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5418c17512bdf42730f9032c74e1ae39afc408745ebb2acf72fbc4691c17945" - [[package]] name = "glam" version = "0.25.0" @@ -2563,18 +2498,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "glow" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "glow" version = "0.13.1" @@ -2596,28 +2519,16 @@ dependencies = [ "gl_generator", ] -[[package]] -name = "glyphon" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e87caa7459145f5e5f167bf34db4532901404c679e62339fb712a0e3ccf722a" -dependencies = [ - "cosmic-text 0.9.0", - "etagere", - "lru 0.11.1", - "wgpu 0.16.3", -] - [[package]] name = "glyphon" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a62d0338e4056db6a73221c2fb2e30619452f6ea9651bac4110f51b0f7a7581" dependencies = [ - "cosmic-text 0.10.0", + "cosmic-text", "etagere", - "lru 0.12.3", - "wgpu 0.19.3", + "lru", + "wgpu", ] [[package]] @@ -2631,33 +2542,14 @@ dependencies = [ "system-deps", ] -[[package]] -name = "gpu-alloc" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22beaafc29b38204457ea030f6fb7a84c9e4dd1b86e311ba0542533453d87f62" -dependencies = [ - "bitflags 1.3.2", - "gpu-alloc-types 0.2.0", -] - [[package]] name = "gpu-alloc" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" dependencies = [ - "bitflags 2.4.2", - "gpu-alloc-types 0.3.0", -] - -[[package]] -name = "gpu-alloc-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" -dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", + "gpu-alloc-types", ] [[package]] @@ -2666,20 +2558,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" dependencies = [ - "bitflags 2.4.2", -] - -[[package]] -name = "gpu-allocator" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" -dependencies = [ - "backtrace", - "log", - "thiserror", - "winapi 0.3.9", - "windows 0.44.0", + "bitflags 2.5.0", ] [[package]] @@ -2692,7 +2571,7 @@ dependencies = [ "presser", "thiserror", "winapi 0.3.9", - "windows 0.52.0", + "windows", ] [[package]] @@ -2701,7 +2580,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "gpu-descriptor-types", "hashbrown 0.14.3", ] @@ -2712,7 +2591,7 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", ] [[package]] @@ -2728,10 +2607,10 @@ dependencies = [ "grin-gui-core", "iced", "iced_aw", - "iced_core 0.12.3", - "iced_futures 0.12.0", - "iced_renderer 0.12.1", - "iced_style 0.12.1", + "iced_core", + "iced_futures", + "iced_renderer", + "iced_style", "image 0.23.14", "isahc 0.9.14", "isolang", @@ -2749,7 +2628,7 @@ dependencies = [ "plotters-backend", "plotters-iced", "rand 0.8.5", - "reqwest 0.11.24", + "reqwest 0.11.27", "rfd", "serde", "serde_json", @@ -2790,11 +2669,11 @@ dependencies = [ "grin_wallet_util", "iced", "iced_aw", - "iced_core 0.12.3", - "iced_futures 0.12.0", - "iced_graphics 0.12.1", - "iced_renderer 0.12.1", - "iced_style 0.12.1", + "iced_core", + "iced_futures", + "iced_graphics", + "iced_renderer", + "iced_style", "isahc 1.7.2", "lazy_static", "log", @@ -3308,9 +3187,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ "bytes 1.5.0", "fnv", @@ -3318,7 +3197,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.3", + "indexmap 2.2.5", "slab", "tokio 1.36.0", "tokio-util 0.7.10", @@ -3327,9 +3206,9 @@ dependencies = [ [[package]] name = "half" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" +checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" dependencies = [ "cfg-if 1.0.0", "crunchy", @@ -3351,31 +3230,16 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "hassle-rs" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" -dependencies = [ - "bitflags 1.3.2", - "com-rs", - "libc", - "libloading 0.7.4", - "thiserror", - "widestring", - "winapi 0.3.9", -] - [[package]] name = "hassle-rs" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af2a7e73e1f34c48da31fb668a907f250794837e08faa144fd24f0b8b741e890" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "com", "libc", - "libloading 0.8.1", + "libloading 0.8.3", "thiserror", "widestring", "winapi 0.3.9", @@ -3407,9 +3271,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.6" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hexf-parse" @@ -3457,9 +3321,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes 1.5.0", "fnv", @@ -3548,7 +3412,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.24", + "h2 0.3.25", "http", "http-body 0.4.6", "httparse", @@ -3644,7 +3508,7 @@ dependencies = [ "serde", "serde_derive", "thiserror", - "toml 0.8.10", + "toml 0.8.12", "unic-langid", ] @@ -3654,7 +3518,7 @@ version = "0.13.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92a86226a7a16632de6723449ee5fe70bac5af718bc642ee9ca2f0f6e14fa1fa" dependencies = [ - "arc-swap 1.6.0", + "arc-swap 1.7.0", "fluent", "fluent-langneg", "fluent-syntax", @@ -3683,10 +3547,10 @@ dependencies = [ "i18n-embed", "lazy_static", "proc-macro-error", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "strsim 0.10.0", - "syn 2.0.50", + "syn 2.0.53", "unic-langid", ] @@ -3698,9 +3562,9 @@ checksum = "81093c4701672f59416582fe3145676126fd23ba5db910acad0793c1108aaa58" dependencies = [ "find-crate", "i18n-config", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -3732,10 +3596,10 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d4eb0fbbefb8c428b70680e77ed9013887b17c1d6be366b40f264f956d1a096" dependencies = [ - "iced_core 0.12.3", - "iced_futures 0.12.0", - "iced_renderer 0.12.1", - "iced_widget 0.12.3", + "iced_core", + "iced_futures", + "iced_renderer", + "iced_widget", "iced_winit", "thiserror", ] @@ -3750,28 +3614,14 @@ dependencies = [ "iced", ] -[[package]] -name = "iced_core" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d0bc4fbf018576d08d93f838e6058cc6f10bbc05e04ae249a2a44dffb4ebc8" -dependencies = [ - "bitflags 1.3.2", - "instant", - "log", - "palette", - "thiserror", - "twox-hash", -] - [[package]] name = "iced_core" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d7e6bbd197f311ed3d8b71651876b0ce01318fde52cda862a9a7a4373c9b930" dependencies = [ - "bitflags 2.4.2", - "glam 0.25.0", + "bitflags 2.5.0", + "glam", "log", "num-traits 0.2.18", "palette", @@ -3782,19 +3632,6 @@ dependencies = [ "xxhash-rust", ] -[[package]] -name = "iced_futures" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14dab0054a9c7a1cbce227a8cd9ee4a094497b3d06094551ac6c1488d563802e" -dependencies = [ - "futures 0.3.30", - "iced_core 0.10.0", - "log", - "wasm-bindgen-futures", - "wasm-timer", -] - [[package]] name = "iced_futures" version = "0.12.0" @@ -3803,42 +3640,25 @@ checksum = "370bad88fb3832cbeeb3fa6c486b4701fb7e8da32a753b3101d4ce81fc1d9497" dependencies = [ "async-std", "futures 0.3.30", - "iced_core 0.12.3", + "iced_core", "log", "tokio 1.36.0", "wasm-bindgen-futures", "wasm-timer", ] -[[package]] -name = "iced_graphics" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ff14447a221e9e9205a13d84d7bbdf0636a3b1daa02cfca690ed09689c4d2b" -dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "glam 0.24.2", - "half", - "iced_core 0.10.0", - "log", - "lyon_path", - "raw-window-handle 0.5.2", - "thiserror", -] - [[package]] name = "iced_graphics" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a044c193ef0840eacabfa05424717331d1fc5b3ecb9a89316200c75da2ba9a4" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", - "cosmic-text 0.10.0", + "cosmic-text", "half", - "iced_core 0.12.3", - "iced_futures 0.12.0", + "iced_core", + "iced_futures", "log", "lyon_path", "once_cell", @@ -3849,96 +3669,42 @@ dependencies = [ "xxhash-rust", ] -[[package]] -name = "iced_renderer" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1033385b0db0099a0d13178c9ff93c1ce11e7d0177522acf578bf79febdb2af8" -dependencies = [ - "iced_graphics 0.9.0", - "iced_tiny_skia 0.1.0", - "iced_wgpu 0.11.1", - "log", - "raw-window-handle 0.5.2", - "thiserror", -] - [[package]] name = "iced_renderer" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c281e03001d566058f53dec9325bbe61c62da715341206d2627f57a3ecc7f69" dependencies = [ - "iced_graphics 0.12.1", - "iced_tiny_skia 0.12.1", - "iced_wgpu 0.12.1", + "iced_graphics", + "iced_tiny_skia", + "iced_wgpu", "log", "thiserror", ] -[[package]] -name = "iced_runtime" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c6c89853e1250c6fac82c5015fa2144517be9b33d4b8e456f10e198b23e28bd" -dependencies = [ - "iced_core 0.10.0", - "iced_futures 0.7.0", - "thiserror", -] - [[package]] name = "iced_runtime" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a79f852c01cc6d61663c94379cb3974ac3ad315a28c504e847d573e094f46822" dependencies = [ - "iced_core 0.12.3", - "iced_futures 0.12.0", + "iced_core", + "iced_futures", "raw-window-handle 0.6.0", "thiserror", ] -[[package]] -name = "iced_style" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d85c47d9d13e2281f75ddf98c865daf2101632bd2b855c401dd0b1c8b81a31a0" -dependencies = [ - "iced_core 0.10.0", - "once_cell", - "palette", -] - [[package]] name = "iced_style" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ea42a740915d2a5a9ff9c3aa0bca28b16e9fb660bc8f675eed71d186cadb579" dependencies = [ - "iced_core 0.12.3", + "iced_core", "once_cell", "palette", ] -[[package]] -name = "iced_tiny_skia" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7715f6222c9470bbbd75a39f70478fa0d1bdfb81a377a34fd1b090ffccc480b" -dependencies = [ - "bytemuck", - "cosmic-text 0.9.0", - "iced_graphics 0.9.0", - "kurbo 0.9.5", - "log", - "raw-window-handle 0.5.2", - "rustc-hash", - "softbuffer 0.2.1", - "tiny-skia 0.10.0", - "twox-hash", -] - [[package]] name = "iced_tiny_skia" version = "0.12.1" @@ -3946,69 +3712,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c2228781f4d381a1cbbd7905a9f077351aa8d37269094021d5d9e779f130aff" dependencies = [ "bytemuck", - "cosmic-text 0.10.0", - "iced_graphics 0.12.1", - "kurbo 0.10.4", + "cosmic-text", + "iced_graphics", + "kurbo", "log", "rustc-hash", - "softbuffer 0.4.1", - "tiny-skia 0.11.4", + "softbuffer", + "tiny-skia", "xxhash-rust", ] -[[package]] -name = "iced_wgpu" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703f7c5de46b997ed7b18e05ec67059dcdf3beeac51e917c21071b021bb848b9" -dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "futures 0.3.30", - "glam 0.24.2", - "glyphon 0.3.0", - "guillotiere", - "iced_graphics 0.9.0", - "log", - "lyon", - "once_cell", - "raw-window-handle 0.5.2", - "rustc-hash", - "twox-hash", - "wgpu 0.16.3", -] - [[package]] name = "iced_wgpu" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c243b6700452886aac1ee1987e84d9fb43b56b53fea9a1eb67713fd0fde244" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "futures 0.3.30", - "glam 0.25.0", - "glyphon 0.5.0", + "glam", + "glyphon", "guillotiere", - "iced_graphics 0.12.1", + "iced_graphics", "log", "lyon", "once_cell", - "wgpu 0.19.3", -] - -[[package]] -name = "iced_widget" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a177219ae51c3ba08f228ab932354b360cc669e94aec50c01e7c9b675f074c7c" -dependencies = [ - "iced_renderer 0.1.0", - "iced_runtime 0.1.1", - "iced_style 0.9.0", - "num-traits 0.2.18", - "thiserror", - "unicode-segmentation", + "wgpu", ] [[package]] @@ -4017,9 +3747,9 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e01b2212adecf1cb80e2267f302c0e0c263e55f97812056949199ccf9f0b908" dependencies = [ - "iced_renderer 0.12.1", - "iced_runtime 0.12.1", - "iced_style 0.12.1", + "iced_renderer", + "iced_runtime", + "iced_style", "num-traits 0.2.18", "ouroboros", "thiserror", @@ -4032,9 +3762,9 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63f66831d0e399b93f631739121a6171780d344b275d56808b9504d8ca75c7d2" dependencies = [ - "iced_graphics 0.12.1", - "iced_runtime 0.12.1", - "iced_style 0.12.1", + "iced_graphics", + "iced_runtime", + "iced_style", "log", "thiserror", "tracing", @@ -4116,9 +3846,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -4158,7 +3888,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.6", + "hermit-abi 0.3.9", "libc", "windows-sys 0.48.0", ] @@ -4184,7 +3914,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" dependencies = [ - "hermit-abi 0.3.6", + "hermit-abi 0.3.9", "libc", "windows-sys 0.52.0", ] @@ -4307,6 +4037,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" +dependencies = [ + "libc", +] + [[package]] name = "jpeg-decoder" version = "0.1.22" @@ -4324,9 +4063,9 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" [[package]] name = "js-sys" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -4374,17 +4113,6 @@ dependencies = [ "winapi-build", ] -[[package]] -name = "khronos-egl" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" -dependencies = [ - "libc", - "libloading 0.7.4", - "pkg-config", -] - [[package]] name = "khronos-egl" version = "6.0.0" @@ -4392,7 +4120,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", - "libloading 0.8.1", + "libloading 0.8.3", "pkg-config", ] @@ -4402,15 +4130,6 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" -[[package]] -name = "kurbo" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b" -dependencies = [ - "arrayvec 0.7.4", -] - [[package]] name = "kurbo" version = "0.10.4" @@ -4476,12 +4195,12 @@ dependencies = [ [[package]] name = "libloading" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if 1.0.0", - "windows-sys 0.48.0", + "windows-targets 0.52.4", ] [[package]] @@ -4506,7 +4225,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall 0.4.1", ] @@ -4517,7 +4236,7 @@ version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "redox_syscall 0.4.1", ] @@ -4602,9 +4321,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" dependencies = [ "serde", "value-bag", @@ -4653,16 +4372,7 @@ dependencies = [ [[package]] name = "lru" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a83fb7698b3643a0e34f9ae6f2e8f0178c0fd42f8b59d493aa271ff3a5bf21" -dependencies = [ - "hashbrown 0.14.3", -] - -[[package]] -name = "lru" -version = "0.12.3" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3262e75e648fce39813cb56ac41f3c3e3f65217ebf3844d818d1f9398cfb0dc" dependencies = [ @@ -4755,15 +4465,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "memmap2" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d28bba84adfe6646737845bc5ebbfa2c08424eb1c37e94a1fd2a82adb56a872" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.8.0" @@ -4782,45 +4483,13 @@ dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg 1.1.0", -] - -[[package]] -name = "memoffset" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" -dependencies = [ - "autocfg 1.1.0", -] - -[[package]] -name = "metal" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" -dependencies = [ - "bitflags 1.3.2", - "block", - "core-graphics-types", - "foreign-types 0.3.2", - "log", - "objc", -] - [[package]] name = "metal" version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "block", "core-graphics-types", "foreign-types 0.5.0", @@ -4901,9 +4570,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", @@ -4960,7 +4629,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c624fa1b7aab6bd2aff6e9b18565cc0363b6d45cbcd7465c9ed5e3740ebf097" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "libc", "nix 0.26.4", "smallstr", @@ -4970,26 +4639,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "naga" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbcc2e0513220fd2b598e6068608d4462db20322c0e77e47f6f488dfcfc279cb" -dependencies = [ - "bit-set", - "bitflags 1.3.2", - "codespan-reporting", - "hexf-parse", - "indexmap 1.9.3", - "log", - "num-traits 0.2.18", - "rustc-hash", - "spirv 0.2.0+1.5.4", - "termcolor", - "thiserror", - "unicode-xid 0.2.4", -] - [[package]] name = "naga" version = "0.19.2" @@ -4997,14 +4646,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50e3524642f53d9af419ab5e8dd29d3ba155708267667c2f3f06c88c9e130843" dependencies = [ "bit-set", - "bitflags 2.4.2", + "bitflags 2.5.0", "codespan-reporting", "hexf-parse", - "indexmap 2.2.3", + "indexmap 2.2.5", "log", "num-traits 0.2.18", "rustc-hash", - "spirv 0.3.0+sdk-1.3.268.0", + "spirv", "termcolor", "thiserror", "unicode-xid 0.2.4", @@ -5074,7 +4723,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "jni-sys", "log", "ndk-sys", @@ -5121,19 +4770,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nix" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" -dependencies = [ - "autocfg 1.1.0", - "bitflags 1.3.2", - "cfg-if 1.0.0", - "libc", - "memoffset 0.6.5", -] - [[package]] name = "nix" version = "0.26.4" @@ -5143,8 +4779,6 @@ dependencies = [ "bitflags 1.3.2", "cfg-if 1.0.0", "libc", - "memoffset 0.7.1", - "pin-utils", ] [[package]] @@ -5285,7 +4919,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.6", + "hermit-abi 0.3.9", "libc", ] @@ -5305,9 +4939,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ "proc-macro-crate", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -5400,9 +5034,9 @@ checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "open" @@ -5429,7 +5063,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg-if 1.0.0", "foreign-types 0.3.2", "libc", @@ -5444,9 +5078,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -5504,10 +5138,10 @@ checksum = "b645dcde5f119c2c454a92d0dfa271a2a3b205da92e4292a68ead4bdbfde1f33" dependencies = [ "heck 0.4.1", "itertools 0.12.1", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "proc-macro2-diagnostics", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -5521,9 +5155,9 @@ dependencies = [ [[package]] name = "palette" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d38e6e5ca1612e2081cc31188f08c3cba630ce4ba44709a153f1a0f38d678f2" +checksum = "ebfc23a4b76642983d57e4ad00bb4504eb30a8ce3c70f4aee1f725610e36d97a" dependencies = [ "approx", "fast-srgb8", @@ -5533,13 +5167,13 @@ dependencies = [ [[package]] name = "palette_derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05d1c929301fee6830dafa764341118829b2535c216b0571e3821ecac5c885b" +checksum = "e8890702dbec0bad9116041ae586f84805b13eecd1d8b1df27c29998a9969d6d" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -5775,9 +5409,9 @@ checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ "phf_generator 0.11.2", "phf_shared 0.11.2", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -5800,22 +5434,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -5892,12 +5526,12 @@ dependencies = [ [[package]] name = "plotters-iced" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b533be9c5ba7d80b7fd619fd5226c58bcae53db2c24b447fa82be25865c117e6" +checksum = "c5e45cd10abd572d7d0dce11446a915c8b54442480d2a46e71dcb9dd43d93b4c" dependencies = [ - "iced_graphics 0.9.0", - "iced_widget 0.1.3", + "iced_graphics", + "iced_widget", "once_cell", "plotters", "plotters-backend", @@ -5962,7 +5596,7 @@ dependencies = [ "cfg-if 1.0.0", "concurrent-queue", "pin-project-lite 0.2.13", - "rustix 0.38.31", + "rustix 0.38.32", "tracing", "windows-sys 0.52.0", ] @@ -5974,7 +5608,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ "cpufeatures", - "opaque-debug 0.3.0", + "opaque-debug 0.3.1", "universal-hash", ] @@ -6006,12 +5640,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.3.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "once_cell", - "toml_edit 0.19.15", + "toml_edit 0.21.1", ] [[package]] @@ -6021,7 +5654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", "version_check", @@ -6033,7 +5666,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "version_check", ] @@ -6049,9 +5682,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" dependencies = [ "unicode-ident", ] @@ -6062,9 +5695,9 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", "version_check", "yansi", ] @@ -6087,15 +5720,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-xml" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" -dependencies = [ - "memchr", -] - [[package]] name = "quick-xml" version = "0.31.0" @@ -6120,7 +5744,7 @@ version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", ] [[package]] @@ -6321,9 +5945,9 @@ checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" [[package]] name = "rangemap" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795915a3930a5d6bafd9053d37602fea3e61be2e5d4d788983a8ba9654c1c6f2" +checksum = "f60fcc7d6849342eff22c4350c8b9a989ee8ceabc4b481253e8946b9fe83d684" [[package]] name = "raw-window-handle" @@ -6344,12 +5968,6 @@ dependencies = [ "cty", ] -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - [[package]] name = "raw-window-handle" version = "0.6.0" @@ -6358,9 +5976,9 @@ checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" [[package]] name = "rayon" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" +checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" dependencies = [ "either", "rayon-core", @@ -6387,9 +6005,9 @@ dependencies = [ [[package]] name = "read-fonts" -version = "0.15.5" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c044ab88c43e2eae05b34a17fc13598736679fdb03d71b49fcfe114443ec8a86" +checksum = "81c524658d3b77930a391f559756d91dbe829ab6cf4687083f615d395df99722" dependencies = [ "font-types", ] @@ -6463,9 +6081,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -6480,9 +6098,9 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "renderdoc-sys" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b" +checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" [[package]] name = "reqwest" @@ -6526,16 +6144,16 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.24" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", "bytes 1.5.0", "encoding_rs", "futures-core", "futures-util", - "h2 0.3.24", + "h2 0.3.25", "http", "http-body 0.4.6", "hyper 0.14.28", @@ -6619,7 +6237,7 @@ checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" dependencies = [ "block-buffer 0.9.0", "digest 0.9.0", - "opaque-debug 0.3.0", + "opaque-debug 0.3.1", ] [[package]] @@ -6667,10 +6285,10 @@ version = "6.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49b94b81e5b2c284684141a2fb9e2a31be90638caf040bf9afbc5a0416afe1ac" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "rust-embed-utils", - "syn 2.0.50", + "syn 2.0.53", "walkdir", ] @@ -6727,11 +6345,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.31" +version = "0.38.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "errno", "libc", "linux-raw-sys 0.4.13", @@ -6791,23 +6409,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" -[[package]] -name = "rustybuzz" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82eea22c8f56965eeaf3a209b3d24508256c7b920fb3b6211b8ba0f7c0583250" -dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "libm", - "smallvec", - "ttf-parser 0.19.2", - "unicode-bidi-mirroring", - "unicode-ccc", - "unicode-general-category", - "unicode-script", -] - [[package]] name = "rustybuzz" version = "0.11.0" @@ -6933,7 +6534,7 @@ dependencies = [ "log", "memmap2 0.9.4", "smithay-client-toolkit", - "tiny-skia 0.11.4", + "tiny-skia", ] [[package]] @@ -7071,9 +6672,9 @@ version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -7126,7 +6727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ "darling", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", ] @@ -7153,7 +6754,7 @@ dependencies = [ "cfg-if 1.0.0", "cpufeatures", "digest 0.9.0", - "opaque-debug 0.3.0", + "opaque-debug 0.3.1", ] [[package]] @@ -7263,22 +6864,22 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "calloop", "calloop-wayland-source", "cursor-icon", "libc", "log", "memmap2 0.9.4", - "rustix 0.38.31", + "rustix 0.38.32", "thiserror", - "wayland-backend 0.3.3", - "wayland-client 0.31.2", + "wayland-backend", + "wayland-client", "wayland-csd-frame", "wayland-cursor", "wayland-protocols", "wayland-protocols-wlr", - "wayland-scanner 0.31.1", + "wayland-scanner", "xkeysym", ] @@ -7290,7 +6891,7 @@ checksum = "c091e7354ea8059d6ad99eace06dd13ddeedbb0ac72d40a9a6e7ff790525882d" dependencies = [ "libc", "smithay-client-toolkit", - "wayland-backend 0.3.3", + "wayland-backend", ] [[package]] @@ -7333,34 +6934,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "softbuffer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2b953f6ba7285f0af131eb748aabd8ddaf53e0b81dda3ba5d803b0847d6559f" -dependencies = [ - "bytemuck", - "cfg_aliases 0.1.1", - "cocoa 0.24.1", - "core-graphics 0.22.3", - "fastrand 1.9.0", - "foreign-types 0.3.2", - "log", - "nix 0.26.4", - "objc", - "raw-window-handle 0.5.2", - "redox_syscall 0.3.5", - "thiserror", - "wasm-bindgen", - "wayland-backend 0.1.2", - "wayland-client 0.30.2", - "wayland-sys 0.30.1", - "web-sys", - "windows-sys 0.48.0", - "x11-dl", - "x11rb 0.11.1", -] - [[package]] name = "softbuffer" version = "0.4.1" @@ -7381,15 +6954,15 @@ dependencies = [ "objc", "raw-window-handle 0.6.0", "redox_syscall 0.4.1", - "rustix 0.38.31", + "rustix 0.38.32", "tiny-xlib", "wasm-bindgen", - "wayland-backend 0.3.3", - "wayland-client 0.31.2", - "wayland-sys 0.31.1", + "wayland-backend", + "wayland-client", + "wayland-sys", "web-sys", "windows-sys 0.52.0", - "x11rb 0.13.0", + "x11rb", ] [[package]] @@ -7407,23 +6980,13 @@ dependencies = [ "lock_api 0.4.11", ] -[[package]] -name = "spirv" -version = "0.2.0+1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" -dependencies = [ - "bitflags 1.3.2", - "num-traits 0.2.18", -] - [[package]] name = "spirv" version = "0.3.0+sdk-1.3.268.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eda41003dc44290527a59b13432d4a0379379fa074b70174882adfbdfd917844" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", ] [[package]] @@ -7475,7 +7038,7 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck 0.3.3", "proc-macro-error", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", ] @@ -7499,7 +7062,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" dependencies = [ "heck 0.3.3", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", ] @@ -7511,7 +7074,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec" dependencies = [ "heck 0.3.3", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", ] @@ -7530,15 +7093,15 @@ checksum = "171758edb47aa306a78dfa4ab9aeb5167405bd4e3dc2b64e88f6a84bbe98bd63" [[package]] name = "svg_fmt" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2" +checksum = "f83ba502a3265efb76efb89b0a2f7782ad6f2675015d4ce37e4b547dda42b499" [[package]] name = "swash" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d06ff4664af8923625604261c645f5c4cc610cc83c84bec74b50d76237089de7" +checksum = "9af636fb90d39858650cae1088a37e2862dab4e874a0bb49d6dfb5b2dacf0e24" dependencies = [ "read-fonts", "yazi", @@ -7562,18 +7125,18 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.50" +version = "2.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "unicode-ident", ] @@ -7660,13 +7223,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if 1.0.0", "fastrand 2.0.1", - "rustix 0.38.31", + "rustix 0.38.32", "windows-sys 0.52.0", ] @@ -7724,22 +7287,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.57" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -7804,21 +7367,6 @@ dependencies = [ "chrono", ] -[[package]] -name = "tiny-skia" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db11798945fa5c3e5490c794ccca7c6de86d3afdd54b4eb324109939c6f37bc" -dependencies = [ - "arrayref", - "arrayvec 0.7.4", - "bytemuck", - "cfg-if 1.0.0", - "log", - "png 0.17.13", - "tiny-skia-path 0.10.0", -] - [[package]] name = "tiny-skia" version = "0.11.4" @@ -7831,18 +7379,7 @@ dependencies = [ "cfg-if 1.0.0", "log", "png 0.17.13", - "tiny-skia-path 0.11.4", -] - -[[package]] -name = "tiny-skia-path" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f60aa35c89ac2687ace1a2556eaaea68e8c0d47408a2e3e7f5c98a489e7281c" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", + "tiny-skia-path", ] [[package]] @@ -7864,7 +7401,7 @@ checksum = "d4098d49269baa034a8d1eae9bd63e9fa532148d772121dace3bcd6a6c98eb6d" dependencies = [ "as-raw-xcb-connection", "ctor", - "libloading 0.8.1", + "libloading 0.8.3", "tracing", ] @@ -7925,7 +7462,7 @@ dependencies = [ "backtrace", "bytes 1.5.0", "libc", - "mio 0.8.10", + "mio 0.8.11", "num_cpus", "pin-project-lite 0.2.13", "socket2 0.5.6", @@ -7948,7 +7485,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", ] @@ -8063,14 +7600,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.10" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.6", + "toml_edit 0.22.8", ] [[package]] @@ -8084,26 +7621,26 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.2.5", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.6" +version = "0.22.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" +checksum = "c12219811e0c1ba077867254e5ad62ee2c9c190b0d957110750ac0cda1ae96cd" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.2.5", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.2", + "winnow 0.6.5", ] [[package]] @@ -8130,9 +7667,9 @@ version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -8184,17 +7721,6 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if 1.0.0", - "rand 0.8.5", - "static_assertions", -] - [[package]] name = "type-map" version = "0.4.0" @@ -8265,12 +7791,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" -[[package]] -name = "unicode-general-category" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2281c8c1d221438e373249e065ca4989c4c36952c211ff21a0ee91c44a3869e7" - [[package]] name = "unicode-ident" version = "1.0.12" @@ -8382,9 +7902,9 @@ dependencies = [ [[package]] name = "value-bag" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126e423afe2dd9ac52142e7e9d5ce4135d7e13776c529d27fd6bc49f19e3280b" +checksum = "74797339c3b98616c009c7c3eb53a0ce41e85c8ec66bd3db96ed132d20cfdee8" [[package]] name = "vcpkg" @@ -8438,9 +7958,9 @@ checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -8475,9 +7995,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if 1.0.0", "serde", @@ -8487,24 +8007,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -8514,9 +8034,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote 1.0.35", "wasm-bindgen-macro-support", @@ -8524,22 +8044,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.91" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-timer" @@ -8556,21 +8076,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "wayland-backend" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b48e27457e8da3b2260ac60d0a94512f5cba36448679f3747c0865b7893ed8" -dependencies = [ - "cc", - "downcast-rs", - "io-lifetimes", - "nix 0.26.4", - "scoped-tls", - "smallvec", - "wayland-sys 0.30.1", -] - [[package]] name = "wayland-backend" version = "0.3.3" @@ -8579,22 +8084,10 @@ checksum = "9d50fa61ce90d76474c87f5fc002828d81b32677340112b4ef08079a9d459a40" dependencies = [ "cc", "downcast-rs", - "rustix 0.38.31", + "rustix 0.38.32", "scoped-tls", "smallvec", - "wayland-sys 0.31.1", -] - -[[package]] -name = "wayland-client" -version = "0.30.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489c9654770f674fc7e266b3c579f4053d7551df0ceb392f153adb1f9ed06ac8" -dependencies = [ - "bitflags 1.3.2", - "nix 0.26.4", - "wayland-backend 0.1.2", - "wayland-scanner 0.30.1", + "wayland-sys", ] [[package]] @@ -8603,10 +8096,10 @@ version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82fb96ee935c2cea6668ccb470fb7771f6215d1691746c2d896b447a00ad3f1f" dependencies = [ - "bitflags 2.4.2", - "rustix 0.38.31", - "wayland-backend 0.3.3", - "wayland-scanner 0.31.1", + "bitflags 2.5.0", + "rustix 0.38.32", + "wayland-backend", + "wayland-scanner", ] [[package]] @@ -8615,9 +8108,9 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "cursor-icon", - "wayland-backend 0.3.3", + "wayland-backend", ] [[package]] @@ -8626,8 +8119,8 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71ce5fa868dd13d11a0d04c5e2e65726d0897be8de247c0c5a65886e283231ba" dependencies = [ - "rustix 0.38.31", - "wayland-client 0.31.2", + "rustix 0.38.32", + "wayland-client", "xcursor", ] @@ -8637,10 +8130,10 @@ version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" dependencies = [ - "bitflags 2.4.2", - "wayland-backend 0.3.3", - "wayland-client 0.31.2", - "wayland-scanner 0.31.1", + "bitflags 2.5.0", + "wayland-backend", + "wayland-client", + "wayland-scanner", ] [[package]] @@ -8649,11 +8142,11 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" dependencies = [ - "bitflags 2.4.2", - "wayland-backend 0.3.3", - "wayland-client 0.31.2", + "bitflags 2.5.0", + "wayland-backend", + "wayland-client", "wayland-protocols", - "wayland-scanner 0.31.1", + "wayland-scanner", ] [[package]] @@ -8662,22 +8155,11 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" dependencies = [ - "bitflags 2.4.2", - "wayland-backend 0.3.3", - "wayland-client 0.31.2", + "bitflags 2.5.0", + "wayland-backend", + "wayland-client", "wayland-protocols", - "wayland-scanner 0.31.1", -] - -[[package]] -name = "wayland-scanner" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9b873b257fbc32ec909c0eb80dea312076a67014e65e245f5eb69a6b8ab330e" -dependencies = [ - "proc-macro2 1.0.78", - "quick-xml 0.28.2", - "quote 1.0.35", + "wayland-scanner", ] [[package]] @@ -8686,23 +8168,11 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b3a62929287001986fb58c789dce9b67604a397c15c611ad9f747300b6c283" dependencies = [ - "proc-macro2 1.0.78", - "quick-xml 0.31.0", + "proc-macro2 1.0.79", + "quick-xml", "quote 1.0.35", ] -[[package]] -name = "wayland-sys" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06" -dependencies = [ - "dlib", - "lazy_static", - "log", - "pkg-config", -] - [[package]] name = "wayland-sys" version = "0.31.1" @@ -8770,30 +8240,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "wgpu" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "480c965c9306872eb6255fa55e4b4953be55a8b64d57e61d7ff840d3dcc051cd" -dependencies = [ - "arrayvec 0.7.4", - "cfg-if 1.0.0", - "js-sys", - "log", - "naga 0.12.3", - "parking_lot 0.12.1", - "profiling", - "raw-window-handle 0.5.2", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core 0.16.1", - "wgpu-hal 0.16.2", - "wgpu-types 0.16.1", -] - [[package]] name = "wgpu" version = "0.19.3" @@ -8805,7 +8251,7 @@ dependencies = [ "cfg_aliases 0.1.1", "js-sys", "log", - "naga 0.19.2", + "naga", "parking_lot 0.12.1", "profiling", "raw-window-handle 0.6.0", @@ -8814,32 +8260,9 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "wgpu-core 0.19.3", - "wgpu-hal 0.19.3", - "wgpu-types 0.19.2", -] - -[[package]] -name = "wgpu-core" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f478237b4bf0d5b70a39898a66fa67ca3a007d79f2520485b8b0c3dfc46f8c2" -dependencies = [ - "arrayvec 0.7.4", - "bit-vec", - "bitflags 2.4.2", - "codespan-reporting", - "log", - "naga 0.12.3", - "parking_lot 0.12.1", - "profiling", - "raw-window-handle 0.5.2", - "rustc-hash", - "smallvec", - "thiserror", - "web-sys", - "wgpu-hal 0.16.2", - "wgpu-types 0.16.1", + "wgpu-core", + "wgpu-hal", + "wgpu-types", ] [[package]] @@ -8850,12 +8273,12 @@ checksum = "f9f6b033c2f00ae0bc8ea872c5989777c60bc241aac4e58b24774faa8b391f78" dependencies = [ "arrayvec 0.7.4", "bit-vec", - "bitflags 2.4.2", + "bitflags 2.5.0", "cfg_aliases 0.1.1", "codespan-reporting", - "indexmap 2.2.3", + "indexmap 2.2.5", "log", - "naga 0.19.2", + "naga", "once_cell", "parking_lot 0.12.1", "profiling", @@ -8864,50 +8287,8 @@ dependencies = [ "smallvec", "thiserror", "web-sys", - "wgpu-hal 0.19.3", - "wgpu-types 0.19.2", -] - -[[package]] -name = "wgpu-hal" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecb3258078e936deee14fd4e0febe1cfe9bbb5ffef165cb60218d2ee5eb4448" -dependencies = [ - "android_system_properties", - "arrayvec 0.7.4", - "ash", - "bit-set", - "bitflags 2.4.2", - "block", - "core-graphics-types", - "d3d12 0.6.0", - "foreign-types 0.3.2", - "glow 0.12.3", - "gpu-alloc 0.5.4", - "gpu-allocator 0.22.0", - "gpu-descriptor", - "hassle-rs 0.10.0", - "js-sys", - "khronos-egl 4.1.0", - "libc", - "libloading 0.8.1", - "log", - "metal 0.24.0", - "naga 0.12.3", - "objc", - "parking_lot 0.12.1", - "profiling", - "range-alloc", - "raw-window-handle 0.5.2", - "renderdoc-sys", - "rustc-hash", - "smallvec", - "thiserror", - "wasm-bindgen", - "web-sys", - "wgpu-types 0.16.1", - "winapi 0.3.9", + "wgpu-hal", + "wgpu-types", ] [[package]] @@ -8920,24 +8301,24 @@ dependencies = [ "arrayvec 0.7.4", "ash", "bit-set", - "bitflags 2.4.2", + "bitflags 2.5.0", "block", "cfg_aliases 0.1.1", "core-graphics-types", - "d3d12 0.19.0", - "glow 0.13.1", + "d3d12", + "glow", "glutin_wgl_sys", - "gpu-alloc 0.6.0", - "gpu-allocator 0.25.0", + "gpu-alloc", + "gpu-allocator", "gpu-descriptor", - "hassle-rs 0.11.0", + "hassle-rs", "js-sys", - "khronos-egl 6.0.0", + "khronos-egl", "libc", - "libloading 0.8.1", + "libloading 0.8.3", "log", - "metal 0.27.0", - "naga 0.19.2", + "metal", + "naga", "ndk-sys", "objc", "once_cell", @@ -8951,28 +8332,17 @@ dependencies = [ "thiserror", "wasm-bindgen", "web-sys", - "wgpu-types 0.19.2", + "wgpu-types", "winapi 0.3.9", ] -[[package]] -name = "wgpu-types" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c153280bb108c2979eb5c7391cb18c56642dd3c072e55f52065e13e2a1252a" -dependencies = [ - "bitflags 2.4.2", - "js-sys", - "web-sys", -] - [[package]] name = "wgpu-types" version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b671ff9fb03f78b46ff176494ee1ebe7d603393f42664be55b64dc8d53969805" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "js-sys", "web-sys", ] @@ -8986,7 +8356,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.31", + "rustix 0.38.32", ] [[package]] @@ -9032,15 +8402,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "winapi-wsapoll" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -9061,15 +8422,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "windows" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows" version = "0.52.0" @@ -9077,7 +8429,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -9086,7 +8438,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -9113,7 +8465,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -9148,17 +8500,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.3", - "windows_aarch64_msvc 0.52.3", - "windows_i686_gnu 0.52.3", - "windows_i686_msvc 0.52.3", - "windows_x86_64_gnu 0.52.3", - "windows_x86_64_gnullvm 0.52.3", - "windows_x86_64_msvc 0.52.3", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -9175,9 +8527,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -9193,9 +8545,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -9211,9 +8563,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -9229,9 +8581,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -9247,9 +8599,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -9265,9 +8617,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -9283,20 +8635,20 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winit" -version = "0.29.14" +version = "0.29.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a3db69ffbe53a9babec7804da7a90f21020fcce1f2f5e5291e2311245b993d" +checksum = "0d59ad965a635657faf09c8f062badd885748428933dad8e8bdd64064d92e5ca" dependencies = [ "ahash", "android-activity", "atomic-waker", - "bitflags 2.4.2", + "bitflags 2.5.0", "bytemuck", "calloop", "cfg_aliases 0.1.1", @@ -9316,22 +8668,22 @@ dependencies = [ "percent-encoding", "raw-window-handle 0.6.0", "redox_syscall 0.3.5", - "rustix 0.38.31", + "rustix 0.38.32", "sctk-adwaita", "smithay-client-toolkit", "smol_str", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", - "wayland-backend 0.3.3", - "wayland-client 0.31.2", + "wayland-backend", + "wayland-client", "wayland-protocols", "wayland-protocols-plasma", "web-sys", "web-time", "windows-sys 0.48.0", "x11-dl", - "x11rb 0.13.0", + "x11rb", "xkbcommon-dl", ] @@ -9346,9 +8698,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.2" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178" +checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" dependencies = [ "memchr", ] @@ -9411,22 +8763,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "x11rb" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdf3c79412dd91bae7a7366b8ad1565a85e35dd049affc3a6a2c549e97419617" -dependencies = [ - "gethostname 0.2.3", - "libc", - "libloading 0.7.4", - "nix 0.25.1", - "once_cell", - "winapi 0.3.9", - "winapi-wsapoll", - "x11rb-protocol 0.11.1", -] - [[package]] name = "x11rb" version = "0.13.0" @@ -9434,21 +8770,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8f25ead8c7e4cba123243a6367da5d3990e0d3affa708ea19dce96356bd9f1a" dependencies = [ "as-raw-xcb-connection", - "gethostname 0.4.3", + "gethostname", "libc", - "libloading 0.8.1", + "libloading 0.8.3", "once_cell", - "rustix 0.38.31", - "x11rb-protocol 0.13.0", -] - -[[package]] -name = "x11rb-protocol" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0b1513b141123073ce54d5bb1d33f801f17508fbd61e02060b1214e96d39c56" -dependencies = [ - "nix 0.25.1", + "rustix 0.38.32", + "x11rb-protocol", ] [[package]] @@ -9487,7 +8814,7 @@ checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", "linux-raw-sys 0.4.13", - "rustix 0.38.31", + "rustix 0.38.32", ] [[package]] @@ -9502,7 +8829,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5" dependencies = [ - "bitflags 2.4.2", + "bitflags 2.5.0", "dlib", "log", "once_cell", @@ -9587,9 +8914,9 @@ version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] @@ -9607,9 +8934,9 @@ version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ - "proc-macro2 1.0.78", + "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.50", + "syn 2.0.53", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 19fa411..641f9cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ iced_renderer = { version = "0.12" } iced_core = { version = "0.12" } iced_aw = { version = "0.8", default-features = false, features = ["card", "modal"]} -plotters-iced = "0.9.0" +plotters-iced = "0.10.0" plotters="0.3" plotters-backend = "0.3" rand = "0.8.3" diff --git a/crates/core/src/theme/mod.rs b/crates/core/src/theme/mod.rs index 2eb2810..320fff7 100644 --- a/crates/core/src/theme/mod.rs +++ b/crates/core/src/theme/mod.rs @@ -53,10 +53,11 @@ pub type Text<'a> = iced::widget::Text<'a, Theme, Renderer>; pub type TextInput<'a, Message> = iced::widget::TextInput<'a, Message, Theme, Renderer>; pub type Button<'a, Message> = iced::widget::Button<'a, Message, Theme, Renderer>; pub type Scrollable<'a, Message> = iced::widget::Scrollable<'a, Message, Theme, Renderer>; -pub type PickList<'a, T, Message> = iced::widget::PickList<'a, T, Message, Theme, Renderer>; +pub type PickList<'a, T, L, V, Message> = + iced::widget::PickList<'a, T, L, V, Message, Theme, Renderer>; pub type Radio = iced::widget::Radio; pub type Card<'a, Message> = iced_aw::native::Card<'a, Message, Theme, Renderer>; -pub type Modal<'a, Content, Message> = iced_aw::modal::Modal<'a, Content, Message>; +pub type Modal<'a, Message, Theme, Renderer> = iced_aw::modal::Modal<'a, Message, Theme, Renderer>; pub type Header<'a, Message> = crate::widget::header::Header<'a, Message, Theme, Renderer>; pub type TableRow<'a, Message> = crate::widget::table_row::TableRow<'a, Message, Theme, Renderer>; diff --git a/src/gui/element/settings/general.rs b/src/gui/element/settings/general.rs index 00d4d24..71c6d2f 100644 --- a/src/gui/element/settings/general.rs +++ b/src/gui/element/settings/general.rs @@ -458,14 +458,11 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain #[cfg(target_os = "windows")] let close_to_tray_column = { - let checkbox = Checkbox::new( - localized_string("close-to-tray"), - config.close_to_tray, - Interaction::ToggleCloseToTray, - ) - .style(grin_gui_core::theme::CheckboxStyle::Normal) - .text_size(DEFAULT_FONT_SIZE) - .spacing(5); + let checkbox = Checkbox::new(localized_string("close-to-tray"), config.close_to_tray) + .style(grin_gui_core::theme::CheckboxStyle::Normal) + .text_size(DEFAULT_FONT_SIZE) + .on_toggle(Interaction::ToggleCloseToTray) + .spacing(5); let checkbox: Element = checkbox.into(); @@ -476,14 +473,11 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain #[cfg(target_os = "windows")] let toggle_autostart_column = { - let checkbox = Checkbox::new( - localized_string("toggle-autostart"), - config.autostart, - Interaction::ToggleAutoStart, - ) - .style(grin_gui_core::theme::CheckboxStyle::Normal) - .text_size(DEFAULT_FONT_SIZE) - .spacing(5); + let checkbox = Checkbox::new(localized_string("toggle-autostart"), config.autostart) + .style(grin_gui_core::theme::CheckboxStyle::Normal) + .text_size(DEFAULT_FONT_SIZE) + .on_toggle(Interaction::ToggleAutoStart) + .spacing(5); let checkbox: Element = checkbox.into(); @@ -497,10 +491,10 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain let checkbox = Checkbox::new( localized_string("start-closed-to-tray"), config.start_closed_to_tray, - Interaction::ToggleStartClosedToTray, ) .style(grin_gui_core::theme::CheckboxStyle::Normal) .text_size(DEFAULT_FONT_SIZE) + .on_toggle(Interaction::ToggleStartClosedToTray) .spacing(5); let checkbox: Element = checkbox.into(); diff --git a/src/gui/element/wallet/operation/create_tx_contracts.rs b/src/gui/element/wallet/operation/create_tx_contracts.rs index 300aa48..0d756dc 100644 --- a/src/gui/element/wallet/operation/create_tx_contracts.rs +++ b/src/gui/element/wallet/operation/create_tx_contracts.rs @@ -374,18 +374,15 @@ pub fn data_container<'a>(config: &'a Config, state: &'a StateContainer) -> Cont .style(grin_gui_core::theme::ContainerStyle::NormalBackground);*/ let checkbox_column = { - let checkbox = Checkbox::new( - localized_string("wallet-self-send"), - state.is_self_send, - |v| { + let checkbox = Checkbox::new(localized_string("wallet-self-send"), state.is_self_send) + .on_toggle(|v| { Interaction::WalletOperationCreateTxContractsViewInteraction( LocalViewInteraction::SelfSendSelected(v), ) - }, - ) - .style(grin_gui_core::theme::CheckboxStyle::Normal) - .text_size(DEFAULT_FONT_SIZE) - .spacing(5); + }) + .style(grin_gui_core::theme::CheckboxStyle::Normal) + .text_size(DEFAULT_FONT_SIZE) + .spacing(5); let checkbox: Element = checkbox.into(); diff --git a/src/gui/element/wallet/operation/open.rs b/src/gui/element/wallet/operation/open.rs index 2ddc073..2e7772f 100644 --- a/src/gui/element/wallet/operation/open.rs +++ b/src/gui/element/wallet/operation/open.rs @@ -199,7 +199,7 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain .size(DEFAULT_FONT_SIZE) .padding(6) .style(grin_gui_core::theme::TextInputStyle::AddonsQuery) - .password(); + .secure(true); let password_input: Element = password_input.into(); diff --git a/src/gui/element/wallet/operation/tx_list.rs b/src/gui/element/wallet/operation/tx_list.rs index 1607706..0e445b8 100644 --- a/src/gui/element/wallet/operation/tx_list.rs +++ b/src/gui/element/wallet/operation/tx_list.rs @@ -10,7 +10,7 @@ use { crate::Result, grin_gui_core::theme::{ Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + TextInput, Theme, }, grin_gui_core::widget::header, grin_gui_core::{ @@ -895,7 +895,7 @@ pub fn titles_row_header<'a>( column_state: &'a [ColumnState], previous_column_key: Option, previous_sort_direction: Option, -) -> Container<'a, Message> { +) -> Header<'a, Message> { // A row containing titles above the addon rows. let mut row_titles = vec![]; @@ -954,6 +954,7 @@ pub fn titles_row_header<'a>( ) .spacing(1) .height(Length::Fixed(25.0)) + .into() /* .on_resize(3, |event| { //TODO //Message::Interaction(Interaction::ResizeColumn(Mode::Catalog, event)) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 340d046..15a2cc1 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -15,17 +15,17 @@ use grin_gui_core::{ subscriber::{self, UIMessage}, ChainTypes, NodeInterface, }, - theme::{Button, ColorPalette, Column, Container, PickList, Row, Scrollable, Text, Theme}, + theme::{ + Button, ColorPalette, Column, Container, Modal, PickList, Row, Scrollable, Text, Theme, + }, wallet::{get_grin_wallet_default_path, global, HTTPNodeClient, WalletInterfaceHttpNodeClient}, }; use iced::widget::{button, pick_list, scrollable, text_input, Checkbox, Space, TextInput}; use iced::{ - alignment, font, window, Alignment, Application, Command, Length, Settings, Subscription, + alignment, font, window, Alignment, Application, Command, Length, Settings, Size, Subscription, }; -use iced_aw::{modal, Card, Modal}; - use iced_futures::futures::channel::mpsc; use image::ImageFormat; @@ -145,9 +145,9 @@ impl Application for GrinGui { type Executor = iced::executor::Default; type Message = Message; type Flags = Config; - type Theme = iced::Theme; + type Theme = Theme; - fn theme(&self) -> iced::Theme { + fn theme(&self) -> Theme { self.theme.clone() } @@ -293,7 +293,8 @@ impl Application for GrinGui { } }; - Modal::new(self.show_modal, underlay, content) + // self.show_modal? + Modal::new(underlay, Some(content)) .on_esc(Message::Interaction(Interaction::CloseErrorModal)) .style(grin_gui_core::theme::ModalStyle::Normal) .into() @@ -310,17 +311,21 @@ pub fn run(opts: Opts, config: Config) { log::debug!("config loaded:\n{:#?}", &config); let mut settings = Settings::default(); - settings.window.size = config.window_size.unwrap_or((900, 620)); + let size = Size { + width: config.window_size.unwrap_or((900, 620)).0 as f32, + height: config.window_size.unwrap_or((900, 620)).1 as f32, + }; + settings.window.size = size; #[cfg(target_os = "macos")] { // false needed for Application shutdown - settings.exit_on_close_request = false; + settings.windows.exit_on_close_request = false; } #[cfg(target_os = "windows")] { - settings.exit_on_close_request = false; + settings.window.exit_on_close_request = false; } #[cfg(not(target_os = "linux"))] @@ -328,7 +333,10 @@ pub fn run(opts: Opts, config: Config) { // on Linux. // @see: https://github.com/ajour/ajour/issues/427 { - settings.window.min_size = Some((600, 300)); + settings.window.min_size = Some(Size { + width: 600.0, + height: 300.0, + }); } #[cfg(feature = "wgpu")] diff --git a/src/gui/update.rs b/src/gui/update.rs index 50cce07..3356059 100644 --- a/src/gui/update.rs +++ b/src/gui/update.rs @@ -271,10 +271,10 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result { + Message::RuntimeEvent(iced_core::Event::Window( + iced_core::window::Id::MAIN, + iced_core::window::Event::Resized { width, height }, + )) => { let width = (width as f64 * grin_gui.general_settings_state.scale_state.scale) as u32; let height = (height as f64 * grin_gui.general_settings_state.scale_state.scale) as u32; @@ -297,6 +297,7 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result { log::debug!("Message::RuntimeEvent(CloseRequested)"); @@ -305,13 +306,14 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result { @@ -323,21 +325,21 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result {} - iced::keyboard::KeyCode::C => { + match key { + iced::keyboard::Key::Character(A) => {} + iced::keyboard::Key::Character(C) => { grin_gui.mode = Mode::Catalog; } - iced::keyboard::KeyCode::R => {} - iced::keyboard::KeyCode::S => { + iced::keyboard::Key::Character(R) => {} + iced::keyboard::Key::Character(S) => { grin_gui.mode = Mode::Settings; } - iced::keyboard::KeyCode::U => {} - iced::keyboard::KeyCode::W => {} - iced::keyboard::KeyCode::I => { + iced::keyboard::Key::Character(U) => {} + iced::keyboard::Key::Character(W) => {} + iced::keyboard::Key::Character(I) => { grin_gui.mode = Mode::Install; } - iced::keyboard::KeyCode::Escape => match grin_gui.mode { + iced::keyboard::Key::Named(Escape) => match grin_gui.mode { _ => (), }, _ => (), @@ -408,7 +410,7 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result { grin_gui.safe_exit(); - return Ok(window::close()); + return Ok(window::close(iced_core::window::Id::MAIN)); } Message::Interaction(Interaction::ExitCancel) => { grin_gui.show_exit(false); @@ -420,7 +422,7 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result Date: Sun, 24 Mar 2024 22:04:44 +0000 Subject: [PATCH 06/12] down to last trait errors? --- Cargo.lock | 148 ++++++++++---------- crates/core/src/widget/header.rs | 21 +-- src/gui/element/wallet/operation/tx_list.rs | 4 +- src/gui/mod.rs | 25 ++-- 4 files changed, 102 insertions(+), 96 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1217458..2627a03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -200,9 +200,9 @@ checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" [[package]] name = "arc-swap" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3d0060af21e8d11a926981cc00c6c1541aa91dd64b9f881985c3da1094425f" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" [[package]] name = "arrayref" @@ -295,7 +295,7 @@ dependencies = [ "async-lock 3.3.0", "async-task", "concurrent-queue", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-lite 2.3.0", "slab", ] @@ -347,7 +347,7 @@ dependencies = [ "futures-io", "futures-lite 2.3.0", "parking", - "polling 3.5.0", + "polling 3.6.0", "rustix 0.38.32", "slab", "tracing", @@ -488,9 +488,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -680,7 +680,7 @@ dependencies = [ "async-channel 2.2.0", "async-lock 3.3.0", "async-task", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", "futures-lite 2.3.0", "piper", @@ -732,7 +732,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -759,9 +759,9 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bzip2" @@ -802,7 +802,7 @@ checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" dependencies = [ "bitflags 2.5.0", "log", - "polling 3.5.0", + "polling 3.6.0", "rustix 0.38.32", "slab", "thiserror", @@ -1099,7 +1099,7 @@ version = "4.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "memchr", ] @@ -1126,9 +1126,12 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "cookie-factory" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b" +checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" +dependencies = [ + "futures 0.3.30", +] [[package]] name = "core-foundation" @@ -1357,7 +1360,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1619,7 +1622,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -1906,9 +1909,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" [[package]] name = "fdeflate" @@ -2104,7 +2107,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -2257,7 +2260,7 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-core", "futures-io", "parking", @@ -2272,7 +2275,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3191,13 +3194,13 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fbd2820c5e49886948654ab546d0688ff24530286bdcf8fca3cefb16d4618eb" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "fnv", "futures-core", "futures-sink", "futures-util", "http", - "indexmap 2.2.5", + "indexmap 2.2.6", "slab", "tokio 1.36.0", "tokio-util 0.7.10", @@ -3325,7 +3328,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "fnv", "itoa 1.0.10", ] @@ -3346,7 +3349,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "http", "pin-project-lite 0.2.13", ] @@ -3408,7 +3411,7 @@ version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-channel", "futures-core", "futures-util", @@ -3491,7 +3494,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "hyper 0.14.28", "native-tls", "tokio 1.36.0", @@ -3518,7 +3521,7 @@ version = "0.13.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92a86226a7a16632de6723449ee5fe70bac5af718bc642ee9ca2f0f6e14fa1fa" dependencies = [ - "arc-swap 1.7.0", + "arc-swap 1.7.1", "fluent", "fluent-langneg", "fluent-syntax", @@ -3550,7 +3553,7 @@ dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", "strsim 0.10.0", - "syn 2.0.53", + "syn 2.0.55", "unic-langid", ] @@ -3564,7 +3567,7 @@ dependencies = [ "i18n-config", "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -3846,9 +3849,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -4243,9 +4246,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.15" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" +checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" dependencies = [ "cc", "libc", @@ -4649,7 +4652,7 @@ dependencies = [ "bitflags 2.5.0", "codespan-reporting", "hexf-parse", - "indexmap 2.2.5", + "indexmap 2.2.6", "log", "num-traits 0.2.18", "rustc-hash", @@ -4941,7 +4944,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5080,7 +5083,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5141,7 +5144,7 @@ dependencies = [ "proc-macro2 1.0.79", "proc-macro2-diagnostics", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5173,7 +5176,7 @@ checksum = "e8890702dbec0bad9116041ae586f84805b13eecd1d8b1df27c29998a9969d6d" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5411,7 +5414,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5449,7 +5452,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -5477,7 +5480,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" dependencies = [ "atomic-waker", - "fastrand 2.0.1", + "fastrand 2.0.2", "futures-io", ] @@ -5589,12 +5592,13 @@ dependencies = [ [[package]] name = "polling" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" +checksum = "e0c976a60b2d7e99d6f229e414670a9b85d13ac305cc6d1e9c134de58c5aaaf6" dependencies = [ "cfg-if 1.0.0", "concurrent-queue", + "hermit-abi 0.3.9", "pin-project-lite 0.2.13", "rustix 0.38.32", "tracing", @@ -5697,7 +5701,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", "version_check", "yansi", ] @@ -5976,9 +5980,9 @@ checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" [[package]] name = "rayon" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4963ed1bc86e4f3ee217022bd855b297cef07fb9eac5dfa1f788b220b49b3bd" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", @@ -6069,9 +6073,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -6149,7 +6153,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" dependencies = [ "base64 0.21.7", - "bytes 1.5.0", + "bytes 1.6.0", "encoding_rs", "futures-core", "futures-util", @@ -6288,7 +6292,7 @@ dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", "rust-embed-utils", - "syn 2.0.53", + "syn 2.0.55", "walkdir", ] @@ -6674,7 +6678,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -6854,9 +6858,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smithay-client-toolkit" @@ -6946,7 +6950,7 @@ dependencies = [ "cocoa 0.25.0", "core-graphics 0.23.1", "drm", - "fastrand 2.0.1", + "fastrand 2.0.2", "foreign-types 0.5.0", "js-sys", "log", @@ -7132,9 +7136,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.53" +version = "2.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", @@ -7228,7 +7232,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if 1.0.0", - "fastrand 2.0.1", + "fastrand 2.0.2", "rustix 0.38.32", "windows-sys 0.52.0", ] @@ -7302,7 +7306,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -7460,7 +7464,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", - "bytes 1.5.0", + "bytes 1.6.0", "libc", "mio 0.8.11", "num_cpus", @@ -7581,7 +7585,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ - "bytes 1.5.0", + "bytes 1.6.0", "futures-core", "futures-sink", "pin-project-lite 0.2.13", @@ -7607,7 +7611,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.8", + "toml_edit 0.22.9", ] [[package]] @@ -7625,18 +7629,18 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "toml_datetime", "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.22.8" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c12219811e0c1ba077867254e5ad62ee2c9c190b0d957110750ac0cda1ae96cd" +checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -7669,7 +7673,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -8016,7 +8020,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", "wasm-bindgen-shared", ] @@ -8050,7 +8054,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -8276,7 +8280,7 @@ dependencies = [ "bitflags 2.5.0", "cfg_aliases 0.1.1", "codespan-reporting", - "indexmap 2.2.5", + "indexmap 2.2.6", "log", "naga", "once_cell", @@ -8916,7 +8920,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] @@ -8936,7 +8940,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.53", + "syn 2.0.55", ] [[package]] diff --git a/crates/core/src/widget/header.rs b/crates/core/src/widget/header.rs index a445bf1..90bcac1 100644 --- a/crates/core/src/widget/header.rs +++ b/crates/core/src/widget/header.rs @@ -1,5 +1,6 @@ #![allow(clippy::type_complexity)] use crate::style::header::StyleSheet; +use iced::advanced::renderer; use iced_core::{ event, layout, mouse, widget::{self, Tree}, @@ -13,9 +14,9 @@ pub use state::State; pub struct Header<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> where - Renderer: 'a + iced_core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, - Message: 'a, + Message: Clone, { spacing: u16, width: Length, @@ -32,9 +33,9 @@ where impl<'a, Message, Theme, Renderer> Header<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, - Theme: StyleSheet + 'a, - Message: 'a, + Renderer: renderer::Renderer, + Theme: StyleSheet, + Message: Clone, { pub fn new( state: State, @@ -138,9 +139,9 @@ where impl<'a, Message, Theme, Renderer> Widget for Header<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, + Renderer: renderer::Renderer, Theme: StyleSheet, - Message: 'a, + Message: Clone, { fn children(&self) -> Vec { self.children.iter().map(Tree::new).collect() @@ -372,9 +373,9 @@ where impl<'a, Message, Theme: 'a, Renderer> From> for Element<'a, Message, Theme, Renderer> where - Renderer: 'a + iced_core::Renderer, - Theme: StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, - Message: 'a, + Renderer: 'a + renderer::Renderer, + Theme: 'a + StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, + Message: 'a + Clone, { fn from(header: Header<'a, Message, Theme, Renderer>) -> Element<'a, Message, Theme, Renderer> { Element::new(header) diff --git a/src/gui/element/wallet/operation/tx_list.rs b/src/gui/element/wallet/operation/tx_list.rs index 0e445b8..58ea870 100644 --- a/src/gui/element/wallet/operation/tx_list.rs +++ b/src/gui/element/wallet/operation/tx_list.rs @@ -1,6 +1,7 @@ use std::borrow::Borrow; use grin_gui_core::config::TxMethod; +use grin_gui_core::theme::Theme; use iced_core::Widget; use { @@ -10,12 +11,12 @@ use { crate::Result, grin_gui_core::theme::{ Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, Theme, }, grin_gui_core::widget::header, grin_gui_core::{ config::Config, node::amount_to_hr_string, + style::header::HeaderStyle, theme::{ButtonStyle, ColorPalette, ContainerStyle}, wallet::{TxLogEntry, TxLogEntryType}, }, @@ -954,7 +955,6 @@ pub fn titles_row_header<'a>( ) .spacing(1) .height(Length::Fixed(25.0)) - .into() /* .on_resize(3, |event| { //TODO //Message::Interaction(Interaction::ResizeColumn(Mode::Catalog, event)) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 15a2cc1..ee1e988 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -199,20 +199,21 @@ impl Application for GrinGui { } /*#[cfg(target_os = "windows")] - fn mode(&self) -> iced::window::Mode { - use crate::tray::GUI_VISIBLE; - use iced::window::Mode; - use std::sync::atomic::Ordering; - - if GUI_VISIBLE.load(Ordering::Relaxed) { - Mode::Windowed - } else { - Mode::Hidden - } - }*/ + fn mode(&self) -> iced::window::Mode { + use crate::tray::GUI_VISIBLE; + use iced::window::Mode; + use std::sync::atomic::Ordering; + use iced_futures::subscription::events; // Add missing import + + if GUI_VISIBLE.load(Ordering::Relaxed) { + Mode::Windowed + } else { + Mode::Hidden + } + }*/ fn subscription(&self) -> Subscription { - let runtime_subscription = iced_futures::subscription::events().map(Message::RuntimeEvent); + let runtime_subscription = iced_futures::event::listen().map(Message::RuntimeEvent); // Fix function call let tick_subscription = time::every(std::time::Duration::from_millis(1000)).map(Message::Tick); let node_subscription = subscriber::subscriber(0).map(|e| Message::SendNodeMessage(e)); From fa8342393c6c5ffdcbf76e5d2decd26a9b14b5c7 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Mon, 25 Mar 2024 21:05:17 +0000 Subject: [PATCH 07/12] now at compilation state, but many things not working --- crates/core/src/style/header.rs | 4 +-- crates/core/src/style/table_row.rs | 28 +++++++++---------- crates/core/src/theme/mod.rs | 6 ++-- crates/core/src/widget/header.rs | 10 +++---- crates/core/src/widget/table_row.rs | 23 ++++++++++++++-- src/gui/element/wallet/operation/tx_list.rs | 12 ++++---- src/gui/element/wallet/setup/wallet_list.rs | 20 ++++++++------ src/gui/element/wallet/setup/wallet_setup.rs | 28 +++++++++---------- src/gui/mod.rs | 29 ++++++++++++-------- src/gui/update.rs | 8 ++++-- 10 files changed, 100 insertions(+), 68 deletions(-) diff --git a/crates/core/src/style/header.rs b/crates/core/src/style/header.rs index 2ca4500..1ca682f 100644 --- a/crates/core/src/style/header.rs +++ b/crates/core/src/style/header.rs @@ -1,4 +1,4 @@ -use iced::Theme; +use crate::theme::Theme; use iced_core::{Background, Color}; /// The appearance of a header. @@ -38,7 +38,7 @@ impl StyleSheet for Theme { HeaderStyle::Default => Appearance { //text_color: Some(self.palette.bright.surface), text_color: None, - background: Some(Background::Color(self.palette().primary)), + background: Some(Background::Color(self.palette.normal.primary)), border_radius: 0.0, border_width: 0.0, border_color: Color::TRANSPARENT, diff --git a/crates/core/src/style/table_row.rs b/crates/core/src/style/table_row.rs index 9acec48..b07b492 100644 --- a/crates/core/src/style/table_row.rs +++ b/crates/core/src/style/table_row.rs @@ -1,4 +1,4 @@ -use iced::Theme; +use crate::theme::Theme; use iced::{Background, Color}; /// The appearance of a table row. @@ -40,8 +40,8 @@ impl StyleSheet for Theme { fn appearance(&self, style: &Self::Style) -> Appearance { match style { TableRowStyle::Default => Appearance { - text_color: Some(self.palette().primary), - background: Some(Background::Color(self.palette().primary)), + text_color: Some(self.palette.normal.primary), + background: Some(Background::Color(self.palette.normal.primary)), border_radius: 0.0, border_width: 0.0, border_color: Color::TRANSPARENT, @@ -53,15 +53,15 @@ impl StyleSheet for Theme { TableRowStyle::TableRowAlternate => Appearance { background: Some(Background::Color(Color { a: 0.50, - ..self.palette().primary + ..self.palette.normal.primary })), ..Appearance::default() }, TableRowStyle::TableRowHighlife => Appearance { - text_color: Some(self.palette().primary), + text_color: Some(self.palette.normal.primary), background: Some(Background::Color(Color { a: 0.30, - ..self.palette().primary + ..self.palette.normal.primary })), border_radius: 0.0, border_width: 0.0, @@ -70,7 +70,7 @@ impl StyleSheet for Theme { offset_right: 0.0, }, TableRowStyle::TableRowLowlife => Appearance { - text_color: Some(self.palette().primary), + text_color: Some(self.palette.normal.primary), background: Some(Background::Color(Color::TRANSPARENT)), border_radius: 0.0, border_width: 0.0, @@ -79,8 +79,8 @@ impl StyleSheet for Theme { offset_right: 0.0, }, TableRowStyle::TableRowSelected => Appearance { - text_color: Some(self.palette().primary), - background: Some(Background::Color(self.palette().primary)), + text_color: Some(self.palette.normal.primary), + background: Some(Background::Color(self.palette.normal.primary)), border_radius: 0.0, border_width: 0.0, border_color: Color::TRANSPARENT, @@ -97,35 +97,35 @@ impl StyleSheet for Theme { TableRowStyle::Default => Appearance { background: Some(Background::Color(Color { a: 0.60, - ..self.palette().primary + ..self.palette.normal.primary })), ..appearance }, TableRowStyle::TableRowAlternate => Appearance { background: Some(Background::Color(Color { a: 0.25, - ..self.palette().primary + ..self.palette.normal.primary })), ..appearance }, TableRowStyle::TableRowHighlife => Appearance { background: Some(Background::Color(Color { a: 0.60, - ..self.palette().primary + ..self.palette.normal.primary })), ..appearance }, TableRowStyle::TableRowLowlife => Appearance { background: Some(Background::Color(Color { a: 0.60, - ..self.palette().primary + ..self.palette.normal.primary })), ..appearance }, TableRowStyle::TableRowSelected => Appearance { background: Some(Background::Color(Color { a: 0.60, - ..self.palette().primary + ..self.palette.normal.primary })), ..appearance }, diff --git a/crates/core/src/theme/mod.rs b/crates/core/src/theme/mod.rs index 320fff7..3ef03b4 100644 --- a/crates/core/src/theme/mod.rs +++ b/crates/core/src/theme/mod.rs @@ -1,4 +1,5 @@ use crate::fs; +use iced::application::StyleSheet; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; @@ -58,8 +59,9 @@ pub type PickList<'a, T, L, V, Message> = pub type Radio = iced::widget::Radio; pub type Card<'a, Message> = iced_aw::native::Card<'a, Message, Theme, Renderer>; pub type Modal<'a, Message, Theme, Renderer> = iced_aw::modal::Modal<'a, Message, Theme, Renderer>; -pub type Header<'a, Message> = crate::widget::header::Header<'a, Message, Theme, Renderer>; -pub type TableRow<'a, Message> = crate::widget::table_row::TableRow<'a, Message, Theme, Renderer>; +pub type Header<'a, Message, Theme> = crate::widget::header::Header<'a, Message, Theme, Renderer>; +pub type TableRow<'a, Message, Theme> = + crate::widget::table_row::TableRow<'a, Message, Theme, Renderer>; #[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)] pub struct BaseColors { diff --git a/crates/core/src/widget/header.rs b/crates/core/src/widget/header.rs index 90bcac1..fc46729 100644 --- a/crates/core/src/widget/header.rs +++ b/crates/core/src/widget/header.rs @@ -12,7 +12,7 @@ use iced::{widget::space::Space, Size}; mod state; pub use state::State; -pub struct Header<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> +pub struct Header<'a, Message, Theme, Renderer = iced::Renderer> where Renderer: renderer::Renderer, Theme: StyleSheet, @@ -370,14 +370,14 @@ where }*/ } -impl<'a, Message, Theme: 'a, Renderer> From> - for Element<'a, Message, Theme, Renderer> +impl<'a, Message, Theme> From> + for Element<'a, Message, Theme, iced::Renderer> where - Renderer: 'a + renderer::Renderer, + //Renderer: 'a + renderer::Renderer, Theme: 'a + StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, Message: 'a + Clone, { - fn from(header: Header<'a, Message, Theme, Renderer>) -> Element<'a, Message, Theme, Renderer> { + fn from(header: Header<'a, Message, Theme>) -> Self { Element::new(header) } } diff --git a/crates/core/src/widget/table_row.rs b/crates/core/src/widget/table_row.rs index 8123cd0..55564c0 100644 --- a/crates/core/src/widget/table_row.rs +++ b/crates/core/src/widget/table_row.rs @@ -8,7 +8,7 @@ use iced_core::{ use iced::{Border, Size}; #[allow(missing_debug_implementations)] -pub struct TableRow<'a, Message, Theme = iced::Theme, Renderer = iced::Renderer> +pub struct TableRow<'a, Message, Theme, Renderer = iced::Renderer> where Renderer: 'a + iced_core::Renderer, Theme: StyleSheet, @@ -53,6 +53,11 @@ where } } + pub fn width(mut self, width: Length) -> Self { + self.width = width; + self + } + /// Sets the style of the [`TableRow`]. pub fn style(mut self, style: S) -> Self where @@ -337,7 +342,7 @@ where } } -impl<'a, Message, Theme: 'a, Renderer> From> +/*impl<'a, Message, Theme: 'a, Renderer> From> for Element<'a, Message, Theme, Renderer> where Renderer: 'a + iced_core::Renderer, @@ -346,7 +351,19 @@ where { fn from( table_row: TableRow<'a, Message, Theme, Renderer>, - ) -> Element<'a, Message, Theme, Renderer> { + ) -> Self { Element::new(table_row) } +}*/ + +impl<'a, Message, Theme, Renderer> From> + for Element<'a, Message, Theme, Renderer> +where + Message: 'a, + Theme: 'a + StyleSheet, + Renderer: iced_core::Renderer + 'a, +{ + fn from(column: TableRow<'a, Message, Theme, Renderer>) -> Self { + Self::new(column) + } } diff --git a/src/gui/element/wallet/operation/tx_list.rs b/src/gui/element/wallet/operation/tx_list.rs index 58ea870..50ec83a 100644 --- a/src/gui/element/wallet/operation/tx_list.rs +++ b/src/gui/element/wallet/operation/tx_list.rs @@ -1,8 +1,6 @@ -use std::borrow::Borrow; - use grin_gui_core::config::TxMethod; -use grin_gui_core::theme::Theme; use iced_core::Widget; +use std::borrow::Borrow; use { super::super::super::{BUTTON_WIDTH, DEFAULT_FONT_SIZE, DEFAULT_PADDING, SMALLER_FONT_SIZE}, @@ -11,6 +9,7 @@ use { crate::Result, grin_gui_core::theme::{ Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, + Theme, }, grin_gui_core::widget::header, grin_gui_core::{ @@ -896,7 +895,7 @@ pub fn titles_row_header<'a>( column_state: &'a [ColumnState], previous_column_key: Option, previous_sort_direction: Option, -) -> Header<'a, Message> { +) -> Header<'a, Message, Theme> { // A row containing titles above the addon rows. let mut row_titles = vec![]; @@ -947,7 +946,10 @@ pub fn titles_row_header<'a>( Header::new( header_state.clone(), - row_titles, + row_titles + .into_iter() + .map(|row| (row.0, row.1.into())) + .collect(), // Some(Length::Fixed(DEFAULT_PADDING)), // Some(Length::Fixed(DEFAULT_PADDING + 5)), None, diff --git a/src/gui/element/wallet/setup/wallet_list.rs b/src/gui/element/wallet/setup/wallet_list.rs index 5fb56aa..ad74ab7 100644 --- a/src/gui/element/wallet/setup/wallet_list.rs +++ b/src/gui/element/wallet/setup/wallet_list.rs @@ -287,7 +287,7 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain } let wallet_row = Row::new() - //.push(checkbox) + // .push(checkbox) .push( Column::new() .push(wallet_name_container) @@ -309,9 +309,8 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain .width(Length::Fill) .on_press(move |_| { log::debug!("data_container::table_row::on_press {}", pos); - - Message::Interaction(Interaction::WalletListWalletViewInteraction( - LocalViewInteraction::WalletRowSelect(true, pos), + Interaction::WalletListWalletViewInteraction(LocalViewInteraction::WalletRowSelect( + true, pos, )) }); @@ -330,10 +329,12 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain } } - wallet_rows.push(table_row.into()); + wallet_rows.push(table_row); } - let wallet_column = Column::new().push(Column::with_children(wallet_rows)); + let wallet_column = Column::new().push(Column::with_children( + wallet_rows.into_iter().map(|row| row.into()), + )); let load_wallet_button_container = Container::new(Text::new(localized_string("load-wallet")).size(DEFAULT_FONT_SIZE)) @@ -389,15 +390,16 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain let scrollable = Scrollable::new(wallet_column).style(grin_gui_core::theme::ScrollableStyle::Primary); - let table_colummn = Column::new().push(table_header_container).push(scrollable); - let table_container = Container::new(table_colummn) + let table_column = Column::new().push(table_header_container).push(scrollable); + let table_container = Container::new(table_column) .style(grin_gui_core::theme::ContainerStyle::PanelBordered) .height(Length::Fill) .padding(1); let row = Row::new().push( Column::new() - .push(table_container) + // TODO: Find out why this isn't working + //.push(table_container) .push(Space::with_height(Length::Fixed(DEFAULT_PADDING))) .push(button_row), ); diff --git a/src/gui/element/wallet/setup/wallet_setup.rs b/src/gui/element/wallet/setup/wallet_setup.rs index e22087a..2b4e4de 100644 --- a/src/gui/element/wallet/setup/wallet_setup.rs +++ b/src/gui/element/wallet/setup/wallet_setup.rs @@ -313,7 +313,7 @@ pub fn data_container<'a>( .padding(6) .width(Length::Fixed(200.0)) .style(grin_gui_core::theme::TextInputStyle::AddonsQuery) - .password(); + .secure(true); let password_input: Element = password_input.into(); @@ -333,7 +333,7 @@ pub fn data_container<'a>( .padding(6) .width(Length::Fixed(200.0)) .style(grin_gui_core::theme::TextInputStyle::AddonsQuery) - .password(); + .secure(true); let repeat_password_input: Element = repeat_password_input.into(); @@ -374,12 +374,12 @@ pub fn data_container<'a>( let checkbox = Checkbox::new( localized_string("restore-from-seed"), state.restore_from_seed, - |b| { - Interaction::WalletSetupWalletViewInteraction( - LocalViewInteraction::ToggleRestoreFromSeed(b), - ) - }, ) + .on_toggle(|b| { + Interaction::WalletSetupWalletViewInteraction( + LocalViewInteraction::ToggleRestoreFromSeed(b), + ) + }) .style(grin_gui_core::theme::CheckboxStyle::Normal) .text_size(DEFAULT_FONT_SIZE) .spacing(10); @@ -395,12 +395,12 @@ pub fn data_container<'a>( let checkbox = Checkbox::new( localized_string("show-advanced-options"), state.show_advanced_options, - |b| { - Interaction::WalletSetupWalletViewInteraction( - LocalViewInteraction::ToggleAdvancedOptions(b), - ) - }, ) + .on_toggle(|b| { + Interaction::WalletSetupWalletViewInteraction( + LocalViewInteraction::ToggleAdvancedOptions(b), + ) + }) .style(grin_gui_core::theme::CheckboxStyle::Normal) .text_size(DEFAULT_FONT_SIZE) .spacing(10); @@ -496,8 +496,8 @@ pub fn data_container<'a>( let display_name_input: Element = display_name_input.into(); - let is_testnet_checkbox = - Checkbox::new(localized_string("use-testnet"), state.is_testnet, |b| { + let is_testnet_checkbox = Checkbox::new(localized_string("use-testnet"), state.is_testnet) + .on_toggle(|b| { Interaction::WalletSetupWalletViewInteraction(LocalViewInteraction::ToggleIsTestnet(b)) }) .style(grin_gui_core::theme::CheckboxStyle::Normal) diff --git a/src/gui/mod.rs b/src/gui/mod.rs index ee1e988..20faec1 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -282,20 +282,27 @@ impl Application for GrinGui { .style(grin_gui_core::theme::ContainerStyle::NormalBackground) .into(); - let content: Element = match self.modal_type { - ModalType::Exit => element::modal::exit_card().into(), - ModalType::Error => { - let error_cause = self - .error - .as_ref() - .map_or_else(|| "unknown error".to_owned(), |e| error_cause_string(e)); - - element::modal::error_card(error_cause.clone()).into() - } + let overlay = if self.show_modal { + Some({ + let content: Element = match self.modal_type { + ModalType::Exit => element::modal::exit_card().into(), + ModalType::Error => { + let error_cause = self + .error + .as_ref() + .map_or_else(|| "unknown error".to_owned(), |e| error_cause_string(e)); + + element::modal::error_card(error_cause.clone()).into() + } + }; + content + }) + } else { + None }; // self.show_modal? - Modal::new(underlay, Some(content)) + Modal::new(underlay, overlay) .on_esc(Message::Interaction(Interaction::CloseErrorModal)) .style(grin_gui_core::theme::ModalStyle::Normal) .into() diff --git a/src/gui/update.rs b/src/gui/update.rs index 3356059..b1ad7aa 100644 --- a/src/gui/update.rs +++ b/src/gui/update.rs @@ -339,9 +339,11 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result { grin_gui.mode = Mode::Install; } - iced::keyboard::Key::Named(Escape) => match grin_gui.mode { - _ => (), - }, + iced::keyboard::Key::Named(iced::keyboard::key::Named::Escape) => { + match grin_gui.mode { + _ => (), + } + } _ => (), } } From 8fb807af34121e6ce0c07ef4e762fcc5533362c7 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Tue, 2 Apr 2024 12:26:16 +0100 Subject: [PATCH 08/12] table adjustments (still not appearing) and button text fixes --- Cargo.lock | 223 ++++++++++---------- crates/core/src/style/table_row.rs | 9 +- crates/core/src/theme/button.rs | 6 +- crates/core/src/theme/container.rs | 1 + crates/core/src/widget/table_row.rs | 8 +- src/gui/element/mod.rs | 2 +- src/gui/element/wallet/operation/open.rs | 17 +- src/gui/element/wallet/setup/wallet_list.rs | 17 +- 8 files changed, 143 insertions(+), 140 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2627a03..1c4501a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,16 +281,16 @@ checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", "event-listener 5.2.0", - "event-listener-strategy 0.5.0", + "event-listener-strategy 0.5.1", "futures-core", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] name = "async-executor" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" +checksum = "10b3e585719c2358d2660232671ca8ca4ddb4be4ce8a1842d6c2dc8685303316" dependencies = [ "async-lock 3.3.0", "async-task", @@ -322,7 +322,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ "async-lock 2.8.0", - "autocfg 1.1.0", + "autocfg 1.2.0", "cfg-if 1.0.0", "concurrent-queue", "futures-lite 1.13.0", @@ -371,7 +371,7 @@ checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ "event-listener 4.0.3", "event-listener-strategy 0.4.0", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -430,7 +430,7 @@ dependencies = [ "log", "memchr", "once_cell", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "pin-utils", "slab", "wasm-bindgen-futures", @@ -477,14 +477,14 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" @@ -732,7 +732,7 @@ checksum = "4da9a32f3fed317401fa3c862968128267c3106685286e15d5aaa3d7389c2f60" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -914,9 +914,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.35" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1330,7 +1330,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ "csv-core", - "itoa 1.0.10", + "itoa 1.0.11", "ryu", "serde", ] @@ -1360,7 +1360,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -1593,7 +1593,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", - "redox_users 0.4.4", + "redox_users 0.4.5", "winapi 0.3.9", ] @@ -1604,7 +1604,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users 0.4.4", + "redox_users 0.4.5", "winapi 0.3.9", ] @@ -1622,7 +1622,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -1837,7 +1837,7 @@ checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" dependencies = [ "concurrent-queue", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -1848,7 +1848,7 @@ checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" dependencies = [ "concurrent-queue", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -1859,7 +1859,7 @@ checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" dependencies = [ "concurrent-queue", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -1869,17 +1869,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ "event-listener 4.0.3", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] name = "event-listener-strategy" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" +checksum = "332f51cb23d20b0de8458b86580878211da09bcd4503cb579c225b3d124cabb3" dependencies = [ "event-listener 5.2.0", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -2107,7 +2107,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -2250,7 +2250,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "waker-fn", ] @@ -2264,7 +2264,7 @@ dependencies = [ "futures-core", "futures-io", "parking", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -2275,7 +2275,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -2303,7 +2303,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "pin-utils", "slab", ] @@ -3202,7 +3202,7 @@ dependencies = [ "http", "indexmap 2.2.6", "slab", - "tokio 1.36.0", + "tokio 1.37.0", "tokio-util 0.7.10", "tracing", ] @@ -3330,7 +3330,7 @@ checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes 1.6.0", "fnv", - "itoa 1.0.10", + "itoa 1.0.11", ] [[package]] @@ -3351,7 +3351,7 @@ checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes 1.6.0", "http", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", ] [[package]] @@ -3420,10 +3420,10 @@ dependencies = [ "http-body 0.4.6", "httparse", "httpdate 1.0.3", - "itoa 1.0.10", - "pin-project-lite 0.2.13", + "itoa 1.0.11", + "pin-project-lite 0.2.14", "socket2 0.5.6", - "tokio 1.36.0", + "tokio 1.37.0", "tower-service", "tracing", "want", @@ -3497,7 +3497,7 @@ dependencies = [ "bytes 1.6.0", "hyper 0.14.28", "native-tls", - "tokio 1.36.0", + "tokio 1.37.0", "tokio-native-tls", ] @@ -3553,7 +3553,7 @@ dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", "strsim 0.10.0", - "syn 2.0.55", + "syn 2.0.57", "unic-langid", ] @@ -3567,7 +3567,7 @@ dependencies = [ "i18n-config", "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -3645,7 +3645,7 @@ dependencies = [ "futures 0.3.30", "iced_core", "log", - "tokio 1.36.0", + "tokio 1.37.0", "wasm-bindgen-futures", "wasm-timer", ] @@ -3843,7 +3843,7 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "hashbrown 0.12.3", ] @@ -4014,9 +4014,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jni" @@ -4224,9 +4224,9 @@ dependencies = [ [[package]] name = "libredox" -version = "0.0.1" +version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" dependencies = [ "bitflags 2.5.0", "libc", @@ -4235,13 +4235,12 @@ dependencies = [ [[package]] name = "libredox" -version = "0.0.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ "bitflags 2.5.0", "libc", - "redox_syscall 0.4.1", ] [[package]] @@ -4318,7 +4317,7 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "scopeguard", ] @@ -4454,9 +4453,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "memmap" @@ -4539,7 +4538,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" dependencies = [ "adler", - "autocfg 1.1.0", + "autocfg 1.2.0", ] [[package]] @@ -4715,8 +4714,8 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework 2.9.2", - "security-framework-sys 2.9.1", + "security-framework 2.10.0", + "security-framework-sys 2.10.0", "tempfile", ] @@ -4829,7 +4828,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "num-integer", "num-traits 0.2.18", ] @@ -4840,7 +4839,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "num-traits 0.2.18", ] @@ -4851,7 +4850,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.4", - "itoa 1.0.10", + "itoa 1.0.11", ] [[package]] @@ -4869,7 +4868,7 @@ version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "num-integer", "num-traits 0.2.18", ] @@ -4880,7 +4879,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "num-bigint", "num-integer", "num-traits 0.2.18", @@ -4892,7 +4891,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "num-integer", "num-traits 0.2.18", ] @@ -4912,7 +4911,7 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "libm", ] @@ -4944,7 +4943,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -5083,7 +5082,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -5094,9 +5093,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.101" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ "cc", "libc", @@ -5144,7 +5143,7 @@ dependencies = [ "proc-macro2 1.0.79", "proc-macro2-diagnostics", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -5176,7 +5175,7 @@ checksum = "e8890702dbec0bad9116041ae586f84805b13eecd1d8b1df27c29998a9969d6d" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -5414,7 +5413,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -5452,7 +5451,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -5463,9 +5462,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -5580,13 +5579,13 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", "bitflags 1.3.2", "cfg-if 1.0.0", "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "windows-sys 0.48.0", ] @@ -5599,7 +5598,7 @@ dependencies = [ "cfg-if 1.0.0", "concurrent-queue", "hermit-abi 0.3.9", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "rustix 0.38.32", "tracing", "windows-sys 0.52.0", @@ -5701,7 +5700,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", "version_check", "yansi", ] @@ -6062,12 +6061,12 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" dependencies = [ "getrandom 0.2.12", - "libredox 0.0.1", + "libredox 0.1.3", "thiserror", ] @@ -6096,9 +6095,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "renderdoc-sys" @@ -6130,7 +6129,7 @@ dependencies = [ "mime_guess", "native-tls", "percent-encoding", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "rustls 0.18.1", "serde", "serde_urlencoded", @@ -6169,14 +6168,14 @@ dependencies = [ "native-tls", "once_cell", "percent-encoding", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", "system-configuration", - "tokio 1.36.0", + "tokio 1.37.0", "tokio-native-tls", "tower-service", "url", @@ -6292,7 +6291,7 @@ dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", "rust-embed-utils", - "syn 2.0.55", + "syn 2.0.57", "walkdir", ] @@ -6574,15 +6573,15 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" dependencies = [ "bitflags 1.3.2", "core-foundation 0.9.4", "core-foundation-sys 0.8.6", "libc", - "security-framework-sys 2.9.1", + "security-framework-sys 2.10.0", ] [[package]] @@ -6597,9 +6596,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" dependencies = [ "core-foundation-sys 0.8.6", "libc", @@ -6678,16 +6677,16 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] name = "serde_json" -version = "1.0.114" +version = "1.0.115" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" dependencies = [ - "itoa 1.0.10", + "itoa 1.0.11", "ryu", "serde", ] @@ -6708,7 +6707,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ "form_urlencoded", - "itoa 1.0.10", + "itoa 1.0.11", "ryu", "serde", ] @@ -6824,7 +6823,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "autocfg 1.1.0", + "autocfg 1.2.0", ] [[package]] @@ -7136,9 +7135,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.55" +version = "2.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0" +checksum = "11a6ae1e52eb25aab8f3fb9fca13be982a373b8f1157ca14b897a825ba4a2d35" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", @@ -7306,7 +7305,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -7459,16 +7458,16 @@ dependencies = [ [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes 1.6.0", "libc", "mio 0.8.11", "num_cpus", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "socket2 0.5.6", "windows-sys 0.48.0", ] @@ -7501,7 +7500,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", - "tokio 1.36.0", + "tokio 1.37.0", ] [[package]] @@ -7588,8 +7587,8 @@ dependencies = [ "bytes 1.6.0", "futures-core", "futures-sink", - "pin-project-lite 0.2.13", - "tokio 1.36.0", + "pin-project-lite 0.2.14", + "tokio 1.37.0", "tracing", ] @@ -7660,7 +7659,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "log", - "pin-project-lite 0.2.13", + "pin-project-lite 0.2.14", "tracing-attributes", "tracing-core", ] @@ -7673,7 +7672,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -8020,7 +8019,7 @@ dependencies = [ "once_cell", "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", "wasm-bindgen-shared", ] @@ -8054,7 +8053,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -8848,9 +8847,9 @@ checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" [[package]] name = "xml-rs" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" +checksum = "791978798f0597cfc70478424c2b4fdc2b7a8024aaff78497ef00f24ef674193" [[package]] name = "xxhash-rust" @@ -8920,7 +8919,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] @@ -8940,7 +8939,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2 1.0.79", "quote 1.0.35", - "syn 2.0.55", + "syn 2.0.57", ] [[package]] diff --git a/crates/core/src/style/table_row.rs b/crates/core/src/style/table_row.rs index b07b492..b3843c2 100644 --- a/crates/core/src/style/table_row.rs +++ b/crates/core/src/style/table_row.rs @@ -40,7 +40,7 @@ impl StyleSheet for Theme { fn appearance(&self, style: &Self::Style) -> Appearance { match style { TableRowStyle::Default => Appearance { - text_color: Some(self.palette.normal.primary), + text_color: Some(self.palette.bright.primary), background: Some(Background::Color(self.palette.normal.primary)), border_radius: 0.0, border_width: 0.0, @@ -51,6 +51,7 @@ impl StyleSheet for Theme { offset_right: 0.0, }, TableRowStyle::TableRowAlternate => Appearance { + text_color: Some(self.palette.bright.primary), background: Some(Background::Color(Color { a: 0.50, ..self.palette.normal.primary @@ -58,7 +59,7 @@ impl StyleSheet for Theme { ..Appearance::default() }, TableRowStyle::TableRowHighlife => Appearance { - text_color: Some(self.palette.normal.primary), + text_color: Some(self.palette.bright.primary), background: Some(Background::Color(Color { a: 0.30, ..self.palette.normal.primary @@ -70,7 +71,7 @@ impl StyleSheet for Theme { offset_right: 0.0, }, TableRowStyle::TableRowLowlife => Appearance { - text_color: Some(self.palette.normal.primary), + text_color: Some(self.palette.bright.primary), background: Some(Background::Color(Color::TRANSPARENT)), border_radius: 0.0, border_width: 0.0, @@ -79,7 +80,7 @@ impl StyleSheet for Theme { offset_right: 0.0, }, TableRowStyle::TableRowSelected => Appearance { - text_color: Some(self.palette.normal.primary), + text_color: Some(self.palette.bright.primary), background: Some(Background::Color(self.palette.normal.primary)), border_radius: 0.0, border_width: 0.0, diff --git a/crates/core/src/theme/button.rs b/crates/core/src/theme/button.rs index 96cbb1e..bdfe33e 100644 --- a/crates/core/src/theme/button.rs +++ b/crates/core/src/theme/button.rs @@ -51,7 +51,7 @@ impl button::StyleSheet for Theme { ..button::Appearance::default() }, ButtonStyle::NormalText => button::Appearance { - text_color: self.palette.normal.surface, + text_color: self.palette.bright.primary, border: Border { color: self.palette.normal.primary, width: 1.0, @@ -144,14 +144,14 @@ impl button::StyleSheet for Theme { })), text_color: Color { a: 0.50, - ..self.palette.normal.primary + ..self.palette.bright.primary }, ..self.active(style) }, ButtonStyle::Primary => button::Appearance { text_color: Color { a: 0.25, - ..self.palette.normal.surface + ..self.palette.bright.primary }, ..self.active(style) }, diff --git a/crates/core/src/theme/container.rs b/crates/core/src/theme/container.rs index a3c3ee6..9160109 100644 --- a/crates/core/src/theme/container.rs +++ b/crates/core/src/theme/container.rs @@ -46,6 +46,7 @@ impl container::StyleSheet for Theme { ..container::Appearance::default() }, ContainerStyle::Segmented => container::Appearance { + text_color: Some(self.palette.bright.primary), border: Border { color: self.palette.normal.primary, width: 1.0, diff --git a/crates/core/src/widget/table_row.rs b/crates/core/src/widget/table_row.rs index 55564c0..751fad2 100644 --- a/crates/core/src/widget/table_row.rs +++ b/crates/core/src/widget/table_row.rs @@ -150,9 +150,11 @@ where renderer: &Renderer, limits: &layout::Limits, ) -> layout::Node { - let limits = limits.loose().width(self.height).height(self.height); - //.padding(); - // TODO: Above? + let limits = limits + .loose() + .width(self.width) + .height(self.height) + .shrink(self.padding); let mut content = self .content diff --git a/src/gui/element/mod.rs b/src/gui/element/mod.rs index 6069014..51375e9 100644 --- a/src/gui/element/mod.rs +++ b/src/gui/element/mod.rs @@ -13,4 +13,4 @@ pub static DEFAULT_SUB_HEADER_FONT_SIZE: u16 = 18; pub static DEFAULT_PADDING: f32 = 10.0; pub static BUTTON_WIDTH: f32 = 84.0; -pub static BUTTON_HEIGHT: f32 = 16.0; +pub static BUTTON_HEIGHT: f32 = 20.0; diff --git a/src/gui/element/wallet/operation/open.rs b/src/gui/element/wallet/operation/open.rs index 2e7772f..469c8b3 100644 --- a/src/gui/element/wallet/operation/open.rs +++ b/src/gui/element/wallet/operation/open.rs @@ -229,12 +229,11 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain .align_x(alignment::Horizontal::Center); let mut submit_button = Button::new(submit_button_label_container) + .on_press(Interaction::WalletOperationOpenViewInteraction( + LocalViewInteraction::OpenWallet, + )) .style(grin_gui_core::theme::ButtonStyle::Primary); - submit_button = submit_button.on_press(Interaction::WalletOperationOpenViewInteraction( - LocalViewInteraction::OpenWallet, - )); - let submit_button: Element = submit_button.into(); let cancel_button_label_container = @@ -249,20 +248,18 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain // &mut state.cancel_button_state, cancel_button_label_container, ) - .style(grin_gui_core::theme::ButtonStyle::Primary); - - cancel_button = cancel_button.on_press(Interaction::WalletOperationOpenViewInteraction( + .on_press(Interaction::WalletOperationOpenViewInteraction( LocalViewInteraction::CancelOpenWallet, - )); + )) + .style(grin_gui_core::theme::ButtonStyle::Primary); + let cancel_button: Element = cancel_button.into(); // give our buttons a nice double bordered look to match toolbar buttons - let submit_button: Element = submit_button.into(); let submit_container = Container::new(submit_button.map(Message::Interaction)).padding(1); let submit_container = Container::new(submit_container) .style(grin_gui_core::theme::ContainerStyle::Segmented) .padding(1); - let cancel_button: Element = cancel_button.into(); let cancel_container = Container::new(cancel_button.map(Message::Interaction)).padding(1); let cancel_container = Container::new(cancel_container) .style(grin_gui_core::theme::ContainerStyle::Segmented) diff --git a/src/gui/element/wallet/setup/wallet_list.rs b/src/gui/element/wallet/setup/wallet_list.rs index ad74ab7..bd2facb 100644 --- a/src/gui/element/wallet/setup/wallet_list.rs +++ b/src/gui/element/wallet/setup/wallet_list.rs @@ -262,7 +262,7 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain let wallet_name = Text::new(w.display_name.clone()).size(DEFAULT_FONT_SIZE); let chain_name = Text::new(w.chain_type.shortname()).size(DEFAULT_FONT_SIZE); - let mut wallet_name_container = Container::new(wallet_name) + /*let mut wallet_name_container = Container::new(wallet_name) .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); let mut wallet_chain_container = Container::new(chain_name) @@ -284,11 +284,11 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain .style(grin_gui_core::theme::ContainerStyle::HoverableBrightForeground); wallet_directory_container = wallet_directory_container .style(grin_gui_core::theme::ContainerStyle::HoverableBrightForeground); - } + }*/ let wallet_row = Row::new() // .push(checkbox) - .push( + /* .push( Column::new() .push(wallet_name_container) .width(Length::FillPortion(1)), @@ -302,7 +302,8 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain Column::new() .push(wallet_directory_container) .width(Length::FillPortion(3)), - ); + )*/ + .push(Text::new("arse").size(DEFAULT_FONT_SIZE)); let mut table_row = TableRow::new(wallet_row) .padding(iced::Padding::from(9)) @@ -329,11 +330,14 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain } } + let table_row: Element = table_row.into(); wallet_rows.push(table_row); } let wallet_column = Column::new().push(Column::with_children( - wallet_rows.into_iter().map(|row| row.into()), + wallet_rows + .into_iter() + .map(|row| row.map(Message::Interaction)), )); let load_wallet_button_container = @@ -398,8 +402,7 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain let row = Row::new().push( Column::new() - // TODO: Find out why this isn't working - //.push(table_container) + .push(table_container) .push(Space::with_height(Length::Fixed(DEFAULT_PADDING))) .push(button_row), ); From 5b39461ee0f4fd424a747045218069fdeac11d15 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Wed, 10 Apr 2024 14:44:22 +0100 Subject: [PATCH 09/12] rework of table to include new iced_aw style widget --- crates/core/src/theme/table_header.rs | 42 +++++ crates/core/src/theme/table_row.rs | 215 ++++++++++++++++++++++++++ 2 files changed, 257 insertions(+) create mode 100644 crates/core/src/theme/table_header.rs create mode 100644 crates/core/src/theme/table_row.rs diff --git a/crates/core/src/theme/table_header.rs b/crates/core/src/theme/table_header.rs new file mode 100644 index 0000000..bd5d80b --- /dev/null +++ b/crates/core/src/theme/table_header.rs @@ -0,0 +1,42 @@ +use iced::{Background, Color}; +use iced_aw::style::table_header::Appearance; +use iced_aw::table; + +use super::Theme; + +#[derive(Debug, Clone, Copy, Default)] +pub enum TableHeaderStyle { + #[default] + Default, +} + +impl table::TableHeaderStyleSheet for Theme { + type Style = TableHeaderStyle; + + fn appearance(&self, style: &Self::Style) -> Appearance { + let palette = self.palette; + + match style { + TableHeaderStyle::Default => Appearance { + //text_color: Some(self.palette.bright.surface), + text_color: palette.base.foreground, + background: Some(Background::Color(palette.base.background)), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_right: 0.0, + offset_left: 0.0, + }, + } + } + + fn hovered(&self, style: &Self::Style) -> Appearance { + let palette = self.palette; + match style { + TableHeaderStyle::Default => Appearance { + background: None, + ..Appearance::default() + }, + } + } +} diff --git a/crates/core/src/theme/table_row.rs b/crates/core/src/theme/table_row.rs new file mode 100644 index 0000000..170223e --- /dev/null +++ b/crates/core/src/theme/table_row.rs @@ -0,0 +1,215 @@ +use iced::{Background, Color}; +use iced_aw::style::table_row::{Appearance, RowOrCellAppearance}; +use iced_aw::table; + +use super::Theme; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] +pub enum TableRowStyle { + #[default] + Default, + TableRowAlternate, + TableRowHighlight, + TableRowLowlight, + TableRowSelected, +} + +impl table::TableRowStyleSheet for Theme { + type Style = TableRowStyle; + fn appearance(&self, style: &Self::Style, row_id: u16) -> Appearance { + let palette = self.palette; + + match style { + TableRowStyle::Default => Appearance { + row: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(palette.base.foreground)), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + cell: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(palette.base.foreground)), + border_radius: 0.0.into(), + border_width: 1.0, + border_color: Color::BLACK, + offset_left: 0.0, + offset_right: 0.0, + }, + }, + TableRowStyle::TableRowAlternate => Appearance { + row: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(Color { + a: 0.50, + ..palette.base.foreground + })), + ..RowOrCellAppearance::default() + }, + cell: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(Color { + a: 0.50, + ..palette.normal.primary + })), + ..RowOrCellAppearance::default() + }, + }, + TableRowStyle::TableRowHighlight => Appearance { + row: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(Color { + a: 0.30, + ..palette.base.foreground + })), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + cell: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(Color { + a: 0.30, + ..palette.base.foreground + })), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + }, + TableRowStyle::TableRowLowlight => Appearance { + row: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(Color::TRANSPARENT)), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + cell: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(Color::TRANSPARENT)), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + }, + TableRowStyle::TableRowSelected => Appearance { + row: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(palette.normal.primary)), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + cell: RowOrCellAppearance { + text_color: palette.normal.primary, + background: Some(Background::Color(palette.normal.primary)), + border_radius: 0.0.into(), + border_width: 0.0, + border_color: Color::TRANSPARENT, + offset_left: 0.0, + offset_right: 0.0, + }, + }, + } + } + + fn hovered(&self, style: &Self::Style, row_id: u16) -> Appearance { + let palette = self.palette; + match style { + TableRowStyle::Default => Appearance { + row: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.60, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).row + }, + cell: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.60, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).cell + }, + }, + TableRowStyle::TableRowAlternate => Appearance { + row: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.25, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).row + }, + cell: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.25, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).cell + }, + }, + TableRowStyle::TableRowHighlight => Appearance { + row: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.60, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).row + }, + cell: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.60, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).cell + }, + }, + TableRowStyle::TableRowLowlight => Appearance { + row: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.60, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).row + }, + cell: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.60, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).cell + }, + }, + TableRowStyle::TableRowSelected => Appearance { + row: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.60, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).row + }, + cell: RowOrCellAppearance { + background: Some(Background::Color(Color { + a: 0.60, + ..palette.normal.primary + })), + ..self.appearance(style, row_id).cell + }, + }, + } + } +} From ee1f032b25e6b219d32ef764b4753cdc8d69f772 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Thu, 11 Apr 2024 12:01:35 +0100 Subject: [PATCH 10/12] includes modified version of table from forked iced_aw to get build working again --- Cargo.lock | 81 +--- Cargo.toml | 3 +- crates/core/Cargo.toml | 3 +- crates/core/src/lib.rs | 2 - crates/core/src/style/header.rs | 58 --- crates/core/src/style/mod.rs | 2 - crates/core/src/style/table_row.rs | 135 ------ crates/core/src/theme/mod.rs | 11 +- crates/core/src/theme/table_row.rs | 45 +- crates/core/src/widget/header.rs | 394 ---------------- crates/core/src/widget/header/state.rs | 11 - crates/core/src/widget/mod.rs | 2 - crates/core/src/widget/table_row.rs | 371 --------------- .../element/wallet/operation/action_menu.rs | 3 +- src/gui/element/wallet/operation/apply_tx.rs | 4 +- .../wallet/operation/apply_tx_confirm.rs | 4 +- src/gui/element/wallet/operation/chart.rs | 3 +- src/gui/element/wallet/operation/create_tx.rs | 4 +- .../wallet/operation/create_tx_contracts.rs | 5 +- src/gui/element/wallet/operation/home.rs | 18 +- src/gui/element/wallet/operation/tx_detail.rs | 4 +- src/gui/element/wallet/operation/tx_list.rs | 442 ++---------------- .../wallet/operation/tx_list_display.rs | 6 +- src/gui/element/wallet/operation/tx_proof.rs | 4 +- src/gui/element/wallet/setup/wallet_list.rs | 56 +-- 25 files changed, 117 insertions(+), 1554 deletions(-) delete mode 100644 crates/core/src/style/header.rs delete mode 100644 crates/core/src/style/mod.rs delete mode 100644 crates/core/src/style/table_row.rs delete mode 100644 crates/core/src/widget/header.rs delete mode 100644 crates/core/src/widget/header/state.rs delete mode 100644 crates/core/src/widget/mod.rs delete mode 100644 crates/core/src/widget/table_row.rs diff --git a/Cargo.lock b/Cargo.lock index 1c4501a..161966d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,12 +114,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "aliasable" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" - [[package]] name = "allocator-api2" version = "0.2.16" @@ -1710,7 +1704,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6368dbd2c6685fb84fc6e6a4749917ddc98905793fd06341c7e11a2504f2724" dependencies = [ - "heck 0.3.3", + "heck", "proc-macro2 0.4.30", "quote 0.6.13", "syn 0.15.44", @@ -3257,12 +3251,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "hermit-abi" version = "0.1.19" @@ -3610,8 +3598,7 @@ dependencies = [ [[package]] name = "iced_aw" version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "129deba9897243dd59c2038e2267a691e392c94e569680066ee63b1164429490" +source = "git+https://github.com/yeastplume/iced_aw.git?branch=table_widget#b698515cc0bd7f712a2b53061e49f11befe9cc16" dependencies = [ "cfg-if 1.0.0", "iced", @@ -3754,7 +3741,6 @@ dependencies = [ "iced_runtime", "iced_style", "num-traits 0.2.18", - "ouroboros", "thiserror", "unicode-segmentation", ] @@ -3997,15 +3983,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "0.4.8" @@ -5121,31 +5098,6 @@ dependencies = [ "num-traits 0.2.18", ] -[[package]] -name = "ouroboros" -version = "0.18.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b7be5a8a3462b752f4be3ff2b2bf2f7f1d00834902e46be2a4d68b87b0573c" -dependencies = [ - "aliasable", - "ouroboros_macro", - "static_assertions", -] - -[[package]] -name = "ouroboros_macro" -version = "0.18.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b645dcde5f119c2c454a92d0dfa271a2a3b205da92e4292a68ead4bdbfde1f33" -dependencies = [ - "heck 0.4.1", - "itertools 0.12.1", - "proc-macro2 1.0.79", - "proc-macro2-diagnostics", - "quote 1.0.35", - "syn 2.0.57", -] - [[package]] name = "owned_ttf_parser" version = "0.20.0" @@ -5692,19 +5644,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "proc-macro2-diagnostics" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" -dependencies = [ - "proc-macro2 1.0.79", - "quote 1.0.35", - "syn 2.0.57", - "version_check", - "yansi", -] - [[package]] name = "profiling" version = "1.0.15" @@ -7039,7 +6978,7 @@ version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ - "heck 0.3.3", + "heck", "proc-macro-error", "proc-macro2 1.0.79", "quote 1.0.35", @@ -7064,7 +7003,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" dependencies = [ - "heck 0.3.3", + "heck", "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", @@ -7076,7 +7015,7 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec" dependencies = [ - "heck 0.3.3", + "heck", "proc-macro2 1.0.79", "quote 1.0.35", "syn 1.0.109", @@ -7203,8 +7142,8 @@ checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6" dependencies = [ "anyhow", "cfg-expr", - "heck 0.3.3", - "itertools 0.10.5", + "heck", + "itertools", "pkg-config", "strum 0.21.0", "strum_macros 0.21.1", @@ -8872,12 +8811,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "yansi" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" - [[package]] name = "yazi" version = "0.1.6" diff --git a/Cargo.toml b/Cargo.toml index 641f9cd..bd47478 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,8 @@ iced_futures = { version = "0.12", features = ["async-std"] } iced_style = {version = "0.12"} iced_renderer = { version = "0.12" } iced_core = { version = "0.12" } -iced_aw = { version = "0.8", default-features = false, features = ["card", "modal"]} +#iced_aw = { path = "../iced_aw", default-features = false, features = ["card", "modal", "table"]} +iced_aw = { git = "https://github.com/yeastplume/iced_aw.git", branch = "table_widget", default-features = false, features = ["card", "modal", "table"]} plotters-iced = "0.10.0" plotters="0.3" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 4e79570..7c67d75 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -102,7 +102,8 @@ iced_core = { version = "0.12" } iced_style = "0.12" iced_graphics = { version = "0.12" } iced_renderer = { version = "0.12", features = ["wgpu"] } -iced_aw = { version = "0.8", default-features = false, features = ["card", "modal"]} +#iced_aw = { path = "../../../iced_aw", default-features = false, features = ["card", "modal", "table"]} +iced_aw = { git = "https://github.com/yeastplume/iced_aw.git", branch = "table_widget", default-features = false, features = ["card", "modal", "table"]} [dev-dependencies] tempfile = "3.2.0" diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index fc743ad..7832090 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -9,12 +9,10 @@ pub mod fs; pub mod logger; pub mod network; pub mod node; -pub mod style; pub mod theme; #[cfg(feature = "wgpu")] pub mod utility; pub mod wallet; -pub mod widget; #[macro_use] extern crate lazy_static; diff --git a/crates/core/src/style/header.rs b/crates/core/src/style/header.rs deleted file mode 100644 index 1ca682f..0000000 --- a/crates/core/src/style/header.rs +++ /dev/null @@ -1,58 +0,0 @@ -use crate::theme::Theme; -use iced_core::{Background, Color}; - -/// The appearance of a header. -#[derive(Debug, Clone, Copy)] -pub struct Appearance { - pub text_color: Option, - pub background: Option, - pub border_radius: f32, - pub border_width: f32, - pub border_color: Color, - pub offset_left: f32, - pub offset_right: f32, -} - -/// A set of rules that dictate the style of a header. -pub trait StyleSheet { - type Style: std::default::Default + Copy; - - /// Produces the style of a header. - fn appearance(&self, style: &Self::Style) -> Appearance; - - /// Produces the a hovered appearance for header. - fn hovered(&self, style: &Self::Style) -> Appearance; -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum HeaderStyle { - #[default] - Default, -} - -impl StyleSheet for Theme { - type Style = HeaderStyle; - - fn appearance(&self, style: &Self::Style) -> Appearance { - match style { - HeaderStyle::Default => Appearance { - //text_color: Some(self.palette.bright.surface), - text_color: None, - background: Some(Background::Color(self.palette.normal.primary)), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - offset_right: 0.0, - offset_left: 0.0, - }, - } - } - - fn hovered(&self, style: &Self::Style) -> Appearance { - let appearance = self.appearance(style); - Appearance { - background: None, - ..appearance - } - } -} diff --git a/crates/core/src/style/mod.rs b/crates/core/src/style/mod.rs deleted file mode 100644 index 91ed81f..0000000 --- a/crates/core/src/style/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod header; -pub mod table_row; diff --git a/crates/core/src/style/table_row.rs b/crates/core/src/style/table_row.rs deleted file mode 100644 index b3843c2..0000000 --- a/crates/core/src/style/table_row.rs +++ /dev/null @@ -1,135 +0,0 @@ -use crate::theme::Theme; -use iced::{Background, Color}; - -/// The appearance of a table row. -#[derive(Debug, Clone, Copy, Default)] -pub struct Appearance { - pub text_color: Option, - pub background: Option, - pub border_radius: f32, - pub border_width: f32, - pub border_color: Color, - pub offset_left: f32, - pub offset_right: f32, -} - -/// A set of rules that dictate the style of a table row. -pub trait StyleSheet { - type Style: std::default::Default + Copy; - - /// Produces the default appearance of a table row. - fn appearance(&self, style: &Self::Style) -> Appearance; - - /// Produces the hovered appearance table row. - fn hovered(&self, style: &Self::Style) -> Appearance; -} - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum TableRowStyle { - #[default] - Default, - TableRowAlternate, - TableRowHighlife, - TableRowLowlife, - TableRowSelected, -} - -impl StyleSheet for Theme { - type Style = TableRowStyle; - - fn appearance(&self, style: &Self::Style) -> Appearance { - match style { - TableRowStyle::Default => Appearance { - text_color: Some(self.palette.bright.primary), - background: Some(Background::Color(self.palette.normal.primary)), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - // offset_left: 10.0, - // offset_right: 25.0, - offset_left: 0.0, - offset_right: 0.0, - }, - TableRowStyle::TableRowAlternate => Appearance { - text_color: Some(self.palette.bright.primary), - background: Some(Background::Color(Color { - a: 0.50, - ..self.palette.normal.primary - })), - ..Appearance::default() - }, - TableRowStyle::TableRowHighlife => Appearance { - text_color: Some(self.palette.bright.primary), - background: Some(Background::Color(Color { - a: 0.30, - ..self.palette.normal.primary - })), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - offset_left: 0.0, - offset_right: 0.0, - }, - TableRowStyle::TableRowLowlife => Appearance { - text_color: Some(self.palette.bright.primary), - background: Some(Background::Color(Color::TRANSPARENT)), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - offset_left: 0.0, - offset_right: 0.0, - }, - TableRowStyle::TableRowSelected => Appearance { - text_color: Some(self.palette.bright.primary), - background: Some(Background::Color(self.palette.normal.primary)), - border_radius: 0.0, - border_width: 0.0, - border_color: Color::TRANSPARENT, - offset_left: 0.0, - offset_right: 0.0, - }, - } - } - - fn hovered(&self, style: &Self::Style) -> Appearance { - let appearance = self.appearance(style); - - match style { - TableRowStyle::Default => Appearance { - background: Some(Background::Color(Color { - a: 0.60, - ..self.palette.normal.primary - })), - ..appearance - }, - TableRowStyle::TableRowAlternate => Appearance { - background: Some(Background::Color(Color { - a: 0.25, - ..self.palette.normal.primary - })), - ..appearance - }, - TableRowStyle::TableRowHighlife => Appearance { - background: Some(Background::Color(Color { - a: 0.60, - ..self.palette.normal.primary - })), - ..appearance - }, - TableRowStyle::TableRowLowlife => Appearance { - background: Some(Background::Color(Color { - a: 0.60, - ..self.palette.normal.primary - })), - ..appearance - }, - TableRowStyle::TableRowSelected => Appearance { - background: Some(Background::Color(Color { - a: 0.60, - ..self.palette.normal.primary - })), - ..appearance - }, - } - } -} diff --git a/crates/core/src/theme/mod.rs b/crates/core/src/theme/mod.rs index 3ef03b4..88b2c63 100644 --- a/crates/core/src/theme/mod.rs +++ b/crates/core/src/theme/mod.rs @@ -20,6 +20,8 @@ pub mod modal; pub mod picklist; pub mod radio; pub mod scrollable; +pub mod table_header; +pub mod table_row; pub mod text; pub mod text_input; @@ -31,6 +33,8 @@ pub use modal::ModalStyle; pub use picklist::PickListStyle; pub use radio::RadioStyle; pub use scrollable::ScrollableStyle; +pub use table_header::TableHeaderStyle; +pub use table_row::TableRowStyle; pub use text_input::TextInputStyle; pub async fn load_user_themes() -> Vec { @@ -57,11 +61,10 @@ pub type Scrollable<'a, Message> = iced::widget::Scrollable<'a, Message, Theme, pub type PickList<'a, T, L, V, Message> = iced::widget::PickList<'a, T, L, V, Message, Theme, Renderer>; pub type Radio = iced::widget::Radio; -pub type Card<'a, Message> = iced_aw::native::Card<'a, Message, Theme, Renderer>; +pub type Card<'a, Message> = iced_aw::Card<'a, Message, Theme, Renderer>; pub type Modal<'a, Message, Theme, Renderer> = iced_aw::modal::Modal<'a, Message, Theme, Renderer>; -pub type Header<'a, Message, Theme> = crate::widget::header::Header<'a, Message, Theme, Renderer>; -pub type TableRow<'a, Message, Theme> = - crate::widget::table_row::TableRow<'a, Message, Theme, Renderer>; +pub type TableHeader<'a, Message, Theme> = iced_aw::TableHeader<'a, Message, Theme, Renderer>; +pub type TableRow<'a, Message, Theme> = iced_aw::TableRow<'a, Message, Theme, Renderer>; #[derive(Debug, Clone, Copy, Default, Deserialize, Serialize)] pub struct BaseColors { diff --git a/crates/core/src/theme/table_row.rs b/crates/core/src/theme/table_row.rs index 170223e..9da3c94 100644 --- a/crates/core/src/theme/table_row.rs +++ b/crates/core/src/theme/table_row.rs @@ -32,10 +32,10 @@ impl table::TableRowStyleSheet for Theme { }, cell: RowOrCellAppearance { text_color: palette.normal.primary, - background: Some(Background::Color(palette.base.foreground)), + background: None, border_radius: 0.0.into(), - border_width: 1.0, - border_color: Color::BLACK, + border_width: 0.0, + border_color: Color::TRANSPARENT, offset_left: 0.0, offset_right: 0.0, }, @@ -51,10 +51,7 @@ impl table::TableRowStyleSheet for Theme { }, cell: RowOrCellAppearance { text_color: palette.normal.primary, - background: Some(Background::Color(Color { - a: 0.50, - ..palette.normal.primary - })), + background: None, ..RowOrCellAppearance::default() }, }, @@ -73,10 +70,7 @@ impl table::TableRowStyleSheet for Theme { }, cell: RowOrCellAppearance { text_color: palette.normal.primary, - background: Some(Background::Color(Color { - a: 0.30, - ..palette.base.foreground - })), + background: None, border_radius: 0.0.into(), border_width: 0.0, border_color: Color::TRANSPARENT, @@ -96,7 +90,7 @@ impl table::TableRowStyleSheet for Theme { }, cell: RowOrCellAppearance { text_color: palette.normal.primary, - background: Some(Background::Color(Color::TRANSPARENT)), + background: None, border_radius: 0.0.into(), border_width: 0.0, border_color: Color::TRANSPARENT, @@ -116,7 +110,7 @@ impl table::TableRowStyleSheet for Theme { }, cell: RowOrCellAppearance { text_color: palette.normal.primary, - background: Some(Background::Color(palette.normal.primary)), + background: None, border_radius: 0.0.into(), border_width: 0.0, border_color: Color::TRANSPARENT, @@ -139,10 +133,7 @@ impl table::TableRowStyleSheet for Theme { ..self.appearance(style, row_id).row }, cell: RowOrCellAppearance { - background: Some(Background::Color(Color { - a: 0.60, - ..palette.normal.primary - })), + background: None, ..self.appearance(style, row_id).cell }, }, @@ -155,10 +146,7 @@ impl table::TableRowStyleSheet for Theme { ..self.appearance(style, row_id).row }, cell: RowOrCellAppearance { - background: Some(Background::Color(Color { - a: 0.25, - ..palette.normal.primary - })), + background: None, ..self.appearance(style, row_id).cell }, }, @@ -171,10 +159,7 @@ impl table::TableRowStyleSheet for Theme { ..self.appearance(style, row_id).row }, cell: RowOrCellAppearance { - background: Some(Background::Color(Color { - a: 0.60, - ..palette.normal.primary - })), + background: None, ..self.appearance(style, row_id).cell }, }, @@ -187,10 +172,7 @@ impl table::TableRowStyleSheet for Theme { ..self.appearance(style, row_id).row }, cell: RowOrCellAppearance { - background: Some(Background::Color(Color { - a: 0.60, - ..palette.normal.primary - })), + background: None, ..self.appearance(style, row_id).cell }, }, @@ -203,10 +185,7 @@ impl table::TableRowStyleSheet for Theme { ..self.appearance(style, row_id).row }, cell: RowOrCellAppearance { - background: Some(Background::Color(Color { - a: 0.60, - ..palette.normal.primary - })), + background: None, ..self.appearance(style, row_id).cell }, }, diff --git a/crates/core/src/widget/header.rs b/crates/core/src/widget/header.rs deleted file mode 100644 index fc46729..0000000 --- a/crates/core/src/widget/header.rs +++ /dev/null @@ -1,394 +0,0 @@ -#![allow(clippy::type_complexity)] -use crate::style::header::StyleSheet; -use iced::advanced::renderer; -use iced_core::{ - event, layout, mouse, - widget::{self, Tree}, - Alignment, Clipboard, Element, Event, Layout, Length, Padding, Rectangle, Shell, Widget, -}; - -use iced::{widget::space::Space, Size}; - -mod state; -pub use state::State; - -pub struct Header<'a, Message, Theme, Renderer = iced::Renderer> -where - Renderer: renderer::Renderer, - Theme: StyleSheet, - Message: Clone, -{ - spacing: u16, - width: Length, - height: Length, - state: State, - leeway: u16, - on_resize: Option<(u16, Box Message + 'a>)>, - children: Vec>, - left_margin: bool, - right_margin: bool, - names: Vec, - style: ::Style, -} - -impl<'a, Message, Theme, Renderer> Header<'a, Message, Theme, Renderer> -where - Renderer: renderer::Renderer, - Theme: StyleSheet, - Message: Clone, -{ - pub fn new( - state: State, - headers: Vec<(String, Element<'a, Message, Theme, Renderer>)>, - left_margin: Option, - right_margin: Option, - ) -> Self - where - Theme: iced_style::container::StyleSheet, - Renderer: 'a + iced_core::Renderer, - Message: 'a, - { - let mut names = vec![]; - let mut left = false; - let mut right = false; - - let mut children = vec![]; - - if let Some(margin) = left_margin { - children.push(Space::with_width(margin).into()); - left = true; - } - - for (key, container) in headers { - names.push(key); - - // add container to children - children.push(container.into()); - } - - if let Some(margin) = right_margin { - children.push(Space::with_width(margin).into()); - right = true; - } - - Self { - spacing: 0, - width: Length::Fill, - height: Length::Fill, - leeway: 0, - state, - on_resize: None, - children, - left_margin: left, - right_margin: right, - names, - style: Default::default(), - } - } - - pub fn spacing(mut self, units: u16) -> Self { - self.spacing = units; - self - } - - pub fn width(mut self, width: Length) -> Self { - self.width = width; - self - } - - pub fn height(mut self, height: Length) -> Self { - self.height = height; - self - } - - pub fn on_resize(mut self, leeway: u16, f: F) -> Self - where - F: 'a + Fn(ResizeEvent) -> Message, - { - self.leeway = leeway; - self.on_resize = Some((leeway, Box::new(f))); - self - } - - fn trigger_resize( - &self, - left_name: String, - left_width: u16, - right_name: String, - right_width: u16, - shell: &mut Shell<'_, Message>, - ) { - if let Some((_, on_resize)) = &self.on_resize { - //TODO: Update - shell.publish(on_resize(ResizeEvent::ResizeColumn { - left_name, - left_width, - right_name, - right_width, - })); - } - } - - fn trigger_finished(&self, shell: &mut Shell<'_, Message>) { - if let Some((_, on_resize)) = &self.on_resize { - shell.publish(on_resize(ResizeEvent::Finished)); - } - } -} - -impl<'a, Message, Theme, Renderer> Widget - for Header<'a, Message, Theme, Renderer> -where - Renderer: renderer::Renderer, - Theme: StyleSheet, - Message: Clone, -{ - fn children(&self) -> Vec { - self.children.iter().map(Tree::new).collect() - } - - fn diff(&self, tree: &mut Tree) { - tree.diff_children(&self.children); - } - - fn size(&self) -> Size { - Size { - width: self.width, - height: self.height, - } - } - - fn layout( - &self, - tree: &mut Tree, - renderer: &Renderer, - limits: &layout::Limits, - ) -> layout::Node { - let limits = limits.width(self.width).height(self.height); - let mut trees = self.children(); - - layout::flex::resolve( - layout::flex::Axis::Horizontal, - renderer, - &limits, - self.width, - self.height, - Padding::ZERO, - self.spacing as f32, - Alignment::Start, - &self.children, - &mut trees, - ) - } - - fn on_event( - &mut self, - tree: &mut Tree, - event: Event, - layout: Layout<'_>, - cursor: mouse::Cursor, - renderer: &Renderer, - clipboard: &mut dyn Clipboard, - shell: &mut Shell<'_, Message>, - viewport: &Rectangle, - ) -> event::Status { - let cursor_position = cursor.position().unwrap_or_default(); - let in_bounds = layout.bounds().contains(cursor_position); - - if self.state.resizing || in_bounds { - let child_len = self.children.len(); - let start_offset = if self.left_margin { 1 } else { 0 }; - let end_offset = if self.right_margin { 1 } else { 0 }; - - let dividers = self - .children - .iter() - .enumerate() - .zip(layout.children()) - .filter_map(|((idx, _), layout)| { - if idx >= start_offset && idx < (child_len - 1 - end_offset) { - Some((idx, layout.position().x + layout.bounds().width)) - } else { - None - } - }) - .collect::>(); - - if self.on_resize.is_some() { - if !self.state.resizing { - self.state.resize_hovering = false; - } - - for (idx, divider) in dividers.iter() { - if cursor_position.x > (divider - self.leeway as f32) - && cursor_position.x < (divider + self.leeway as f32) - { - if !self.state.resize_hovering { - self.state.resizing_idx = *idx; - } - - self.state.resize_hovering = true; - } - } - } - - match event { - Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) => { - if self.state.resize_hovering { - self.state.resizing = true; - self.state.starting_cursor_pos = Some(cursor_position); - self.state.starting_left_width = layout - .children() - .nth(self.state.resizing_idx) - .unwrap() - .bounds() - .width; - self.state.starting_right_width = layout - .children() - .nth(self.state.resizing_idx + 1) - .unwrap() - .bounds() - .width; - return event::Status::Captured; - } - } - Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left)) => { - if self.state.resizing { - self.state.resizing = false; - self.state.starting_cursor_pos.take(); - // TODO: UPDATE - //shell.publish(messages); - return event::Status::Captured; - } - } - Event::Mouse(mouse::Event::CursorMoved { position }) => { - if self.state.resizing { - let delta = position.x - self.state.starting_cursor_pos.unwrap().x; - - let left_width = self.state.starting_left_width; - let right_width = self.state.starting_right_width; - - let max_width = left_width + right_width - 30.0; - - let left_width = (left_width + delta).max(30.0).min(max_width) as u16; - let left_name = &self.names[self.state.resizing_idx - start_offset]; - let right_width = (right_width - delta).max(30.0).min(max_width) as u16; - let right_name = &self.names[self.state.resizing_idx + 1 - start_offset]; - - self.trigger_resize( - left_name.clone(), - left_width, - right_name.clone(), - right_width, - shell, - ); - return event::Status::Captured; - } - } - _ => {} - } - } else { - self.state.resize_hovering = false; - } - - self.children - .iter_mut() - .zip(&mut tree.children) - .zip(layout.children()) - .map(|((child, state), layout)| { - child.as_widget_mut().on_event( - state, - event.clone(), - layout, - cursor, - renderer, - clipboard, - shell, - viewport, - ) - }) - .fold(event::Status::Ignored, event::Status::merge) - } - - fn draw( - &self, - tree: &Tree, - renderer: &mut Renderer, - theme: &Theme, - style: &iced_core::renderer::Style, - layout: Layout<'_>, - cursor: mouse::Cursor, - viewport: &Rectangle, - ) { - for ((child, state), layout) in self - .children - .iter() - .zip(&tree.children) - .zip(layout.children()) - { - child - .as_widget() - .draw(state, renderer, theme, style, layout, cursor, viewport); - } - } - - fn mouse_interaction( - &self, - tree: &Tree, - layout: Layout<'_>, - cursor: mouse::Cursor, - viewport: &Rectangle, - renderer: &Renderer, - ) -> mouse::Interaction { - let bounds = layout.bounds(); - let cursor_position = cursor.position().unwrap_or_default(); - let is_mouse_over = bounds.contains(cursor_position); - - if is_mouse_over { - mouse::Interaction::Pointer - } else { - mouse::Interaction::default() - } - } - - /*fn hash_layout(&self, state: &mut Hasher) { - use std::hash::Hash; - - struct Marker; - std::any::TypeId::of::().hash(state); - - self.width.hash(state); - self.height.hash(state); - self.spacing.hash(state); - self.left_margin.hash(state); - self.right_margin.hash(state); - self.leeway.hash(state); - - for child in &self.children { - child.hash_layout(state); - } - }*/ -} - -impl<'a, Message, Theme> From> - for Element<'a, Message, Theme, iced::Renderer> -where - //Renderer: 'a + renderer::Renderer, - Theme: 'a + StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, - Message: 'a + Clone, -{ - fn from(header: Header<'a, Message, Theme>) -> Self { - Element::new(header) - } -} - -#[derive(Debug, Clone)] -pub enum ResizeEvent { - ResizeColumn { - left_name: String, - left_width: u16, - right_name: String, - right_width: u16, - }, - Finished, -} diff --git a/crates/core/src/widget/header/state.rs b/crates/core/src/widget/header/state.rs deleted file mode 100644 index 4fdc052..0000000 --- a/crates/core/src/widget/header/state.rs +++ /dev/null @@ -1,11 +0,0 @@ -use iced_core::Point; - -#[derive(Clone, Debug, Default)] -pub struct State { - pub resize_hovering: bool, - pub resizing: bool, - pub starting_cursor_pos: Option, - pub starting_left_width: f32, - pub starting_right_width: f32, - pub resizing_idx: usize, -} diff --git a/crates/core/src/widget/mod.rs b/crates/core/src/widget/mod.rs deleted file mode 100644 index 91ed81f..0000000 --- a/crates/core/src/widget/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod header; -pub mod table_row; diff --git a/crates/core/src/widget/table_row.rs b/crates/core/src/widget/table_row.rs deleted file mode 100644 index 751fad2..0000000 --- a/crates/core/src/widget/table_row.rs +++ /dev/null @@ -1,371 +0,0 @@ -#![allow(clippy::type_complexity)] -use crate::style::table_row::StyleSheet; -use iced_core::{ - event, layout, mouse, overlay, renderer, widget, widget::Tree, Alignment, Clipboard, Element, - Event, Layout, Length, Padding, Point, Rectangle, Shell, Widget, -}; - -use iced::{Border, Size}; - -#[allow(missing_debug_implementations)] -pub struct TableRow<'a, Message, Theme, Renderer = iced::Renderer> -where - Renderer: 'a + iced_core::Renderer, - Theme: StyleSheet, - Message: 'a, -{ - padding: Padding, - width: Length, - height: Length, - max_width: u32, - max_height: u32, - inner_row_height: u32, - horizontal_alignment: Alignment, - vertical_alignment: Alignment, - style: ::Style, - content: Element<'a, Message, Theme, Renderer>, - on_press: Option Message + 'a>>, -} - -impl<'a, Message, Theme, Renderer> TableRow<'a, Message, Theme, Renderer> -where - Renderer: 'a + iced_core::Renderer, - Theme: StyleSheet, - Message: 'a, -{ - /// Creates an empty [`TableRow`]. - pub fn new(content: T) -> Self - where - T: Into>, - { - TableRow { - padding: Padding::ZERO, - width: Length::Shrink, - height: Length::Shrink, - max_width: u32::MAX, - max_height: u32::MAX, - inner_row_height: u32::MAX, - horizontal_alignment: Alignment::Start, - vertical_alignment: Alignment::Start, - style: Default::default(), - content: content.into(), - on_press: None, - } - } - - pub fn width(mut self, width: Length) -> Self { - self.width = width; - self - } - - /// Sets the style of the [`TableRow`]. - pub fn style(mut self, style: S) -> Self - where - S: Into<::Style>, - { - self.style = style.into(); - self - } - - /// Sets the height of the [`TableRow`]. - pub fn height(mut self, height: Length) -> Self { - self.height = height; - self - } - - /// Sets the maximum width of the [`TableRow`]. - pub fn max_width(mut self, max_width: u32) -> Self { - self.max_width = max_width; - self - } - - /// Sets the maximum height of the [`TableRow`] in pixels. - pub fn max_height(mut self, max_height: u32) -> Self { - self.max_height = max_height; - self - } - - /// Sets the height of the area that will be used to define the event capture area of [`TableRow`] in pixels. - pub fn inner_row_height(mut self, inner_row_height: u32) -> Self { - self.inner_row_height = inner_row_height; - self - } - - /// Sets the content alignment for the horizontal axis of the [`TableRow`]. - pub fn align_x(mut self, alignment: Alignment) -> Self { - self.horizontal_alignment = alignment; - self - } - - /// Sets the content alignment for the vertical axis of the [`TableRow`]. - pub fn align_y(mut self, alignment: Alignment) -> Self { - self.vertical_alignment = alignment; - self - } - - /// Centers the contents in the horizontal axis of the [`TableRow`]. - pub fn center_x(mut self) -> Self { - self.horizontal_alignment = Alignment::Center; - self - } - - /// Centers the contents in the vertical axis of the [`TableRow`]. - pub fn center_y(mut self) -> Self { - self.vertical_alignment = Alignment::Center; - self - } - - /// Sets the message that will be produced when the [`TableRow`] is pressed. - pub fn on_press(mut self, f: T) -> Self - where - T: 'a + Fn(Event) -> Message, - { - self.on_press = Some(Box::new(f)); - self - } - - pub fn padding(mut self, p: Padding) -> Self { - self.padding = p; - self - } -} - -impl<'a, Message, Theme, Renderer> Widget - for TableRow<'a, Message, Theme, Renderer> -where - Renderer: 'a + iced_core::Renderer, - Theme: StyleSheet, - Message: 'a, -{ - fn size(&self) -> Size { - Size { - width: self.width, - height: self.height, - } - } - - fn layout( - &self, - tree: &mut Tree, - renderer: &Renderer, - limits: &layout::Limits, - ) -> layout::Node { - let limits = limits - .loose() - .width(self.width) - .height(self.height) - .shrink(self.padding); - - let mut content = self - .content - .as_widget() - .layout(tree, renderer, &limits.loose()); - let size = limits.resolve(self.width, self.height, content.size()); - - // TODO: MODIFIED COORDINATES, CHECK - content = content.move_to(Point::new( - self.padding.top as f32, - self.padding.left as f32, - )); - content = content.align(self.horizontal_alignment, self.vertical_alignment, size); - - layout::Node::with_children(size.expand(self.padding), vec![content]) - } - - fn draw( - &self, - _tree: &Tree, - renderer: &mut Renderer, - theme: &Theme, - style: &renderer::Style, - layout: Layout<'_>, - cursor: mouse::Cursor, - viewport: &Rectangle, - ) { - let cursor_position = cursor.position().unwrap_or_default(); - let bounds = layout.bounds(); - let mut custom_bounds = layout.bounds(); - let tree = Tree::new(&self.content); - - // inner_row_height set? - if self.inner_row_height != u32::MAX { - custom_bounds.height = self.inner_row_height as f32; - } - - let is_mouse_over = custom_bounds.contains(cursor_position); - let content_layout = layout.children().next().unwrap(); - - let appearance = if is_mouse_over { - theme.hovered(&self.style) - } else { - theme.appearance(&self.style) - }; - - let background = iced_core::renderer::Quad { - bounds: Rectangle { - x: bounds.x + appearance.offset_left as f32, - y: bounds.y, - width: bounds.width - appearance.offset_right as f32, - height: custom_bounds.height, - }, - border: Border { - width: appearance.border_width, - color: appearance.border_color, - radius: appearance.border_radius.into(), - }, - shadow: Default::default(), - }; - - renderer.fill_quad( - background.into(), - appearance.background.unwrap(), //.unwrap_or(Background::Color(Color::TRANSPARENT)), - ); - - self.content.as_widget().draw( - &tree, - renderer, - theme, - style, - content_layout, - cursor, - viewport, - ); - } - - fn mouse_interaction( - &self, - _tree: &Tree, - layout: Layout<'_>, - cursor: mouse::Cursor, - viewport: &Rectangle, - renderer: &Renderer, - ) -> mouse::Interaction { - let cursor_position = cursor.position().unwrap_or_default(); - let bounds = layout.bounds(); - let is_mouse_over = bounds.contains(cursor_position); - - let mut mouse_interaction = if is_mouse_over { - mouse::Interaction::Pointer - } else { - mouse::Interaction::default() - }; - - let children = layout.children(); - - for layout in children { - let is_mouse_over = layout.bounds().contains(cursor_position); - let new_mouse_interaction = if is_mouse_over { - mouse::Interaction::Pointer - } else { - mouse::Interaction::default() - }; - - if new_mouse_interaction > mouse_interaction { - mouse_interaction = new_mouse_interaction; - } - } - - mouse_interaction - } - - /*fn hash_layout(&self, state: &mut Hasher) { - struct Marker; - std::any::TypeId::of::().hash(state); - - self.padding.hash(state); - self.width.hash(state); - self.height.hash(state); - self.max_width.hash(state); - self.max_height.hash(state); - self.inner_row_height.hash(state); - - self.content.hash_layout(state); - }*/ - - fn on_event( - &mut self, - _tree: &mut Tree, - event: Event, - layout: Layout<'_>, - cursor: mouse::Cursor, - renderer: &Renderer, - clipboard: &mut dyn Clipboard, - shell: &mut Shell<'_, Message>, - viewport: &Rectangle, - ) -> event::Status { - let cursor_position = cursor.position().unwrap_or_default(); - let mut tree = Tree::new(&self.content); - let status_from_content = self.content.as_widget_mut().on_event( - &mut tree, - event.clone(), - layout.children().next().unwrap(), - cursor, - renderer, - clipboard, - shell, - viewport, - ); - match status_from_content { - event::Status::Ignored => { - if let Event::Mouse(mouse::Event::ButtonPressed(mouse::Button::Left)) = event { - if let Some(on_press) = &self.on_press { - let mut bounds = layout.bounds(); - - // was inner row height set? - if self.inner_row_height != u32::MAX { - //We can face issues if the row is expanded, so we manage it by having a reduced bounds area to check for pointer - bounds.height = self.inner_row_height as f32; - } - - if bounds.contains(cursor_position) { - shell.publish(on_press(event)); - } - } - } - status_from_content - } - _ => status_from_content, - } - } - - fn overlay<'b>( - &'b mut self, - tree: &'b mut Tree, - layout: Layout<'_>, - renderer: &Renderer, - cursor: iced_core::Vector, // Change the type of the `cursor` parameter - ) -> Option> { - self.content.as_widget_mut().overlay( - tree, - layout.children().next().unwrap(), - renderer, - cursor, - ) - } -} - -/*impl<'a, Message, Theme: 'a, Renderer> From> - for Element<'a, Message, Theme, Renderer> -where - Renderer: 'a + iced_core::Renderer, - Theme: StyleSheet + iced::widget::container::StyleSheet + widget::text::StyleSheet, - Message: 'a, -{ - fn from( - table_row: TableRow<'a, Message, Theme, Renderer>, - ) -> Self { - Element::new(table_row) - } -}*/ - -impl<'a, Message, Theme, Renderer> From> - for Element<'a, Message, Theme, Renderer> -where - Message: 'a, - Theme: 'a + StyleSheet, - Renderer: iced_core::Renderer + 'a, -{ - fn from(column: TableRow<'a, Message, Theme, Renderer>) -> Self { - Self::new(column) - } -} diff --git a/src/gui/element/wallet/operation/action_menu.rs b/src/gui/element/wallet/operation/action_menu.rs index 29132ae..d5d3aba 100644 --- a/src/gui/element/wallet/operation/action_menu.rs +++ b/src/gui/element/wallet/operation/action_menu.rs @@ -21,8 +21,7 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, TableRow, Text, TextInput, }, grin_gui_core::wallet::{StatusMessage, WalletInfo, WalletInterface}, grin_gui_core::{node::amount_to_hr_string, theme::ColorPalette}, diff --git a/src/gui/element/wallet/operation/apply_tx.rs b/src/gui/element/wallet/operation/apply_tx.rs index 8a22710..a62d2e2 100644 --- a/src/gui/element/wallet/operation/apply_tx.rs +++ b/src/gui/element/wallet/operation/apply_tx.rs @@ -1,7 +1,6 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; -use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, wallet::{Slate, Slatepack, TxLogEntry, TxLogEntryType}, @@ -23,8 +22,7 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, TableRow, Text, TextInput, }, grin_gui_core::wallet::{StatusMessage, WalletInfo, WalletInterface}, grin_gui_core::{node::amount_to_hr_string, theme::ColorPalette}, diff --git a/src/gui/element/wallet/operation/apply_tx_confirm.rs b/src/gui/element/wallet/operation/apply_tx_confirm.rs index eeffaca..23b9618 100644 --- a/src/gui/element/wallet/operation/apply_tx_confirm.rs +++ b/src/gui/element/wallet/operation/apply_tx_confirm.rs @@ -1,7 +1,6 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; -use grin_gui_core::widget::header; use grin_gui_core::{ config::{Config, TxMethod}, wallet::{ @@ -27,8 +26,7 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, TableRow, Text, TextInput, }, grin_gui_core::wallet::{parse_abs_tx_amount_fee, StatusMessage, WalletInfo, WalletInterface}, grin_gui_core::{node::amount_to_hr_string, theme::ColorPalette}, diff --git a/src/gui/element/wallet/operation/chart.rs b/src/gui/element/wallet/operation/chart.rs index 70451e8..2599e0d 100644 --- a/src/gui/element/wallet/operation/chart.rs +++ b/src/gui/element/wallet/operation/chart.rs @@ -4,8 +4,7 @@ extern crate plotters; use crate::gui::{element::DEFAULT_PADDING, Message}; use chrono::{DateTime, Utc}; use grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, Theme, + Button, Column, Container, Element, PickList, Row, Scrollable, TableRow, Text, TextInput, Theme, }; use iced::{ alignment::{Horizontal, Vertical}, diff --git a/src/gui/element/wallet/operation/create_tx.rs b/src/gui/element/wallet/operation/create_tx.rs index 4f56804..35bfe5e 100644 --- a/src/gui/element/wallet/operation/create_tx.rs +++ b/src/gui/element/wallet/operation/create_tx.rs @@ -1,7 +1,6 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; -use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, error::GrinWalletInterfaceError, @@ -25,8 +24,7 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, TableRow, Text, TextInput, }, grin_gui_core::wallet::{InitTxArgs, Slate, StatusMessage, WalletInfo, WalletInterface}, grin_gui_core::{ diff --git a/src/gui/element/wallet/operation/create_tx_contracts.rs b/src/gui/element/wallet/operation/create_tx_contracts.rs index 0d756dc..384dc6d 100644 --- a/src/gui/element/wallet/operation/create_tx_contracts.rs +++ b/src/gui/element/wallet/operation/create_tx_contracts.rs @@ -1,7 +1,6 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; -use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, error::GrinWalletInterfaceError, @@ -28,8 +27,8 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Radio, Row, Scrollable, TableRow, - Text, TextInput, + Button, Column, Container, Element, PickList, Radio, Row, Scrollable, TableRow, Text, + TextInput, }, grin_gui_core::wallet::{InitTxArgs, Slate, StatusMessage, WalletInfo, WalletInterface}, grin_gui_core::{ diff --git a/src/gui/element/wallet/operation/home.rs b/src/gui/element/wallet/operation/home.rs index eb35e21..4ba098d 100644 --- a/src/gui/element/wallet/operation/home.rs +++ b/src/gui/element/wallet/operation/home.rs @@ -9,7 +9,6 @@ use chrono::{DateTime, DurationRound, TimeZone, Utc}; use grin_gui_core::error::GrinWalletInterfaceError; use grin_gui_core::node::SyncStatus; use grin_gui_core::wallet::SlatepackAddress; -use grin_gui_core::widget::header; use grin_gui_core::{ config::{Config, Currency}, wallet::{InvoiceProof, RetrieveTxQueryArgs, TxLogEntry, TxLogEntryType}, @@ -38,8 +37,7 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, TableRow, Text, TextInput, }, grin_gui_core::wallet::{StatusMessage, WalletInfo, WalletInterface}, grin_gui_core::{ @@ -574,8 +572,6 @@ pub fn data_container<'a>(config: &'a Config, state: &'a StateContainer) -> Cont let close_wallet_label_container = Container::new(Text::new(localized_string("close")).size(SMALLER_FONT_SIZE)) - .height(Length::Fixed(14.0)) - .width(Length::Fixed(30.0)) .center_y() .center_x(); @@ -584,12 +580,12 @@ pub fn data_container<'a>(config: &'a Config, state: &'a StateContainer) -> Cont .on_press(Interaction::WalletOperationHomeViewInteraction( LocalViewInteraction::Back, )) - .padding(2) + .width(Length::Shrink) .into(); let subtitle_row = Row::new() .push(subtitle_container) - .push(Space::with_width(Length::Fixed(2.0))) + .push(Space::with_width(Length::Fixed(10.0))) .push(close_wallet_button.map(Message::Interaction)); let address_label = Text::new(format!( @@ -631,22 +627,20 @@ pub fn data_container<'a>(config: &'a Config, state: &'a StateContainer) -> Cont let copy_address_label_container = Container::new(Text::new(localized_string("copy-to-clipboard")).size(SMALLER_FONT_SIZE)) - .height(Length::Fixed(14.0)) - .width(Length::Fixed(30.0)) .center_y() .center_x(); let copy_address_button: Element = Button::new(copy_address_label_container) .style(grin_gui_core::theme::ButtonStyle::Bordered) .on_press(Interaction::WriteToClipboard(copied_address_value)) - .padding(2) + .width(Length::Shrink) .into(); let address_row = Row::new() .push(address_label_container) - .push(Space::with_width(Length::Fixed(2.0))) + .push(Space::with_width(Length::Fixed(10.0))) .push(address_container) - .push(Space::with_width(Length::Fixed(2.0))) + .push(Space::with_width(Length::Fixed(10.0))) .push(copy_address_button.map(Message::Interaction)); let title_container = Container::new( diff --git a/src/gui/element/wallet/operation/tx_detail.rs b/src/gui/element/wallet/operation/tx_detail.rs index 928590f..fae185d 100644 --- a/src/gui/element/wallet/operation/tx_detail.rs +++ b/src/gui/element/wallet/operation/tx_detail.rs @@ -1,7 +1,6 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; -use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, error::GrinWalletInterfaceError, @@ -25,8 +24,7 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, TableRow, Text, TextInput, }, grin_gui_core::wallet::{InitTxArgs, Slate, StatusMessage, WalletInfo, WalletInterface}, grin_gui_core::{ diff --git a/src/gui/element/wallet/operation/tx_list.rs b/src/gui/element/wallet/operation/tx_list.rs index 50ec83a..2693416 100644 --- a/src/gui/element/wallet/operation/tx_list.rs +++ b/src/gui/element/wallet/operation/tx_list.rs @@ -1,5 +1,6 @@ use grin_gui_core::config::TxMethod; use iced_core::Widget; +use iced_renderer::graphics::text::cosmic_text::rustybuzz::ttf_parser::ankr::Table; use std::borrow::Borrow; use { @@ -8,19 +9,18 @@ use { crate::localization::localized_string, crate::Result, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, + Button, Column, Container, Element, PickList, Row, Scrollable, TableHeaderStyle, Text, Theme, }, - grin_gui_core::widget::header, grin_gui_core::{ config::Config, node::amount_to_hr_string, - style::header::HeaderStyle, - theme::{ButtonStyle, ColorPalette, ContainerStyle}, + theme::{ButtonStyle, ColorPalette, ContainerStyle, TableHeader, TableRow, TableRowStyle}, wallet::{TxLogEntry, TxLogEntryType}, }, iced::widget::{button, pick_list, scrollable, text_input, Space}, iced::{alignment, Alignment, Command, Length}, + iced_aw::TableHeaderState, serde::{Deserialize, Serialize}, std::collections::HashMap, strfmt::strfmt, @@ -243,7 +243,7 @@ impl std::fmt::Display for TxListResultSize { } pub struct HeaderState { - pub state: header::State, + pub state: TableHeaderState, pub previous_column_key: Option, pub previous_sort_direction: Option, pub columns: Vec, @@ -275,28 +275,28 @@ impl Default for HeaderState { ColumnState { key: ColumnKey::NetDifference, // btn_state: Default::default(), - width: Length::Fixed(110.0), + width: Length::FillPortion(1), hidden: false, order: 1, }, ColumnState { key: ColumnKey::CreationTime, // btn_state: Default::default(), - width: Length::Fixed(110.0), + width: Length::FillPortion(2), hidden: false, order: 2, }, ColumnState { key: ColumnKey::Status, // btn_state: Default::default(), - width: Length::Fixed(300.0), + width: Length::FillPortion(1), hidden: false, order: 3, }, ColumnState { key: ColumnKey::ConfirmationTime, // btn_state: Default::default(), - width: Length::Fixed(110.0), + width: Length::FillPortion(2), hidden: true, order: 4, }, @@ -603,7 +603,7 @@ pub struct TxListColumnState { } pub struct TxListHeaderState { - state: header::State, + state: TableHeaderState, previous_column_key: Option, previous_sort_direction: Option, columns: Vec, @@ -891,11 +891,11 @@ fn row_title( pub fn titles_row_header<'a>( tx_list: &TxList, - header_state: &'a header::State, + header_state: &'a TableHeaderState, column_state: &'a [ColumnState], previous_column_key: Option, previous_sort_direction: Option, -) -> Header<'a, Message, Theme> { +) -> TableHeader<'a, Message, Theme> { // A row containing titles above the addon rows. let mut row_titles = vec![]; @@ -944,7 +944,7 @@ pub fn titles_row_header<'a>( } } - Header::new( + TableHeader::new( header_state.clone(), row_titles .into_iter() @@ -955,8 +955,7 @@ pub fn titles_row_header<'a>( None, None, ) - .spacing(1) - .height(Length::Fixed(25.0)) + .width(Length::Fill) /* .on_resize(3, |event| { //TODO //Message::Interaction(Interaction::ResizeColumn(Mode::Catalog, event)) @@ -983,7 +982,7 @@ pub fn data_row_container<'a, 'b>( pending_confirmation: &Option, node_synched: bool, ) -> Container<'a, Message> { - let default_height = Length::Fixed(26.0); + let default_height = Length::Fixed(40.0); let mut default_row_height = 26; let mut row_containers = vec![]; @@ -1020,57 +1019,8 @@ pub fn data_row_container<'a, 'b>( ) ) }; - //TODO this will show the latest status - // Unconfirmed - Created time - // Confirmed - let status = create_tx_display_status(&tx_log_entry_wrap.tx); - - /*let version = tx - .version() - .map(str::to_string) - .unwrap_or_else(|| "-".to_string()); - let release_package = addon_cloned.relevant_release_package(global_release_channel);*/ - - /*if let Some((idx, width)) = column_config - .iter() - .enumerate() - .filter_map(|(idx, (key, width, hidden))| { - if *key == ColumnKey::Title && !hidden { - Some((idx, width)) - } else { - None - } - }) - .next() - { - let title = Text::new(addon.title()).size(DEFAULT_FONT_SIZE); - - let mut title_row = Row::new().push(title).spacing(5).align_items(Align::Center); - - if addon.release_channel != ReleaseChannel::Default { - let release_channel = - Container::new(Text::new(addon.release_channel.to_string()).size(10)) - .style(style::ChannelBadge) - .padding(3); - - title_row = title_row.push(release_channel); - } - - let mut title_container = Container::new(title_row) - .padding(5) - .height(default_height) - .width(*width) - .center_y(); - if is_addon_expanded && matches!(expand_type, ExpandType::Details(_)) { - title_container = - title_container.style(style::SelectedBrightForegroundContainer); - } else { - title_container = - title_container.style(grin_gui_core::theme::container::Container::HoverableBrightForeground); - } - row_containers.push((idx, title_container)); - }*/ + let status = create_tx_display_status(&tx_log_entry_wrap.tx); if let Some((idx, width)) = column_config .iter() @@ -1087,10 +1037,7 @@ pub fn data_row_container<'a, 'b>( let display_id = Text::new(id.clone()).size(DEFAULT_FONT_SIZE); let id_container = Container::new(display_id) - .padding(5) - .height(default_height) .width(*width) - .center_y() .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); row_containers.push((idx, id_container)); @@ -1111,10 +1058,7 @@ pub fn data_row_container<'a, 'b>( let display_creation_time = Text::new(creation_time).size(DEFAULT_FONT_SIZE); let display_creation_time_container = Container::new(display_creation_time) - .padding(5) - .height(default_height) .width(*width) - .center_y() .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); row_containers.push((idx, display_creation_time_container)); @@ -1135,10 +1079,7 @@ pub fn data_row_container<'a, 'b>( let display_confirmation_time = Text::new(confirmation_time).size(DEFAULT_FONT_SIZE); let display_confirmation_time_container = Container::new(display_confirmation_time) - .padding(5) - .height(default_height) .width(*width) - .center_y() .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); row_containers.push((idx, display_confirmation_time_container)); @@ -1156,13 +1097,12 @@ pub fn data_row_container<'a, 'b>( }) .next() { - let display_net_difference = Text::new(net_diff).size(DEFAULT_FONT_SIZE); + let display_net_difference = Text::new(net_diff) + .size(DEFAULT_FONT_SIZE) + .size(DEFAULT_FONT_SIZE); let display_net_difference_container = Container::new(display_net_difference) - .padding(5) - .height(default_height) .width(*width) - .center_y() .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); row_containers.push((idx, display_net_difference_container)); @@ -1180,61 +1120,17 @@ pub fn data_row_container<'a, 'b>( }) .next() { - let display_status = Text::new(status).size(DEFAULT_FONT_SIZE); + let display_status = Text::new(status) + .size(DEFAULT_FONT_SIZE) + .vertical_alignment(alignment::Vertical::Center); let display_status_container = Container::new(display_status) - .padding(5) - .height(default_height) .width(*width) - .center_y() .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); row_containers.push((idx, display_status_container)); } - /*if let Some((idx, width)) = column_config - .iter() - .enumerate() - .filter_map(|(idx, (key, width, hidden))| { - if *key == ColumnKey::Type && !hidden { - Some((idx, width)) - } else { - None - } - }) - .next() - { - let display_type = if let Some(package) = &release_package { - package.version.clone() - } else { - String::from("-") - }; - let remote_version = Text::new(remote_version).size(DEFAULT_FONT_SIZE); - - let mut remote_version_button = - Button::new(&mut addon.remote_version_btn_state, remote_version) - .style(grin_gui_core::theme::button::Button::NormalText); - - if changelog_url.is_some() { - remote_version_button = - remote_version_button.on_press(Interaction::Expand(ExpandType::Changelog { - addon: addon_cloned.clone(), - changelog: None, - })); - } - - let remote_version_button: Element = remote_version_button.into(); - - let remote_version_container = - Container::new(remote_version_button.map(Message::Interaction)) - .height(default_height) - .width(*width) - .center_y() - .style(grin_gui_core::theme::container::Container::HoverableForeground); - - row_containers.push((idx, remote_version_container)); - }*/ - if let Some((idx, width)) = column_config .iter() .enumerate() @@ -1249,271 +1145,42 @@ pub fn data_row_container<'a, 'b>( { let display_tx_type = Text::new(tx_type.clone()).size(SMALLER_FONT_SIZE); let display_tx_type_container = Container::new(display_tx_type) - .height(default_height) .width(*width) - .center_y() - .padding(5) .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); row_containers.push((idx, display_tx_type_container)); } - /*if let Some((idx, width)) = column_config - .iter() - .enumerate() - .filter_map(|(idx, (key, width, hidden))| { - if *key == ColumnKey::Author && !hidden { - Some((idx, width)) - } else { - None - } - }) - .next() - { - let author = Text::new(author.as_deref().unwrap_or("-")).size(DEFAULT_FONT_SIZE); - let author_container = Container::new(author) - .height(default_height) - .width(*width) - .center_y() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground); - - row_containers.push((idx, author_container)); - }*/ - - /*if let Some((idx, width)) = column_config - .iter() - .enumerate() - .filter_map(|(idx, (key, width, hidden))| { - if *key == ColumnKey::GameVersion && !hidden { - Some((idx, width)) - } else { - None - } - }) - .next() - { - let game_version = - Text::new(game_version.as_deref().unwrap_or("-")).size(DEFAULT_FONT_SIZE); - let game_version_container = Container::new(game_version) - .height(default_height) - .width(*width) - .center_y() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground); - - row_containers.push((idx, game_version_container)); - }*/ - - /*if let Some((idx, width)) = column_config - .iter() - .enumerate() - .filter_map(|(idx, (key, width, hidden))| { - if *key == ColumnKey::DateReleased && !hidden { - Some((idx, width)) - } else { - None - } - }) - .next() - { - let release_date_text: String = if let Some(package) = &release_package { - let f = localized_timeago_formatter(); - let now = Local::now(); - - if let Some(time) = package.date_time.as_ref() { - f.convert_chrono(*time, now) - } else { - "".to_string() - } - } else { - "-".to_string() - }; - let release_date_text = Text::new(release_date_text).size(DEFAULT_FONT_SIZE); - let game_version_container = Container::new(release_date_text) - .height(default_height) - .width(*width) - .center_y() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground); - - row_containers.push((idx, game_version_container)); - }*/ - - /*if let Some((idx, width)) = column_config - .iter() - .enumerate() - .filter_map(|(idx, (key, width, hidden))| { - if *key == ColumnKey::Source && !hidden { - Some((idx, width)) - } else { - None - } - }) - .next() - { - let source_text = - repository_kind.map_or_else(|| localized_string("unknown"), |a| a.to_string()); - let source = Text::new(source_text).size(DEFAULT_FONT_SIZE); - let source_container = Container::new(source) - .height(default_height) - .width(*width) - .center_y() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground); - - row_containers.push((idx, source_container)); - }*/ - - /*if let Some((idx, width)) = column_config - .iter() - .enumerate() - .filter_map(|(idx, (key, width, hidden))| { - if *key == ColumnKey::Summary && !hidden { - Some((idx, width)) - } else { - None - } - }) - .next() - { - let text = addon_cloned.notes().unwrap_or("-"); - let summary = Text::new(text).size(DEFAULT_FONT_SIZE); - let container = Container::new(summary) - .height(default_height) - .width(*width) - .center_y() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground); - - row_containers.push((idx, container)); - }*/ - - /*if let Some((idx, width)) = column_config - .iter() - .enumerate() - .filter_map(|(idx, (key, width, hidden))| { - if *key == ColumnKey::Status && !hidden { - Some((idx, width)) - } else { - None - } - }) - .next() - { - let update_button_container = match &addon.state { - AddonState::Idle => Container::new(Text::new("".to_string()).size(DEFAULT_FONT_SIZE)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .style(grin_gui_core::theme::container::Container::HoverableForeground), - AddonState::Completed => { - Container::new(Text::new(localized_string("completed")).size(DEFAULT_FONT_SIZE)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .style(grin_gui_core::theme::container::Container::HoverableForeground) - } - AddonState::Error(message) => { - Container::new(Text::new(message).size(DEFAULT_FONT_SIZE)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .style(grin_gui_core::theme::container::Container::HoverableForeground) - } - AddonState::Updatable | AddonState::Retry => { - let id = addon.primary_folder_id.clone(); - - let text = match addon.state { - AddonState::Updatable => localized_string("update"), - AddonState::Retry => localized_string("retry"), - _ => "".to_owned(), - }; - - let update_wrapper = Container::new(Text::new(text).size(DEFAULT_FONT_SIZE)) - .width(*width) - .center_x() - .align_x(Align::Center); - let update_button: Element = - Button::new(&mut addon.update_btn_state, update_wrapper) - .width(Length::FillPortion(1)) - .style(style::SecondaryButton) - .on_press(Interaction::Update(id)) - .into(); - - Container::new(update_button.map(Message::Interaction)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .style(grin_gui_core::theme::container::Container::HoverableBrightForeground) - } - AddonState::Downloading => { - Container::new(Text::new(localized_string("downloading")).size(DEFAULT_FONT_SIZE)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground) - } - AddonState::Unpacking => { - Container::new(Text::new(localized_string("unpacking")).size(DEFAULT_FONT_SIZE)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground) - } - AddonState::Fingerprint => { - Container::new(Text::new(localized_string("hashing")).size(DEFAULT_FONT_SIZE)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground) - } - AddonState::Ignored => { - Container::new(Text::new(localized_string("ignored")).size(DEFAULT_FONT_SIZE)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground) - } - AddonState::Unknown => Container::new(Text::new("").size(DEFAULT_FONT_SIZE)) - .height(default_height) - .width(*width) - .center_y() - .center_x() - .padding(5) - .style(grin_gui_core::theme::container::Container::HoverableForeground), - }; - - row_containers.push((idx, update_button_container)); - }*/ - let left_spacer = Space::new(Length::Fixed(DEFAULT_PADDING), Length::Fixed(0.0)); let right_spacer = Space::new(Length::Fixed(DEFAULT_PADDING + 5.0), Length::Fixed(0.0)); //let mut row = Row::new().push(left_spacer).spacing(1); - let mut row = Row::new().spacing(1); + let mut table_row_content = vec![]; // Sort columns and push them into row row_containers.sort_by(|a, b| a.0.cmp(&b.0)); - for (_, elem) in row_containers.into_iter() { - row = row.push(elem); + + for (_, mut elem) in row_containers.into_iter() { + table_row_content.push(elem); } - row = row.push(right_spacer); + let tx_cloned_for_closure = tx_cloned_for_row.clone(); + let mut table_row = TableRow::new(table_row_content, 0) + .width(Length::Fill) + .padding(3.0.into()) + .on_press(move |_| { + Message::Interaction(Interaction::WalletOperationTxListInteraction( + LocalViewInteraction::Expand(ExpandType::Details(tx_cloned_for_closure.clone())), + )) + }); + + if is_odd == Some(true) { + table_row = table_row.style(TableRowStyle::TableRowLowlight) + } else { + table_row = table_row.style(TableRowStyle::TableRowHighlight) + } - let mut tx_column = Column::new().push(row); + let mut tx_column = Column::new().push(table_row); let mut action_button_row = Row::new(); if is_tx_expanded { @@ -1647,7 +1314,12 @@ pub fn data_row_container<'a, 'b>( .style(grin_gui_core::theme::ButtonStyle::Primary) .on_press(Interaction::WalletOperationHomeViewInteraction( super::home::LocalViewInteraction::ReloadTxSlate( - tx_cloned_for_row.tx.tx_slate_id.unwrap().to_string(), + tx_cloned_for_row + .clone() + .tx + .tx_slate_id + .unwrap() + .to_string(), ), )) .into(); @@ -1887,26 +1559,10 @@ pub fn data_row_container<'a, 'b>( } } - let mut table_row = TableRow::new(tx_column) - .width(Length::Fill) - .inner_row_height(default_row_height) - .on_press(move |_| { - Message::Interaction(Interaction::WalletOperationTxListInteraction( - LocalViewInteraction::Expand(ExpandType::Details(tx_cloned_for_row.clone())), - )) - }); - - if is_odd == Some(true) { - table_row = - table_row.style(grin_gui_core::style::table_row::TableRowStyle::TableRowAlternate) - } else { - table_row = table_row.style(grin_gui_core::style::table_row::TableRowStyle::Default) - } - // Due to what feels like an iced-rs bug, don't put buttons within the actual row as they appear // to clear their state between the press down and up event if included within the row itself // Some kind of fix to the table row widget might rectify this - let mut return_column = Column::new().push(table_row).push(action_button_row); + let mut return_column = Column::new().push(tx_column).push(action_button_row); if is_tx_expanded { return_column = return_column.push(Space::new( diff --git a/src/gui/element/wallet/operation/tx_list_display.rs b/src/gui/element/wallet/operation/tx_list_display.rs index 11f1b28..f5620b0 100644 --- a/src/gui/element/wallet/operation/tx_list_display.rs +++ b/src/gui/element/wallet/operation/tx_list_display.rs @@ -2,7 +2,6 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; use chrono::DurationRound; -use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, wallet::{TxLogEntry, TxLogEntryType}, @@ -23,8 +22,7 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, TableRow, Text, TextInput, }, grin_gui_core::wallet::{ InitTxArgs, RetrieveTxQueryArgs, RetrieveTxQuerySortOrder, Slate, StatusMessage, @@ -241,7 +239,7 @@ pub fn data_container<'a>( state: &'a StateContainer, ) -> Container<'a, Message> { let button_height = Length::Fixed(BUTTON_HEIGHT); - let button_width = Length::Fixed(BUTTON_WIDTH); + let button_width = Length::Shrink; let title = Text::new(localized_string("tx-list")).size(DEFAULT_HEADER_FONT_SIZE); let title_container = Container::new(title) diff --git a/src/gui/element/wallet/operation/tx_proof.rs b/src/gui/element/wallet/operation/tx_proof.rs index 7b73eb1..3ebd94f 100644 --- a/src/gui/element/wallet/operation/tx_proof.rs +++ b/src/gui/element/wallet/operation/tx_proof.rs @@ -1,7 +1,6 @@ use super::tx_list::{self, ExpandType}; use crate::log_error; use async_std::prelude::FutureExt; -use grin_gui_core::widget::header; use grin_gui_core::{ config::Config, error::GrinWalletInterfaceError, @@ -25,8 +24,7 @@ use { crate::Result, anyhow::Context, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, Text, TextInput, }, grin_gui_core::wallet::{InitTxArgs, Slate, StatusMessage, WalletInfo, WalletInterface}, grin_gui_core::{ diff --git a/src/gui/element/wallet/setup/wallet_list.rs b/src/gui/element/wallet/setup/wallet_list.rs index bd2facb..32db3ef 100644 --- a/src/gui/element/wallet/setup/wallet_list.rs +++ b/src/gui/element/wallet/setup/wallet_list.rs @@ -8,8 +8,8 @@ use { anyhow::Context, grin_gui_core::config::Config, grin_gui_core::theme::{ - Button, Column, Container, Element, Header, PickList, Row, Scrollable, TableRow, Text, - TextInput, + Button, Column, Container, Element, PickList, Row, Scrollable, TableHeader, TableRow, + TableRowStyle, Text, TextInput, }, grin_gui_core::{ theme::ColorPalette, @@ -22,7 +22,6 @@ use { std::sync::{Arc, RwLock}, }; -use grin_gui_core::widget::table_row; use isahc::head; use crate::gui::element::DEFAULT_SUB_HEADER_FONT_SIZE; @@ -262,11 +261,13 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain let wallet_name = Text::new(w.display_name.clone()).size(DEFAULT_FONT_SIZE); let chain_name = Text::new(w.chain_type.shortname()).size(DEFAULT_FONT_SIZE); - /*let mut wallet_name_container = Container::new(wallet_name) - .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); + let mut wallet_name_container = Container::new(wallet_name) + .style(grin_gui_core::theme::ContainerStyle::HoverableForeground) + .width(Length::FillPortion(1)); let mut wallet_chain_container = Container::new(chain_name) - .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); + .style(grin_gui_core::theme::ContainerStyle::HoverableForeground) + .width(Length::FillPortion(1)); let tld_string = match &w.tld { Some(path_buf) => path_buf.display().to_string(), @@ -275,7 +276,8 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain let wallet_directory = Text::new(tld_string).size(DEFAULT_FONT_SIZE); let mut wallet_directory_container = Container::new(wallet_directory) - .style(grin_gui_core::theme::ContainerStyle::HoverableForeground); + .style(grin_gui_core::theme::ContainerStyle::HoverableForeground) + .width(Length::FillPortion(3)); if selected_wallet { wallet_name_container = wallet_name_container @@ -284,28 +286,15 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain .style(grin_gui_core::theme::ContainerStyle::HoverableBrightForeground); wallet_directory_container = wallet_directory_container .style(grin_gui_core::theme::ContainerStyle::HoverableBrightForeground); - }*/ - - let wallet_row = Row::new() - // .push(checkbox) - /* .push( - Column::new() - .push(wallet_name_container) - .width(Length::FillPortion(1)), - ) - .push( - Column::new() - .push(wallet_chain_container) - .width(Length::FillPortion(1)), - ) - .push( - Column::new() - .push(wallet_directory_container) - .width(Length::FillPortion(3)), - )*/ - .push(Text::new("arse").size(DEFAULT_FONT_SIZE)); - - let mut table_row = TableRow::new(wallet_row) + } + + let wallet_row = vec![ + wallet_name_container, + wallet_chain_container, + wallet_directory_container, + ]; + + let mut table_row = TableRow::new(wallet_row, 0) .padding(iced::Padding::from(9)) .width(Length::Fill) .on_press(move |_| { @@ -317,16 +306,13 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain if selected_wallet { // selected wallet should be highlighted - table_row = - table_row.style(grin_gui_core::style::table_row::TableRowStyle::TableRowSelected); + table_row = table_row.style(TableRowStyle::TableRowSelected); } else { // contrast row styles to spice things up if pos % 2 == 0 { - table_row = table_row - .style(grin_gui_core::style::table_row::TableRowStyle::TableRowLowlife); + table_row = table_row.style(TableRowStyle::TableRowLowlight); } else { - table_row = table_row - .style(grin_gui_core::style::table_row::TableRowStyle::TableRowHighlife); + table_row = table_row.style(TableRowStyle::TableRowHighlight); } } From ebc3101ae928595f51b3674b8662e2028b74d9a1 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Thu, 11 Apr 2024 12:05:44 +0100 Subject: [PATCH 11/12] remove core crates --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2262ab2..21790b9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - job_args: [crates/core, crates/widgets, .] + job_args: [crates/core, .] steps: - uses: actions/checkout@v3 - name: Test ${{ matrix.job_args }} From e8b849ac422effe01ee14600293dfbc75151c3a9 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Fri, 12 Apr 2024 09:14:41 +0100 Subject: [PATCH 12/12] macos fixes + version bump --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- crates/core/Cargo.toml | 2 +- src/gui/mod.rs | 2 +- src/gui/update.rs | 4 +++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 161966d..8022b70 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2593,7 +2593,7 @@ dependencies = [ [[package]] name = "grin-gui" -version = "0.1.0-alpha.6" +version = "0.1.0-alpha.7" dependencies = [ "anyhow", "async-std", @@ -2639,7 +2639,7 @@ dependencies = [ [[package]] name = "grin-gui-core" -version = "0.1.0-alpha.6" +version = "0.1.0-alpha.7" dependencies = [ "async-std", "backtrace", diff --git a/Cargo.toml b/Cargo.toml index bd47478..31509fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin-gui" -version = "0.1.0-alpha.6" +version = "0.1.0-alpha.7" authors = ["Grin Developers "] description = "GUI wrapping grin and grin-wallet. Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 7c67d75..85da0ac 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "grin-gui-core" description = "Core GUI library for Grin GUI" -version = "0.1.0-alpha.6" +version = "0.1.0-alpha.7" authors = ["Yeastplume", "Casper Rogild Storm"] license = "GPL-3.0" homepage = "https://github.com/mimblewimble/grin-gui" diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 20faec1..2f0ab6e 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -328,7 +328,7 @@ pub fn run(opts: Opts, config: Config) { #[cfg(target_os = "macos")] { // false needed for Application shutdown - settings.windows.exit_on_close_request = false; + settings.window.exit_on_close_request = false; } #[cfg(target_os = "windows")] diff --git a/src/gui/update.rs b/src/gui/update.rs index b1ad7aa..2aef1da 100644 --- a/src/gui/update.rs +++ b/src/gui/update.rs @@ -289,6 +289,7 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result { log::debug!("Message::RuntimeEvent(CloseRequested)"); @@ -306,7 +307,8 @@ pub fn handle_message(grin_gui: &mut GrinGui, message: Message) -> Result