From 989c42321a23b9b0c9bc29b198ef9705b8f17cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 18 Feb 2024 23:36:30 +0100 Subject: [PATCH] AB --- Cargo.lock | 133 ++++++++++++++-------------- Changelog.md | 4 +- krokiet/Cargo.toml | 1 + krokiet/README.md | 16 ++-- krokiet/src/common.rs | 4 +- krokiet/src/connect_delete.rs | 10 ++- krokiet/src/connect_show_preview.rs | 4 +- krokiet/src/main.rs | 1 + krokiet/src/model_operations.rs | 2 +- 9 files changed, 92 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee75634..62559a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" dependencies = [ "anstyle", "anstyle-parse", @@ -234,7 +234,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" dependencies = [ "concurrent-queue", - "event-listener 5.0.0", + "event-listener 5.1.0", "event-listener-strategy 0.5.0", "futures-core", "pin-project-lite", @@ -309,7 +309,7 @@ dependencies = [ "futures-io", "futures-lite 2.2.0", "parking", - "polling 3.4.0", + "polling 3.5.0", "rustix 0.38.31", "slab", "tracing", @@ -372,7 +372,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -407,7 +407,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -434,7 +434,7 @@ dependencies = [ "derive_utils", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -483,7 +483,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.48", + "syn 2.0.49", "which", ] @@ -589,9 +589,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" [[package]] name = "by_address" @@ -616,7 +616,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -684,7 +684,7 @@ checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" dependencies = [ "bitflags 2.4.2", "log", - "polling 3.4.0", + "polling 3.5.0", "rustix 0.38.31", "slab", "thiserror", @@ -821,9 +821,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.0" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -831,9 +831,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.0" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -850,7 +850,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -983,7 +983,7 @@ checksum = "57aaaad9185d3bcb3afe63549d8ba60b2fb0ea8dc2da83f62dd56805edf56fd1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1190,7 +1190,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1438,7 +1438,7 @@ checksum = "61bb5a1014ce6dfc2a378578509abe775a5aa06bff584a547555d9efdb81b926" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1487,7 +1487,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1635,7 +1635,7 @@ checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1646,7 +1646,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1704,9 +1704,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72557800024fabbaa2449dd4bf24e37b93702d457a4d4f2b0dd1f0f039f20c1" +checksum = "b7ad6fd685ce13acd6d9541a30f6db6567a7a24c9ffd4ba2955d29e3f22c8b27" dependencies = [ "concurrent-queue", "parking", @@ -1729,7 +1729,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" dependencies = [ - "event-listener 5.0.0", + "event-listener 5.1.0", "pin-project-lite", ] @@ -1992,7 +1992,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2113,7 +2113,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2371,7 +2371,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2658,9 +2658,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -2858,7 +2858,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f2a4e4c21ed660181abe101b6f141d920e838fec4bc1ff20f7440dc03fb5ad8" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -2983,7 +2983,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.10.0", - "syn 2.0.48", + "syn 2.0.49", "unic-langid", ] @@ -2997,7 +2997,7 @@ dependencies = [ "i18n-config", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3367,6 +3367,7 @@ dependencies = [ "serde_json", "slint", "slint-build", + "trash", ] [[package]] @@ -3608,7 +3609,7 @@ checksum = "764b60e1ddd07e5665a6a17636a95cd7d8f3b86c73503a69c32979d05f72f3cf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3934,14 +3935,14 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "num_threads" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" dependencies = [ "libc", ] @@ -4243,7 +4244,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4277,15 +4278,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "png" -version = "0.17.11" +version = "0.17.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6c3c3e617595665b8ea2ff95a86066be38fb121ff920a9c0eb282abcd1da5a" +checksum = "78c2378060fb13acff3ba0325b83442c1d2c44fbb76df481160ddc1687cce160" dependencies = [ "bitflags 1.3.2", "crc32fast", @@ -4312,9 +4313,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30054e72317ab98eddd8561db0f6524df3367636884b7b21b703e4b280a84a14" +checksum = "24f040dee2588b4963afb4e420540439d126f73fdacf4a9c486a96d840bac3c9" dependencies = [ "cfg-if", "concurrent-queue", @@ -4358,7 +4359,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4705,7 +4706,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.48", + "syn 2.0.49", "walkdir", ] @@ -4940,7 +4941,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4962,7 +4963,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5351,7 +5352,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5566,9 +5567,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", @@ -5649,7 +5650,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5786,7 +5787,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.5", + "toml_edit 0.22.6", ] [[package]] @@ -5822,15 +5823,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" dependencies = [ "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.0", + "winnow 0.6.1", ] [[package]] @@ -5852,7 +5853,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -6239,7 +6240,7 @@ checksum = "6b2b8eecdb8e4284adf5546fc518f048f6dc33e7203dbe36fa93a4add39b31f6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -6314,7 +6315,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-shared", ] @@ -6348,7 +6349,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6850,9 +6851,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1dbce9e90e5404c5a52ed82b1d13fc8cfbdad85033b6f57546ffd1265f8451" +checksum = "d90f4e0f530c4c69f62b80d839e9ef3855edc9cba471a160c4d692deed62b401" dependencies = [ "memchr", ] @@ -7005,9 +7006,9 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "xxhash-rust" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53be06678ed9e83edb1745eb72efc0bbcd7b5c3c35711a860906aed827a13d61" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" [[package]] name = "yaml-rust" @@ -7101,7 +7102,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] diff --git a/Changelog.md b/Changelog.md index 16d6d28..c270b71 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,4 @@ -## Version 7.0.0 - ? +## Version 7.0.0 - 19.02.2024r ### BREAKING CHANGES - Reducing size of cache files, made old cache files incompatible with new version - `-C` in CLI now saves as compact json @@ -34,7 +34,7 @@ - Decrease a little size of cache by few percents and improve loading/saving speed - [#1159](https://github.com/qarmin/czkawka/pull/1159) - Added ability to remove from scan files with excluded extensions - [#1184](https://github.com/qarmin/czkawka/pull/1102) - Fixed not showing in similar images results, files with same hashes when using reference folders - [#1184](https://github.com/qarmin/czkawka/pull/1102) -- Optimize release binaries with LTO(~25% smaller, ~5/10% faster) - [#1184](https://github.com/qarmin/czkawka/pull/1102) +- Optimize release binaries with LTO(~25/50% smaller, ~5/10% faster) - [#1184](https://github.com/qarmin/czkawka/pull/1102) ## Version 6.1.0 - 15.10.2023r - BREAKING CHANGE - Changed cache saving method, deduplicated, optimized and simplified procedure(all files needs to be hashed again) - [#1072](https://github.com/qarmin/czkawka/pull/1072), [#1086](https://github.com/qarmin/czkawka/pull/1086) diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index 5e10747..4d733c6 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -28,6 +28,7 @@ directories-next = "2.0" image_hasher = "1.2" rayon = "1.8" fs_extra = "1.3" # TODO replace with less buggy library +trash = "3.3" # Translations i18n-embed = { version = "0.14", features = ["fluent-system", "desktop-requester"] } diff --git a/krokiet/README.md b/krokiet/README.md index d302223..e017354 100644 --- a/krokiet/README.md +++ b/krokiet/README.md @@ -6,7 +6,7 @@ C code. ![Krokiet](https://github.com/qarmin/czkawka/assets/41945903/52628a29-ecd6-4692-9ee4-8a680c889193) Different toolkit means different look, limitations and features, so you should not expect same features like in Gtk 4 -frontend(but of course I want implement most of features from other project). +frontend(but of course I want implement most of the features from other project). ## Usage @@ -109,13 +109,13 @@ SLINT_STYLE=material-dark cargo run -- --path . There are multiple reasons why I decided to use Slint as toolkit for Krokiet over other toolkits. -| Toolkit | Pros | Cons | -|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Gtk 4 | - Hard compilation/cross compilation and bundling all required libraries - mostly on windows
- Cambalache can be used to create graphically gui
- Good gtk4-rs bindings(but sometimes not really intuitive) | - Hard compilation/cross compilation and bundling all required libraries - mostly on windows
- Forcing the use of a specific gui creation style
- Strange crashes, not working basic features, etc.(again, mostly on windows)
- Forcing to use bugged/outdated but dynamically loaded version of libraries on linux (e.g. 4.6 on Ubuntu 22.04) - not all fixes are backported | -| Qt | - QML support - simplify creating of gui from code it is easy to use and powerful
- Very flexible framework
- Typescript/javascript <=> qml interoperability
- Probably the most mature GUI library | - New and limited qt bindings
- Hard to cross-compile
- Very easy to create and use invalid state in QML(unexpected null/undefined values, messed properties bindings etc.)
- Commercial license or GPL | -| Slint | - Internal language is compiled to native code
- Live gui preview with Vscode/Vscodium without needing to use rust
- Full rust solution - easy to compile/cross compile, minimal runtime requirements
- Static type checks in slint files | - Internal .slint language is more limited than QML
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Only GPL is only available open-source license
- Popup windows almost not exists
- Internal widgets are almost not customizable and usually quite limited | -| Iced | - ~100% rust code - so compilation is simple
- Elm architecture - simple to understand | - Mostly maintained by one person - slows down fixing bugs and implementing new features
- GUI can be created only from rust code, which really is bad for creating complex GUIs(mostly due rust compile times)
- Docs are almost non-existent | -| Tauri | - Easy to create ui(at least for web developers) - uses html/css/js
- Quite portable | - Webview dependency - it is not really lightweight and can be hard to compile on some platforms and on Linux e.g. webRTC not working
- Cannot select directory - file chooser only can choose files - small thing but important for me
- Not very performant Rust <=> Javascript communication | +| Toolkit | Pros | Cons | +|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Gtk 4 | - Good Linux support
- Cambalache can be used to create graphically gui
- Good gtk4-rs bindings(but sometimes not really intuitive) | - Hard compilation/cross compilation and bundling all required libraries - mostly on windows
- Forcing the use of a specific gui creation style
- Strange crashes, not working basic features, etc.(again, mostly on windows)
- Forcing to use bugged/outdated but dynamically loaded version of libraries on linux (e.g. 4.6 on Ubuntu 22.04) - not all fixes are backported | +| Qt | - QML support - simplify creating of gui from code it is easy to use and powerful
- Very flexible framework
- Typescript/javascript <=> qml interoperability
- Probably the most mature GUI library | - New and limited qt bindings
- Hard to cross-compile
- Very easy to create and use invalid state in QML(unexpected null/undefined values, messed properties bindings etc.)
- Commercial license or GPL | +| Slint | - Internal language is compiled to native code
- Live gui preview with Vscode/Vscodium without needing to use rust
- Full rust solution - easy to compile/cross compile, minimal runtime requirements
- Static type checks in slint files | - Internal .slint language is more limited than QML
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Only GPL is only available open-source license
- Popup windows almost not exists
- Internal widgets are almost not customizable and usually quite limited | +| Iced | - ~100% rust code - so compilation is simple
- Elm architecture - simple to understand | - Mostly maintained by one person - slows down fixing bugs and implementing new features
- GUI can be created only from rust code, which really is bad for creating complex GUIs(mostly due rust compile times)
- Docs are almost non-existent | +| Tauri | - Easy to create ui(at least for web developers) - uses html/css/js
- Quite portable | - Webview dependency - it is not really lightweight and can be hard to compile on some platforms and on Linux e.g. webRTC not working
- Cannot select directory - file chooser only can choose files - small thing but important for me
- Not very performant Rust <=> Javascript communication (less problematic with [Tauri 2](https://github.com/tauri-apps/tauri/pull/7170#issuecomment-1583279023) ) | Since I don't have time to create really complex and good looking GUI, I needed a helper tool to create GUI not from Rust(I don't want to use different language, because this will make communication with czkawka_core harder) so I decided diff --git a/krokiet/src/common.rs b/krokiet/src/common.rs index 13dd405..e8b20a3 100644 --- a/krokiet/src/common.rs +++ b/krokiet/src/common.rs @@ -1,4 +1,4 @@ -#![allow(dead_code)] // TODO later remove +#![allow(dead_code)] use std::path::PathBuf; use crate::{CurrentTab, ExcludedDirectoriesModel, IncludedDirectoriesModel, MainListModel, MainWindow, Settings}; @@ -391,7 +391,7 @@ pub fn split_u64_into_i32s(value: u64) -> (i32, i32) { } pub fn connect_i32_into_u64(part1: i32, part2: i32) -> u64 { - ((part1 as u64) << 32) | (part2 as u64 & 0xFFFFFFFF) + ((part1 as u64) << 32) | (part2 as u64 & 0xFFFF_FFFF) } #[cfg(test)] diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index ac20a84..45120ed 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -60,8 +60,14 @@ fn remove_selected_items(items_to_remove: Vec, active_tab: CurrentTab, r items_to_remove .into_par_iter() .filter_map(|item| { - if let Err(e) = std::fs::remove_file(item) { - return Some(format!("Error while removing file: {e}")); + if remove_to_trash { + if let Err(e) = trash::delete(item) { + return Some(format!("Error while moving to trash: {e}")); + } + } else { + if let Err(e) = std::fs::remove_file(item) { + return Some(format!("Error while removing file: {e}")); + } } None }) diff --git a/krokiet/src/connect_show_preview.rs b/krokiet/src/connect_show_preview.rs index 809c082..399d38b 100644 --- a/krokiet/src/connect_show_preview.rs +++ b/krokiet/src/connect_show_preview.rs @@ -39,7 +39,7 @@ pub fn connect_show_preview(app: &MainWindow) { let res = load_image(path); if let Some((load_time, img)) = res { let start_timer_convert_time = Instant::now(); - let slint_image = convert_into_slint_image(img); + let slint_image = convert_into_slint_image(&img); let convert_time = start_timer_convert_time.elapsed(); let start_set_time = Instant::now(); @@ -67,7 +67,7 @@ fn set_preview_visible(gui_state: &GuiState, preview: Option<&str>) { } } -fn convert_into_slint_image(img: DynamicImage) -> slint::Image { +fn convert_into_slint_image(img: &DynamicImage) -> slint::Image { let image_buffer: ImageBufferRgba = img.to_rgba8(); let buffer = slint::SharedPixelBuffer::::clone_from_slice(image_buffer.as_raw(), image_buffer.width(), image_buffer.height()); slint::Image::from_rgba8(buffer) diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index c9f66e2..4a7f559 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -3,6 +3,7 @@ #![allow(unknown_lints)] // May be disabled, but locally I use nightly clippy #![allow(clippy::comparison_chain)] #![allow(clippy::collapsible_if)] +#![allow(clippy::collapsible_else_if)] #![allow(clippy::should_panic_without_expect)] #![allow(clippy::struct_field_names)] // Generated code #![allow(clippy::overly_complex_bool_expr)] // Generated code diff --git a/krokiet/src/model_operations.rs b/krokiet/src/model_operations.rs index 74f706b..2d35fbc 100644 --- a/krokiet/src/model_operations.rs +++ b/krokiet/src/model_operations.rs @@ -26,7 +26,7 @@ pub fn collect_full_path_from_model(items: &[MainListModel], active_tab: Current .map(|item| { let path = item.val_str.iter().nth(path_idx).unwrap(); let name = item.val_str.iter().nth(name_idx).unwrap(); - format!("{}{}{}", path, MAIN_SEPARATOR, name) + format!("{path}{MAIN_SEPARATOR}{name}") }) .collect::>() }