From adb905f9b750166cac26363a526cb99d73bc2638 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 1 Nov 2023 21:52:25 +0100 Subject: [PATCH] Async --- Cargo.lock | 677 ++++++++++++++++-- czkawka_slint_gui/Cargo.toml | 1 + .../src/connect_directories_changes.rs | 46 ++ czkawka_slint_gui/src/main.rs | 3 + czkawka_slint_gui/ui/action_buttons.slint | 90 +-- czkawka_slint_gui/ui/bottom_panel.slint | 9 + czkawka_slint_gui/ui/main_window.slint | 2 + 7 files changed, 744 insertions(+), 84 deletions(-) create mode 100644 czkawka_slint_gui/src/connect_directories_changes.rs diff --git a/Cargo.lock b/Cargo.lock index b2728f7..c7bbe65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -198,6 +198,213 @@ dependencies = [ "libloading 0.7.4", ] +[[package]] +name = "ashpd" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c018490e423efb6f032ef575f873ea57b61d44bec763cfe027b8e8852a027cf" +dependencies = [ + "async-std", + "enumflags2", + "futures-channel", + "futures-util", + "once_cell", + "rand", + "serde", + "serde_repr", + "url", + "zbus", +] + +[[package]] +name = "async-broadcast" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" +dependencies = [ + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener 2.5.3", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" +dependencies = [ + "async-lock", + "async-task", + "concurrent-queue", + "fastrand 2.0.1", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +dependencies = [ + "async-lock", + "autocfg", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-global-executor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +dependencies = [ + "async-channel", + "async-executor", + "async-io 1.13.0", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite", + "log", + "parking", + "polling 2.8.0", + "rustix 0.37.27", + "slab", + "socket2", + "waker-fn", +] + +[[package]] +name = "async-io" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10da8f3146014722c89e7859e1d7bb97873125d7346d10ca642ffab794355828" +dependencies = [ + "async-lock", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling 3.3.0", + "rustix 0.38.21", + "slab", + "tracing", + "waker-fn", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener 2.5.3", +] + +[[package]] +name = "async-process" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" +dependencies = [ + "async-io 1.13.0", + "async-lock", + "async-signal", + "blocking", + "cfg-if", + "event-listener 3.0.1", + "futures-lite", + "rustix 0.38.21", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "async-signal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" +dependencies = [ + "async-io 2.1.0", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 0.38.21", + "signal-hook-registry", + "slab", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-channel", + "async-global-executor", + "async-io 1.13.0", + "async-lock", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" + [[package]] name = "async-trait" version = "0.1.74" @@ -379,6 +586,22 @@ dependencies = [ "objc2", ] +[[package]] +name = "blocking" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "fastrand 2.0.1", + "futures-io", + "futures-lite", + "piper", + "tracing", +] + [[package]] name = "bumpalo" version = "3.14.0" @@ -493,7 +716,7 @@ dependencies = [ "bitflags 2.4.1", "log", "polling 3.3.0", - "rustix", + "rustix 0.38.21", "slab", "thiserror", ] @@ -505,7 +728,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ "calloop 0.12.3", - "rustix", + "rustix 0.38.21", "wayland-backend", "wayland-client", ] @@ -773,7 +996,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "const-field-offset-macro", "field-offset", @@ -782,7 +1005,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "proc-macro2", "quote", @@ -1111,6 +1334,7 @@ dependencies = [ "handsome_logger", "open", "rand", + "rfd", "slint", "slint-build", ] @@ -1207,6 +1431,17 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_more" version = "0.99.17" @@ -1368,6 +1603,27 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enumflags2" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "enumn" version = "0.1.12" @@ -1404,6 +1660,23 @@ dependencies = [ "num-traits", ] +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "event-listener" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cec0252c2afff729ee6f00e903d479fba81784c8e2bd77447673471fdfaea1" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + [[package]] name = "exr" version = "1.6.4" @@ -1420,6 +1693,15 @@ dependencies = [ "zune-inflate", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.0.1" @@ -1757,6 +2039,21 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.29" @@ -1787,8 +2084,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-core", + "futures-io", "futures-macro", + "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", "slab", @@ -2044,6 +2344,18 @@ dependencies = [ "async-trait", ] +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "glow" version = "0.12.3" @@ -2302,6 +2614,12 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "hmac" version = "0.12.1" @@ -2332,7 +2650,7 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "calloop 0.11.0", "drm", @@ -2353,7 +2671,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2366,7 +2684,7 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "accesskit", "bytemuck", @@ -2402,7 +2720,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "cfg-if", "derive_more", @@ -2413,7 +2731,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "by_address", "codemap", @@ -2442,7 +2760,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "auto_enums", "bytemuck", @@ -2485,7 +2803,7 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "quote", "syn 2.0.38", @@ -2494,7 +2812,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "cfg-if", "const-field-offset", @@ -2526,7 +2844,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "ash", "bytemuck", @@ -2814,6 +3132,15 @@ dependencies = [ "libc", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + [[package]] name = "integer-sqrt" version = "0.1.5" @@ -2947,9 +3274,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -2969,6 +3296,15 @@ dependencies = [ "arrayvec", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy-bytes-cast" version = "5.0.1" @@ -3090,6 +3426,12 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + [[package]] name = "linux-raw-sys" version = "0.4.10" @@ -3151,6 +3493,9 @@ name = "log" version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +dependencies = [ + "value-bag", +] [[package]] name = "loom" @@ -3605,6 +3950,16 @@ dependencies = [ "redox_syscall 0.3.5", ] +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "overload" version = "0.1.1" @@ -3645,6 +4000,12 @@ dependencies = [ "system-deps", ] +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.12.1" @@ -3797,6 +4158,17 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b330c9d1b92dfe68442ca20b009c717d5f0b1e3cf4965e62f704c3c6e95a1305" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + [[package]] name = "pkg-config" version = "0.3.27" @@ -3841,11 +4213,17 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix", + "rustix 0.38.21", "tracing", "windows-sys 0.48.0", ] +[[package]] +name = "pollster" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" + [[package]] name = "portable-atomic" version = "1.5.1" @@ -4153,6 +4531,31 @@ dependencies = [ "usvg", ] +[[package]] +name = "rfd" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c9e7b57df6e8472152674607f6cc68aa14a748a3157a857a94f516e11aeacc2" +dependencies = [ + "ashpd", + "async-io 1.13.0", + "block", + "dispatch", + "futures-util", + "js-sys", + "log", + "objc", + "objc-foundation", + "objc_id", + "pollster", + "raw-window-handle 0.5.2", + "urlencoding", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-sys 0.48.0", +] + [[package]] name = "rgb" version = "0.8.37" @@ -4306,6 +4709,20 @@ dependencies = [ "version_check", ] +[[package]] +name = "rustix" +version = "0.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + [[package]] name = "rustix" version = "0.38.21" @@ -4315,7 +4732,7 @@ dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.10", "windows-sys 0.48.0", ] @@ -4478,6 +4895,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "serde_spanned" version = "0.6.4" @@ -4536,6 +4964,15 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + [[package]] name = "simd-adler32" version = "0.3.7" @@ -4600,7 +5037,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -4616,7 +5053,7 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "i-slint-compiler", "spin_on", @@ -4627,7 +5064,7 @@ dependencies = [ [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -4663,7 +5100,7 @@ dependencies = [ "libc", "log", "memmap2 0.9.0", - "rustix", + "rustix 0.38.21", "thiserror", "wayland-backend", "wayland-client", @@ -4717,6 +5154,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "softbuffer" version = "0.3.3" @@ -4728,7 +5175,7 @@ dependencies = [ "cfg_aliases", "cocoa 0.25.0", "core-graphics 0.23.1", - "fastrand", + "fastrand 2.0.1", "foreign-types 0.5.0", "js-sys", "log", @@ -4736,7 +5183,7 @@ dependencies = [ "objc", "raw-window-handle 0.5.2", "redox_syscall 0.4.1", - "rustix", + "rustix 0.38.21", "tiny-xlib", "wasm-bindgen", "wayland-backend", @@ -5098,9 +5545,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", - "fastrand", + "fastrand 2.0.1", "redox_syscall 0.4.1", - "rustix", + "rustix 0.38.21", "windows-sys 0.48.0", ] @@ -5484,6 +5931,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "uds_windows" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" +dependencies = [ + "tempfile", + "winapi", +] + [[package]] name = "unic-langid" version = "0.9.1" @@ -5606,8 +6063,15 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "usvg" version = "0.34.1" @@ -5687,6 +6151,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "value-bag" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a72e1902dde2bd6441347de2b70b7f5d59bf157c6c62f0c44572607a1d55bbe" + [[package]] name = "version-compare" version = "0.1.1" @@ -5728,7 +6198,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "const-field-offset", "portable-atomic", @@ -5739,7 +6209,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" +source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" dependencies = [ "proc-macro2", "quote", @@ -5774,6 +6244,12 @@ dependencies = [ "vk-parse", ] +[[package]] +name = "waker-fn" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" + [[package]] name = "walkdir" version = "2.4.0" @@ -5792,9 +6268,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -5802,9 +6278,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", @@ -5817,9 +6293,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -5829,9 +6305,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5839,9 +6315,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", @@ -5852,9 +6328,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wayland-backend" @@ -5967,9 +6443,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -6006,7 +6482,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix", + "rustix 0.38.21", ] [[package]] @@ -6237,7 +6713,7 @@ dependencies = [ "percent-encoding", "raw-window-handle 0.5.2", "redox_syscall 0.3.5", - "rustix", + "rustix 0.38.21", "sctk-adwaita", "smithay-client-toolkit", "smol_str", @@ -6338,6 +6814,16 @@ dependencies = [ "nom", ] +[[package]] +name = "xdg-home" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd" +dependencies = [ + "nix 0.26.4", + "winapi", +] + [[package]] name = "xkbcommon" version = "0.6.0" @@ -6401,6 +6887,72 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "zbus" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31de390a2d872e4cd04edd71b425e29853f786dc99317ed72d73d6fcf5ebb948" +dependencies = [ + "async-broadcast", + "async-executor", + "async-fs", + "async-io 1.13.0", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "byteorder", + "derivative", + "enumflags2", + "event-listener 2.5.3", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix 0.26.4", + "once_cell", + "ordered-stream", + "rand", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "winapi", + "xdg-home", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1794a946878c0e807f55a397187c11fc7a038ba5d868e7db4f3bd7760bc9d" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb80bb776dbda6e23d705cf0123c3b95df99c4ebeaec6c2599d4a5419902b4a9" +dependencies = [ + "serde", + "static_assertions", + "zvariant", +] + [[package]] name = "zerocopy" version = "0.7.21" @@ -6448,3 +7000,42 @@ checksum = "73ab332fe2f6680068f3582b16a24f90ad7096d5d39b974d1c0aff0125116f02" dependencies = [ "simd-adler32", ] + +[[package]] +name = "zvariant" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b291bee0d960c53170780af148dca5fa260a63cdd24f1962fa82e03e53338c" +dependencies = [ + "byteorder", + "enumflags2", + "libc", + "serde", + "static_assertions", + "url", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "934d7a7dfc310d6ee06c87ffe88ef4eca7d3e37bb251dece2ef93da8f17d8ecd" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro2", + "quote", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index 73817d5..3674b2d 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -27,6 +27,7 @@ chrono = "0.4.31" open = "5.0.0" crossbeam-channel = "0.5.8" handsome_logger = "0.8.0" +rfd = { version = "0.12.0", default-features = false, features = ["xdg-portal"] } [build-dependencies] #slint-build = "1.2.2" diff --git a/czkawka_slint_gui/src/connect_directories_changes.rs b/czkawka_slint_gui/src/connect_directories_changes.rs new file mode 100644 index 0000000..6691723 --- /dev/null +++ b/czkawka_slint_gui/src/connect_directories_changes.rs @@ -0,0 +1,46 @@ +use crate::{MainWindow, Settings}; +use rfd::FileDialog; +use slint::{ComponentHandle, Model, ModelRc, VecModel}; + +pub fn connect_add_directories(app: &MainWindow) { + let a = app.as_weak(); + app.on_folder_choose_requested(move |included_directories| { + let app = a.upgrade().unwrap(); + + let directory = std::env::current_dir().unwrap_or(std::path::PathBuf::from("/")); + + let file_dialog = FileDialog::new().set_directory(directory); + + let Some(folders) = file_dialog.pick_folders() else { + return; + }; + + let settings = app.global::(); + let old_folders = if included_directories { + settings.get_included_directories() + } else { + settings.get_excluded_directories() + }; + + let mut new_folders = old_folders.iter().map(|x| x.text.to_string()).collect::>(); + new_folders.extend(folders.iter().map(|x| x.to_string_lossy().to_string())); + new_folders.sort(); + new_folders.dedup(); + + let new_folders_standard_list_view = new_folders + .iter() + .map(|x| { + let mut element = slint::StandardListViewItem::default(); + element.text = slint::SharedString::from(x.to_string()); + element + }) + .collect::>(); + let new_folders_model = ModelRc::new(VecModel::from(new_folders_standard_list_view)); + + if included_directories { + settings.set_included_directories(new_folders_model); + } else { + settings.set_excluded_directories(new_folders_model); + } + }); +} diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 5ff9a54..c71bf77 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -14,6 +14,7 @@ mod common; mod connect_delete; +mod connect_directories_changes; mod connect_open; mod connect_progress_receiver; mod connect_scan; @@ -28,6 +29,7 @@ use crate::connect_delete::connect_delete_button; use crate::connect_open::connect_open_items; use crate::connect_scan::connect_scan_button; +use crate::connect_directories_changes::connect_add_directories; use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_stop::connect_stop_button; use crate::settings::reset_settings; @@ -51,6 +53,7 @@ fn main() { connect_stop_button(&app, stop_sender); connect_open_items(&app); connect_progress_gathering(&app, progress_receiver); + connect_add_directories(&app); reset_settings(&app); diff --git a/czkawka_slint_gui/ui/action_buttons.slint b/czkawka_slint_gui/ui/action_buttons.slint index a4b6685..0e9ede7 100644 --- a/czkawka_slint_gui/ui/action_buttons.slint +++ b/czkawka_slint_gui/ui/action_buttons.slint @@ -17,7 +17,7 @@ export component VisibilityButton inherits Button { } } -export component ActionButtons { +export component ActionButtons inherits HorizontalLayout { callback deleted; callback scan_stopping; callback scan_starting(CurrentTab); @@ -26,47 +26,55 @@ export component ActionButtons { in-out property stop_requested: false; in-out property scanning; in-out property active-tab; + out property name; + height: 30px; + spacing: 4px; - HorizontalBox { - height: 50px; - scan_button:= Button { - enabled: !scanning; - text: "Scan"; - clicked => { - root.scanning = true; - root.scan_starting(active-tab); - } - } - stop_button:= Button { - enabled: scanning && !stop_requested; - text: "Stop"; - clicked => { - root.scan_stopping(); - root.stop_requested = true; - } - } - delete_button:= Button { - enabled: !scanning; - text: "Delete"; - clicked => { - root.deleted(); - } - } - - VisibilityButton { - button-visibility: BottomPanelVisibility.Directories; - bottom_panel_visibility <=> bottom_panel_visibility; - text: "Dirs"; - } - VisibilityButton { - button-visibility: BottomPanelVisibility.NotVisible; - bottom_panel_visibility <=> bottom_panel_visibility; - text: "NotVS"; - } - VisibilityButton { - button-visibility: BottomPanelVisibility.TextErrors; - bottom_panel_visibility <=> bottom_panel_visibility; - text: "Text"; + scan_button:= Button { + height: parent.height; + enabled: !scanning; + text: "Scan"; + clicked => { + root.scanning = true; + root.scan_starting(active-tab); } } + stop_button:= Button { + height: parent.height; + enabled: scanning && !stop_requested; + text: "Stop"; + clicked => { + root.scan_stopping(); + root.stop_requested = true; + } + } + delete_button:= Button { + height: parent.height; + enabled: !scanning; + text: "Delete"; + clicked => { + root.deleted(); + } + } + + VisibilityButton { + height: parent.height; + button-visibility: BottomPanelVisibility.Directories; + bottom_panel_visibility <=> bottom_panel_visibility; + text: "Dirs"; + } + + VisibilityButton { + height: parent.height; + button-visibility: BottomPanelVisibility.NotVisible; + bottom_panel_visibility <=> bottom_panel_visibility; + text: "NotVS"; + } + + VisibilityButton { + height: parent.height; + button-visibility: BottomPanelVisibility.TextErrors; + bottom_panel_visibility <=> bottom_panel_visibility; + text: "Text"; + } } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/bottom_panel.slint b/czkawka_slint_gui/ui/bottom_panel.slint index ee89dc1..5598bf1 100644 --- a/czkawka_slint_gui/ui/bottom_panel.slint +++ b/czkawka_slint_gui/ui/bottom_panel.slint @@ -5,12 +5,16 @@ import {BottomPanelVisibility} from "common.slint"; component DirectoriesPanel { out property buttonSize: 75px; + callback folder-choose-requested(bool); HorizontalLayout { VerticalLayout { width: buttonSize; Button { text: "Add"; + clicked => { + folder-choose-requested(true); + } } Button { text: "Remove"; @@ -33,6 +37,9 @@ component DirectoriesPanel { width: buttonSize; Button { text: "Add"; + clicked => { + folder-choose-requested(false); + } } Button { text: "Remove"; @@ -62,6 +69,7 @@ component TextErrorsPanel { export component BottomPanel { in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; + callback folder-choose-requested(bool); min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px; min-width: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 400px; @@ -69,6 +77,7 @@ export component BottomPanel { if bottom-panel-visibility == BottomPanelVisibility.Directories: DirectoriesPanel { width: parent.width; height: parent.height; + folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)} } if bottom-panel-visibility == BottomPanelVisibility.TextErrors : TextErrorsPanel { width: parent.width; diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index f07a5df..333fb33 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -16,6 +16,7 @@ export component MainWindow inherits Window { callback scan_stopping; callback scan_starting(CurrentTab); callback item_opened(string); + callback folder-choose-requested(bool); callback scan_ended(); @@ -117,6 +118,7 @@ export component MainWindow inherits Window { BottomPanel { bottom-panel-visibility <=> action_buttons.bottom-panel-visibility; vertical-stretch: 0.0; + folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)} } }