From 1c044d2ad85ee35af3f23c01d73395425f42d16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 17 Oct 2023 16:30:43 +0200 Subject: [PATCH 001/107] A1 --- czkawka_slint_gui/src/main.rs | 43 ++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 3ebd0630c..00b4c6c6a 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,3 +1,44 @@ fn main() {} -slint::slint! {} +slint::slint! { + import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView} from "std-widgets.slint"; + export component MainWindow { + VerticalBox { + TabWidget { + width: 400px; + preferred-height: 300px; + Tab { + title: "Empty Folders"; + ListView { + + } + StandardTableView { + visible: true; + columns: [{title: "Selection", Sort: false}, {title: "Name"}, {title: "Path"}]; + rows: [ + [{ text: "FG"}, {text: "gasg"}, {text:"asg" }], + [{ text: "GS"}, {text: "WW"}, {text:"AGAS" }] + ]; + + } + + } + Tab { + title: "Empty Files"; + Text { + text: "Empty files"; + } + } + } + HorizontalBox { + Button { + text: "Scan"; + } + Button { + text: "Delete"; + } + } + } + } + +} From 16a0ee2ce5c7e21ee02f0cbd5048e919d06534d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 17 Oct 2023 17:40:05 +0200 Subject: [PATCH 002/107] Again --- czkawka_slint_gui/src/main.rs | 107 +++++++++++++++++++++++++--------- 1 file changed, 81 insertions(+), 26 deletions(-) diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 00b4c6c6a..4d22d5468 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,44 +1,99 @@ fn main() {} slint::slint! { - import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView} from "std-widgets.slint"; - export component MainWindow { - VerticalBox { - TabWidget { - width: 400px; - preferred-height: 300px; - Tab { - title: "Empty Folders"; - ListView { +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView} from "std-widgets.slint"; - } - StandardTableView { - visible: true; - columns: [{title: "Selection", Sort: false}, {title: "Name"}, {title: "Path"}]; - rows: [ - [{ text: "FG"}, {text: "gasg"}, {text:"asg" }], - [{ text: "GS"}, {text: "WW"}, {text:"AGAS" }] - ]; +component CzkawkaTableView inherits Rectangle { + in property <[string]> columns; + in property <[[string]]> values; - } + private property <[length]> column_sizes: [20px, 100px, 50px, 200px]; + private property column_number: 3; - } - Tab { - title: "Empty Files"; - Text { - text: "Empty files"; + VerticalBox { + padding: 5px; + HorizontalLayout { + padding: 5px; spacing: 5px; + vertical-stretch: 0; + for title[idx] in root.columns : HorizontalLayout { + width: root.column_sizes[idx]; + Text { overflow: elide; text: idx; } + Rectangle { + width: 1px; + background: gray; + TouchArea { + width: 10px; + x: (parent.width - self.width) / 2; + property cached; + pointer-event(event) => { + if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) { + self.cached = root.column_sizes[idx]; + } + } + moved => { + if (self.pressed) { + root.column_sizes[idx] += (self.mouse-x - self.pressed-x); + if (root.column_sizes[idx] < 0) { + root.column_sizes[idx] = 0; + } + } + } + mouse-cursor: ew-resize; } } } - HorizontalBox { + } + ListView { + for r in root.values : HorizontalLayout { + padding: 5px; + spacing: 5px; + for t[idx] in r : HorizontalLayout { + width: root.column_sizes[idx]; + Text { overflow: elide; text: t; } + } + } + } + } +} + +export component MainWindow { + in-out property active-tab; + VerticalBox { + HorizontalBox { + width: 400px; + preferred-height: 300px; + + tab_bar := VerticalLayout { + width: 120px; + spacing: 3px; Button { - text: "Scan"; + text: "Empty Folders"; + clicked => { root.active-tab = 0; } } Button { - text: "Delete"; + text: "Similar Images"; + clicked => { root.active-tab = 1; } } } + + CzkawkaTableView { + columns: ["Device", "Mount Point", "Total", "Free"]; + values: [ + ["/dev/sda1", "/", "255GB", "82.2GB"] , + ["/dev/sda2", "/tmp", "60.5GB", "44.5GB"] , + ["/dev/sdb1", "/home", "255GB", "32.2GB"] , + ]; + } + } + HorizontalBox { + Button { + text: "Scan"; + } + Button { + text: "Delete"; + } } } +} } From d298bf524b9fa01a32bd88a81aa22af92c6e219f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 17 Oct 2023 20:51:40 +0200 Subject: [PATCH 003/107] BD --- czkawka_slint_gui/src/main.rs | 73 +++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 21 deletions(-) diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 4d22d5468..0b2fc3f16 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,28 +1,30 @@ fn main() {} slint::slint! { -import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView} from "std-widgets.slint"; +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; -component CzkawkaTableView inherits Rectangle { +component SelectableTableView inherits Rectangle { in property <[string]> columns; in property <[[string]]> values; - private property <[length]> column_sizes: [20px, 100px, 50px, 200px]; - private property column_number: 3; + private property <[length]> column_sizes: [30px, 100px, 100px, 100px]; + private property column_number: 4; VerticalBox { padding: 5px; + // Widgets HorizontalLayout { padding: 5px; spacing: 5px; vertical-stretch: 0; for title[idx] in root.columns : HorizontalLayout { width: root.column_sizes[idx]; - Text { overflow: elide; text: idx; } + Text { overflow: elide; text: title; } Rectangle { width: 1px; background: gray; + TouchArea { - width: 10px; + width: 5px; x: (parent.width - self.width) / 2; property cached; pointer-event(event) => { @@ -43,13 +45,38 @@ component CzkawkaTableView inherits Rectangle { } } } - ListView { - for r in root.values : HorizontalLayout { - padding: 5px; - spacing: 5px; - for t[idx] in r : HorizontalLayout { - width: root.column_sizes[idx]; - Text { overflow: elide; text: t; } + list_view:= ListView { + for r[idx] in root.values : Rectangle { + private property selected: false; + background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); + + touch_area:= TouchArea { + clicked => { + parent.selected = !parent.selected + } + } + + HorizontalLayout { + padding: 5px; + spacing: 5px; + //width: root.column_sizes[idx]; + + CheckBox { + //min-width: 200px; + width: root.column-sizes[0]; + } + + HorizontalLayout { + padding: 5px; + spacing: 5px; + for f[idx] in r : Text { + width: root.column-sizes[idx + 1]; + text: f; + vertical-alignment: center; + + overflow: elide; + } + } } } } @@ -60,7 +87,7 @@ export component MainWindow { in-out property active-tab; VerticalBox { HorizontalBox { - width: 400px; + width: 600px; preferred-height: 300px; tab_bar := VerticalLayout { @@ -76,24 +103,28 @@ export component MainWindow { } } - CzkawkaTableView { - columns: ["Device", "Mount Point", "Total", "Free"]; + // TODO - using root.active-tab in visible property will not + if root.active-tab == 0: SelectableTableView { + columns: ["Selection", "Folder Name", "Path", "Modification Date"]; values: [ - ["/dev/sda1", "/", "255GB", "82.2GB"] , - ["/dev/sda2", "/tmp", "60.5GB", "44.5GB"] , - ["/dev/sdb1", "/home", "255GB", "32.2GB"] , + ["kropkarz", "/Xd1", "24.10.2023"] , + ["witasphere", "/Xd1/Imagerren2", "25.11.1991"] , + ["lokkaler", "/Xd1/Vide2", "01.23.1911"] , ]; } } HorizontalBox { - Button { + scan_button:= Button { text: "Scan"; } - Button { + delete_button:= Button { text: "Delete"; } } } } + + + } From c753c06620453541d8cc34bbb6919c933e25fff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 17 Oct 2023 21:31:08 +0200 Subject: [PATCH 004/107] Not compilable --- Cargo.lock | 3550 ++++++++++++++++- Cargo.toml | 2 +- czkawka_slint_gui/Cargo.toml | 6 +- czkawka_slint_gui/build.rs | 3 + czkawka_slint_gui/src/main.rs | 131 +- czkawka_slint_gui/ui/main_window.slint | 49 + .../ui/selectable_tree_view.slint | 81 + 7 files changed, 3571 insertions(+), 251 deletions(-) create mode 100644 czkawka_slint_gui/build.rs create mode 100644 czkawka_slint_gui/ui/main_window.slint create mode 100644 czkawka_slint_gui/ui/selectable_tree_view.slint diff --git a/Cargo.lock b/Cargo.lock index 3f7f71c64..96f101454 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,91 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ab_glyph" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1061f3ff92c2f65800df1f12fc7b4ff44ee14783104187dd04dfee6f11b0fd2" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" + +[[package]] +name = "accesskit" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76eb1adf08c5bcaa8490b9851fd53cca27fa9880076f178ea9d29f05196728a8" + +[[package]] +name = "accesskit_consumer" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04bb4d9e4772fe0d47df57d0d5dbe5d85dd05e2f37ae1ddb6b105e76be58fb00" +dependencies = [ + "accesskit", +] + +[[package]] +name = "accesskit_macos" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134d0acf6acb667c89d3332999b1a5df4edbc8d6113910f392ebb73f2b03bb56" +dependencies = [ + "accesskit", + "accesskit_consumer", + "objc2", + "once_cell", +] + +[[package]] +name = "accesskit_unix" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e084cb5168790c0c112626175412dc5ad127083441a8248ae49ddf6725519e83" +dependencies = [ + "accesskit", + "accesskit_consumer", + "async-channel", + "atspi", + "futures-lite", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_windows" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eac0a7f2d7cd7a93b938af401d3d8e8b7094217989a7c25c55a953023436e31" +dependencies = [ + "accesskit", + "accesskit_consumer", + "arrayvec", + "once_cell", + "paste", + "windows 0.48.0", +] + +[[package]] +name = "accesskit_winit" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "825d23acee1bd6d25cbaa3ca6ed6e73faf24122a774ec33d52c5c86c6ab423c0" +dependencies = [ + "accesskit", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "winit", +] + [[package]] name = "adler" version = "1.0.2" @@ -25,6 +110,17 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "1.1.2" @@ -34,6 +130,30 @@ dependencies = [ "memchr", ] +[[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", + "ndk-context", + "ndk-sys", + "num_enum 0.6.1", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -84,7 +204,7 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -94,7 +214,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -121,17 +241,193 @@ 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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5f312b0a56c5cdf967c0aeb67f6289603354951683bc97ddc595ab974ba9aa" + +[[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-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", + "rustix 0.37.25", + "slab", + "socket2", + "waker-fn", +] + +[[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", + "async-lock", + "async-signal", + "blocking", + "cfg-if", + "event-listener 3.0.0", + "futures-lite", + "rustix 0.38.19", + "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.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2a5415b7abcdc9cd7d63d6badba5288b2ca017e3fbd4173b8f405449f1a2399" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix 0.38.19", + "signal-hook-registry", + "slab", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-task" +version = "4.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9441c6b2fe128a7c2bf680a44c34d0df31ce09e5b7e401fcca3faa483dbc921" + [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", "syn 2.0.38", ] +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "atspi" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "674e7a3376837b2e7d12d34d58ac47073c491dc3bf6f71a7adaf687d4d817faa" +dependencies = [ + "async-recursion", + "async-trait", + "atspi-macros", + "enumflags2", + "futures-lite", + "serde", + "tracing", + "zbus", + "zbus_names", +] + +[[package]] +name = "atspi-macros" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb4870a32c0eaa17e35bca0e6b16020635157121fb7d45593d242c295bc768" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "audio_checker" version = "0.1.0" @@ -141,6 +437,18 @@ dependencies = [ "symphonia", ] +[[package]] +name = "auto_enums" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4ba50b181a898ce52142184e3a46641002b3b190bf5ef827eb3c578fad4b70" +dependencies = [ + "derive_utils", + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -168,6 +476,29 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.68.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" +dependencies = [ + "bitflags 2.4.1", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.38", + "which", +] + [[package]] name = "bit_field" version = "0.10.2" @@ -182,9 +513,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "bk-tree" @@ -233,17 +564,72 @@ dependencies = [ "generic-array", ] +[[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", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys", + "objc2-encode", +] + +[[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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "by_address" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf8dba2868114ed769a1f2590fc9ae5eb331175b44313b6c9b922f8f7ca813d0" + [[package]] name = "bytemuck" version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] [[package]] name = "byteorder" @@ -278,7 +664,7 @@ version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c0466dfa8c0ee78deef390c274ad756801e0a6dbb86c5ef0924a298c5761c4d" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cairo-sys-rs", "glib", "libc", @@ -297,6 +683,35 @@ 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.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dea4bfce4c7fbd71e5bb8a7063b6cc7eed48c6d29ee9a08332a59e5d9d93e5c4" +dependencies = [ + "bitflags 1.3.2", + "io-lifetimes", + "log", + "nix 0.26.4", + "polling", + "slab", + "thiserror", +] + [[package]] name = "cbc" version = "0.1.2" @@ -312,9 +727,19 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ + "jobserver", "libc", ] +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfb" version = "0.7.3" @@ -343,12 +768,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "chrono" -version = "0.4.31" +name = "cfg_aliases" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "cgl" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" dependencies = [ - "android-tzdata", + "libc", +] + +[[package]] +name = "chrono" +version = "0.4.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", "num-traits", @@ -366,6 +806,17 @@ dependencies = [ "inout", ] +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading 0.7.4", +] + [[package]] name = "clap" version = "4.4.6" @@ -406,6 +857,84 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +[[package]] +name = "clipboard-win" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fdf5e01086b6be750428ba4a40619f847eb2e95756eee84b18e06e5f0b50342" +dependencies = [ + "lazy-bytes-cast", + "winapi", +] + +[[package]] +name = "clru" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8191fa7302e03607ff0e237d4246cc043ff5b3cb9409d995172ba3bea16b807" + +[[package]] +name = "cocoa" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" +dependencies = [ + "bitflags 1.3.2", + "block", + "cocoa-foundation", + "core-foundation", + "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", + "core-graphics 0.23.1", + "foreign-types 0.5.0", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c6234cbb2e4c785b456c0644748b1ac416dd045799740356f8363dfe00c93f7" +dependencies = [ + "bitflags 1.3.2", + "block", + "core-foundation", + "core-graphics-types", + "libc", + "objc", +] + +[[package]] +name = "codemap" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e769b5c8c8283982a987c6e948e540254f1058d5a74b8794914d4ef5fc2a24" + +[[package]] +name = "codemap-diagnostic" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc20770be05b566a963bf91505e60412c4a2d016d1ef95c5512823bb085a8122" +dependencies = [ + "codemap", + "termcolor", +] + [[package]] name = "color_quant" version = "1.1.0" @@ -418,6 +947,36 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "concurrent-queue" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "const-field-offset" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6304465f16f463cddc572b737c3df93576edd3a6b53f057bd8beeb29f4ef8dfd" +dependencies = [ + "const-field-offset-macro", + "field-offset", +] + +[[package]] +name = "const-field-offset-macro" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57aaaad9185d3bcb3afe63549d8ba60b2fb0ea8dc2da83f62dd56805edf56fd1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "const_fn" version = "0.4.9" @@ -436,12 +995,147 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "copypasta" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "133fc8675ee3a4ec9aa513584deda9aa0faeda3586b87f7f0f2ba082c66fb172" +dependencies = [ + "clipboard-win", + "objc", + "objc-foundation", + "objc_id", + "smithay-clipboard", + "x11-clipboard", +] + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-graphics-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", + "core-graphics-types", + "foreign-types 0.5.0", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "core-text" +version = "19.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" +dependencies = [ + "core-foundation", + "core-graphics 0.22.3", + "foreign-types 0.3.2", + "libc", +] + +[[package]] +name = "countme" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" + +[[package]] +name = "cpp" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa65869ef853e45c60e9828aa08cdd1398cb6e13f3911d9cb2a079b144fcd64" +dependencies = [ + "cpp_macros", +] + +[[package]] +name = "cpp_build" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e361fae2caf9758164b24da3eedd7f7d7451be30d90d8e7b5d2be29a2f0cf5b" +dependencies = [ + "cc", + "cpp_common", + "lazy_static", + "proc-macro2", + "regex", + "syn 2.0.38", + "unicode-xid", +] + +[[package]] +name = "cpp_common" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e1a2532e4ed4ea13031c13bc7bc0dbca4aae32df48e9d77f0d1e743179f2ea1" +dependencies = [ + "lazy_static", + "proc-macro2", + "syn 2.0.38", +] + +[[package]] +name = "cpp_macros" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47ec9cc90633446f779ef481a9ce5a0077107dd5b87016440448d908625a83fd" +dependencies = [ + "aho-corasick", + "byteorder", + "cpp_common", + "lazy_static", + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "cpufeatures" version = "0.2.9" @@ -460,6 +1154,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "critical-section" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" + [[package]] name = "crossbeam-channel" version = "0.5.8" @@ -490,7 +1190,7 @@ dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset", + "memoffset 0.9.0", "scopeguard", ] @@ -519,6 +1219,25 @@ dependencies = [ "typenum", ] +[[package]] +name = "css-color-parser2" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8ed1639f4b56ec6f31d007ff66ce4a13099dce5a9995d48368a30d62bf04bd" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "ctor" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" +dependencies = [ + "quote", + "syn 2.0.38", +] + [[package]] name = "czkawka_cli" version = "6.1.0" @@ -538,7 +1257,7 @@ dependencies = [ "anyhow", "audio_checker", "bincode", - "bitflags 2.4.0", + "bitflags 2.4.1", "bk-tree", "blake3", "crc32fast", @@ -606,6 +1325,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "czkawka_slint" +version = "6.1.0" +dependencies = [ + "rand", + "slint", + "slint-build", +] + [[package]] name = "darling" version = "0.14.4" @@ -654,6 +1382,12 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "data-url" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5" + [[package]] name = "datasize" version = "0.2.15" @@ -692,6 +1426,41 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", +] + +[[package]] +name = "derive_utils" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9abcad25e9720609ccb3dcdb795d845e37d8ce34183330a9f48b03a1a71c8e21" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "digest" version = "0.10.7" @@ -724,6 +1493,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + [[package]] name = "displaydoc" version = "0.2.4" @@ -735,6 +1510,15 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "dlib" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" +dependencies = [ + "libloading 0.8.1", +] + [[package]] name = "doc-comment" version = "0.3.3" @@ -742,29 +1526,114 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] -name = "either" -version = "1.9.0" +name = "downcast-rs" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] -name = "encoding_rs" -version = "0.8.33" +name = "drm" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "edf9159ef4bcecd0c5e4cbeb573b8d0037493403d542780dba5d840bbf9df56f" dependencies = [ - "cfg-if", + "bitflags 1.3.2", + "bytemuck", + "drm-ffi", + "drm-fourcc", + "nix 0.26.4", ] [[package]] -name = "enumn" -version = "0.1.12" +name = "drm-ffi" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" +checksum = "1352481b7b90e27a8a1bf8ef6b33cf18b98dba7c410e75c24bb3eef2f0d8d525" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", + "drm-sys", + "nix 0.26.4", +] + +[[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.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1369f1679d6b706d234c4c1e0613c415c2c74b598a09ad28080ba2474b72e42d" +dependencies = [ + "libc", +] + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "dwrote" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" +dependencies = [ + "lazy_static", + "libc", + "serde", + "serde_derive", + "winapi", + "wio", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", ] [[package]] @@ -780,7 +1649,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "euclid" +version = "0.22.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f253bc5c813ca05792837a0ff4b3a580336b224512d48f7eda1d7dd9210787" +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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29e56284f00d94c1bc7fd3c77027b4623c88c1f53d8d2394c6199f2921dea325" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", ] [[package]] @@ -799,6 +1694,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" @@ -834,6 +1738,27 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "femtovg" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3a2d0ff0df09856a5c1c89cc83863a1f0f994c55452186621bb57a01f270b3" +dependencies = [ + "bitflags 2.4.1", + "fnv", + "generational-arena", + "glow", + "image", + "imgref", + "lru", + "rgb", + "rustybuzz", + "unicode-bidi", + "unicode-segmentation", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "ffmpeg_cmdline_utils" version = "0.1.3" @@ -854,10 +1779,22 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" dependencies = [ - "memoffset", + "memoffset 0.9.0", "rustc_version", ] +[[package]] +name = "filetime" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.3.5", + "windows-sys 0.48.0", +] + [[package]] name = "find-crate" version = "0.6.3" @@ -883,6 +1820,12 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" + [[package]] name = "fluent" version = "0.16.0" @@ -933,7 +1876,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ - "spin", + "spin 0.9.8", ] [[package]] @@ -942,6 +1885,81 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "fontconfig-parser" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "674e258f4b5d2dcd63888c01c68413c51f565e8af99d2f7701c7b81d79ef41c4" +dependencies = [ + "roxmltree", +] + +[[package]] +name = "fontdb" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af8d8cbea8f21307d7e84bca254772981296f058a1d36b461bf4d83a7499fc9e" +dependencies = [ + "fontconfig-parser", + "log", + "memmap2 0.6.2", + "slotmap", + "tinyvec", + "ttf-parser 0.19.2", +] + +[[package]] +name = "fontdue" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0793f5137567643cf65ea42043a538804ff0fbf288649e2141442b602d81f9bc" +dependencies = [ + "hashbrown 0.13.2", + "ttf-parser 0.15.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 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", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "foreign-types-shared" +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.0" @@ -1034,6 +2052,21 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +[[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.28" @@ -1075,6 +2108,28 @@ dependencies = [ "slab", ] +[[package]] +name = "gbm" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ec389cda876966cf824111bf6e533fb934c711d473498279964a990853b3c6" +dependencies = [ + "bitflags 1.3.2", + "drm", + "drm-fourcc", + "gbm-sys", + "libc", +] + +[[package]] +name = "gbm-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63eba9b9b7a231514482deb08759301c9f9f049ac6869403f381834ebfeaf67" +dependencies = [ + "libc", +] + [[package]] name = "gdk-pixbuf" version = "0.18.0" @@ -1133,6 +2188,15 @@ dependencies = [ "system-deps", ] +[[package]] +name = "generational-arena" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877e94aff08e743b651baaea359664321055749b398adff8740a7399af7796e7" +dependencies = [ + "cfg-if", +] + [[package]] name = "generator" version = "0.7.5" @@ -1156,6 +2220,26 @@ 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", +] + +[[package]] +name = "gethostname" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb65d4ba3173c56a500b555b532f72c42e8d1fe64962b518897f8959fae2c177" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "getrandom" version = "0.2.10" @@ -1209,13 +2293,24 @@ dependencies = [ "winapi", ] +[[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 = "glib" version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c316afb01ce8067c5eaab1fc4f2cd47dc21ce7b6296358605e2ffab23ccbd19" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "futures-channel", "futures-core", "futures-executor", @@ -1271,6 +2366,82 @@ dependencies = [ "async-trait", ] +[[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 = "glutin" +version = "0.30.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc93b03242719b8ad39fb26ed2b01737144ce7bd4bfc7adadcef806596760fe" +dependencies = [ + "bitflags 1.3.2", + "cfg_aliases", + "cgl", + "core-foundation", + "dispatch", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", + "libloading 0.7.4", + "objc2", + "once_cell", + "raw-window-handle", + "wayland-sys 0.30.1", + "windows-sys 0.45.0", + "x11-dl", +] + +[[package]] +name = "glutin-winit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "629a873fc04062830bfe8f97c03773bcd7b371e23bcc465d0a61448cd1588fa4" +dependencies = [ + "cfg_aliases", + "glutin", + "raw-window-handle", + "winit", +] + +[[package]] +name = "glutin_egl_sys" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af784eb26c5a68ec85391268e074f0aa618c096eadb5d6330b0911cf34fe57c5" +dependencies = [ + "gl_generator", + "windows-sys 0.45.0", +] + +[[package]] +name = "glutin_glx_sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b53cb5fe568964aa066a3ba91eac5ecbac869fb0842cd0dc9e412434f1a1494" +dependencies = [ + "gl_generator", + "x11-dl", +] + +[[package]] +name = "glutin_wgl_sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef89398e90033fc6bc65e9bd42fd29bbbfd483bda5b56dc5562f455550618165" +dependencies = [ + "gl_generator", +] + [[package]] name = "gobject-sys" version = "0.18.0" @@ -1423,6 +2594,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.14.1" @@ -1436,14 +2616,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] -name = "hmac" -version = "0.12.1" +name = "hermit-abi" +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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "humansize" version = "2.1.3" @@ -1453,6 +2654,264 @@ dependencies = [ "libm", ] +[[package]] +name = "i-slint-backend-linuxkms" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e321d0f8d12509ec2ed5b5aba4996922606686ac3d86d70ba126cba1b4e4563" +dependencies = [ + "calloop 0.11.0", + "drm", + "gbm", + "glutin", + "i-slint-common", + "i-slint-core", + "i-slint-renderer-femtovg", + "input", + "libseat", + "nix 0.27.1", + "raw-window-handle", + "xkbcommon", +] + +[[package]] +name = "i-slint-backend-qt" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f1ce3687c329341842f79c31c95d7bcf49b6fda7fd19b09e0b5d7fb33b9d6b2" +dependencies = [ + "const-field-offset", + "cpp", + "cpp_build", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "lyon_path", + "once_cell", + "pin-project", + "pin-weak", + "qttypes", + "vtable", +] + +[[package]] +name = "i-slint-backend-selector" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7382cc01e9c9ef607debe1e4af7e1c6af78720a258fd18d8e32761b8593c5db" +dependencies = [ + "cfg-if", + "i-slint-backend-linuxkms", + "i-slint-backend-qt", + "i-slint-backend-winit", + "i-slint-core", +] + +[[package]] +name = "i-slint-backend-winit" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c0f3f01e2c678d24b81914a38e53d3b660a0ef13831acb59c71bd7c95ed0cb" +dependencies = [ + "accesskit", + "accesskit_winit", + "bytemuck", + "cfg-if", + "cfg_aliases", + "cocoa 0.24.1", + "const-field-offset", + "copypasta", + "derive_more", + "glutin", + "glutin-winit", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "i-slint-renderer-femtovg", + "i-slint-renderer-skia", + "imgref", + "instant", + "lyon_path", + "once_cell", + "pin-weak", + "raw-window-handle", + "rgb", + "scoped-tls-hkt", + "scopeguard", + "send_wrapper", + "softbuffer", + "vtable", + "wasm-bindgen", + "web-sys", + "winit", +] + +[[package]] +name = "i-slint-common" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7daf484e68bf27e06b7501767c6e66063c0f85948e57a6de679b53d2d9d2044" +dependencies = [ + "cfg-if", + "derive_more", + "fontdb", + "libloading 0.8.1", +] + +[[package]] +name = "i-slint-compiler" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b99172cc43ca17a78e96e3f8f13699d9fc1c00474d2d87bc57c0f7e816c4a48" +dependencies = [ + "by_address", + "codemap", + "codemap-diagnostic", + "css-color-parser2", + "derive_more", + "dunce", + "fontdue", + "i-slint-common", + "image", + "itertools 0.11.0", + "linked_hash_set", + "lyon_extra", + "lyon_path", + "num_enum 0.7.0", + "once_cell", + "proc-macro2", + "quote", + "resvg", + "rowan", + "smol_str", + "strum", + "thiserror", + "url", +] + +[[package]] +name = "i-slint-core" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62e590bb3d6009447a52760e9343c25a3bf7a8a7b0ad7ab5a77c5324fcaa957" +dependencies = [ + "auto_enums", + "bytemuck", + "cfg-if", + "clru", + "const-field-offset", + "derive_more", + "euclid", + "fontdue", + "i-slint-common", + "i-slint-core-macros", + "image", + "instant", + "integer-sqrt", + "lyon_algorithms", + "lyon_extra", + "lyon_geom", + "lyon_path", + "num-traits", + "once_cell", + "pin-project", + "pin-weak", + "portable-atomic", + "resvg", + "rgb", + "rustybuzz", + "scoped-tls-hkt", + "scopeguard", + "slab", + "static_assertions", + "strum", + "unicode-linebreak", + "unicode-script", + "unicode-segmentation", + "vtable", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "i-slint-core-macros" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62a416f1e9fc42c2bf1f171e5be38a8155850fcd390fce300869bcc9d6c9c117" +dependencies = [ + "quote", + "syn 2.0.38", +] + +[[package]] +name = "i-slint-renderer-femtovg" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e99a941fca00b96a7756d56e4bc5e2876283f34c693eabc73585c0b91ab84f0" +dependencies = [ + "cfg-if", + "const-field-offset", + "core-foundation", + "core-text", + "derive_more", + "dwrote", + "femtovg", + "glow", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "imgref", + "instant", + "lyon_path", + "once_cell", + "pin-weak", + "raw-window-handle", + "rgb", + "scoped-tls-hkt", + "ttf-parser 0.18.1", + "unicode-script", + "unicode-segmentation", + "vtable", + "wasm-bindgen", + "web-sys", + "winapi", +] + +[[package]] +name = "i-slint-renderer-skia" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f617268cfee53e1fa3fcab8f6ab2775deacfce74057386c4ad39ef2647f8db6" +dependencies = [ + "cfg-if", + "cfg_aliases", + "cocoa 0.24.1", + "const-field-offset", + "core-foundation", + "core-graphics-types", + "derive_more", + "foreign-types 0.3.2", + "glow", + "glutin", + "i-slint-common", + "i-slint-core", + "i-slint-core-macros", + "instant", + "lyon_path", + "metal", + "objc", + "once_cell", + "pin-weak", + "raw-window-handle", + "scoped-tls-hkt", + "skia-safe", + "unicode-segmentation", + "vtable", + "winapi", + "winit", + "wio", +] + [[package]] name = "i18n-config" version = "0.4.6" @@ -1525,16 +2984,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.48.0", + "windows-core", ] [[package]] @@ -1614,6 +3073,18 @@ dependencies = [ "serde_yaml", ] +[[package]] +name = "imagesize" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" + +[[package]] +name = "imgref" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90d944e334f00f4449c9640b440a171f816be0152305c12ef90424fc35fd035c" + [[package]] name = "indexmap" version = "1.9.3" @@ -1662,6 +3133,50 @@ dependencies = [ "generic-array", ] +[[package]] +name = "input" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e74cd82cedcd66db78742a8337bdc48f188c4d2c12742cbc5cd85113f0b059" +dependencies = [ + "bitflags 1.3.2", + "input-sys", + "io-lifetimes", + "libc", + "log", + "udev", +] + +[[package]] +name = "input-sys" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f6c2a17e8aba7217660e32863af87b0febad811d4b8620ef76b386603fddc2" +dependencies = [ + "libc", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "integer-sqrt" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "276ec31bcb4a9ee45f58bec6f9ec700ae4cf4f4f8f2fa7e06cb406bd5ffdd770" +dependencies = [ + "num-traits", +] + [[package]] name = "intl-memoizer" version = "0.5.1" @@ -1681,6 +3196,17 @@ dependencies = [ "unic-langid", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "is-docker" version = "0.2.0" @@ -1718,12 +3244,36 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + [[package]] name = "jpeg-decoder" version = "0.3.0" @@ -1742,12 +3292,39 @@ dependencies = [ "wasm-bindgen", ] +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "lazy-bytes-cast" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10257499f089cd156ad82d0a9cd57d9501fa2c989068992a97eb3c27836f206b" + [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "lebe" version = "0.5.2" @@ -1780,18 +3357,85 @@ dependencies = [ "libc", ] +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libloading" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "libm" version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libseat" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a0adf8d8607a73a5b74cbe4132f57cb349e4bf860103cd089461bbcbc9907e" +dependencies = [ + "cc", + "errno", + "libseat-sys", + "log", + "pkg-config", +] + +[[package]] +name = "libseat-sys" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3671cb5e03871f1d6bf0b3b5daa9275549e348fa6359e0f9adb910ca163d4c34" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libudev-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "linked-hash-map" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linked_hash_set" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47186c6da4d81ca383c7c47c1bfc80f4b95f4720514d860a5407aaf4233f9588" +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" @@ -1823,9 +3467,9 @@ dependencies = [ [[package]] name = "lofty" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa7a62ede7d634892901a2be8bb32f3e13d0418f276d2a391a509afe050f01b" +checksum = "c18ba58211b3c3557970755d7afc3a7438c2d4557bcd684470b2195c0ae66e53" dependencies = [ "base64", "byteorder", @@ -1870,34 +3514,125 @@ dependencies = [ ] [[package]] -name = "malloc_buf" -version = "0.0.6" +name = "lru" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] +checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" [[package]] -name = "matchers" -version = "0.1.0" +name = "lyon_algorithms" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "00a0349cd8f0270781bb93a824b63df6178e3b4a27794e7be3ce3763f5a44d6e" dependencies = [ - "regex-automata 0.1.10", + "lyon_path", + "num-traits", ] [[package]] -name = "md5" -version = "0.7.0" +name = "lyon_extra" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" +checksum = "b9ce2ae38f2480094ec1f0d5df51a75581fa84f0e8f32a0edb1d264630c99f3b" +dependencies = [ + "lyon_path", +] [[package]] -name = "memchr" -version = "2.6.4" +name = "lyon_geom" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "74df1ff0a0147282eb10699537a03baa7d31972b58984a1d44ce0624043fe8ad" +dependencies = [ + "arrayvec", + "euclid", + "num-traits", +] + +[[package]] +name = "lyon_path" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca507745ba7ccbc76e5c44e7b63b1a29d2b0d6126f375806a5bbaf657c7d6c45" +dependencies = [ + "lyon_geom", + "num-traits", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "md5" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" + +[[package]] +name = "memchr" +version = "2.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d28bba84adfe6646737845bc5ebbfa2c08424eb1c37e94a1fd2a82adb56a872" +dependencies = [ + "libc", +] + +[[package]] +name = "memmap2" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] [[package]] name = "memoffset" @@ -1908,6 +3643,20 @@ dependencies = [ "autocfg", ] +[[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 = "mime" version = "0.3.17" @@ -1924,6 +3673,12 @@ dependencies = [ "unicase", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1934,6 +3689,18 @@ dependencies = [ "simd-adler32", ] +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "multicache" version = "0.6.1" @@ -1943,6 +3710,94 @@ dependencies = [ "linked-hash-map", ] +[[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", + "num_enum 0.5.11", + "raw-window-handle", + "thiserror", +] + +[[package]] +name = "ndk-context" +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 = "nix" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.6.5", +] + +[[package]] +name = "nix" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.6.5", +] + +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "libc", + "memoffset 0.7.1", + "pin-utils", +] + +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "libc", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1999,6 +3854,70 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", + "libm", +] + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +dependencies = [ + "num_enum_derive 0.7.0", +] + +[[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", + "quote", + "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", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.38", ] [[package]] @@ -2017,6 +3936,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", + "objc_exception", ] [[package]] @@ -2030,6 +3950,41 @@ 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 = "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", +] + +[[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", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + [[package]] name = "objc_id" version = "0.1.1" @@ -2053,6 +4008,10 @@ name = "once_cell" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +dependencies = [ + "atomic-polyfill", + "critical-section", +] [[package]] name = "open" @@ -2065,12 +4024,40 @@ dependencies = [ "pathdiff", ] +[[package]] +name = "orbclient" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8378ac0dfbd4e7895f2d2c1f1345cab3836910baf3a300b000d04250f0c8428f" +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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "owned_ttf_parser" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "706de7e2214113d63a8238d1910463cfce781129a6f263d13fdb09ff64355ba4" +dependencies = [ + "ttf-parser 0.19.2", +] + [[package]] name = "pango" version = "0.18.0" @@ -2096,6 +4083,12 @@ dependencies = [ "system-deps", ] +[[package]] +name = "parking" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" + [[package]] name = "parking_lot" version = "0.12.1" @@ -2169,7 +4162,7 @@ dependencies = [ "globalcache", "inflate", "istring", - "itertools", + "itertools 0.10.5", "jpeg-decoder", "log", "md5", @@ -2192,6 +4185,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "percent-encoding" version = "2.3.0" @@ -2199,20 +4198,63 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] -name = "pin-project-lite" -version = "0.2.13" +name = "pico-args" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] -name = "pin-utils" -version = "0.1.0" +name = "pin-project" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] [[package]] -name = "pkg-config" -version = "0.3.27" +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pin-weak" +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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" @@ -2229,6 +4271,31 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "portable-atomic" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" +dependencies = [ + "critical-section", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -2241,6 +4308,16 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2", + "syn 2.0.38", +] + [[package]] name = "primal-check" version = "0.3.3" @@ -2302,6 +4379,26 @@ dependencies = [ "bytemuck", ] +[[package]] +name = "qttypes" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "116e96ef85a287acd172c5ed017ef56ee1d9e4f016558e8fc1625925f3f77468" +dependencies = [ + "cpp", + "cpp_build", + "semver", +] + +[[package]] +name = "quick-xml" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.33" @@ -2341,6 +4438,12 @@ dependencies = [ "getrandom", ] +[[package]] +name = "raw-window-handle" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" + [[package]] name = "rawloader" version = "0.37.1" @@ -2376,6 +4479,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "rctree" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f" + [[package]] name = "realfft" version = "3.3.0" @@ -2416,14 +4525,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.0" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.1", - "regex-syntax 0.8.1", + "regex-automata 0.4.3", + "regex-syntax 0.8.2", ] [[package]] @@ -2437,13 +4546,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.1", + "regex-syntax 0.8.2", ] [[package]] @@ -2454,9 +4563,69 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "resvg" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0e3d65cea36eefb28a020edb6e66341764e00cd4b426e0c1f0599b1adaa78f5" +dependencies = [ + "log", + "pico-args", + "rgb", + "svgtypes", + "tiny-skia 0.10.0", + "usvg", +] + +[[package]] +name = "rgb" +version = "0.8.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ec2d3e3fc7a92ced357df9cebd5a10b6fb2aa1ee797bf7e9ce2f17dffc8f59" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rowan" +version = "0.15.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "906057e449592587bf6724f00155bf82a6752c868d78a8fb3aa41f4e6357cfe8" +dependencies = [ + "countme", + "hashbrown 0.12.3", + "memoffset 0.9.0", + "rustc-hash", + "text-size", +] + +[[package]] +name = "roxmltree" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d84fdd47036b038fc80dd333d10b6aab10d5d31f4a366e20014def75328d33" +checksum = "862340e351ce1b271a378ec53f304a5558f7db87f3769dc655a8f6ecbb68b302" +dependencies = [ + "xmlparser", +] [[package]] name = "rubato" @@ -2566,17 +4735,53 @@ dependencies = [ "version_check", ] +[[package]] +name = "rustix" +version = "0.37.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4eb579851244c2c03e7c24f501c3432bed80b8f720af1d6e5b0e0f01555a035" +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.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys", - "windows-sys", + "linux-raw-sys 0.4.10", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustls" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +dependencies = [ + "ring", + "untrusted", ] [[package]] @@ -2595,6 +4800,22 @@ dependencies = [ "rustfft 6.1.0", ] +[[package]] +name = "rustybuzz" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162bdf42e261bee271b3957691018634488084ef577dddeb6420a9684cab2a6a" +dependencies = [ + "bitflags 1.3.2", + "bytemuck", + "smallvec", + "ttf-parser 0.18.1", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-general-category", + "unicode-script", +] + [[package]] name = "ryu" version = "1.0.15" @@ -2616,12 +4837,41 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" +[[package]] +name = "scoped-tls-hkt" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ddc765d3410d9f6c6ca071bf0b67f6b01e3ec4595dc3892f02677e75819dddc" + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "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", + "tiny-skia 0.8.4", +] + [[package]] name = "self_cell" version = "0.10.2" @@ -2634,6 +4884,12 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +[[package]] +name = "send_wrapper" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" + [[package]] name = "serde" version = "1.0.189" @@ -2665,6 +4921,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_repr" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + [[package]] name = "serde_spanned" version = "0.6.3" @@ -2717,6 +4984,21 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +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" @@ -2724,88 +5006,332 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] -name = "slab" -version = "0.4.9" +name = "simplecss" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +checksum = "a11be7c62927d9427e9f40f3444d5499d868648e2edbc4e2116de69e7ec0e89d" dependencies = [ - "autocfg", + "log", ] [[package]] -name = "smallvec" -version = "1.11.1" +name = "siphasher" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] -name = "snafu" -version = "0.7.5" +name = "skia-bindings" +version = "0.66.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" +checksum = "2a42e3db408fbe7beafeadcaf5309c59eb99cc80979cab1b49e2a47539adf8ab" dependencies = [ - "doc-comment", - "snafu-derive", + "bindgen", + "cc", + "flate2", + "heck", + "lazy_static", + "regex", + "serde_json", + "tar", + "toml 0.7.8", + "ureq", ] [[package]] -name = "snafu-derive" -version = "0.7.5" +name = "skia-safe" +version = "0.66.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" +checksum = "6d03680a0ce867756947f2d5fa92078915342f81996c43b61847fed565068f75" dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 1.0.109", + "bitflags 2.4.1", + "lazy_static", + "skia-bindings", + "winapi", + "wio", ] [[package]] -name = "spin" -version = "0.9.8" +name = "slab" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "lock_api", + "autocfg", ] [[package]] -name = "state" -version = "0.6.0" +name = "slint" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8" +checksum = "c9a6f76430dde7dc57d374c37aa3103532813cc275a94b515b5907e91dd19334" dependencies = [ - "loom", + "const-field-offset", + "i-slint-backend-selector", + "i-slint-core", + "i-slint-renderer-femtovg", + "num-traits", + "once_cell", + "pin-weak", + "slint-macros", + "vtable", ] [[package]] -name = "strength_reduce" -version = "0.2.4" +name = "slint-build" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" +checksum = "c6edc7309a89f14c685086544ea3dbd7668ccdeb03d774f06879f38237e55815" +dependencies = [ + "i-slint-compiler", + "spin_on", + "thiserror", + "toml_edit 0.19.15", +] [[package]] -name = "stringprep" -version = "0.1.4" +name = "slint-macros" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +checksum = "33f96e5ea0574ac69b773b159d43124f7a329107cf60c11516e63d38c2d8c89c" dependencies = [ - "finl_unicode", - "unicode-bidi", - "unicode-normalization", + "i-slint-compiler", + "proc-macro2", + "quote", + "spin_on", ] [[package]] -name = "strsim" -version = "0.10.0" +name = "slotmap" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +dependencies = [ + "version_check", +] [[package]] -name = "subtle" -version = "2.5.0" +name = "smallvec" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" + +[[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", + "wayland-protocols", +] + +[[package]] +name = "smithay-clipboard" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" +dependencies = [ + "smithay-client-toolkit", + "wayland-client 0.29.5", +] + +[[package]] +name = "smol_str" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" +dependencies = [ + "serde", +] + +[[package]] +name = "snafu" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" +dependencies = [ + "doc-comment", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "softbuffer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bd56fe5e6c6f1881aad2bd37acaef4ac4a3689c970dfcbd87a36a6e60210ec8" +dependencies = [ + "as-raw-xcb-connection", + "bytemuck", + "cfg_aliases", + "cocoa 0.25.0", + "core-graphics 0.23.1", + "drm", + "drm-sys", + "fastrand 2.0.1", + "foreign-types 0.5.0", + "js-sys", + "log", + "memmap2 0.7.1", + "nix 0.26.4", + "objc", + "raw-window-handle", + "redox_syscall 0.3.5", + "tiny-xlib", + "wasm-bindgen", + "wayland-backend", + "wayland-client 0.30.2", + "wayland-sys 0.30.1", + "web-sys", + "windows-sys 0.48.0", + "x11rb 0.12.0", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spin_on" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "076e103ed41b9864aa838287efe5f4e3a7a0362dd00671ae62a212e5e4612da2" +dependencies = [ + "pin-utils", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "state" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b8c4a4445d81357df8b1a650d0d0d6fbbbfe99d064aa5e02f3e4022061476d8" +dependencies = [ + "loom", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strength_reduce" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe895eb47f22e2ddd4dabc02bce419d2e643c8e3b585c78158b349195bc24d82" + +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] + +[[package]] +name = "stringprep" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +dependencies = [ + "finl_unicode", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.38", +] + +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + +[[package]] +name = "svgtypes" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed4b0611e7f3277f68c0fa18e385d9e2d26923691379690039548f867cef02a7" +dependencies = [ + "kurbo", + "siphasher", +] [[package]] name = "symphonia" @@ -3025,6 +5551,17 @@ dependencies = [ "version-compare", ] +[[package]] +name = "tar" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +dependencies = [ + "filetime", + "libc", + "xattr", +] + [[package]] name = "target-lexicon" version = "0.12.11" @@ -3038,10 +5575,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", - "fastrand", + "fastrand 2.0.1", "redox_syscall 0.3.5", - "rustix", - "windows-sys", + "rustix 0.38.19", + "windows-sys 0.48.0", ] [[package]] @@ -3053,6 +5590,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "text-size" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" + [[package]] name = "thiserror" version = "1.0.49" @@ -3125,6 +5668,69 @@ dependencies = [ "time-core", ] +[[package]] +name = "tiny-skia" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "png", + "tiny-skia-path 0.8.4", +] + +[[package]] +name = "tiny-skia" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7db11798945fa5c3e5490c794ccca7c6de86d3afdd54b4eb324109939c6f37bc" +dependencies = [ + "arrayref", + "arrayvec", + "bytemuck", + "cfg-if", + "log", + "png", + "tiny-skia-path 0.10.0", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f60aa35c89ac2687ace1a2556eaaea68e8c0d47408a2e3e7f5c98a489e7281c" +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.4" @@ -3158,6 +5764,18 @@ dependencies = [ "serde", ] +[[package]] +name = "toml" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.19.15", +] + [[package]] name = "toml" version = "0.8.2" @@ -3186,6 +5804,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.0.2", + "serde", + "serde_spanned", "toml_datetime", "winnow", ] @@ -3296,6 +5916,24 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622b09ce2fe2df4618636fb92176d205662f59803f39e70d1c333393082de96c" +[[package]] +name = "ttf-parser" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" + +[[package]] +name = "ttf-parser" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633" + +[[package]] +name = "ttf-parser" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1" + [[package]] name = "type-map" version = "0.4.0" @@ -3320,6 +5958,27 @@ dependencies = [ "const_fn", ] +[[package]] +name = "udev" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebdbbd670373442a12fe9ef7aeb53aec4147a5a27a00bbc3ab639f08f48191a" +dependencies = [ + "libc", + "libudev-sys", + "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" @@ -3355,10 +6014,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] -name = "unicode-ident" -version = "1.0.12" +name = "unicode-bidi-mirroring" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694" + +[[package]] +name = "unicode-ccc" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-normalization" @@ -3369,6 +6052,52 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-script" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d817255e1bed6dfd4ca47258685d14d2bdcfbc64fdc9e3819bd5848057b8ecc" + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode-vo" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "ureq" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3" +dependencies = [ + "base64", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-webpki", + "url", + "webpki-roots", +] + [[package]] name = "url" version = "2.4.1" @@ -3380,6 +6109,67 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "usvg" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2304b933107198a910c1f3219acb65246f2b148f862703cffd51c6e62156abe" +dependencies = [ + "base64", + "log", + "pico-args", + "usvg-parser", + "usvg-text-layout", + "usvg-tree", + "xmlwriter", +] + +[[package]] +name = "usvg-parser" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12b940fea80394e3b14cb21c83fa1b8f8a41023c25929bba68bb84a76193ebed" +dependencies = [ + "data-url", + "flate2", + "imagesize", + "kurbo", + "log", + "roxmltree", + "simplecss", + "siphasher", + "svgtypes", + "usvg-tree", +] + +[[package]] +name = "usvg-text-layout" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69dfd6119f431aa7e969b4a69f9cc8b9ae37b8ae85bb26780ccfa3beaf8b71eb" +dependencies = [ + "fontdb", + "kurbo", + "log", + "rustybuzz", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "usvg-tree", +] + +[[package]] +name = "usvg-tree" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3185eb13b6e3d3cf1817d29612251cc308d5a7e5e6235362e67efe832435c6d9" +dependencies = [ + "rctree", + "strict-num", + "svgtypes", + "tiny-skia-path 0.10.0", +] + [[package]] name = "utf8parse" version = "0.2.1" @@ -3398,6 +6188,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version-compare" version = "0.1.1" @@ -3427,6 +6223,35 @@ dependencies = [ "transpose", ] +[[package]] +name = "vtable" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f4c7506238561777a1861d3dc3c0001877c475187e7bc4392ea87ebf631fd9c" +dependencies = [ + "const-field-offset", + "portable-atomic", + "stable_deref_trait", + "vtable-macro", +] + +[[package]] +name = "vtable-macro" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b2b8eecdb8e4284adf5546fc518f048f6dc33e7203dbe36fa93a4add39b31f6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.38", +] + +[[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" @@ -3497,12 +6322,163 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[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-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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "489c9654770f674fc7e266b3c579f4053d7551df0ceb392f153adb1f9ed06ac8" +dependencies = [ + "bitflags 1.3.2", + "nix 0.26.4", + "wayland-backend", + "wayland-scanner 0.30.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-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-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-scanner" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", +] + +[[package]] +name = "wayland-scanner" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b873b257fbc32ec909c0eb80dea312076a67014e65e245f5eb69a6b8ab330e" +dependencies = [ + "proc-macro2", + "quick-xml", + "quote", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06" +dependencies = [ + "dlib", + "lazy_static", + "log", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + [[package]] name = "weezl" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix 0.38.19", +] + [[package]] name = "winapi" version = "0.3.9" @@ -3528,6 +6504,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "winapi-wsapoll" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -3549,9 +6534,51 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ + "windows-implement", + "windows-interface", "windows-targets 0.48.5", ] +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-implement" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "windows-interface" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -3675,6 +6702,41 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "winit" +version = "0.28.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" +dependencies = [ + "android-activity", + "bitflags 1.3.2", + "cfg_aliases", + "core-foundation", + "core-graphics 0.22.3", + "dispatch", + "instant", + "libc", + "log", + "mio", + "ndk", + "objc2", + "once_cell", + "orbclient", + "percent-encoding", + "raw-window-handle", + "redox_syscall 0.3.5", + "sctk-adwaita", + "smithay-client-toolkit", + "wasm-bindgen", + "wayland-client 0.29.5", + "wayland-commons", + "wayland-protocols", + "wayland-scanner 0.29.5", + "web-sys", + "windows-sys 0.45.0", + "x11-dl", +] + [[package]] name = "winnow" version = "0.5.17" @@ -3684,6 +6746,146 @@ dependencies = [ "memchr", ] +[[package]] +name = "wio" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" +dependencies = [ + "winapi", +] + +[[package]] +name = "x11-clipboard" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "980b9aa9226c3b7de8e2adb11bf20124327c054e0e5812d2aac0b5b5a87e7464" +dependencies = [ + "x11rb 0.10.1", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x11rb" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" +dependencies = [ + "gethostname 0.2.3", + "nix 0.24.3", + "winapi", + "winapi-wsapoll", + "x11rb-protocol 0.10.0", +] + +[[package]] +name = "x11rb" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" +dependencies = [ + "as-raw-xcb-connection", + "gethostname 0.3.0", + "libc", + "libloading 0.7.4", + "nix 0.26.4", + "once_cell", + "winapi", + "winapi-wsapoll", + "x11rb-protocol 0.12.0", +] + +[[package]] +name = "x11rb-protocol" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67" +dependencies = [ + "nix 0.24.3", +] + +[[package]] +name = "x11rb-protocol" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d6c3f9a0fb6701fab8f6cea9b0c0bd5d6876f1f89f7fada07e558077c344bc" +dependencies = [ + "nix 0.26.4", +] + +[[package]] +name = "xattr" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +dependencies = [ + "libc", +] + +[[package]] +name = "xcursor" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" +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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c286371c44b3572d19b09196c129a8fff47d7704d6494daefb44fec10f0278ab" +dependencies = [ + "libc", + "memmap2 0.7.1", + "xkeysym", +] + +[[package]] +name = "xkeysym" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "054a8e68b76250b253f671d1268cb7f1ae089ec35e195b2efb2a4e9a836d0621" + +[[package]] +name = "xml-rs" +version = "0.8.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" + +[[package]] +name = "xmlparser" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" + +[[package]] +name = "xmlwriter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" + [[package]] name = "xxhash-rust" version = "0.8.7" @@ -3699,6 +6901,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", + "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", + "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 = "zip" version = "0.6.6" @@ -3726,3 +6994,41 @@ 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", + "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", + "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/Cargo.toml b/Cargo.toml index b0946f48a..6a485d609 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,10 +3,10 @@ members = [ "czkawka_core", "czkawka_cli", "czkawka_gui", + "czkawka_slint_gui" ] exclude = [ "ci_tester", - "czkawka_slint_gui" ] resolver = "2" diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index 4123b97dc..815bafd94 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -8,7 +8,11 @@ description = "Slint frontend of Czkawka" license = "GPL-3" homepage = "https://github.com/qarmin/czkawka" repository = "https://github.com/qarmin/czkawka" +build = "build.rs" [dependencies] slint = "1.2.2" -rand = "0.8.5" \ No newline at end of file +rand = "0.8.5" + +[dev-dependencies] +slint-build = "1.2.2" \ No newline at end of file diff --git a/czkawka_slint_gui/build.rs b/czkawka_slint_gui/build.rs new file mode 100644 index 000000000..2f05231bb --- /dev/null +++ b/czkawka_slint_gui/build.rs @@ -0,0 +1,3 @@ +fn main() { + slint_build::compile("ui/main_window.slint").unwrap(); +} diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 0b2fc3f16..beda760b4 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,130 +1,7 @@ -fn main() {} +slint::include_modules!(); -slint::slint! { -import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; - -component SelectableTableView inherits Rectangle { - in property <[string]> columns; - in property <[[string]]> values; - - private property <[length]> column_sizes: [30px, 100px, 100px, 100px]; - private property column_number: 4; - - VerticalBox { - padding: 5px; - // Widgets - HorizontalLayout { - padding: 5px; spacing: 5px; - vertical-stretch: 0; - for title[idx] in root.columns : HorizontalLayout { - width: root.column_sizes[idx]; - Text { overflow: elide; text: title; } - Rectangle { - width: 1px; - background: gray; - - TouchArea { - width: 5px; - x: (parent.width - self.width) / 2; - property cached; - pointer-event(event) => { - if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) { - self.cached = root.column_sizes[idx]; - } - } - moved => { - if (self.pressed) { - root.column_sizes[idx] += (self.mouse-x - self.pressed-x); - if (root.column_sizes[idx] < 0) { - root.column_sizes[idx] = 0; - } - } - } - mouse-cursor: ew-resize; - } - } - } - } - list_view:= ListView { - for r[idx] in root.values : Rectangle { - private property selected: false; - background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); - - touch_area:= TouchArea { - clicked => { - parent.selected = !parent.selected - } - } - - HorizontalLayout { - padding: 5px; - spacing: 5px; - //width: root.column_sizes[idx]; - - CheckBox { - //min-width: 200px; - width: root.column-sizes[0]; - } - - HorizontalLayout { - padding: 5px; - spacing: 5px; - for f[idx] in r : Text { - width: root.column-sizes[idx + 1]; - text: f; - vertical-alignment: center; - - overflow: elide; - } - } - } - } - } - } +fn main() { + MainWindow::new().unwrap().run().unwrap(); } -export component MainWindow { - in-out property active-tab; - VerticalBox { - HorizontalBox { - width: 600px; - preferred-height: 300px; - - tab_bar := VerticalLayout { - width: 120px; - spacing: 3px; - Button { - text: "Empty Folders"; - clicked => { root.active-tab = 0; } - } - Button { - text: "Similar Images"; - clicked => { root.active-tab = 1; } - } - } - - // TODO - using root.active-tab in visible property will not - if root.active-tab == 0: SelectableTableView { - columns: ["Selection", "Folder Name", "Path", "Modification Date"]; - values: [ - ["kropkarz", "/Xd1", "24.10.2023"] , - ["witasphere", "/Xd1/Imagerren2", "25.11.1991"] , - ["lokkaler", "/Xd1/Vide2", "01.23.1911"] , - ]; - } - } - HorizontalBox { - scan_button:= Button { - text: "Scan"; - } - delete_button:= Button { - text: "Delete"; - } - } - } -} - - - - -} +slint::slint! {} diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint new file mode 100644 index 000000000..68696fe0b --- /dev/null +++ b/czkawka_slint_gui/ui/main_window.slint @@ -0,0 +1,49 @@ +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; +import {SelectableTableView} from "selectable_tree_view.slint"; + +enum CurrentTab { + EmptyFolders, + SimilarImages, +} + +export component MainWindow { + in-out property active-tab; + VerticalBox { + HorizontalBox { + width: 600px; + preferred-height: 300px; + + tab_bar := VerticalLayout { + width: 120px; + spacing: 3px; + Button { + text: "Empty Folders"; + clicked => { root.active-tab = CurrentTab.EmptyFolders; } + } + Button { + text: "Similar Images"; + clicked => { root.active-tab = CurrentTab.SimilarImages; } + } + } + + // TODO - using root.active-tab in visible property will not + if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { + columns: ["Selection", "Folder Name", "Path", "Modification Date"]; + values: [ + ["kropkarz", "/Xd1", "24.10.2023"] , + ["witasphere", "/Xd1/Imagerren2", "25.11.1991"] , + ["lokkaler", "/Xd1/Vide2", "01.23.1911"] , + ]; + } + } + HorizontalBox { + scan_button:= Button { + text: "Scan"; + } + delete_button:= Button { + text: "Delete"; + } + } + } +} + diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint new file mode 100644 index 000000000..234a476c2 --- /dev/null +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -0,0 +1,81 @@ +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; + +export component SelectableTableView inherits Rectangle { + in property <[string]> columns; + in property <[[string]]> values; + + private property <[length]> column_sizes: [30px, 100px, 100px, 100px]; + private property column_number: 4; + + VerticalBox { + padding: 5px; + // Widgets + HorizontalLayout { + padding: 5px; spacing: 5px; + vertical-stretch: 0; + for title[idx] in root.columns : HorizontalLayout { + width: root.column_sizes[idx]; + Text { overflow: elide; text: title; } + Rectangle { + width: 1px; + background: gray; + + TouchArea { + width: 5px; + x: (parent.width - self.width) / 2; + property cached; + pointer-event(event) => { + if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) { + self.cached = root.column_sizes[idx]; + } + } + moved => { + if (self.pressed) { + root.column_sizes[idx] += (self.mouse-x - self.pressed-x); + if (root.column_sizes[idx] < 0) { + root.column_sizes[idx] = 0; + } + } + } + mouse-cursor: ew-resize; + } + } + } + } + list_view:= ListView { + for r[idx] in root.values : Rectangle { + private property selected: false; + background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); + + touch_area:= TouchArea { + clicked => { + parent.selected = !parent.selected + } + } + + HorizontalLayout { + padding: 5px; + spacing: 5px; + //width: root.column_sizes[idx]; + + CheckBox { + //min-width: 200px; + width: root.column-sizes[0]; + } + + HorizontalLayout { + padding: 5px; + spacing: 5px; + for f[idx] in r : Text { + width: root.column-sizes[idx + 1]; + text: f; + vertical-alignment: center; + + overflow: elide; + } + } + } + } + } + } +} \ No newline at end of file From 98590adbd1c19e0228f929513c4cbf69b5703531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 19 Oct 2023 09:32:37 +0200 Subject: [PATCH 005/107] AB --- czkawka_slint_gui/Cargo.toml | 3 ++- czkawka_slint_gui/src/main.rs | 20 ++++++++++++++++--- czkawka_slint_gui/ui/main_window.slint | 17 ++++++++++------ .../ui/selectable_tree_view.slint | 11 ++++++---- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index 815bafd94..e7b8978ac 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -13,6 +13,7 @@ build = "build.rs" [dependencies] slint = "1.2.2" rand = "0.8.5" +#czkawka_core = { version = "6.1.0", path = "../czkawka_core" } -[dev-dependencies] +[build-dependencies] slint-build = "1.2.2" \ No newline at end of file diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index beda760b4..996fba97b 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,7 +1,21 @@ +use std::rc::Rc; +use slint::{Model, ModelRc, SharedString, StandardListViewItem, VecModel}; slint::include_modules!(); fn main() { - MainWindow::new().unwrap().run().unwrap(); -} + let app = MainWindow::new().unwrap();//.run().unwrap(); + let row_data: Rc>> = Rc::new(VecModel::default()); -slint::slint! {} + for r in 0..10000000 { + let items = VecModel::default(); + + for c in 0..3 { + items.push(slint::format!("Item {r}.{c}").into()); + } + + row_data.push(ModelRc::new(items)); + } + app.set_empty_folder_model(row_data.into()); + + app.run().unwrap(); +} \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 68696fe0b..0b5fcad11 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -8,9 +8,16 @@ enum CurrentTab { export component MainWindow { in-out property active-tab; + in-out property <[[string]]> empty-folder-model: [ + ["kropkarz", "/Xd1", "24.10.2023"] , + ["witasphere", "/Xd1/Imagerren2", "25.11.1991"] , + ["lokkaler", "/Xd1/Vide2", "01.23.1911"] , +]; + + min-width: 200px; VerticalBox { HorizontalBox { - width: 600px; + // min-width: 600px; preferred-height: 300px; tab_bar := VerticalLayout { @@ -28,12 +35,10 @@ export component MainWindow { // TODO - using root.active-tab in visible property will not if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { + min-width: 200px; + columns: ["Selection", "Folder Name", "Path", "Modification Date"]; - values: [ - ["kropkarz", "/Xd1", "24.10.2023"] , - ["witasphere", "/Xd1/Imagerren2", "25.11.1991"] , - ["lokkaler", "/Xd1/Vide2", "01.23.1911"] , - ]; + values: empty-folder-model; } } HorizontalBox { diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 234a476c2..3134924e4 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -11,7 +11,8 @@ export component SelectableTableView inherits Rectangle { padding: 5px; // Widgets HorizontalLayout { - padding: 5px; spacing: 5px; + padding: 5px; + spacing: 5px; vertical-stretch: 0; for title[idx] in root.columns : HorizontalLayout { width: root.column_sizes[idx]; @@ -32,8 +33,8 @@ export component SelectableTableView inherits Rectangle { moved => { if (self.pressed) { root.column_sizes[idx] += (self.mouse-x - self.pressed-x); - if (root.column_sizes[idx] < 0) { - root.column_sizes[idx] = 0; + if (root.column_sizes[idx] < 20px) { + root.column_sizes[idx] = 20px; } } } @@ -45,7 +46,8 @@ export component SelectableTableView inherits Rectangle { list_view:= ListView { for r[idx] in root.values : Rectangle { private property selected: false; - background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); + background: touch-area.has-hover ? (selected ? #cccccc : #dddddd) : (selected ? #cccccc: #dddddd); + // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); touch_area:= TouchArea { clicked => { @@ -61,6 +63,7 @@ export component SelectableTableView inherits Rectangle { CheckBox { //min-width: 200px; width: root.column-sizes[0]; + // preferred-width: root.column-sizes[0]; } HorizontalLayout { From ac636dfdada7f0016fd5f4503f374a85155f0227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 19 Oct 2023 21:39:48 +0200 Subject: [PATCH 006/107] Updated --- czkawka_slint_gui/Cargo.toml | 5 +-- czkawka_slint_gui/src/main.rs | 33 ++++++++++++++++--- czkawka_slint_gui/ui/main_window.slint | 12 ++++--- .../ui/selectable_tree_view.slint | 13 +++++--- 4 files changed, 48 insertions(+), 15 deletions(-) diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index e7b8978ac..fe3ee6404 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -11,9 +11,10 @@ repository = "https://github.com/qarmin/czkawka" build = "build.rs" [dependencies] -slint = "1.2.2" +#slint = "1.2.2" +slint = { git = "https://github.com/slint-ui/slint.git", branch = "olivier/fix-3700"} rand = "0.8.5" #czkawka_core = { version = "6.1.0", path = "../czkawka_core" } [build-dependencies] -slint-build = "1.2.2" \ No newline at end of file +slint-build = { git = "https://github.com/slint-ui/slint.git", branch = "olivier/fix-3700"} \ No newline at end of file diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 996fba97b..6a95264f3 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,21 +1,46 @@ use std::rc::Rc; -use slint::{Model, ModelRc, SharedString, StandardListViewItem, VecModel}; +use slint::{Model, ModelRc, SharedString, VecModel}; slint::include_modules!(); +use std::borrow::BorrowMut; fn main() { let app = MainWindow::new().unwrap();//.run().unwrap(); - let row_data: Rc>> = Rc::new(VecModel::default()); + let row_data: Rc)>> = Rc::new(VecModel::default()); - for r in 0..10000000 { + for r in 0..1000 { let items = VecModel::default(); for c in 0..3 { items.push(slint::format!("Item {r}.{c}").into()); } - row_data.push(ModelRc::new(items)); + row_data.push((r % 2 == 0, r% 3 == 0, ModelRc::new(items))); } app.set_empty_folder_model(row_data.into()); + let a = app.as_weak(); + app.on_deleted(move || { + let app = a.upgrade().unwrap(); + + + let mut r = app.get_empty_folder_model(); + let m = r.borrow_mut(); + let length_before = m.iter().count(); + let mut s: Vec<_> = m.iter().filter(|(a,_b,_c)|{ + !*a + }).collect(); + + + let length_after = s.len(); + if length_before != length_after { + dbg!(format!("Items to remove {}", length_before - length_after)); + s.iter_mut().for_each(|(_a, selected_row, _)|{ + *selected_row = false; + }); + let r = ModelRc::new(VecModel::from(s)); + app.set_empty_folder_model(r.into()); + } + }); + app.run().unwrap(); } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 0b5fcad11..7640d4ddf 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -7,11 +7,12 @@ enum CurrentTab { } export component MainWindow { + callback deleted; in-out property active-tab; - in-out property <[[string]]> empty-folder-model: [ - ["kropkarz", "/Xd1", "24.10.2023"] , - ["witasphere", "/Xd1/Imagerren2", "25.11.1991"] , - ["lokkaler", "/Xd1/Vide2", "01.23.1911"] , + in-out property <[{checked: bool, selected_row: bool, val:[string]}]> empty-folder-model: [ + {checked: false, selected_row: false, val: ["kropkarz", "/Xd1", "24.10.2023"]} , + {checked: false, selected_row: true, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: true, selected_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} , ]; min-width: 200px; @@ -47,6 +48,9 @@ export component MainWindow { } delete_button:= Button { text: "Delete"; + clicked => { + root.deleted(); + } } } } diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 3134924e4..9e1c0061f 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -2,7 +2,7 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV export component SelectableTableView inherits Rectangle { in property <[string]> columns; - in property <[[string]]> values; + in property <[{checked: bool, selected_row: bool, val:[string]}]> values; private property <[length]> column_sizes: [30px, 100px, 100px, 100px]; private property column_number: 4; @@ -45,13 +45,12 @@ export component SelectableTableView inherits Rectangle { } list_view:= ListView { for r[idx] in root.values : Rectangle { - private property selected: false; - background: touch-area.has-hover ? (selected ? #cccccc : #dddddd) : (selected ? #cccccc: #dddddd); + background: touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd); // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); touch_area:= TouchArea { clicked => { - parent.selected = !parent.selected + r.selected_row = !r.selected_row } } @@ -62,14 +61,18 @@ export component SelectableTableView inherits Rectangle { CheckBox { //min-width: 200px; + checked: r.checked; width: root.column-sizes[0]; + toggled => { + r.checked = self.checked; + } // preferred-width: root.column-sizes[0]; } HorizontalLayout { padding: 5px; spacing: 5px; - for f[idx] in r : Text { + for f[idx] in r.val : Text { width: root.column-sizes[idx + 1]; text: f; vertical-alignment: center; From 19f0be721fe3c0f705e56a1aa8944b7efc35e0bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 21 Oct 2023 08:36:56 +0200 Subject: [PATCH 007/107] Header row --- Cargo.lock | 91 +++++++------------ czkawka_slint_gui/Cargo.toml | 3 +- czkawka_slint_gui/src/connect_delete.rs | 30 ++++++ czkawka_slint_gui/src/connect_scan.rs | 54 +++++++++++ czkawka_slint_gui/src/main.rs | 57 ++++++------ czkawka_slint_gui/ui/main_window.slint | 64 ++++++++----- .../ui/selectable_tree_view.slint | 12 ++- 7 files changed, 194 insertions(+), 117 deletions(-) create mode 100644 czkawka_slint_gui/src/connect_delete.rs create mode 100644 czkawka_slint_gui/src/connect_scan.rs diff --git a/Cargo.lock b/Cargo.lock index 96f101454..dc8885470 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -959,8 +959,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6304465f16f463cddc572b737c3df93576edd3a6b53f057bd8beeb29f4ef8dfd" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "const-field-offset-macro", "field-offset", @@ -969,8 +968,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57aaaad9185d3bcb3afe63549d8ba60b2fb0ea8dc2da83f62dd56805edf56fd1" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "proc-macro2", "quote", @@ -1329,6 +1327,8 @@ dependencies = [ name = "czkawka_slint" version = "6.1.0" dependencies = [ + "chrono", + "czkawka_core", "rand", "slint", "slint-build", @@ -1569,12 +1569,6 @@ dependencies = [ "libc", ] -[[package]] -name = "dunce" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" - [[package]] name = "dwrote" version = "0.11.0" @@ -2656,9 +2650,8 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e321d0f8d12509ec2ed5b5aba4996922606686ac3d86d70ba126cba1b4e4563" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "calloop 0.11.0", "drm", @@ -2676,9 +2669,8 @@ dependencies = [ [[package]] name = "i-slint-backend-qt" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1ce3687c329341842f79c31c95d7bcf49b6fda7fd19b09e0b5d7fb33b9d6b2" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "const-field-offset", "cpp", @@ -2696,22 +2688,21 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7382cc01e9c9ef607debe1e4af7e1c6af78720a258fd18d8e32761b8593c5db" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", "i-slint-backend-qt", "i-slint-backend-winit", + "i-slint-common", "i-slint-core", ] [[package]] name = "i-slint-backend-winit" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c0f3f01e2c678d24b81914a38e53d3b660a0ef13831acb59c71bd7c95ed0cb" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "accesskit", "accesskit_winit", @@ -2748,9 +2739,8 @@ dependencies = [ [[package]] name = "i-slint-common" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daf484e68bf27e06b7501767c6e66063c0f85948e57a6de679b53d2d9d2044" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "cfg-if", "derive_more", @@ -2760,16 +2750,14 @@ dependencies = [ [[package]] name = "i-slint-compiler" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b99172cc43ca17a78e96e3f8f13699d9fc1c00474d2d87bc57c0f7e816c4a48" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "by_address", "codemap", "codemap-diagnostic", "css-color-parser2", "derive_more", - "dunce", "fontdue", "i-slint-common", "image", @@ -2791,9 +2779,8 @@ dependencies = [ [[package]] name = "i-slint-core" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62e590bb3d6009447a52760e9343c25a3bf7a8a7b0ad7ab5a77c5324fcaa957" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "auto_enums", "bytemuck", @@ -2835,9 +2822,8 @@ dependencies = [ [[package]] name = "i-slint-core-macros" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a416f1e9fc42c2bf1f171e5be38a8155850fcd390fce300869bcc9d6c9c117" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "quote", "syn 2.0.38", @@ -2845,9 +2831,8 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99a941fca00b96a7756d56e4bc5e2876283f34c693eabc73585c0b91ab84f0" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "cfg-if", "const-field-offset", @@ -2879,9 +2864,8 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f617268cfee53e1fa3fcab8f6ab2775deacfce74057386c4ad39ef2647f8db6" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "cfg-if", "cfg_aliases", @@ -3389,11 +3373,9 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54a0adf8d8607a73a5b74cbe4132f57cb349e4bf860103cd089461bbcbc9907e" dependencies = [ - "cc", "errno", "libseat-sys", "log", - "pkg-config", ] [[package]] @@ -5062,9 +5044,8 @@ dependencies = [ [[package]] name = "slint" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a6f76430dde7dc57d374c37aa3103532813cc275a94b515b5907e91dd19334" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5079,21 +5060,19 @@ dependencies = [ [[package]] name = "slint-build" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6edc7309a89f14c685086544ea3dbd7668ccdeb03d774f06879f38237e55815" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "i-slint-compiler", "spin_on", "thiserror", - "toml_edit 0.19.15", + "toml_edit 0.20.2", ] [[package]] name = "slint-macros" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33f96e5ea0574ac69b773b159d43124f7a329107cf60c11516e63d38c2d8c89c" +version = "1.3.0" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -6226,8 +6205,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f4c7506238561777a1861d3dc3c0001877c475187e7bc4392ea87ebf631fd9c" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "const-field-offset", "portable-atomic", @@ -6238,8 +6216,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2b8eecdb8e4284adf5546fc518f048f6dc33e7203dbe36fa93a4add39b31f6" +source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" dependencies = [ "proc-macro2", "quote", diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index fe3ee6404..c47e9465d 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -14,7 +14,8 @@ build = "build.rs" #slint = "1.2.2" slint = { git = "https://github.com/slint-ui/slint.git", branch = "olivier/fix-3700"} rand = "0.8.5" -#czkawka_core = { version = "6.1.0", path = "../czkawka_core" } +czkawka_core = { version = "6.1.0", path = "../czkawka_core" } +chrono = "0.4.31" [build-dependencies] slint-build = { git = "https://github.com/slint-ui/slint.git", branch = "olivier/fix-3700"} \ No newline at end of file diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs new file mode 100644 index 000000000..cb3af34c9 --- /dev/null +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -0,0 +1,30 @@ +use crate::MainWindow; +use slint::{ComponentHandle, Model, ModelRc, VecModel}; +use std::borrow::BorrowMut; + +pub fn connect_delete_button(app: &MainWindow) { + let a = app.as_weak(); + app.on_deleted(move || { + let app = a.upgrade().unwrap(); + + let mut r = app.get_empty_folder_model(); + let m = r.borrow_mut(); + let length_before = m.iter().count(); + let (entries_to_delete, entries_left): (Vec<_>, Vec<_>) = m.iter().partition(|(checked, _selected_row, _header_row, _data)| *checked); + let mut s: Vec<_> = m.iter().filter(|(checked, _selected_row, _header_row, _data)| !*checked).collect(); + + entries_to_delete.into_iter().for_each(|(_checked, _selected_row, _header_row, _data)| { + // TODO delete in parallel items, consider to add progress bar + }); + + let length_after = s.len(); + if length_before != length_after { + dbg!(format!("Items to remove {}", length_before - length_after)); + s.iter_mut().for_each(|(_checked, selected_row, _header_row, _data)| { + *selected_row = false; + }); + let r = ModelRc::new(VecModel::from(s)); + app.set_empty_folder_model(r.into()); + } + }); +} diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs new file mode 100644 index 000000000..35c8335b0 --- /dev/null +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -0,0 +1,54 @@ +use crate::{split_path, CurrentTab, MainWindow}; +use chrono::NaiveDateTime; +use czkawka_core::common_tool::CommonData; +use czkawka_core::empty_folder::EmptyFolder; +use slint::{ComponentHandle, ModelRc, SharedString, VecModel}; +use std::path::PathBuf; +use std::rc::Rc; +use std::thread; + +pub fn connect_scan_button(app: &MainWindow) { + let a = app.as_weak(); + app.on_scanned(move |active_tab| { + let app = a.upgrade().unwrap(); + app.set_scanning(true); + + let a = app.as_weak(); + match active_tab { + CurrentTab::EmptyFolders => { + thread::spawn(move || { + let mut ef = EmptyFolder::new(); + ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); + ef.find_empty_folders(None, None); + + ef.get_empty_folder_list(); + + let mut vector = ef.get_empty_folder_list().keys().cloned().collect::>(); + + vector.sort_unstable_by_key(|e| { + let t = split_path(e.as_path()); + (t.0, t.1) + }); + + a.upgrade_in_event_loop(move |app| { + let mut folder_map = ef.get_empty_folder_list(); + let items = Rc::new(VecModel::default()); + for path in vector { + let (directory, file) = split_path(&path); + let data_model = VecModel::from_slice(&[ + SharedString::from(file), + SharedString::from(directory), + SharedString::from(NaiveDateTime::from_timestamp_opt(folder_map[&path].modified_date as i64, 0).unwrap().to_string()), + ]); + + items.push((false, false, false, ModelRc::new(data_model))); + } + app.set_empty_folder_model(items.into()); + app.set_scanning(false); + }) + }); + } + _ => panic!(), + } + }); +} diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 6a95264f3..198180215 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,11 +1,21 @@ +mod connect_delete; +mod connect_scan; + +use std::borrow::BorrowMut; +use std::path::Path; use std::rc::Rc; + +use crate::connect_delete::connect_delete_button; +use crate::connect_scan::connect_scan_button; + +use czkawka_core::common_tool::CommonData; +use czkawka_core::empty_folder::EmptyFolder; use slint::{Model, ModelRc, SharedString, VecModel}; -slint::include_modules!(); -use std::borrow::BorrowMut; +slint::include_modules!(); fn main() { - let app = MainWindow::new().unwrap();//.run().unwrap(); - let row_data: Rc)>> = Rc::new(VecModel::default()); + let app = MainWindow::new().unwrap(); //.run().unwrap(); + let row_data: Rc)>> = Rc::new(VecModel::default()); for r in 0..1000 { let items = VecModel::default(); @@ -14,33 +24,20 @@ fn main() { items.push(slint::format!("Item {r}.{c}").into()); } - row_data.push((r % 2 == 0, r% 3 == 0, ModelRc::new(items))); + row_data.push((r % 4 == 0, r % 3 == 0, r % 2 == 0, ModelRc::new(items))); } - app.set_empty_folder_model(row_data.into()); + // app.set_empty_folder_model(row_data.into()); - let a = app.as_weak(); - app.on_deleted(move || { - let app = a.upgrade().unwrap(); - - - let mut r = app.get_empty_folder_model(); - let m = r.borrow_mut(); - let length_before = m.iter().count(); - let mut s: Vec<_> = m.iter().filter(|(a,_b,_c)|{ - !*a - }).collect(); - - - let length_after = s.len(); - if length_before != length_after { - dbg!(format!("Items to remove {}", length_before - length_after)); - s.iter_mut().for_each(|(_a, selected_row, _)|{ - *selected_row = false; - }); - let r = ModelRc::new(VecModel::from(s)); - app.set_empty_folder_model(r.into()); - } - }); + connect_delete_button(&app); + connect_scan_button(&app); app.run().unwrap(); -} \ No newline at end of file +} + +pub fn split_path(path: &Path) -> (String, String) { + match (path.parent(), path.file_name()) { + (Some(dir), Some(file)) => (dir.display().to_string(), file.to_string_lossy().into_owned()), + (Some(dir), None) => (dir.display().to_string(), String::new()), + (None, _) => (String::new(), String::new()), + } +} diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 7640d4ddf..daf35f21f 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -1,19 +1,24 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; import {SelectableTableView} from "selectable_tree_view.slint"; +import {LeftSidePanel} from "left_side_panel.slint"; +import {CurrentTab} from "common.slint"; -enum CurrentTab { - EmptyFolders, - SimilarImages, -} - -export component MainWindow { +export component MainWindow inherits Window { callback deleted; - in-out property active-tab; - in-out property <[{checked: bool, selected_row: bool, val:[string]}]> empty-folder-model: [ - {checked: false, selected_row: false, val: ["kropkarz", "/Xd1", "24.10.2023"]} , - {checked: false, selected_row: true, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: true, selected_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} , -]; + callback scanned(CurrentTab); + + in-out property scanning: false; + + in-out property active-tab: CurrentTab.EmptyFolders; + in-out property <[{checked: bool, selected_row: bool, header_row: bool, val:[string]}]> empty_folder_model: [ + {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , + {checked: false, selected_row: true, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} + ]; + in-out property <[{checked: bool, selected_row: bool, header_row: bool, val:[string]}]> empty_files_model: []; + in-out property <[{checked: bool, selected_row: bool, header_row: bool, val:[string]}]> similar_images_model: []; + + title: root.active-tab == CurrentTab.EmptyFiles ? "EmptyFiles" : (root.active-tab == CurrentTab.EmptyFolders ? "EmptyFolders" : "Similar Images"); min-width: 200px; VerticalBox { @@ -21,32 +26,42 @@ export component MainWindow { // min-width: 600px; preferred-height: 300px; - tab_bar := VerticalLayout { - width: 120px; - spacing: 3px; - Button { - text: "Empty Folders"; - clicked => { root.active-tab = CurrentTab.EmptyFolders; } - } - Button { - text: "Similar Images"; - clicked => { root.active-tab = CurrentTab.SimilarImages; } - } + LeftSidePanel { + scanning: root.scanning; + active-tab <=> root.active-tab; } - // TODO - using root.active-tab in visible property will not + // TODO - using root.active-tab in visible property will not clear model if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { min-width: 200px; columns: ["Selection", "Folder Name", "Path", "Modification Date"]; values: empty-folder-model; } + if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { + min-width: 200px; + + columns: ["Selection", "Folder Name", "Path", "Modification Date"]; + values: empty-files-model; + } + if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { + min-width: 200px; + + columns: ["Selection", "Folder Name", "Path", "Modification Date"]; + values: similar-images-model; + } } HorizontalBox { + height: 50px; scan_button:= Button { + enabled: !scanning; text: "Scan"; + clicked => { + root.scanned(active-tab); + } } delete_button:= Button { + enabled: !scanning; text: "Delete"; clicked => { root.deleted(); @@ -55,4 +70,3 @@ export component MainWindow { } } } - diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 9e1c0061f..777b1c9dd 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -2,7 +2,7 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV export component SelectableTableView inherits Rectangle { in property <[string]> columns; - in property <[{checked: bool, selected_row: bool, val:[string]}]> values; + in property <[{checked: bool, selected_row: bool, header_row: bool, val:[string]}]> values; private property <[length]> column_sizes: [30px, 100px, 100px, 100px]; private property column_number: 4; @@ -44,13 +44,16 @@ export component SelectableTableView inherits Rectangle { } } list_view:= ListView { + min-width: 100px; for r[idx] in root.values : Rectangle { - background: touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd); + background: r.header-row ? #888888 : (touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd)); // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); touch_area:= TouchArea { clicked => { - r.selected_row = !r.selected_row + if (!r.header_row) { + r.selected_row = !r.selected_row + } } } @@ -61,7 +64,8 @@ export component SelectableTableView inherits Rectangle { CheckBox { //min-width: 200px; - checked: r.checked; + visible: !r.header-row; + checked: r.checked && !r.header-row; width: root.column-sizes[0]; toggled => { r.checked = self.checked; From 0c3dd22b0eddc8c5454b7a6d7036af1d3ff69b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 21 Oct 2023 10:01:22 +0200 Subject: [PATCH 008/107] Missing --- czkawka_slint_gui/ui/common.slint | 5 +++ czkawka_slint_gui/ui/left_side_panel.slint | 44 ++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 czkawka_slint_gui/ui/common.slint create mode 100644 czkawka_slint_gui/ui/left_side_panel.slint diff --git a/czkawka_slint_gui/ui/common.slint b/czkawka_slint_gui/ui/common.slint new file mode 100644 index 000000000..20f9cabda --- /dev/null +++ b/czkawka_slint_gui/ui/common.slint @@ -0,0 +1,5 @@ +export enum CurrentTab { + EmptyFolders, + EmptyFiles, + SimilarImages, +} \ No newline at end of file diff --git a/czkawka_slint_gui/ui/left_side_panel.slint b/czkawka_slint_gui/ui/left_side_panel.slint new file mode 100644 index 000000000..b3bdef09a --- /dev/null +++ b/czkawka_slint_gui/ui/left_side_panel.slint @@ -0,0 +1,44 @@ +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; +import {CurrentTab} from "common.slint"; + +component TabItem { + in property scanning; + in-out property active-tab; + in property text; + in property curr_tab; + + Button { + enabled: !scanning; + text: root.text; + clicked => { root.active-tab = root.curr-tab; } + } +} + +export component LeftSidePanel { + in-out property active-tab; + in-out property scanning; + + VerticalLayout { + width: 120px; + spacing: 3px; + + TabItem { + scanning: scanning; + text: "Empty Folders"; + active-tab <=> root.active-tab; + curr_tab: CurrentTab.EmptyFolders; + } + TabItem { + scanning: scanning; + text: "Empty Files"; + active-tab <=> root.active-tab; + curr_tab: CurrentTab.EmptyFiles; + } + TabItem { + scanning: scanning; + text: "Similar Images"; + active-tab <=> root.active-tab; + curr_tab: CurrentTab.SimilarImages; + } + } +} \ No newline at end of file From 0f56ca018775414e75f019adf95dfc125764efc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 21 Oct 2023 15:13:27 +0200 Subject: [PATCH 009/107] Closed --- czkawka_slint_gui/src/connect_scan.rs | 68 ++++++++++++++------------- czkawka_slint_gui/src/main.rs | 4 +- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index 35c8335b0..e9cb7e057 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -2,7 +2,7 @@ use crate::{split_path, CurrentTab, MainWindow}; use chrono::NaiveDateTime; use czkawka_core::common_tool::CommonData; use czkawka_core::empty_folder::EmptyFolder; -use slint::{ComponentHandle, ModelRc, SharedString, VecModel}; +use slint::{ComponentHandle, ModelRc, SharedString, VecModel, Weak}; use std::path::PathBuf; use std::rc::Rc; use std::thread; @@ -16,39 +16,43 @@ pub fn connect_scan_button(app: &MainWindow) { let a = app.as_weak(); match active_tab { CurrentTab::EmptyFolders => { - thread::spawn(move || { - let mut ef = EmptyFolder::new(); - ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); - ef.find_empty_folders(None, None); - - ef.get_empty_folder_list(); - - let mut vector = ef.get_empty_folder_list().keys().cloned().collect::>(); - - vector.sort_unstable_by_key(|e| { - let t = split_path(e.as_path()); - (t.0, t.1) - }); - - a.upgrade_in_event_loop(move |app| { - let mut folder_map = ef.get_empty_folder_list(); - let items = Rc::new(VecModel::default()); - for path in vector { - let (directory, file) = split_path(&path); - let data_model = VecModel::from_slice(&[ - SharedString::from(file), - SharedString::from(directory), - SharedString::from(NaiveDateTime::from_timestamp_opt(folder_map[&path].modified_date as i64, 0).unwrap().to_string()), - ]); - - items.push((false, false, false, ModelRc::new(data_model))); - } - app.set_empty_folder_model(items.into()); - app.set_scanning(false); - }) - }); + scan_empty_folders(a); } _ => panic!(), } }); } + +fn scan_empty_folders(a: Weak) { + thread::spawn(move || { + let mut ef = EmptyFolder::new(); + ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); + ef.find_empty_folders(None, None); + + ef.get_empty_folder_list(); + + let mut vector = ef.get_empty_folder_list().keys().cloned().collect::>(); + + vector.sort_unstable_by_key(|e| { + let t = split_path(e.as_path()); + (t.0, t.1) + }); + + a.upgrade_in_event_loop(move |app| { + let mut folder_map = ef.get_empty_folder_list(); + let items = Rc::new(VecModel::default()); + for path in vector { + let (directory, file) = split_path(&path); + let data_model = VecModel::from_slice(&[ + SharedString::from(file), + SharedString::from(directory), + SharedString::from(NaiveDateTime::from_timestamp_opt(folder_map[&path].modified_date as i64, 0).unwrap().to_string()), + ]); + + items.push((false, false, false, ModelRc::new(data_model))); + } + app.set_empty_folder_model(items.into()); + app.set_scanning(false); + }) + }); +} diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 198180215..4c2915f10 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -24,9 +24,9 @@ fn main() { items.push(slint::format!("Item {r}.{c}").into()); } - row_data.push((r % 4 == 0, r % 3 == 0, r % 2 == 0, ModelRc::new(items))); + row_data.push((r % 2 == 0, false, true, ModelRc::new(items))); } - // app.set_empty_folder_model(row_data.into()); + app.set_empty_folder_model(row_data.into()); connect_delete_button(&app); connect_scan_button(&app); From 5f9ddc91e2b63c7727062a91fa3de6ccf6176c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 21 Oct 2023 23:33:29 +0200 Subject: [PATCH 010/107] Better list view resizable items --- czkawka_slint_gui/Cargo.toml | 1 + czkawka_slint_gui/src/connect_delete.rs | 20 +++++------ czkawka_slint_gui/src/connect_scan.rs | 2 +- czkawka_slint_gui/src/main.rs | 25 +++++++------- czkawka_slint_gui/ui/main_window.slint | 31 +++++++++++------ .../ui/selectable_tree_view.slint | 33 ++++++++++++++----- 6 files changed, 70 insertions(+), 42 deletions(-) diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index c47e9465d..dd97e856f 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -18,4 +18,5 @@ czkawka_core = { version = "6.1.0", path = "../czkawka_core" } chrono = "0.4.31" [build-dependencies] +#slint-build = "1.2.2" slint-build = { git = "https://github.com/slint-ui/slint.git", branch = "olivier/fix-3700"} \ No newline at end of file diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index cb3af34c9..953e5707b 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -9,21 +9,17 @@ pub fn connect_delete_button(app: &MainWindow) { let mut r = app.get_empty_folder_model(); let m = r.borrow_mut(); - let length_before = m.iter().count(); - let (entries_to_delete, entries_left): (Vec<_>, Vec<_>) = m.iter().partition(|(checked, _selected_row, _header_row, _data)| *checked); - let mut s: Vec<_> = m.iter().filter(|(checked, _selected_row, _header_row, _data)| !*checked).collect(); + let (entries_to_delete, mut entries_left): (Vec<_>, Vec<_>) = m.iter().partition(|(checked, _header_row, _selected_row, _data)| *checked); - entries_to_delete.into_iter().for_each(|(_checked, _selected_row, _header_row, _data)| { - // TODO delete in parallel items, consider to add progress bar - }); - - let length_after = s.len(); - if length_before != length_after { - dbg!(format!("Items to remove {}", length_before - length_after)); - s.iter_mut().for_each(|(_checked, selected_row, _header_row, _data)| { + if !entries_to_delete.is_empty() { + dbg!(format!("Items to remove {}", entries_to_delete.len())); + entries_to_delete.into_iter().for_each(|(_checked, _header_row, _selected_row, _data)| { + // TODO delete in parallel items, consider to add progress bar + }); + entries_left.iter_mut().for_each(|(_checked, _header_row, selected_row, _data)| { *selected_row = false; }); - let r = ModelRc::new(VecModel::from(s)); + let r = ModelRc::new(VecModel::from(entries_left)); app.set_empty_folder_model(r.into()); } }); diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index e9cb7e057..8faa70651 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -39,7 +39,7 @@ fn scan_empty_folders(a: Weak) { }); a.upgrade_in_event_loop(move |app| { - let mut folder_map = ef.get_empty_folder_list(); + let folder_map = ef.get_empty_folder_list(); let items = Rc::new(VecModel::default()); for path in vector { let (directory, file) = split_path(&path); diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 4c2915f10..8ae91f1e8 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,37 +1,40 @@ mod connect_delete; mod connect_scan; -use std::borrow::BorrowMut; use std::path::Path; use std::rc::Rc; use crate::connect_delete::connect_delete_button; use crate::connect_scan::connect_scan_button; -use czkawka_core::common_tool::CommonData; -use czkawka_core::empty_folder::EmptyFolder; -use slint::{Model, ModelRc, SharedString, VecModel}; +use slint::{ModelRc, SharedString, VecModel}; slint::include_modules!(); fn main() { let app = MainWindow::new().unwrap(); //.run().unwrap(); + + to_remove_debug(&app); + + connect_delete_button(&app); + connect_scan_button(&app); + + app.run().unwrap(); +} + +// TODO remove this after trying +pub fn to_remove_debug(app: &MainWindow) { let row_data: Rc)>> = Rc::new(VecModel::default()); - for r in 0..1000 { + for r in 0..100000 { let items = VecModel::default(); for c in 0..3 { items.push(slint::format!("Item {r}.{c}").into()); } - row_data.push((r % 2 == 0, false, true, ModelRc::new(items))); + row_data.push((r % 2 == 0, r % 3 == 0, false, ModelRc::new(items))); } app.set_empty_folder_model(row_data.into()); - - connect_delete_button(&app); - connect_scan_button(&app); - - app.run().unwrap(); } pub fn split_path(path: &Path) -> (String, String) { diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index daf35f21f..8533755c7 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -4,29 +4,38 @@ import {LeftSidePanel} from "left_side_panel.slint"; import {CurrentTab} from "common.slint"; export component MainWindow inherits Window { - callback deleted; + callback deleted; callback scanned(CurrentTab); + min-width: 300px; in-out property scanning: false; in-out property active-tab: CurrentTab.EmptyFolders; - in-out property <[{checked: bool, selected_row: bool, header_row: bool, val:[string]}]> empty_folder_model: [ + in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_folder_model: [ {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , - {checked: false, selected_row: true, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} ]; - in-out property <[{checked: bool, selected_row: bool, header_row: bool, val:[string]}]> empty_files_model: []; - in-out property <[{checked: bool, selected_row: bool, header_row: bool, val:[string]}]> similar_images_model: []; + in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_files_model: []; + in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> similar_images_model: []; title: root.active-tab == CurrentTab.EmptyFiles ? "EmptyFiles" : (root.active-tab == CurrentTab.EmptyFolders ? "EmptyFolders" : "Similar Images"); - min-width: 200px; VerticalBox { HorizontalBox { // min-width: 600px; preferred-height: 300px; LeftSidePanel { + max-width: 10px; // Just forces the smallest possible scanning: root.scanning; active-tab <=> root.active-tab; } @@ -35,20 +44,22 @@ export component MainWindow inherits Window { if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { min-width: 200px; - columns: ["Selection", "Folder Name", "Path", "Modification Date"]; - values: empty-folder-model; + columns: ["Selection", "Folder Name", "Path"]; + last-column: "Modification Date"; + column-sizes: [30px, 100px, 100px, 100px]; + values <=> empty-folder-model; } if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { min-width: 200px; columns: ["Selection", "Folder Name", "Path", "Modification Date"]; - values: empty-files-model; + values <=> empty-files-model; } if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { min-width: 200px; columns: ["Selection", "Folder Name", "Path", "Modification Date"]; - values: similar-images-model; + values <=> similar-images-model; } } HorizontalBox { diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 777b1c9dd..f2b2cf756 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -2,11 +2,15 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV export component SelectableTableView inherits Rectangle { in property <[string]> columns; - in property <[{checked: bool, selected_row: bool, header_row: bool, val:[string]}]> values; + in property last_column; + in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> values; - private property <[length]> column_sizes: [30px, 100px, 100px, 100px]; + in-out property <[length]> column_sizes: [200px, 100px, 100px, 100px]; + private property <[length]> real_sizes: [0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px]; private property column_number: 4; + in-out property selected_item: -1; + VerticalBox { padding: 5px; // Widgets @@ -15,12 +19,13 @@ export component SelectableTableView inherits Rectangle { spacing: 5px; vertical-stretch: 0; for title[idx] in root.columns : HorizontalLayout { - width: root.column_sizes[idx]; + width: root.column-sizes[idx]; + Text { overflow: elide; text: title; } Rectangle { width: 1px; background: gray; - + TouchArea { width: 5px; x: (parent.width - self.width) / 2; @@ -42,17 +47,29 @@ export component SelectableTableView inherits Rectangle { } } } + Text { overflow: elide; text: last-column; } } - list_view:= ListView { + list_view := ListView { min-width: 100px; for r[idx] in root.values : Rectangle { + height: 30px; background: r.header-row ? #888888 : (touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd)); // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); touch_area:= TouchArea { clicked => { if (!r.header_row) { - r.selected_row = !r.selected_row + r.selected_row = !r.selected_row; + if (root.selected-item == -1) { + root.selected-item = idx; + } else { + if (r.selected_row == true) { + root.values[root.selected-item].selected_row = false; + root.selected-item = idx; + } else { + root.selected-item = -1; + } + } } } } @@ -60,7 +77,6 @@ export component SelectableTableView inherits Rectangle { HorizontalLayout { padding: 5px; spacing: 5px; - //width: root.column_sizes[idx]; CheckBox { //min-width: 200px; @@ -74,11 +90,12 @@ export component SelectableTableView inherits Rectangle { } HorizontalLayout { - padding: 5px; spacing: 5px; for f[idx] in r.val : Text { width: root.column-sizes[idx + 1]; text: f; + font-size: 12px; + vertical-alignment: center; overflow: elide; From 7e7a603f4cc7a22c25353197d9f0ae0b835765fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 22 Oct 2023 11:32:13 +0200 Subject: [PATCH 011/107] Active --- .github/workflows/linux_cli.yml | 2 +- .github/workflows/linux_gui.yml | 4 +- czkawka_cli/Cargo.toml | 2 +- czkawka_core/Cargo.toml | 2 +- czkawka_gui/Cargo.toml | 2 +- czkawka_slint_gui/icons/logo.png | Bin 0 -> 11273 bytes czkawka_slint_gui/icons/settings.png | Bin 0 -> 4667 bytes czkawka_slint_gui/ui/action_buttons.slint | 31 ++++++++ czkawka_slint_gui/ui/left_side_panel.slint | 55 ++++++++----- czkawka_slint_gui/ui/main_lists.slint | 38 +++++++++ czkawka_slint_gui/ui/main_window.slint | 74 +++++++++--------- .../ui/selectable_tree_view.slint | 4 +- instructions/Compilation.md | 2 +- 13 files changed, 152 insertions(+), 64 deletions(-) create mode 100644 czkawka_slint_gui/icons/logo.png create mode 100644 czkawka_slint_gui/icons/settings.png create mode 100644 czkawka_slint_gui/ui/action_buttons.slint create mode 100644 czkawka_slint_gui/ui/main_lists.slint diff --git a/.github/workflows/linux_cli.yml b/.github/workflows/linux_cli.yml index 70f3c9b05..f306f9743 100644 --- a/.github/workflows/linux_cli.yml +++ b/.github/workflows/linux_cli.yml @@ -12,7 +12,7 @@ jobs: linux-cli: strategy: matrix: - toolchain: [ stable, 1.70.0 ] + toolchain: [ stable, 1.72.1 ] type: [ release ] runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/linux_gui.yml b/.github/workflows/linux_gui.yml index 96c81473b..bcdd94a31 100644 --- a/.github/workflows/linux_gui.yml +++ b/.github/workflows/linux_gui.yml @@ -12,7 +12,7 @@ jobs: linux-gui: strategy: matrix: - toolchain: [ stable, 1.70.0 ] + toolchain: [ stable, 1.72.1 ] type: [ release ] runs-on: ubuntu-22.04 steps: @@ -29,7 +29,7 @@ jobs: env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0" - if: ${{ (matrix.type == 'release') && (matrix.toolchain == '1.70.0') }} + if: ${{ (matrix.type == 'release') && (matrix.toolchain == '1.72.1') }} - name: Store Linux GUI Heif uses: actions/upload-artifact@v3 diff --git a/czkawka_cli/Cargo.toml b/czkawka_cli/Cargo.toml index 783596edf..2eb75bc77 100644 --- a/czkawka_cli/Cargo.toml +++ b/czkawka_cli/Cargo.toml @@ -3,7 +3,7 @@ name = "czkawka_cli" version = "6.1.0" authors = ["Rafał Mikrut "] edition = "2021" -rust-version = "1.70.0" +rust-version = "1.72.1" description = "CLI frontend of Czkawka" license = "MIT" homepage = "https://github.com/qarmin/czkawka" diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index ba49cc3a8..b8bc8193c 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -3,7 +3,7 @@ name = "czkawka_core" version = "6.1.0" authors = ["Rafał Mikrut "] edition = "2021" -rust-version = "1.70.0" +rust-version = "1.72.1" description = "Core of Czkawka app" license = "MIT" homepage = "https://github.com/qarmin/czkawka" diff --git a/czkawka_gui/Cargo.toml b/czkawka_gui/Cargo.toml index 431bdb940..7db4db605 100644 --- a/czkawka_gui/Cargo.toml +++ b/czkawka_gui/Cargo.toml @@ -3,7 +3,7 @@ name = "czkawka_gui" version = "6.1.0" authors = ["Rafał Mikrut "] edition = "2021" -rust-version = "1.70.0" +rust-version = "1.72.1" description = "GTK frontend of Czkawka" license = "MIT" homepage = "https://github.com/qarmin/czkawka" diff --git a/czkawka_slint_gui/icons/logo.png b/czkawka_slint_gui/icons/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..1064e495efc39aef590c67b8cd65c910bb2761fe GIT binary patch literal 11273 zcmeHrc{tSF`~R6S_O-|oWzCXp>^mb-lQjxSj2KLou`|}GNDoDZr$x3Bii$RcFfG!^ z+GeLjB$6dN^E;!S?fQOy*YEqeuJ7-^$92s)@AoCo^mkxGg^48nEbfthS61|Gmjk$tlUP*rmloNA_0NsP<`Nr};v=OPsaj zHzp1uIZ+psP|8;`i_S>DX60#l%Kn?oWDr;N>6Ra#6ipG$Mq3-MdtS<~Sz3KyGGgLc zBqVw&;?Ag;B0m6#B!Zcl9oEe356_{$IdK_Ad!J#%8r&To*ze>KR2VvUMZeqJ9Cg7Z zN$LRGgI#4jvKQjnthZ7Gh4wso@Zm$_(RWW84mq(pnewfI;P7Dku#C<03j!|Bqk{U< zBNw(uPJt`?y|dqKVb!cXR-DPMcKProrgFBUd`72n7T)L86tN0XY2`7Ci_t=#4h@X1 zi^UxqI7+saNz-_Cb8|VrZGa

&kNvN6NvW&>^)JB3icTJ)y*(}WTVZLjL*2RXLnDtH4k>mzf6ZG>y7IX0@$>NPXM2w#QqM{3GUXPP zFH8}>rLQ3P`hNcR@4R~PzqxW$X;WXSrE_S$OcP(_jgR!(BKxBMnjLa1{?26jCW#78 z&99YfasIt6{8T!Z>z9CpB7{`}#f|9KAzhFl`sh)hU(@!WDyH3eT-{mQXtoaW0^|ja z2Z`8 z9%dvZ1?MIHurDCU+WJrUz|dbTKt5EXJc3l!RM4sc0jhu32n{ojfFQpN`foKt55NkhKG3K%_H!EVbXtx@bdgqKPWuJf5ROwPgT4>J^+e_!d2D&vE&}CwcVc@3<`V* z0YMvDknDd*h7r8~BI_TvF=jU0`MV)d{ZHI~NdMvchA@<}w$|TG^bBX1huv)?#aLh8 zi|9%4(%*PgQ&Uq{SJU-S)>ik{P}bB?$18hyX=y5J>1pbEdZ_EDdwQw;4GJ3=8s-t` ziDy7Ta1{c?(bZP-MtfAMI;!WXtL?3g{~LsD2mwZ= zhyUNLVnBI8C_Nptrk1vjma?vn2DAq6jaNRZrjAzjL~Ch#=xKO+YJ2~*#>-RRf*2Cu z0k@M7;NgQ;4GQ$xSc5^hzNsD7NJ?D={nv<{zekuiR4|gVA_Rs<{WWob5P)|G^I)*4 zrmd%=r=^Wn)6rH(Yij>Z+YuiU3L}w$sfJe3(A-dGY>Pg01`_MRh*Jo#F%EsvHw(dg zgb_my5Q+XqQVf$M7@B`hTf^hzb@c;iU43Hja{n#Kxh}_wfAbLa0Xs z-fP27i1l;I)7K-=2M@EyuW-OJ;j=%GaKut<*(yr~c55po5?bAu}h`HhWI_@{KFFP^arkT7L6wDMns>HH#0 z^_Rn{jGXa@$A+r^g%iUKfxjggsP}UWCNG!^RsT$ezc^#0o&S%2zxLw);|dV^-$ni- ze*dNGU%LJy2L2=Af1~SPy8a^u{v+Xkqw9Z-E{?xGr|^NW3W|guOFJ943BeC7mZO$? zc5i%gfhDt=1o*@rwD(Xb04maqA0n#ABmxeyhGDJESw}epS+?r&&*Y21A(1e1=P)y3 z0HZ1g8^t2tOCpjG<}1M{7M+gsKzPxk*xjZFqIxF#NfkSsj<9~8$|Y&=?|Lb-IYT)U zBg477((W{yJO_v1d9u{Ef)kFCryci8op&j?dS2k5g0iyAepC6~0&i0=UF$gRQ%2+o zOMrc8qfKdU_M?w&k0OQEOvOb`j?CVuX2uTm+vNAwPwDl?=_7vn^S|HXzF1_Fc@*ae z00A1@>sk1KupV*&95QYjR`l> z5h!pm8&8JanRNsdhH8Zj(O*)IPv%U>02qAUjDdr220}uSzXbk5!?C<)XxXhYV4%RU zN4x;40yZGL#v}oLJy+~fL7;vL{Dp=B`Y$%t`BRwjPa~)UyMWO}h6Qj2eK|w+&jrZ0 zv^5dEN-HR%!f>)+g@)tA4^N;0B)9%i9+&$Ua(-F;3@TbX*ZDB>4*5=Yk#K*8ECFC|^$uXh&H*-S94VC2s>gQH%kDlW!P2 zhyY0P(AWw)>@g3I<;h;GT{IAZ`&#g<@CV7wk_~b@=FH~&R=xf<2jh7!oAcbuek*{v z$8Fu7*V8@9*B(}bYuHNV0!G_DzK?Tj5XTu=WEWi4034%P+hR3mE(0_Z05Yuz;bFF} z3Dd%-N&v?~j&QuLz!}v)x4`vg2->DZcw04>LFY3gck=)Q4qdGL%^L}MKyxy@Yg)d> z?#~ZBON23m$>^R(z3GNZ&HS4a*#UyQeak#yJ;Jxay$kX#c;j7XM-?J{ircQyp6YjV zPs(=S4eVb23P9)s#K6TlhHN2!qC*fSE=Ewz6|Ql8sd*BC6hOb|DddL2r+nO-8nPln zQ53er;QLG#4YE!Ph^d0WAhS0_~Bj4ZMb#+J;1#YGkk<;s}h{^_$4fPHIZi|zQ z9Z!w-2x~mUQ}TF~zaaCJV;e)7* zK1hj?t+J%td!Ql#VW=lULd7KoaDZpKWme=)-PW zaC)23E~N6CA4Oy#`&+437w4H|t3I6IY~363J}V*KIrR>CtxuCz*y?Uh%`?TtW?iPB z5K1Pc&xm#dyI%R(me+f}A%Qx9&~H?SC$J59g4*VY`0!SyAQhT+2iUzdKn)}3gK9>x!OTVGlR$;l3PwB-pTDNTBy7iB62T6R>^<=mfhju) zC&A4{Yi1@O3A3O#8y^>N;YSt6-8)JvR|Q;pC^jTetWA zYibuJzwR6#G+rrGuD6V@y(Ao1FpUj^+WQ4hI_~aquHE|NM}VY+B*2lEJdzr!bR-MX z6%lFGd?=ViP-H|K3$Ww9RTG+aK-C+u9Ip!Z7O)62GR!@|r3u&&(DYt^uCW>$4nz_U z4_dxZZyeL{0$guL^~nj_!}H{9F$zo)49OXJXrm zq>@wWpYpa_p1jB$w1qsxi~FvF5!EMO<)wb-@?gPCv*Jo3qOIyf&7Vq=6*%gLcq_8k zl#v)k3%b5EnXkR`5WLEuL2~o;+qzXFi=!TioP!`HhHmAmtP`_b>dDI>9Cj+{-8uv5p7h0rYU_Ajx9+|5+R@BlVAhwPNH$;pJt2ef+Y*&IgH@7hdX_b z>8oraK&MNJA;(4x>z?sb?L?qQyU4Qw(ArZX$YvIp>fz4*)u6w_2m%$yZdJ#6j42{G z5U^6Su!+R05#AbKlqJ@FIq#7i=JpkS(%g=mZ7; zcvLrDe~p6o4O;;Og53P-(7rZeKQ#afio@~$(g~Ay{bP9S@zqpu7a)AP<0bbU&~w)k zp6#Fe9rYprg}H~Ig46^eOWcMp?pirhE*s&+l*i5oy0#*7#MtgnFAzuX zB=QyPCs>`fjAN2xJ25oaGE_g2+v&Sy%990XAjyMEn8=xm_s{)gfk2!FcraMy+;Ev% zZLrpbwtJ|tNenYB1cNAAUm8vDkwTG&2JZp1OGk{Ju33y3^}Ycta-$vQYSeWDVt}x9 z)WAzFaAZ-94S~*iI{16_{U(5ZwW4*z96fGtCXHf46fANA&cH_QBbS&XT($@ctk((A z2PWLLbZfKOVKtYlxO(KKc|&&3RcEim*$CXB+(^6MA91JVvYCY47Z*KkGbreg+gI{Y zWZ0j2HwAaWNrRuuH+b;dIB%JA=wX3WUrPkpEs2a5sF75{@04NGB>U$53eC4nT_FP0 z@hZ+s;Y~@*4erzK!N8Y$6xNR7v1L1xhfMk+M59mdU&Z!u^BG|L69(hLlLmR)xIov^ zo0j&x}Pj;mPvr{r#rSlyv+;+?T4VfE1O7R{-emS4%@N zowr-vveuA9c6?X_7r@aY&b^5>mPDKvMY@PzgIVUYyzju_^t&gh<1Z}dg^*xT%`biF zel_KNi{n{~!h^{mE&=1pOvPC^u&EuHD7!t<2t8oGn;lR?kzBChSh4X&Cb~BR+#Ijb zc;T`Z5>PQrrF>)nEPHhPkmnCwJnTyS5eJV^<=ItJm|ml%g=AnlIRjtFq=h%xWYY49 zUFq-)+d&-*y8Jql6=uV!)Vf_~VBYF*2^2_!hq>l8?czDfC<&M^PzKS}f&u_{ZpFqL zb7AFFh6&^+!$f$keP7agdb~lUxL`cfMVMs-;$RU98eT8JW$jLHNq`BlRj@VVD#S(K z61mfOfVM-@Y^{0mu@jCM&JJ)@$|&aNOC!RBIBN72(TuT|6zK%V$r#B1~2N z+z12Z)l`+f6cc^6Tl!25{nwE$dWf@@Mj#I?Tj;U<{DZQ5ITB&kyf zX-R$Dp+*hPxb5((2BG>de{NyEp+L58B)-e?eWI6LrbmikmZ&k4~m(|5j~fO{cf1(O)QsI z*nawmb;}$smKn90uCv*9crxPs0FDLJP1cm{$>pTP9&751cK`9nlA_qTT5Dr9L(NK7 zu-SVz!Lp!AiB?k9Sgg{{Q7J@CiF0rII{($;RKoj=O<(F{Onx8Ex6dmH(#=$Lcq~gR z%QQTe(wT7VVC;+9R_`V=iOfD}nliufn}i}#N6`WL+S5~=i(MB@8?W}nL{bubeN(S; zB=9=V&LeRrR!T@6`3Zp}0F4kTaU})4|G}Z{kT)1KlekcI+r@31%^5|H}x0m&}0jr>Wl*6JCm7P2EYKssbY_RL9sfQnpm0??N zlgf`MT+qKA^UX(n$!_pf@gf&%rlHrul zm^G^Kc1v-&?2<2KL1t+pYj9RkBta~mNKw@?oO0i4Jo-j`X_21M*jaYzQm~E9+HZ-M zvGL(gCfCMfbZq3Qsx8C(LY;SN!9|=CMQ1W-_(w~YTw+{XHWS7^FF4-s;F-Fd;qpvF zLuwB=aO;??J<+&C!`Oxaq#Qh`UZw;reWhI-A=PlHD=7l=GD1Q(XNYOa9 z-dq3fe)k2@ffe)6`wNF33Ve#WmJ?6x8JNP79OW#|rZX$xmbxizwSp}qAh8E?zAf=CqJwvO#i2YaVR z2zBYtim>tOW$xpo_mj*>FhLDaxB!e5N3g_)lOL)Ivm#kzyHi%yEGXioCtiIm>pt_! z-YrD?o7D{b+KmZ&{2;m|*yiPA8&lWi5J!BC>H%{D?0{DBqsiM(pTCcYvwG$ey{C!) zt9Lk_;?6tF`JpJQ=P7F^+2N>$>X4*U=_7F zU;FWBURJ8~JEH~OhpUq()#E40vkzBWx z+L@~z$mQ4il|mp?-;Vh>LFoR{UT+h{xNPwKdzQoNhRxeEIrhD|TSx3wPl*q-R*UPY ztQ3x%87Vs0wO7mKc8% z4-L3Xj$U)E`9RI?8EUyYo>ZdIxUB{qQBq%wnWr$_&BnoK_UI4 zYVR~mpfl(_os~jtpaSIYBbjBJ*v?++uF+U}p?$CG^31mwYd@;^zAAFFgT33Ec-J2! zi+7(SZx+W$ACMI}%#T??H?~w*~uXhY&2Q0rGpIx_3t`xe6 zATtZ4%$7bq=p%B0$vE&SalB6X*BTPbck!=&IOX=w5z zQqYRxnfZ8UrmeC68^&p=jB=#7H%}4j=ZOz^mnW3~LAwqmivarwawQ!mb#DP=(X>zuQVxe(rh@J)@3@a zm$H*z#}4&bSo>aIiErzE5|LL@t5aIhF-NM)TlQOp^ni=%pm}*QD!Uw9ERitM{B)tS zpXRC2@~Xq;u$={VKzAet78PmyZd0oY?q4gjoVMPS0y4CIjU~s9DXY8XBfXrCt$Kiq zwgnrnvPay(EsNKC-E(ltYG$!HfhF$E2)Q>-KGQZTW-zP#$E7SC0hiy)$NdPJ()_8>daK7tMjK3@?f>P!ayS~T%wr(Vr!mIRQR`UqYqjxbS^52AP zmt2S~<4!MX&@@ZYx@YnuwY+(KGn331id?ZF&0ntZaHCNmwo1M4{@3TKL*5u(Ea_5@ zO>xFx)^JVb;}@ZRbt^W-SvsXujW4b#jW*LRE2SOt*E)N?9GXt8UKy&(dL^h6S68OK z{(bjhn4)?kT2-w`R|l0ZtzWC;EpgqvnCG{1?@H!ld76%_0LAv&<7)vc{(Ursl95qm z`B59+GEqv7Zo}6z_9|yIZcw*BES|TaOx-dzd*ic;Yw_`aHGkswJ7ne~cQa=6=ifLC zWPE!RJ39P;SY-HuUUckj%#l>%Stf_udI|Oizu&g4;_KKGGS?DWQTsouew}mZtgRvT U#}1JMR~Z^ubDQ0_ci~R_ALpmYng9R* literal 0 HcmV?d00001 diff --git a/czkawka_slint_gui/icons/settings.png b/czkawka_slint_gui/icons/settings.png new file mode 100644 index 0000000000000000000000000000000000000000..475bd01adb8fb40bf5615f9b1645d1c769fb24b5 GIT binary patch literal 4667 zcmeHKeNYo;8eh*U6j8wIyX0 z`9|N8B^jP8J9CvMt%}B%qY4^Q41a$ijz5ibKi*3kT4!vGzn!&58?s31y>@AMi|*!g z>C-zyh|r8~a9^UvAut|Prc^M+0yyfe2avwJb$*Ss<-|6cZ2szn z_QcuS=SB8j8s3@JhbB72v)3|)#r-#CMj5IPy!~o94?)u!`P5X4DK&L8a1d_mQ(Fz0 z$C9Ftm*xK6S`_`5;>)mI)L)Ip=*s!eSYpqG?5AETxf4t9nMEbhGcK(EMNISRpaqW7 z#U(S6Z%pqzf86w`F>AQYS`mKr!?lS$m+LPbnckS*!si!6e=_)5OU}|xr`s6%o?`Q~ z!SV;_mNh5##kcqBk6yoWwZHUPN9~RwvGM$S$DtjW(Tvor+bmGepRc{*O}dMOl~mPN4qP3a_D4&>-bKB= zVGCDSZ@&ET;rf;JL$|VDe?LYz?`_}f9QXl(<`naw5DU%O6eGBlG%MIRrO)L76$(KK zi9Qd_RB{q*;~c!(p!oXm`wEz64T=Jd88v%Sxe7kB&dcT2<>WDSm5iQMB(4fc@KFH3 z#Yr^mb2;52dT#VQ5tSCJ|WibAsmP8GZyOehH@iWq%-HLh3{0w;J`J7rBv zAAtZ*21SJ=c_@{trlv+&qgD!DhYHi{^(qus;Wz>`5V6)R(LTg2#>o%?j5JPUyu3%^ z1ve~X(l((=GAI;a9Uk@1+u`3sCY(yPm<$SBiQbb~oU~*I1_nho@2>LQ zTgc;GT&_gRY+_nHsn=+=8VyEj^;p1XKVClP6+tD+m>8;52Ug^?P#_pUEG^e502qyu zO7(KIBzW@#!D&#)5U^}HwrmFN#L^O-MoSz3MR7HSp%jkip*l)UQfl=I6sOQ}`U1<_ zYyX?J+&pkXAmy372==e_ivk^$%dHJO1siEfP!o`W`3%OrYHZ$*a3)XI z`}i3txBIvQfS%f9Qv6QQHAUB?7?_muRCP_!H7N!rr94$#|2Miq?wuGpH+a#j0q4P@ z)r;qXv*b+M;~8ntUHQB7$ewLL@}MVkjR--?IQcit*Pd7ngh7(YYz*oPiJbXJ+@YN8 zG9Y?bG8Rgyf=fPlK>qh(j)iM@sREYYhYOybvj8Y{n9`E-3Xcus7ti?s4t?vyP+80O z%Hnkq|M&yj|F-qwPRpsXGL^V}Q&{uzu+EL=m!7RAi6dppl04a)a{t18Srs1KxciL$ zgM&}b4gJcHl^GWDq9f|lg!RD@(B`9#U+rmcy||?GZ^3WO(6k-3orWzP1G?WN?dmR3 zusbf_Oxk@z;#O@Q3|bJ0pM6jWYg-og(Ki>qKwm4b>T2>>_65J#aO%Xj%C@eS;FRYU jo~VClx$gLxL;cY5)fu< scanning; + in-out property active-tab; + + HorizontalBox { + height: 50px; + scan_button:= Button { + enabled: !scanning; + text: "Scan"; + clicked => { + root.scanned(active-tab); + } + } + delete_button:= Button { + enabled: !scanning; + text: "Delete"; + clicked => { + root.deleted(); + } + } + } +} \ No newline at end of file diff --git a/czkawka_slint_gui/ui/left_side_panel.slint b/czkawka_slint_gui/ui/left_side_panel.slint index b3bdef09a..d35458a66 100644 --- a/czkawka_slint_gui/ui/left_side_panel.slint +++ b/czkawka_slint_gui/ui/left_side_panel.slint @@ -17,28 +17,47 @@ component TabItem { export component LeftSidePanel { in-out property active-tab; in-out property scanning; + width: 120px; VerticalLayout { - width: 120px; - spacing: 3px; - - TabItem { - scanning: scanning; - text: "Empty Folders"; - active-tab <=> root.active-tab; - curr_tab: CurrentTab.EmptyFolders; + spacing: 20px; + Rectangle { + height: 100px; + Image { + width: root.width; + source: @image-url("../icons/logo.png"); + } } - TabItem { - scanning: scanning; - text: "Empty Files"; - active-tab <=> root.active-tab; - curr_tab: CurrentTab.EmptyFiles; + VerticalLayout { + spacing: 3px; + alignment: center; + + TabItem { + scanning: scanning; + text: "Empty Folders"; + active-tab <=> root.active-tab; + curr_tab: CurrentTab.EmptyFolders; + } + TabItem { + scanning: scanning; + text: "Empty Files"; + active-tab <=> root.active-tab; + curr_tab: CurrentTab.EmptyFiles; + } + TabItem { + scanning: scanning; + text: "Similar Images"; + active-tab <=> root.active-tab; + curr_tab: CurrentTab.SimilarImages; + } } - TabItem { - scanning: scanning; - text: "Similar Images"; - active-tab <=> root.active-tab; - curr_tab: CurrentTab.SimilarImages; + HorizontalLayout { + height: 20px; + alignment: end; + Image { + width: 20px; + source: @image-url("../icons/settings.png"); + } } } } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_lists.slint b/czkawka_slint_gui/ui/main_lists.slint new file mode 100644 index 000000000..1cc1045dc --- /dev/null +++ b/czkawka_slint_gui/ui/main_lists.slint @@ -0,0 +1,38 @@ +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; +import {SelectableTableView} from "selectable_tree_view.slint"; +import {LeftSidePanel} from "left_side_panel.slint"; +import {CurrentTab} from "common.slint"; + +export component MainList { + in-out property active-tab; + + in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_folder_model; + in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_files_model; + in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> similar_images_model; + +// TODO - using root.active-tab in visible property will not clear model + if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { + min-width: 200px; + + columns: ["Selection", "Folder Name", "Path"]; + last-column: "Modification Date"; + column-sizes: [30px, 100px, 100px, 100px]; + values <=> empty-folder-model; + } + if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { + min-width: 200px; + + columns: ["Selection", "Folder Name", "Path"]; + last-column: "Modification Date"; + column-sizes: [30px, 100px, 100px, 100px]; + values <=> empty-files-model; + } + if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { + min-width: 200px; + + columns: ["Selection", "Folder Name", "Path"]; + last-column: "Modification Date"; + column-sizes: [30px, 100px, 100px, 100px]; + values <=> similar-images-model; + } +} \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 8533755c7..7d79dd7ad 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -1,12 +1,17 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; +import {MainList} from "main_lists.slint"; import {CurrentTab} from "common.slint"; +import { ActionButtons } from "action_buttons.slint"; export component MainWindow inherits Window { callback deleted; callback scanned(CurrentTab); min-width: 300px; + preferred-width: 1024px; + min-height: 300px; + preferred-height: 600px; in-out property scanning: false; @@ -22,6 +27,22 @@ export component MainWindow inherits Window { {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} ]; in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_files_model: []; @@ -31,53 +52,30 @@ export component MainWindow inherits Window { VerticalBox { HorizontalBox { + vertical-stretch: 1.0; // min-width: 600px; preferred-height: 300px; LeftSidePanel { - max-width: 10px; // Just forces the smallest possible - scanning: root.scanning; + horizontal-stretch: 0.0; + scanning <=> root.scanning; active-tab <=> root.active-tab; } - // TODO - using root.active-tab in visible property will not clear model - if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { - min-width: 200px; - - columns: ["Selection", "Folder Name", "Path"]; - last-column: "Modification Date"; - column-sizes: [30px, 100px, 100px, 100px]; - values <=> empty-folder-model; - } - if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { - min-width: 200px; - - columns: ["Selection", "Folder Name", "Path", "Modification Date"]; - values <=> empty-files-model; - } - if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { - min-width: 200px; - - columns: ["Selection", "Folder Name", "Path", "Modification Date"]; - values <=> similar-images-model; + MainList { + horizontal-stretch: 1.0; + active-tab <=> root.active-tab; + empty_folder_model <=> root.empty_folder_model; + empty_files_model <=> root.empty_files_model; + similar_images_model <=> root.similar_images_model; } } - HorizontalBox { - height: 50px; - scan_button:= Button { - enabled: !scanning; - text: "Scan"; - clicked => { - root.scanned(active-tab); - } - } - delete_button:= Button { - enabled: !scanning; - text: "Delete"; - clicked => { - root.deleted(); - } - } + ActionButtons { + vertical-stretch: 0.0; + scanning <=> root.scanning; + active-tab <=> root.active-tab; + deleted => {root.deleted();} + scanned(item) => {root.scanned(item);} } } } diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index f2b2cf756..90de282f2 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -7,7 +7,7 @@ export component SelectableTableView inherits Rectangle { in-out property <[length]> column_sizes: [200px, 100px, 100px, 100px]; private property <[length]> real_sizes: [0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px]; - private property column_number: 4; + private property column_number: column-sizes.length + 1; in-out property selected_item: -1; @@ -51,8 +51,10 @@ export component SelectableTableView inherits Rectangle { } list_view := ListView { min-width: 100px; + for r[idx] in root.values : Rectangle { height: 30px; + // TODO move this into singleton background: r.header-row ? #888888 : (touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd)); // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); diff --git a/instructions/Compilation.md b/instructions/Compilation.md index 2fe33b492..535318f3d 100644 --- a/instructions/Compilation.md +++ b/instructions/Compilation.md @@ -12,7 +12,7 @@ New versions of GTK fixes some bugs, so e.g. middle button selection will work o | Program | Min | What for | |---------|--------|--------------------------------------------------------------------------------------| -| Rust | 1.70.0 | The minimum version of rust does not depend on anything, so it can change frequently | +| Rust | 1.72.1 | The minimum version of rust does not depend on anything, so it can change frequently | | GTK | 4.6 | Only for the `GTK` backend | #### Debian / Ubuntu From fbe0295f6d0ba1331b06a22baf0b04819e8ee773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 22 Oct 2023 12:18:41 +0200 Subject: [PATCH 012/107] Opening items --- Cargo.lock | 1 + czkawka_slint_gui/Cargo.toml | 1 + czkawka_slint_gui/src/connect_open.rs | 15 +++++++++++++++ czkawka_slint_gui/src/main.rs | 3 +++ czkawka_slint_gui/ui/common.slint | 5 +++++ czkawka_slint_gui/ui/main_lists.slint | 12 +++++++++++- czkawka_slint_gui/ui/main_window.slint | 3 +++ czkawka_slint_gui/ui/selectable_tree_view.slint | 17 ++++++++++++++++- 8 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 czkawka_slint_gui/src/connect_open.rs diff --git a/Cargo.lock b/Cargo.lock index dc8885470..1cff48570 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1329,6 +1329,7 @@ version = "6.1.0" dependencies = [ "chrono", "czkawka_core", + "open", "rand", "slint", "slint-build", diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index dd97e856f..ee1e794bf 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -16,6 +16,7 @@ slint = { git = "https://github.com/slint-ui/slint.git", branch = "olivier/fix-3 rand = "0.8.5" czkawka_core = { version = "6.1.0", path = "../czkawka_core" } chrono = "0.4.31" +open="5.0.0" [build-dependencies] #slint-build = "1.2.2" diff --git a/czkawka_slint_gui/src/connect_open.rs b/czkawka_slint_gui/src/connect_open.rs new file mode 100644 index 000000000..731679015 --- /dev/null +++ b/czkawka_slint_gui/src/connect_open.rs @@ -0,0 +1,15 @@ +use crate::MainWindow; +use slint::{ComponentHandle, Model, ModelRc, SharedString, VecModel}; +use std::borrow::BorrowMut; + +pub fn connect_open_items(app: &MainWindow) { + app.on_item_opened(move |path| { + match open::that(&*path) { + Ok(_) => {} + Err(e) => { + eprintln!("Failed to open file: {}", e); + } + }; + // TODO - this should be added to line edit + }); +} diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 8ae91f1e8..9c857a1bc 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,10 +1,12 @@ mod connect_delete; +mod connect_open; mod connect_scan; use std::path::Path; use std::rc::Rc; use crate::connect_delete::connect_delete_button; +use crate::connect_open::connect_open_items; use crate::connect_scan::connect_scan_button; use slint::{ModelRc, SharedString, VecModel}; @@ -17,6 +19,7 @@ fn main() { connect_delete_button(&app); connect_scan_button(&app); + connect_open_items(&app); app.run().unwrap(); } diff --git a/czkawka_slint_gui/ui/common.slint b/czkawka_slint_gui/ui/common.slint index 20f9cabda..b1de47207 100644 --- a/czkawka_slint_gui/ui/common.slint +++ b/czkawka_slint_gui/ui/common.slint @@ -2,4 +2,9 @@ export enum CurrentTab { EmptyFolders, EmptyFiles, SimilarImages, +} + +export enum TypeOfOpenedItem { + CurrentItem, + ParentItem, } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_lists.slint b/czkawka_slint_gui/ui/main_lists.slint index 1cc1045dc..cfe630065 100644 --- a/czkawka_slint_gui/ui/main_lists.slint +++ b/czkawka_slint_gui/ui/main_lists.slint @@ -1,9 +1,10 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; -import {CurrentTab} from "common.slint"; +import {CurrentTab, TypeOfOpenedItem} from "common.slint"; export component MainList { + callback item_opened(string); in-out property active-tab; in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_folder_model; @@ -18,6 +19,9 @@ export component MainList { last-column: "Modification Date"; column-sizes: [30px, 100px, 100px, 100px]; values <=> empty-folder-model; + parentPathIdx: 2; + fileNameIdx: 1; + item_opened(item) => {item_opened(item)} } if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { min-width: 200px; @@ -26,6 +30,9 @@ export component MainList { last-column: "Modification Date"; column-sizes: [30px, 100px, 100px, 100px]; values <=> empty-files-model; + parentPathIdx: 2; + fileNameIdx: 1; + item_opened(item) => {item_opened(item)} } if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { min-width: 200px; @@ -34,5 +41,8 @@ export component MainList { last-column: "Modification Date"; column-sizes: [30px, 100px, 100px, 100px]; values <=> similar-images-model; + parentPathIdx: 2; + fileNameIdx: 1; + item_opened(item) => {item_opened(item)} } } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 7d79dd7ad..21f4f63a6 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -8,6 +8,7 @@ import { ActionButtons } from "action_buttons.slint"; export component MainWindow inherits Window { callback deleted; callback scanned(CurrentTab); + callback item_opened(string); min-width: 300px; preferred-width: 1024px; min-height: 300px; @@ -68,6 +69,8 @@ export component MainWindow inherits Window { empty_folder_model <=> root.empty_folder_model; empty_files_model <=> root.empty_files_model; similar_images_model <=> root.similar_images_model; + + item_opened(item) => {item_opened(item)} } } ActionButtons { diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 90de282f2..7288be55c 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -1,14 +1,21 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; +import {TypeOfOpenedItem} from "common.slint"; export component SelectableTableView inherits Rectangle { + callback item_opened(string); + in property <[string]> columns; in property last_column; in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> values; - in-out property <[length]> column_sizes: [200px, 100px, 100px, 100px]; + in-out property <[length]> column_sizes; private property <[length]> real_sizes: [0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px]; private property column_number: column-sizes.length + 1; + // This idx, starts from zero, but since first is always a checkbox, and is not in model.val values, remove 1 from idx + in-out property parentPathIdx; + in-out property fileNameIdx; + in-out property selected_item: -1; VerticalBox { @@ -74,6 +81,14 @@ export component SelectableTableView inherits Rectangle { } } } + pointer-event(event) => { + // TODO this should be clicked by double-click + if (event.button == PointerEventButton.right && event.kind == PointerEventKind.up) { + root.item_opened(r.val[root.parentPathIdx - 1]) + } else if (event.button == PointerEventButton.middle && event.kind == PointerEventKind.up) { + root.item_opened(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]) + } + } } HorizontalLayout { From e859c777a403f376c317cd2b66dab7b16d886ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 22 Oct 2023 13:07:38 +0200 Subject: [PATCH 013/107] Delete --- .github/workflows/quality.yml | 10 +++------- czkawka_slint_gui/.clippy.toml | 0 czkawka_slint_gui/src/connect_delete.rs | 2 +- czkawka_slint_gui/src/connect_open.rs | 2 -- czkawka_slint_gui/src/main.rs | 7 ++++--- 5 files changed, 8 insertions(+), 13 deletions(-) create mode 100644 czkawka_slint_gui/.clippy.toml diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index a7c04594c..b28b53ff5 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -20,11 +20,7 @@ jobs: - name: Check the format run: cargo fmt --all -- --check - # type complexity must be ignored because we use huge templates for queries + # Clippy overly_complex_bool_expr is disabled because mess with generated files in target dir + # and I cannot disable it - name: Run clippy - run: > - cargo clippy - --all-targets - --all-features - -- - -D warnings + run: cargo clippy --all-targets --all-features -- -A clippy::overly_complex_bool_expr -D warnings diff --git a/czkawka_slint_gui/.clippy.toml b/czkawka_slint_gui/.clippy.toml new file mode 100644 index 000000000..e69de29bb diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index 953e5707b..648f6a5cd 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -20,7 +20,7 @@ pub fn connect_delete_button(app: &MainWindow) { *selected_row = false; }); let r = ModelRc::new(VecModel::from(entries_left)); - app.set_empty_folder_model(r.into()); + app.set_empty_folder_model(r); } }); } diff --git a/czkawka_slint_gui/src/connect_open.rs b/czkawka_slint_gui/src/connect_open.rs index 731679015..cfd56fcf7 100644 --- a/czkawka_slint_gui/src/connect_open.rs +++ b/czkawka_slint_gui/src/connect_open.rs @@ -1,6 +1,4 @@ use crate::MainWindow; -use slint::{ComponentHandle, Model, ModelRc, SharedString, VecModel}; -use std::borrow::BorrowMut; pub fn connect_open_items(app: &MainWindow) { app.on_item_opened(move |path| { diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 9c857a1bc..8422ef078 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -24,15 +24,16 @@ fn main() { app.run().unwrap(); } +type ModelType = VecModel<(bool, bool, bool, ModelRc)>; // TODO remove this after trying pub fn to_remove_debug(app: &MainWindow) { - let row_data: Rc)>> = Rc::new(VecModel::default()); + let row_data: Rc = Rc::new(VecModel::default()); - for r in 0..100000 { + for r in 0..100_000 { let items = VecModel::default(); for c in 0..3 { - items.push(slint::format!("Item {r}.{c}").into()); + items.push(slint::format!("Item {r}.{c}")); } row_data.push((r % 2 == 0, r % 3 == 0, false, ModelRc::new(items))); From 6d8fe135ce053aa317643efbb9dd39acadae18dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 22 Oct 2023 22:12:59 +0200 Subject: [PATCH 014/107] Make --- Cargo.lock | 1 + czkawka_slint_gui/Cargo.toml | 1 + .../src/connect_progress_receiver.rs | 39 +++++++++++++++++++ czkawka_slint_gui/src/connect_scan.rs | 17 +++++--- czkawka_slint_gui/src/main.rs | 11 +++++- czkawka_slint_gui/ui/action_buttons.slint | 1 - czkawka_slint_gui/ui/common.slint | 6 +++ czkawka_slint_gui/ui/main_window.slint | 30 ++++++++++---- .../ui/selectable_tree_view.slint | 22 +++++++++-- 9 files changed, 109 insertions(+), 19 deletions(-) create mode 100644 czkawka_slint_gui/src/connect_progress_receiver.rs diff --git a/Cargo.lock b/Cargo.lock index 1cff48570..4d4986e28 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1328,6 +1328,7 @@ name = "czkawka_slint" version = "6.1.0" dependencies = [ "chrono", + "crossbeam-channel", "czkawka_core", "open", "rand", diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index ee1e794bf..fd1c0ebf7 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -17,6 +17,7 @@ rand = "0.8.5" czkawka_core = { version = "6.1.0", path = "../czkawka_core" } chrono = "0.4.31" open="5.0.0" +crossbeam-channel = "0.5.8" [build-dependencies] #slint-build = "1.2.2" diff --git a/czkawka_slint_gui/src/connect_progress_receiver.rs b/czkawka_slint_gui/src/connect_progress_receiver.rs new file mode 100644 index 000000000..b3ea2a355 --- /dev/null +++ b/czkawka_slint_gui/src/connect_progress_receiver.rs @@ -0,0 +1,39 @@ +use crate::{MainWindow, ProgressToSend}; +use crossbeam_channel::Receiver; +use czkawka_core::common_dir_traversal::ProgressData; +use slint::{ComponentHandle, SharedString}; +use std::thread; + +pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver) { + let a = app.as_weak(); + + thread::spawn(move || loop { + let progress_data = progress_receiver.recv().unwrap(); + + a.upgrade_in_event_loop(move |app| { + let (all_stages, current_stage) = common_get_data(&progress_data); + let to_send = ProgressToSend { + all_progress: (all_stages * 100.0) as i32, + current_progress: (current_stage * 100.0) as i32, + step_name: SharedString::from(format!("Checked {} folders", progress_data.entries_checked)), + }; + + app.set_progress_datas(to_send); + }) + .unwrap(); + }); +} +fn common_get_data(item: &ProgressData) -> (f64, f64) { + if item.entries_to_check != 0 { + let all_stages = (item.current_stage as f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64; + let all_stages = if all_stages > 0.99 { 0.99 } else { all_stages }; + + let current_stage = (item.entries_checked) as f64 / item.entries_to_check as f64; + let current_stage = if current_stage > 0.99 { 0.99 } else { current_stage }; + (all_stages, current_stage) + } else { + let all_stages = (item.current_stage as f64) / (item.max_stage + 1) as f64; + let all_stages = if all_stages > 0.99 { 0.99 } else { all_stages }; + (all_stages, 0f64) + } +} diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index 8faa70651..774c59d50 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -1,5 +1,7 @@ -use crate::{split_path, CurrentTab, MainWindow}; +use crate::{split_path, CurrentTab, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; +use crossbeam_channel::Sender; +use czkawka_core::common_dir_traversal::ProgressData; use czkawka_core::common_tool::CommonData; use czkawka_core::empty_folder::EmptyFolder; use slint::{ComponentHandle, ModelRc, SharedString, VecModel, Weak}; @@ -7,27 +9,32 @@ use std::path::PathBuf; use std::rc::Rc; use std::thread; -pub fn connect_scan_button(app: &MainWindow) { +pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender) { let a = app.as_weak(); app.on_scanned(move |active_tab| { let app = a.upgrade().unwrap(); app.set_scanning(true); + app.set_progress_datas(ProgressToSend { + all_progress: 0, + current_progress: 0, + step_name: SharedString::from(""), + }); let a = app.as_weak(); match active_tab { CurrentTab::EmptyFolders => { - scan_empty_folders(a); + scan_empty_folders(a, &progress_sender); } _ => panic!(), } }); } -fn scan_empty_folders(a: Weak) { +fn scan_empty_folders(a: Weak, progress_sender: &Sender) { thread::spawn(move || { let mut ef = EmptyFolder::new(); ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); - ef.find_empty_folders(None, None); + ef.find_empty_folders(None, Some(progress_sender)); ef.get_empty_folder_list(); diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 8422ef078..095094f17 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,7 +1,9 @@ mod connect_delete; mod connect_open; +mod connect_progress_receiver; mod connect_scan; +use crossbeam_channel::{unbounded, Receiver, Sender}; use std::path::Path; use std::rc::Rc; @@ -9,17 +11,22 @@ use crate::connect_delete::connect_delete_button; use crate::connect_open::connect_open_items; use crate::connect_scan::connect_scan_button; +use crate::connect_progress_receiver::connect_progress_gathering; +use czkawka_core::common_dir_traversal::ProgressData; use slint::{ModelRc, SharedString, VecModel}; slint::include_modules!(); fn main() { let app = MainWindow::new().unwrap(); //.run().unwrap(); + let (progress_sender, progress_receiver): (Sender, Receiver) = unbounded(); + // Fills model at start, don't really needed too much after testing to_remove_debug(&app); connect_delete_button(&app); - connect_scan_button(&app); + connect_scan_button(&app, progress_sender); connect_open_items(&app); + connect_progress_gathering(&app, progress_receiver); app.run().unwrap(); } @@ -29,7 +36,7 @@ type ModelType = VecModel<(bool, bool, bool, ModelRc)>; pub fn to_remove_debug(app: &MainWindow) { let row_data: Rc = Rc::new(VecModel::default()); - for r in 0..100_000 { + for r in 0..1_000_000 { let items = VecModel::default(); for c in 0..3 { diff --git a/czkawka_slint_gui/ui/action_buttons.slint b/czkawka_slint_gui/ui/action_buttons.slint index 79095d664..e173b314e 100644 --- a/czkawka_slint_gui/ui/action_buttons.slint +++ b/czkawka_slint_gui/ui/action_buttons.slint @@ -1,5 +1,4 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; -import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; import {MainList} from "main_lists.slint"; import {CurrentTab} from "common.slint"; diff --git a/czkawka_slint_gui/ui/common.slint b/czkawka_slint_gui/ui/common.slint index b1de47207..700cae136 100644 --- a/czkawka_slint_gui/ui/common.slint +++ b/czkawka_slint_gui/ui/common.slint @@ -7,4 +7,10 @@ export enum CurrentTab { export enum TypeOfOpenedItem { CurrentItem, ParentItem, +} + +export struct ProgressToSend { + current_progress: int, + all_progress: int, + step_name: string, } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 21f4f63a6..2a28e5db2 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -2,19 +2,26 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; import {MainList} from "main_lists.slint"; -import {CurrentTab} from "common.slint"; +import {CurrentTab, ProgressToSend} from "common.slint"; import { ActionButtons } from "action_buttons.slint"; +import { Progress } from "progress.slint"; export component MainWindow inherits Window { callback deleted; callback scanned(CurrentTab); callback item_opened(string); + min-width: 300px; preferred-width: 1024px; min-height: 300px; preferred-height: 600px; in-out property scanning: false; + in-out property progress_datas : { + current_progress: 15, + all_progress: 20, + step_name: "Cache", + }; in-out property active-tab: CurrentTab.EmptyFolders; in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_folder_model: [ @@ -63,14 +70,21 @@ export component MainWindow inherits Window { active-tab <=> root.active-tab; } - MainList { + VerticalLayout { horizontal-stretch: 1.0; - active-tab <=> root.active-tab; - empty_folder_model <=> root.empty_folder_model; - empty_files_model <=> root.empty_files_model; - similar_images_model <=> root.similar_images_model; - - item_opened(item) => {item_opened(item)} + MainList { + vertical-stretch: 1.0; + active-tab <=> root.active-tab; + empty_folder_model <=> root.empty_folder_model; + empty_files_model <=> root.empty_files_model; + similar_images_model <=> root.similar_images_model; + + item_opened(item) => {item_opened(item)} + } + Progress { + horizontal-stretch: 0.0; + progress_datas <=> root.progress_datas; + } } } ActionButtons { diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 7288be55c..019d3dcf3 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -18,9 +18,18 @@ export component SelectableTableView inherits Rectangle { in-out property selected_item: -1; + forward-focus: focus_item; + + focus_item := FocusScope { + key-released(event) => { + debug(event); + accept + } + } + VerticalBox { padding: 5px; - // Widgets + forward-focus: focus-item; HorizontalLayout { padding: 5px; spacing: 5px; @@ -32,11 +41,13 @@ export component SelectableTableView inherits Rectangle { Rectangle { width: 1px; background: gray; + forward-focus: focus-item; TouchArea { width: 5px; x: (parent.width - self.width) / 2; property cached; + forward-focus: focus-item; pointer-event(event) => { if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) { self.cached = root.column_sizes[idx]; @@ -58,14 +69,17 @@ export component SelectableTableView inherits Rectangle { } list_view := ListView { min-width: 100px; + forward-focus: focus-item; for r[idx] in root.values : Rectangle { + forward-focus: focus-item; height: 30px; // TODO move this into singleton background: r.header-row ? #888888 : (touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd)); // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); touch_area:= TouchArea { + forward-focus: focus-item; clicked => { if (!r.header_row) { r.selected_row = !r.selected_row; @@ -82,6 +96,7 @@ export component SelectableTableView inherits Rectangle { } } pointer-event(event) => { + debug(event); // TODO this should be clicked by double-click if (event.button == PointerEventButton.right && event.kind == PointerEventKind.up) { root.item_opened(r.val[root.parentPathIdx - 1]) @@ -94,16 +109,16 @@ export component SelectableTableView inherits Rectangle { HorizontalLayout { padding: 5px; spacing: 5px; + forward-focus: focus-item; CheckBox { - //min-width: 200px; visible: !r.header-row; checked: r.checked && !r.header-row; width: root.column-sizes[0]; + forward-focus: focus-item; toggled => { r.checked = self.checked; } - // preferred-width: root.column-sizes[0]; } HorizontalLayout { @@ -112,6 +127,7 @@ export component SelectableTableView inherits Rectangle { width: root.column-sizes[idx + 1]; text: f; font-size: 12px; + forward-focus: focus-item; vertical-alignment: center; From 674d4798f7abd06c56650ed715746e9160a2e939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 22 Oct 2023 22:55:20 +0200 Subject: [PATCH 015/107] Crossbeam instead futures --- Cargo.lock | 19 ------- czkawka_core/Cargo.toml | 3 -- czkawka_core/src/bad_extensions.rs | 9 ++-- czkawka_core/src/big_file.rs | 7 ++- czkawka_core/src/broken_files.rs | 9 ++-- czkawka_core/src/common.rs | 6 +-- czkawka_core/src/common_dir_traversal.rs | 9 ++-- czkawka_core/src/duplicate.rs | 22 +++----- czkawka_core/src/empty_files.rs | 7 ++- czkawka_core/src/empty_folder.rs | 7 ++- czkawka_core/src/invalid_symlinks.rs | 7 ++- czkawka_core/src/same_music.rs | 18 +++---- czkawka_core/src/similar_images.rs | 14 ++--- czkawka_core/src/similar_videos.rs | 9 ++-- czkawka_core/src/temporary.rs | 7 ++- czkawka_gui/Cargo.toml | 3 -- .../connect_things/connect_button_search.rs | 51 +++++++++---------- .../connect_things/connect_progress_window.rs | 41 ++++++++------- czkawka_gui/src/main.rs | 5 +- .../src/connect_progress_receiver.rs | 1 + czkawka_slint_gui/src/connect_scan.rs | 7 +-- 21 files changed, 114 insertions(+), 147 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d4986e28..5986015ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1263,7 +1263,6 @@ dependencies = [ "directories-next", "ffmpeg_cmdline_utils", "fun_time", - "futures", "hamming", "handsome_logger", "humansize", @@ -1304,7 +1303,6 @@ dependencies = [ "directories-next", "fs_extra", "fun_time", - "futures", "gdk4", "glib", "gtk4", @@ -2000,21 +1998,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.28" @@ -2022,7 +2005,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", - "futures-sink", ] [[package]] @@ -2092,7 +2074,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ - "futures-channel", "futures-core", "futures-io", "futures-macro", diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index b8bc8193c..36b6c1ef2 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -28,9 +28,6 @@ hamming = "0.1" bitflags = "2.4" lofty = "0.16" -# Futures - needed by async progress sender -futures = "0.3.28" - # Needed by broken files zip = { version = "0.6", features = ["aes-crypto", "bzip2", "deflate", "time"], default-features = false } audio_checker = "0.1" diff --git a/czkawka_core/src/bad_extensions.rs b/czkawka_core/src/bad_extensions.rs index c2bc3b60c..0e2c4e03f 100644 --- a/czkawka_core/src/bad_extensions.rs +++ b/czkawka_core/src/bad_extensions.rs @@ -5,9 +5,8 @@ use std::path::PathBuf; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::Arc; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use log::debug; use mime_guess::get_mime_extensions; use rayon::prelude::*; @@ -195,7 +194,7 @@ impl BadExtensions { } #[fun_time(message = "find_bad_extensions_files", level = "info")] - pub fn find_bad_extensions_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_bad_extensions_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); if !self.check_files(stop_receiver, progress_sender) { self.common_data.stopped_search = true; @@ -209,7 +208,7 @@ impl BadExtensions { } #[fun_time(message = "check_files", level = "debug")] - fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let result = DirTraversalBuilder::new() .root_dirs(self.common_data.directories.included_directories.clone()) .group_by(|_fe| ()) @@ -239,7 +238,7 @@ impl BadExtensions { } #[fun_time(message = "look_for_bad_extensions_files", level = "debug")] - fn look_for_bad_extensions_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn look_for_bad_extensions_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let (progress_thread_handle, progress_thread_run, atomic_counter, check_was_stopped) = prepare_thread_handler_common(progress_sender, 1, 1, self.files_to_check.len(), CheckingMethod::None, self.get_cd().tool_type); diff --git a/czkawka_core/src/big_file.rs b/czkawka_core/src/big_file.rs index 58ac2fa5e..d5815f771 100644 --- a/czkawka_core/src/big_file.rs +++ b/czkawka_core/src/big_file.rs @@ -6,9 +6,8 @@ use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use humansize::{format_size, BINARY}; use log::debug; use rayon::prelude::*; @@ -57,7 +56,7 @@ impl BigFile { } #[fun_time(message = "find_big_files", level = "info")] - pub fn find_big_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_big_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); if !self.look_for_big_files(stop_receiver, progress_sender) { self.common_data.stopped_search = true; @@ -68,7 +67,7 @@ impl BigFile { } #[fun_time(message = "look_for_big_files", level = "debug")] - fn look_for_big_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn look_for_big_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let mut folders_to_check: Vec = Vec::with_capacity(1024 * 2); // This should be small enough too not see to big difference and big enough to store most of paths without needing to resize vector let mut old_map: BTreeMap> = Default::default(); diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 31f52598b..5c568453b 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -7,9 +7,8 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use std::{fs, mem, panic}; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use log::debug; use pdf::file::FileOptions; use pdf::object::ParseOptions; @@ -93,7 +92,7 @@ impl BrokenFiles { } #[fun_time(message = "find_broken_files", level = "info")] - pub fn find_broken_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_broken_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); if !self.check_files(stop_receiver, progress_sender) { self.common_data.stopped_search = true; @@ -108,7 +107,7 @@ impl BrokenFiles { } #[fun_time(message = "check_files", level = "debug")] - fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let mut folders_to_check: Vec = Vec::with_capacity(1024 * 2); // This should be small enough too not see to big difference and big enough to store most of paths without needing to resize vector // Add root folders for finding @@ -347,7 +346,7 @@ impl BrokenFiles { } #[fun_time(message = "look_for_broken_files", level = "debug")] - fn look_for_broken_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn look_for_broken_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let (loaded_hash_map, records_already_cached, non_cached_files_to_check) = self.load_cache(); let (progress_thread_handle, progress_thread_run, atomic_counter, _check_was_stopped) = diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 7a715fef2..7158bdc94 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -10,9 +10,9 @@ use std::{fs, thread}; #[cfg(feature = "heif")] use anyhow::Result; +use crossbeam_channel::Sender; use directories_next::ProjectDirs; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use handsome_logger::{ColorChoice, ConfigBuilder, TerminalMode}; use image::{DynamicImage, ImageBuffer, Rgb}; use imagepipe::{ImageSource, Pipeline}; @@ -460,7 +460,7 @@ where } pub fn prepare_thread_handler_common( - progress_sender: Option<&UnboundedSender>, + progress_sender: Option<&Sender>, current_stage: u8, max_stage: u8, max_value: usize, @@ -480,7 +480,7 @@ pub fn prepare_thread_handler_common( loop { if time_since_last_send.elapsed().unwrap().as_millis() > SEND_PROGRESS_DATA_TIME_BETWEEN as u128 { progress_send - .unbounded_send(ProgressData { + .send(ProgressData { checking_method, current_stage, max_stage, diff --git a/czkawka_core/src/common_dir_traversal.rs b/czkawka_core/src/common_dir_traversal.rs index 40db1b129..65db63377 100644 --- a/czkawka_core/src/common_dir_traversal.rs +++ b/czkawka_core/src/common_dir_traversal.rs @@ -5,9 +5,8 @@ use std::path::{Path, PathBuf}; use std::sync::atomic::Ordering; use std::time::UNIX_EPOCH; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use log::debug; use rayon::prelude::*; use serde::{Deserialize, Serialize}; @@ -136,7 +135,7 @@ pub struct DirTraversalBuilder<'a, 'b, F> { group_by: Option, root_dirs: Vec, stop_receiver: Option<&'a Receiver<()>>, - progress_sender: Option<&'b UnboundedSender>, + progress_sender: Option<&'b Sender>, minimal_file_size: Option, maximal_file_size: Option, checking_method: CheckingMethod, @@ -153,7 +152,7 @@ pub struct DirTraversal<'a, 'b, F> { group_by: F, root_dirs: Vec, stop_receiver: Option<&'a Receiver<()>>, - progress_sender: Option<&'b UnboundedSender>, + progress_sender: Option<&'b Sender>, recursive_search: bool, directories: Directories, excluded_items: ExcludedItems, @@ -204,7 +203,7 @@ impl<'a, 'b, F> DirTraversalBuilder<'a, 'b, F> { self } - pub fn progress_sender(mut self, progress_sender: Option<&'b UnboundedSender>) -> Self { + pub fn progress_sender(mut self, progress_sender: Option<&'b Sender>) -> Self { self.progress_sender = progress_sender; self } diff --git a/czkawka_core/src/duplicate.rs b/czkawka_core/src/duplicate.rs index ba3813785..a98a0db60 100644 --- a/czkawka_core/src/duplicate.rs +++ b/czkawka_core/src/duplicate.rs @@ -10,9 +10,8 @@ use std::path::Path; use std::sync::atomic::Ordering; use std::{fs, mem}; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use humansize::{format_size, BINARY}; use log::debug; use rayon::prelude::*; @@ -111,7 +110,7 @@ impl DuplicateFinder { } #[fun_time(message = "find_duplicates", level = "info")] - pub fn find_duplicates(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_duplicates(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); self.common_data.use_reference_folders = !self.common_data.directories.reference_directories.is_empty(); @@ -151,7 +150,7 @@ impl DuplicateFinder { } #[fun_time(message = "check_files_name", level = "debug")] - fn check_files_name(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files_name(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let group_by_func = if self.case_sensitive_name_comparison { |fe: &FileEntry| fe.path.file_name().unwrap().to_string_lossy().to_string() } else { @@ -226,7 +225,7 @@ impl DuplicateFinder { } #[fun_time(message = "check_files_size_name", level = "debug")] - fn check_files_size_name(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files_size_name(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let group_by_func = if self.case_sensitive_name_comparison { |fe: &FileEntry| (fe.size, fe.path.file_name().unwrap().to_string_lossy().to_string()) } else { @@ -303,7 +302,7 @@ impl DuplicateFinder { } #[fun_time(message = "check_files_size", level = "debug")] - fn check_files_size(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files_size(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let max_stage = match self.check_method { CheckingMethod::Size => 0, CheckingMethod::Hash => MAX_STAGE, @@ -491,7 +490,7 @@ impl DuplicateFinder { fn prehashing( &mut self, stop_receiver: Option<&Receiver<()>>, - progress_sender: Option<&UnboundedSender>, + progress_sender: Option<&Sender>, pre_checked_map: &mut BTreeMap>, ) -> Option<()> { let check_type = self.hash_type; @@ -679,12 +678,7 @@ impl DuplicateFinder { } #[fun_time(message = "full_hashing", level = "debug")] - fn full_hashing( - &mut self, - stop_receiver: Option<&Receiver<()>>, - progress_sender: Option<&UnboundedSender>, - pre_checked_map: BTreeMap>, - ) -> Option<()> { + fn full_hashing(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>, pre_checked_map: BTreeMap>) -> Option<()> { let (progress_thread_handle, progress_thread_run, _atomic_counter, _check_was_stopped) = prepare_thread_handler_common(progress_sender, 4, MAX_STAGE, 0, self.check_method, self.common_data.tool_type); @@ -805,7 +799,7 @@ impl DuplicateFinder { } #[fun_time(message = "check_files_hash", level = "debug")] - fn check_files_hash(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files_hash(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { assert_eq!(self.check_method, CheckingMethod::Hash); let mut pre_checked_map: BTreeMap> = Default::default(); diff --git a/czkawka_core/src/empty_files.rs b/czkawka_core/src/empty_files.rs index a4acedf3d..2360b9e1a 100644 --- a/czkawka_core/src/empty_files.rs +++ b/czkawka_core/src/empty_files.rs @@ -2,9 +2,8 @@ use std::fs; use std::io::prelude::*; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use log::debug; use crate::common_dir_traversal::{DirTraversalBuilder, DirTraversalResult, FileEntry, ProgressData, ToolType}; @@ -41,7 +40,7 @@ impl EmptyFiles { } #[fun_time(message = "find_empty_files", level = "info")] - pub fn find_empty_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_empty_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); if !self.check_files(stop_receiver, progress_sender) { self.common_data.stopped_search = true; @@ -52,7 +51,7 @@ impl EmptyFiles { } #[fun_time(message = "check_files", level = "debug")] - fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let result = DirTraversalBuilder::new() .root_dirs(self.common_data.directories.included_directories.clone()) .group_by(|_fe| ()) diff --git a/czkawka_core/src/empty_folder.rs b/czkawka_core/src/empty_folder.rs index ed5fa99c0..73050f0e1 100644 --- a/czkawka_core/src/empty_folder.rs +++ b/czkawka_core/src/empty_folder.rs @@ -3,9 +3,8 @@ use std::fs; use std::io::Write; use std::path::PathBuf; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use log::debug; use rayon::prelude::*; @@ -42,7 +41,7 @@ impl EmptyFolder { } #[fun_time(message = "find_empty_folders", level = "info")] - pub fn find_empty_folders(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_empty_folders(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); if !self.check_for_empty_folders(stop_receiver, progress_sender) { self.common_data.stopped_search = true; @@ -74,7 +73,7 @@ impl EmptyFolder { } #[fun_time(message = "check_for_empty_folders", level = "debug")] - fn check_for_empty_folders(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_for_empty_folders(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let result = DirTraversalBuilder::new() .root_dirs(self.common_data.directories.included_directories.clone()) .group_by(|_fe| ()) diff --git a/czkawka_core/src/invalid_symlinks.rs b/czkawka_core/src/invalid_symlinks.rs index fd57ae6c9..a3d036b42 100644 --- a/czkawka_core/src/invalid_symlinks.rs +++ b/czkawka_core/src/invalid_symlinks.rs @@ -2,9 +2,8 @@ use std::fs; use std::io::prelude::*; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use log::debug; use crate::common_dir_traversal::{Collect, DirTraversalBuilder, DirTraversalResult, ErrorType, FileEntry, ProgressData, ToolType}; @@ -31,7 +30,7 @@ impl InvalidSymlinks { } #[fun_time(message = "find_invalid_links", level = "info")] - pub fn find_invalid_links(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_invalid_links(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); if !self.check_files(stop_receiver, progress_sender) { self.common_data.stopped_search = true; @@ -42,7 +41,7 @@ impl InvalidSymlinks { } #[fun_time(message = "check_files", level = "debug")] - fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let result = DirTraversalBuilder::new() .root_dirs(self.common_data.directories.included_directories.clone()) .group_by(|_fe| ()) diff --git a/czkawka_core/src/same_music.rs b/czkawka_core/src/same_music.rs index 84e339dc8..178e308c7 100644 --- a/czkawka_core/src/same_music.rs +++ b/czkawka_core/src/same_music.rs @@ -9,9 +9,9 @@ use std::sync::Arc; use std::{mem, panic}; use anyhow::Context; -use crossbeam_channel::Receiver; + +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use humansize::{format_size, BINARY}; use lofty::{read_from, AudioFile, ItemKey, TaggedFileExt}; use log::debug; @@ -137,7 +137,7 @@ impl SameMusic { } #[fun_time(message = "find_same_music", level = "info")] - pub fn find_same_music(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_same_music(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); self.common_data.use_reference_folders = !self.common_data.directories.reference_directories.is_empty(); if !self.check_files(stop_receiver, progress_sender) { @@ -176,7 +176,7 @@ impl SameMusic { } #[fun_time(message = "check_files", level = "debug")] - fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { if !self.common_data.allowed_extensions.using_custom_extensions() { self.common_data.allowed_extensions.extend_allowed_extensions(AUDIO_FILES_EXTENSIONS); } else { @@ -277,7 +277,7 @@ impl SameMusic { } #[fun_time(message = "calculate_fingerprint", level = "debug")] - fn calculate_fingerprint(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn calculate_fingerprint(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let (progress_thread_handle, progress_thread_run, _atomic_counter, _check_was_stopped) = prepare_thread_handler_common(progress_sender, 1, MAX_STAGE_CONTENT, 0, self.check_type, self.common_data.tool_type); @@ -341,7 +341,7 @@ impl SameMusic { } #[fun_time(message = "read_tags", level = "debug")] - fn read_tags(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn read_tags(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let (progress_thread_handle, progress_thread_run, _atomic_counter, _check_was_stopped) = prepare_thread_handler_common(progress_sender, 1, MAX_STAGE_TAGS, 0, self.check_type, self.common_data.tool_type); @@ -404,7 +404,7 @@ impl SameMusic { } #[fun_time(message = "check_for_duplicate_tags", level = "debug")] - fn check_for_duplicate_tags(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_for_duplicate_tags(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let (progress_thread_handle, progress_thread_run, atomic_counter, _check_was_stopped) = prepare_thread_handler_common(progress_sender, 4, MAX_STAGE_TAGS, self.music_to_check.len(), self.check_type, self.common_data.tool_type); @@ -503,7 +503,7 @@ impl SameMusic { true } #[fun_time(message = "read_tags_to_files_similar_by_content", level = "debug")] - fn read_tags_to_files_similar_by_content(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn read_tags_to_files_similar_by_content(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let groups_to_check = max(self.duplicated_music_entries.len(), self.duplicated_music_entries_referenced.len()); let (progress_thread_handle, progress_thread_run, atomic_counter, check_was_stopped) = prepare_thread_handler_common(progress_sender, 5, MAX_STAGE_CONTENT, groups_to_check, self.check_type, self.common_data.tool_type); @@ -629,7 +629,7 @@ impl SameMusic { } #[fun_time(message = "check_for_duplicate_fingerprints", level = "debug")] - fn check_for_duplicate_fingerprints(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_for_duplicate_fingerprints(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let (base_files, files_to_compare) = self.split_fingerprints_to_check(); let (progress_thread_handle, progress_thread_run, atomic_counter, _check_was_stopped) = prepare_thread_handler_common(progress_sender, 2, 3, base_files.len(), self.check_type, self.common_data.tool_type); diff --git a/czkawka_core/src/similar_images.rs b/czkawka_core/src/similar_images.rs index 8055f9da5..43a4425fe 100644 --- a/czkawka_core/src/similar_images.rs +++ b/czkawka_core/src/similar_images.rs @@ -7,9 +7,9 @@ use std::time::SystemTime; use std::{mem, panic}; use bk_tree::BKTree; -use crossbeam_channel::Receiver; + +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use humansize::{format_size, BINARY}; use image::GenericImageView; use image_hasher::{FilterType, HashAlg, HasherConfig}; @@ -125,7 +125,7 @@ impl SimilarImages { } #[fun_time(message = "find_similar_images", level = "info")] - pub fn find_similar_images(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_similar_images(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); self.common_data.use_reference_folders = !self.common_data.directories.reference_directories.is_empty(); if !self.check_for_similar_images(stop_receiver, progress_sender) { @@ -145,7 +145,7 @@ impl SimilarImages { } #[fun_time(message = "check_for_similar_images", level = "debug")] - fn check_for_similar_images(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_for_similar_images(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let mut folders_to_check: Vec = Vec::with_capacity(1024 * 2); // This should be small enough too not see to big difference and big enough to store most of paths without needing to resize vector if !self.common_data.allowed_extensions.using_custom_extensions() { @@ -304,7 +304,7 @@ impl SimilarImages { // - Join all hashes and save it to file #[fun_time(message = "hash_images", level = "debug")] - fn hash_images(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn hash_images(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let (loaded_hash_map, records_already_cached, non_cached_files_to_check) = self.hash_images_load_cache(); let (progress_thread_handle, progress_thread_run, atomic_counter, check_was_stopped) = @@ -550,7 +550,7 @@ impl SimilarImages { &mut self, all_hashed_images: &HashMap>, collected_similar_images: &mut HashMap>, - progress_sender: Option<&UnboundedSender>, + progress_sender: Option<&Sender>, stop_receiver: Option<&Receiver<()>>, tolerance: u32, ) -> bool { @@ -684,7 +684,7 @@ impl SimilarImages { } #[fun_time(message = "find_similar_hashes", level = "debug")] - fn find_similar_hashes(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn find_similar_hashes(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { if self.image_hashes.is_empty() { return true; } diff --git a/czkawka_core/src/similar_videos.rs b/czkawka_core/src/similar_videos.rs index d76bd2ffc..3d162ba71 100644 --- a/czkawka_core/src/similar_videos.rs +++ b/czkawka_core/src/similar_videos.rs @@ -5,10 +5,9 @@ use std::mem; use std::path::{Path, PathBuf}; use std::sync::atomic::Ordering; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use ffmpeg_cmdline_utils::FfmpegErrorKind::FfmpegNotFound; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use humansize::{format_size, BINARY}; use rayon::prelude::*; use serde::{Deserialize, Serialize}; @@ -103,7 +102,7 @@ impl SimilarVideos { } #[fun_time(message = "find_similar_videos", level = "info")] - pub fn find_similar_videos(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_similar_videos(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { if !check_if_ffmpeg_is_installed() { self.common_data.text_messages.errors.push(flc!("core_ffmpeg_not_found")); #[cfg(target_os = "windows")] @@ -130,7 +129,7 @@ impl SimilarVideos { } #[fun_time(message = "check_for_similar_videos", level = "debug")] - fn check_for_similar_videos(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_for_similar_videos(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let mut folders_to_check: Vec = Vec::with_capacity(1024 * 2); // This should be small enough too not see to big difference and big enough to store most of paths without needing to resize vector if !self.common_data.allowed_extensions.using_custom_extensions() { @@ -266,7 +265,7 @@ impl SimilarVideos { } #[fun_time(message = "sort_videos", level = "debug")] - fn sort_videos(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn sort_videos(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let (loaded_hash_map, records_already_cached, non_cached_files_to_check) = self.load_cache_at_start(); let (progress_thread_handle, progress_thread_run, atomic_counter, check_was_stopped) = diff --git a/czkawka_core/src/temporary.rs b/czkawka_core/src/temporary.rs index 0785303c2..ac17539a6 100644 --- a/czkawka_core/src/temporary.rs +++ b/czkawka_core/src/temporary.rs @@ -6,9 +6,8 @@ use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; use rayon::prelude::*; use serde::Serialize; @@ -60,7 +59,7 @@ impl Temporary { } #[fun_time(message = "find_temporary_files", level = "info")] - pub fn find_temporary_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) { + pub fn find_temporary_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) { self.optimize_dirs_before_start(); if !self.check_files(stop_receiver, progress_sender) { self.common_data.stopped_search = true; @@ -71,7 +70,7 @@ impl Temporary { } #[fun_time(message = "check_files", level = "debug")] - fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&UnboundedSender>) -> bool { + fn check_files(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&Sender>) -> bool { let mut folders_to_check: Vec = Vec::with_capacity(1024 * 2); // This should be small enough too not see to big difference and big enough to store most of paths without needing to resize vector // Add root folders for finding diff --git a/czkawka_gui/Cargo.toml b/czkawka_gui/Cargo.toml index 7db4db605..f76f38018 100644 --- a/czkawka_gui/Cargo.toml +++ b/czkawka_gui/Cargo.toml @@ -19,9 +19,6 @@ chrono = "0.4.31" # Used for sending stop signal across threads crossbeam-channel = "0.5.8" -# To get information about progress -futures = "0.3.28" - # For saving/loading config files to specific directories directories-next = "2.0" diff --git a/czkawka_gui/src/connect_things/connect_button_search.rs b/czkawka_gui/src/connect_things/connect_button_search.rs index 4468eb6da..077e3d885 100644 --- a/czkawka_gui/src/connect_things/connect_button_search.rs +++ b/czkawka_gui/src/connect_things/connect_button_search.rs @@ -3,10 +3,9 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; -use crossbeam_channel::Receiver; +use crossbeam_channel::{Receiver, Sender}; use fun_time::fun_time; -use futures::channel::mpsc::UnboundedSender; -use glib::Sender; +use glib::Sender as glibSender; use gtk4::prelude::*; use gtk4::Grid; @@ -35,7 +34,7 @@ use crate::taskbar_progress::tbp_flags::TBPF_NOPROGRESS; use crate::{flg, DEFAULT_MAXIMAL_FILE_SIZE, DEFAULT_MINIMAL_CACHE_SIZE, DEFAULT_MINIMAL_FILE_SIZE}; #[allow(clippy::too_many_arguments)] -pub fn connect_button_search(gui_data: &GuiData, glib_stop_sender: Sender, progress_sender: UnboundedSender) { +pub fn connect_button_search(gui_data: &GuiData, glib_stop_sender: glibSender, progress_sender: Sender) { let buttons_array = gui_data.bottom_buttons.buttons_array.clone(); let buttons_search_clone = gui_data.bottom_buttons.buttons_search.clone(); let grid_progress_stages = gui_data.progress_window.grid_progress_stages.clone(); @@ -284,9 +283,9 @@ fn duplicate_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.show(); @@ -346,9 +345,9 @@ fn empty_files_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.hide(); @@ -373,9 +372,9 @@ fn empty_directories_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.hide(); @@ -397,9 +396,9 @@ fn big_files_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.hide(); @@ -433,9 +432,9 @@ fn temporary_files_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.hide(); @@ -459,9 +458,9 @@ fn same_music_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, show_dialog: &Arc, ) { grid_progress_stages.show(); @@ -561,9 +560,9 @@ fn broken_files_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, show_dialog: &Arc, ) { grid_progress_stages.show(); @@ -636,9 +635,9 @@ fn similar_image_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.show(); @@ -698,9 +697,9 @@ fn similar_video_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.show(); @@ -742,9 +741,9 @@ fn bad_symlinks_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.hide(); @@ -769,9 +768,9 @@ fn bad_extensions_search( gui_data: &GuiData, loaded_common_items: LoadedCommonItems, stop_receiver: Receiver<()>, - glib_stop_sender: Sender, + glib_stop_sender: glibSender, grid_progress_stages: &Grid, - progress_data_sender: UnboundedSender, + progress_data_sender: Sender, ) { grid_progress_stages.show(); diff --git a/czkawka_gui/src/connect_things/connect_progress_window.rs b/czkawka_gui/src/connect_things/connect_progress_window.rs index 955ad6bcf..1b99421da 100644 --- a/czkawka_gui/src/connect_things/connect_progress_window.rs +++ b/czkawka_gui/src/connect_things/connect_progress_window.rs @@ -1,9 +1,10 @@ +use crossbeam_channel::Receiver; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; -use futures::channel::mpsc::UnboundedReceiver; -use futures::StreamExt; +use std::time::Duration; + use glib::MainContext; use gtk4::prelude::*; use gtk4::ProgressBar; @@ -19,29 +20,35 @@ use crate::taskbar_progress::tbp_flags::TBPF_INDETERMINATE; use crate::taskbar_progress::TaskbarProgress; #[allow(clippy::too_many_arguments)] -pub fn connect_progress_window(gui_data: &GuiData, mut progress_receiver: UnboundedReceiver) { +pub fn connect_progress_window(gui_data: &GuiData, progress_receiver: Receiver) { let main_context = MainContext::default(); let _guard = main_context.acquire().unwrap(); let gui_data = gui_data.clone(); + let future = async move { - while let Some(item) = progress_receiver.next().await { - match item.tool_type { - ToolType::Duplicate => process_bar_duplicates(&gui_data, &item), - ToolType::EmptyFiles => process_bar_empty_files(&gui_data, &item), - ToolType::EmptyFolders => process_bar_empty_folder(&gui_data, &item), - ToolType::BigFile => process_bar_big_files(&gui_data, &item), - ToolType::SameMusic => process_bar_same_music(&gui_data, &item), - ToolType::SimilarImages => process_bar_similar_images(&gui_data, &item), - ToolType::SimilarVideos => process_bar_similar_videos(&gui_data, &item), - ToolType::TemporaryFiles => process_bar_temporary(&gui_data, &item), - ToolType::InvalidSymlinks => process_bar_invalid_symlinks(&gui_data, &item), - ToolType::BrokenFiles => process_bar_broken_files(&gui_data, &item), - ToolType::BadExtensions => process_bar_bad_extensions(&gui_data, &item), - ToolType::None => panic!(), + loop { + let item = progress_receiver.try_recv(); + if let Ok(item) = item { + match item.tool_type { + ToolType::Duplicate => process_bar_duplicates(&gui_data, &item), + ToolType::EmptyFiles => process_bar_empty_files(&gui_data, &item), + ToolType::EmptyFolders => process_bar_empty_folder(&gui_data, &item), + ToolType::BigFile => process_bar_big_files(&gui_data, &item), + ToolType::SameMusic => process_bar_same_music(&gui_data, &item), + ToolType::SimilarImages => process_bar_similar_images(&gui_data, &item), + ToolType::SimilarVideos => process_bar_similar_videos(&gui_data, &item), + ToolType::TemporaryFiles => process_bar_temporary(&gui_data, &item), + ToolType::InvalidSymlinks => process_bar_invalid_symlinks(&gui_data, &item), + ToolType::BrokenFiles => process_bar_broken_files(&gui_data, &item), + ToolType::BadExtensions => process_bar_bad_extensions(&gui_data, &item), + ToolType::None => panic!(), + } } + glib::timeout_future(Duration::from_millis(300)).await; } }; + main_context.spawn_local(future); } diff --git a/czkawka_gui/src/main.rs b/czkawka_gui/src/main.rs index 0707d96e1..e6853178d 100644 --- a/czkawka_gui/src/main.rs +++ b/czkawka_gui/src/main.rs @@ -5,11 +5,10 @@ #![allow(clippy::type_complexity)] #![allow(clippy::needless_late_init)] +use crossbeam_channel::{unbounded, Receiver, Sender}; use std::env; use std::ffi::OsString; -use futures::channel::mpsc; -use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender}; use glib::Priority; use gtk4::gio::ApplicationFlags; use gtk4::prelude::*; @@ -87,7 +86,7 @@ fn build_ui(application: &Application, arguments: &[OsString]) { let (glib_stop_sender, glib_stop_receiver) = glib::MainContext::channel(Priority::default()); // Futures progress report - let (progress_sender, progress_receiver): (UnboundedSender, UnboundedReceiver) = mpsc::unbounded(); + let (progress_sender, progress_receiver): (Sender, Receiver) = unbounded(); initialize_gui(&gui_data); validate_notebook_data(&gui_data); // Must be run after initialization of gui, to check if everything was properly setup diff --git a/czkawka_slint_gui/src/connect_progress_receiver.rs b/czkawka_slint_gui/src/connect_progress_receiver.rs index b3ea2a355..f13a4634a 100644 --- a/czkawka_slint_gui/src/connect_progress_receiver.rs +++ b/czkawka_slint_gui/src/connect_progress_receiver.rs @@ -1,4 +1,5 @@ use crate::{MainWindow, ProgressToSend}; + use crossbeam_channel::Receiver; use czkawka_core::common_dir_traversal::ProgressData; use slint::{ComponentHandle, SharedString}; diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index 774c59d50..53cef23be 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -12,6 +12,7 @@ use std::thread; pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender) { let a = app.as_weak(); app.on_scanned(move |active_tab| { + let progress_sender = progress_sender.clone(); let app = a.upgrade().unwrap(); app.set_scanning(true); app.set_progress_datas(ProgressToSend { @@ -23,18 +24,18 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender { - scan_empty_folders(a, &progress_sender); + scan_empty_folders(a, progress_sender); } _ => panic!(), } }); } -fn scan_empty_folders(a: Weak, progress_sender: &Sender) { +fn scan_empty_folders(a: Weak, progress_sender: Sender) { thread::spawn(move || { let mut ef = EmptyFolder::new(); ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); - ef.find_empty_folders(None, Some(progress_sender)); + ef.find_empty_folders(None, Some(&progress_sender)); ef.get_empty_folder_list(); From 00a532b4117aad41e82e60da20886d50499053a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 22 Oct 2023 23:18:01 +0200 Subject: [PATCH 016/107] PRG --- Cargo.lock | 222 +++++++++++++++++----------- czkawka_slint_gui/Cargo.toml | 4 +- czkawka_slint_gui/ui/progress.slint | 62 ++++++++ 3 files changed, 203 insertions(+), 85 deletions(-) create mode 100644 czkawka_slint_gui/ui/progress.slint diff --git a/Cargo.lock b/Cargo.lock index 5986015ea..a369d75f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -308,7 +308,7 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.25", + "rustix 0.37.26", "slab", "socket2", "waker-fn", @@ -336,7 +336,7 @@ dependencies = [ "cfg-if", "event-listener 3.0.0", "futures-lite", - "rustix 0.38.19", + "rustix 0.38.20", "windows-sys 0.48.0", ] @@ -363,7 +363,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.19", + "rustix 0.38.20", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -371,9 +371,9 @@ dependencies = [ [[package]] name = "async-task" -version = "4.4.1" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9441c6b2fe128a7c2bf680a44c34d0df31ce09e5b7e401fcca3faa483dbc921" +checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" [[package]] name = "async-trait" @@ -439,9 +439,9 @@ dependencies = [ [[package]] name = "auto_enums" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4ba50b181a898ce52142184e3a46641002b3b190bf5ef827eb3c578fad4b70" +checksum = "a764179c02b324e33cf71b4180e7dd13572400ff7e5c866da813f6c84e0e4cd3" dependencies = [ "derive_utils", "proc-macro2", @@ -959,7 +959,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "const-field-offset-macro", "field-offset", @@ -968,7 +968,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "proc-macro2", "quote", @@ -1136,9 +1136,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" dependencies = [ "libc", ] @@ -1376,7 +1376,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.1", + "hashbrown 0.14.2", "lock_api", "once_cell", "parking_lot_core", @@ -1539,21 +1539,44 @@ checksum = "edf9159ef4bcecd0c5e4cbeb573b8d0037493403d542780dba5d840bbf9df56f" dependencies = [ "bitflags 1.3.2", "bytemuck", - "drm-ffi", + "drm-ffi 0.5.0", "drm-fourcc", "nix 0.26.4", ] +[[package]] +name = "drm" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb1b703ffbc7ebd216eba7900008049a56ace55580ecb2ee7fa801e8d8be87" +dependencies = [ + "bitflags 2.4.1", + "bytemuck", + "drm-ffi 0.6.0", + "drm-fourcc", + "nix 0.27.1", +] + [[package]] name = "drm-ffi" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1352481b7b90e27a8a1bf8ef6b33cf18b98dba7c410e75c24bb3eef2f0d8d525" dependencies = [ - "drm-sys", + "drm-sys 0.4.0", "nix 0.26.4", ] +[[package]] +name = "drm-ffi" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba7d1c19c4b6270e89d59fb27dc6d02a317c658a8a54e54781e1db9b5947595d" +dependencies = [ + "drm-sys 0.5.0", + "nix 0.27.1", +] + [[package]] name = "drm-fourcc" version = "2.2.0" @@ -1569,6 +1592,12 @@ dependencies = [ "libc", ] +[[package]] +name = "drm-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4f1c0468062a56cd5705f1e3b5409eb286d5596a2028ec8e947595d7e715ae" + [[package]] name = "dwrote" version = "0.11.0" @@ -2092,7 +2121,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ec389cda876966cf824111bf6e533fb934c711d473498279964a990853b3c6" dependencies = [ "bitflags 1.3.2", - "drm", + "drm 0.9.0", "drm-fourcc", "gbm-sys", "libc", @@ -2582,9 +2611,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "heck" @@ -2634,10 +2663,10 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "calloop 0.11.0", - "drm", + "drm 0.9.0", "gbm", "glutin", "i-slint-common", @@ -2653,7 +2682,7 @@ dependencies = [ [[package]] name = "i-slint-backend-qt" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "const-field-offset", "cpp", @@ -2672,7 +2701,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2685,7 +2714,7 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "accesskit", "accesskit_winit", @@ -2723,7 +2752,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "cfg-if", "derive_more", @@ -2734,7 +2763,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "by_address", "codemap", @@ -2763,7 +2792,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "auto_enums", "bytemuck", @@ -2806,7 +2835,7 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "quote", "syn 2.0.38", @@ -2815,7 +2844,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "cfg-if", "const-field-offset", @@ -2848,7 +2877,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "cfg-if", "cfg_aliases", @@ -3069,7 +3098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.1", + "hashbrown 0.14.2", ] [[package]] @@ -3422,9 +3451,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -3581,6 +3610,15 @@ dependencies = [ "libc", ] +[[package]] +name = "memmap2" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deaba38d7abf1d4cca21cc89e932e542ba2b9258664d2a9ef0e61512039c9375" +dependencies = [ + "libc", +] + [[package]] name = "memoffset" version = "0.6.5" @@ -3739,7 +3777,6 @@ dependencies = [ "cfg-if", "libc", "memoffset 0.7.1", - "pin-utils", ] [[package]] @@ -4050,9 +4087,9 @@ dependencies = [ [[package]] name = "parking" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" @@ -4066,13 +4103,13 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "smallvec", "windows-targets 0.48.5", ] @@ -4357,9 +4394,9 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.28.2" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" dependencies = [ "memchr", ] @@ -4477,6 +4514,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -4702,9 +4748,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.25" +version = "0.37.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4eb579851244c2c03e7c24f501c3432bed80b8f720af1d6e5b0e0f01555a035" +checksum = "84f3f8f960ed3b5a59055428714943298bf3fa2d4a1d53135084e0544829d995" dependencies = [ "bitflags 1.3.2", "errno", @@ -4716,9 +4762,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.19" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ "bitflags 2.4.1", "errno", @@ -5028,7 +5074,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5044,7 +5090,7 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "i-slint-compiler", "spin_on", @@ -5055,7 +5101,7 @@ dependencies = [ [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -5140,9 +5186,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -5150,31 +5196,30 @@ dependencies = [ [[package]] name = "softbuffer" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd56fe5e6c6f1881aad2bd37acaef4ac4a3689c970dfcbd87a36a6e60210ec8" +checksum = "b0c651aec504a26e45df1f8c8df237ee7eef8e31b3f13b267a69a374adafbbd1" dependencies = [ "as-raw-xcb-connection", "bytemuck", "cfg_aliases", "cocoa 0.25.0", "core-graphics 0.23.1", - "drm", - "drm-sys", + "drm 0.10.0", "fastrand 2.0.1", "foreign-types 0.5.0", "js-sys", "log", - "memmap2 0.7.1", - "nix 0.26.4", + "memmap2 0.9.0", "objc", "raw-window-handle", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", + "rustix 0.38.20", "tiny-xlib", "wasm-bindgen", "wayland-backend", - "wayland-client 0.30.2", - "wayland-sys 0.30.1", + "wayland-client 0.31.1", + "wayland-sys 0.31.1", "web-sys", "windows-sys 0.48.0", "x11rb 0.12.0", @@ -5526,9 +5571,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.11" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" +checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] name = "tempfile" @@ -5539,7 +5584,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.3.5", - "rustix 0.38.19", + "rustix 0.38.20", "windows-sys 0.48.0", ] @@ -5560,18 +5605,18 @@ checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -5787,9 +5832,9 @@ dependencies = [ [[package]] name = "tracing" -version = "0.1.39" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2ef2af84856a50c1d430afce2fdded0a4ec7eda868db86409b4543df0797f9" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -5858,9 +5903,9 @@ dependencies = [ [[package]] name = "trash" -version = "3.1.0" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b23f2b0cf93f537bbe90cbb59ea9176cc8ce9b010a36dcd5b726facd82825e" +checksum = "8c646008e5144d988005bec12b1e56f5e0a951e957176686815eba8b025e0418" dependencies = [ "chrono", "libc", @@ -6140,9 +6185,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" [[package]] name = "valuable" @@ -6188,7 +6233,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "const-field-offset", "portable-atomic", @@ -6199,7 +6244,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git?branch=olivier/fix-3700#c03366792958460a84e4c340a34928643338a963" +source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" dependencies = [ "proc-macro2", "quote", @@ -6284,17 +6329,16 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wayland-backend" -version = "0.1.2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b48e27457e8da3b2260ac60d0a94512f5cba36448679f3747c0865b7893ed8" +checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4" dependencies = [ "cc", "downcast-rs", - "io-lifetimes", "nix 0.26.4", "scoped-tls", "smallvec", - "wayland-sys 0.30.1", + "wayland-sys 0.31.1", ] [[package]] @@ -6315,14 +6359,14 @@ dependencies = [ [[package]] name = "wayland-client" -version = "0.30.2" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489c9654770f674fc7e266b3c579f4053d7551df0ceb392f153adb1f9ed06ac8" +checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "nix 0.26.4", "wayland-backend", - "wayland-scanner 0.30.1", + "wayland-scanner 0.31.0", ] [[package]] @@ -6373,9 +6417,9 @@ dependencies = [ [[package]] name = "wayland-scanner" -version = "0.30.1" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9b873b257fbc32ec909c0eb80dea312076a67014e65e245f5eb69a6b8ab330e" +checksum = "fb8e28403665c9f9513202b7e1ed71ec56fde5c107816843fb14057910b2c09c" dependencies = [ "proc-macro2", "quick-xml", @@ -6405,6 +6449,18 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "wayland-sys" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15a0c8eaff5216d07f226cb7a549159267f3467b289d9a2e52fd3ef5aae2b7af" +dependencies = [ + "dlib", + "log", + "once_cell", + "pkg-config", +] + [[package]] name = "web-sys" version = "0.3.64" @@ -6436,7 +6492,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.19", + "rustix 0.38.20", ] [[package]] diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index fd1c0ebf7..ee28252dd 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -12,7 +12,7 @@ build = "build.rs" [dependencies] #slint = "1.2.2" -slint = { git = "https://github.com/slint-ui/slint.git", branch = "olivier/fix-3700"} +slint = { git = "https://github.com/slint-ui/slint.git"} rand = "0.8.5" czkawka_core = { version = "6.1.0", path = "../czkawka_core" } chrono = "0.4.31" @@ -21,4 +21,4 @@ crossbeam-channel = "0.5.8" [build-dependencies] #slint-build = "1.2.2" -slint-build = { git = "https://github.com/slint-ui/slint.git", branch = "olivier/fix-3700"} \ No newline at end of file +slint-build = { git = "https://github.com/slint-ui/slint.git"} \ No newline at end of file diff --git a/czkawka_slint_gui/ui/progress.slint b/czkawka_slint_gui/ui/progress.slint new file mode 100644 index 000000000..e16cbb6d9 --- /dev/null +++ b/czkawka_slint_gui/ui/progress.slint @@ -0,0 +1,62 @@ +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; +import {SelectableTableView} from "selectable_tree_view.slint"; +import {LeftSidePanel} from "left_side_panel.slint"; +import {MainList} from "main_lists.slint"; +import {CurrentTab, ProgressToSend} from "common.slint"; +import { ProgressIndicator } from "std-widgets.slint"; + +export component Progress { + in-out property progress_datas; + preferred-width: 400px; + preferred-height: 40px; + + VerticalLayout { + Text { + text: progress-datas.step-name; + horizontal-alignment: TextHorizontalAlignment.center; + } + HorizontalLayout { + spacing: 5px; + VerticalLayout { + spacing: 5px; + Text { + vertical-alignment: TextVerticalAlignment.center; + text: "Current Stage:"; + } + Text { + vertical-alignment: TextVerticalAlignment.center; + text: "All Stages:"; + } + } + VerticalLayout { + spacing: 5px; + VerticalLayout { + alignment: LayoutAlignment.center; + ProgressIndicator { + visible: progress_datas.current-progress >= -0.001; + height: 8px; + progress: progress_datas.current-progress / 100.0; + } + } + VerticalLayout { + alignment: LayoutAlignment.center; + ProgressIndicator { + height: 8px; + progress: progress_datas.all-progress / 100.0; + } + } + } + VerticalLayout { + spacing: 5px; + Text { + vertical-alignment: TextVerticalAlignment.center; + text: progress_datas.current-progress + "%"; + } + Text { + vertical-alignment: TextVerticalAlignment.center; + text: progress_datas.all-progress + "%"; + } + } + } + } +} \ No newline at end of file From 3e2eb8b41427c8dae519d4103329be36be7ead08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 23 Oct 2023 20:37:41 +0200 Subject: [PATCH 017/107] A lot of --- Cargo.lock | 1366 ++++++----------- czkawka_slint_gui/Cargo.toml | 29 +- .../src/connect_progress_receiver.rs | 4 +- czkawka_slint_gui/src/connect_scan.rs | 2 +- 4 files changed, 536 insertions(+), 865 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a369d75f0..2458c13d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,69 +24,6 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76eb1adf08c5bcaa8490b9851fd53cca27fa9880076f178ea9d29f05196728a8" -[[package]] -name = "accesskit_consumer" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04bb4d9e4772fe0d47df57d0d5dbe5d85dd05e2f37ae1ddb6b105e76be58fb00" -dependencies = [ - "accesskit", -] - -[[package]] -name = "accesskit_macos" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134d0acf6acb667c89d3332999b1a5df4edbc8d6113910f392ebb73f2b03bb56" -dependencies = [ - "accesskit", - "accesskit_consumer", - "objc2", - "once_cell", -] - -[[package]] -name = "accesskit_unix" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e084cb5168790c0c112626175412dc5ad127083441a8248ae49ddf6725519e83" -dependencies = [ - "accesskit", - "accesskit_consumer", - "async-channel", - "atspi", - "futures-lite", - "serde", - "zbus", -] - -[[package]] -name = "accesskit_windows" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eac0a7f2d7cd7a93b938af401d3d8e8b7094217989a7c25c55a953023436e31" -dependencies = [ - "accesskit", - "accesskit_consumer", - "arrayvec", - "once_cell", - "paste", - "windows 0.48.0", -] - -[[package]] -name = "accesskit_winit" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825d23acee1bd6d25cbaa3ca6ed6e73faf24122a774ec33d52c5c86c6ab423c0" -dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", - "winit", -] - [[package]] name = "adler" version = "1.0.2" @@ -112,13 +49,15 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "72832d73be48bac96a5d7944568f305d829ed55b0ce3b483647089dfaf6cf704" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -132,20 +71,23 @@ dependencies = [ [[package]] name = "android-activity" -version = "0.4.3" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" +checksum = "052ad56e336bcc615a214bffbeca6c181ee9550acec193f0327e0b103b033a4d" dependencies = [ "android-properties", - "bitflags 1.3.2", + "bitflags 2.4.1", "cc", + "cesu8", + "jni", "jni-sys", "libc", "log", "ndk", "ndk-context", "ndk-sys", - "num_enum 0.6.1", + "num_enum", + "thiserror", ] [[package]] @@ -248,133 +190,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d5f312b0a56c5cdf967c0aeb67f6289603354951683bc97ddc595ab974ba9aa" [[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-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", - "rustix 0.37.26", - "slab", - "socket2", - "waker-fn", -] - -[[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", - "async-lock", - "async-signal", - "blocking", - "cfg-if", - "event-listener 3.0.0", - "futures-lite", - "rustix 0.38.20", - "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.4" +name = "ash" +version = "0.37.3+1.3.251" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2a5415b7abcdc9cd7d63d6badba5288b2ca017e3fbd4173b8f405449f1a2399" +checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if", - "futures-core", - "futures-io", - "rustix 0.38.20", - "signal-hook-registry", - "slab", - "windows-sys 0.48.0", + "libloading 0.7.4", ] -[[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" @@ -401,33 +224,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "atspi" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "674e7a3376837b2e7d12d34d58ac47073c491dc3bf6f71a7adaf687d4d817faa" -dependencies = [ - "async-recursion", - "async-trait", - "atspi-macros", - "enumflags2", - "futures-lite", - "serde", - "tracing", - "zbus", - "zbus_names", -] - -[[package]] -name = "atspi-macros" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb4870a32c0eaa17e35bca0e6b16020635157121fb7d45593d242c295bc768" -dependencies = [ - "quote", - "syn 1.0.109", -] - [[package]] name = "audio_checker" version = "0.1.0" @@ -457,9 +253,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -570,7 +366,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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dd7cf50912cddc06dc5ea7c08c5e81c1b2c842a70d19def1848d54c586fed92" +dependencies = [ + "objc-sys 0.3.1", ] [[package]] @@ -579,24 +384,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 = "blocking" -version = "1.4.1" +name = "block2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ - "async-channel", - "async-lock", - "async-task", - "fastrand 2.0.1", - "futures-io", - "futures-lite", - "piper", - "tracing", + "block-sys 0.2.0", + "objc2 0.4.1", ] [[package]] @@ -637,6 +436,12 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + [[package]] name = "bzip2" version = "0.4.4" @@ -685,33 +490,45 @@ dependencies = [ [[package]] name = "calloop" -version = "0.10.6" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" +checksum = "dea4bfce4c7fbd71e5bb8a7063b6cc7eed48c6d29ee9a08332a59e5d9d93e5c4" dependencies = [ "bitflags 1.3.2", + "io-lifetimes", "log", - "nix 0.25.1", - "slotmap", + "nix 0.26.4", + "polling 2.8.0", + "slab", "thiserror", - "vec_map", ] [[package]] name = "calloop" -version = "0.11.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea4bfce4c7fbd71e5bb8a7063b6cc7eed48c6d29ee9a08332a59e5d9d93e5c4" +checksum = "7b50b5a44d59a98c55a9eeb518f39bf7499ba19fd98ee7d22618687f3f10adbf" dependencies = [ - "bitflags 1.3.2", - "io-lifetimes", + "bitflags 2.4.1", "log", - "nix 0.26.4", - "polling", + "polling 3.2.0", + "rustix", "slab", "thiserror", ] +[[package]] +name = "calloop-wayland-source" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" +dependencies = [ + "calloop 0.12.3", + "rustix", + "wayland-backend", + "wayland-client 0.31.1", +] + [[package]] name = "cbc" version = "0.1.2" @@ -731,6 +548,12 @@ dependencies = [ "libc", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cexpr" version = "0.6.0" @@ -947,6 +770,16 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "combine" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "concurrent-queue" version = "2.3.0" @@ -959,7 +792,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "const-field-offset-macro", "field-offset", @@ -968,7 +801,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "proc-macro2", "quote", @@ -1084,56 +917,6 @@ version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" -[[package]] -name = "cpp" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa65869ef853e45c60e9828aa08cdd1398cb6e13f3911d9cb2a079b144fcd64" -dependencies = [ - "cpp_macros", -] - -[[package]] -name = "cpp_build" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e361fae2caf9758164b24da3eedd7f7d7451be30d90d8e7b5d2be29a2f0cf5b" -dependencies = [ - "cc", - "cpp_common", - "lazy_static", - "proc-macro2", - "regex", - "syn 2.0.38", - "unicode-xid", -] - -[[package]] -name = "cpp_common" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e1a2532e4ed4ea13031c13bc7bc0dbca4aae32df48e9d77f0d1e743179f2ea1" -dependencies = [ - "lazy_static", - "proc-macro2", - "syn 2.0.38", -] - -[[package]] -name = "cpp_macros" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47ec9cc90633446f779ef481a9ce5a0077107dd5b87016440448d908625a83fd" -dependencies = [ - "aho-corasick", - "byteorder", - "cpp_common", - "lazy_static", - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "cpufeatures" version = "0.2.10" @@ -1192,6 +975,16 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -1236,6 +1029,12 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "cursor-icon" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "740bb192a8e2d1350119916954f4409ee7f62f149b536911eeb78ba5a20526bf" + [[package]] name = "czkawka_cli" version = "6.1.0" @@ -1328,6 +1127,7 @@ dependencies = [ "chrono", "crossbeam-channel", "czkawka_core", + "handsome_logger", "open", "rand", "slint", @@ -1426,17 +1226,6 @@ 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" @@ -1539,44 +1328,21 @@ checksum = "edf9159ef4bcecd0c5e4cbeb573b8d0037493403d542780dba5d840bbf9df56f" dependencies = [ "bitflags 1.3.2", "bytemuck", - "drm-ffi 0.5.0", + "drm-ffi", "drm-fourcc", "nix 0.26.4", ] -[[package]] -name = "drm" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb1b703ffbc7ebd216eba7900008049a56ace55580ecb2ee7fa801e8d8be87" -dependencies = [ - "bitflags 2.4.1", - "bytemuck", - "drm-ffi 0.6.0", - "drm-fourcc", - "nix 0.27.1", -] - [[package]] name = "drm-ffi" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1352481b7b90e27a8a1bf8ef6b33cf18b98dba7c410e75c24bb3eef2f0d8d525" dependencies = [ - "drm-sys 0.4.0", + "drm-sys", "nix 0.26.4", ] -[[package]] -name = "drm-ffi" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba7d1c19c4b6270e89d59fb27dc6d02a317c658a8a54e54781e1db9b5947595d" -dependencies = [ - "drm-sys 0.5.0", - "nix 0.27.1", -] - [[package]] name = "drm-fourcc" version = "2.2.0" @@ -1592,12 +1358,6 @@ dependencies = [ "libc", ] -[[package]] -name = "drm-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a4f1c0468062a56cd5705f1e3b5409eb286d5596a2028ec8e947595d7e715ae" - [[package]] name = "dwrote" version = "0.11.0" @@ -1627,27 +1387,6 @@ 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" @@ -1684,23 +1423,6 @@ 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.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29e56284f00d94c1bc7fd3c77027b4623c88c1f53d8d2394c6199f2921dea325" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - [[package]] name = "exr" version = "1.71.0" @@ -1717,15 +1439,6 @@ 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" @@ -2059,21 +1772,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" -[[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.28" @@ -2085,12 +1783,6 @@ dependencies = [ "syn 2.0.38", ] -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - [[package]] name = "futures-task" version = "0.3.28" @@ -2104,11 +1796,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-core", - "futures-io", "futures-macro", - "futures-sink", "futures-task", - "memchr", "pin-project-lite", "pin-utils", "slab", @@ -2121,7 +1810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ec389cda876966cf824111bf6e533fb934c711d473498279964a990853b3c6" dependencies = [ "bitflags 1.3.2", - "drm 0.9.0", + "drm", "drm-fourcc", "gbm-sys", "libc", @@ -2388,34 +2077,58 @@ dependencies = [ name = "glutin" version = "0.30.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc93b03242719b8ad39fb26ed2b01737144ce7bd4bfc7adadcef806596760fe" +checksum = "8fc93b03242719b8ad39fb26ed2b01737144ce7bd4bfc7adadcef806596760fe" +dependencies = [ + "bitflags 1.3.2", + "cfg_aliases", + "cgl", + "core-foundation", + "dispatch", + "glutin_egl_sys 0.5.1", + "glutin_glx_sys 0.4.0", + "glutin_wgl_sys 0.4.0", + "libloading 0.7.4", + "objc2 0.3.0-beta.3.patch-leaks.3", + "once_cell", + "raw-window-handle 0.5.2", + "wayland-sys 0.30.1", + "windows-sys 0.45.0", + "x11-dl", +] + +[[package]] +name = "glutin" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04c03bcbdb3c865ac10196deaddbcea719e601d2d3eef7541872b8dee3492a36" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "cfg_aliases", "cgl", "core-foundation", "dispatch", - "glutin_egl_sys", - "glutin_glx_sys", - "glutin_wgl_sys", - "libloading 0.7.4", - "objc2", + "glutin_egl_sys 0.6.0", + "glutin_glx_sys 0.5.0", + "glutin_wgl_sys 0.5.0", + "icrate", + "libloading 0.8.1", + "objc2 0.4.1", "once_cell", - "raw-window-handle", - "wayland-sys 0.30.1", - "windows-sys 0.45.0", + "raw-window-handle 0.5.2", + "wayland-sys 0.31.1", + "windows-sys 0.48.0", "x11-dl", ] [[package]] name = "glutin-winit" -version = "0.3.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629a873fc04062830bfe8f97c03773bcd7b371e23bcc465d0a61448cd1588fa4" +checksum = "1ebcdfba24f73b8412c5181e56f092b5eff16671c514ce896b258a0a64bd7735" dependencies = [ "cfg_aliases", - "glutin", - "raw-window-handle", + "glutin 0.31.0", + "raw-window-handle 0.5.2", "winit", ] @@ -2429,6 +2142,16 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "glutin_egl_sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77cc5623f5309ef433c3dd4ca1223195347fe62c413da8e2fdd0eb76db2d9bcd" +dependencies = [ + "gl_generator", + "windows-sys 0.48.0", +] + [[package]] name = "glutin_glx_sys" version = "0.4.0" @@ -2439,6 +2162,16 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "glutin_glx_sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a165fd686c10dcc2d45380b35796e577eacfd43d4660ee741ec8ebe2201b3b4f" +dependencies = [ + "gl_generator", + "x11-dl", +] + [[package]] name = "glutin_wgl_sys" version = "0.4.0" @@ -2448,6 +2181,15 @@ dependencies = [ "gl_generator", ] +[[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 = "gobject-sys" version = "0.18.0" @@ -2573,6 +2315,7 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0" dependencies = [ + "bytemuck", "crunchy", ] @@ -2627,12 +2370,6 @@ 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" @@ -2663,61 +2400,43 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "calloop 0.11.0", - "drm 0.9.0", + "drm", "gbm", - "glutin", + "glutin 0.30.10", "i-slint-common", "i-slint-core", "i-slint-renderer-femtovg", + "i-slint-renderer-skia", "input", "libseat", "nix 0.27.1", - "raw-window-handle", + "raw-window-handle 0.5.2", + "vulkano", "xkbcommon", ] -[[package]] -name = "i-slint-backend-qt" -version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" -dependencies = [ - "const-field-offset", - "cpp", - "cpp_build", - "i-slint-common", - "i-slint-core", - "i-slint-core-macros", - "lyon_path", - "once_cell", - "pin-project", - "pin-weak", - "qttypes", - "vtable", -] - [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", - "i-slint-backend-qt", "i-slint-backend-winit", "i-slint-common", "i-slint-core", + "i-slint-renderer-skia", ] [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "accesskit", - "accesskit_winit", "bytemuck", "cfg-if", "cfg_aliases", @@ -2725,7 +2444,7 @@ dependencies = [ "const-field-offset", "copypasta", "derive_more", - "glutin", + "glutin 0.31.0", "glutin-winit", "i-slint-common", "i-slint-core", @@ -2733,11 +2452,10 @@ dependencies = [ "i-slint-renderer-femtovg", "i-slint-renderer-skia", "imgref", - "instant", "lyon_path", "once_cell", "pin-weak", - "raw-window-handle", + "raw-window-handle 0.5.2", "rgb", "scoped-tls-hkt", "scopeguard", @@ -2752,7 +2470,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "cfg-if", "derive_more", @@ -2763,7 +2481,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "by_address", "codemap", @@ -2777,7 +2495,7 @@ dependencies = [ "linked_hash_set", "lyon_extra", "lyon_path", - "num_enum 0.7.0", + "num_enum", "once_cell", "proc-macro2", "quote", @@ -2792,7 +2510,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "auto_enums", "bytemuck", @@ -2805,7 +2523,6 @@ dependencies = [ "i-slint-common", "i-slint-core-macros", "image", - "instant", "integer-sqrt", "lyon_algorithms", "lyon_extra", @@ -2830,12 +2547,13 @@ dependencies = [ "vtable", "wasm-bindgen", "web-sys", + "web-time", ] [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "quote", "syn 2.0.38", @@ -2844,7 +2562,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "cfg-if", "const-field-offset", @@ -2858,11 +2576,10 @@ dependencies = [ "i-slint-core", "i-slint-core-macros", "imgref", - "instant", "lyon_path", "once_cell", "pin-weak", - "raw-window-handle", + "raw-window-handle 0.5.2", "rgb", "scoped-tls-hkt", "ttf-parser 0.18.1", @@ -2877,8 +2594,10 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ + "ash", + "bytemuck", "cfg-if", "cfg_aliases", "cocoa 0.24.1", @@ -2888,21 +2607,22 @@ dependencies = [ "derive_more", "foreign-types 0.3.2", "glow", - "glutin", + "glutin 0.30.10", "i-slint-common", "i-slint-core", "i-slint-core-macros", - "instant", "lyon_path", "metal", "objc", "once_cell", "pin-weak", - "raw-window-handle", + "raw-window-handle 0.5.2", "scoped-tls-hkt", "skia-safe", + "softbuffer", "unicode-segmentation", "vtable", + "vulkano", "winapi", "winit", "wio", @@ -3001,6 +2721,17 @@ dependencies = [ "cc", ] +[[package]] +name = "icrate" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" +dependencies = [ + "block2 0.3.0", + "dispatch", + "objc2 0.4.1", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -3152,18 +2883,6 @@ dependencies = [ "libc", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "integer-sqrt" version = "0.1.5" @@ -3255,6 +2974,22 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -3424,12 +3159,6 @@ 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" @@ -3692,18 +3421,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "mio" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "multicache" version = "0.6.1" @@ -3715,15 +3432,17 @@ dependencies = [ [[package]] name = "ndk" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "jni-sys", + "log", "ndk-sys", - "num_enum 0.5.11", - "raw-window-handle", + "num_enum", + "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "thiserror", ] @@ -3735,9 +3454,9 @@ checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" [[package]] name = "ndk-sys" -version = "0.4.1+23.1.7779620" +version = "0.5.0+25.2.9519653" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +checksum = "8c196769dd60fd4f363e11d948139556a344e79d451aeb2fa2fd040738ef7691" dependencies = [ "jni-sys", ] @@ -3754,19 +3473,6 @@ dependencies = [ "memoffset 0.6.5", ] -[[package]] -name = "nix" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.6.5", -] - [[package]] name = "nix" version = "0.26.4" @@ -3859,55 +3565,13 @@ dependencies = [ "libm", ] -[[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.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" dependencies = [ - "num_enum_derive 0.7.0", -] - -[[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", - "quote", - "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", - "quote", - "syn 2.0.38", + "num_enum_derive", ] [[package]] @@ -3958,15 +3622,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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845" + [[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.1", + "objc2-encode 3.0.0", ] [[package]] @@ -3975,9 +3655,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" @@ -4035,16 +3721,6 @@ 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" @@ -4085,12 +3761,6 @@ 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" @@ -4243,17 +3913,6 @@ 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" @@ -4289,6 +3948,20 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "polling" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62a79e457c9898100b4298d57d69ec53d06f9a6ed352431ce5f377e082d2e846" +dependencies = [ + "cfg-if", + "concurrent-queue", + "pin-project-lite", + "rustix", + "tracing", + "windows-sys 0.48.0", +] + [[package]] name = "portable-atomic" version = "1.4.3" @@ -4381,17 +4054,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "qttypes" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "116e96ef85a287acd172c5ed017ef56ee1d9e4f016558e8fc1625925f3f77468" -dependencies = [ - "cpp", - "cpp_build", - "semver", -] - [[package]] name = "quick-xml" version = "0.30.0" @@ -4446,6 +4108,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 = "rawloader" version = "0.37.1" @@ -4746,20 +4414,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "rustix" -version = "0.37.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f3f8f960ed3b5a59055428714943298bf3fa2d4a1d53135084e0544829d995" -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.20" @@ -4769,7 +4423,7 @@ dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys 0.4.10", + "linux-raw-sys", "windows-sys 0.48.0", ] @@ -4872,15 +4526,15 @@ dependencies = [ [[package]] name = "sctk-adwaita" -version = "0.5.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda4e97be1fd174ccc2aae81c8b694e803fa99b34e8fd0f057a9d70698e3ed09" +checksum = "1729a30a469de249c6effc17ec8d039b0aa29b3af79b819b7f51cb6ab8046a90" dependencies = [ "ab_glyph", "log", - "memmap2 0.5.10", - "smithay-client-toolkit", - "tiny-skia 0.8.4", + "memmap2 0.9.0", + "smithay-client-toolkit 0.18.0", + "tiny-skia 0.11.2", ] [[package]] @@ -4932,17 +4586,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] - [[package]] name = "serde_spanned" version = "0.6.3" @@ -5001,15 +4644,6 @@ 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" @@ -5074,7 +4708,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5090,7 +4724,7 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "i-slint-compiler", "spin_on", @@ -5101,7 +4735,7 @@ dependencies = [ [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -5130,17 +4764,41 @@ 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", + "bitflags 1.3.2", + "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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f" +dependencies = [ + "bitflags 2.4.1", + "calloop 0.12.3", + "calloop-wayland-source", + "cursor-icon", + "libc", "log", - "memmap2 0.5.10", - "nix 0.24.3", - "pkg-config", - "wayland-client 0.29.5", - "wayland-cursor", - "wayland-protocols", + "memmap2 0.9.0", + "rustix", + "thiserror", + "wayland-backend", + "wayland-client 0.31.1", + "wayland-csd-frame", + "wayland-cursor 0.31.0", + "wayland-protocols 0.31.0", + "wayland-protocols-wlr", + "wayland-scanner 0.31.0", + "xkeysym", ] [[package]] @@ -5149,7 +4807,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" dependencies = [ - "smithay-client-toolkit", + "smithay-client-toolkit 0.16.1", "wayland-client 0.29.5", ] @@ -5184,16 +4842,6 @@ 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.2" @@ -5205,16 +4853,15 @@ dependencies = [ "cfg_aliases", "cocoa 0.25.0", "core-graphics 0.23.1", - "drm 0.10.0", - "fastrand 2.0.1", + "fastrand", "foreign-types 0.5.0", "js-sys", "log", "memmap2 0.9.0", "objc", - "raw-window-handle", + "raw-window-handle 0.5.2", "redox_syscall 0.4.1", - "rustix 0.38.20", + "rustix", "tiny-xlib", "wasm-bindgen", "wayland-backend", @@ -5582,9 +5229,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", - "fastrand 2.0.1", + "fastrand", "redox_syscall 0.3.5", - "rustix 0.38.20", + "rustix", "windows-sys 0.48.0", ] @@ -5677,38 +5324,38 @@ dependencies = [ [[package]] name = "tiny-skia" -version = "0.8.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" +checksum = "7db11798945fa5c3e5490c794ccca7c6de86d3afdd54b4eb324109939c6f37bc" dependencies = [ "arrayref", "arrayvec", "bytemuck", "cfg-if", + "log", "png", - "tiny-skia-path 0.8.4", + "tiny-skia-path 0.10.0", ] [[package]] name = "tiny-skia" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db11798945fa5c3e5490c794ccca7c6de86d3afdd54b4eb324109939c6f37bc" +checksum = "3b72a92a05db376db09fe6d50b7948d106011761c05a6a45e23e17ee9b556222" dependencies = [ "arrayref", "arrayvec", "bytemuck", "cfg-if", "log", - "png", - "tiny-skia-path 0.10.0", + "tiny-skia-path 0.11.2", ] [[package]] name = "tiny-skia-path" -version = "0.8.4" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adbfb5d3f3dd57a0e11d12f4f13d4ebbbc1b5c15b7ab0a156d030b21da5f677c" +checksum = "2f60aa35c89ac2687ace1a2556eaaea68e8c0d47408a2e3e7f5c98a489e7281c" dependencies = [ "arrayref", "bytemuck", @@ -5717,9 +5364,9 @@ dependencies = [ [[package]] name = "tiny-skia-path" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f60aa35c89ac2687ace1a2556eaaea68e8c0d47408a2e3e7f5c98a489e7281c" +checksum = "6ac3865b9708fc7e1961a65c3a4fa55e984272f33092d3c859929f887fceb647" dependencies = [ "arrayref", "bytemuck", @@ -5976,16 +5623,6 @@ 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" @@ -6077,12 +5714,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - [[package]] name = "untrusted" version = "0.7.1" @@ -6195,12 +5826,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version-compare" version = "0.1.1" @@ -6230,10 +5855,19 @@ dependencies = [ "transpose", ] +[[package]] +name = "vk-parse" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6a0bda9bbe6b9e50e6456c80aa8fe4cca3b21e4311a1130c41e4915ec2e32a" +dependencies = [ + "xml-rs", +] + [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "const-field-offset", "portable-atomic", @@ -6244,7 +5878,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#5bf2c7192b6264947e5e80e7e85f831f4ea3f852" +source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" dependencies = [ "proc-macro2", "quote", @@ -6252,10 +5886,32 @@ dependencies = [ ] [[package]] -name = "waker-fn" -version = "1.1.1" +name = "vulkano" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" +checksum = "1e1f15eeb9d93a05eb3c237332a10806eac1eb82444e54485bfcc1859c483c23" +dependencies = [ + "ahash", + "ash", + "bytemuck", + "core-graphics-types", + "crossbeam-queue", + "half", + "heck", + "indexmap 1.9.3", + "libloading 0.7.4", + "objc", + "once_cell", + "parking_lot", + "proc-macro2", + "quote", + "regex", + "serde", + "serde_json", + "smallvec", + "thread_local", + "vk-parse", +] [[package]] name = "walkdir" @@ -6298,6 +5954,18 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" @@ -6381,6 +6049,17 @@ dependencies = [ "wayland-sys 0.29.5", ] +[[package]] +name = "wayland-csd-frame" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" +dependencies = [ + "bitflags 2.4.1", + "cursor-icon", + "wayland-backend", +] + [[package]] name = "wayland-cursor" version = "0.29.5" @@ -6392,6 +6071,17 @@ dependencies = [ "xcursor", ] +[[package]] +name = "wayland-cursor" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" +dependencies = [ + "nix 0.26.4", + "wayland-client 0.31.1", + "xcursor", +] + [[package]] name = "wayland-protocols" version = "0.29.5" @@ -6404,6 +6094,44 @@ dependencies = [ "wayland-scanner 0.29.5", ] +[[package]] +name = "wayland-protocols" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c" +dependencies = [ + "bitflags 2.4.1", + "wayland-backend", + "wayland-client 0.31.1", + "wayland-scanner 0.31.0", +] + +[[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.1", + "wayland-backend", + "wayland-client 0.31.1", + "wayland-protocols 0.31.0", + "wayland-scanner 0.31.0", +] + +[[package]] +name = "wayland-protocols-wlr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" +dependencies = [ + "bitflags 2.4.1", + "wayland-backend", + "wayland-client 0.31.1", + "wayland-protocols 0.31.0", + "wayland-scanner 0.31.0", +] + [[package]] name = "wayland-scanner" version = "0.29.5" @@ -6471,6 +6199,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8208e3fdbc243c8fd30805721869242a7f6de3e2e9f3b057652ab36e52ae1e87" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "webpki-roots" version = "0.25.2" @@ -6492,7 +6230,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.20", + "rustix", ] [[package]] @@ -6550,8 +6288,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-implement", - "windows-interface", "windows-targets 0.48.5", ] @@ -6564,28 +6300,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-implement" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "windows-interface" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -6720,37 +6434,50 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winit" -version = "0.28.7" +version = "0.29.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" +checksum = "b829f75d02fe1e225b97c91a04c326900147a50234d1141a1cbe215ce8798c11" dependencies = [ + "ahash", "android-activity", - "bitflags 1.3.2", + "atomic-waker", + "bitflags 2.4.1", + "bytemuck", + "calloop 0.12.3", "cfg_aliases", "core-foundation", - "core-graphics 0.22.3", - "dispatch", - "instant", + "core-graphics 0.23.1", + "cursor-icon", + "icrate", + "js-sys", "libc", "log", - "mio", + "memmap2 0.9.0", "ndk", - "objc2", + "ndk-sys", + "objc2 0.4.1", "once_cell", "orbclient", "percent-encoding", - "raw-window-handle", + "raw-window-handle 0.5.2", "redox_syscall 0.3.5", + "rustix", "sctk-adwaita", - "smithay-client-toolkit", + "smithay-client-toolkit 0.18.0", + "smol_str", + "unicode-segmentation", "wasm-bindgen", - "wayland-client 0.29.5", - "wayland-commons", - "wayland-protocols", - "wayland-scanner 0.29.5", + "wasm-bindgen-futures", + "wayland-backend", + "wayland-client 0.31.1", + "wayland-protocols 0.31.0", + "wayland-protocols-plasma", "web-sys", - "windows-sys 0.45.0", + "web-time", + "windows-sys 0.48.0", "x11-dl", + "x11rb 0.12.0", + "xkbcommon-dl", ] [[package]] @@ -6857,16 +6584,6 @@ 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" @@ -6878,6 +6595,19 @@ dependencies = [ "xkeysym", ] +[[package]] +name = "xkbcommon-dl" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6924668544c48c0133152e7eec86d644a056ca3d09275eb8d5cdb9855f9d8699" +dependencies = [ + "bitflags 2.4.1", + "dlib", + "log", + "once_cell", + "xkeysym", +] + [[package]] name = "xkeysym" version = "0.2.0" @@ -6918,69 +6648,23 @@ dependencies = [ ] [[package]] -name = "zbus" -version = "3.14.1" +name = "zerocopy" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31de390a2d872e4cd04edd71b425e29853f786dc99317ed72d73d6fcf5ebb948" +checksum = "4c19fae0c8a9efc6a8281f2e623db8af1db9e57852e04cde3e754dd2dc29340f" dependencies = [ - "async-broadcast", - "async-executor", - "async-fs", - "async-io", - "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", + "zerocopy-derive", ] [[package]] -name = "zbus_macros" -version = "3.14.1" +name = "zerocopy-derive" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d1794a946878c0e807f55a397187c11fc7a038ba5d868e7db4f3bd7760bc9d" +checksum = "fc56589e9ddd1f1c28d4b4b5c773ce232910a6bb67a70133d61c9e347585efe9" dependencies = [ - "proc-macro-crate", "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", + "syn 2.0.38", ] [[package]] @@ -7010,41 +6694,3 @@ 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", - "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", - "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 ee28252dd..a3ac6198a 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -12,13 +12,36 @@ build = "build.rs" [dependencies] #slint = "1.2.2" -slint = { git = "https://github.com/slint-ui/slint.git"} +#slint = { git = "https://github.com/slint-ui/slint.git"} + +# Try to use only needed features from https://github.com/slint-ui/slint/blob/master/api/rs/slint/Cargo.toml#L23-L31 +slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = ["std", + "backend-winit", + "renderer-femtovg", + "renderer-software", + "accessibility", + "compat-1-2" +] } + + rand = "0.8.5" czkawka_core = { version = "6.1.0", path = "../czkawka_core" } chrono = "0.4.31" -open="5.0.0" +open = "5.0.0" crossbeam-channel = "0.5.8" +handsome_logger = "0.8.0" [build-dependencies] #slint-build = "1.2.2" -slint-build = { git = "https://github.com/slint-ui/slint.git"} \ No newline at end of file +slint-build = { git = "https://github.com/slint-ui/slint.git" } + +[features] +default = ["skia_opengl"] +skia_opengl = ["slint/renderer-skia-opengl"] +skia_vulkan = ["slint/renderer-skia-vulkan"] +software = ["slint/renderer-software"] +femtovg = ["slint/renderer-femtovg"] +winit_femtovg = ["slint/renderer-winit-femtovg"] +winit_skia_opengl = ["slint/renderer-winit-skia-opengl"] +winit_skia_vulkan = ["slint/renderer-winit-skia-vulkan"] +winit_software = ["slint/renderer-winit-software"] \ No newline at end of file diff --git a/czkawka_slint_gui/src/connect_progress_receiver.rs b/czkawka_slint_gui/src/connect_progress_receiver.rs index f13a4634a..800453f51 100644 --- a/czkawka_slint_gui/src/connect_progress_receiver.rs +++ b/czkawka_slint_gui/src/connect_progress_receiver.rs @@ -9,7 +9,9 @@ pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver< let a = app.as_weak(); thread::spawn(move || loop { - let progress_data = progress_receiver.recv().unwrap(); + let Ok(progress_data) = progress_receiver.recv() else { + return; // Channel closed + }; a.upgrade_in_event_loop(move |app| { let (all_stages, current_stage) = common_get_data(&progress_data); diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index 53cef23be..23a89f115 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -34,7 +34,7 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender, progress_sender: Sender) { thread::spawn(move || { let mut ef = EmptyFolder::new(); - ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); + ef.set_included_directory(vec![PathBuf::from("/home/rafal")]); ef.find_empty_folders(None, Some(&progress_sender)); ef.get_empty_folder_list(); From 43ef4092930db20b0c708222586df8c423163756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 24 Oct 2023 18:52:10 +0200 Subject: [PATCH 018/107] Ab --- czkawka_slint_gui/Cargo.toml | 3 +-- czkawka_slint_gui/src/connect_progress_receiver.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index a3ac6198a..ab669d35e 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -23,7 +23,6 @@ slint = { git = "https://github.com/slint-ui/slint.git", default-features = fals "compat-1-2" ] } - rand = "0.8.5" czkawka_core = { version = "6.1.0", path = "../czkawka_core" } chrono = "0.4.31" @@ -36,7 +35,7 @@ handsome_logger = "0.8.0" slint-build = { git = "https://github.com/slint-ui/slint.git" } [features] -default = ["skia_opengl"] +default = ["winit_femtovg"] skia_opengl = ["slint/renderer-skia-opengl"] skia_vulkan = ["slint/renderer-skia-vulkan"] software = ["slint/renderer-software"] diff --git a/czkawka_slint_gui/src/connect_progress_receiver.rs b/czkawka_slint_gui/src/connect_progress_receiver.rs index 800453f51..0064d95c9 100644 --- a/czkawka_slint_gui/src/connect_progress_receiver.rs +++ b/czkawka_slint_gui/src/connect_progress_receiver.rs @@ -10,7 +10,7 @@ pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver< thread::spawn(move || loop { let Ok(progress_data) = progress_receiver.recv() else { - return; // Channel closed + return; // Channel closed, so exit the thread since app closing }; a.upgrade_in_event_loop(move |app| { From 1168e82ed0c1bad754e9de1e3f3fc2a1db5031b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 24 Oct 2023 22:05:09 +0200 Subject: [PATCH 019/107] Split --- czkawka_slint_gui/ui/selectable_tree_view.slint | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 019d3dcf3..06585f981 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -73,7 +73,7 @@ export component SelectableTableView inherits Rectangle { for r[idx] in root.values : Rectangle { forward-focus: focus-item; - height: 30px; + height: 20px; // TODO move this into singleton background: r.header-row ? #888888 : (touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd)); // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); @@ -107,8 +107,6 @@ export component SelectableTableView inherits Rectangle { } HorizontalLayout { - padding: 5px; - spacing: 5px; forward-focus: focus-item; CheckBox { From 4d08878c7aa34d9be26f69c2b01ffcffc502e95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 26 Oct 2023 20:57:17 +0200 Subject: [PATCH 020/107] Split --- Cargo.lock | 373 +++++++----------- czkawka_slint_gui/src/connect_scan.rs | 17 +- czkawka_slint_gui/src/connect_stop.rs | 8 + czkawka_slint_gui/src/main.rs | 8 +- czkawka_slint_gui/ui/action_buttons.slint | 16 +- czkawka_slint_gui/ui/main_window.slint | 23 +- .../ui/selectable_tree_view.slint | 4 +- 7 files changed, 190 insertions(+), 259 deletions(-) create mode 100644 czkawka_slint_gui/src/connect_stop.rs diff --git a/Cargo.lock b/Cargo.lock index 2458c13d9..826b97dca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,9 +49,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72832d73be48bac96a5d7944568f305d829ed55b0ce3b483647089dfaf6cf704" +checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" dependencies = [ "cfg-if", "getrandom", @@ -360,32 +360,13 @@ dependencies = [ "generic-array", ] -[[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.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dd7cf50912cddc06dc5ea7c08c5e81c1b2c842a70d19def1848d54c586fed92" dependencies = [ - "objc-sys 0.3.1", -] - -[[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]] @@ -394,8 +375,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ - "block-sys 0.2.0", - "objc2 0.4.1", + "block-sys", + "objc2", ] [[package]] @@ -642,9 +623,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", "clap_derive", @@ -652,9 +633,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstream", "anstyle", @@ -664,9 +645,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.2" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", @@ -676,9 +657,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "clipboard-win" @@ -792,7 +773,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "const-field-offset-macro", "field-offset", @@ -801,7 +782,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "proc-macro2", "quote", @@ -919,9 +900,9 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -1425,9 +1406,9 @@ dependencies = [ [[package]] name = "exr" -version = "1.71.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "832a761f35ab3e6664babfbdc6cef35a4860e816ec3916dcfd0882954e98a8a8" +checksum = "279d3efcc55e19917fff7ab3ddd6c14afb6a90881a0078465196fe2f99d08c56" dependencies = [ "bit_field", "flume", @@ -1608,11 +1589,15 @@ dependencies = [ [[package]] name = "flume" -version = "0.11.0" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" dependencies = [ - "spin 0.9.8", + "futures-core", + "futures-sink", + "nanorand", + "pin-project", + "spin", ] [[package]] @@ -1742,24 +1727,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -1768,32 +1753,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", "syn 2.0.38", ] +[[package]] +name = "futures-sink" +version = "0.3.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" + [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-core", "futures-macro", @@ -1942,8 +1933,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -2073,29 +2066,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "glutin" -version = "0.30.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc93b03242719b8ad39fb26ed2b01737144ce7bd4bfc7adadcef806596760fe" -dependencies = [ - "bitflags 1.3.2", - "cfg_aliases", - "cgl", - "core-foundation", - "dispatch", - "glutin_egl_sys 0.5.1", - "glutin_glx_sys 0.4.0", - "glutin_wgl_sys 0.4.0", - "libloading 0.7.4", - "objc2 0.3.0-beta.3.patch-leaks.3", - "once_cell", - "raw-window-handle 0.5.2", - "wayland-sys 0.30.1", - "windows-sys 0.45.0", - "x11-dl", -] - [[package]] name = "glutin" version = "0.31.0" @@ -2107,12 +2077,12 @@ dependencies = [ "cgl", "core-foundation", "dispatch", - "glutin_egl_sys 0.6.0", - "glutin_glx_sys 0.5.0", - "glutin_wgl_sys 0.5.0", + "glutin_egl_sys", + "glutin_glx_sys", + "glutin_wgl_sys", "icrate", "libloading 0.8.1", - "objc2 0.4.1", + "objc2", "once_cell", "raw-window-handle 0.5.2", "wayland-sys 0.31.1", @@ -2127,21 +2097,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ebcdfba24f73b8412c5181e56f092b5eff16671c514ce896b258a0a64bd7735" dependencies = [ "cfg_aliases", - "glutin 0.31.0", + "glutin", "raw-window-handle 0.5.2", "winit", ] -[[package]] -name = "glutin_egl_sys" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af784eb26c5a68ec85391268e074f0aa618c096eadb5d6330b0911cf34fe57c5" -dependencies = [ - "gl_generator", - "windows-sys 0.45.0", -] - [[package]] name = "glutin_egl_sys" version = "0.6.0" @@ -2152,16 +2112,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "glutin_glx_sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b53cb5fe568964aa066a3ba91eac5ecbac869fb0842cd0dc9e412434f1a1494" -dependencies = [ - "gl_generator", - "x11-dl", -] - [[package]] name = "glutin_glx_sys" version = "0.5.0" @@ -2172,15 +2122,6 @@ dependencies = [ "x11-dl", ] -[[package]] -name = "glutin_wgl_sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef89398e90033fc6bc65e9bd42fd29bbbfd483bda5b56dc5562f455550618165" -dependencies = [ - "gl_generator", -] - [[package]] name = "glutin_wgl_sys" version = "0.5.0" @@ -2311,11 +2252,12 @@ dependencies = [ [[package]] name = "half" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b4af3693f1b705df946e9fe5631932443781d0aabb423b62fcd4d73f6d2fd0" +checksum = "bc52e53916c08643f1b56ec082790d1e86a32e58dc5268f897f313fbae7b4872" dependencies = [ "bytemuck", + "cfg-if", "crunchy", ] @@ -2400,12 +2342,12 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "calloop 0.11.0", "drm", "gbm", - "glutin 0.30.10", + "glutin", "i-slint-common", "i-slint-core", "i-slint-renderer-femtovg", @@ -2421,7 +2363,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2434,7 +2376,7 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "accesskit", "bytemuck", @@ -2444,7 +2386,7 @@ dependencies = [ "const-field-offset", "copypasta", "derive_more", - "glutin 0.31.0", + "glutin", "glutin-winit", "i-slint-common", "i-slint-core", @@ -2470,7 +2412,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "cfg-if", "derive_more", @@ -2481,7 +2423,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "by_address", "codemap", @@ -2510,7 +2452,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "auto_enums", "bytemuck", @@ -2553,7 +2495,7 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "quote", "syn 2.0.38", @@ -2562,7 +2504,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "cfg-if", "const-field-offset", @@ -2594,7 +2536,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "ash", "bytemuck", @@ -2607,7 +2549,7 @@ dependencies = [ "derive_more", "foreign-types 0.3.2", "glow", - "glutin 0.30.10", + "glutin", "i-slint-common", "i-slint-core", "i-slint-core-macros", @@ -2624,7 +2566,6 @@ dependencies = [ "vtable", "vulkano", "winapi", - "winit", "wio", ] @@ -2638,7 +2579,7 @@ dependencies = [ "serde", "serde_derive", "thiserror", - "toml 0.8.2", + "toml 0.8.5", "unic-langid", ] @@ -2727,9 +2668,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]] @@ -3430,6 +3371,15 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "nanorand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +dependencies = [ + "getrandom", +] + [[package]] name = "ndk" version = "0.8.0" @@ -3616,46 +3566,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.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845" -[[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.1", - "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]] @@ -3964,9 +3888,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" +checksum = "b559898e0b4931ed2d3b959ab0c2da4d99cc644c4b0b1a35b4d344027f474023" dependencies = [ "critical-section", ] @@ -4271,17 +4195,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", - "spin 0.5.2", + "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -4429,9 +4352,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", "ring", @@ -4441,9 +4364,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", "untrusted", @@ -4516,9 +4439,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -4557,18 +4480,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", @@ -4588,9 +4511,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -4667,9 +4590,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "skia-bindings" -version = "0.66.3" +version = "0.67.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a42e3db408fbe7beafeadcaf5309c59eb99cc80979cab1b49e2a47539adf8ab" +checksum = "534eae89c6ff605e4a5088d8583ba3e1bbce98b0da9fd2eba37ce4698c86138a" dependencies = [ "bindgen", "cc", @@ -4679,15 +4602,15 @@ dependencies = [ "regex", "serde_json", "tar", - "toml 0.7.8", + "toml 0.8.5", "ureq", ] [[package]] name = "skia-safe" -version = "0.66.3" +version = "0.67.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d03680a0ce867756947f2d5fa92078915342f81996c43b61847fed565068f75" +checksum = "fd6be5caec5fbe1426bb06cfb6500ec00194d97e5ccad4573e7f972c9d6bd938" dependencies = [ "bitflags 2.4.1", "lazy_static", @@ -4708,7 +4631,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -4724,18 +4647,18 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "i-slint-compiler", "spin_on", "thiserror", - "toml_edit 0.20.2", + "toml_edit 0.20.5", ] [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -4872,12 +4795,6 @@ dependencies = [ "x11rb 0.12.0", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -5201,7 +5118,7 @@ dependencies = [ "cfg-expr", "heck", "pkg-config", - "toml 0.8.2", + "toml 0.8.5", "version-compare", ] @@ -5420,33 +5337,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.19.15", -] - -[[package]] -name = "toml" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "3efaf127c78d5339cc547cce4e4d973bd5e4f56e949a06d091c082ebeef2f800" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.20.5", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -5458,17 +5363,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.0.2", - "serde", - "serde_spanned", "toml_datetime", "winnow", ] [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "782bf6c2ddf761c1e7855405e8975472acf76f7f36d0d4328bd3b7a2fae12a85" dependencies = [ "indexmap 2.0.2", "serde", @@ -5511,12 +5414,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -5716,9 +5619,9 @@ checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" @@ -5867,7 +5770,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "const-field-offset", "portable-atomic", @@ -5878,7 +5781,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#49571c8bf2aaac499aaa678829651384fc93fdc9" +source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" dependencies = [ "proc-macro2", "quote", @@ -6165,18 +6068,6 @@ dependencies = [ "pkg-config", ] -[[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" @@ -6201,9 +6092,9 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8208e3fdbc243c8fd30805721869242a7f6de3e2e9f3b057652ab36e52ae1e87" +checksum = "57099a701fb3a8043f993e8228dc24229c7b942e2b009a1b962e54489ba1d3bf" dependencies = [ "js-sys", "wasm-bindgen", @@ -6455,7 +6346,7 @@ dependencies = [ "memmap2 0.9.0", "ndk", "ndk-sys", - "objc2 0.4.1", + "objc2", "once_cell", "orbclient", "percent-encoding", @@ -6649,18 +6540,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.11" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c19fae0c8a9efc6a8281f2e623db8af1db9e57852e04cde3e754dd2dc29340f" +checksum = "81ba595b9f2772fbee2312de30eeb80ec773b4cb2f1e8098db024afadda6c06f" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.11" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc56589e9ddd1f1c28d4b4b5c773ce232910a6bb67a70133d61c9e347585efe9" +checksum = "772666c41fb6dceaf520b564b962d738a8e1a83b41bd48945f50837aed78bb1d" dependencies = [ "proc-macro2", "quote", diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index 23a89f115..2d9c4019f 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -1,6 +1,6 @@ use crate::{split_path, CurrentTab, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; -use crossbeam_channel::Sender; +use crossbeam_channel::{Receiver, Sender}; use czkawka_core::common_dir_traversal::ProgressData; use czkawka_core::common_tool::CommonData; use czkawka_core::empty_folder::EmptyFolder; @@ -9,12 +9,13 @@ use std::path::PathBuf; use std::rc::Rc; use std::thread; -pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender) { +pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender, stop_receiver: Receiver<()>) { let a = app.as_weak(); - app.on_scanned(move |active_tab| { + app.on_scan_starting(move |active_tab| { let progress_sender = progress_sender.clone(); + let stop_receiver = stop_receiver.clone(); let app = a.upgrade().unwrap(); - app.set_scanning(true); + app.set_progress_datas(ProgressToSend { all_progress: 0, current_progress: 0, @@ -24,18 +25,18 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender { - scan_empty_folders(a, progress_sender); + scan_empty_folders(a, progress_sender, stop_receiver); } _ => panic!(), } }); } -fn scan_empty_folders(a: Weak, progress_sender: Sender) { +fn scan_empty_folders(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>) { thread::spawn(move || { let mut ef = EmptyFolder::new(); ef.set_included_directory(vec![PathBuf::from("/home/rafal")]); - ef.find_empty_folders(None, Some(&progress_sender)); + ef.find_empty_folders(Some(&stop_receiver), Some(&progress_sender)); ef.get_empty_folder_list(); @@ -60,7 +61,7 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender items.push((false, false, false, ModelRc::new(data_model))); } app.set_empty_folder_model(items.into()); - app.set_scanning(false); + app.invoke_scan_ended(); }) }); } diff --git a/czkawka_slint_gui/src/connect_stop.rs b/czkawka_slint_gui/src/connect_stop.rs new file mode 100644 index 000000000..8a1c7fd5a --- /dev/null +++ b/czkawka_slint_gui/src/connect_stop.rs @@ -0,0 +1,8 @@ +use crate::MainWindow; +use crossbeam_channel::Sender; + +pub fn connect_stop_button(app: &MainWindow, stop_sender: Sender<()>) { + app.on_scan_stopping(move || { + stop_sender.send(()).unwrap(); + }); +} diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 095094f17..0542d92ca 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -2,6 +2,7 @@ mod connect_delete; mod connect_open; mod connect_progress_receiver; mod connect_scan; +mod connect_stop; use crossbeam_channel::{unbounded, Receiver, Sender}; use std::path::Path; @@ -12,6 +13,7 @@ use crate::connect_open::connect_open_items; use crate::connect_scan::connect_scan_button; use crate::connect_progress_receiver::connect_progress_gathering; +use crate::connect_stop::connect_stop_button; use czkawka_core::common_dir_traversal::ProgressData; use slint::{ModelRc, SharedString, VecModel}; @@ -20,11 +22,13 @@ fn main() { let app = MainWindow::new().unwrap(); //.run().unwrap(); let (progress_sender, progress_receiver): (Sender, Receiver) = unbounded(); + let (stop_sender, stop_receiver): (Sender<()>, Receiver<()>) = unbounded(); // Fills model at start, don't really needed too much after testing to_remove_debug(&app); connect_delete_button(&app); - connect_scan_button(&app, progress_sender); + connect_scan_button(&app, progress_sender, stop_receiver); + connect_stop_button(&app, stop_sender); connect_open_items(&app); connect_progress_gathering(&app, progress_receiver); @@ -36,7 +40,7 @@ type ModelType = VecModel<(bool, bool, bool, ModelRc)>; pub fn to_remove_debug(app: &MainWindow) { let row_data: Rc = Rc::new(VecModel::default()); - for r in 0..1_000_000 { + for r in 0..20_000_000 { let items = VecModel::default(); for c in 0..3 { diff --git a/czkawka_slint_gui/ui/action_buttons.slint b/czkawka_slint_gui/ui/action_buttons.slint index e173b314e..6a8637934 100644 --- a/czkawka_slint_gui/ui/action_buttons.slint +++ b/czkawka_slint_gui/ui/action_buttons.slint @@ -6,7 +6,10 @@ import {CurrentTab} from "common.slint"; export component ActionButtons { callback deleted; - callback scanned(CurrentTab); + callback scan_stopping; + callback scan_starting(CurrentTab); + + in-out property stop_requested: false; in-out property scanning; in-out property active-tab; @@ -16,7 +19,16 @@ export component ActionButtons { enabled: !scanning; text: "Scan"; clicked => { - root.scanned(active-tab); + 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 { diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 2a28e5db2..690e2ea81 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -1,4 +1,4 @@ -import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint"; import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; import {MainList} from "main_lists.slint"; @@ -8,14 +8,18 @@ import { Progress } from "progress.slint"; export component MainWindow inherits Window { callback deleted; - callback scanned(CurrentTab); + callback scan_stopping; + callback scan_starting(CurrentTab); callback item_opened(string); + callback scan_ended(); + min-width: 300px; preferred-width: 1024px; min-height: 300px; preferred-height: 600px; + in-out property stop_requested: false; in-out property scanning: false; in-out property progress_datas : { current_progress: 15, @@ -81,7 +85,7 @@ export component MainWindow inherits Window { item_opened(item) => {item_opened(item)} } - Progress { + if root.scanning: Progress { horizontal-stretch: 0.0; progress_datas <=> root.progress_datas; } @@ -91,8 +95,19 @@ export component MainWindow inherits Window { vertical-stretch: 0.0; scanning <=> root.scanning; active-tab <=> root.active-tab; + stop_requested <=> root.stop-requested; deleted => {root.deleted();} - scanned(item) => {root.scanned(item);} + scan_stopping => {root.scan_stopping();} + scan_starting(item) => {root.scan_starting(item);} + } + LineEdit { + text: root.stop-requested ? "Stopping scan, please wait..." : "Search stopped"; + read-only: true; } } + + scan_ended() => { + root.scanning = false; + root.stop_requested = false; + } } diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 06585f981..2c634cdee 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -20,9 +20,10 @@ export component SelectableTableView inherits Rectangle { forward-focus: focus_item; + // TODO not works focus_item := FocusScope { key-released(event) => { - debug(event); + // debug(event); accept } } @@ -96,7 +97,6 @@ export component SelectableTableView inherits Rectangle { } } pointer-event(event) => { - debug(event); // TODO this should be clicked by double-click if (event.button == PointerEventButton.right && event.kind == PointerEventKind.up) { root.item_opened(r.val[root.parentPathIdx - 1]) From 2de5a4aa9e44ed87dd95ca14798ea36bb85fbab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 27 Oct 2023 11:09:18 +0200 Subject: [PATCH 021/107] Basic deleting --- czkawka_slint_gui/src/common.rs | 3 + czkawka_slint_gui/src/connect_delete.rs | 119 +++++++++++++++++++++++- czkawka_slint_gui/src/main.rs | 16 ++-- 3 files changed, 128 insertions(+), 10 deletions(-) create mode 100644 czkawka_slint_gui/src/common.rs diff --git a/czkawka_slint_gui/src/common.rs b/czkawka_slint_gui/src/common.rs new file mode 100644 index 000000000..c99da54c8 --- /dev/null +++ b/czkawka_slint_gui/src/common.rs @@ -0,0 +1,3 @@ +use slint::{ModelRc, SharedString}; + +pub type ModelType = (bool, bool, bool, ModelRc); diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index 648f6a5cd..16897415b 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -1,15 +1,16 @@ +use crate::common::ModelType; use crate::MainWindow; use slint::{ComponentHandle, Model, ModelRc, VecModel}; -use std::borrow::BorrowMut; +use std::borrow::Borrow; pub fn connect_delete_button(app: &MainWindow) { let a = app.as_weak(); app.on_deleted(move || { let app = a.upgrade().unwrap(); - let mut r = app.get_empty_folder_model(); - let m = r.borrow_mut(); - let (entries_to_delete, mut entries_left): (Vec<_>, Vec<_>) = m.iter().partition(|(checked, _header_row, _selected_row, _data)| *checked); + let r = app.get_empty_folder_model(); + let m = r.borrow(); + let (entries_to_delete, mut entries_left): (Vec, Vec) = m.iter().partition(|(checked, _header_row, _selected_row, _data)| *checked); if !entries_to_delete.is_empty() { dbg!(format!("Items to remove {}", entries_to_delete.len())); @@ -24,3 +25,113 @@ pub fn connect_delete_button(app: &MainWindow) { } }); } + +fn filter_out_checked_items(items: &ModelRc, have_header: bool) -> (Vec, Vec) { + if cfg!(debug_assertions) { + check_if_header_is_checked(items); + check_if_header_is_selected_but_should_not_be(items, have_header); + } + + let (entries_to_delete, mut entries_left): (Vec<_>, Vec<_>) = items.iter().partition(|(checked, _header_row, _selected_row, _data)| *checked); + + if have_header && !entries_left.is_empty() { + // First row must be header + assert!(entries_left[0].1); + + if entries_left.len() == 3 { + // First row is header, so if second or third is also header, then there is no enough items to fill model + if entries_left[1].1 || entries_left[2].1 { + entries_left = Vec::new(); + } + } else if entries_left.len() < 3 { + // Not have enough items to fill model + entries_left = Vec::new(); + } else { + let mut last_header = 0; + let mut new_items: Vec = Vec::new(); + for i in 1..entries_left.len() { + if entries_left[i].1 { + if i - last_header > 2 { + new_items.extend(entries_left[last_header..i].iter().cloned()); + } + last_header = i; + } + } + if entries_left.len() - last_header > 2 { + new_items.extend(entries_left[last_header..].iter().cloned()); + } + + entries_left = new_items; + } + } + + (entries_to_delete, entries_left) +} + +// Function to verify if really headers are not checked +// Checked header is big bug +#[cfg(debug_assertions)] +fn check_if_header_is_checked(items: &ModelRc) { + for i in items.iter() { + let (checked, header_row, _selected_row, _data) = i; + if header_row { + assert!(!checked); + } + } +} + +// In some modes header should not be visible +#[cfg(debug_assertions)] +fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, can_have_header: bool) { + if !can_have_header { + for i in items.iter() { + let (_checked, header_row, _selected_row, _data) = i; + assert!(!header_row); + } + } +} + +#[test] +fn test_filter_out_checked_items_empty() { + let vec_items = Vec::new(); + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, false); + assert!(to_delete.is_empty()); + assert!(left.is_empty()); + let (to_delete, left) = filter_out_checked_items(&items, true); + assert!(to_delete.is_empty()); + assert!(left.is_empty()); +} + +#[test] +fn test_filter_out_checked_items_one_element_valid_normal() { + let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, false); + assert!(to_delete.is_empty()); + assert_eq!(left.len(), items.iter().count()); +} + +#[test] +fn test_filter_out_checked_items_one_element_valid_header() { + let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, true); + assert!(to_delete.is_empty()); + assert_eq!(left.len(), items.iter().count()); +} + +#[test] +#[should_panic] +fn test_filter_out_checked_items_one_element_invalid_normal() { + let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + filter_out_checked_items(&items, false); +} +#[test] +#[should_panic] +fn test_filter_out_checked_items_one_element_invalid_header() { + let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + filter_out_checked_items(&items, true); +} diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 0542d92ca..a1b59f793 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,3 +1,4 @@ +mod common; mod connect_delete; mod connect_open; mod connect_progress_receiver; @@ -12,13 +13,16 @@ use crate::connect_delete::connect_delete_button; use crate::connect_open::connect_open_items; use crate::connect_scan::connect_scan_button; +use crate::common::ModelType; use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_stop::connect_stop_button; use czkawka_core::common_dir_traversal::ProgressData; -use slint::{ModelRc, SharedString, VecModel}; +use slint::{ModelRc, VecModel}; slint::include_modules!(); fn main() { + handsome_logger::init().unwrap(); + let app = MainWindow::new().unwrap(); //.run().unwrap(); let (progress_sender, progress_receiver): (Sender, Receiver) = unbounded(); @@ -35,19 +39,19 @@ fn main() { app.run().unwrap(); } -type ModelType = VecModel<(bool, bool, bool, ModelRc)>; // TODO remove this after trying pub fn to_remove_debug(app: &MainWindow) { - let row_data: Rc = Rc::new(VecModel::default()); - - for r in 0..20_000_000 { + let row_data: Rc> = Rc::new(VecModel::default()); + for r in 0..100_000 { let items = VecModel::default(); for c in 0..3 { items.push(slint::format!("Item {r}.{c}")); } - row_data.push((r % 2 == 0, r % 3 == 0, false, ModelRc::new(items))); + let is_header = r % 3 == 0; + let is_checked = (r % 2 == 0) && !is_header; + row_data.push((is_checked, is_header, false, ModelRc::new(items))); } app.set_empty_folder_model(row_data.into()); } From abf52eab766bdb47ff3621c3feaca6a2c416c412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 27 Oct 2023 20:07:36 +0200 Subject: [PATCH 022/107] Rechecked --- Changelog.md | 10 ++ czkawka_slint_gui/src/connect_delete.rs | 179 +++++++++++++++++------- czkawka_slint_gui/src/main.rs | 2 + czkawka_slint_gui/ui/main_window.slint | 14 +- 4 files changed, 154 insertions(+), 51 deletions(-) diff --git a/Changelog.md b/Changelog.md index 02f9a1fec..7cb286655 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,13 @@ +## Version 7.0.0 - ? +### GTK GUI + +### CLI + +### Slawka GUI + +### Core(all modes) + + ## 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) - Remove up to 340ms of delay when waiting for results - [#1070](https://github.com/qarmin/czkawka/pull/1070) diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index 16897415b..0559339e0 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -10,22 +10,32 @@ pub fn connect_delete_button(app: &MainWindow) { let r = app.get_empty_folder_model(); let m = r.borrow(); - let (entries_to_delete, mut entries_left): (Vec, Vec) = m.iter().partition(|(checked, _header_row, _selected_row, _data)| *checked); + + let (entries_to_delete, mut entries_left) = filter_out_checked_items(m, true); if !entries_to_delete.is_empty() { dbg!(format!("Items to remove {}", entries_to_delete.len())); - entries_to_delete.into_iter().for_each(|(_checked, _header_row, _selected_row, _data)| { - // TODO delete in parallel items, consider to add progress bar - }); - entries_left.iter_mut().for_each(|(_checked, _header_row, selected_row, _data)| { - *selected_row = false; - }); + + remove_all_items(entries_to_delete); + deselect_all_items(&mut entries_left); + let r = ModelRc::new(VecModel::from(entries_left)); app.set_empty_folder_model(r); } }); } +// TODO delete in parallel items, consider to add progress bar +fn remove_all_items(items: Vec) { + items.into_iter().for_each(|(_checked, _header_row, _selected_row, _data)| {}); +} + +fn deselect_all_items(items: &mut [ModelType]) { + items.iter_mut().for_each(|(_checked, _header_row, selected_row, _data)| { + *selected_row = false; + }); +} + fn filter_out_checked_items(items: &ModelRc, have_header: bool) -> (Vec, Vec) { if cfg!(debug_assertions) { check_if_header_is_checked(items); @@ -91,47 +101,122 @@ fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, can } } -#[test] -fn test_filter_out_checked_items_empty() { - let vec_items = Vec::new(); - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - let (to_delete, left) = filter_out_checked_items(&items, false); - assert!(to_delete.is_empty()); - assert!(left.is_empty()); - let (to_delete, left) = filter_out_checked_items(&items, true); - assert!(to_delete.is_empty()); - assert!(left.is_empty()); -} +#[cfg(test)] +mod tests { + use crate::common::ModelType; + use crate::connect_delete::filter_out_checked_items; + use slint::{Model, ModelRc, SharedString, VecModel}; -#[test] -fn test_filter_out_checked_items_one_element_valid_normal() { - let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - let (to_delete, left) = filter_out_checked_items(&items, false); - assert!(to_delete.is_empty()); - assert_eq!(left.len(), items.iter().count()); -} + #[test] + fn test_filter_out_checked_items_empty() { + let vec_items = Vec::new(); + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, false); + assert!(to_delete.is_empty()); + assert!(left.is_empty()); + let (to_delete, left) = filter_out_checked_items(&items, true); + assert!(to_delete.is_empty()); + assert!(left.is_empty()); + } + #[test] + fn test_filter_out_checked_items_one_element_valid_normal() { + let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, false); + assert!(to_delete.is_empty()); + assert_eq!(left.len(), items.iter().count()); + } -#[test] -fn test_filter_out_checked_items_one_element_valid_header() { - let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - let (to_delete, left) = filter_out_checked_items(&items, true); - assert!(to_delete.is_empty()); - assert_eq!(left.len(), items.iter().count()); -} + #[test] + fn test_filter_out_checked_items_one_element_valid_header() { + let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, true); + assert!(to_delete.is_empty()); + assert!(left.is_empty()); + } -#[test] -#[should_panic] -fn test_filter_out_checked_items_one_element_invalid_normal() { - let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - filter_out_checked_items(&items, false); -} -#[test] -#[should_panic] -fn test_filter_out_checked_items_one_element_invalid_header() { - let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - filter_out_checked_items(&items, true); + #[test] + #[should_panic] + fn test_filter_out_checked_items_one_element_invalid_normal() { + let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + filter_out_checked_items(&items, false); + } + #[test] + #[should_panic] + fn test_filter_out_checked_items_one_element_invalid_header() { + let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + filter_out_checked_items(&items, true); + } + + #[test] + fn test_filter_out_checked_items_multiple_element_valid_normal() { + let vec_items = vec![ + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), + (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), + (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), + ]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, false); + let to_delete_data = get_single_data_from_model(&to_delete); + let left_data = get_single_data_from_model(&left); + + assert_eq!(to_delete_data, vec!["3", "4"]); + assert_eq!(left_data, vec!["1", "2", "5"]); + } + + #[test] + fn test_filter_out_checked_items_multiple_element_valid_header() { + let vec_items = vec![ + (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), + (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), + (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), + (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("6")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("7")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("8")]))), + ]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, true); + let to_delete_data = get_single_data_from_model(&to_delete); + let left_data = get_single_data_from_model(&left); + + assert_eq!(to_delete_data, vec!["3"]); + assert_eq!(left_data, vec!["6", "7", "8"]); + } + + #[test] + fn test_filter_out_checked_items_multiple2_element_valid_header() { + let vec_items = vec![ + (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), + (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("6")]))), + (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("7")]))), + (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("8")]))), + ]; + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let (to_delete, left) = filter_out_checked_items(&items, true); + let to_delete_data = get_single_data_from_model(&to_delete); + let left_data = get_single_data_from_model(&left); + + assert_eq!(to_delete_data, vec!["3"]); + assert_eq!(left_data, vec!["1", "2", "4", "5", "6"]); + } + + fn get_single_data_from_model(model: &[ModelType]) -> Vec { + let mut d = model + .iter() + .map(|(_checked, _header_row, _selected_row, data)| data.iter().next().unwrap().to_string()) + .collect::>(); + d.sort(); + d + } } diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index a1b59f793..bdc8d5604 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,3 +1,5 @@ +#![allow(clippy::comparison_chain)] + mod common; mod connect_delete; mod connect_open; diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 690e2ea81..a3baf61fb 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -97,16 +97,22 @@ export component MainWindow inherits Window { active-tab <=> root.active-tab; stop_requested <=> root.stop-requested; deleted => {root.deleted();} - scan_stopping => {root.scan_stopping();} - scan_starting(item) => {root.scan_starting(item);} + scan_stopping => { + text_summary.text = "Stopping scan, please wait..."; + root.scan_stopping(); + } + scan_starting(item) => { + text-summary.text = "Searching..."; + root.scan_starting(item); + } } - LineEdit { - text: root.stop-requested ? "Stopping scan, please wait..." : "Search stopped"; + text_summary := LineEdit { read-only: true; } } scan_ended() => { + text-summary.text = ""; // TODO this should be filled with results root.scanning = false; root.stop_requested = false; } From 60c5d6727e3885c1cf1272fe417271ad68062145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 27 Oct 2023 20:48:59 +0200 Subject: [PATCH 023/107] ED --- czkawka_slint_gui/src/connect_delete.rs | 43 +++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index 0559339e0..daeb8bace 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -1,32 +1,40 @@ -use crate::common::ModelType; -use crate::MainWindow; -use slint::{ComponentHandle, Model, ModelRc, VecModel}; use std::borrow::Borrow; +use slint::{ComponentHandle, Model, ModelRc, VecModel}; + +use crate::common::ModelType; +use crate::{CurrentTab, MainWindow}; + pub fn connect_delete_button(app: &MainWindow) { let a = app.as_weak(); app.on_deleted(move || { let app = a.upgrade().unwrap(); - let r = app.get_empty_folder_model(); - let m = r.borrow(); + let active_tab = app.get_active_tab(); - let (entries_to_delete, mut entries_left) = filter_out_checked_items(m, true); + match active_tab { + CurrentTab::EmptyFolders => handle_delete_empty_folders(&app), + _ => panic!(), + } + }); +} - if !entries_to_delete.is_empty() { - dbg!(format!("Items to remove {}", entries_to_delete.len())); +fn handle_delete_empty_folders(app: &MainWindow) { + let r = app.get_empty_folder_model(); + let (entries_to_delete, mut entries_left) = filter_out_checked_items(r.borrow(), false); - remove_all_items(entries_to_delete); - deselect_all_items(&mut entries_left); + if !entries_to_delete.is_empty() { + remove_selected_items(entries_to_delete); + deselect_all_items(&mut entries_left); - let r = ModelRc::new(VecModel::from(entries_left)); - app.set_empty_folder_model(r); - } - }); + let r = ModelRc::new(VecModel::from(entries_left)); + app.set_empty_folder_model(r); + } } // TODO delete in parallel items, consider to add progress bar -fn remove_all_items(items: Vec) { +fn remove_selected_items(items: Vec) { + dbg!(format!("Items to remove {}", items.len())); items.into_iter().for_each(|(_checked, _header_row, _selected_row, _data)| {}); } @@ -90,7 +98,7 @@ fn check_if_header_is_checked(items: &ModelRc) { } } -// In some modes header should not be visible +// In some modes header should not be visible, but if are, then it is a bug #[cfg(debug_assertions)] fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, can_have_header: bool) { if !can_have_header { @@ -103,9 +111,10 @@ fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, can #[cfg(test)] mod tests { + use slint::{Model, ModelRc, SharedString, VecModel}; + use crate::common::ModelType; use crate::connect_delete::filter_out_checked_items; - use slint::{Model, ModelRc, SharedString, VecModel}; #[test] fn test_filter_out_checked_items_empty() { From f128dd6a881fa58fd3000762d8f8844222cf3100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 27 Oct 2023 21:37:51 +0200 Subject: [PATCH 024/107] Id --- czkawka_slint_gui/src/connect_scan.rs | 2 +- czkawka_slint_gui/ui/color_palette.slint | 5 +++ czkawka_slint_gui/ui/left_side_panel.slint | 36 +++++++++++++++++++--- czkawka_slint_gui/ui/main_lists.slint | 2 +- czkawka_slint_gui/ui/settings.slint | 3 ++ 5 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 czkawka_slint_gui/ui/color_palette.slint create mode 100644 czkawka_slint_gui/ui/settings.slint diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index 2d9c4019f..66d9f5cb7 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -35,7 +35,7 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender, progress_sender: Sender, stop_receiver: Receiver<()>) { thread::spawn(move || { let mut ef = EmptyFolder::new(); - ef.set_included_directory(vec![PathBuf::from("/home/rafal")]); + ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); ef.find_empty_folders(Some(&stop_receiver), Some(&progress_sender)); ef.get_empty_folder_list(); diff --git a/czkawka_slint_gui/ui/color_palette.slint b/czkawka_slint_gui/ui/color_palette.slint new file mode 100644 index 000000000..3a87b72e4 --- /dev/null +++ b/czkawka_slint_gui/ui/color_palette.slint @@ -0,0 +1,5 @@ +export global ColorPalette { + // Tabs at left side + in-out property tab_selected_color: NativeStyleMetrics.dark-color-scheme ? red : blue; + in-out property tab_hovered_color: NativeStyleMetrics.dark-color-scheme ? green : yellow; +} \ No newline at end of file diff --git a/czkawka_slint_gui/ui/left_side_panel.slint b/czkawka_slint_gui/ui/left_side_panel.slint index d35458a66..e1b281816 100644 --- a/czkawka_slint_gui/ui/left_side_panel.slint +++ b/czkawka_slint_gui/ui/left_side_panel.slint @@ -1,5 +1,6 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; import {CurrentTab} from "common.slint"; +import {ColorPalette} from "color_palette.slint"; component TabItem { in property scanning; @@ -7,10 +8,32 @@ component TabItem { in property text; in property curr_tab; - Button { - enabled: !scanning; + + Rectangle { + width: parent.width; + horizontal-stretch: 1.0; + background: touch-area.has-hover ? blue : green; + opacity: 0.05; + + touch_area:= TouchArea { + clicked => { + root.active-tab = root.curr-tab; + } + } + } + HorizontalLayout { + width: parent.width; + alignment: LayoutAlignment.end; + Rectangle { + visible: (root.active-tab == root.curr-tab); + width: 5px; + background: ColorPalette.tab_selected_color; + } + } + Text { text: root.text; - clicked => { root.active-tab = root.curr-tab; } + width: parent.width; + horizontal-alignment: center; } } @@ -29,22 +52,25 @@ export component LeftSidePanel { } } VerticalLayout { - spacing: 3px; + // spacing: 3px; alignment: center; - + out property element-size: 25px; TabItem { + height: parent.element-size; scanning: scanning; text: "Empty Folders"; active-tab <=> root.active-tab; curr_tab: CurrentTab.EmptyFolders; } TabItem { + height: parent.element-size; scanning: scanning; text: "Empty Files"; active-tab <=> root.active-tab; curr_tab: CurrentTab.EmptyFiles; } TabItem { + height: parent.element-size; scanning: scanning; text: "Similar Images"; active-tab <=> root.active-tab; diff --git a/czkawka_slint_gui/ui/main_lists.slint b/czkawka_slint_gui/ui/main_lists.slint index cfe630065..0c94efaf9 100644 --- a/czkawka_slint_gui/ui/main_lists.slint +++ b/czkawka_slint_gui/ui/main_lists.slint @@ -17,7 +17,7 @@ export component MainList { columns: ["Selection", "Folder Name", "Path"]; last-column: "Modification Date"; - column-sizes: [30px, 100px, 100px, 100px]; + column-sizes: [35px, 100px, 350px, 300px]; values <=> empty-folder-model; parentPathIdx: 2; fileNameIdx: 1; diff --git a/czkawka_slint_gui/ui/settings.slint b/czkawka_slint_gui/ui/settings.slint new file mode 100644 index 000000000..86ee2153d --- /dev/null +++ b/czkawka_slint_gui/ui/settings.slint @@ -0,0 +1,3 @@ +export global Settings { + in-out property todo: blue; +} \ No newline at end of file From 230ac9d6c79623313dbe74abdd369af0c1d8408b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 28 Oct 2023 18:20:46 +0200 Subject: [PATCH 025/107] Ab --- czkawka_slint_gui/README.md | 20 +++++++++ czkawka_slint_gui/ui/color_palette.slint | 11 ++++- czkawka_slint_gui/ui/common.slint | 7 +++ czkawka_slint_gui/ui/left_side_panel.slint | 2 +- czkawka_slint_gui/ui/main_lists.slint | 43 ++++++++++--------- .../ui/selectable_tree_view.slint | 6 +-- 6 files changed, 61 insertions(+), 28 deletions(-) create mode 100644 czkawka_slint_gui/README.md diff --git a/czkawka_slint_gui/README.md b/czkawka_slint_gui/README.md new file mode 100644 index 000000000..18dafa79f --- /dev/null +++ b/czkawka_slint_gui/README.md @@ -0,0 +1,20 @@ +# NAME_TODO + +NAME_TODO is new Czkawka frontend written in Slint(written mostly in Rust) in opposite to Gtk 4 frontend which uses mostly C code. + +Different + +## Requirements +Slint version of app should not have any special runtime requirements - it should work on almost any OpenGL 3 capable device. + +Alternatively, it can be run with software rendering. + +## Compilation +Default compilation is done by `cargo build --release`. + +All dependencies should be handled by cargo, except windows where you need to install m. + +The only exception is building skia frontend, that require + + + diff --git a/czkawka_slint_gui/ui/color_palette.slint b/czkawka_slint_gui/ui/color_palette.slint index 3a87b72e4..447d0357e 100644 --- a/czkawka_slint_gui/ui/color_palette.slint +++ b/czkawka_slint_gui/ui/color_palette.slint @@ -1,5 +1,12 @@ +import { StyleMetrics } from "std-widgets.slint"; + export global ColorPalette { // Tabs at left side - in-out property tab_selected_color: NativeStyleMetrics.dark-color-scheme ? red : blue; - in-out property tab_hovered_color: NativeStyleMetrics.dark-color-scheme ? green : yellow; + in-out property tab_selected_color: StyleMetrics.dark-color-scheme ? red : blue; + in-out property tab_hovered_color: StyleMetrics.dark-color-scheme ? green : yellow; + + // ListView + in-out property list_view_normal_color: StyleMetrics.dark-color-scheme ? #474747 : #dddddd; + in-out property list_view_normal_header_color: StyleMetrics.dark-color-scheme ? #292929 : #888888; + in-out property list_view_normal_selected_header: StyleMetrics.dark-color-scheme ? #575757 : #cccccc; } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/common.slint b/czkawka_slint_gui/ui/common.slint index 700cae136..0946e9fdc 100644 --- a/czkawka_slint_gui/ui/common.slint +++ b/czkawka_slint_gui/ui/common.slint @@ -13,4 +13,11 @@ export struct ProgressToSend { current_progress: int, all_progress: int, step_name: string, +} + +export struct MainListModel { + checked: bool, + header_row: bool, + selected: bool, + data: [string] } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/left_side_panel.slint b/czkawka_slint_gui/ui/left_side_panel.slint index e1b281816..c0139b226 100644 --- a/czkawka_slint_gui/ui/left_side_panel.slint +++ b/czkawka_slint_gui/ui/left_side_panel.slint @@ -12,7 +12,7 @@ component TabItem { Rectangle { width: parent.width; horizontal-stretch: 1.0; - background: touch-area.has-hover ? blue : green; + background: touch-area.has-hover ? ColorPalette.tab-hovered-color : transparent; opacity: 0.05; touch_area:= TouchArea { diff --git a/czkawka_slint_gui/ui/main_lists.slint b/czkawka_slint_gui/ui/main_lists.slint index 0c94efaf9..645c9d49a 100644 --- a/czkawka_slint_gui/ui/main_lists.slint +++ b/czkawka_slint_gui/ui/main_lists.slint @@ -2,12 +2,13 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; import {CurrentTab, TypeOfOpenedItem} from "common.slint"; +import {MainListModel} from "common.slint"; export component MainList { callback item_opened(string); in-out property active-tab; - in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_folder_model; + in-out property <[MainListModel]> empty_folder_model; in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_files_model; in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> similar_images_model; @@ -23,26 +24,26 @@ export component MainList { fileNameIdx: 1; item_opened(item) => {item_opened(item)} } - if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { - min-width: 200px; + // if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { + // min-width: 200px; - columns: ["Selection", "Folder Name", "Path"]; - last-column: "Modification Date"; - column-sizes: [30px, 100px, 100px, 100px]; - values <=> empty-files-model; - parentPathIdx: 2; - fileNameIdx: 1; - item_opened(item) => {item_opened(item)} - } - if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { - min-width: 200px; + // columns: ["Selection", "Folder Name", "Path"]; + // last-column: "Modification Date"; + // column-sizes: [30px, 100px, 100px, 100px]; + // values <=> empty-files-model; + // parentPathIdx: 2; + // fileNameIdx: 1; + // item_opened(item) => {item_opened(item)} + // } + // if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { + // min-width: 200px; - columns: ["Selection", "Folder Name", "Path"]; - last-column: "Modification Date"; - column-sizes: [30px, 100px, 100px, 100px]; - values <=> similar-images-model; - parentPathIdx: 2; - fileNameIdx: 1; - item_opened(item) => {item_opened(item)} - } + // columns: ["Selection", "Folder Name", "Path"]; + // last-column: "Modification Date"; + // column-sizes: [30px, 100px, 100px, 100px]; + // values <=> similar-images-model; + // parentPathIdx: 2; + // fileNameIdx: 1; + // item_opened(item) => {item_opened(item)} + // } } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 2c634cdee..11763a15b 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -1,5 +1,6 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; import {TypeOfOpenedItem} from "common.slint"; +import {ColorPalette} from "color_palette.slint"; export component SelectableTableView inherits Rectangle { callback item_opened(string); @@ -75,10 +76,7 @@ export component SelectableTableView inherits Rectangle { for r[idx] in root.values : Rectangle { forward-focus: focus-item; height: 20px; - // TODO move this into singleton - background: r.header-row ? #888888 : (touch-area.has-hover ? (r.selected_row ? #cccccc : #dddddd) : (r.selected_row ? #cccccc: #dddddd)); - // background: touch-area.has-hover ? (selected ? #333333 : #222222) : (selected ? #333333: #222222); - + background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header: ColorPalette.list_view_normal_color)); touch_area:= TouchArea { forward-focus: focus-item; clicked => { From b8c5ffa713e3600658282886832d19a04f614cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 28 Oct 2023 20:08:14 +0200 Subject: [PATCH 026/107] Model --- czkawka_slint_gui/src/common.rs | 2 - czkawka_slint_gui/src/connect_delete.rs | 181 +++++++++--------- czkawka_slint_gui/src/connect_scan.rs | 9 +- czkawka_slint_gui/src/main.rs | 13 +- czkawka_slint_gui/ui/common.slint | 4 +- czkawka_slint_gui/ui/main_lists.slint | 46 ++--- czkawka_slint_gui/ui/main_window.slint | 8 +- .../ui/selectable_tree_view.slint | 5 +- 8 files changed, 141 insertions(+), 127 deletions(-) diff --git a/czkawka_slint_gui/src/common.rs b/czkawka_slint_gui/src/common.rs index c99da54c8..8b1378917 100644 --- a/czkawka_slint_gui/src/common.rs +++ b/czkawka_slint_gui/src/common.rs @@ -1,3 +1 @@ -use slint::{ModelRc, SharedString}; -pub type ModelType = (bool, bool, bool, ModelRc); diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index daeb8bace..23a9b609d 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -2,7 +2,7 @@ use std::borrow::Borrow; use slint::{ComponentHandle, Model, ModelRc, VecModel}; -use crate::common::ModelType; +use crate::MainListModel; use crate::{CurrentTab, MainWindow}; pub fn connect_delete_button(app: &MainWindow) { @@ -33,32 +33,32 @@ fn handle_delete_empty_folders(app: &MainWindow) { } // TODO delete in parallel items, consider to add progress bar -fn remove_selected_items(items: Vec) { +fn remove_selected_items(items: Vec) { dbg!(format!("Items to remove {}", items.len())); - items.into_iter().for_each(|(_checked, _header_row, _selected_row, _data)| {}); + items.into_iter().for_each(|_item| {}); } -fn deselect_all_items(items: &mut [ModelType]) { - items.iter_mut().for_each(|(_checked, _header_row, selected_row, _data)| { - *selected_row = false; +fn deselect_all_items(items: &mut [MainListModel]) { + items.iter_mut().for_each(|item| { + item.selected_row = false; }); } -fn filter_out_checked_items(items: &ModelRc, have_header: bool) -> (Vec, Vec) { +fn filter_out_checked_items(items: &ModelRc, have_header: bool) -> (Vec, Vec) { if cfg!(debug_assertions) { check_if_header_is_checked(items); check_if_header_is_selected_but_should_not_be(items, have_header); } - let (entries_to_delete, mut entries_left): (Vec<_>, Vec<_>) = items.iter().partition(|(checked, _header_row, _selected_row, _data)| *checked); + let (entries_to_delete, mut entries_left): (Vec<_>, Vec<_>) = items.iter().partition(|item| item.checked); if have_header && !entries_left.is_empty() { // First row must be header - assert!(entries_left[0].1); + assert!(entries_left[0].header_row); if entries_left.len() == 3 { // First row is header, so if second or third is also header, then there is no enough items to fill model - if entries_left[1].1 || entries_left[2].1 { + if entries_left[1].header_row || entries_left[2].header_row { entries_left = Vec::new(); } } else if entries_left.len() < 3 { @@ -66,9 +66,9 @@ fn filter_out_checked_items(items: &ModelRc, have_header: bool) -> (V entries_left = Vec::new(); } else { let mut last_header = 0; - let mut new_items: Vec = Vec::new(); + let mut new_items: Vec = Vec::new(); for i in 1..entries_left.len() { - if entries_left[i].1 { + if entries_left[i].header_row { if i - last_header > 2 { new_items.extend(entries_left[last_header..i].iter().cloned()); } @@ -89,22 +89,20 @@ fn filter_out_checked_items(items: &ModelRc, have_header: bool) -> (V // Function to verify if really headers are not checked // Checked header is big bug #[cfg(debug_assertions)] -fn check_if_header_is_checked(items: &ModelRc) { - for i in items.iter() { - let (checked, header_row, _selected_row, _data) = i; - if header_row { - assert!(!checked); +fn check_if_header_is_checked(items: &ModelRc) { + for item in items.iter() { + if item.header_row { + assert!(!item.checked); } } } // In some modes header should not be visible, but if are, then it is a bug #[cfg(debug_assertions)] -fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, can_have_header: bool) { +fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, can_have_header: bool) { if !can_have_header { - for i in items.iter() { - let (_checked, header_row, _selected_row, _data) = i; - assert!(!header_row); + for item in items.iter() { + assert!(!item.header_row); } } } @@ -113,13 +111,13 @@ fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, can mod tests { use slint::{Model, ModelRc, SharedString, VecModel}; - use crate::common::ModelType; + use crate::common::MainListModel; use crate::connect_delete::filter_out_checked_items; #[test] fn test_filter_out_checked_items_empty() { let vec_items = Vec::new(); - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); let (to_delete, left) = filter_out_checked_items(&items, false); assert!(to_delete.is_empty()); assert!(left.is_empty()); @@ -130,7 +128,7 @@ mod tests { #[test] fn test_filter_out_checked_items_one_element_valid_normal() { let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); let (to_delete, left) = filter_out_checked_items(&items, false); assert!(to_delete.is_empty()); assert_eq!(left.len(), items.iter().count()); @@ -139,7 +137,7 @@ mod tests { #[test] fn test_filter_out_checked_items_one_element_valid_header() { let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); let (to_delete, left) = filter_out_checked_items(&items, true); assert!(to_delete.is_empty()); assert!(left.is_empty()); @@ -149,82 +147,79 @@ mod tests { #[should_panic] fn test_filter_out_checked_items_one_element_invalid_normal() { let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); filter_out_checked_items(&items, false); } #[test] #[should_panic] fn test_filter_out_checked_items_one_element_invalid_header() { let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); filter_out_checked_items(&items, true); } - - #[test] - fn test_filter_out_checked_items_multiple_element_valid_normal() { - let vec_items = vec![ - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), - (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), - (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), - ]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - let (to_delete, left) = filter_out_checked_items(&items, false); - let to_delete_data = get_single_data_from_model(&to_delete); - let left_data = get_single_data_from_model(&left); - - assert_eq!(to_delete_data, vec!["3", "4"]); - assert_eq!(left_data, vec!["1", "2", "5"]); - } - - #[test] - fn test_filter_out_checked_items_multiple_element_valid_header() { - let vec_items = vec![ - (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), - (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), - (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), - (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("6")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("7")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("8")]))), - ]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - let (to_delete, left) = filter_out_checked_items(&items, true); - let to_delete_data = get_single_data_from_model(&to_delete); - let left_data = get_single_data_from_model(&left); - - assert_eq!(to_delete_data, vec!["3"]); - assert_eq!(left_data, vec!["6", "7", "8"]); - } - - #[test] - fn test_filter_out_checked_items_multiple2_element_valid_header() { - let vec_items = vec![ - (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), - (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("6")]))), - (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("7")]))), - (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("8")]))), - ]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - let (to_delete, left) = filter_out_checked_items(&items, true); - let to_delete_data = get_single_data_from_model(&to_delete); - let left_data = get_single_data_from_model(&left); - - assert_eq!(to_delete_data, vec!["3"]); - assert_eq!(left_data, vec!["1", "2", "4", "5", "6"]); - } - - fn get_single_data_from_model(model: &[ModelType]) -> Vec { - let mut d = model - .iter() - .map(|(_checked, _header_row, _selected_row, data)| data.iter().next().unwrap().to_string()) - .collect::>(); + // + // #[test] + // fn test_filter_out_checked_items_multiple_element_valid_normal() { + // let vec_items = vec![ + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), + // (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), + // (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), + // ]; + // let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + // let (to_delete, left) = filter_out_checked_items(&items, false); + // let to_delete_data = get_single_data_from_model(&to_delete); + // let left_data = get_single_data_from_model(&left); + // + // assert_eq!(to_delete_data, vec!["3", "4"]); + // assert_eq!(left_data, vec!["1", "2", "5"]); + // } + // + // #[test] + // fn test_filter_out_checked_items_multiple_element_valid_header() { + // let vec_items = vec![ + // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), + // (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), + // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), + // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("6")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("7")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("8")]))), + // ]; + // let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + // let (to_delete, left) = filter_out_checked_items(&items, true); + // let to_delete_data = get_single_data_from_model(&to_delete); + // let left_data = get_single_data_from_model(&left); + // + // assert_eq!(to_delete_data, vec!["3"]); + // assert_eq!(left_data, vec!["6", "7", "8"]); + // } + // + // #[test] + // fn test_filter_out_checked_items_multiple2_element_valid_header() { + // let vec_items = vec![ + // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), + // (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("6")]))), + // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("7")]))), + // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("8")]))), + // ]; + // let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + // let (to_delete, left) = filter_out_checked_items(&items, true); + // let to_delete_data = get_single_data_from_model(&to_delete); + // let left_data = get_single_data_from_model(&left); + // + // assert_eq!(to_delete_data, vec!["3"]); + // assert_eq!(left_data, vec!["1", "2", "4", "5", "6"]); + // } + + fn get_single_data_from_model(model: &[MainListModel]) -> Vec { + let mut d = model.iter().map(|item| item.data.iter().next().unwrap().to_string()).collect::>(); d.sort(); d } diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index 66d9f5cb7..9737289a3 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -1,3 +1,4 @@ +use crate::MainListModel; use crate::{split_path, CurrentTab, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; use crossbeam_channel::{Receiver, Sender}; @@ -58,7 +59,13 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender SharedString::from(NaiveDateTime::from_timestamp_opt(folder_map[&path].modified_date as i64, 0).unwrap().to_string()), ]); - items.push((false, false, false, ModelRc::new(data_model))); + let main = MainListModel { + checked: false, + header_row: false, + selected_row: false, + val: ModelRc::new(data_model), + }; + items.push(main); } app.set_empty_folder_model(items.into()); app.invoke_scan_ended(); diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index bdc8d5604..d0ecc9c98 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -15,7 +15,6 @@ use crate::connect_delete::connect_delete_button; use crate::connect_open::connect_open_items; use crate::connect_scan::connect_scan_button; -use crate::common::ModelType; use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_stop::connect_stop_button; use czkawka_core::common_dir_traversal::ProgressData; @@ -43,7 +42,7 @@ fn main() { // TODO remove this after trying pub fn to_remove_debug(app: &MainWindow) { - let row_data: Rc> = Rc::new(VecModel::default()); + let row_data: Rc> = Rc::new(VecModel::default()); for r in 0..100_000 { let items = VecModel::default(); @@ -53,7 +52,15 @@ pub fn to_remove_debug(app: &MainWindow) { let is_header = r % 3 == 0; let is_checked = (r % 2 == 0) && !is_header; - row_data.push((is_checked, is_header, false, ModelRc::new(items))); + + let item = MainListModel { + checked: is_checked, + header_row: is_header, + selected_row: false, + val: ModelRc::new(items), + }; + + row_data.push(item); } app.set_empty_folder_model(row_data.into()); } diff --git a/czkawka_slint_gui/ui/common.slint b/czkawka_slint_gui/ui/common.slint index 0946e9fdc..a9e165bea 100644 --- a/czkawka_slint_gui/ui/common.slint +++ b/czkawka_slint_gui/ui/common.slint @@ -18,6 +18,6 @@ export struct ProgressToSend { export struct MainListModel { checked: bool, header_row: bool, - selected: bool, - data: [string] + selected_row: bool, + val: [string] } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_lists.slint b/czkawka_slint_gui/ui/main_lists.slint index 645c9d49a..f9a656232 100644 --- a/czkawka_slint_gui/ui/main_lists.slint +++ b/czkawka_slint_gui/ui/main_lists.slint @@ -9,8 +9,8 @@ export component MainList { in-out property active-tab; in-out property <[MainListModel]> empty_folder_model; - in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_files_model; - in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> similar_images_model; + in-out property <[MainListModel]> empty_files_model; + in-out property <[MainListModel]> similar_images_model; // TODO - using root.active-tab in visible property will not clear model if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { @@ -24,26 +24,28 @@ export component MainList { fileNameIdx: 1; item_opened(item) => {item_opened(item)} } - // if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { - // min-width: 200px; + + if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { + min-width: 200px; + + columns: ["Selection", "Folder Name", "Path"]; + last-column: "Modification Date"; + column-sizes: [30px, 100px, 100px, 100px]; + values <=> empty-files-model; + parentPathIdx: 2; + fileNameIdx: 1; + item_opened(item) => {item_opened(item)} + } - // columns: ["Selection", "Folder Name", "Path"]; - // last-column: "Modification Date"; - // column-sizes: [30px, 100px, 100px, 100px]; - // values <=> empty-files-model; - // parentPathIdx: 2; - // fileNameIdx: 1; - // item_opened(item) => {item_opened(item)} - // } - // if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { - // min-width: 200px; + if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { + min-width: 200px; - // columns: ["Selection", "Folder Name", "Path"]; - // last-column: "Modification Date"; - // column-sizes: [30px, 100px, 100px, 100px]; - // values <=> similar-images-model; - // parentPathIdx: 2; - // fileNameIdx: 1; - // item_opened(item) => {item_opened(item)} - // } + columns: ["Selection", "Folder Name", "Path"]; + last-column: "Modification Date"; + column-sizes: [30px, 100px, 100px, 100px]; + values <=> similar-images-model; + parentPathIdx: 2; + fileNameIdx: 1; + item_opened(item) => {item_opened(item)} + } } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index a3baf61fb..da5af5452 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -5,6 +5,8 @@ import {MainList} from "main_lists.slint"; import {CurrentTab, ProgressToSend} from "common.slint"; import { ActionButtons } from "action_buttons.slint"; import { Progress } from "progress.slint"; +import {MainListModel} from "common.slint"; + export component MainWindow inherits Window { callback deleted; @@ -28,7 +30,7 @@ export component MainWindow inherits Window { }; in-out property active-tab: CurrentTab.EmptyFolders; - in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_folder_model: [ + in-out property <[MainListModel]> empty_folder_model: [ {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , @@ -57,8 +59,8 @@ export component MainWindow inherits Window { {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} ]; - in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> empty_files_model: []; - in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> similar_images_model: []; + in-out property <[MainListModel]> empty_files_model: []; + in-out property <[MainListModel]> similar_images_model: []; title: root.active-tab == CurrentTab.EmptyFiles ? "EmptyFiles" : (root.active-tab == CurrentTab.EmptyFolders ? "EmptyFolders" : "Similar Images"); diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index 11763a15b..b1f5b3c7a 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -1,13 +1,15 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; import {TypeOfOpenedItem} from "common.slint"; import {ColorPalette} from "color_palette.slint"; +import {MainListModel} from "common.slint"; + export component SelectableTableView inherits Rectangle { callback item_opened(string); in property <[string]> columns; in property last_column; - in-out property <[{checked: bool, header_row: bool, selected_row: bool, val:[string]}]> values; + in-out property <[MainListModel]> values; in-out property <[length]> column_sizes; private property <[length]> real_sizes: [0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px]; @@ -74,6 +76,7 @@ export component SelectableTableView inherits Rectangle { forward-focus: focus-item; for r[idx] in root.values : Rectangle { + border-radius: 20px; forward-focus: focus-item; height: 20px; background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header: ColorPalette.list_view_normal_color)); From 4663f4ef00244172deb8022828d197c76614511b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 28 Oct 2023 20:27:04 +0200 Subject: [PATCH 027/107] Simplified tests --- czkawka_slint_gui/src/connect_delete.rs | 152 +++++++++++++----------- 1 file changed, 80 insertions(+), 72 deletions(-) diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index 23a9b609d..c2bfec0a1 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -111,13 +111,13 @@ fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, mod tests { use slint::{Model, ModelRc, SharedString, VecModel}; - use crate::common::MainListModel; use crate::connect_delete::filter_out_checked_items; + use crate::MainListModel; #[test] fn test_filter_out_checked_items_empty() { - let vec_items = Vec::new(); - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items: ModelRc = create_new_model(vec![]); + let (to_delete, left) = filter_out_checked_items(&items, false); assert!(to_delete.is_empty()); assert!(left.is_empty()); @@ -127,8 +127,7 @@ mod tests { } #[test] fn test_filter_out_checked_items_one_element_valid_normal() { - let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items = create_new_model(vec![(false, false, false, vec![])]); let (to_delete, left) = filter_out_checked_items(&items, false); assert!(to_delete.is_empty()); assert_eq!(left.len(), items.iter().count()); @@ -136,8 +135,7 @@ mod tests { #[test] fn test_filter_out_checked_items_one_element_valid_header() { - let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items = create_new_model(vec![(false, true, false, vec![])]); let (to_delete, left) = filter_out_checked_items(&items, true); assert!(to_delete.is_empty()); assert!(left.is_empty()); @@ -146,81 +144,91 @@ mod tests { #[test] #[should_panic] fn test_filter_out_checked_items_one_element_invalid_normal() { - let vec_items = vec![(false, true, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items = create_new_model(vec![(false, true, false, vec![])]); filter_out_checked_items(&items, false); } #[test] #[should_panic] fn test_filter_out_checked_items_one_element_invalid_header() { - let vec_items = vec![(false, false, false, ModelRc::new(VecModel::default()))]; - let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); + let items = create_new_model(vec![(false, false, false, vec![])]); filter_out_checked_items(&items, true); } - // - // #[test] - // fn test_filter_out_checked_items_multiple_element_valid_normal() { - // let vec_items = vec![ - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), - // (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), - // (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), - // ]; - // let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - // let (to_delete, left) = filter_out_checked_items(&items, false); - // let to_delete_data = get_single_data_from_model(&to_delete); - // let left_data = get_single_data_from_model(&left); - // - // assert_eq!(to_delete_data, vec!["3", "4"]); - // assert_eq!(left_data, vec!["1", "2", "5"]); - // } - // - // #[test] - // fn test_filter_out_checked_items_multiple_element_valid_header() { - // let vec_items = vec![ - // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), - // (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), - // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), - // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("6")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("7")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("8")]))), - // ]; - // let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - // let (to_delete, left) = filter_out_checked_items(&items, true); - // let to_delete_data = get_single_data_from_model(&to_delete); - // let left_data = get_single_data_from_model(&left); - // - // assert_eq!(to_delete_data, vec!["3"]); - // assert_eq!(left_data, vec!["6", "7", "8"]); - // } - // - // #[test] - // fn test_filter_out_checked_items_multiple2_element_valid_header() { - // let vec_items = vec![ - // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("1")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("2")]))), - // (true, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("3")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("4")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("5")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("6")]))), - // (false, true, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("7")]))), - // (false, false, false, ModelRc::new(VecModel::from_slice(&[SharedString::from("8")]))), - // ]; - // let items: ModelRc = ModelRc::new(VecModel::from(vec_items)); - // let (to_delete, left) = filter_out_checked_items(&items, true); - // let to_delete_data = get_single_data_from_model(&to_delete); - // let left_data = get_single_data_from_model(&left); - // - // assert_eq!(to_delete_data, vec!["3"]); - // assert_eq!(left_data, vec!["1", "2", "4", "5", "6"]); - // } + + #[test] + fn test_filter_out_checked_items_multiple_element_valid_normal() { + let items = create_new_model(vec![ + (false, false, false, vec!["1"]), + (false, false, false, vec!["2"]), + (true, false, false, vec!["3"]), + (true, false, false, vec!["4"]), + (false, false, false, vec!["5"]), + ]); + let (to_delete, left) = filter_out_checked_items(&items, false); + let to_delete_data = get_single_data_from_model(&to_delete); + let left_data = get_single_data_from_model(&left); + + assert_eq!(to_delete_data, vec!["3", "4"]); + assert_eq!(left_data, vec!["1", "2", "5"]); + } + + #[test] + fn test_filter_out_checked_items_multiple_element_valid_header() { + let items = create_new_model(vec![ + (false, true, false, vec!["1"]), + (false, false, false, vec!["2"]), + (true, false, false, vec!["3"]), + (false, true, false, vec!["4"]), + (false, false, false, vec!["5"]), + (false, true, false, vec!["6"]), + (false, false, false, vec!["7"]), + (false, false, false, vec!["8"]), + ]); + let (to_delete, left) = filter_out_checked_items(&items, true); + let to_delete_data = get_single_data_from_model(&to_delete); + let left_data = get_single_data_from_model(&left); + + assert_eq!(to_delete_data, vec!["3"]); + assert_eq!(left_data, vec!["6", "7", "8"]); + } + + #[test] + fn test_filter_out_checked_items_multiple2_element_valid_header() { + let items = create_new_model(vec![ + (false, true, false, vec!["1"]), + (false, false, false, vec!["2"]), + (true, false, false, vec!["3"]), + (false, false, false, vec!["4"]), + (false, false, false, vec!["5"]), + (false, false, false, vec!["6"]), + (false, true, false, vec!["7"]), + (false, false, false, vec!["8"]), + ]); + let (to_delete, left) = filter_out_checked_items(&items, true); + let to_delete_data = get_single_data_from_model(&to_delete); + let left_data = get_single_data_from_model(&left); + + assert_eq!(to_delete_data, vec!["3"]); + assert_eq!(left_data, vec!["1", "2", "4", "5", "6"]); + } fn get_single_data_from_model(model: &[MainListModel]) -> Vec { - let mut d = model.iter().map(|item| item.data.iter().next().unwrap().to_string()).collect::>(); + let mut d = model.iter().map(|item| item.val.iter().next().unwrap().to_string()).collect::>(); d.sort(); d } + + fn create_new_model(items: Vec<(bool, bool, bool, Vec<&'static str>)>) -> ModelRc { + let model = VecModel::default(); + for item in items { + let all_items = item.3.iter().map(|item| SharedString::from(*item)).collect::>(); + let all_items = VecModel::from(all_items); + model.push(MainListModel { + checked: item.0, + header_row: item.1, + selected_row: item.2, + val: ModelRc::new(all_items), + }); + } + ModelRc::new(model) + } } From d367f33e4088ea1f5a781bf661245d696c12256e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 29 Oct 2023 13:19:28 +0100 Subject: [PATCH 028/107] Handsome --- czkawka_slint_gui/Cargo.toml | 4 +- czkawka_slint_gui/README.md | 59 +++++++++++++++++-- czkawka_slint_gui/src/main.rs | 3 +- czkawka_slint_gui/ui/left_side_panel.slint | 35 +++++++++-- czkawka_slint_gui/ui/main_window.slint | 1 - .../ui/selectable_tree_view.slint | 2 +- 6 files changed, 88 insertions(+), 16 deletions(-) diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index ab669d35e..73817d56d 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -17,8 +17,6 @@ build = "build.rs" # Try to use only needed features from https://github.com/slint-ui/slint/blob/master/api/rs/slint/Cargo.toml#L23-L31 slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = ["std", "backend-winit", - "renderer-femtovg", - "renderer-software", "accessibility", "compat-1-2" ] } @@ -35,7 +33,7 @@ handsome_logger = "0.8.0" slint-build = { git = "https://github.com/slint-ui/slint.git" } [features] -default = ["winit_femtovg"] +default = ["winit_femtovg", "winit_software"] skia_opengl = ["slint/renderer-skia-opengl"] skia_vulkan = ["slint/renderer-skia-vulkan"] software = ["slint/renderer-software"] diff --git a/czkawka_slint_gui/README.md b/czkawka_slint_gui/README.md index 18dafa79f..87e4f0fa9 100644 --- a/czkawka_slint_gui/README.md +++ b/czkawka_slint_gui/README.md @@ -2,19 +2,68 @@ NAME_TODO is new Czkawka frontend written in Slint(written mostly in Rust) in opposite to Gtk 4 frontend which uses mostly C code. -Different +Different toolkit means different look, limitations and features, so you should not expect same features like in Gtk 4 frontend. ## Requirements -Slint version of app should not have any special runtime requirements - it should work on almost any OpenGL 3 capable device. +Slint version of app should not have any special runtime requirements - it should work on almost any OpenGL ES 2 capable device. Alternatively, it can be run with software rendering. ## Compilation -Default compilation is done by `cargo build --release`. +Default compilation is done by `cargo build --release` and should work on most systems. -All dependencies should be handled by cargo, except windows where you need to install m. +You need the latest available version of Rust to compile it, because NAME_TODO aims to support the latest slint verions, +that should provide best experience(fixed more bugs/new features). -The only exception is building skia frontend, that require +The only exception is building non default skia renderer, that require on windows msvc compiler(not sure how to exactly install it). +Also skia renderer is written in C++ and uses on platforms like x86_64 and arm64 prebuild binaries, so if you are using different architecture, this library will be build from source, which can take a lot of time and require additional dependencies. +## Additional Renderers +By default, only femtovg(opengl) and software renderer are enabled, but you can enable more renderers by compiling app with additional features. +Most of the users will want to use app with windowing system/compositor, so features starting with `winit` in name are recommended. + +E.g. +``` +cargo build --release --features "winit_skia_opengl" +cargo build --release --features "winit_software" +``` + +to run app with different renderers you need to use it, by adding `SLINT_BACKEND` environment +``` +SLINT_BACKEND=winit-femtovg ./target/release/czkawka_slint_gui +SLINT_BACKEND=software ./target/release/czkawka_slint_gui +SLINT_BACKEND=skia ./target/release/czkawka_slint_gui # This uses now opengl - https://github.com/slint-ui/slint/discussions/3799 +``` +when you will use invalid/non-existing backend, app will show warning +``` +slint winit: unrecognized renderer skia, falling back to FemtoVG +``` +to check what is really used, add `SLINT_DEBUG_PERFORMANCE=refresh_lazy,console,overlay` env +``` +SLINT_DEBUG_PERFORMANCE=refresh_lazy,console,overlay cargo run +``` +should print something like +``` +Slint: Build config: debug; Backend: software +``` + +## How to help? +- Suggesting possible design changes in the gui - of course, they should be possible to be simply implemented in the slint keeping in mind the performance aspect as well +- Modifying user interface - gui is written in simple language similar to qml - [slint live preview example](https://slint.dev/releases/1.2.2/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) +- Improving libraries used by NAME_TODO e.g. czkawka_core, image-rs etc. +- Improving app rust code + +## Why Slint? +There are multiple reasons why I decided to use Slint as toolkit for NAME_TODO 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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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 | - Internal .slint language is more limited than QML(javascript flexibility is big pl)
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different ) | +| 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) and this is also
- Docs are almost non-existent | +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 to not look at Iced which only allows to create GUI from Rust. + +GTK and QT also I throw away due cross compilation problems caused mostly by using C/C++, so only Slint left. \ No newline at end of file diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index d0ecc9c98..5b81ffb1f 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -17,12 +17,13 @@ use crate::connect_scan::connect_scan_button; use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_stop::connect_stop_button; +use czkawka_core::common::setup_logger; use czkawka_core::common_dir_traversal::ProgressData; use slint::{ModelRc, VecModel}; slint::include_modules!(); fn main() { - handsome_logger::init().unwrap(); + setup_logger(false); let app = MainWindow::new().unwrap(); //.run().unwrap(); diff --git a/czkawka_slint_gui/ui/left_side_panel.slint b/czkawka_slint_gui/ui/left_side_panel.slint index c0139b226..4cbe83758 100644 --- a/czkawka_slint_gui/ui/left_side_panel.slint +++ b/czkawka_slint_gui/ui/left_side_panel.slint @@ -8,7 +8,6 @@ component TabItem { in property text; in property curr_tab; - Rectangle { width: parent.width; horizontal-stretch: 1.0; @@ -17,6 +16,10 @@ component TabItem { touch_area:= TouchArea { clicked => { + if (root.active-tab == root.curr-tab) { + return; + } + root.active-tab = root.curr-tab; } } @@ -24,10 +27,24 @@ component TabItem { HorizontalLayout { width: parent.width; alignment: LayoutAlignment.end; - Rectangle { - visible: (root.active-tab == root.curr-tab); - width: 5px; - background: ColorPalette.tab_selected_color; + layout_rectangle := VerticalLayout { + empty_rectangle := Rectangle { + + } + current_rectangle := Rectangle { + visible: (root.active-tab == root.curr-tab); + border-radius: 2px; + width: 5px; + height: 0px; + background: ColorPalette.tab_selected_color; + animate height { + duration: 150ms; + easing: ease; + } + } + empty_rectangle2 := Rectangle { + + } } } Text { @@ -35,6 +52,14 @@ component TabItem { width: parent.width; horizontal-alignment: center; } + states [ + is-selected when root.active-tab == root.curr-tab: { + current_rectangle.height: layout_rectangle.height; + } + is-not-selected when root.active-tab != root.curr-tab: { + current_rectangle.height: 0px; + } + ] } export component LeftSidePanel { diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index da5af5452..9834ade41 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -7,7 +7,6 @@ import { ActionButtons } from "action_buttons.slint"; import { Progress } from "progress.slint"; import {MainListModel} from "common.slint"; - export component MainWindow inherits Window { callback deleted; callback scan_stopping; diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/czkawka_slint_gui/ui/selectable_tree_view.slint index b1f5b3c7a..fc119852c 100644 --- a/czkawka_slint_gui/ui/selectable_tree_view.slint +++ b/czkawka_slint_gui/ui/selectable_tree_view.slint @@ -76,7 +76,7 @@ export component SelectableTableView inherits Rectangle { forward-focus: focus-item; for r[idx] in root.values : Rectangle { - border-radius: 20px; + border-radius: 5px; forward-focus: focus-item; height: 20px; background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header: ColorPalette.list_view_normal_color)); From 4ae23037e493bc6af7f5e257f8220fd097e3dba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 29 Oct 2023 21:11:07 +0100 Subject: [PATCH 029/107] Clippy also on generated code --- czkawka_slint_gui/src/connect_delete.rs | 25 ++++++++++++++----------- czkawka_slint_gui/src/connect_open.rs | 4 ++-- czkawka_slint_gui/src/main.rs | 12 ++++++++++++ 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index c2bfec0a1..982f25ede 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -35,13 +35,14 @@ fn handle_delete_empty_folders(app: &MainWindow) { // TODO delete in parallel items, consider to add progress bar fn remove_selected_items(items: Vec) { dbg!(format!("Items to remove {}", items.len())); - items.into_iter().for_each(|_item| {}); + drop(items); + // items.into_iter().for_each(|_item| {}); } fn deselect_all_items(items: &mut [MainListModel]) { - items.iter_mut().for_each(|item| { + for item in items { item.selected_row = false; - }); + } } fn filter_out_checked_items(items: &ModelRc, have_header: bool) -> (Vec, Vec) { @@ -88,21 +89,23 @@ fn filter_out_checked_items(items: &ModelRc, have_header: bool) - // Function to verify if really headers are not checked // Checked header is big bug -#[cfg(debug_assertions)] fn check_if_header_is_checked(items: &ModelRc) { - for item in items.iter() { - if item.header_row { - assert!(!item.checked); + if cfg!(debug_assertions) { + for item in items.iter() { + if item.header_row { + assert!(!item.checked); + } } } } // In some modes header should not be visible, but if are, then it is a bug -#[cfg(debug_assertions)] fn check_if_header_is_selected_but_should_not_be(items: &ModelRc, can_have_header: bool) { - if !can_have_header { - for item in items.iter() { - assert!(!item.header_row); + if cfg!(debug_assertions) { + if !can_have_header { + for item in items.iter() { + assert!(!item.header_row); + } } } } diff --git a/czkawka_slint_gui/src/connect_open.rs b/czkawka_slint_gui/src/connect_open.rs index cfd56fcf7..e53b70d9b 100644 --- a/czkawka_slint_gui/src/connect_open.rs +++ b/czkawka_slint_gui/src/connect_open.rs @@ -3,9 +3,9 @@ use crate::MainWindow; pub fn connect_open_items(app: &MainWindow) { app.on_item_opened(move |path| { match open::that(&*path) { - Ok(_) => {} + Ok(()) => {} Err(e) => { - eprintln!("Failed to open file: {}", e); + eprintln!("Failed to open file: {e}"); } }; // TODO - this should be added to line edit diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index 5b81ffb1f..c7fb8e831 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -1,4 +1,16 @@ #![allow(clippy::comparison_chain)] +#![allow(clippy::collapsible_if)] +#![allow(clippy::overly_complex_bool_expr)] // Generated code +#![allow(clippy::semicolon_if_nothing_returned)] // Generated code +#![allow(clippy::used_underscore_binding)] // Generated code +#![allow(clippy::unreadable_literal)] // Generated code +#![allow(clippy::float_cmp)] // Generated code +#![allow(clippy::no_effect_underscore_binding)] // Generated code +#![allow(clippy::uninlined_format_args)] // Generated code +#![allow(clippy::needless_pass_by_value)] // Generated code +#![allow(clippy::redundant_closure_for_method_calls)] // Generated code +#![allow(clippy::items_after_statements)] // Generated code +#![allow(clippy::match_same_arms)] // Generated code mod common; mod connect_delete; From e00256d904ffcfe194861a53e9f72e95d091e925 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 1 Nov 2023 16:36:38 +0100 Subject: [PATCH 030/107] Basic settings --- Cargo.lock | 391 ++++++++---------------- czkawka_slint_gui/src/main.rs | 32 +- czkawka_slint_gui/src/settings.rs | 23 ++ czkawka_slint_gui/ui/bottom_panel.slint | 57 ++++ czkawka_slint_gui/ui/main_window.slint | 7 + czkawka_slint_gui/ui/settings.slint | 10 +- 6 files changed, 252 insertions(+), 268 deletions(-) create mode 100644 czkawka_slint_gui/src/settings.rs create mode 100644 czkawka_slint_gui/ui/bottom_panel.slint diff --git a/Cargo.lock b/Cargo.lock index 826b97dca..b2728f76e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1061f3ff92c2f65800df1f12fc7b4ff44ee14783104187dd04dfee6f11b0fd2" +checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -492,7 +492,7 @@ checksum = "7b50b5a44d59a98c55a9eeb518f39bf7499ba19fd98ee7d22618687f3f10adbf" dependencies = [ "bitflags 2.4.1", "log", - "polling 3.2.0", + "polling 3.3.0", "rustix", "slab", "thiserror", @@ -507,7 +507,7 @@ dependencies = [ "calloop 0.12.3", "rustix", "wayland-backend", - "wayland-client 0.31.1", + "wayland-client", ] [[package]] @@ -773,7 +773,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "const-field-offset-macro", "field-offset", @@ -782,7 +782,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "proc-macro2", "quote", @@ -815,9 +815,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "copypasta" -version = "0.8.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133fc8675ee3a4ec9aa513584deda9aa0faeda3586b87f7f0f2ba082c66fb172" +checksum = "6d35364349bf9e9e1c3a035ddcb00d188d23a3c40c50244c03c27a99fc6a65ae" dependencies = [ "clipboard-win", "objc", @@ -1448,9 +1448,9 @@ dependencies = [ [[package]] name = "fdeflate" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10" +checksum = "64d6dafc854908ff5da46ff3f8f473c6984119a2876a383a860246dd7841a868" dependencies = [ "simd-adler32", ] @@ -1906,16 +1906,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", -] - [[package]] name = "gethostname" version = "0.3.0" @@ -2022,7 +2012,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8da903822b136d42360518653fcf154455defc437d3e7a81475bf9a95ff1e47" dependencies = [ "heck", - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro-error", "proc-macro2", "quote", @@ -2068,9 +2058,9 @@ dependencies = [ [[package]] name = "glutin" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c03bcbdb3c865ac10196deaddbcea719e601d2d3eef7541872b8dee3492a36" +checksum = "eca18d477e18c996c1fd1a50e04c6a745b67e2d512c7fb51f2757d9486a0e3ee" dependencies = [ "bitflags 2.4.1", "cfg_aliases", @@ -2085,7 +2075,7 @@ dependencies = [ "objc2", "once_cell", "raw-window-handle 0.5.2", - "wayland-sys 0.31.1", + "wayland-sys", "windows-sys 0.48.0", "x11-dl", ] @@ -2224,7 +2214,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d57ec49cf9b657f69a05bca8027cff0a8dfd0c49e812be026fc7311f2163832f" dependencies = [ "anyhow", - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro-error", "proc-macro2", "quote", @@ -2342,7 +2332,7 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "calloop 0.11.0", "drm", @@ -2363,7 +2353,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2376,7 +2366,7 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "accesskit", "bytemuck", @@ -2412,7 +2402,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "cfg-if", "derive_more", @@ -2423,7 +2413,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "by_address", "codemap", @@ -2452,7 +2442,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "auto_enums", "bytemuck", @@ -2495,7 +2485,7 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "quote", "syn 2.0.38", @@ -2504,7 +2494,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "cfg-if", "const-field-offset", @@ -2536,7 +2526,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "ash", "bytemuck", @@ -2579,7 +2569,7 @@ dependencies = [ "serde", "serde_derive", "thiserror", - "toml 0.8.5", + "toml 0.8.6", "unic-langid", ] @@ -2765,9 +2755,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown 0.14.2", @@ -3253,15 +3243,6 @@ version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" -[[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" @@ -3289,15 +3270,6 @@ dependencies = [ "libc", ] -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.7.1" @@ -3411,18 +3383,6 @@ dependencies = [ "jni-sys", ] -[[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", - "libc", - "memoffset 0.6.5", -] - [[package]] name = "nix" version = "0.26.4" @@ -3517,20 +3477,20 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 2.0.38", @@ -3653,11 +3613,11 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "owned_ttf_parser" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "706de7e2214113d63a8238d1910463cfce781129a6f263d13fdb09ff64355ba4" +checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7" dependencies = [ - "ttf-parser 0.19.2", + "ttf-parser 0.20.0", ] [[package]] @@ -3874,9 +3834,9 @@ dependencies = [ [[package]] name = "polling" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a79e457c9898100b4298d57d69ec53d06f9a6ed352431ce5f377e082d2e846" +checksum = "e53b6af1f60f36f8c2ac2aad5459d75a5a9b4be1e8cdd40264f315d78193e531" dependencies = [ "cfg-if", "concurrent-queue", @@ -3888,9 +3848,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b559898e0b4931ed2d3b959ab0c2da4d99cc644c4b0b1a35b4d344027f474023" +checksum = "3bccab0e7fd7cc19f820a1c8c91720af652d0c88dc9664dd72aef2614f04af3b" dependencies = [ "critical-section", ] @@ -3936,6 +3896,15 @@ dependencies = [ "toml_edit 0.19.15", ] +[[package]] +name = "proc-macro-crate" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +dependencies = [ + "toml_edit 0.20.7", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -4186,9 +4155,9 @@ dependencies = [ [[package]] name = "rgb" -version = "0.8.36" +version = "0.8.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20ec2d3e3fc7a92ced357df9cebd5a10b6fb2aa1ee797bf7e9ce2f17dffc8f59" +checksum = "05aaa8004b64fd573fc9d002f4e632d51ad4f026c2b5ba95fcb6c2f32c2c47d8" dependencies = [ "bytemuck", ] @@ -4339,9 +4308,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.20" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", @@ -4456,7 +4425,7 @@ dependencies = [ "ab_glyph", "log", "memmap2 0.9.0", - "smithay-client-toolkit 0.18.0", + "smithay-client-toolkit", "tiny-skia 0.11.2", ] @@ -4500,9 +4469,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -4590,9 +4559,9 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "skia-bindings" -version = "0.67.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534eae89c6ff605e4a5088d8583ba3e1bbce98b0da9fd2eba37ce4698c86138a" +checksum = "0af1b86d01552a56d70b515e2bc1af9123acffcc679a7410010e2648f59fbec3" dependencies = [ "bindgen", "cc", @@ -4602,15 +4571,15 @@ dependencies = [ "regex", "serde_json", "tar", - "toml 0.8.5", + "toml 0.8.6", "ureq", ] [[package]] name = "skia-safe" -version = "0.67.0" +version = "0.68.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6be5caec5fbe1426bb06cfb6500ec00194d97e5ccad4573e7f972c9d6bd938" +checksum = "ed678303df69daf5b666faf477800ff7fcb7b67316b10a94c31d748d42dd5a83" dependencies = [ "bitflags 2.4.1", "lazy_static", @@ -4631,7 +4600,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -4647,18 +4616,18 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "i-slint-compiler", "spin_on", "thiserror", - "toml_edit 0.20.5", + "toml_edit 0.20.7", ] [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -4681,24 +4650,6 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" -[[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", - "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.0" @@ -4715,23 +4666,24 @@ dependencies = [ "rustix", "thiserror", "wayland-backend", - "wayland-client 0.31.1", + "wayland-client", "wayland-csd-frame", - "wayland-cursor 0.31.0", - "wayland-protocols 0.31.0", + "wayland-cursor", + "wayland-protocols", "wayland-protocols-wlr", - "wayland-scanner 0.31.0", + "wayland-scanner", "xkeysym", ] [[package]] name = "smithay-clipboard" -version = "0.6.6" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a345c870a1fae0b1b779085e81b51e614767c239e93503588e54c5b17f4b0e8" +checksum = "0bb62b280ce5a5cba847669933a0948d00904cf83845c944eae96a4738cea1a6" dependencies = [ - "smithay-client-toolkit 0.16.1", - "wayland-client 0.29.5", + "libc", + "smithay-client-toolkit", + "wayland-backend", ] [[package]] @@ -4767,9 +4719,9 @@ dependencies = [ [[package]] name = "softbuffer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c651aec504a26e45df1f8c8df237ee7eef8e31b3f13b267a69a374adafbbd1" +checksum = "826da2ead8e85d1b4ea579fae3d58ec10c81a77d61deab8918c4a4f7514b2948" dependencies = [ "as-raw-xcb-connection", "bytemuck", @@ -4788,11 +4740,11 @@ dependencies = [ "tiny-xlib", "wasm-bindgen", "wayland-backend", - "wayland-client 0.31.1", - "wayland-sys 0.31.1", + "wayland-client", + "wayland-sys", "web-sys", "windows-sys 0.48.0", - "x11rb 0.12.0", + "x11rb", ] [[package]] @@ -5111,14 +5063,14 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.1.2" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94af52f9402f94aac4948a2518b43359be8d9ce6cd9efc1c4de3b2f7b7e897d6" +checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" dependencies = [ "cfg-expr", "heck", "pkg-config", - "toml 0.8.5", + "toml 0.8.6", "version-compare", ] @@ -5141,13 +5093,13 @@ checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", + "redox_syscall 0.4.1", "rustix", "windows-sys 0.48.0", ] @@ -5337,14 +5289,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3efaf127c78d5339cc547cce4e4d973bd5e4f56e949a06d091c082ebeef2f800" +checksum = "8ff9e3abce27ee2c9a37f9ad37238c1bdd4e789c84ba37df76aa4d528f5072cc" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.5", + "toml_edit 0.20.7", ] [[package]] @@ -5362,18 +5314,18 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "toml_datetime", "winnow", ] [[package]] name = "toml_edit" -version = "0.20.5" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "782bf6c2ddf761c1e7855405e8975472acf76f7f36d0d4328bd3b7a2fae12a85" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", @@ -5491,6 +5443,12 @@ version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1" +[[package]] +name = "ttf-parser" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" + [[package]] name = "type-map" version = "0.4.0" @@ -5770,7 +5728,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "const-field-offset", "portable-atomic", @@ -5781,7 +5739,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#3deb620953f1307de1b9c0b5b757b5d8ed31a3a1" +source = "git+https://github.com/slint-ui/slint.git#1441719f61e9ab7e393ed6e601dab9b6bcb58a62" dependencies = [ "proc-macro2", "quote", @@ -5909,23 +5867,7 @@ dependencies = [ "nix 0.26.4", "scoped-tls", "smallvec", - "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", + "wayland-sys", ] [[package]] @@ -5937,19 +5879,7 @@ dependencies = [ "bitflags 2.4.1", "nix 0.26.4", "wayland-backend", - "wayland-scanner 0.31.0", -] - -[[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", + "wayland-scanner", ] [[package]] @@ -5963,17 +5893,6 @@ dependencies = [ "wayland-backend", ] -[[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.0" @@ -5981,22 +5900,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" dependencies = [ "nix 0.26.4", - "wayland-client 0.31.1", + "wayland-client", "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.0" @@ -6005,8 +5912,8 @@ checksum = "e253d7107ba913923dc253967f35e8561a3c65f914543e46843c88ddd729e21c" dependencies = [ "bitflags 2.4.1", "wayland-backend", - "wayland-client 0.31.1", - "wayland-scanner 0.31.0", + "wayland-client", + "wayland-scanner", ] [[package]] @@ -6017,9 +5924,9 @@ checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" dependencies = [ "bitflags 2.4.1", "wayland-backend", - "wayland-client 0.31.1", - "wayland-protocols 0.31.0", - "wayland-scanner 0.31.0", + "wayland-client", + "wayland-protocols", + "wayland-scanner", ] [[package]] @@ -6030,20 +5937,9 @@ checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" dependencies = [ "bitflags 2.4.1", "wayland-backend", - "wayland-client 0.31.1", - "wayland-protocols 0.31.0", - "wayland-scanner 0.31.0", -] - -[[package]] -name = "wayland-scanner" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" -dependencies = [ - "proc-macro2", - "quote", - "xml-rs", + "wayland-client", + "wayland-protocols", + "wayland-scanner", ] [[package]] @@ -6057,17 +5953,6 @@ dependencies = [ "quote", ] -[[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.31.1" @@ -6325,9 +6210,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winit" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b829f75d02fe1e225b97c91a04c326900147a50234d1141a1cbe215ce8798c11" +checksum = "161598019a9da35ab6c34dc46cd13546cba9dbf9816475d4dd9a639455016563" dependencies = [ "ahash", "android-activity", @@ -6354,28 +6239,28 @@ dependencies = [ "redox_syscall 0.3.5", "rustix", "sctk-adwaita", - "smithay-client-toolkit 0.18.0", + "smithay-client-toolkit", "smol_str", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", "wayland-backend", - "wayland-client 0.31.1", - "wayland-protocols 0.31.0", + "wayland-client", + "wayland-protocols", "wayland-protocols-plasma", "web-sys", "web-time", "windows-sys 0.48.0", "x11-dl", - "x11rb 0.12.0", + "x11rb", "xkbcommon-dl", ] [[package]] name = "winnow" -version = "0.5.17" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +checksum = "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32" dependencies = [ "memchr", ] @@ -6391,11 +6276,11 @@ dependencies = [ [[package]] name = "x11-clipboard" -version = "0.7.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "980b9aa9226c3b7de8e2adb11bf20124327c054e0e5812d2aac0b5b5a87e7464" +checksum = "b41aca1115b1f195f21c541c5efb423470848d48143127d0f07f8b90c27440df" dependencies = [ - "x11rb 0.10.1", + "x11rb", ] [[package]] @@ -6409,19 +6294,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "x11rb" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" -dependencies = [ - "gethostname 0.2.3", - "nix 0.24.3", - "winapi", - "winapi-wsapoll", - "x11rb-protocol 0.10.0", -] - [[package]] name = "x11rb" version = "0.12.0" @@ -6429,23 +6301,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1641b26d4dec61337c35a1b1aaf9e3cba8f46f0b43636c609ab0291a648040a" dependencies = [ "as-raw-xcb-connection", - "gethostname 0.3.0", + "gethostname", "libc", "libloading 0.7.4", "nix 0.26.4", "once_cell", "winapi", "winapi-wsapoll", - "x11rb-protocol 0.12.0", -] - -[[package]] -name = "x11rb-protocol" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67" -dependencies = [ - "nix 0.24.3", + "x11rb-protocol", ] [[package]] @@ -6540,18 +6403,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.15" +version = "0.7.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ba595b9f2772fbee2312de30eeb80ec773b4cb2f1e8098db024afadda6c06f" +checksum = "686b7e407015242119c33dab17b8f61ba6843534de936d94368856528eae4dcc" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.15" +version = "0.7.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "772666c41fb6dceaf520b564b962d738a8e1a83b41bd48945f50837aed78bb1d" +checksum = "020f3dfe25dfc38dfea49ce62d5d45ecdd7f0d8a724fa63eb36b6eba4ec76806" dependencies = [ "proc-macro2", "quote", diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index c7fb8e831..5ff9a543a 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -18,6 +18,7 @@ mod connect_open; mod connect_progress_receiver; mod connect_scan; mod connect_stop; +mod settings; use crossbeam_channel::{unbounded, Receiver, Sender}; use std::path::Path; @@ -29,6 +30,7 @@ use crate::connect_scan::connect_scan_button; use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_stop::connect_stop_button; +use crate::settings::reset_settings; use czkawka_core::common::setup_logger; use czkawka_core::common_dir_traversal::ProgressData; use slint::{ModelRc, VecModel}; @@ -50,12 +52,14 @@ fn main() { connect_open_items(&app); connect_progress_gathering(&app, progress_receiver); + reset_settings(&app); + app.run().unwrap(); } // TODO remove this after trying pub fn to_remove_debug(app: &MainWindow) { - let row_data: Rc> = Rc::new(VecModel::default()); + let header_row_data: Rc> = Rc::new(VecModel::default()); for r in 0..100_000 { let items = VecModel::default(); @@ -73,9 +77,31 @@ pub fn to_remove_debug(app: &MainWindow) { val: ModelRc::new(items), }; - row_data.push(item); + header_row_data.push(item); } - app.set_empty_folder_model(row_data.into()); + let non_header_row_data: Rc> = Rc::new(VecModel::default()); + for r in 0..100_000 { + let items = VecModel::default(); + + for c in 0..3 { + items.push(slint::format!("Item {r}.{c}")); + } + + let is_checked = r % 2 == 0; + + let item = MainListModel { + checked: is_checked, + header_row: false, + selected_row: false, + val: ModelRc::new(items), + }; + + non_header_row_data.push(item); + } + + app.set_empty_folder_model(non_header_row_data.clone().into()); + app.set_empty_files_model(non_header_row_data.into()); + app.set_similar_images_model(header_row_data.into()); } pub fn split_path(path: &Path) -> (String, String) { diff --git a/czkawka_slint_gui/src/settings.rs b/czkawka_slint_gui/src/settings.rs new file mode 100644 index 000000000..26f4296b4 --- /dev/null +++ b/czkawka_slint_gui/src/settings.rs @@ -0,0 +1,23 @@ +use crate::MainWindow; +use std::env; + +use crate::Settings; +use slint::{ComponentHandle, ModelRc, SharedString, StandardListViewItem, VecModel}; +pub fn reset_settings(app: &MainWindow) { + let settings = app.global::(); + + // Get current folder where executed binary is + let current_folder = env::current_dir(); + let mut included_directories = vec![]; + if let Ok(current_dir) = current_folder { + included_directories.push(current_dir.to_string_lossy().to_string()); + }; + + let included_items = VecModel::default(); + for i in included_directories { + let mut element = StandardListViewItem::default(); + element.text = SharedString::from(i); + included_items.push(element); + } + settings.set_included_directories(ModelRc::new(included_items)); +} diff --git a/czkawka_slint_gui/ui/bottom_panel.slint b/czkawka_slint_gui/ui/bottom_panel.slint new file mode 100644 index 000000000..3833ec8fb --- /dev/null +++ b/czkawka_slint_gui/ui/bottom_panel.slint @@ -0,0 +1,57 @@ + +import {Button, StandardListView, VerticalBox} from "std-widgets.slint"; +import {Settings} from "settings.slint"; + +export component BottomPanel { + min-height: 50px; + min-width: 400px; + + out property buttonSize: 75px; + + HorizontalLayout { + VerticalLayout { + width: buttonSize; + Button { + text: "Add"; + } + Button { + text: "Remove"; + } + Rectangle { + vertical-stretch: 1.0; + } + } + VerticalLayout { + Rectangle { + Text { + text: "Included Directories"; + } + } + StandardListView { + model: Settings.included-directories; + } + } + VerticalLayout { + width: buttonSize; + Button { + text: "Add"; + } + Button { + text: "Remove"; + } + Rectangle { + vertical-stretch: 1.0; + } + } + VerticalLayout { + Rectangle { + Text { + text: "Excluded Directories"; + } + } + StandardListView { + model: Settings.excluded-directories; + } + } + } +} diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 9834ade41..56dbd9557 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -6,6 +6,10 @@ import {CurrentTab, ProgressToSend} from "common.slint"; import { ActionButtons } from "action_buttons.slint"; import { Progress } from "progress.slint"; import {MainListModel} from "common.slint"; +import {Settings, SettingsModel} from "settings.slint"; +import { BottomPanel } from "bottom_panel.slint"; + +export {Settings} export component MainWindow inherits Window { callback deleted; @@ -110,6 +114,9 @@ export component MainWindow inherits Window { text_summary := LineEdit { read-only: true; } + BottomPanel { + vertical-stretch: 0.0; + } } scan_ended() => { diff --git a/czkawka_slint_gui/ui/settings.slint b/czkawka_slint_gui/ui/settings.slint index 86ee2153d..e53435a36 100644 --- a/czkawka_slint_gui/ui/settings.slint +++ b/czkawka_slint_gui/ui/settings.slint @@ -1,3 +1,11 @@ +export struct SettingsModel { + is_selected: bool, +} + export global Settings { - in-out property todo: blue; + in-out property model; + in-out property checkbox_checked: false; + + in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}]; + in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}]; } \ No newline at end of file From 0be1d3f2914073e8de75e2ee7a6ab9a5402de20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 1 Nov 2023 17:47:45 +0100 Subject: [PATCH 031/107] In out --- czkawka_slint_gui/ui/action_buttons.slint | 32 ++++++++++++++++++++++- czkawka_slint_gui/ui/bottom_panel.slint | 28 +++++++++++++++++--- czkawka_slint_gui/ui/common.slint | 6 +++++ czkawka_slint_gui/ui/main_window.slint | 5 ++-- 4 files changed, 64 insertions(+), 7 deletions(-) diff --git a/czkawka_slint_gui/ui/action_buttons.slint b/czkawka_slint_gui/ui/action_buttons.slint index 6a8637934..a4b6685f1 100644 --- a/czkawka_slint_gui/ui/action_buttons.slint +++ b/czkawka_slint_gui/ui/action_buttons.slint @@ -2,13 +2,27 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV import {LeftSidePanel} from "left_side_panel.slint"; import {MainList} from "main_lists.slint"; import {CurrentTab} from "common.slint"; +import {BottomPanelVisibility} from "common.slint"; +export component VisibilityButton inherits Button { + in-out property button_visibility; + in-out property bottom_panel_visibility; + + enabled: bottom_panel_visibility != button-visibility; + height: 30px; + width: 70px; + + clicked => { + bottom-panel-visibility = button_visibility; + } +} export component ActionButtons { callback deleted; callback scan_stopping; callback scan_starting(CurrentTab); - + + in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; in-out property stop_requested: false; in-out property scanning; in-out property active-tab; @@ -38,5 +52,21 @@ export component ActionButtons { 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"; + } } } \ 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 3833ec8fb..ee89dc1e3 100644 --- a/czkawka_slint_gui/ui/bottom_panel.slint +++ b/czkawka_slint_gui/ui/bottom_panel.slint @@ -1,11 +1,9 @@ import {Button, StandardListView, VerticalBox} from "std-widgets.slint"; import {Settings} from "settings.slint"; +import {BottomPanelVisibility} from "common.slint"; -export component BottomPanel { - min-height: 50px; - min-width: 400px; - +component DirectoriesPanel { out property buttonSize: 75px; HorizontalLayout { @@ -55,3 +53,25 @@ export component BottomPanel { } } } +// TODO this should be a normal read only Text editor +component TextErrorsPanel { + Rectangle { + background: red; + } +} + +export component BottomPanel { + in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; + + min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px; + min-width: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 400px; + + if bottom-panel-visibility == BottomPanelVisibility.Directories: DirectoriesPanel { + width: parent.width; + height: parent.height; + } + if bottom-panel-visibility == BottomPanelVisibility.TextErrors : TextErrorsPanel { + width: parent.width; + height: parent.height; + } +} diff --git a/czkawka_slint_gui/ui/common.slint b/czkawka_slint_gui/ui/common.slint index a9e165bea..b8c15eb16 100644 --- a/czkawka_slint_gui/ui/common.slint +++ b/czkawka_slint_gui/ui/common.slint @@ -20,4 +20,10 @@ export struct MainListModel { header_row: bool, selected_row: bool, val: [string] +} + +export enum BottomPanelVisibility { + NotVisible, + TextErrors, + Directories } \ No newline at end of file diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 56dbd9557..f07a5dfef 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -96,7 +96,7 @@ export component MainWindow inherits Window { } } } - ActionButtons { + action_buttons := ActionButtons { vertical-stretch: 0.0; scanning <=> root.scanning; active-tab <=> root.active-tab; @@ -114,7 +114,8 @@ export component MainWindow inherits Window { text_summary := LineEdit { read-only: true; } - BottomPanel { + BottomPanel { + bottom-panel-visibility <=> action_buttons.bottom-panel-visibility; vertical-stretch: 0.0; } } 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 032/107] 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 | 84 ++- czkawka_slint_gui/ui/bottom_panel.slint | 9 + czkawka_slint_gui/ui/main_window.slint | 2 + 7 files changed, 741 insertions(+), 81 deletions(-) create mode 100644 czkawka_slint_gui/src/connect_directories_changes.rs diff --git a/Cargo.lock b/Cargo.lock index b2728f76e..c7bbe653b 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 73817d56d..3674b2d97 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 000000000..6691723ed --- /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 5ff9a543a..c71bf7776 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 a4b6685f1..0e9ede7b4 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); - } + scan_button:= Button { + height: parent.height; + 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; - } + } + stop_button:= Button { + height: parent.height; + enabled: scanning && !stop_requested; + text: "Stop"; + clicked => { + root.scan_stopping(); + root.stop_requested = true; } - delete_button:= Button { - enabled: !scanning; - text: "Delete"; - clicked => { - root.deleted(); - } + } + delete_button:= Button { + height: parent.height; + 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"; - } + 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 ee89dc1e3..5598bf185 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 f07a5dfef..333fb33b5 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)} } } From f4ff67b71b6c39fa4ec5e7aa4985b81119314798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 2 Nov 2023 18:29:38 +0100 Subject: [PATCH 033/107] ABC --- czkawka_slint_gui/src/settings.rs | 3 ++ czkawka_slint_gui/ui/action_buttons.slint | 51 ++++++++++++++--------- czkawka_slint_gui/ui/bottom_panel.slint | 21 +++++++--- czkawka_slint_gui/ui/main_window.slint | 14 +++++-- 4 files changed, 62 insertions(+), 27 deletions(-) diff --git a/czkawka_slint_gui/src/settings.rs b/czkawka_slint_gui/src/settings.rs index 26f4296b4..8bb6cd02a 100644 --- a/czkawka_slint_gui/src/settings.rs +++ b/czkawka_slint_gui/src/settings.rs @@ -6,6 +6,9 @@ use slint::{ComponentHandle, ModelRc, SharedString, StandardListViewItem, VecMod pub fn reset_settings(app: &MainWindow) { let settings = app.global::(); + // app.width(1000); + app.invoke_set_console_text(SharedString::from("")); + // Get current folder where executed binary is let current_folder = env::current_dir(); let mut included_directories = vec![]; diff --git a/czkawka_slint_gui/ui/action_buttons.slint b/czkawka_slint_gui/ui/action_buttons.slint index 0e9ede7b4..6d8e70e6d 100644 --- a/czkawka_slint_gui/ui/action_buttons.slint +++ b/czkawka_slint_gui/ui/action_buttons.slint @@ -21,7 +21,7 @@ export component ActionButtons inherits HorizontalLayout { callback deleted; callback scan_stopping; callback scan_starting(CurrentTab); - + in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; in-out property stop_requested: false; in-out property scanning; @@ -48,6 +48,11 @@ export component ActionButtons inherits HorizontalLayout { root.stop_requested = true; } } + + Rectangle { + horizontal-stretch: 0.5; + } + delete_button:= Button { height: parent.height; enabled: !scanning; @@ -56,25 +61,33 @@ export component ActionButtons inherits HorizontalLayout { 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"; + Rectangle { + horizontal-stretch: 0.5; } - - VisibilityButton { - height: parent.height; - button-visibility: BottomPanelVisibility.TextErrors; - bottom_panel_visibility <=> bottom_panel_visibility; - text: "Text"; + + HorizontalLayout { + padding: 0px; + spacing: 0px; + VisibilityButton { + height: parent.height; + button-visibility: BottomPanelVisibility.Directories; + bottom_panel_visibility <=> bottom_panel_visibility; + text: "Dirs"; + } + + VisibilityButton { + height: parent.height; + button-visibility: BottomPanelVisibility.TextErrors; + bottom_panel_visibility <=> bottom_panel_visibility; + text: "Text"; + } + + VisibilityButton { + height: parent.height; + button-visibility: BottomPanelVisibility.NotVisible; + bottom_panel_visibility <=> bottom_panel_visibility; + text: "NotVS"; + } } } \ 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 5598bf185..cccf815bc 100644 --- a/czkawka_slint_gui/ui/bottom_panel.slint +++ b/czkawka_slint_gui/ui/bottom_panel.slint @@ -1,5 +1,5 @@ -import {Button, StandardListView, VerticalBox} from "std-widgets.slint"; +import {Button, StandardListView, VerticalBox, ScrollView, TextEdit} from "std-widgets.slint"; import {Settings} from "settings.slint"; import {BottomPanelVisibility} from "common.slint"; @@ -61,15 +61,19 @@ component DirectoriesPanel { } } // TODO this should be a normal read only Text editor -component TextErrorsPanel { - Rectangle { - background: red; - } +component TextErrorsPanel inherits TextEdit { + height: 20px; + read-only: true; + text: "Something\nShould be\nASFASF\nasgasg\nASfgasga\nasfgAGAWGW\nAfgAWFGAWG\nfawfafgweg\nAFGWGTwgwg\nGawgAWFWAF\nawfawgaw\nasfa \nasfawgw\nawfawg\nRRRRRR"; + } export component BottomPanel { in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; + in-out property console_text; + callback folder-choose-requested(bool); + callback set_console_text(string); min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px; min-width: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 400px; @@ -79,8 +83,15 @@ export component BottomPanel { height: parent.height; folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)} } + if bottom-panel-visibility == BottomPanelVisibility.TextErrors : TextErrorsPanel { + text: console_text; + width: parent.width; height: parent.height; } + + set_console_text(text) => { + console_text = text; + } } diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 333fb33b5..e579cfa6a 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -11,17 +11,22 @@ import { BottomPanel } from "bottom_panel.slint"; export {Settings} +export component Raw inherits Window { + preferred-width: 2000px; +} + export component MainWindow inherits Window { callback deleted; callback scan_stopping; callback scan_starting(CurrentTab); callback item_opened(string); callback folder-choose-requested(bool); + callback set_console_text(string); callback scan_ended(); min-width: 300px; - preferred-width: 1024px; + preferred-width: 2000px; min-height: 300px; preferred-height: 600px; @@ -71,7 +76,6 @@ export component MainWindow inherits Window { VerticalBox { HorizontalBox { vertical-stretch: 1.0; - // min-width: 600px; preferred-height: 300px; LeftSidePanel { @@ -115,13 +119,17 @@ export component MainWindow inherits Window { text_summary := LineEdit { read-only: true; } - BottomPanel { + bottom_panel := BottomPanel { bottom-panel-visibility <=> action_buttons.bottom-panel-visibility; vertical-stretch: 0.0; folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)} } } + set_console_text(text) => { + bottom-panel.set_console_text(text); + } + scan_ended() => { text-summary.text = ""; // TODO this should be filled with results root.scanning = false; From da54431880159d95baa8ce5af86f02f70e811c3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 2 Nov 2023 20:18:59 +0100 Subject: [PATCH 034/107] G --- czkawka_slint_gui/ui/main_window.slint | 6 ------ 1 file changed, 6 deletions(-) diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index e579cfa6a..6356643d6 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -11,10 +11,6 @@ import { BottomPanel } from "bottom_panel.slint"; export {Settings} -export component Raw inherits Window { - preferred-width: 2000px; -} - export component MainWindow inherits Window { callback deleted; callback scan_stopping; @@ -71,8 +67,6 @@ export component MainWindow inherits Window { in-out property <[MainListModel]> empty_files_model: []; in-out property <[MainListModel]> similar_images_model: []; - title: root.active-tab == CurrentTab.EmptyFiles ? "EmptyFiles" : (root.active-tab == CurrentTab.EmptyFolders ? "EmptyFolders" : "Similar Images"); - VerticalBox { HorizontalBox { vertical-stretch: 1.0; From 84b714555099e1451f7f81af6adc7ad0b5198e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 2 Nov 2023 20:44:20 +0100 Subject: [PATCH 035/107] G --- Cargo.lock | 1 + czkawka_slint_gui/Cargo.toml | 1 + czkawka_slint_gui/src/common.rs | 12 ++++++++++ czkawka_slint_gui/src/settings.rs | 38 +++++++++++++++++++++++-------- 4 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7bbe653b..0cdabc669 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1332,6 +1332,7 @@ dependencies = [ "crossbeam-channel", "czkawka_core", "handsome_logger", + "home", "open", "rand", "rfd", diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index 3674b2d97..34dfacf8c 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -28,6 +28,7 @@ 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"] } +home = "0.5.5" [build-dependencies] #slint-build = "1.2.2" diff --git a/czkawka_slint_gui/src/common.rs b/czkawka_slint_gui/src/common.rs index 8b1378917..66c912004 100644 --- a/czkawka_slint_gui/src/common.rs +++ b/czkawka_slint_gui/src/common.rs @@ -1 +1,13 @@ +use slint::{ModelRc, SharedString, StandardListViewItem, VecModel}; +pub fn create_string_standard_list_view(items: &[String]) -> ModelRc { + let new_folders_standard_list_view = items + .iter() + .map(|x| { + let mut element = StandardListViewItem::default(); + element.text = SharedString::from(x.to_string()); + element + }) + .collect::>(); + ModelRc::new(VecModel::from(new_folders_standard_list_view)) +} diff --git a/czkawka_slint_gui/src/settings.rs b/czkawka_slint_gui/src/settings.rs index 8bb6cd02a..896f2497c 100644 --- a/czkawka_slint_gui/src/settings.rs +++ b/czkawka_slint_gui/src/settings.rs @@ -1,26 +1,44 @@ use crate::MainWindow; use std::env; +use crate::common::create_string_standard_list_view; use crate::Settings; +use home::home_dir; use slint::{ComponentHandle, ModelRc, SharedString, StandardListViewItem, VecModel}; + +#[cfg(target_family = "unix")] +const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", "/snap"]; +#[cfg(not(target_family = "unix"))] +const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["C:\\Windows"]; + pub fn reset_settings(app: &MainWindow) { let settings = app.global::(); // app.width(1000); app.invoke_set_console_text(SharedString::from("")); - // Get current folder where executed binary is - let current_folder = env::current_dir(); + // Included directories let mut included_directories = vec![]; - if let Ok(current_dir) = current_folder { + if let Ok(current_dir) = env::current_dir() { included_directories.push(current_dir.to_string_lossy().to_string()); + } else { + if let Some(home_dir) = home_dir() { + included_directories.push(home_dir.to_string_lossy().to_string()); + } else { + if cfg!(target_family = "unix") { + included_directories.push("/".to_string()); + } else { + included_directories.push("C:\\".to_string()); + } + } }; + included_directories.sort(); + let included_items = create_string_standard_list_view(&included_directories); + settings.set_included_directories(included_items); - let included_items = VecModel::default(); - for i in included_directories { - let mut element = StandardListViewItem::default(); - element.text = SharedString::from(i); - included_items.push(element); - } - settings.set_included_directories(ModelRc::new(included_items)); + // Excluded directories + let mut excluded_directories = DEFAULT_EXCLUDED_DIRECTORIES.iter().map(|x| x.to_string()).collect::>(); + excluded_directories.sort(); + let excluded_items = create_string_standard_list_view(&excluded_directories); + settings.set_excluded_directories(excluded_items); } From 592ec9a040e077c26ee445af6b7d2dc8c2658810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 5 Nov 2023 10:01:37 +0100 Subject: [PATCH 036/107] AB --- Cargo.lock | 118 ++++++++++-------- czkawka_slint_gui/Cargo.toml | 4 +- czkawka_slint_gui/README.md | 5 + czkawka_slint_gui/src/connect_delete.rs | 3 +- .../src/connect_directories_changes.rs | 42 ++++++- czkawka_slint_gui/src/connect_scan.rs | 3 +- czkawka_slint_gui/src/main.rs | 13 +- czkawka_slint_gui/src/settings.rs | 19 ++- czkawka_slint_gui/ui/bottom_panel.slint | 10 +- czkawka_slint_gui/ui/main_window.slint | 2 +- czkawka_slint_gui/ui/settings.slint | 2 + 11 files changed, 139 insertions(+), 82 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0cdabc669..7ead23b48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -669,9 +669,9 @@ dependencies = [ [[package]] name = "cairo-rs" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c0466dfa8c0ee78deef390c274ad756801e0a6dbb86c5ef0924a298c5761c4d" +checksum = "f33613627f0dea6a731b0605101fad59ba4f193a52c96c4687728d822605a8a1" dependencies = [ "bitflags 2.4.1", "cairo-sys-rs", @@ -996,7 +996,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "const-field-offset-macro", "field-offset", @@ -1005,7 +1005,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "proc-macro2", "quote", @@ -1235,9 +1235,9 @@ dependencies = [ [[package]] name = "cursor-icon" -version = "1.0.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740bb192a8e2d1350119916954f4409ee7f62f149b536911eeb78ba5a20526bf" +checksum = "96a6ac251f4a2aca6b3f91340350eab87ae57c3f127ffeb585e92bd336717991" [[package]] name = "czkawka_cli" @@ -1333,6 +1333,7 @@ dependencies = [ "czkawka_core", "handsome_logger", "home", + "log", "open", "rand", "rfd", @@ -2119,9 +2120,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf" -version = "0.18.0" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbc9c2ed73a81d556b65d08879ba4ee58808a6b1927ce915262185d6d547c6f3" +checksum = "446f32b74d22c33b7b258d4af4ffde53c2bf96ca2e29abdf1a785fe59bd6c82c" dependencies = [ "gdk-pixbuf-sys", "gio", @@ -2242,9 +2243,9 @@ dependencies = [ [[package]] name = "gio" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57052f84e8e5999b258e8adf8f5f2af0ac69033864936b8b6838321db2f759b1" +checksum = "47d809baf02bdf1b5ef4ad3bf60dd9d4977149db4612b7bbb58e56aef168193b" dependencies = [ "futures-channel", "futures-core", @@ -2285,9 +2286,9 @@ dependencies = [ [[package]] name = "glib" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c316afb01ce8067c5eaab1fc4f2cd47dc21ce7b6296358605e2ffab23ccbd19" +checksum = "58cf801b6f7829fa76db37449ab67c9c98a2b1bf21076d9113225621e61a0fa6" dependencies = [ "bitflags 2.4.1", "futures-channel", @@ -2308,12 +2309,12 @@ dependencies = [ [[package]] name = "glib-macros" -version = "0.18.2" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8da903822b136d42360518653fcf154455defc437d3e7a81475bf9a95ff1e47" +checksum = "72793962ceece3863c2965d7f10c8786323b17c7adea75a515809fa20ab799a5" dependencies = [ "heck", - "proc-macro-crate 1.3.1", + "proc-macro-crate 2.0.0", "proc-macro-error", "proc-macro2", "quote", @@ -2651,7 +2652,7 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "calloop 0.11.0", "drm", @@ -2672,7 +2673,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2685,7 +2686,7 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "accesskit", "bytemuck", @@ -2721,7 +2722,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "cfg-if", "derive_more", @@ -2732,7 +2733,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "by_address", "codemap", @@ -2761,7 +2762,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "auto_enums", "bytemuck", @@ -2804,7 +2805,7 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "quote", "syn 2.0.38", @@ -2813,7 +2814,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "cfg-if", "const-field-offset", @@ -2845,7 +2846,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "ash", "bytemuck", @@ -3382,6 +3383,28 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + +[[package]] +name = "libredox" +version = "0.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.4.1", +] + [[package]] name = "libseat" version = "0.2.1" @@ -3944,11 +3967,11 @@ dependencies = [ [[package]] name = "orbclient" -version = "0.3.46" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8378ac0dfbd4e7895f2d2c1f1345cab3836910baf3a300b000d04250f0c8428f" +checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" dependencies = [ - "redox_syscall 0.3.5", + "libredox 0.0.2", ] [[package]] @@ -3978,9 +4001,9 @@ dependencies = [ [[package]] name = "pango" -version = "0.18.0" +version = "0.18.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06a9e54b831d033206160096b825f2070cf5fda7e35167b1c01e9e774f9202d1" +checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" dependencies = [ "gio", "glib", @@ -4436,15 +4459,6 @@ dependencies = [ "rustfft 6.1.0", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -4465,12 +4479,12 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ "getrandom", - "redox_syscall 0.2.16", + "libredox 0.0.1", "thiserror", ] @@ -5038,7 +5052,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5054,7 +5068,7 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "i-slint-compiler", "spin_on", @@ -5065,7 +5079,7 @@ dependencies = [ [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -6199,7 +6213,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "const-field-offset", "portable-atomic", @@ -6210,7 +6224,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#50a6040c38cf93c6cd0e21255e052286b468a59c" +source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" dependencies = [ "proc-macro2", "quote", @@ -6735,9 +6749,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.5.18" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" dependencies = [ "memchr", ] @@ -6956,18 +6970,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.21" +version = "0.7.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686b7e407015242119c33dab17b8f61ba6843534de936d94368856528eae4dcc" +checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.21" +version = "0.7.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020f3dfe25dfc38dfea49ce62d5d45ecdd7f0d8a724fa63eb36b6eba4ec76806" +checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" dependencies = [ "proc-macro2", "quote", diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index 34dfacf8c..706185aea 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -29,13 +29,15 @@ crossbeam-channel = "0.5.8" handsome_logger = "0.8.0" rfd = { version = "0.12.0", default-features = false, features = ["xdg-portal"] } home = "0.5.5" +log = "0.4.20" [build-dependencies] #slint-build = "1.2.2" slint-build = { git = "https://github.com/slint-ui/slint.git" } [features] -default = ["winit_femtovg", "winit_software"] +# TODO remove from deault features skia, because is harder to cross-compile it +default = ["winit_femtovg", "winit_software", "winit_skia_opengl"] skia_opengl = ["slint/renderer-skia-opengl"] skia_vulkan = ["slint/renderer-skia-vulkan"] software = ["slint/renderer-software"] diff --git a/czkawka_slint_gui/README.md b/czkawka_slint_gui/README.md index 87e4f0fa9..ea879d8b9 100644 --- a/czkawka_slint_gui/README.md +++ b/czkawka_slint_gui/README.md @@ -10,6 +10,11 @@ Slint version of app should not have any special runtime requirements - it shoul Alternatively, it can be run with software rendering. ## Compilation +Ubuntu +``` +sudo apt install libfontconfig-dev libfreetype-dev +``` + Default compilation is done by `cargo build --release` and should work on most systems. You need the latest available version of Rust to compile it, because NAME_TODO aims to support the latest slint verions, diff --git a/czkawka_slint_gui/src/connect_delete.rs b/czkawka_slint_gui/src/connect_delete.rs index 982f25ede..9fc752eb9 100644 --- a/czkawka_slint_gui/src/connect_delete.rs +++ b/czkawka_slint_gui/src/connect_delete.rs @@ -4,6 +4,7 @@ use slint::{ComponentHandle, Model, ModelRc, VecModel}; use crate::MainListModel; use crate::{CurrentTab, MainWindow}; +use log::info; pub fn connect_delete_button(app: &MainWindow) { let a = app.as_weak(); @@ -34,7 +35,7 @@ fn handle_delete_empty_folders(app: &MainWindow) { // TODO delete in parallel items, consider to add progress bar fn remove_selected_items(items: Vec) { - dbg!(format!("Items to remove {}", items.len())); + info!("Items to remove {}", items.len()); drop(items); // items.into_iter().for_each(|_item| {}); } diff --git a/czkawka_slint_gui/src/connect_directories_changes.rs b/czkawka_slint_gui/src/connect_directories_changes.rs index 6691723ed..ae579ee6a 100644 --- a/czkawka_slint_gui/src/connect_directories_changes.rs +++ b/czkawka_slint_gui/src/connect_directories_changes.rs @@ -1,8 +1,46 @@ -use crate::{MainWindow, Settings}; use rfd::FileDialog; use slint::{ComponentHandle, Model, ModelRc, VecModel}; -pub fn connect_add_directories(app: &MainWindow) { +use crate::{MainWindow, Settings}; + +pub fn connect_add_remove_directories(app: &MainWindow) { + connect_add_directories(app); + connect_remove_directories(app); +} + +fn connect_remove_directories(app: &MainWindow) { + let a = app.as_weak(); + app.global::().on_remove_item_directories(move |included_directories, current_index| { + // Nothing selected + if current_index == -1 { + return; + } + let app = a.upgrade().unwrap(); + let settings = app.global::(); + + if included_directories { + let included_model = settings.get_included_directories(); + let model_count = included_model.iter().count(); + + if model_count > current_index as usize { + let mut included_model = included_model.iter().collect::>(); + included_model.remove(current_index as usize); + settings.set_included_directories(ModelRc::new(VecModel::from(included_model))); + } + } else { + let excluded_model = settings.get_excluded_directories(); + let model_count = excluded_model.iter().count(); + + if model_count > current_index as usize { + let mut excluded_model = excluded_model.iter().collect::>(); + excluded_model.remove(current_index as usize); + settings.set_excluded_directories(ModelRc::new(VecModel::from(excluded_model))); + } + } + }); +} + +fn connect_add_directories(app: &MainWindow) { let a = app.as_weak(); app.on_folder_choose_requested(move |included_directories| { let app = a.upgrade().unwrap(); diff --git a/czkawka_slint_gui/src/connect_scan.rs b/czkawka_slint_gui/src/connect_scan.rs index 9737289a3..816868741 100644 --- a/czkawka_slint_gui/src/connect_scan.rs +++ b/czkawka_slint_gui/src/connect_scan.rs @@ -1,7 +1,8 @@ use crate::MainListModel; -use crate::{split_path, CurrentTab, MainWindow, ProgressToSend}; +use crate::{CurrentTab, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; use crossbeam_channel::{Receiver, Sender}; +use czkawka_core::common::split_path; use czkawka_core::common_dir_traversal::ProgressData; use czkawka_core::common_tool::CommonData; use czkawka_core::empty_folder::EmptyFolder; diff --git a/czkawka_slint_gui/src/main.rs b/czkawka_slint_gui/src/main.rs index c71bf7776..15ae34f03 100644 --- a/czkawka_slint_gui/src/main.rs +++ b/czkawka_slint_gui/src/main.rs @@ -22,14 +22,13 @@ mod connect_stop; mod settings; use crossbeam_channel::{unbounded, Receiver, Sender}; -use std::path::Path; use std::rc::Rc; 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_directories_changes::connect_add_remove_directories; use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_stop::connect_stop_button; use crate::settings::reset_settings; @@ -53,7 +52,7 @@ fn main() { connect_stop_button(&app, stop_sender); connect_open_items(&app); connect_progress_gathering(&app, progress_receiver); - connect_add_directories(&app); + connect_add_remove_directories(&app); reset_settings(&app); @@ -106,11 +105,3 @@ pub fn to_remove_debug(app: &MainWindow) { app.set_empty_files_model(non_header_row_data.into()); app.set_similar_images_model(header_row_data.into()); } - -pub fn split_path(path: &Path) -> (String, String) { - match (path.parent(), path.file_name()) { - (Some(dir), Some(file)) => (dir.display().to_string(), file.to_string_lossy().into_owned()), - (Some(dir), None) => (dir.display().to_string(), String::new()), - (None, _) => (String::new(), String::new()), - } -} diff --git a/czkawka_slint_gui/src/settings.rs b/czkawka_slint_gui/src/settings.rs index 896f2497c..85ac33cdc 100644 --- a/czkawka_slint_gui/src/settings.rs +++ b/czkawka_slint_gui/src/settings.rs @@ -4,7 +4,7 @@ use std::env; use crate::common::create_string_standard_list_view; use crate::Settings; use home::home_dir; -use slint::{ComponentHandle, ModelRc, SharedString, StandardListViewItem, VecModel}; +use slint::{ComponentHandle, SharedString}; #[cfg(target_family = "unix")] const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", "/snap"]; @@ -21,23 +21,20 @@ pub fn reset_settings(app: &MainWindow) { let mut included_directories = vec![]; if let Ok(current_dir) = env::current_dir() { included_directories.push(current_dir.to_string_lossy().to_string()); + } else if let Some(home_dir) = home_dir() { + included_directories.push(home_dir.to_string_lossy().to_string()); + } else if cfg!(target_family = "unix") { + included_directories.push("/".to_string()); } else { - if let Some(home_dir) = home_dir() { - included_directories.push(home_dir.to_string_lossy().to_string()); - } else { - if cfg!(target_family = "unix") { - included_directories.push("/".to_string()); - } else { - included_directories.push("C:\\".to_string()); - } - } + // This could be set to default + included_directories.push("C:\\".to_string()); }; included_directories.sort(); let included_items = create_string_standard_list_view(&included_directories); settings.set_included_directories(included_items); // Excluded directories - let mut excluded_directories = DEFAULT_EXCLUDED_DIRECTORIES.iter().map(|x| x.to_string()).collect::>(); + let mut excluded_directories = DEFAULT_EXCLUDED_DIRECTORIES.iter().map(|x| (*x).to_string()).collect::>(); excluded_directories.sort(); let excluded_items = create_string_standard_list_view(&excluded_directories); settings.set_excluded_directories(excluded_items); diff --git a/czkawka_slint_gui/ui/bottom_panel.slint b/czkawka_slint_gui/ui/bottom_panel.slint index cccf815bc..737986b78 100644 --- a/czkawka_slint_gui/ui/bottom_panel.slint +++ b/czkawka_slint_gui/ui/bottom_panel.slint @@ -18,6 +18,9 @@ component DirectoriesPanel { } Button { text: "Remove"; + clicked => { + Settings.remove_item_directories(true, included-list.current-item); + } } Rectangle { vertical-stretch: 1.0; @@ -29,7 +32,7 @@ component DirectoriesPanel { text: "Included Directories"; } } - StandardListView { + included_list := StandardListView { model: Settings.included-directories; } } @@ -43,6 +46,9 @@ component DirectoriesPanel { } Button { text: "Remove"; + clicked => { + Settings.remove_item_directories(false, excluded-list.current-item); + } } Rectangle { vertical-stretch: 1.0; @@ -54,7 +60,7 @@ component DirectoriesPanel { text: "Excluded Directories"; } } - StandardListView { + excluded_list := StandardListView { model: Settings.excluded-directories; } } diff --git a/czkawka_slint_gui/ui/main_window.slint b/czkawka_slint_gui/ui/main_window.slint index 6356643d6..9248ba613 100644 --- a/czkawka_slint_gui/ui/main_window.slint +++ b/czkawka_slint_gui/ui/main_window.slint @@ -22,7 +22,7 @@ export component MainWindow inherits Window { callback scan_ended(); min-width: 300px; - preferred-width: 2000px; + preferred-width: 800px; min-height: 300px; preferred-height: 600px; diff --git a/czkawka_slint_gui/ui/settings.slint b/czkawka_slint_gui/ui/settings.slint index e53435a36..2186b1519 100644 --- a/czkawka_slint_gui/ui/settings.slint +++ b/czkawka_slint_gui/ui/settings.slint @@ -8,4 +8,6 @@ export global Settings { in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}]; in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}]; + + callback remove_item_directories(bool, int); } \ No newline at end of file From 27f43b3c6bc9f851cb49df8d859aad0ce0146b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 6 Nov 2023 15:50:02 +0100 Subject: [PATCH 037/107] BP --- czkawka_slint_gui/ui/bottom_panel.slint | 40 +++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/czkawka_slint_gui/ui/bottom_panel.slint b/czkawka_slint_gui/ui/bottom_panel.slint index 737986b78..fb9660f3a 100644 --- a/czkawka_slint_gui/ui/bottom_panel.slint +++ b/czkawka_slint_gui/ui/bottom_panel.slint @@ -4,12 +4,12 @@ import {Settings} from "settings.slint"; import {BottomPanelVisibility} from "common.slint"; component DirectoriesPanel { - out property buttonSize: 75px; callback folder-choose-requested(bool); + // Included directories HorizontalLayout { VerticalLayout { - width: buttonSize; + horizontal-stretch: 0.0; Button { text: "Add"; clicked => { @@ -27,6 +27,7 @@ component DirectoriesPanel { } } VerticalLayout { + horizontal-stretch: 1.0; Rectangle { Text { text: "Included Directories"; @@ -36,8 +37,10 @@ component DirectoriesPanel { model: Settings.included-directories; } } + + // Excluded directories VerticalLayout { - width: buttonSize; + horizontal-stretch: 0.0; Button { text: "Add"; clicked => { @@ -50,11 +53,18 @@ component DirectoriesPanel { Settings.remove_item_directories(false, excluded-list.current-item); } } + Button { + text: "Manual Add"; + clicked => { + popup_item.show(); + } + } Rectangle { vertical-stretch: 1.0; } } VerticalLayout { + horizontal-stretch: 1.0; Rectangle { Text { text: "Excluded Directories"; @@ -65,6 +75,30 @@ component DirectoriesPanel { } } } + + popup_item := PopupWindow { + height: root.height; + width: root.width; + + private property text_data; + + close-on-click: false; + + TextEdit { + text <=> text-data; + } + TextEdit { + + } + + Rectangle { + background: red; + border-radius: 3px; + border-width: 2px; + border-color: blue; + } + + } } // TODO this should be a normal read only Text editor component TextErrorsPanel inherits TextEdit { From 8d8abe39a4daed366c3410e4d5a9f4df74e806d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 6 Nov 2023 17:42:35 +0100 Subject: [PATCH 038/107] Other themes --- Cargo.lock | 412 +++++++++++++++++++++++++++-------- czkawka_slint_gui/Cargo.toml | 6 + czkawka_slint_gui/README.md | 15 ++ 3 files changed, 344 insertions(+), 89 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7ead23b48..b636f5eb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -20,9 +20,74 @@ checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" [[package]] name = "accesskit" -version = "0.11.2" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8410747ed85a17c4a1e9ed3f5a74d3e7bdcc876cf9a18ff40ae21d645997b2" + +[[package]] +name = "accesskit_consumer" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c17cca53c09fbd7288667b22a201274b9becaa27f0b91bf52a526db95de45e6" +dependencies = [ + "accesskit", +] + +[[package]] +name = "accesskit_macos" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76eb1adf08c5bcaa8490b9851fd53cca27fa9880076f178ea9d29f05196728a8" +checksum = "cd3b6ae1eabbfbced10e840fd3fce8a93ae84f174b3e4ba892ab7bcb42e477a7" +dependencies = [ + "accesskit", + "accesskit_consumer", + "objc2 0.3.0-beta.3.patch-leaks.3", + "once_cell", +] + +[[package]] +name = "accesskit_unix" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8c9b4467d77cacfbc93cee9aa8e7822f6d527c774efdca5f8b3a5280c34847" +dependencies = [ + "accesskit", + "accesskit_consumer", + "async-channel 1.9.0", + "async-once-cell", + "atspi", + "futures-lite 1.13.0", + "once_cell", + "serde", + "zbus", +] + +[[package]] +name = "accesskit_windows" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcae27ec0974fc7c3b0b318783be89fd1b2e66dd702179fe600166a38ff4a0b" +dependencies = [ + "accesskit", + "accesskit_consumer", + "once_cell", + "paste", + "static_assertions", + "windows 0.48.0", +] + +[[package]] +name = "accesskit_winit" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5284218aca17d9e150164428a0ebc7b955f70e3a9a78b4c20894513aabf98a67" +dependencies = [ + "accesskit", + "accesskit_macos", + "accesskit_unix", + "accesskit_windows", + "winit", +] [[package]] name = "adler" @@ -237,17 +302,30 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-channel" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d37875bd9915b7d67c2f117ea2c30a0989874d0b2cb694fe25403c85763c0c9e" +dependencies = [ + "concurrent-queue", + "event-listener 3.0.1", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + [[package]] name = "async-executor" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" dependencies = [ - "async-lock", + "async-lock 2.8.0", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite", + "futures-lite 1.13.0", "slab", ] @@ -257,10 +335,10 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" dependencies = [ - "async-lock", + "async-lock 2.8.0", "autocfg", "blocking", - "futures-lite", + "futures-lite 1.13.0", ] [[package]] @@ -269,12 +347,12 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-executor", "async-io 1.13.0", - "async-lock", + "async-lock 2.8.0", "blocking", - "futures-lite", + "futures-lite 1.13.0", "once_cell", ] @@ -284,11 +362,11 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ - "async-lock", + "async-lock 2.8.0", "autocfg", "cfg-if", "concurrent-queue", - "futures-lite", + "futures-lite 1.13.0", "log", "parking", "polling 2.8.0", @@ -300,15 +378,15 @@ dependencies = [ [[package]] name = "async-io" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10da8f3146014722c89e7859e1d7bb97873125d7346d10ca642ffab794355828" +checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" dependencies = [ - "async-lock", + "async-lock 3.0.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite", + "futures-lite 2.0.1", "parking", "polling 3.3.0", "rustix 0.38.21", @@ -327,6 +405,23 @@ dependencies = [ "event-listener 2.5.3", ] +[[package]] +name = "async-lock" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e900cdcd39bb94a14487d3f7ef92ca222162e6c7c3fe7cb3550ea75fb486ed" +dependencies = [ + "event-listener 3.0.1", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-once-cell" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb" + [[package]] name = "async-process" version = "1.8.1" @@ -334,12 +429,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88" dependencies = [ "async-io 1.13.0", - "async-lock", + "async-lock 2.8.0", "async-signal", "blocking", "cfg-if", "event-listener 3.0.1", - "futures-lite", + "futures-lite 1.13.0", "rustix 0.38.21", "windows-sys 0.48.0", ] @@ -352,7 +447,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -361,8 +456,8 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.1.0", - "async-lock", + "async-io 2.2.0", + "async-lock 2.8.0", "atomic-waker", "cfg-if", "futures-core", @@ -379,15 +474,15 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-global-executor", "async-io 1.13.0", - "async-lock", + "async-lock 2.8.0", "crossbeam-utils", "futures-channel", "futures-core", "futures-io", - "futures-lite", + "futures-lite 1.13.0", "gloo-timers", "kv-log-macro", "log", @@ -413,7 +508,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -431,6 +526,54 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "atspi" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6059f350ab6f593ea00727b334265c4dfc7fd442ee32d264794bd9bdc68e87ca" +dependencies = [ + "atspi-common", + "atspi-connection", + "atspi-proxies", +] + +[[package]] +name = "atspi-common" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92af95f966d2431f962bc632c2e68eda7777330158bf640c4af4249349b2cdf5" +dependencies = [ + "enumflags2", + "serde", + "static_assertions", + "zbus", + "zbus_names", + "zvariant", +] + +[[package]] +name = "atspi-connection" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c65e7d70f86d4c0e3b2d585d9bf3f979f0b19d635a336725a88d279f76b939" +dependencies = [ + "atspi-common", + "atspi-proxies", + "futures-lite 1.13.0", + "zbus", +] + +[[package]] +name = "atspi-proxies" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6495661273703e7a229356dcbe8c8f38223d697aacfaf0e13590a9ac9977bb52" +dependencies = [ + "atspi-common", + "serde", + "zbus", +] + [[package]] name = "audio_checker" version = "0.1.0" @@ -449,7 +592,7 @@ dependencies = [ "derive_utils", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -498,7 +641,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.38", + "syn 2.0.39", "which", ] @@ -567,13 +710,32 @@ dependencies = [ "generic-array", ] +[[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.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dd7cf50912cddc06dc5ea7c08c5e81c1b2c842a70d19def1848d54c586fed92" dependencies = [ - "objc-sys", + "objc-sys 0.3.1", +] + +[[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", ] [[package]] @@ -582,22 +744,22 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ - "block-sys", - "objc2", + "block-sys 0.2.0", + "objc2 0.4.1", ] [[package]] name = "blocking" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +checksum = "864b30e660d766b7e9b47347d9b6558a17f1cfa22274034fa6f55b274b3e4620" dependencies = [ - "async-channel", - "async-lock", + "async-channel 2.1.0", + "async-lock 3.0.0", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite", + "futures-lite 2.0.1", "piper", "tracing", ] @@ -631,7 +793,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -875,7 +1037,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -996,7 +1158,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "const-field-offset-macro", "field-offset", @@ -1005,11 +1167,11 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1230,7 +1392,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" dependencies = [ "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1465,7 +1627,7 @@ checksum = "9abcad25e9720609ccb3dcdb795d845e37d8ce34183330a9f48b03a1a71c8e21" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1514,7 +1676,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1623,7 +1785,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1634,7 +1796,7 @@ checksum = "c2ad8cef1d801a4686bfd8919f0b30eac4c8e48968c437a6405ded4fb5272d2b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1679,6 +1841,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener-strategy" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160" +dependencies = [ + "event-listener 3.0.1", + "pin-project-lite", +] + [[package]] name = "exr" version = "1.6.4" @@ -1950,7 +2122,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2056,6 +2228,16 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-lite" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "futures-macro" version = "0.3.29" @@ -2064,7 +2246,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2318,7 +2500,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2386,7 +2568,7 @@ dependencies = [ "glutin_wgl_sys", "icrate", "libloading 0.8.1", - "objc2", + "objc2 0.4.1", "once_cell", "raw-window-handle 0.5.2", "wayland-sys", @@ -2652,7 +2834,7 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "calloop 0.11.0", "drm", @@ -2673,7 +2855,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2686,9 +2868,10 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "accesskit", + "accesskit_winit", "bytemuck", "cfg-if", "cfg_aliases", @@ -2722,7 +2905,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "cfg-if", "derive_more", @@ -2733,7 +2916,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "by_address", "codemap", @@ -2762,7 +2945,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "auto_enums", "bytemuck", @@ -2805,16 +2988,16 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "cfg-if", "const-field-offset", @@ -2846,7 +3029,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "ash", "bytemuck", @@ -2932,7 +3115,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.38", + "syn 2.0.39", "unic-langid", ] @@ -2946,7 +3129,7 @@ dependencies = [ "i18n-config", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2978,9 +3161,9 @@ version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319" dependencies = [ - "block2", + "block2 0.3.0", "dispatch", - "objc2", + "objc2 0.4.1", ] [[package]] @@ -3333,9 +3516,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libheif-rs" @@ -3509,7 +3692,7 @@ checksum = "764b60e1ddd07e5665a6a17636a95cd7d8f3b86c73503a69c32979d05f72f3cf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3862,7 +4045,7 @@ dependencies = [ "proc-macro-crate 2.0.0", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -3895,20 +4078,46 @@ 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.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845" +[[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", - "objc2-encode", + "objc-sys 0.3.1", + "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", ] [[package]] @@ -4161,7 +4370,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4276,7 +4485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4648,7 +4857,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.38", + "syn 2.0.39", "walkdir", ] @@ -4896,7 +5105,7 @@ checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -4918,7 +5127,7 @@ checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -5052,7 +5261,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5068,7 +5277,7 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "i-slint-compiler", "spin_on", @@ -5079,7 +5288,7 @@ dependencies = [ [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -5299,7 +5508,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -5514,9 +5723,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -5598,7 +5807,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -5813,7 +6022,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6213,7 +6422,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "const-field-offset", "portable-atomic", @@ -6224,11 +6433,11 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#8becbeb2926335400e4e31ab2d0758698a7ac627" +source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -6302,7 +6511,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -6336,7 +6545,7 @@ checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6555,6 +6764,8 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ + "windows-implement", + "windows-interface", "windows-targets 0.48.5", ] @@ -6567,6 +6778,28 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-implement" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "windows-interface" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "windows-sys" version = "0.45.0" @@ -6722,11 +6955,12 @@ dependencies = [ "memmap2 0.9.0", "ndk", "ndk-sys", - "objc2", + "objc2 0.4.1", "once_cell", "orbclient", "percent-encoding", "raw-window-handle 0.5.2", + "raw-window-handle 0.6.0", "redox_syscall 0.3.5", "rustix 0.38.21", "sctk-adwaita", @@ -6912,7 +7146,7 @@ dependencies = [ "async-executor", "async-fs", "async-io 1.13.0", - "async-lock", + "async-lock 2.8.0", "async-process", "async-recursion", "async-task", @@ -6985,7 +7219,7 @@ checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] diff --git a/czkawka_slint_gui/Cargo.toml b/czkawka_slint_gui/Cargo.toml index 706185aea..91866f370 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/czkawka_slint_gui/Cargo.toml @@ -20,6 +20,11 @@ slint = { git = "https://github.com/slint-ui/slint.git", default-features = fals "accessibility", "compat-1-2" ] } +#slint = { path = "/home/rafal/test/slint/api/rs/slint/", default-features = false, features = ["std", +# "backend-winit", +# "accessibility", +# "compat-1-2" +#] } rand = "0.8.5" czkawka_core = { version = "6.1.0", path = "../czkawka_core" } @@ -34,6 +39,7 @@ log = "0.4.20" [build-dependencies] #slint-build = "1.2.2" slint-build = { git = "https://github.com/slint-ui/slint.git" } +#slint-build = { path = "/home/rafal/test/slint/api/rs/build/"} [features] # TODO remove from deault features skia, because is harder to cross-compile it diff --git a/czkawka_slint_gui/README.md b/czkawka_slint_gui/README.md index ea879d8b9..136b3f27d 100644 --- a/czkawka_slint_gui/README.md +++ b/czkawka_slint_gui/README.md @@ -54,6 +54,21 @@ should print something like Slint: Build config: debug; Backend: software ``` +## Dark theme +App was created with white fluent theme by default, but is easily possible to use dark theme by setting `SLINT_STYLE` environment variable to `fluent-dark` during compilation +e.g. +``` +SLINT_STYLE=fluent-dark cargo run -- --path . +``` + +Slint supports also other themes, but they are not officially supported by this app and may be broken. +``` +SLINT_STYLE=cupertino-light cargo run -- --path . +SLINT_STYLE=cupertino-dark cargo run -- --path . +SLINT_STYLE=material-light cargo run -- --path . +SLINT_STYLE=material-dark cargo run -- --path . +``` + ## How to help? - Suggesting possible design changes in the gui - of course, they should be possible to be simply implemented in the slint keeping in mind the performance aspect as well - Modifying user interface - gui is written in simple language similar to qml - [slint live preview example](https://slint.dev/releases/1.2.2/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) From 727dd4fce805205052ae4238daacbada15b5e7f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 6 Nov 2023 22:03:44 +0100 Subject: [PATCH 039/107] Upt --- .gitignore | 4 +- Cargo.lock | 289 +++--------------- Cargo.toml | 2 +- {czkawka_slint_gui => krokiet}/.clippy.toml | 0 {czkawka_slint_gui => krokiet}/Cargo.toml | 6 +- {czkawka_slint_gui => krokiet}/LICENSE | 0 {czkawka_slint_gui => krokiet}/README.md | 34 ++- {czkawka_slint_gui => krokiet}/build.rs | 0 {czkawka_slint_gui => krokiet}/icons/logo.png | Bin .../icons/settings.png | Bin {czkawka_slint_gui => krokiet}/src/common.rs | 0 .../src/connect_delete.rs | 0 .../src/connect_directories_changes.rs | 0 .../src/connect_open.rs | 0 .../src/connect_progress_receiver.rs | 0 .../src/connect_scan.rs | 0 .../src/connect_stop.rs | 0 {czkawka_slint_gui => krokiet}/src/main.rs | 0 .../src/settings.rs | 0 .../ui/action_buttons.slint | 0 .../ui/bottom_panel.slint | 0 .../ui/color_palette.slint | 0 .../ui/common.slint | 0 .../ui/left_side_panel.slint | 0 .../ui/main_lists.slint | 0 .../ui/main_window.slint | 0 .../ui/progress.slint | 0 .../ui/selectable_tree_view.slint | 0 .../ui/settings.slint | 0 29 files changed, 74 insertions(+), 261 deletions(-) rename {czkawka_slint_gui => krokiet}/.clippy.toml (100%) rename {czkawka_slint_gui => krokiet}/Cargo.toml (95%) rename {czkawka_slint_gui => krokiet}/LICENSE (100%) rename {czkawka_slint_gui => krokiet}/README.md (79%) rename {czkawka_slint_gui => krokiet}/build.rs (100%) rename {czkawka_slint_gui => krokiet}/icons/logo.png (100%) rename {czkawka_slint_gui => krokiet}/icons/settings.png (100%) rename {czkawka_slint_gui => krokiet}/src/common.rs (100%) rename {czkawka_slint_gui => krokiet}/src/connect_delete.rs (100%) rename {czkawka_slint_gui => krokiet}/src/connect_directories_changes.rs (100%) rename {czkawka_slint_gui => krokiet}/src/connect_open.rs (100%) rename {czkawka_slint_gui => krokiet}/src/connect_progress_receiver.rs (100%) rename {czkawka_slint_gui => krokiet}/src/connect_scan.rs (100%) rename {czkawka_slint_gui => krokiet}/src/connect_stop.rs (100%) rename {czkawka_slint_gui => krokiet}/src/main.rs (100%) rename {czkawka_slint_gui => krokiet}/src/settings.rs (100%) rename {czkawka_slint_gui => krokiet}/ui/action_buttons.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/bottom_panel.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/color_palette.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/common.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/left_side_panel.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/main_lists.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/main_window.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/progress.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/selectable_tree_view.slint (100%) rename {czkawka_slint_gui => krokiet}/ui/settings.slint (100%) diff --git a/.gitignore b/.gitignore index 298e00bba..1a095450c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,6 @@ flatpak/ /report ci_tester/target ci_tester/Cargo.lock -czkawka_slint_gui/Cargo.lock -czkawka_slint_gui/target +krokiet/Cargo.lock +krokiet/target *.json \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index b636f5eb6..6d9cc42e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,77 +18,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" -[[package]] -name = "accesskit" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8410747ed85a17c4a1e9ed3f5a74d3e7bdcc876cf9a18ff40ae21d645997b2" - -[[package]] -name = "accesskit_consumer" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c17cca53c09fbd7288667b22a201274b9becaa27f0b91bf52a526db95de45e6" -dependencies = [ - "accesskit", -] - -[[package]] -name = "accesskit_macos" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3b6ae1eabbfbced10e840fd3fce8a93ae84f174b3e4ba892ab7bcb42e477a7" -dependencies = [ - "accesskit", - "accesskit_consumer", - "objc2 0.3.0-beta.3.patch-leaks.3", - "once_cell", -] - -[[package]] -name = "accesskit_unix" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8c9b4467d77cacfbc93cee9aa8e7822f6d527c774efdca5f8b3a5280c34847" -dependencies = [ - "accesskit", - "accesskit_consumer", - "async-channel 1.9.0", - "async-once-cell", - "atspi", - "futures-lite 1.13.0", - "once_cell", - "serde", - "zbus", -] - -[[package]] -name = "accesskit_windows" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcae27ec0974fc7c3b0b318783be89fd1b2e66dd702179fe600166a38ff4a0b" -dependencies = [ - "accesskit", - "accesskit_consumer", - "once_cell", - "paste", - "static_assertions", - "windows 0.48.0", -] - -[[package]] -name = "accesskit_winit" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5284218aca17d9e150164428a0ebc7b955f70e3a9a78b4c20894513aabf98a67" -dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_unix", - "accesskit_windows", - "winit", -] - [[package]] name = "adler" version = "1.0.2" @@ -416,12 +345,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "async-once-cell" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9338790e78aa95a416786ec8389546c4b6a1dfc3dc36071ed9518a9413a542eb" - [[package]] name = "async-process" version = "1.8.1" @@ -526,54 +449,6 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" -[[package]] -name = "atspi" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6059f350ab6f593ea00727b334265c4dfc7fd442ee32d264794bd9bdc68e87ca" -dependencies = [ - "atspi-common", - "atspi-connection", - "atspi-proxies", -] - -[[package]] -name = "atspi-common" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92af95f966d2431f962bc632c2e68eda7777330158bf640c4af4249349b2cdf5" -dependencies = [ - "enumflags2", - "serde", - "static_assertions", - "zbus", - "zbus_names", - "zvariant", -] - -[[package]] -name = "atspi-connection" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c65e7d70f86d4c0e3b2d585d9bf3f979f0b19d635a336725a88d279f76b939" -dependencies = [ - "atspi-common", - "atspi-proxies", - "futures-lite 1.13.0", - "zbus", -] - -[[package]] -name = "atspi-proxies" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6495661273703e7a229356dcbe8c8f38223d697aacfaf0e13590a9ac9977bb52" -dependencies = [ - "atspi-common", - "serde", - "zbus", -] - [[package]] name = "audio_checker" version = "0.1.0" @@ -710,32 +585,13 @@ dependencies = [ "generic-array", ] -[[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.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dd7cf50912cddc06dc5ea7c08c5e81c1b2c842a70d19def1848d54c586fed92" dependencies = [ - "objc-sys 0.3.1", -] - -[[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]] @@ -744,8 +600,8 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" dependencies = [ - "block-sys 0.2.0", - "objc2 0.4.1", + "block-sys", + "objc2", ] [[package]] @@ -1158,7 +1014,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "const-field-offset-macro", "field-offset", @@ -1167,7 +1023,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "proc-macro2", "quote", @@ -1486,23 +1342,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "czkawka_slint" -version = "6.1.0" -dependencies = [ - "chrono", - "crossbeam-channel", - "czkawka_core", - "handsome_logger", - "home", - "log", - "open", - "rand", - "rfd", - "slint", - "slint-build", -] - [[package]] name = "darling" version = "0.14.4" @@ -2568,7 +2407,7 @@ dependencies = [ "glutin_wgl_sys", "icrate", "libloading 0.8.1", - "objc2 0.4.1", + "objc2", "once_cell", "raw-window-handle 0.5.2", "wayland-sys", @@ -2834,7 +2673,7 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "calloop 0.11.0", "drm", @@ -2855,7 +2694,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2868,10 +2707,8 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ - "accesskit", - "accesskit_winit", "bytemuck", "cfg-if", "cfg_aliases", @@ -2905,7 +2742,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "cfg-if", "derive_more", @@ -2916,7 +2753,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "by_address", "codemap", @@ -2945,7 +2782,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "auto_enums", "bytemuck", @@ -2988,7 +2825,7 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "quote", "syn 2.0.39", @@ -2997,7 +2834,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "cfg-if", "const-field-offset", @@ -3029,7 +2866,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "ash", "bytemuck", @@ -3161,9 +2998,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]] @@ -3472,6 +3309,23 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc" +[[package]] +name = "krokiet" +version = "6.1.0" +dependencies = [ + "chrono", + "crossbeam-channel", + "czkawka_core", + "handsome_logger", + "home", + "log", + "open", + "rand", + "rfd", + "slint", + "slint-build", +] + [[package]] name = "kurbo" version = "0.9.5" @@ -4078,46 +3932,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.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99e1d07c6eab1ce8b6382b8e3c7246fe117ff3f8b34be065f5ebace6749fe845" -[[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.1", - "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]] @@ -5090,18 +4918,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.191" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd" dependencies = [ "proc-macro2", "quote", @@ -5261,7 +5089,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5277,7 +5105,7 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "i-slint-compiler", "spin_on", @@ -5288,7 +5116,7 @@ dependencies = [ [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -6422,7 +6250,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "const-field-offset", "portable-atomic", @@ -6433,7 +6261,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#849b583b774a7d62176bf10aa11c383207b44d95" +source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" dependencies = [ "proc-macro2", "quote", @@ -6764,8 +6592,6 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-implement", - "windows-interface", "windows-targets 0.48.5", ] @@ -6778,28 +6604,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-implement" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "windows-interface" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -6955,12 +6759,11 @@ dependencies = [ "memmap2 0.9.0", "ndk", "ndk-sys", - "objc2 0.4.1", + "objc2", "once_cell", "orbclient", "percent-encoding", "raw-window-handle 0.5.2", - "raw-window-handle 0.6.0", "redox_syscall 0.3.5", "rustix 0.38.21", "sctk-adwaita", diff --git a/Cargo.toml b/Cargo.toml index 6a485d609..c8806cb0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [ "czkawka_core", "czkawka_cli", "czkawka_gui", - "czkawka_slint_gui" + "krokiet" ] exclude = [ "ci_tester", diff --git a/czkawka_slint_gui/.clippy.toml b/krokiet/.clippy.toml similarity index 100% rename from czkawka_slint_gui/.clippy.toml rename to krokiet/.clippy.toml diff --git a/czkawka_slint_gui/Cargo.toml b/krokiet/Cargo.toml similarity index 95% rename from czkawka_slint_gui/Cargo.toml rename to krokiet/Cargo.toml index 91866f370..68780d2de 100644 --- a/czkawka_slint_gui/Cargo.toml +++ b/krokiet/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "czkawka_slint" +name = "krokiet" version = "6.1.0" authors = ["Rafał Mikrut "] edition = "2021" rust-version = "1.72.1" -description = "Slint frontend of Czkawka" +description = "Slint frontend of Czkawka Core" license = "GPL-3" homepage = "https://github.com/qarmin/czkawka" repository = "https://github.com/qarmin/czkawka" @@ -17,7 +17,7 @@ build = "build.rs" # Try to use only needed features from https://github.com/slint-ui/slint/blob/master/api/rs/slint/Cargo.toml#L23-L31 slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = ["std", "backend-winit", - "accessibility", +# "accessibility", "compat-1-2" ] } #slint = { path = "/home/rafal/test/slint/api/rs/slint/", default-features = false, features = ["std", diff --git a/czkawka_slint_gui/LICENSE b/krokiet/LICENSE similarity index 100% rename from czkawka_slint_gui/LICENSE rename to krokiet/LICENSE diff --git a/czkawka_slint_gui/README.md b/krokiet/README.md similarity index 79% rename from czkawka_slint_gui/README.md rename to krokiet/README.md index 136b3f27d..b8ef78d25 100644 --- a/czkawka_slint_gui/README.md +++ b/krokiet/README.md @@ -1,23 +1,23 @@ -# NAME_TODO +# Krokiet -NAME_TODO is new Czkawka frontend written in Slint(written mostly in Rust) in opposite to Gtk 4 frontend which uses mostly C code. +Krokiet is new Czkawka frontend written in Slint(written mostly in Rust) in opposite to Gtk 4 frontend which uses mostly C code. Different toolkit means different look, limitations and features, so you should not expect same features like in Gtk 4 frontend. ## Requirements -Slint version of app should not have any special runtime requirements - it should work on almost any OpenGL ES 2 capable device. +Krokiet should not have any special runtime requirements - it should work on almost any OpenGL ES 2 capable device. Alternatively, it can be run with software rendering. ## Compilation -Ubuntu +On Ubuntu you need to install this dependencies: ``` sudo apt install libfontconfig-dev libfreetype-dev ``` Default compilation is done by `cargo build --release` and should work on most systems. -You need the latest available version of Rust to compile it, because NAME_TODO aims to support the latest slint verions, +You need the latest available version of Rust to compile it, because Krokiet aims to support the latest slint verions, that should provide best experience(fixed more bugs/new features). The only exception is building non default skia renderer, that require on windows msvc compiler(not sure how to exactly install it). @@ -37,9 +37,9 @@ cargo build --release --features "winit_software" to run app with different renderers you need to use it, by adding `SLINT_BACKEND` environment ``` -SLINT_BACKEND=winit-femtovg ./target/release/czkawka_slint_gui -SLINT_BACKEND=software ./target/release/czkawka_slint_gui -SLINT_BACKEND=skia ./target/release/czkawka_slint_gui # This uses now opengl - https://github.com/slint-ui/slint/discussions/3799 +SLINT_BACKEND=winit-femtovg ./target/release/krokiet +SLINT_BACKEND=software ./target/release/krokiet +SLINT_BACKEND=skia ./target/release/krokiet # This uses now opengl - https://github.com/slint-ui/slint/discussions/3799 ``` when you will use invalid/non-existing backend, app will show warning ``` @@ -54,7 +54,7 @@ should print something like Slint: Build config: debug; Backend: software ``` -## Dark theme +## Dark/Different theme App was created with white fluent theme by default, but is easily possible to use dark theme by setting `SLINT_STYLE` environment variable to `fluent-dark` during compilation e.g. ``` @@ -72,11 +72,11 @@ SLINT_STYLE=material-dark cargo run -- --path . ## How to help? - Suggesting possible design changes in the gui - of course, they should be possible to be simply implemented in the slint keeping in mind the performance aspect as well - Modifying user interface - gui is written in simple language similar to qml - [slint live preview example](https://slint.dev/releases/1.2.2/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) -- Improving libraries used by NAME_TODO e.g. czkawka_core, image-rs etc. +- Improving libraries used by Krokiet e.g. czkawka_core, image-rs etc. - Improving app rust code ## Why Slint? -There are multiple reasons why I decided to use Slint as toolkit for NAME_TODO over other toolkits. +There are multiple reasons why I decided to use Slint as toolkit for Krokiet over other toolkits. | Toolkit | Pros | Cons | |---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| @@ -84,6 +84,16 @@ There are multiple reasons why I decided to use Slint as toolkit for NAME_TODO o | 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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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 | - Internal .slint language is more limited than QML(javascript flexibility is big pl)
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different ) | | 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) and this is also
- 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
- Cannot select directory - file chooser only can choose files - small thing but important for me
- Not very performant Rust <=> Javascript communication | + 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 to not look at Iced which only allows to create GUI from Rust. -GTK and QT also I throw away due cross compilation problems caused mostly by using C/C++, so only Slint left. \ No newline at end of file +GTK and QT also I throw away due cross compilation problems caused mostly by using C/C++ internally. + +Tauri - I don't really like to use Javascript because I already used it with Qt(C++) + QML + Typescript combination and I found that creating ui in such language may be simple at start but later any bigger changes cause a lot of runtime errors. + +So only Slint left. + +## Name +Why Krokiet(eng. Croquette)? +Because I like croquettes, the ones with meat, mushrooms wrapped in breadcrumbs... it makes my mouth water. \ No newline at end of file diff --git a/czkawka_slint_gui/build.rs b/krokiet/build.rs similarity index 100% rename from czkawka_slint_gui/build.rs rename to krokiet/build.rs diff --git a/czkawka_slint_gui/icons/logo.png b/krokiet/icons/logo.png similarity index 100% rename from czkawka_slint_gui/icons/logo.png rename to krokiet/icons/logo.png diff --git a/czkawka_slint_gui/icons/settings.png b/krokiet/icons/settings.png similarity index 100% rename from czkawka_slint_gui/icons/settings.png rename to krokiet/icons/settings.png diff --git a/czkawka_slint_gui/src/common.rs b/krokiet/src/common.rs similarity index 100% rename from czkawka_slint_gui/src/common.rs rename to krokiet/src/common.rs diff --git a/czkawka_slint_gui/src/connect_delete.rs b/krokiet/src/connect_delete.rs similarity index 100% rename from czkawka_slint_gui/src/connect_delete.rs rename to krokiet/src/connect_delete.rs diff --git a/czkawka_slint_gui/src/connect_directories_changes.rs b/krokiet/src/connect_directories_changes.rs similarity index 100% rename from czkawka_slint_gui/src/connect_directories_changes.rs rename to krokiet/src/connect_directories_changes.rs diff --git a/czkawka_slint_gui/src/connect_open.rs b/krokiet/src/connect_open.rs similarity index 100% rename from czkawka_slint_gui/src/connect_open.rs rename to krokiet/src/connect_open.rs diff --git a/czkawka_slint_gui/src/connect_progress_receiver.rs b/krokiet/src/connect_progress_receiver.rs similarity index 100% rename from czkawka_slint_gui/src/connect_progress_receiver.rs rename to krokiet/src/connect_progress_receiver.rs diff --git a/czkawka_slint_gui/src/connect_scan.rs b/krokiet/src/connect_scan.rs similarity index 100% rename from czkawka_slint_gui/src/connect_scan.rs rename to krokiet/src/connect_scan.rs diff --git a/czkawka_slint_gui/src/connect_stop.rs b/krokiet/src/connect_stop.rs similarity index 100% rename from czkawka_slint_gui/src/connect_stop.rs rename to krokiet/src/connect_stop.rs diff --git a/czkawka_slint_gui/src/main.rs b/krokiet/src/main.rs similarity index 100% rename from czkawka_slint_gui/src/main.rs rename to krokiet/src/main.rs diff --git a/czkawka_slint_gui/src/settings.rs b/krokiet/src/settings.rs similarity index 100% rename from czkawka_slint_gui/src/settings.rs rename to krokiet/src/settings.rs diff --git a/czkawka_slint_gui/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint similarity index 100% rename from czkawka_slint_gui/ui/action_buttons.slint rename to krokiet/ui/action_buttons.slint diff --git a/czkawka_slint_gui/ui/bottom_panel.slint b/krokiet/ui/bottom_panel.slint similarity index 100% rename from czkawka_slint_gui/ui/bottom_panel.slint rename to krokiet/ui/bottom_panel.slint diff --git a/czkawka_slint_gui/ui/color_palette.slint b/krokiet/ui/color_palette.slint similarity index 100% rename from czkawka_slint_gui/ui/color_palette.slint rename to krokiet/ui/color_palette.slint diff --git a/czkawka_slint_gui/ui/common.slint b/krokiet/ui/common.slint similarity index 100% rename from czkawka_slint_gui/ui/common.slint rename to krokiet/ui/common.slint diff --git a/czkawka_slint_gui/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint similarity index 100% rename from czkawka_slint_gui/ui/left_side_panel.slint rename to krokiet/ui/left_side_panel.slint diff --git a/czkawka_slint_gui/ui/main_lists.slint b/krokiet/ui/main_lists.slint similarity index 100% rename from czkawka_slint_gui/ui/main_lists.slint rename to krokiet/ui/main_lists.slint diff --git a/czkawka_slint_gui/ui/main_window.slint b/krokiet/ui/main_window.slint similarity index 100% rename from czkawka_slint_gui/ui/main_window.slint rename to krokiet/ui/main_window.slint diff --git a/czkawka_slint_gui/ui/progress.slint b/krokiet/ui/progress.slint similarity index 100% rename from czkawka_slint_gui/ui/progress.slint rename to krokiet/ui/progress.slint diff --git a/czkawka_slint_gui/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint similarity index 100% rename from czkawka_slint_gui/ui/selectable_tree_view.slint rename to krokiet/ui/selectable_tree_view.slint diff --git a/czkawka_slint_gui/ui/settings.slint b/krokiet/ui/settings.slint similarity index 100% rename from czkawka_slint_gui/ui/settings.slint rename to krokiet/ui/settings.slint From 4f65c9193aefc5b21e95cf5d25771277b48f3ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 7 Nov 2023 21:52:43 +0100 Subject: [PATCH 040/107] Added manual setting --- krokiet/src/connect_directories_changes.rs | 41 +++++++++++- krokiet/ui/bottom_panel.slint | 40 ++++-------- krokiet/ui/callabler.slint | 4 ++ krokiet/ui/color_palette.slint | 7 +- krokiet/ui/left_side_panel.slint | 1 - krokiet/ui/main_window.slint | 74 +++++++++++++++++++++- krokiet/ui/settings.slint | 7 -- 7 files changed, 132 insertions(+), 42 deletions(-) create mode 100644 krokiet/ui/callabler.slint diff --git a/krokiet/src/connect_directories_changes.rs b/krokiet/src/connect_directories_changes.rs index ae579ee6a..0eb6ccb15 100644 --- a/krokiet/src/connect_directories_changes.rs +++ b/krokiet/src/connect_directories_changes.rs @@ -1,16 +1,53 @@ use rfd::FileDialog; use slint::{ComponentHandle, Model, ModelRc, VecModel}; -use crate::{MainWindow, Settings}; +use crate::{Callabler, MainWindow, Settings}; pub fn connect_add_remove_directories(app: &MainWindow) { connect_add_directories(app); connect_remove_directories(app); + connect_add_manual_directories(app); +} + +fn connect_add_manual_directories(app: &MainWindow) { + let a = app.as_weak(); + app.global::().on_added_manual_directories(move |included_directories, list_of_files_to_add| { + let non_empty_lines = list_of_files_to_add.lines().filter(|x| !x.is_empty()).collect::>(); + if non_empty_lines.is_empty() { + return; + } + let app = a.upgrade().unwrap(); + let settings = app.global::(); + + if included_directories { + let included_model = settings.get_included_directories(); + let mut included_model = included_model.iter().collect::>(); + included_model.extend(non_empty_lines.iter().map(|x| { + let mut element = slint::StandardListViewItem::default(); + element.text = slint::SharedString::from(x.to_string()); + element + })); + included_model.sort_by_cached_key(|x| x.text.to_string()); + included_model.dedup(); + settings.set_included_directories(ModelRc::new(VecModel::from(included_model))); + } else { + let excluded_model = settings.get_excluded_directories(); + let mut excluded_model = excluded_model.iter().collect::>(); + excluded_model.extend(non_empty_lines.iter().map(|x| { + let mut element = slint::StandardListViewItem::default(); + element.text = slint::SharedString::from(x.to_string()); + element + })); + excluded_model.sort_by_cached_key(|x| x.text.to_string()); + excluded_model.dedup(); + settings.set_excluded_directories(ModelRc::new(VecModel::from(excluded_model))); + } + }); } fn connect_remove_directories(app: &MainWindow) { let a = app.as_weak(); - app.global::().on_remove_item_directories(move |included_directories, current_index| { + app.global::().on_remove_item_directories(move |included_directories, current_index| { // Nothing selected if current_index == -1 { return; diff --git a/krokiet/ui/bottom_panel.slint b/krokiet/ui/bottom_panel.slint index fb9660f3a..7b115420d 100644 --- a/krokiet/ui/bottom_panel.slint +++ b/krokiet/ui/bottom_panel.slint @@ -2,9 +2,11 @@ import {Button, StandardListView, VerticalBox, ScrollView, TextEdit} from "std-widgets.slint"; import {Settings} from "settings.slint"; import {BottomPanelVisibility} from "common.slint"; +import {Callabler} from "callabler.slint"; component DirectoriesPanel { callback folder-choose-requested(bool); + callback show_manual_add_dialog(bool); // Included directories HorizontalLayout { @@ -19,7 +21,13 @@ component DirectoriesPanel { Button { text: "Remove"; clicked => { - Settings.remove_item_directories(true, included-list.current-item); + Callabler.remove_item_directories(true, included-list.current-item); + } + } + Button { + text: "Manual Add"; + clicked => { + show_manual_add_dialog(true); } } Rectangle { @@ -50,13 +58,13 @@ component DirectoriesPanel { Button { text: "Remove"; clicked => { - Settings.remove_item_directories(false, excluded-list.current-item); + Callabler.remove_item_directories(false, excluded-list.current-item); } } Button { text: "Manual Add"; clicked => { - popup_item.show(); + show_manual_add_dialog(false); } } Rectangle { @@ -75,30 +83,6 @@ component DirectoriesPanel { } } } - - popup_item := PopupWindow { - height: root.height; - width: root.width; - - private property text_data; - - close-on-click: false; - - TextEdit { - text <=> text-data; - } - TextEdit { - - } - - Rectangle { - background: red; - border-radius: 3px; - border-width: 2px; - border-color: blue; - } - - } } // TODO this should be a normal read only Text editor component TextErrorsPanel inherits TextEdit { @@ -113,6 +97,7 @@ export component BottomPanel { in-out property console_text; callback folder-choose-requested(bool); + callback show_manual_add_dialog(bool); callback set_console_text(string); min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px; @@ -122,6 +107,7 @@ export component BottomPanel { width: parent.width; height: parent.height; folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)} + show_manual_add_dialog(included-directories) => {root.show_manual_add_dialog(included-directories)} } if bottom-panel-visibility == BottomPanelVisibility.TextErrors : TextErrorsPanel { diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint new file mode 100644 index 000000000..dbb78e53d --- /dev/null +++ b/krokiet/ui/callabler.slint @@ -0,0 +1,4 @@ +export global Callabler { + callback remove_item_directories(bool, int); + callback added_manual_directories(bool, string); +} \ No newline at end of file diff --git a/krokiet/ui/color_palette.slint b/krokiet/ui/color_palette.slint index 447d0357e..8150309d9 100644 --- a/krokiet/ui/color_palette.slint +++ b/krokiet/ui/color_palette.slint @@ -2,11 +2,14 @@ import { StyleMetrics } from "std-widgets.slint"; export global ColorPalette { // Tabs at left side - in-out property tab_selected_color: StyleMetrics.dark-color-scheme ? red : blue; - in-out property tab_hovered_color: StyleMetrics.dark-color-scheme ? green : yellow; + in-out property tab_selected_color: StyleMetrics.dark-color-scheme ? #353535 : #5e5e5e; + in-out property tab_hovered_color: StyleMetrics.dark-color-scheme ? #49494926 : #80808014; // ListView in-out property list_view_normal_color: StyleMetrics.dark-color-scheme ? #474747 : #dddddd; in-out property list_view_normal_header_color: StyleMetrics.dark-color-scheme ? #292929 : #888888; in-out property list_view_normal_selected_header: StyleMetrics.dark-color-scheme ? #575757 : #cccccc; + + // Popup + in-out property popup_background: StyleMetrics.dark-color-scheme ? #353535 : #5e5e5e; } \ No newline at end of file diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index 4cbe83758..75a5dc315 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -12,7 +12,6 @@ component TabItem { width: parent.width; horizontal-stretch: 1.0; background: touch-area.has-hover ? ColorPalette.tab-hovered-color : transparent; - opacity: 0.05; touch_area:= TouchArea { clicked => { diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index 9248ba613..e3ef17468 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -1,4 +1,4 @@ -import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint"; +import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint"; import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; import {MainList} from "main_lists.slint"; @@ -6,10 +6,12 @@ import {CurrentTab, ProgressToSend} from "common.slint"; import { ActionButtons } from "action_buttons.slint"; import { Progress } from "progress.slint"; import {MainListModel} from "common.slint"; -import {Settings, SettingsModel} from "settings.slint"; +import {Settings} from "settings.slint"; +import {Callabler} from "callabler.slint"; import { BottomPanel } from "bottom_panel.slint"; +import {ColorPalette} from "color_palette.slint"; -export {Settings} +export {Settings, Callabler} export component MainWindow inherits Window { callback deleted; @@ -114,10 +116,76 @@ export component MainWindow inherits Window { read-only: true; } bottom_panel := BottomPanel { + property included-directories; // TODO why cannot set popup_item property? Strange limitation + bottom-panel-visibility <=> action_buttons.bottom-panel-visibility; vertical-stretch: 0.0; folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)} + show_manual_add_dialog(included-directories) => { + self.included-directories = included-directories; + popup-item.show() + } + } + } + + popup_item := PopupWindow { + height: root.height; + width: root.width; + + property included_directories; + private property text_data; + + callback set_included_directories(bool); + + close-on-click: false; + + set-included-directories(included-directories) => { + self.included-directories = included-directories; } + + HorizontalLayout { + alignment: LayoutAlignment.center; + VerticalLayout { + alignment: LayoutAlignment.center; + Rectangle { + clip: true; + width: popup_item.width - 20px; + height: popup_item.height - 20px; + border-radius: 20px; + background: ColorPalette.popup_background; // TODO Dark theme + VerticalLayout { + // width: parent.width - 20px; + // height: parent.height - 20px; + Text { + text: "Please add directories one per line"; + horizontal-alignment: TextHorizontalAlignment.center; + } + TextEdit { + vertical-stretch: 1.0; + text <=> text-data; + } + HorizontalLayout { + min-height: 20px; + Button { + enabled: text-data != ""; + text: "OK"; + clicked => { + Callabler.added_manual_directories(bottom-panel.included-directories, text_data); + popup-item.close(); + } + } + Button { + text: "Cancel"; + clicked => { + popup-item.close(); + } + } + } + } + } + } + } + } set_console_text(text) => { diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index 2186b1519..f9d0efcc1 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -1,13 +1,6 @@ -export struct SettingsModel { - is_selected: bool, -} - export global Settings { - in-out property model; in-out property checkbox_checked: false; in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}]; in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}]; - - callback remove_item_directories(bool, int); } \ No newline at end of file From ea29b65c11f8092ba0fcc87422be5b819cc6ab33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 8 Nov 2023 21:27:24 +0100 Subject: [PATCH 041/107] Settings --- Cargo.lock | 2 + krokiet/Cargo.toml | 4 +- krokiet/src/common.rs | 16 ++++- krokiet/src/connect_delete.rs | 3 +- krokiet/src/connect_directories_changes.rs | 4 +- krokiet/src/connect_scan.rs | 64 +++++++++++++++--- krokiet/src/settings.rs | 78 ++++++++++++++++------ krokiet/ui/main_window.slint | 6 -- 8 files changed, 133 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d9cc42e3..c9ac55ca4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3322,6 +3322,8 @@ dependencies = [ "open", "rand", "rfd", + "serde", + "serde_json", "slint", "slint-build", ] diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index 68780d2de..8bffa6e52 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -35,6 +35,8 @@ handsome_logger = "0.8.0" rfd = { version = "0.12.0", default-features = false, features = ["xdg-portal"] } home = "0.5.5" log = "0.4.20" +serde = "1.0" +serde_json = "1.0" [build-dependencies] #slint-build = "1.2.2" @@ -43,7 +45,7 @@ slint-build = { git = "https://github.com/slint-ui/slint.git" } [features] # TODO remove from deault features skia, because is harder to cross-compile it -default = ["winit_femtovg", "winit_software", "winit_skia_opengl"] +default = ["winit_femtovg", "winit_software"] skia_opengl = ["slint/renderer-skia-opengl"] skia_vulkan = ["slint/renderer-skia-vulkan"] software = ["slint/renderer-software"] diff --git a/krokiet/src/common.rs b/krokiet/src/common.rs index 66c912004..4b4eed750 100644 --- a/krokiet/src/common.rs +++ b/krokiet/src/common.rs @@ -1,11 +1,23 @@ use slint::{ModelRc, SharedString, StandardListViewItem, VecModel}; +use std::path::PathBuf; -pub fn create_string_standard_list_view(items: &[String]) -> ModelRc { +// pub fn create_string_standard_list_view(items: &[String]) -> ModelRc { +// let new_folders_standard_list_view = items +// .iter() +// .map(|x| { +// let mut element = StandardListViewItem::default(); +// element.text = SharedString::from(x.to_string()); +// element +// }) +// .collect::>(); +// ModelRc::new(VecModel::from(new_folders_standard_list_view)) +// } +pub fn create_string_standard_list_view_from_pathbuf(items: &[PathBuf]) -> ModelRc { let new_folders_standard_list_view = items .iter() .map(|x| { let mut element = StandardListViewItem::default(); - element.text = SharedString::from(x.to_string()); + element.text = SharedString::from(x.to_string_lossy().to_string()); element }) .collect::>(); diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index 9fc752eb9..4f337a4ee 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -2,8 +2,7 @@ use std::borrow::Borrow; use slint::{ComponentHandle, Model, ModelRc, VecModel}; -use crate::MainListModel; -use crate::{CurrentTab, MainWindow}; +use crate::{CurrentTab, MainListModel, MainWindow}; use log::info; pub fn connect_delete_button(app: &MainWindow) { diff --git a/krokiet/src/connect_directories_changes.rs b/krokiet/src/connect_directories_changes.rs index 0eb6ccb15..80a919d8c 100644 --- a/krokiet/src/connect_directories_changes.rs +++ b/krokiet/src/connect_directories_changes.rs @@ -24,7 +24,7 @@ fn connect_add_manual_directories(app: &MainWindow) { let mut included_model = included_model.iter().collect::>(); included_model.extend(non_empty_lines.iter().map(|x| { let mut element = slint::StandardListViewItem::default(); - element.text = slint::SharedString::from(x.to_string()); + element.text = slint::SharedString::from((*x).to_string()); element })); included_model.sort_by_cached_key(|x| x.text.to_string()); @@ -35,7 +35,7 @@ fn connect_add_manual_directories(app: &MainWindow) { let mut excluded_model = excluded_model.iter().collect::>(); excluded_model.extend(non_empty_lines.iter().map(|x| { let mut element = slint::StandardListViewItem::default(); - element.text = slint::SharedString::from(x.to_string()); + element.text = slint::SharedString::from((*x).to_string()); element })); excluded_model.sort_by_cached_key(|x| x.text.to_string()); diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 816868741..927393e94 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -1,10 +1,12 @@ -use crate::MainListModel; -use crate::{CurrentTab, MainWindow, ProgressToSend}; +use crate::settings::{collect_settings, SettingsCustom}; +use crate::{CurrentTab, MainListModel, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; use crossbeam_channel::{Receiver, Sender}; use czkawka_core::common::split_path; use czkawka_core::common_dir_traversal::ProgressData; use czkawka_core::common_tool::CommonData; +use czkawka_core::common_traits::ResultEntry; +use czkawka_core::empty_files::EmptyFiles; use czkawka_core::empty_folder::EmptyFolder; use slint::{ComponentHandle, ModelRc, SharedString, VecModel, Weak}; use std::path::PathBuf; @@ -24,25 +26,67 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender { - scan_empty_folders(a, progress_sender, stop_receiver); + scan_empty_folders(a, progress_sender, stop_receiver, custom_settings); + } + CurrentTab::EmptyFiles => { + scan_empty_files(a, progress_sender, stop_receiver, custom_settings); } _ => panic!(), } }); } -fn scan_empty_folders(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>) { +fn scan_empty_files(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>, custom_settings: SettingsCustom) { thread::spawn(move || { - let mut ef = EmptyFolder::new(); - ef.set_included_directory(vec![PathBuf::from("/home/rafal/Desktop")]); - ef.find_empty_folders(Some(&stop_receiver), Some(&progress_sender)); + let mut finder = EmptyFiles::new(); + finder.set_included_directory(custom_settings.included_directories.clone()); + finder.set_excluded_directory(custom_settings.excluded_directories.clone()); + finder.find_empty_files(Some(&stop_receiver), Some(&progress_sender)); + + let mut vector = finder.get_empty_files().clone(); + + vector.sort_unstable_by_key(|e| { + let t = split_path(e.get_path()); + (t.0, t.1) + }); + + a.upgrade_in_event_loop(move |app| { + let items = Rc::new(VecModel::default()); + for fe in vector { + let (directory, file) = split_path(fe.get_path()); + let data_model = VecModel::from_slice(&[ + SharedString::from(file), + SharedString::from(directory), + SharedString::from(NaiveDateTime::from_timestamp_opt(fe.get_modified_date() as i64, 0).unwrap().to_string()), + ]); - ef.get_empty_folder_list(); + let main = MainListModel { + checked: false, + header_row: false, + selected_row: false, + val: ModelRc::new(data_model), + }; + items.push(main); + } + app.set_empty_files_model(items.into()); + app.invoke_scan_ended(); + }) + }); +} + +fn scan_empty_folders(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>, custom_settings: SettingsCustom) { + thread::spawn(move || { + let mut finder = EmptyFolder::new(); + finder.set_included_directory(custom_settings.included_directories.clone()); + finder.set_excluded_directory(custom_settings.excluded_directories.clone()); + finder.find_empty_folders(Some(&stop_receiver), Some(&progress_sender)); - let mut vector = ef.get_empty_folder_list().keys().cloned().collect::>(); + let mut vector = finder.get_empty_folder_list().keys().cloned().collect::>(); vector.sort_unstable_by_key(|e| { let t = split_path(e.as_path()); @@ -50,7 +94,7 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender }); a.upgrade_in_event_loop(move |app| { - let folder_map = ef.get_empty_folder_list(); + let folder_map = finder.get_empty_folder_list(); let items = Rc::new(VecModel::default()); for path in vector { let (directory, file) = split_path(&path); diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 85ac33cdc..23669600f 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -1,10 +1,11 @@ use crate::MainWindow; use std::env; +use std::path::PathBuf; -use crate::common::create_string_standard_list_view; +use crate::common::create_string_standard_list_view_from_pathbuf; use crate::Settings; use home::home_dir; -use slint::{ComponentHandle, SharedString}; +use slint::{ComponentHandle, Model, SharedString}; #[cfg(target_family = "unix")] const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", "/snap"]; @@ -12,30 +13,65 @@ const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["C:\\Windows"]; pub fn reset_settings(app: &MainWindow) { - let settings = app.global::(); - - // app.width(1000); app.invoke_set_console_text(SharedString::from("")); + set_settings_to_gui(app, &SettingsCustom::default()); +} + +pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { + let settings = app.global::(); + // Included directories - let mut included_directories = vec![]; - if let Ok(current_dir) = env::current_dir() { - included_directories.push(current_dir.to_string_lossy().to_string()); - } else if let Some(home_dir) = home_dir() { - included_directories.push(home_dir.to_string_lossy().to_string()); - } else if cfg!(target_family = "unix") { - included_directories.push("/".to_string()); - } else { - // This could be set to default - included_directories.push("C:\\".to_string()); - }; - included_directories.sort(); - let included_items = create_string_standard_list_view(&included_directories); + let included_items = create_string_standard_list_view_from_pathbuf(&custom_settings.included_directories); settings.set_included_directories(included_items); // Excluded directories - let mut excluded_directories = DEFAULT_EXCLUDED_DIRECTORIES.iter().map(|x| (*x).to_string()).collect::>(); - excluded_directories.sort(); - let excluded_items = create_string_standard_list_view(&excluded_directories); + let excluded_items = create_string_standard_list_view_from_pathbuf(&custom_settings.excluded_directories); settings.set_excluded_directories(excluded_items); } + +pub struct SettingsCustom { + pub included_directories: Vec, + pub excluded_directories: Vec, +} + +impl Default for SettingsCustom { + fn default() -> Self { + let mut included_directories = vec![]; + if let Ok(current_dir) = env::current_dir() { + included_directories.push(current_dir.to_string_lossy().to_string()); + } else if let Some(home_dir) = home_dir() { + included_directories.push(home_dir.to_string_lossy().to_string()); + } else if cfg!(target_family = "unix") { + included_directories.push("/".to_string()); + } else { + // This could be set to default + included_directories.push("C:\\".to_string()); + }; + included_directories.sort(); + let included_directories = included_directories.iter().map(PathBuf::from).collect::>(); + + let mut excluded_directories = DEFAULT_EXCLUDED_DIRECTORIES.iter().map(PathBuf::from).collect::>(); + excluded_directories.sort(); + + Self { + included_directories, + excluded_directories, + } + } +} + +pub fn collect_settings(app: &MainWindow) -> SettingsCustom { + let settings = app.global::(); + + let included_directories = settings.get_included_directories(); + let included_directories = included_directories.iter().map(|x| PathBuf::from(x.text.as_str())).collect::>(); + + let excluded_directories = settings.get_excluded_directories(); + let excluded_directories = excluded_directories.iter().map(|x| PathBuf::from(x.text.as_str())).collect::>(); + + SettingsCustom { + included_directories, + excluded_directories, + } +} diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index e3ef17468..8250609a4 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -135,14 +135,8 @@ export component MainWindow inherits Window { property included_directories; private property text_data; - callback set_included_directories(bool); - close-on-click: false; - set-included-directories(included-directories) => { - self.included-directories = included-directories; - } - HorizontalLayout { alignment: LayoutAlignment.center; VerticalLayout { From 812164bce97850f27adf3b5ed141292d0834fc3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 10 Nov 2023 16:49:54 +0100 Subject: [PATCH 042/107] Console text --- krokiet/src/connect_scan.rs | 10 +++++++-- krokiet/src/settings.rs | 15 +++++++------ krokiet/ui/action_buttons.slint | 2 +- krokiet/ui/bottom_panel.slint | 12 ++--------- krokiet/ui/color_palette.slint | 6 +++--- krokiet/ui/main_lists.slint | 8 +++---- krokiet/ui/main_window.slint | 38 ++++----------------------------- krokiet/ui/settings.slint | 4 ++-- 8 files changed, 32 insertions(+), 63 deletions(-) diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 927393e94..226cbdc1f 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -1,4 +1,5 @@ use crate::settings::{collect_settings, SettingsCustom}; +use crate::Settings; use crate::{CurrentTab, MainListModel, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; use crossbeam_channel::{Receiver, Sender}; @@ -49,6 +50,7 @@ fn scan_empty_files(a: Weak, progress_sender: Sender, finder.find_empty_files(Some(&stop_receiver), Some(&progress_sender)); let mut vector = finder.get_empty_files().clone(); + let messages = finder.get_text_messages().create_messages_text(); vector.sort_unstable_by_key(|e| { let t = split_path(e.get_path()); @@ -56,6 +58,7 @@ fn scan_empty_files(a: Weak, progress_sender: Sender, }); a.upgrade_in_event_loop(move |app| { + let number_of_empty_files = vector.len(); let items = Rc::new(VecModel::default()); for fe in vector { let (directory, file) = split_path(fe.get_path()); @@ -74,7 +77,8 @@ fn scan_empty_files(a: Weak, progress_sender: Sender, items.push(main); } app.set_empty_files_model(items.into()); - app.invoke_scan_ended(); + app.invoke_scan_ended(format!("Found {} empty files", number_of_empty_files).into()); + app.global::().set_info_text(messages.into()); }) }); } @@ -87,6 +91,7 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender finder.find_empty_folders(Some(&stop_receiver), Some(&progress_sender)); let mut vector = finder.get_empty_folder_list().keys().cloned().collect::>(); + let messages = finder.get_text_messages().create_messages_text(); vector.sort_unstable_by_key(|e| { let t = split_path(e.as_path()); @@ -113,7 +118,8 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender items.push(main); } app.set_empty_folder_model(items.into()); - app.invoke_scan_ended(); + app.invoke_scan_ended(format!("Found {} empty folders", folder_map.len()).into()); + app.global::().set_info_text(messages.into()); }) }); } diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 23669600f..9fdb8340f 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -5,16 +5,19 @@ use std::path::PathBuf; use crate::common::create_string_standard_list_view_from_pathbuf; use crate::Settings; use home::home_dir; -use slint::{ComponentHandle, Model, SharedString}; +use slint::{ComponentHandle, Model}; #[cfg(target_family = "unix")] const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", "/snap"]; #[cfg(not(target_family = "unix"))] const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["C:\\Windows"]; -pub fn reset_settings(app: &MainWindow) { - app.invoke_set_console_text(SharedString::from("")); +pub struct SettingsCustom { + pub included_directories: Vec, + pub excluded_directories: Vec, +} +pub fn reset_settings(app: &MainWindow) { set_settings_to_gui(app, &SettingsCustom::default()); } @@ -28,11 +31,9 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { // Excluded directories let excluded_items = create_string_standard_list_view_from_pathbuf(&custom_settings.excluded_directories); settings.set_excluded_directories(excluded_items); -} -pub struct SettingsCustom { - pub included_directories: Vec, - pub excluded_directories: Vec, + // Clear text + app.global::().set_info_text("".into()); } impl Default for SettingsCustom { diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 6d8e70e6d..4614ca009 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -87,7 +87,7 @@ export component ActionButtons inherits HorizontalLayout { height: parent.height; button-visibility: BottomPanelVisibility.NotVisible; bottom_panel_visibility <=> bottom_panel_visibility; - text: "NotVS"; + text: "None"; } } } \ No newline at end of file diff --git a/krokiet/ui/bottom_panel.slint b/krokiet/ui/bottom_panel.slint index 7b115420d..2de881291 100644 --- a/krokiet/ui/bottom_panel.slint +++ b/krokiet/ui/bottom_panel.slint @@ -84,21 +84,19 @@ component DirectoriesPanel { } } } -// TODO this should be a normal read only Text editor + component TextErrorsPanel inherits TextEdit { height: 20px; read-only: true; - text: "Something\nShould be\nASFASF\nasgasg\nASfgasga\nasfgAGAWGW\nAfgAWFGAWG\nfawfafgweg\nAFGWGTwgwg\nGawgAWFWAF\nawfawgaw\nasfa \nasfawgw\nawfawg\nRRRRRR"; + text <=> Settings.info_text; } export component BottomPanel { in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; - in-out property console_text; callback folder-choose-requested(bool); callback show_manual_add_dialog(bool); - callback set_console_text(string); min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px; min-width: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 400px; @@ -111,13 +109,7 @@ export component BottomPanel { } if bottom-panel-visibility == BottomPanelVisibility.TextErrors : TextErrorsPanel { - text: console_text; - width: parent.width; height: parent.height; } - - set_console_text(text) => { - console_text = text; - } } diff --git a/krokiet/ui/color_palette.slint b/krokiet/ui/color_palette.slint index 8150309d9..c448c20b7 100644 --- a/krokiet/ui/color_palette.slint +++ b/krokiet/ui/color_palette.slint @@ -6,9 +6,9 @@ export global ColorPalette { in-out property tab_hovered_color: StyleMetrics.dark-color-scheme ? #49494926 : #80808014; // ListView - in-out property list_view_normal_color: StyleMetrics.dark-color-scheme ? #474747 : #dddddd; - in-out property list_view_normal_header_color: StyleMetrics.dark-color-scheme ? #292929 : #888888; - in-out property list_view_normal_selected_header: StyleMetrics.dark-color-scheme ? #575757 : #cccccc; + in-out property list_view_normal_color: StyleMetrics.dark-color-scheme ? #222222 : #dddddd; + in-out property list_view_normal_header_color: StyleMetrics.dark-color-scheme ? #111111 : #888888; + in-out property list_view_normal_selected_header: StyleMetrics.dark-color-scheme ? #444444 : #cccccc; // Popup in-out property popup_background: StyleMetrics.dark-color-scheme ? #353535 : #5e5e5e; diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index f9a656232..34e50b592 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -28,9 +28,9 @@ export component MainList { if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { min-width: 200px; - columns: ["Selection", "Folder Name", "Path"]; + columns: ["Selection", "File Name", "Path"]; last-column: "Modification Date"; - column-sizes: [30px, 100px, 100px, 100px]; + column-sizes: [35px, 100px, 350px, 100px]; values <=> empty-files-model; parentPathIdx: 2; fileNameIdx: 1; @@ -40,9 +40,9 @@ export component MainList { if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { min-width: 200px; - columns: ["Selection", "Folder Name", "Path"]; + columns: ["Selection", "File Name", "Path"]; last-column: "Modification Date"; - column-sizes: [30px, 100px, 100px, 100px]; + column-sizes: [35px, 100px, 350px, 100px]; values <=> similar-images-model; parentPathIdx: 2; fileNameIdx: 1; diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index 8250609a4..1465c31a4 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -19,9 +19,8 @@ export component MainWindow inherits Window { callback scan_starting(CurrentTab); callback item_opened(string); callback folder-choose-requested(bool); - callback set_console_text(string); - callback scan_ended(); + callback scan_ended(string); min-width: 300px; preferred-width: 800px; @@ -41,29 +40,6 @@ export component MainWindow inherits Window { {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , - {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} ]; in-out property <[MainListModel]> empty_files_model: []; @@ -146,10 +122,8 @@ export component MainWindow inherits Window { width: popup_item.width - 20px; height: popup_item.height - 20px; border-radius: 20px; - background: ColorPalette.popup_background; // TODO Dark theme + background: ColorPalette.popup_background; VerticalLayout { - // width: parent.width - 20px; - // height: parent.height - 20px; Text { text: "Please add directories one per line"; horizontal-alignment: TextHorizontalAlignment.center; @@ -182,12 +156,8 @@ export component MainWindow inherits Window { } - set_console_text(text) => { - bottom-panel.set_console_text(text); - } - - scan_ended() => { - text-summary.text = ""; // TODO this should be filled with results + scan_ended(scan_text) => { + text-summary.text = scan_text; root.scanning = false; root.stop_requested = false; } diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index f9d0efcc1..f95a6b7a8 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -1,6 +1,6 @@ export global Settings { - in-out property checkbox_checked: false; - in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}]; in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}]; + + in-out property info_text: "Nothing to report"; } \ No newline at end of file From a0e151e5fefef9507c5bbbec4c8b98cd199d3873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 10 Nov 2023 17:11:32 +0100 Subject: [PATCH 043/107] Formatter --- krokiet/ui/action_buttons.slint | 15 +++++------ krokiet/ui/bottom_panel.slint | 27 ++++++++++++------- krokiet/ui/callabler.slint | 4 +-- krokiet/ui/color_palette.slint | 16 +++++------ krokiet/ui/left_side_panel.slint | 26 +++++++++--------- krokiet/ui/main_lists.slint | 23 ++++++++-------- krokiet/ui/main_window.slint | 36 ++++++++++++++----------- krokiet/ui/progress.slint | 15 +++++++---- krokiet/ui/selectable_tree_view.slint | 39 +++++++++++++-------------- krokiet/ui/settings.slint | 5 ++-- 10 files changed, 108 insertions(+), 98 deletions(-) diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 4614ca009..5da027be8 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -7,11 +7,9 @@ import {BottomPanelVisibility} from "common.slint"; export component VisibilityButton inherits Button { in-out property button_visibility; in-out property bottom_panel_visibility; - enabled: bottom_panel_visibility != button-visibility; height: 30px; width: 70px; - clicked => { bottom-panel-visibility = button_visibility; } @@ -21,7 +19,6 @@ export component ActionButtons inherits HorizontalLayout { callback deleted; callback scan_stopping; callback scan_starting(CurrentTab); - in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; in-out property stop_requested: false; in-out property scanning; @@ -29,8 +26,7 @@ export component ActionButtons inherits HorizontalLayout { out property name; height: 30px; spacing: 4px; - - scan_button:= Button { + scan_button := Button { height: parent.height; enabled: !scanning; text: "Scan"; @@ -39,7 +35,8 @@ export component ActionButtons inherits HorizontalLayout { root.scan_starting(active-tab); } } - stop_button:= Button { + + stop_button := Button { height: parent.height; enabled: scanning && !stop_requested; text: "Stop"; @@ -53,7 +50,7 @@ export component ActionButtons inherits HorizontalLayout { horizontal-stretch: 0.5; } - delete_button:= Button { + delete_button := Button { height: parent.height; enabled: !scanning; text: "Delete"; @@ -61,7 +58,7 @@ export component ActionButtons inherits HorizontalLayout { root.deleted(); } } - + Rectangle { horizontal-stretch: 0.5; } @@ -90,4 +87,4 @@ export component ActionButtons inherits HorizontalLayout { text: "None"; } } -} \ No newline at end of file +} diff --git a/krokiet/ui/bottom_panel.slint b/krokiet/ui/bottom_panel.slint index 2de881291..00ce526e4 100644 --- a/krokiet/ui/bottom_panel.slint +++ b/krokiet/ui/bottom_panel.slint @@ -7,7 +7,6 @@ import {Callabler} from "callabler.slint"; component DirectoriesPanel { callback folder-choose-requested(bool); callback show_manual_add_dialog(bool); - // Included directories HorizontalLayout { VerticalLayout { @@ -18,22 +17,26 @@ component DirectoriesPanel { folder-choose-requested(true); } } + Button { text: "Remove"; clicked => { Callabler.remove_item_directories(true, included-list.current-item); } } + Button { text: "Manual Add"; clicked => { show_manual_add_dialog(true); } } + Rectangle { vertical-stretch: 1.0; } } + VerticalLayout { horizontal-stretch: 1.0; Rectangle { @@ -41,6 +44,7 @@ component DirectoriesPanel { text: "Included Directories"; } } + included_list := StandardListView { model: Settings.included-directories; } @@ -55,22 +59,26 @@ component DirectoriesPanel { folder-choose-requested(false); } } + Button { text: "Remove"; clicked => { Callabler.remove_item_directories(false, excluded-list.current-item); } } + Button { text: "Manual Add"; clicked => { show_manual_add_dialog(false); } } + Rectangle { vertical-stretch: 1.0; } } + VerticalLayout { horizontal-stretch: 1.0; Rectangle { @@ -78,6 +86,7 @@ component DirectoriesPanel { text: "Excluded Directories"; } } + excluded_list := StandardListView { model: Settings.excluded-directories; } @@ -89,26 +98,26 @@ component TextErrorsPanel inherits TextEdit { height: 20px; read-only: true; text <=> Settings.info_text; - } export component BottomPanel { in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; - callback folder-choose-requested(bool); callback show_manual_add_dialog(bool); - min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px; min-width: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 400px; - if bottom-panel-visibility == BottomPanelVisibility.Directories: DirectoriesPanel { width: parent.width; height: parent.height; - folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)} - show_manual_add_dialog(included-directories) => {root.show_manual_add_dialog(included-directories)} + folder-choose-requested(included-directories) => { + root.folder-choose-requested(included-directories) + } + show_manual_add_dialog(included-directories) => { + root.show_manual_add_dialog(included-directories) + } } - - if bottom-panel-visibility == BottomPanelVisibility.TextErrors : TextErrorsPanel { + + if bottom-panel-visibility == BottomPanelVisibility.TextErrors: TextErrorsPanel { width: parent.width; height: parent.height; } diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint index dbb78e53d..b4f21da2f 100644 --- a/krokiet/ui/callabler.slint +++ b/krokiet/ui/callabler.slint @@ -1,4 +1,4 @@ -export global Callabler { +export global Callabler { callback remove_item_directories(bool, int); callback added_manual_directories(bool, string); -} \ No newline at end of file +} diff --git a/krokiet/ui/color_palette.slint b/krokiet/ui/color_palette.slint index c448c20b7..671c77a90 100644 --- a/krokiet/ui/color_palette.slint +++ b/krokiet/ui/color_palette.slint @@ -2,14 +2,12 @@ import { StyleMetrics } from "std-widgets.slint"; export global ColorPalette { // Tabs at left side - in-out property tab_selected_color: StyleMetrics.dark-color-scheme ? #353535 : #5e5e5e; - in-out property tab_hovered_color: StyleMetrics.dark-color-scheme ? #49494926 : #80808014; - + in-out property tab_selected_color: StyleMetrics.dark-color-scheme ? #353535 : #5e5e5e; + in-out property tab_hovered_color: StyleMetrics.dark-color-scheme ? #49494926 : #80808014; // ListView - in-out property list_view_normal_color: StyleMetrics.dark-color-scheme ? #222222 : #dddddd; - in-out property list_view_normal_header_color: StyleMetrics.dark-color-scheme ? #111111 : #888888; - in-out property list_view_normal_selected_header: StyleMetrics.dark-color-scheme ? #444444 : #cccccc; - + in-out property list_view_normal_color: StyleMetrics.dark-color-scheme ? #222222 : #dddddd; + in-out property list_view_normal_header_color: StyleMetrics.dark-color-scheme ? #111111 : #888888; + in-out property list_view_normal_selected_header: StyleMetrics.dark-color-scheme ? #444444 : #cccccc; // Popup - in-out property popup_background: StyleMetrics.dark-color-scheme ? #353535 : #5e5e5e; -} \ No newline at end of file + in-out property popup_background: StyleMetrics.dark-color-scheme ? #353535 : #5e5e5e; +} diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index 75a5dc315..8b9dac2a8 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -7,50 +7,47 @@ component TabItem { in-out property active-tab; in property text; in property curr_tab; - Rectangle { width: parent.width; horizontal-stretch: 1.0; background: touch-area.has-hover ? ColorPalette.tab-hovered-color : transparent; - - touch_area:= TouchArea { + touch_area := TouchArea { clicked => { if (root.active-tab == root.curr-tab) { return; } - root.active-tab = root.curr-tab; } } } + HorizontalLayout { width: parent.width; alignment: LayoutAlignment.end; layout_rectangle := VerticalLayout { - empty_rectangle := Rectangle { + empty_rectangle := Rectangle { } - } current_rectangle := Rectangle { visible: (root.active-tab == root.curr-tab); border-radius: 2px; width: 5px; height: 0px; background: ColorPalette.tab_selected_color; - animate height { + animate height{ duration: 150ms; - easing: ease; + easing: ease; } } - empty_rectangle2 := Rectangle { - - } + empty_rectangle2 := Rectangle { } } } + Text { text: root.text; width: parent.width; horizontal-alignment: center; } + states [ is-selected when root.active-tab == root.curr-tab: { current_rectangle.height: layout_rectangle.height; @@ -65,7 +62,6 @@ export component LeftSidePanel { in-out property active-tab; in-out property scanning; width: 120px; - VerticalLayout { spacing: 20px; Rectangle { @@ -75,6 +71,7 @@ export component LeftSidePanel { source: @image-url("../icons/logo.png"); } } + VerticalLayout { // spacing: 3px; alignment: center; @@ -86,6 +83,7 @@ export component LeftSidePanel { active-tab <=> root.active-tab; curr_tab: CurrentTab.EmptyFolders; } + TabItem { height: parent.element-size; scanning: scanning; @@ -93,6 +91,7 @@ export component LeftSidePanel { active-tab <=> root.active-tab; curr_tab: CurrentTab.EmptyFiles; } + TabItem { height: parent.element-size; scanning: scanning; @@ -101,6 +100,7 @@ export component LeftSidePanel { curr_tab: CurrentTab.SimilarImages; } } + HorizontalLayout { height: 20px; alignment: end; @@ -110,4 +110,4 @@ export component LeftSidePanel { } } } -} \ No newline at end of file +} diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 34e50b592..a83285fb5 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -7,45 +7,46 @@ import {MainListModel} from "common.slint"; export component MainList { callback item_opened(string); in-out property active-tab; - in-out property <[MainListModel]> empty_folder_model; in-out property <[MainListModel]> empty_files_model; in-out property <[MainListModel]> similar_images_model; - -// TODO - using root.active-tab in visible property will not clear model + // TODO - using root.active-tab in visible property will not clear model if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { min-width: 200px; - columns: ["Selection", "Folder Name", "Path"]; last-column: "Modification Date"; column-sizes: [35px, 100px, 350px, 300px]; values <=> empty-folder-model; parentPathIdx: 2; fileNameIdx: 1; - item_opened(item) => {item_opened(item)} + item_opened(item) => { + item_opened(item) + } } - + if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { min-width: 200px; - columns: ["Selection", "File Name", "Path"]; last-column: "Modification Date"; column-sizes: [35px, 100px, 350px, 100px]; values <=> empty-files-model; parentPathIdx: 2; fileNameIdx: 1; - item_opened(item) => {item_opened(item)} + item_opened(item) => { + item_opened(item) + } } if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { min-width: 200px; - columns: ["Selection", "File Name", "Path"]; last-column: "Modification Date"; column-sizes: [35px, 100px, 350px, 100px]; values <=> similar-images-model; parentPathIdx: 2; fileNameIdx: 1; - item_opened(item) => {item_opened(item)} + item_opened(item) => { + item_opened(item) + } } -} \ No newline at end of file +} diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index 1465c31a4..2ff9c4d3c 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -19,22 +19,18 @@ export component MainWindow inherits Window { callback scan_starting(CurrentTab); callback item_opened(string); callback folder-choose-requested(bool); - callback scan_ended(string); - min-width: 300px; preferred-width: 800px; min-height: 300px; preferred-height: 600px; - in-out property stop_requested: false; in-out property scanning: false; - in-out property progress_datas : { + in-out property progress_datas: { current_progress: 15, all_progress: 20, step_name: "Cache", }; - in-out property active-tab: CurrentTab.EmptyFolders; in-out property <[MainListModel]> empty_folder_model: [ {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , @@ -44,12 +40,10 @@ export component MainWindow inherits Window { ]; in-out property <[MainListModel]> empty_files_model: []; in-out property <[MainListModel]> similar_images_model: []; - VerticalBox { HorizontalBox { vertical-stretch: 1.0; preferred-height: 300px; - LeftSidePanel { horizontal-stretch: 0.0; scanning <=> root.scanning; @@ -65,20 +59,26 @@ export component MainWindow inherits Window { empty_files_model <=> root.empty_files_model; similar_images_model <=> root.similar_images_model; - item_opened(item) => {item_opened(item)} + item_opened(item) => { + item_opened(item) + } } - if root.scanning: Progress { + + if root.scanning: Progress { horizontal-stretch: 0.0; progress_datas <=> root.progress_datas; } } } + action_buttons := ActionButtons { vertical-stretch: 0.0; scanning <=> root.scanning; active-tab <=> root.active-tab; stop_requested <=> root.stop-requested; - deleted => {root.deleted();} + deleted => { + root.deleted(); + } scan_stopping => { text_summary.text = "Stopping scan, please wait..."; root.scan_stopping(); @@ -88,15 +88,20 @@ export component MainWindow inherits Window { root.scan_starting(item); } } + text_summary := LineEdit { read-only: true; } + bottom_panel := BottomPanel { - property included-directories; // TODO why cannot set popup_item property? Strange limitation + property included-directories; + // TODO why cannot set popup_item property? Strange limitation bottom-panel-visibility <=> action_buttons.bottom-panel-visibility; vertical-stretch: 0.0; - folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)} + folder-choose-requested(included-directories) => { + root.folder-choose-requested(included-directories) + } show_manual_add_dialog(included-directories) => { self.included-directories = included-directories; popup-item.show() @@ -107,12 +112,9 @@ export component MainWindow inherits Window { popup_item := PopupWindow { height: root.height; width: root.width; - property included_directories; private property text_data; - close-on-click: false; - HorizontalLayout { alignment: LayoutAlignment.center; VerticalLayout { @@ -128,10 +130,12 @@ export component MainWindow inherits Window { text: "Please add directories one per line"; horizontal-alignment: TextHorizontalAlignment.center; } + TextEdit { vertical-stretch: 1.0; text <=> text-data; } + HorizontalLayout { min-height: 20px; Button { @@ -142,6 +146,7 @@ export component MainWindow inherits Window { popup-item.close(); } } + Button { text: "Cancel"; clicked => { @@ -153,7 +158,6 @@ export component MainWindow inherits Window { } } } - } scan_ended(scan_text) => { diff --git a/krokiet/ui/progress.slint b/krokiet/ui/progress.slint index e16cbb6d9..6d09e4a73 100644 --- a/krokiet/ui/progress.slint +++ b/krokiet/ui/progress.slint @@ -9,12 +9,12 @@ export component Progress { in-out property progress_datas; preferred-width: 400px; preferred-height: 40px; - VerticalLayout { Text { text: progress-datas.step-name; horizontal-alignment: TextHorizontalAlignment.center; } + HorizontalLayout { spacing: 5px; VerticalLayout { @@ -23,11 +23,13 @@ export component Progress { vertical-alignment: TextVerticalAlignment.center; text: "Current Stage:"; } + Text { vertical-alignment: TextVerticalAlignment.center; text: "All Stages:"; } } + VerticalLayout { spacing: 5px; VerticalLayout { @@ -38,25 +40,28 @@ export component Progress { progress: progress_datas.current-progress / 100.0; } } + VerticalLayout { alignment: LayoutAlignment.center; ProgressIndicator { height: 8px; - progress: progress_datas.all-progress / 100.0; + progress: progress_datas.all-progress / 100.0; } } } + VerticalLayout { spacing: 5px; Text { vertical-alignment: TextVerticalAlignment.center; - text: progress_datas.current-progress + "%"; + text: progress_datas.current-progress + "%"; } + Text { vertical-alignment: TextVerticalAlignment.center; - text: progress_datas.all-progress + "%"; + text: progress_datas.all-progress + "%"; } } } } -} \ No newline at end of file +} diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index fc119852c..652e16672 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -6,23 +6,17 @@ import {MainListModel} from "common.slint"; export component SelectableTableView inherits Rectangle { callback item_opened(string); - in property <[string]> columns; in property last_column; in-out property <[MainListModel]> values; - in-out property <[length]> column_sizes; - private property <[length]> real_sizes: [0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px,0px]; + private property <[length]> real_sizes: [0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px]; private property column_number: column-sizes.length + 1; - // This idx, starts from zero, but since first is always a checkbox, and is not in model.val values, remove 1 from idx in-out property parentPathIdx; in-out property fileNameIdx; - in-out property selected_item: -1; - forward-focus: focus_item; - // TODO not works focus_item := FocusScope { key-released(event) => { @@ -35,18 +29,20 @@ export component SelectableTableView inherits Rectangle { padding: 5px; forward-focus: focus-item; HorizontalLayout { - padding: 5px; + padding: 5px; spacing: 5px; vertical-stretch: 0; - for title[idx] in root.columns : HorizontalLayout { + for title [idx] in root.columns: HorizontalLayout { width: root.column-sizes[idx]; + Text { + overflow: elide; + text: title; + } - Text { overflow: elide; text: title; } Rectangle { width: 1px; background: gray; forward-focus: focus-item; - TouchArea { width: 5px; x: (parent.width - self.width) / 2; @@ -69,18 +65,22 @@ export component SelectableTableView inherits Rectangle { } } } - Text { overflow: elide; text: last-column; } + + Text { + overflow: elide; + text: last-column; + } } + list_view := ListView { min-width: 100px; forward-focus: focus-item; - - for r[idx] in root.values : Rectangle { + for r [idx] in root.values: Rectangle { border-radius: 5px; forward-focus: focus-item; height: 20px; - background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header: ColorPalette.list_view_normal_color)); - touch_area:= TouchArea { + background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color)); + touch_area := TouchArea { forward-focus: focus-item; clicked => { if (!r.header_row) { @@ -109,7 +109,6 @@ export component SelectableTableView inherits Rectangle { HorizontalLayout { forward-focus: focus-item; - CheckBox { visible: !r.header-row; checked: r.checked && !r.header-row; @@ -122,14 +121,12 @@ export component SelectableTableView inherits Rectangle { HorizontalLayout { spacing: 5px; - for f[idx] in r.val : Text { + for f [idx] in r.val: Text { width: root.column-sizes[idx + 1]; text: f; font-size: 12px; forward-focus: focus-item; - vertical-alignment: center; - overflow: elide; } } @@ -137,4 +134,4 @@ export component SelectableTableView inherits Rectangle { } } } -} \ No newline at end of file +} diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index f95a6b7a8..c9d8660fc 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -1,6 +1,5 @@ -export global Settings { +export global Settings { in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}]; in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}]; - in-out property info_text: "Nothing to report"; -} \ No newline at end of file +} From 49871e433ce31656a448da54029af68a048d2976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 10 Nov 2023 20:19:35 +0100 Subject: [PATCH 044/107] 1.3.0 --- Cargo.lock | 124 +++++++++++++++++++++++++-------------------- krokiet/Cargo.toml | 18 +++---- krokiet/README.md | 79 +++++++++++++++++++++++------ 3 files changed, 138 insertions(+), 83 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9ac55ca4..5db9451f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,19 +231,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "async-channel" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37875bd9915b7d67c2f117ea2c30a0989874d0b2cb694fe25403c85763c0c9e" -dependencies = [ - "concurrent-queue", - "event-listener 3.0.1", - "event-listener-strategy", - "futures-core", - "pin-project-lite", -] - [[package]] name = "async-executor" version = "1.6.0" @@ -276,7 +263,7 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ - "async-channel 1.9.0", + "async-channel", "async-executor", "async-io 1.13.0", "async-lock 2.8.0", @@ -397,7 +384,7 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ - "async-channel 1.9.0", + "async-channel", "async-global-executor", "async-io 1.13.0", "async-lock 2.8.0", @@ -606,16 +593,16 @@ dependencies = [ [[package]] name = "blocking" -version = "1.5.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "864b30e660d766b7e9b47347d9b6558a17f1cfa22274034fa6f55b274b3e4620" +checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" dependencies = [ - "async-channel 2.1.0", - "async-lock 3.0.0", + "async-channel", + "async-lock 2.8.0", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite 2.0.1", + "futures-lite 1.13.0", "piper", "tracing", ] @@ -1014,7 +1001,8 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6304465f16f463cddc572b737c3df93576edd3a6b53f057bd8beeb29f4ef8dfd" dependencies = [ "const-field-offset-macro", "field-offset", @@ -1023,7 +1011,8 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57aaaad9185d3bcb3afe63549d8ba60b2fb0ea8dc2da83f62dd56805edf56fd1" dependencies = [ "proc-macro2", "quote", @@ -1646,9 +1635,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" dependencies = [ "libc", "windows-sys 0.48.0", @@ -2241,9 +2230,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "js-sys", @@ -2673,7 +2662,8 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8955a5385270c9a8d76530e872a397eb6717bd1020f16c09c7f9c7fc1a59cd39" dependencies = [ "calloop 0.11.0", "drm", @@ -2694,7 +2684,8 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "059bb78add36aaa9cc1a4f7e5978f47e5ec1ece31ca281451cc646ef3a7e4d85" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2707,7 +2698,8 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8992e2356a2331502261987d2a6803e798bf7a2a5272907713c08f46a7ad0652" dependencies = [ "bytemuck", "cfg-if", @@ -2742,7 +2734,8 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "181a597710932e4ba09cd29fed3d479587fe33d3c880b0addd5421dbed4940bd" dependencies = [ "cfg-if", "derive_more", @@ -2753,7 +2746,8 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0020485613a80b6dfe86a46f93c946b8382045ccbb29f7b9faf20725658fc7f0" dependencies = [ "by_address", "codemap", @@ -2782,7 +2776,8 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "408aa4fe8a28ae7284d18d0b35612fe172c096392dc429342e3626926c70e595" dependencies = [ "auto_enums", "bytemuck", @@ -2825,7 +2820,8 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d582a1644a5d818ee813f393490a5b2496936ef3962b62ff077e42a81626ef" dependencies = [ "quote", "syn 2.0.39", @@ -2834,7 +2830,8 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbc056f6daab6224bb55a55751456ab2897a41ade84ca7772001a1cff46a6b26" dependencies = [ "cfg-if", "const-field-offset", @@ -2866,7 +2863,8 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82c4893627aa07956397bc997b4bcb83a22e1b364f8109be72505168837e2eb7" dependencies = [ "ash", "bytemuck", @@ -2909,7 +2907,7 @@ dependencies = [ "serde", "serde_derive", "thiserror", - "toml 0.8.6", + "toml 0.8.8", "unic-langid", ] @@ -3497,9 +3495,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "locale_config" @@ -4786,7 +4784,7 @@ dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys 0.4.10", + "linux-raw-sys 0.4.11", "windows-sys 0.48.0", ] @@ -4920,18 +4918,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.191" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a834c4821019838224821468552240d4d95d14e751986442c816572d39a080c9" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.191" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fa52d5646bce91b680189fe5b1c049d2ea38dabb4e2e7c8d00ca12cfbfbcfd" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -5062,7 +5060,7 @@ dependencies = [ "regex", "serde_json", "tar", - "toml 0.8.6", + "toml 0.8.8", "ureq", ] @@ -5091,7 +5089,8 @@ dependencies = [ [[package]] name = "slint" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9d589a30c2812877798eecf2b5cb51e7f2c4531f7c9e8746be6b25a24f37e6" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5107,7 +5106,8 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2edbdfb7bdb1688273656c301ffa221a3939869620e7a12f02d7cae6532098ee" dependencies = [ "i-slint-compiler", "spin_on", @@ -5118,7 +5118,8 @@ dependencies = [ [[package]] name = "slint-macros" version = "1.3.0" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee1b8b49389eb768793499fce1c60d613ac52d14fe77383a65f233327cd65715" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -5137,9 +5138,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "smithay-client-toolkit" @@ -5571,7 +5572,7 @@ dependencies = [ "cfg-expr", "heck", "pkg-config", - "toml 0.8.6", + "toml 0.8.8", "version-compare", ] @@ -5790,14 +5791,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff9e3abce27ee2c9a37f9ad37238c1bdd4e789c84ba37df76aa4d528f5072cc" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.7", + "toml_edit 0.21.0", ] [[package]] @@ -5825,6 +5826,17 @@ name = "toml_edit" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap 2.1.0", "serde", @@ -6252,7 +6264,8 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f4c7506238561777a1861d3dc3c0001877c475187e7bc4392ea87ebf631fd9c" dependencies = [ "const-field-offset", "portable-atomic", @@ -6263,7 +6276,8 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#2acaa222d0aa8c3787f6cd700d0c76768b9612ed" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b2b8eecdb8e4284adf5546fc518f048f6dc33e7203dbe36fa93a4add39b31f6" dependencies = [ "proc-macro2", "quote", diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index 8bffa6e52..fd88895dd 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -11,20 +11,14 @@ repository = "https://github.com/qarmin/czkawka" build = "build.rs" [dependencies] -#slint = "1.2.2" -#slint = { git = "https://github.com/slint-ui/slint.git"} - # Try to use only needed features from https://github.com/slint-ui/slint/blob/master/api/rs/slint/Cargo.toml#L23-L31 -slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = ["std", +#slint = { path = "/home/rafal/test/slint/api/rs/slint/", default-features = false, features = ["std", +#slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = [ +slint = { version = "1.3.0", default-features = false, features = [ + "std", "backend-winit", -# "accessibility", "compat-1-2" ] } -#slint = { path = "/home/rafal/test/slint/api/rs/slint/", default-features = false, features = ["std", -# "backend-winit", -# "accessibility", -# "compat-1-2" -#] } rand = "0.8.5" czkawka_core = { version = "6.1.0", path = "../czkawka_core" } @@ -39,8 +33,8 @@ serde = "1.0" serde_json = "1.0" [build-dependencies] -#slint-build = "1.2.2" -slint-build = { git = "https://github.com/slint-ui/slint.git" } +slint-build = "1.3.0" +#slint-build = { git = "https://github.com/slint-ui/slint.git" } #slint-build = { path = "/home/rafal/test/slint/api/rs/build/"} [features] diff --git a/krokiet/README.md b/krokiet/README.md index b8ef78d25..3dd444749 100644 --- a/krokiet/README.md +++ b/krokiet/README.md @@ -1,16 +1,21 @@ # Krokiet -Krokiet is new Czkawka frontend written in Slint(written mostly in Rust) in opposite to Gtk 4 frontend which uses mostly C code. +Krokiet is new Czkawka frontend written in Slint(written mostly in Rust) in opposite to Gtk 4 frontend which uses mostly +C code. -Different toolkit means different look, limitations and features, so you should not expect same features like in Gtk 4 frontend. +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). ## Requirements + Krokiet should not have any special runtime requirements - it should work on almost any OpenGL ES 2 capable device. -Alternatively, it can be run with software rendering. +Alternatively, it can be run with software rendering on computers that don't have graphics card. ## Compilation + On Ubuntu you need to install this dependencies: + ``` sudo apt install libfontconfig-dev libfreetype-dev ``` @@ -20,48 +25,66 @@ Default compilation is done by `cargo build --release` and should work on most s You need the latest available version of Rust to compile it, because Krokiet aims to support the latest slint verions, that should provide best experience(fixed more bugs/new features). -The only exception is building non default skia renderer, that require on windows msvc compiler(not sure how to exactly install it). +The only exception is building non default skia renderer, that require on windows msvc compiler(not sure how to exactly +install it). -Also skia renderer is written in C++ and uses on platforms like x86_64 and arm64 prebuild binaries, so if you are using different architecture, this library will be build from source, which can take a lot of time and require additional dependencies. +Also skia renderer is written in C++ and uses on platforms like x86_64 and arm64 prebuild binaries, so if you are using +different architecture, this library will be build from source, which can take a lot of time and require additional +dependencies. ## Additional Renderers -By default, only femtovg(opengl) and software renderer are enabled, but you can enable more renderers by compiling app with additional features. -Most of the users will want to use app with windowing system/compositor, so features starting with `winit` in name are recommended. +By default, only femtovg(opengl) and software renderer are enabled, but you can enable more renderers by compiling app +with additional features. + +Most of the users will want to use app with windowing system/compositor, so features starting with `winit` in name are +recommended. + +E.g. -E.g. ``` cargo build --release --features "winit_skia_opengl" cargo build --release --features "winit_software" ``` to run app with different renderers you need to use it, by adding `SLINT_BACKEND` environment + ``` SLINT_BACKEND=winit-femtovg ./target/release/krokiet SLINT_BACKEND=software ./target/release/krokiet SLINT_BACKEND=skia ./target/release/krokiet # This uses now opengl - https://github.com/slint-ui/slint/discussions/3799 ``` + when you will use invalid/non-existing backend, app will show warning + ``` slint winit: unrecognized renderer skia, falling back to FemtoVG ``` + to check what is really used, add `SLINT_DEBUG_PERFORMANCE=refresh_lazy,console,overlay` env + ``` SLINT_DEBUG_PERFORMANCE=refresh_lazy,console,overlay cargo run ``` + should print something like + ``` Slint: Build config: debug; Backend: software ``` ## Dark/Different theme -App was created with white fluent theme by default, but is easily possible to use dark theme by setting `SLINT_STYLE` environment variable to `fluent-dark` during compilation -e.g. + +App was created with white fluent theme by default, but is easily possible to use dark theme by setting `SLINT_STYLE` +environment variable to `fluent-dark` during compilation +e.g. + ``` SLINT_STYLE=fluent-dark cargo run -- --path . ``` Slint supports also other themes, but they are not officially supported by this app and may be broken. + ``` SLINT_STYLE=cupertino-light cargo run -- --path . SLINT_STYLE=cupertino-dark cargo run -- --path . @@ -70,12 +93,28 @@ SLINT_STYLE=material-dark cargo run -- --path . ``` ## How to help? -- Suggesting possible design changes in the gui - of course, they should be possible to be simply implemented in the slint keeping in mind the performance aspect as well -- Modifying user interface - gui is written in simple language similar to qml - [slint live preview example](https://slint.dev/releases/1.2.2/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) + +- Suggesting possible design changes in the gui - of course, they should be possible to be simply implemented in the + slint keeping in mind the performance aspect as well +- Modifying user interface - gui is written in simple language similar to qml, that can be modified in vscode/web with + live preview - [slint live preview example](https://slint.dev/releases/1.2.2/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) - Improving libraries used by Krokiet e.g. czkawka_core, image-rs etc. - Improving app rust code +## Missing features available in GTK 4 frontend + +- preview support +- selecting/deselecting results +- icons in buttons +- resizable input files panel +- settings +- moving files +- deleting files +- implementing all modes +- multiple languages + ## Why Slint? + There are multiple reasons why I decided to use Slint as toolkit for Krokiet over other toolkits. | Toolkit | Pros | Cons | @@ -86,14 +125,22 @@ There are multiple reasons why I decided to use Slint as toolkit for Krokiet ove | 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) and this is also
- 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
- Cannot select directory - file chooser only can choose files - small thing but important for me
- Not very performant Rust <=> Javascript communication | -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 to not look at Iced which only allows to create GUI from Rust. +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 +to not look at Iced which only allows to create GUI from Rust. GTK and QT also I throw away due cross compilation problems caused mostly by using C/C++ internally. -Tauri - I don't really like to use Javascript because I already used it with Qt(C++) + QML + Typescript combination and I found that creating ui in such language may be simple at start but later any bigger changes cause a lot of runtime errors. +Tauri - I don't really like to use Javascript because I already used it with Qt(C++) + QML + Typescript combination and +I found that creating ui in such language may be simple at start but later any bigger changes cause a lot of runtime +errors. -So only Slint left. +So only Slint left with its cons and pros. ## Name + Why Krokiet(eng. Croquette)? -Because I like croquettes, the ones with meat, mushrooms wrapped in breadcrumbs... it makes my mouth water. \ No newline at end of file +Because I like croquettes(Polish version), the ones with meat, mushrooms wrapped in breadcrumbs... it makes my mouth +water. +I considered also other dishes which I like to eat like pierogi, żurek, pączek, schabowy or zapiekanka. +This name should be a lot of easier to remember than Czkawka. \ No newline at end of file From 922502515776437a9add23fdb2c524ec7ab42b6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 11 Nov 2023 07:47:52 +0100 Subject: [PATCH 045/107] Default dark theme --- Changelog.md | 8 +++++--- czkawka_gui/README.md | 0 krokiet/README.md | 10 +++++++++- krokiet/build.rs | 8 +++++++- 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 czkawka_gui/README.md diff --git a/Changelog.md b/Changelog.md index 7cb286655..c2b54884f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,12 +1,14 @@ ## Version 7.0.0 - ? ### GTK GUI +- Added drag&drop support for included/excluded folders - [#1102](https://github.com/qarmin/czkawka/pull/1102) ### CLI -### Slawka GUI - -### Core(all modes) +### Krokiet GUI +- Initial release of new gui - [#1102](https://github.com/qarmin/czkawka/pull/1102) +### Core +- Using normal crossbeam channels instead of asyncio tokio channel - [#1102](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/czkawka_gui/README.md b/czkawka_gui/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/krokiet/README.md b/krokiet/README.md index 3dd444749..f90ea89bb 100644 --- a/krokiet/README.md +++ b/krokiet/README.md @@ -97,7 +97,7 @@ SLINT_STYLE=material-dark cargo run -- --path . - Suggesting possible design changes in the gui - of course, they should be possible to be simply implemented in the slint keeping in mind the performance aspect as well - Modifying user interface - gui is written in simple language similar to qml, that can be modified in vscode/web with - live preview - [slint live preview example](https://slint.dev/releases/1.2.2/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) + live preview - [slint live preview example](https://slint.dev/releases/1.3.0/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) - Improving libraries used by Krokiet e.g. czkawka_core, image-rs etc. - Improving app rust code @@ -110,8 +110,16 @@ SLINT_STYLE=material-dark cargo run -- --path . - settings - moving files - deleting files +- sorting files +- saving results +- symlink/hardlink - implementing all modes - multiple languages +- multiple selection +- key selection support +- proper popup windows - slint not handle them properly +- logo +- about window ## Why Slint? diff --git a/krokiet/build.rs b/krokiet/build.rs index 2f05231bb..87696d68a 100644 --- a/krokiet/build.rs +++ b/krokiet/build.rs @@ -1,3 +1,9 @@ +use std::env; + fn main() { - slint_build::compile("ui/main_window.slint").unwrap(); + if env::var("SLINT_STYLE").is_err() || env::var("SLINT_STYLE") == Ok("".into()) { + slint_build::compile_with_config("ui/main_window.slint", slint_build::CompilerConfiguration::new().with_style("fluent-dark".into())).unwrap(); + } else { + slint_build::compile("ui/main_window.slint").unwrap(); + } } From b67a98f8ca6368bb195e7457b778d3a85405c93a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 11 Nov 2023 19:10:07 +0100 Subject: [PATCH 046/107] Similar images and proper tool type --- Cargo.lock | 1 + Changelog.md | 1 + czkawka_core/src/bad_extensions.rs | 1 + czkawka_core/src/common.rs | 1 + czkawka_core/src/common_dir_traversal.rs | 4 +- czkawka_core/src/duplicate.rs | 3 + czkawka_core/src/empty_files.rs | 1 + czkawka_core/src/empty_folder.rs | 1 + czkawka_core/src/invalid_symlinks.rs | 1 + czkawka_core/src/same_music.rs | 1 + czkawka_core/src/similar_images.rs | 2 +- krokiet/Cargo.toml | 1 + krokiet/LICENSE_MIT_CODE | 21 +++++++ krokiet/README.md | 19 ++++--- krokiet/build.rs | 2 +- krokiet/src/common.rs | 4 ++ krokiet/src/connect_progress_receiver.rs | 71 ++++++++++++++++++++---- krokiet/src/connect_scan.rs | 65 +++++++++++++++++++++- krokiet/ui/bottom_panel.slint | 1 + krokiet/ui/main_lists.slint | 8 +-- krokiet/ui/progress.slint | 1 + 21 files changed, 184 insertions(+), 26 deletions(-) create mode 100644 krokiet/LICENSE_MIT_CODE diff --git a/Cargo.lock b/Cargo.lock index 5db9451f6..ecf34ab16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3316,6 +3316,7 @@ dependencies = [ "czkawka_core", "handsome_logger", "home", + "humansize", "log", "open", "rand", diff --git a/Changelog.md b/Changelog.md index c2b54884f..f75055d90 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ ### Core - Using normal crossbeam channels instead of asyncio tokio channel - [#1102](https://github.com/qarmin/czkawka/pull/1102) +- Fixed tool type when using progress of empty directories ## 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/czkawka_core/src/bad_extensions.rs b/czkawka_core/src/bad_extensions.rs index 0e2c4e03f..2b30b4d2e 100644 --- a/czkawka_core/src/bad_extensions.rs +++ b/czkawka_core/src/bad_extensions.rs @@ -220,6 +220,7 @@ impl BadExtensions { .allowed_extensions(self.common_data.allowed_extensions.clone()) .excluded_items(self.common_data.excluded_items.clone()) .recursive_search(self.common_data.recursive_search) + .tool_type(self.common_data.tool_type) .build() .run(); diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 7158bdc94..a3f4618af 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -467,6 +467,7 @@ pub fn prepare_thread_handler_common( checking_method: CheckingMethod, tool_type: ToolType, ) -> (JoinHandle<()>, Arc, Arc, AtomicBool) { + assert_ne!(tool_type, ToolType::None, "ToolType::None should not exist"); let progress_thread_run = Arc::new(AtomicBool::new(true)); let atomic_counter = Arc::new(AtomicUsize::new(0)); let check_was_stopped = AtomicBool::new(false); diff --git a/czkawka_core/src/common_dir_traversal.rs b/czkawka_core/src/common_dir_traversal.rs index 65db63377..340a01202 100644 --- a/czkawka_core/src/common_dir_traversal.rs +++ b/czkawka_core/src/common_dir_traversal.rs @@ -187,7 +187,7 @@ impl<'a, 'b> DirTraversalBuilder<'a, 'b, ()> { directories: None, allowed_extensions: None, excluded_items: None, - tool_type: ToolType::BadExtensions, + tool_type: ToolType::None, } } } @@ -341,6 +341,8 @@ where { #[fun_time(message = "run(collecting files/dirs)", level = "debug")] pub fn run(self) -> DirTraversalResult { + assert!(self.tool_type != ToolType::None, "Tool type cannot be None"); + let mut all_warnings = vec![]; let mut grouped_file_entries: BTreeMap> = BTreeMap::new(); let mut folder_entries: BTreeMap = BTreeMap::new(); diff --git a/czkawka_core/src/duplicate.rs b/czkawka_core/src/duplicate.rs index a98a0db60..7946fe909 100644 --- a/czkawka_core/src/duplicate.rs +++ b/czkawka_core/src/duplicate.rs @@ -169,6 +169,7 @@ impl DuplicateFinder { .recursive_search(self.common_data.recursive_search) .minimal_file_size(self.common_data.minimal_file_size) .maximal_file_size(self.common_data.maximal_file_size) + .tool_type(self.common_data.tool_type) .build() .run(); @@ -244,6 +245,7 @@ impl DuplicateFinder { .recursive_search(self.common_data.recursive_search) .minimal_file_size(self.common_data.minimal_file_size) .maximal_file_size(self.common_data.maximal_file_size) + .tool_type(self.common_data.tool_type) .build() .run(); @@ -321,6 +323,7 @@ impl DuplicateFinder { .recursive_search(self.common_data.recursive_search) .minimal_file_size(self.common_data.minimal_file_size) .maximal_file_size(self.common_data.maximal_file_size) + .tool_type(self.common_data.tool_type) .build() .run(); diff --git a/czkawka_core/src/empty_files.rs b/czkawka_core/src/empty_files.rs index 2360b9e1a..372ec0513 100644 --- a/czkawka_core/src/empty_files.rs +++ b/czkawka_core/src/empty_files.rs @@ -63,6 +63,7 @@ impl EmptyFiles { .allowed_extensions(self.common_data.allowed_extensions.clone()) .excluded_items(self.common_data.excluded_items.clone()) .recursive_search(self.common_data.recursive_search) + .tool_type(self.common_data.tool_type) .build() .run(); diff --git a/czkawka_core/src/empty_folder.rs b/czkawka_core/src/empty_folder.rs index 73050f0e1..2d7a09f07 100644 --- a/czkawka_core/src/empty_folder.rs +++ b/czkawka_core/src/empty_folder.rs @@ -83,6 +83,7 @@ impl EmptyFolder { .excluded_items(self.common_data.excluded_items.clone()) .collect(Collect::EmptyFolders) .max_stage(0) + .tool_type(self.common_data.tool_type) .build() .run(); diff --git a/czkawka_core/src/invalid_symlinks.rs b/czkawka_core/src/invalid_symlinks.rs index a3d036b42..574af5684 100644 --- a/czkawka_core/src/invalid_symlinks.rs +++ b/czkawka_core/src/invalid_symlinks.rs @@ -52,6 +52,7 @@ impl InvalidSymlinks { .allowed_extensions(self.common_data.allowed_extensions.clone()) .excluded_items(self.common_data.excluded_items.clone()) .recursive_search(self.common_data.recursive_search) + .tool_type(self.common_data.tool_type) .build() .run(); diff --git a/czkawka_core/src/same_music.rs b/czkawka_core/src/same_music.rs index 178e308c7..89e5fab6c 100644 --- a/czkawka_core/src/same_music.rs +++ b/czkawka_core/src/same_music.rs @@ -203,6 +203,7 @@ impl SameMusic { .allowed_extensions(self.common_data.allowed_extensions.clone()) .excluded_items(self.common_data.excluded_items.clone()) .recursive_search(self.common_data.recursive_search) + .tool_type(self.common_data.tool_type) .max_stage(max_stage) .build() .run(); diff --git a/czkawka_core/src/similar_images.rs b/czkawka_core/src/similar_images.rs index 43a4425fe..2bf403d94 100644 --- a/czkawka_core/src/similar_images.rs +++ b/czkawka_core/src/similar_images.rs @@ -94,7 +94,7 @@ pub struct SimilarImages { // Hashmap with image hashes and Vector with names of files similarity: u32, images_to_check: BTreeMap, - hash_size: u8, + pub hash_size: u8, // TODO to remove pub, this is needeed by new gui, because there is no way to check what exactly was seelected hash_alg: HashAlg, image_filter: FilterType, exclude_images_with_same_size: bool, diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index fd88895dd..98010d177 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -31,6 +31,7 @@ home = "0.5.5" log = "0.4.20" serde = "1.0" serde_json = "1.0" +humansize = "2.1.3" [build-dependencies] slint-build = "1.3.0" diff --git a/krokiet/LICENSE_MIT_CODE b/krokiet/LICENSE_MIT_CODE new file mode 100644 index 000000000..8836e460f --- /dev/null +++ b/krokiet/LICENSE_MIT_CODE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-2023 Rafał Mikrut + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/krokiet/README.md b/krokiet/README.md index f90ea89bb..3408eedb6 100644 --- a/krokiet/README.md +++ b/krokiet/README.md @@ -73,14 +73,13 @@ should print something like Slint: Build config: debug; Backend: software ``` -## Dark/Different theme +## Different theme -App was created with white fluent theme by default, but is easily possible to use dark theme by setting `SLINT_STYLE` -environment variable to `fluent-dark` during compilation -e.g. +App was created with fluent theme in mind, but is possible to use dark theme by setting `SLINT_STYLE` environment +variable to `fluent-dark` during compilation e.g. ``` -SLINT_STYLE=fluent-dark cargo run -- --path . +SLINT_STYLE=fluent-light cargo run -- --path . ``` Slint supports also other themes, but they are not officially supported by this app and may be broken. @@ -97,7 +96,8 @@ SLINT_STYLE=material-dark cargo run -- --path . - Suggesting possible design changes in the gui - of course, they should be possible to be simply implemented in the slint keeping in mind the performance aspect as well - Modifying user interface - gui is written in simple language similar to qml, that can be modified in vscode/web with - live preview - [slint live preview example](https://slint.dev/releases/1.3.0/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) + live + preview - [slint live preview example](https://slint.dev/releases/1.3.0/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) - Improving libraries used by Krokiet e.g. czkawka_core, image-rs etc. - Improving app rust code @@ -120,6 +120,8 @@ SLINT_STYLE=material-dark cargo run -- --path . - proper popup windows - slint not handle them properly - logo - about window +- reference folders +- translations(problem is only with interface, messages like "Checking {x} file" can be easily translated from rust side) ## Why Slint? @@ -145,10 +147,13 @@ errors. So only Slint left with its cons and pros. +## License +Code is licensed under MIT license but entire project is licensed under GPL-3.0 license, due Slint license restrictions. + ## Name Why Krokiet(eng. Croquette)? Because I like croquettes(Polish version), the ones with meat, mushrooms wrapped in breadcrumbs... it makes my mouth water. I considered also other dishes which I like to eat like pierogi, żurek, pączek, schabowy or zapiekanka. -This name should be a lot of easier to remember than Czkawka. \ No newline at end of file +This name should be a lot of easier to remember than czkawka or szyszka. \ No newline at end of file diff --git a/krokiet/build.rs b/krokiet/build.rs index 87696d68a..7f1c72259 100644 --- a/krokiet/build.rs +++ b/krokiet/build.rs @@ -1,7 +1,7 @@ use std::env; fn main() { - if env::var("SLINT_STYLE").is_err() || env::var("SLINT_STYLE") == Ok("".into()) { + if env::var("SLINT_STYLE").is_err() || env::var("SLINT_STYLE") == Ok(String::new()) { slint_build::compile_with_config("ui/main_window.slint", slint_build::CompilerConfiguration::new().with_style("fluent-dark".into())).unwrap(); } else { slint_build::compile("ui/main_window.slint").unwrap(); diff --git a/krokiet/src/common.rs b/krokiet/src/common.rs index 4b4eed750..7444fa915 100644 --- a/krokiet/src/common.rs +++ b/krokiet/src/common.rs @@ -23,3 +23,7 @@ pub fn create_string_standard_list_view_from_pathbuf(items: &[PathBuf]) -> Model .collect::>(); ModelRc::new(VecModel::from(new_folders_standard_list_view)) } + +pub fn create_vec_model_from_vec_string(items: Vec) -> VecModel { + VecModel::from(items.into_iter().map(SharedString::from).collect::>()) +} diff --git a/krokiet/src/connect_progress_receiver.rs b/krokiet/src/connect_progress_receiver.rs index 0064d95c9..24d32fdb6 100644 --- a/krokiet/src/connect_progress_receiver.rs +++ b/krokiet/src/connect_progress_receiver.rs @@ -1,7 +1,7 @@ use crate::{MainWindow, ProgressToSend}; use crossbeam_channel::Receiver; -use czkawka_core::common_dir_traversal::ProgressData; +use czkawka_core::common_dir_traversal::{ProgressData, ToolType}; use slint::{ComponentHandle, SharedString}; use std::thread; @@ -14,29 +14,80 @@ pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver< }; a.upgrade_in_event_loop(move |app| { - let (all_stages, current_stage) = common_get_data(&progress_data); - let to_send = ProgressToSend { - all_progress: (all_stages * 100.0) as i32, - current_progress: (current_stage * 100.0) as i32, - step_name: SharedString::from(format!("Checked {} folders", progress_data.entries_checked)), - }; + let to_send; + match progress_data.tool_type { + ToolType::EmptyFiles => { + let (all_progress, current_progress) = no_current_stage_get_data(&progress_data); + to_send = ProgressToSend { + all_progress, + current_progress, + step_name: SharedString::from(format!("Checked {} files", progress_data.entries_checked)), + }; + } + ToolType::EmptyFolders => { + let (all_progress, current_progress) = no_current_stage_get_data(&progress_data); + to_send = ProgressToSend { + all_progress, + current_progress, + step_name: SharedString::from(format!("Checked {} folders", progress_data.entries_checked)), + }; + } + ToolType::SimilarImages => { + let step_name; + let all_progress; + let current_progress; + match progress_data.current_stage { + 0 => { + (all_progress, current_progress) = no_current_stage_get_data(&progress_data); + step_name = format!("Scanning {} file", progress_data.entries_checked); + } + 1 => { + (all_progress, current_progress) = common_get_data(&progress_data); + step_name = format!("Hashing {}/{} image", progress_data.entries_checked, progress_data.entries_to_check); + } + 2 => { + (all_progress, current_progress) = common_get_data(&progress_data); + step_name = format!("Comparing {}/{} image hash", progress_data.entries_checked, progress_data.entries_to_check); + } + _ => panic!(), + } + to_send = ProgressToSend { + all_progress, + current_progress, + step_name: SharedString::from(step_name), + }; + } + _ => { + panic!("Invalid tool type {:?}", progress_data.tool_type); + } + } app.set_progress_datas(to_send); }) .unwrap(); }); } -fn common_get_data(item: &ProgressData) -> (f64, f64) { + +// Used when current stage not have enough data to show status, so we show only all_stages +// Happens if we searching files and we don't know how many files we need to check +fn no_current_stage_get_data(item: &ProgressData) -> (i32, i32) { + let all_stages = (item.current_stage as f64) / (item.max_stage + 1) as f64; + + ((all_stages * 100.0) as i32, -1) +} + +// Used to calculate number of files to check and also to calculate current progress according to number of files to check and checked +fn common_get_data(item: &ProgressData) -> (i32, i32) { if item.entries_to_check != 0 { let all_stages = (item.current_stage as f64 + (item.entries_checked) as f64 / item.entries_to_check as f64) / (item.max_stage + 1) as f64; let all_stages = if all_stages > 0.99 { 0.99 } else { all_stages }; let current_stage = (item.entries_checked) as f64 / item.entries_to_check as f64; let current_stage = if current_stage > 0.99 { 0.99 } else { current_stage }; - (all_stages, current_stage) + ((all_stages * 100.0) as i32, (current_stage * 100.0) as i32) } else { let all_stages = (item.current_stage as f64) / (item.max_stage + 1) as f64; let all_stages = if all_stages > 0.99 { 0.99 } else { all_stages }; - (all_stages, 0f64) + ((all_stages * 100.0) as i32, 0) } } diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 226cbdc1f..9f0594690 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -1,3 +1,4 @@ +use crate::common::create_vec_model_from_vec_string; use crate::settings::{collect_settings, SettingsCustom}; use crate::Settings; use crate::{CurrentTab, MainListModel, MainWindow, ProgressToSend}; @@ -9,6 +10,10 @@ use czkawka_core::common_tool::CommonData; use czkawka_core::common_traits::ResultEntry; use czkawka_core::empty_files::EmptyFiles; use czkawka_core::empty_folder::EmptyFolder; +use czkawka_core::similar_images; +use czkawka_core::similar_images::SimilarImages; +use humansize::format_size; +use humansize::BINARY; use slint::{ComponentHandle, ModelRc, SharedString, VecModel, Weak}; use std::path::PathBuf; use std::rc::Rc; @@ -23,7 +28,7 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender { scan_empty_files(a, progress_sender, stop_receiver, custom_settings); } - _ => panic!(), + CurrentTab::SimilarImages => { + scan_similar_images(a, progress_sender, stop_receiver, custom_settings); + } // _ => panic!(), } }); } +// TODO handle referenced folders +fn scan_similar_images(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>, custom_settings: SettingsCustom) { + thread::spawn(move || { + let mut finder = SimilarImages::new(); + finder.set_included_directory(custom_settings.included_directories.clone()); + finder.set_excluded_directory(custom_settings.excluded_directories.clone()); + finder.find_similar_images(Some(&stop_receiver), Some(&progress_sender)); + + let mut vector = finder.get_similar_images().clone(); + let messages = finder.get_text_messages().create_messages_text(); + + for vec_fe in &mut vector { + vec_fe.sort_unstable_by_key(|e| e.similarity); + } + + let hash_size = finder.hash_size; + + a.upgrade_in_event_loop(move |app| { + let number_of_empty_files = vector.len(); + let items = Rc::new(VecModel::default()); + for vec_fe in vector { + items.push(MainListModel { + checked: false, + header_row: true, + selected_row: false, + val: ModelRc::new(VecModel::default()), + }); + for fe in vec_fe { + let (directory, file) = split_path(fe.get_path()); + let data_model = create_vec_model_from_vec_string(vec![ + similar_images::get_string_from_similarity(&fe.similarity, hash_size), + format_size(fe.size, BINARY), + fe.dimensions.clone(), + file, + directory, + NaiveDateTime::from_timestamp_opt(fe.get_modified_date() as i64, 0).unwrap().to_string(), + ]); + + let main = MainListModel { + checked: false, + header_row: false, + selected_row: false, + val: ModelRc::new(data_model), + }; + items.push(main); + } + } + app.set_similar_images_model(items.into()); + app.invoke_scan_ended(format!("Found {} similar images files", number_of_empty_files).into()); + app.global::().set_info_text(messages.into()); + }) + }); +} + fn scan_empty_files(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>, custom_settings: SettingsCustom) { thread::spawn(move || { let mut finder = EmptyFiles::new(); diff --git a/krokiet/ui/bottom_panel.slint b/krokiet/ui/bottom_panel.slint index 00ce526e4..96b7d65be 100644 --- a/krokiet/ui/bottom_panel.slint +++ b/krokiet/ui/bottom_panel.slint @@ -97,6 +97,7 @@ component DirectoriesPanel { component TextErrorsPanel inherits TextEdit { height: 20px; read-only: true; + wrap: TextWrap.no-wrap; text <=> Settings.info_text; } diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index a83285fb5..15867f4b0 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -39,12 +39,12 @@ export component MainList { if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { min-width: 200px; - columns: ["Selection", "File Name", "Path"]; + columns: ["Selection", "Similarity", "Size", "Dimensions", "File Name", "Path"]; last-column: "Modification Date"; - column-sizes: [35px, 100px, 350px, 100px]; + column-sizes: [35px, 80px, 80px, 80px, 350px, 100px, 100px]; values <=> similar-images-model; - parentPathIdx: 2; - fileNameIdx: 1; + parentPathIdx: 5; + fileNameIdx: 4; item_opened(item) => { item_opened(item) } diff --git a/krokiet/ui/progress.slint b/krokiet/ui/progress.slint index 6d09e4a73..2c874f574 100644 --- a/krokiet/ui/progress.slint +++ b/krokiet/ui/progress.slint @@ -53,6 +53,7 @@ export component Progress { VerticalLayout { spacing: 5px; Text { + visible: progress_datas.current-progress >= -0.001; vertical-alignment: TextVerticalAlignment.center; text: progress_datas.current-progress + "%"; } From ff7cfff90001e73b886b9d818a42ac87bb42dbad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 12 Nov 2023 09:09:15 +0100 Subject: [PATCH 047/107] Simplify opening --- czkawka_core/src/similar_images.rs | 23 +++++ krokiet/src/connect_delete.rs | 4 +- krokiet/src/connect_open.rs | 5 +- krokiet/ui/action_buttons.slint | 4 +- krokiet/ui/bottom_panel.slint | 130 +++++++++++++------------- krokiet/ui/callabler.slint | 6 ++ krokiet/ui/main_lists.slint | 10 -- krokiet/ui/main_window.slint | 15 +-- krokiet/ui/selectable_tree_view.slint | 6 +- 9 files changed, 107 insertions(+), 96 deletions(-) diff --git a/czkawka_core/src/similar_images.rs b/czkawka_core/src/similar_images.rs index 2bf403d94..c3d63ed11 100644 --- a/czkawka_core/src/similar_images.rs +++ b/czkawka_core/src/similar_images.rs @@ -1132,6 +1132,7 @@ mod tests { use std::collections::HashMap; use std::path::PathBuf; + use crate::common_dir_traversal::ToolType; use bk_tree::BKTree; use crate::common_directory::Directories; @@ -1152,6 +1153,10 @@ mod tests { for _ in 0..100 { let mut similar_images = SimilarImages { similarity: 0, + common_data: CommonToolData { + tool_type: ToolType::SimilarImages, + ..Default::default() + }, ..Default::default() }; @@ -1183,6 +1188,10 @@ mod tests { for _ in 0..100 { let mut similar_images = SimilarImages { similarity: 1, + common_data: CommonToolData { + tool_type: ToolType::SimilarImages, + ..Default::default() + }, ..Default::default() }; @@ -1203,6 +1212,7 @@ mod tests { similarity: 2, common_data: CommonToolData { use_reference_folders: false, + tool_type: ToolType::SimilarImages, ..Default::default() }, ..Default::default() @@ -1227,6 +1237,10 @@ mod tests { // for _ in 0..100 { // let mut similar_images = SimilarImages { // similarity: 10, + // common_data: CommonToolData { + // tool_type: ToolType::SimilarImages, + // ..Default::default() + // }, // use_reference_folders: false, // ..Default::default() // }; @@ -1250,6 +1264,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 0, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, directories: Directories { reference_directories: vec![PathBuf::from("/home/rr/")], ..Default::default() @@ -1276,6 +1291,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 0, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, directories: Directories { reference_directories: vec![PathBuf::from("/home/rr/")], ..Default::default() @@ -1303,6 +1319,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 0, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, directories: Directories { reference_directories: vec![PathBuf::from("/home/rr/")], ..Default::default() @@ -1334,6 +1351,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 1, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, use_reference_folders: false, ..Default::default() }, @@ -1358,6 +1376,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 4, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, use_reference_folders: false, ..Default::default() }, @@ -1391,6 +1410,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 1, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, directories: Directories { reference_directories: vec![PathBuf::from("/home/rr/")], ..Default::default() @@ -1421,6 +1441,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 1, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, directories: Directories { reference_directories: vec![PathBuf::from("/home/rr/")], ..Default::default() @@ -1448,6 +1469,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 1, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, directories: Directories { reference_directories: vec![PathBuf::from("/home/rr/")], ..Default::default() @@ -1486,6 +1508,7 @@ mod tests { let mut similar_images = SimilarImages { similarity: 10, common_data: CommonToolData { + tool_type: ToolType::SimilarImages, directories: Directories { reference_directories: vec![PathBuf::from("/home/rr/")], ..Default::default() diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index 4f337a4ee..a385d5955 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -2,12 +2,12 @@ use std::borrow::Borrow; use slint::{ComponentHandle, Model, ModelRc, VecModel}; -use crate::{CurrentTab, MainListModel, MainWindow}; +use crate::{Callabler, CurrentTab, MainListModel, MainWindow}; use log::info; pub fn connect_delete_button(app: &MainWindow) { let a = app.as_weak(); - app.on_deleted(move || { + app.global::().on_delete_selected_items(move || { let app = a.upgrade().unwrap(); let active_tab = app.get_active_tab(); diff --git a/krokiet/src/connect_open.rs b/krokiet/src/connect_open.rs index e53b70d9b..1b98363e6 100644 --- a/krokiet/src/connect_open.rs +++ b/krokiet/src/connect_open.rs @@ -1,7 +1,8 @@ -use crate::MainWindow; +use crate::{Callabler, MainWindow}; +use slint::ComponentHandle; pub fn connect_open_items(app: &MainWindow) { - app.on_item_opened(move |path| { + app.global::().on_item_opened(move |path| { match open::that(&*path) { Ok(()) => {} Err(e) => { diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 5da027be8..48c45368f 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -3,6 +3,7 @@ import {LeftSidePanel} from "left_side_panel.slint"; import {MainList} from "main_lists.slint"; import {CurrentTab} from "common.slint"; import {BottomPanelVisibility} from "common.slint"; +import {Callabler} from "callabler.slint"; export component VisibilityButton inherits Button { in-out property button_visibility; @@ -16,7 +17,6 @@ export component VisibilityButton inherits Button { } export component ActionButtons inherits HorizontalLayout { - callback deleted; callback scan_stopping; callback scan_starting(CurrentTab); in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; @@ -55,7 +55,7 @@ export component ActionButtons inherits HorizontalLayout { enabled: !scanning; text: "Delete"; clicked => { - root.deleted(); + Callabler.delete_selected_items(); } } diff --git a/krokiet/ui/bottom_panel.slint b/krokiet/ui/bottom_panel.slint index 96b7d65be..a8c8b510f 100644 --- a/krokiet/ui/bottom_panel.slint +++ b/krokiet/ui/bottom_panel.slint @@ -4,92 +4,92 @@ import {Settings} from "settings.slint"; import {BottomPanelVisibility} from "common.slint"; import {Callabler} from "callabler.slint"; -component DirectoriesPanel { - callback folder-choose-requested(bool); +component DirectoriesPanel inherits HorizontalLayout { + callback folder_choose_requested(bool); callback show_manual_add_dialog(bool); // Included directories - HorizontalLayout { - VerticalLayout { - horizontal-stretch: 0.0; - Button { - text: "Add"; - clicked => { - folder-choose-requested(true); - } + VerticalLayout { + horizontal-stretch: 0.0; + spacing: 5px; + Button { + text: "Add"; + clicked => { + folder_choose_requested(true); } + } - Button { - text: "Remove"; - clicked => { - Callabler.remove_item_directories(true, included-list.current-item); - } + Button { + text: "Remove"; + clicked => { + Callabler.remove_item_directories(true, included-list.current-item); } + } - Button { - text: "Manual Add"; - clicked => { - show_manual_add_dialog(true); - } + Button { + text: "Manual Add"; + clicked => { + show_manual_add_dialog(true); } + } - Rectangle { - vertical-stretch: 1.0; - } + Rectangle { + vertical-stretch: 1.0; } + } - VerticalLayout { - horizontal-stretch: 1.0; - Rectangle { - Text { - text: "Included Directories"; - } + VerticalLayout { + horizontal-stretch: 1.0; + Rectangle { + Text { + text: "Included Directories"; } + } - included_list := StandardListView { - model: Settings.included-directories; - } + included_list := StandardListView { + model: Settings.included-directories; } + } - // Excluded directories - VerticalLayout { - horizontal-stretch: 0.0; - Button { - text: "Add"; - clicked => { - folder-choose-requested(false); - } + // Excluded directories + VerticalLayout { + horizontal-stretch: 0.0; + spacing: 5px; + Button { + text: "Add"; + clicked => { + folder_choose_requested(false); } + } - Button { - text: "Remove"; - clicked => { - Callabler.remove_item_directories(false, excluded-list.current-item); - } + Button { + text: "Remove"; + clicked => { + Callabler.remove_item_directories(false, excluded-list.current-item); } + } - Button { - text: "Manual Add"; - clicked => { - show_manual_add_dialog(false); - } + Button { + text: "Manual Add"; + clicked => { + show_manual_add_dialog(false); } + } - Rectangle { - vertical-stretch: 1.0; - } + Rectangle { + vertical-stretch: 1.0; } + } - VerticalLayout { - horizontal-stretch: 1.0; - Rectangle { - Text { - text: "Excluded Directories"; - } + VerticalLayout { + horizontal-stretch: 1.0; + Rectangle { + Text { + text: "Excluded Directories"; } + } - excluded_list := StandardListView { - model: Settings.excluded-directories; - } + excluded_list := StandardListView { + model: Settings.excluded-directories; } } } @@ -103,15 +103,15 @@ component TextErrorsPanel inherits TextEdit { export component BottomPanel { in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; - callback folder-choose-requested(bool); + callback folder_choose_requested(bool); callback show_manual_add_dialog(bool); min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px; min-width: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 400px; if bottom-panel-visibility == BottomPanelVisibility.Directories: DirectoriesPanel { width: parent.width; height: parent.height; - folder-choose-requested(included-directories) => { - root.folder-choose-requested(included-directories) + folder_choose_requested(included-directories) => { + root.folder_choose_requested(included-directories) } show_manual_add_dialog(included-directories) => { root.show_manual_add_dialog(included-directories) diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint index b4f21da2f..8029aa282 100644 --- a/krokiet/ui/callabler.slint +++ b/krokiet/ui/callabler.slint @@ -1,4 +1,10 @@ export global Callabler { + // Bottom panel operations callback remove_item_directories(bool, int); callback added_manual_directories(bool, string); + + // Right click or middle click opener + callback item_opened(string); + + callback delete_selected_items(); } diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 15867f4b0..ae802c40c 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -5,7 +5,6 @@ import {CurrentTab, TypeOfOpenedItem} from "common.slint"; import {MainListModel} from "common.slint"; export component MainList { - callback item_opened(string); in-out property active-tab; in-out property <[MainListModel]> empty_folder_model; in-out property <[MainListModel]> empty_files_model; @@ -19,9 +18,6 @@ export component MainList { values <=> empty-folder-model; parentPathIdx: 2; fileNameIdx: 1; - item_opened(item) => { - item_opened(item) - } } if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { @@ -32,9 +28,6 @@ export component MainList { values <=> empty-files-model; parentPathIdx: 2; fileNameIdx: 1; - item_opened(item) => { - item_opened(item) - } } if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { @@ -45,8 +38,5 @@ export component MainList { values <=> similar-images-model; parentPathIdx: 5; fileNameIdx: 4; - item_opened(item) => { - item_opened(item) - } } } diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index 2ff9c4d3c..513ef72b8 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -14,11 +14,9 @@ import {ColorPalette} from "color_palette.slint"; export {Settings, Callabler} export component MainWindow inherits Window { - callback deleted; callback scan_stopping; callback scan_starting(CurrentTab); - callback item_opened(string); - callback folder-choose-requested(bool); + callback folder_choose_requested(bool); callback scan_ended(string); min-width: 300px; preferred-width: 800px; @@ -58,10 +56,6 @@ export component MainWindow inherits Window { empty_folder_model <=> root.empty_folder_model; empty_files_model <=> root.empty_files_model; similar_images_model <=> root.similar_images_model; - - item_opened(item) => { - item_opened(item) - } } if root.scanning: Progress { @@ -76,9 +70,6 @@ export component MainWindow inherits Window { scanning <=> root.scanning; active-tab <=> root.active-tab; stop_requested <=> root.stop-requested; - deleted => { - root.deleted(); - } scan_stopping => { text_summary.text = "Stopping scan, please wait..."; root.scan_stopping(); @@ -99,8 +90,8 @@ export component MainWindow inherits Window { bottom-panel-visibility <=> action_buttons.bottom-panel-visibility; vertical-stretch: 0.0; - folder-choose-requested(included-directories) => { - root.folder-choose-requested(included-directories) + folder_choose_requested(included-directories) => { + root.folder_choose_requested(included-directories) } show_manual_add_dialog(included-directories) => { self.included-directories = included-directories; diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index 652e16672..ca9c09e86 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -2,7 +2,7 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV import {TypeOfOpenedItem} from "common.slint"; import {ColorPalette} from "color_palette.slint"; import {MainListModel} from "common.slint"; - +import {Callabler} from "callabler.slint"; export component SelectableTableView inherits Rectangle { callback item_opened(string); @@ -100,9 +100,9 @@ export component SelectableTableView inherits Rectangle { pointer-event(event) => { // TODO this should be clicked by double-click if (event.button == PointerEventButton.right && event.kind == PointerEventKind.up) { - root.item_opened(r.val[root.parentPathIdx - 1]) + Callabler.item_opened(r.val[root.parentPathIdx - 1]) } else if (event.button == PointerEventButton.middle && event.kind == PointerEventKind.up) { - root.item_opened(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]) + Callabler.item_opened(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]) } } } From 186c0e18957e982edd7f477b65aa8a34400ada3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 12 Nov 2023 13:54:59 +0100 Subject: [PATCH 048/107] Preview --- Cargo.lock | 1 + czkawka_core/src/common.rs | 2 +- krokiet/Cargo.toml | 1 + krokiet/src/connect_scan.rs | 8 ++-- krokiet/src/connect_show_preview.rs | 66 +++++++++++++++++++++++++++ krokiet/src/main.rs | 21 ++++++--- krokiet/src/settings.rs | 3 +- krokiet/ui/bottom_panel.slint | 3 +- krokiet/ui/callabler.slint | 3 ++ krokiet/ui/gui_state.slint | 5 ++ krokiet/ui/main_lists.slint | 16 +++++-- krokiet/ui/main_window.slint | 33 +++++++++++--- krokiet/ui/preview.slint | 3 ++ krokiet/ui/selectable_tree_view.slint | 10 +++- krokiet/ui/settings.slint | 1 - 15 files changed, 148 insertions(+), 28 deletions(-) create mode 100644 krokiet/src/connect_show_preview.rs create mode 100644 krokiet/ui/gui_state.slint create mode 100644 krokiet/ui/preview.slint diff --git a/Cargo.lock b/Cargo.lock index ecf34ab16..510ed9691 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3317,6 +3317,7 @@ dependencies = [ "handsome_logger", "home", "humansize", + "image", "log", "open", "rand", diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index a3f4618af..6613f8671 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -44,7 +44,7 @@ pub fn get_number_of_threads() -> usize { fn filtering_messages(record: &Record) -> bool { if let Some(module_path) = record.module_path() { - module_path.starts_with("czkawka") + module_path.starts_with("czkawka") || module_path.starts_with("krokiet") } else { true } diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index 98010d177..a6213e100 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -32,6 +32,7 @@ log = "0.4.20" serde = "1.0" serde_json = "1.0" humansize = "2.1.3" +image = "0.24.7" [build-dependencies] slint-build = "1.3.0" diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 9f0594690..8aa66f502 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -1,6 +1,6 @@ use crate::common::create_vec_model_from_vec_string; use crate::settings::{collect_settings, SettingsCustom}; -use crate::Settings; +use crate::GuiState; use crate::{CurrentTab, MainListModel, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; use crossbeam_channel::{Receiver, Sender}; @@ -98,7 +98,7 @@ fn scan_similar_images(a: Weak, progress_sender: Sender().set_info_text(messages.into()); + app.global::().set_info_text(messages.into()); }) }); } @@ -139,7 +139,7 @@ fn scan_empty_files(a: Weak, progress_sender: Sender, } app.set_empty_files_model(items.into()); app.invoke_scan_ended(format!("Found {} empty files", number_of_empty_files).into()); - app.global::().set_info_text(messages.into()); + app.global::().set_info_text(messages.into()); }) }); } @@ -180,7 +180,7 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender } app.set_empty_folder_model(items.into()); app.invoke_scan_ended(format!("Found {} empty folders", folder_map.len()).into()); - app.global::().set_info_text(messages.into()); + app.global::().set_info_text(messages.into()); }) }); } diff --git a/krokiet/src/connect_show_preview.rs b/krokiet/src/connect_show_preview.rs new file mode 100644 index 000000000..bcd6e6ae9 --- /dev/null +++ b/krokiet/src/connect_show_preview.rs @@ -0,0 +1,66 @@ +use crate::{Callabler, GuiState, MainWindow}; +use czkawka_core::common::IMAGE_RS_EXTENSIONS; +use image::DynamicImage; +use log::{debug, error}; +use slint::ComponentHandle; +use std::path::Path; +use std::time::{Duration, Instant}; + +pub type ImageBufferRgba = image::ImageBuffer, Vec>; + +pub fn connect_show_preview(app: &MainWindow) { + let a = app.as_weak(); + app.global::().on_load_image_preview(move |image_path| { + let app = a.upgrade().unwrap(); + + let path = Path::new(image_path.as_str()); + + 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 convert_time = start_timer_convert_time.elapsed(); + + let start_set_time = Instant::now(); + app.global::().set_preview_image(slint_image); + let set_time = start_set_time.elapsed(); + + debug!( + "Loading image took: {:?}, converting image took: {:?}, setting image took: {:?}", + load_time, convert_time, set_time + ); + app.global::().set_preview_visible(true); + } else { + app.global::().set_preview_visible(false); + } + }); +} + +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) +} + +fn load_image(image_path: &Path) -> Option<(Duration, image::DynamicImage)> { + if !image_path.is_file() { + return None; + } + let image_name = image_path.to_string_lossy().to_string(); + let image_extension = image_path.extension()?.to_string_lossy().to_lowercase(); + let extension_with_dot = format!(".{}", image_extension); + + if !IMAGE_RS_EXTENSIONS.contains(&extension_with_dot.as_str()) { + return None; + } + let load_img_start_timer = Instant::now(); + let img = image::open(image_name); + + match img { + Ok(img) => Some((load_img_start_timer.elapsed(), img)), + Err(e) => { + error!("Error while loading image: {}", e); + return None; + } + } +} diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 15ae34f03..102faa663 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -18,6 +18,7 @@ mod connect_directories_changes; mod connect_open; mod connect_progress_receiver; mod connect_scan; +mod connect_show_preview; mod connect_stop; mod settings; @@ -30,6 +31,7 @@ use crate::connect_scan::connect_scan_button; use crate::connect_directories_changes::connect_add_remove_directories; use crate::connect_progress_receiver::connect_progress_gathering; +use crate::connect_show_preview::connect_show_preview; use crate::connect_stop::connect_stop_button; use crate::settings::reset_settings; use czkawka_core::common::setup_logger; @@ -53,14 +55,21 @@ fn main() { connect_open_items(&app); connect_progress_gathering(&app, progress_receiver); connect_add_remove_directories(&app); + connect_show_preview(&app); reset_settings(&app); app.run().unwrap(); } -// TODO remove this after trying +// TODO remove this after debugging - or leave commented pub fn to_remove_debug(app: &MainWindow) { + app.set_empty_folder_model(to_remove_create_without_header("@@").into()); + app.set_empty_files_model(to_remove_create_without_header("%%").into()); + app.set_similar_images_model(to_remove_create_with_header().into()); +} + +fn to_remove_create_with_header() -> Rc> { let header_row_data: Rc> = Rc::new(VecModel::default()); for r in 0..100_000 { let items = VecModel::default(); @@ -81,12 +90,15 @@ pub fn to_remove_debug(app: &MainWindow) { header_row_data.push(item); } + header_row_data +} +fn to_remove_create_without_header(s: &str) -> Rc> { let non_header_row_data: Rc> = Rc::new(VecModel::default()); for r in 0..100_000 { let items = VecModel::default(); for c in 0..3 { - items.push(slint::format!("Item {r}.{c}")); + items.push(slint::format!("Item {r}.{c}.{s}")); } let is_checked = r % 2 == 0; @@ -100,8 +112,5 @@ pub fn to_remove_debug(app: &MainWindow) { non_header_row_data.push(item); } - - app.set_empty_folder_model(non_header_row_data.clone().into()); - app.set_empty_files_model(non_header_row_data.into()); - app.set_similar_images_model(header_row_data.into()); + non_header_row_data } diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 9fdb8340f..f329c2ca2 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -3,6 +3,7 @@ use std::env; use std::path::PathBuf; use crate::common::create_string_standard_list_view_from_pathbuf; +use crate::GuiState; use crate::Settings; use home::home_dir; use slint::{ComponentHandle, Model}; @@ -33,7 +34,7 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { settings.set_excluded_directories(excluded_items); // Clear text - app.global::().set_info_text("".into()); + app.global::().set_info_text("".into()); } impl Default for SettingsCustom { diff --git a/krokiet/ui/bottom_panel.slint b/krokiet/ui/bottom_panel.slint index a8c8b510f..f4872f511 100644 --- a/krokiet/ui/bottom_panel.slint +++ b/krokiet/ui/bottom_panel.slint @@ -3,6 +3,7 @@ import {Button, StandardListView, VerticalBox, ScrollView, TextEdit} from "std-w import {Settings} from "settings.slint"; import {BottomPanelVisibility} from "common.slint"; import {Callabler} from "callabler.slint"; +import {GuiState} from "gui_state.slint"; component DirectoriesPanel inherits HorizontalLayout { callback folder_choose_requested(bool); @@ -98,7 +99,7 @@ component TextErrorsPanel inherits TextEdit { height: 20px; read-only: true; wrap: TextWrap.no-wrap; - text <=> Settings.info_text; + text <=> GuiState.info_text; } export component BottomPanel { diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint index 8029aa282..0d35e7447 100644 --- a/krokiet/ui/callabler.slint +++ b/krokiet/ui/callabler.slint @@ -7,4 +7,7 @@ export global Callabler { callback item_opened(string); callback delete_selected_items(); + + // Preview + callback load_image_preview(string); } diff --git a/krokiet/ui/gui_state.slint b/krokiet/ui/gui_state.slint new file mode 100644 index 000000000..30d1187a2 --- /dev/null +++ b/krokiet/ui/gui_state.slint @@ -0,0 +1,5 @@ +export global GuiState { + in-out property info_text: "Nothing to report"; + in-out property preview_visible; + in-out property preview_image; +} diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index ae802c40c..15fd1aac2 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -9,19 +9,23 @@ export component MainList { in-out property <[MainListModel]> empty_folder_model; in-out property <[MainListModel]> empty_files_model; in-out property <[MainListModel]> similar_images_model; - // TODO - using root.active-tab in visible property will not clear model - if root.active-tab == CurrentTab.EmptyFolders: SelectableTableView { + + SelectableTableView { + visible: root.active-tab == CurrentTab.EmptyFolders; min-width: 200px; + height: parent.height; columns: ["Selection", "Folder Name", "Path"]; last-column: "Modification Date"; - column-sizes: [35px, 100px, 350px, 300px]; + column-sizes: [35px, 100px, 350px, 100px]; values <=> empty-folder-model; parentPathIdx: 2; fileNameIdx: 1; } - if root.active-tab == CurrentTab.EmptyFiles: SelectableTableView { + SelectableTableView { + visible: root.active-tab == CurrentTab.EmptyFiles; min-width: 200px; + height: parent.height; columns: ["Selection", "File Name", "Path"]; last-column: "Modification Date"; column-sizes: [35px, 100px, 350px, 100px]; @@ -30,8 +34,10 @@ export component MainList { fileNameIdx: 1; } - if root.active-tab == CurrentTab.SimilarImages: SelectableTableView { + SelectableTableView { + visible: root.active-tab == CurrentTab.SimilarImages; min-width: 200px; + height: parent.height; columns: ["Selection", "Similarity", "Size", "Dimensions", "File Name", "Path"]; last-column: "Modification Date"; column-sizes: [35px, 80px, 80px, 80px, 350px, 100px, 100px]; diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index 513ef72b8..5668fbe75 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -10,8 +10,10 @@ import {Settings} from "settings.slint"; import {Callabler} from "callabler.slint"; import { BottomPanel } from "bottom_panel.slint"; import {ColorPalette} from "color_palette.slint"; +import {GuiState} from "gui_state.slint"; +import { Preview } from "preview.slint"; -export {Settings, Callabler} +export {Settings, Callabler, GuiState} export component MainWindow inherits Window { callback scan_stopping; @@ -36,7 +38,12 @@ export component MainWindow inherits Window { {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} ]; - in-out property <[MainListModel]> empty_files_model: []; + in-out property <[MainListModel]> empty_files_model: [ + {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} + ]; in-out property <[MainListModel]> similar_images_model: []; VerticalBox { HorizontalBox { @@ -50,12 +57,24 @@ export component MainWindow inherits Window { VerticalLayout { horizontal-stretch: 1.0; - MainList { + Rectangle { vertical-stretch: 1.0; - active-tab <=> root.active-tab; - empty_folder_model <=> root.empty_folder_model; - empty_files_model <=> root.empty_files_model; - similar_images_model <=> root.similar_images_model; + MainList { + width: GuiState.preview_visible ? parent.width / 2 : parent.width; + height: parent.height; + horizontal-stretch: 0.5; + active-tab <=> root.active-tab; + empty_folder_model <=> root.empty_folder_model; + empty_files_model <=> root.empty_files_model; + similar_images_model <=> root.similar_images_model; + } + Preview { + height: parent.height; + x: parent.width / 2; + width: GuiState.preview_visible ? parent.width / 2 : 0; + visible: GuiState.preview_visible; + source: GuiState.preview_image; + } } if root.scanning: Progress { diff --git a/krokiet/ui/preview.slint b/krokiet/ui/preview.slint new file mode 100644 index 000000000..a7b4ead35 --- /dev/null +++ b/krokiet/ui/preview.slint @@ -0,0 +1,3 @@ +export component Preview inherits Image { + +} \ No newline at end of file diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index ca9c09e86..b4a4efe5c 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -1,8 +1,9 @@ -import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, ScrollView} from "std-widgets.slint"; import {TypeOfOpenedItem} from "common.slint"; import {ColorPalette} from "color_palette.slint"; import {MainListModel} from "common.slint"; import {Callabler} from "callabler.slint"; +import {GuiState} from "gui_state.slint"; export component SelectableTableView inherits Rectangle { callback item_opened(string); @@ -10,7 +11,6 @@ export component SelectableTableView inherits Rectangle { in property last_column; in-out property <[MainListModel]> values; in-out property <[length]> column_sizes; - private property <[length]> real_sizes: [0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px, 0px]; private property column_number: column-sizes.length + 1; // This idx, starts from zero, but since first is always a checkbox, and is not in model.val values, remove 1 from idx in-out property parentPathIdx; @@ -95,6 +95,12 @@ export component SelectableTableView inherits Rectangle { root.selected-item = -1; } } + + if (root.selected_item != -1) { + Callabler.load_image_preview(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]); + } else { + GuiState.preview-visible = false; + } } } pointer-event(event) => { diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index c9d8660fc..95414c5f5 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -1,5 +1,4 @@ export global Settings { in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}]; in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}]; - in-out property info_text: "Nothing to report"; } From c919aa11fa1f0596988ad98d0b81c395f03a39a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 12 Nov 2023 16:00:55 +0100 Subject: [PATCH 049/107] Improved ListView --- czkawka_core/src/common.rs | 30 ++++- krokiet/src/connect_show_preview.rs | 32 +++-- krokiet/ui/left_side_panel.slint | 7 ++ krokiet/ui/main_lists.slint | 27 ++-- krokiet/ui/main_window.slint | 8 +- krokiet/ui/selectable_tree_view.slint | 173 +++++++++++++------------- 6 files changed, 168 insertions(+), 109 deletions(-) diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 6613f8671..940499449 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::Arc; use std::thread::{sleep, JoinHandle}; -use std::time::{Duration, SystemTime}; +use std::time::{Duration, Instant, SystemTime}; use std::{fs, thread}; #[cfg(feature = "heif")] @@ -18,7 +18,7 @@ use image::{DynamicImage, ImageBuffer, Rgb}; use imagepipe::{ImageSource, Pipeline}; #[cfg(feature = "heif")] use libheif_rs::{ColorSpace, HeifContext, RgbChroma}; -use log::{info, LevelFilter, Record}; +use log::{debug, info, LevelFilter, Record}; // #[cfg(feature = "heif")] // use libheif_rs::LibHeif; @@ -184,12 +184,17 @@ pub fn get_dynamic_image_from_heic(path: &str) -> Result { } pub fn get_dynamic_image_from_raw_image(path: impl AsRef + std::fmt::Debug) -> Option { + let mut start_timer = Instant::now(); + let mut times = Vec::new(); + let file_handler = match OpenOptions::new().read(true).open(&path) { Ok(t) => t, Err(_e) => { return None; } }; + times.push(("After opening", start_timer.elapsed())); + start_timer = Instant::now(); let mut reader = BufReader::new(file_handler); let raw = match rawloader::decode(&mut reader) { @@ -199,8 +204,14 @@ pub fn get_dynamic_image_from_raw_image(path: impl AsRef + std::fmt::Debug } }; + times.push(("After decoding", start_timer.elapsed())); + start_timer = Instant::now(); + let source = ImageSource::Raw(raw); + times.push(("After creating source", start_timer.elapsed())); + start_timer = Instant::now(); + let mut pipeline = match Pipeline::new_from_source(source) { Ok(pipeline) => pipeline, Err(_e) => { @@ -208,6 +219,9 @@ pub fn get_dynamic_image_from_raw_image(path: impl AsRef + std::fmt::Debug } }; + times.push(("After creating pipeline", start_timer.elapsed())); + start_timer = Instant::now(); + pipeline.run(None); let image = match pipeline.output_8bit(None) { Ok(image) => image, @@ -216,12 +230,22 @@ pub fn get_dynamic_image_from_raw_image(path: impl AsRef + std::fmt::Debug } }; + times.push(("After creating image", start_timer.elapsed())); + start_timer = Instant::now(); + let Some(image) = ImageBuffer::, Vec>::from_raw(image.width as u32, image.height as u32, image.data) else { return None; }; + times.push(("After creating image buffer", start_timer.elapsed())); + start_timer = Instant::now(); // println!("Properly hashed {:?}", path); - Some(DynamicImage::ImageRgb8(image)) + let res = Some(DynamicImage::ImageRgb8(image)); + times.push(("After creating dynamic image", start_timer.elapsed())); + + let str_timer = times.into_iter().map(|(name, time)| format!("{name}: {time:?}")).collect::>().join(", "); + debug!("Loading raw image --- {str_timer}"); + res } pub fn split_path(path: &Path) -> (String, String) { diff --git a/krokiet/src/connect_show_preview.rs b/krokiet/src/connect_show_preview.rs index bcd6e6ae9..30aeec341 100644 --- a/krokiet/src/connect_show_preview.rs +++ b/krokiet/src/connect_show_preview.rs @@ -1,5 +1,5 @@ use crate::{Callabler, GuiState, MainWindow}; -use czkawka_core::common::IMAGE_RS_EXTENSIONS; +use czkawka_core::common::{get_dynamic_image_from_raw_image, IMAGE_RS_EXTENSIONS, RAW_IMAGE_EXTENSIONS}; use image::DynamicImage; use log::{debug, error}; use slint::ComponentHandle; @@ -50,17 +50,33 @@ fn load_image(image_path: &Path) -> Option<(Duration, image::DynamicImage)> { let image_extension = image_path.extension()?.to_string_lossy().to_lowercase(); let extension_with_dot = format!(".{}", image_extension); - if !IMAGE_RS_EXTENSIONS.contains(&extension_with_dot.as_str()) { + let is_raw_image = RAW_IMAGE_EXTENSIONS.contains(&extension_with_dot.as_str()); + let is_normal_image = IMAGE_RS_EXTENSIONS.contains(&extension_with_dot.as_str()); + + if !is_raw_image && !is_normal_image { return None; } let load_img_start_timer = Instant::now(); - let img = image::open(image_name); - match img { - Ok(img) => Some((load_img_start_timer.elapsed(), img)), - Err(e) => { - error!("Error while loading image: {}", e); + // TODO this needs to be run inside closure + let img = if is_normal_image { + match image::open(image_name) { + Ok(img) => img, + Err(e) => { + error!("Error while loading image: {}", e); + return None; + } + } + } else if is_raw_image { + if let Some(img) = get_dynamic_image_from_raw_image(image_name) { + img + } else { + error!("Error while loading raw image - not sure why - try to guess"); return None; } - } + } else { + panic!("Used not supported image extension"); + }; + + Some((load_img_start_timer.elapsed(), img)) } diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index 8b9dac2a8..85196aa5b 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -7,6 +7,8 @@ component TabItem { in-out property active-tab; in property text; in property curr_tab; + callback changed_current_tab(); + Rectangle { width: parent.width; horizontal-stretch: 1.0; @@ -17,6 +19,7 @@ component TabItem { return; } root.active-tab = root.curr-tab; + changed_current_tab(); } } } @@ -61,6 +64,7 @@ component TabItem { export component LeftSidePanel { in-out property active-tab; in-out property scanning; + callback changed_current_tab(); width: 120px; VerticalLayout { spacing: 20px; @@ -82,6 +86,7 @@ export component LeftSidePanel { text: "Empty Folders"; active-tab <=> root.active-tab; curr_tab: CurrentTab.EmptyFolders; + changed_current_tab() => {root.changed_current_tab();} } TabItem { @@ -90,6 +95,7 @@ export component LeftSidePanel { text: "Empty Files"; active-tab <=> root.active-tab; curr_tab: CurrentTab.EmptyFiles; + changed_current_tab() => {root.changed_current_tab();} } TabItem { @@ -98,6 +104,7 @@ export component LeftSidePanel { text: "Similar Images"; active-tab <=> root.active-tab; curr_tab: CurrentTab.SimilarImages; + changed_current_tab() => {root.changed_current_tab();} } } diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 15fd1aac2..d8e102942 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -9,40 +9,43 @@ export component MainList { in-out property <[MainListModel]> empty_folder_model; in-out property <[MainListModel]> empty_files_model; in-out property <[MainListModel]> similar_images_model; + callback changed_current_tab(); - SelectableTableView { + empty_folders := SelectableTableView { visible: root.active-tab == CurrentTab.EmptyFolders; min-width: 200px; height: parent.height; - columns: ["Selection", "Folder Name", "Path"]; - last-column: "Modification Date"; - column-sizes: [35px, 100px, 350px, 100px]; + columns: ["Selection", "Folder Name", "Path", "Modification Date"]; + column-sizes: [35px, 100px, 350px, 150px]; values <=> empty-folder-model; parentPathIdx: 2; fileNameIdx: 1; } - SelectableTableView { + empty_files := SelectableTableView { visible: root.active-tab == CurrentTab.EmptyFiles; min-width: 200px; height: parent.height; - columns: ["Selection", "File Name", "Path"]; - last-column: "Modification Date"; - column-sizes: [35px, 100px, 350px, 100px]; + columns: ["Selection", "File Name", "Path", "Modification Date"]; + column-sizes: [35px, 100px, 350px, 150px]; values <=> empty-files-model; parentPathIdx: 2; fileNameIdx: 1; } - SelectableTableView { + similar_images := SelectableTableView { visible: root.active-tab == CurrentTab.SimilarImages; min-width: 200px; height: parent.height; - columns: ["Selection", "Similarity", "Size", "Dimensions", "File Name", "Path"]; - last-column: "Modification Date"; - column-sizes: [35px, 80px, 80px, 80px, 350px, 100px, 100px]; + columns: ["Selection", "Similarity", "Size", "Dimensions", "File Name", "Path", "Modification Date"]; + column-sizes: [35px, 80px, 80px, 80px, 100px, 350px, 150px]; values <=> similar-images-model; parentPathIdx: 5; fileNameIdx: 4; } + changed_current_tab() => { + empty_folders.deselect_selected_item(); + empty_files.deselect_selected_item(); + similar_images.deselect_selected_item(); + } } diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index 5668fbe75..69d3aa229 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -53,13 +53,18 @@ export component MainWindow inherits Window { horizontal-stretch: 0.0; scanning <=> root.scanning; active-tab <=> root.active-tab; + changed_current_tab() => { + GuiState.preview-visible = false; + main_list.changed_current_tab(); + } } VerticalLayout { horizontal-stretch: 1.0; Rectangle { vertical-stretch: 1.0; - MainList { + main_list := MainList { + x: 0; width: GuiState.preview_visible ? parent.width / 2 : parent.width; height: parent.height; horizontal-stretch: 0.5; @@ -74,6 +79,7 @@ export component MainWindow inherits Window { width: GuiState.preview_visible ? parent.width / 2 : 0; visible: GuiState.preview_visible; source: GuiState.preview_image; + image-fit: ImageFit.contain; } } diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index b4a4efe5c..642d39313 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -8,7 +8,6 @@ import {GuiState} from "gui_state.slint"; export component SelectableTableView inherits Rectangle { callback item_opened(string); in property <[string]> columns; - in property last_column; in-out property <[MainListModel]> values; in-out property <[length]> column_sizes; private property column_number: column-sizes.length + 1; @@ -25,119 +24,123 @@ export component SelectableTableView inherits Rectangle { } } - VerticalBox { - padding: 5px; - forward-focus: focus-item; - HorizontalLayout { + ScrollView { + VerticalBox { padding: 5px; - spacing: 5px; - vertical-stretch: 0; - for title [idx] in root.columns: HorizontalLayout { - width: root.column-sizes[idx]; - Text { - overflow: elide; - text: title; - } + forward-focus: focus-item; + HorizontalLayout { + padding: 5px; + spacing: 5px; + vertical-stretch: 0; + for title [idx] in root.columns: HorizontalLayout { + width: root.column-sizes[idx]; + Text { + overflow: elide; + text: title; + } - Rectangle { - width: 1px; - background: gray; - forward-focus: focus-item; - TouchArea { - width: 5px; - x: (parent.width - self.width) / 2; - property cached; + Rectangle { + width: 1px; + background: gray; forward-focus: focus-item; - pointer-event(event) => { - if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) { - self.cached = root.column_sizes[idx]; + TouchArea { + width: 5px; + x: (parent.width - self.width) / 2; + property cached; + forward-focus: focus-item; + pointer-event(event) => { + if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) { + self.cached = root.column_sizes[idx]; + } } - } - moved => { - if (self.pressed) { - root.column_sizes[idx] += (self.mouse-x - self.pressed-x); - if (root.column_sizes[idx] < 20px) { - root.column_sizes[idx] = 20px; + moved => { + if (self.pressed) { + root.column_sizes[idx] += (self.mouse-x - self.pressed-x); + if (root.column_sizes[idx] < 20px) { + root.column_sizes[idx] = 20px; + } } } + mouse-cursor: ew-resize; } - mouse-cursor: ew-resize; } } } - Text { - overflow: elide; - text: last-column; - } - } - - list_view := ListView { - min-width: 100px; - forward-focus: focus-item; - for r [idx] in root.values: Rectangle { - border-radius: 5px; + list_view := ListView { + min-width: 100px; forward-focus: focus-item; - height: 20px; - background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color)); - touch_area := TouchArea { + for r [idx] in root.values: Rectangle { + border-radius: 5px; forward-focus: focus-item; - clicked => { - if (!r.header_row) { - r.selected_row = !r.selected_row; - if (root.selected-item == -1) { - root.selected-item = idx; - } else { - if (r.selected_row == true) { - root.values[root.selected-item].selected_row = false; + height: 20px; + background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color)); + touch_area := TouchArea { + forward-focus: focus-item; + clicked => { + if (!r.header_row) { + r.selected_row = !r.selected_row; + if (root.selected-item == -1) { root.selected-item = idx; } else { - root.selected-item = -1; + if (r.selected_row == true) { + root.values[root.selected-item].selected_row = false; + root.selected-item = idx; + } else { + root.selected-item = -1; + } } - } - if (root.selected_item != -1) { - Callabler.load_image_preview(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]); - } else { - GuiState.preview-visible = false; + if (root.selected_item != -1) { + Callabler.load_image_preview(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]); + } else { + GuiState.preview-visible = false; + } } } - } - pointer-event(event) => { - // TODO this should be clicked by double-click - if (event.button == PointerEventButton.right && event.kind == PointerEventKind.up) { - Callabler.item_opened(r.val[root.parentPathIdx - 1]) - } else if (event.button == PointerEventButton.middle && event.kind == PointerEventKind.up) { - Callabler.item_opened(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]) + pointer-event(event) => { + // TODO this should be clicked by double-click + if (event.button == PointerEventButton.right && event.kind == PointerEventKind.up) { + Callabler.item_opened(r.val[root.parentPathIdx - 1]) + } else if (event.button == PointerEventButton.middle && event.kind == PointerEventKind.up) { + Callabler.item_opened(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]) + } } } - } - HorizontalLayout { - forward-focus: focus-item; - CheckBox { - visible: !r.header-row; - checked: r.checked && !r.header-row; - width: root.column-sizes[0]; + HorizontalLayout { forward-focus: focus-item; - toggled => { - r.checked = self.checked; + CheckBox { + visible: !r.header-row; + checked: r.checked && !r.header-row; + width: root.column-sizes[0]; + forward-focus: focus-item; + toggled => { + r.checked = self.checked; + } } - } - HorizontalLayout { - spacing: 5px; - for f [idx] in r.val: Text { - width: root.column-sizes[idx + 1]; - text: f; - font-size: 12px; - forward-focus: focus-item; - vertical-alignment: center; - overflow: elide; + HorizontalLayout { + spacing: 5px; + for f [idx] in r.val: Text { + width: root.column-sizes[idx + 1]; + text: f; + font-size: 12px; + forward-focus: focus-item; + vertical-alignment: center; + overflow: elide; + } } } } } } } + + public function deselect_selected_item() { + if (root.selected_item != -1) { + root.values[root.selected-item].selected_row = false; + root.selected-item = -1; + } + } } From 0b99d9c1d972957d31df1c8b2ca3029582d559d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 13 Nov 2023 19:54:22 +0100 Subject: [PATCH 050/107] Loading/Saving settings --- Cargo.lock | 1 + krokiet/Cargo.toml | 1 + krokiet/src/connect_scan.rs | 6 +- krokiet/src/main.rs | 13 ++-- krokiet/src/settings.rs | 125 ++++++++++++++++++++++++++++-------- 5 files changed, 109 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 510ed9691..722acd233 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3314,6 +3314,7 @@ dependencies = [ "chrono", "crossbeam-channel", "czkawka_core", + "directories-next", "handsome_logger", "home", "humansize", diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index a6213e100..0204576af 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -33,6 +33,7 @@ serde = "1.0" serde_json = "1.0" humansize = "2.1.3" image = "0.24.7" +directories-next = "2.0" [build-dependencies] slint-build = "1.3.0" diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 8aa66f502..cf3267a8f 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -1,7 +1,6 @@ use crate::common::create_vec_model_from_vec_string; use crate::settings::{collect_settings, SettingsCustom}; -use crate::GuiState; -use crate::{CurrentTab, MainListModel, MainWindow, ProgressToSend}; +use crate::{CurrentTab, GuiState, MainListModel, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; use crossbeam_channel::{Receiver, Sender}; use czkawka_core::common::split_path; @@ -12,8 +11,7 @@ use czkawka_core::empty_files::EmptyFiles; use czkawka_core::empty_folder::EmptyFolder; use czkawka_core::similar_images; use czkawka_core::similar_images::SimilarImages; -use humansize::format_size; -use humansize::BINARY; +use humansize::{format_size, BINARY}; use slint::{ComponentHandle, ModelRc, SharedString, VecModel, Weak}; use std::path::PathBuf; use std::rc::Rc; diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 102faa663..e520768ec 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -33,7 +33,7 @@ use crate::connect_directories_changes::connect_add_remove_directories; use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_show_preview::connect_show_preview; use crate::connect_stop::connect_stop_button; -use crate::settings::reset_settings; +use crate::settings::{load_settings_from_file, reset_settings, save_settings_to_file}; use czkawka_core::common::setup_logger; use czkawka_core::common_dir_traversal::ProgressData; use slint::{ModelRc, VecModel}; @@ -42,13 +42,16 @@ slint::include_modules!(); fn main() { setup_logger(false); - let app = MainWindow::new().unwrap(); //.run().unwrap(); + let app = MainWindow::new().unwrap(); let (progress_sender, progress_receiver): (Sender, Receiver) = unbounded(); let (stop_sender, stop_receiver): (Sender<()>, Receiver<()>) = unbounded(); - // Fills model at start, don't really needed too much after testing + to_remove_debug(&app); + reset_settings(&app); + load_settings_from_file(&app); + connect_delete_button(&app); connect_scan_button(&app, progress_sender, stop_receiver); connect_stop_button(&app, stop_sender); @@ -57,9 +60,9 @@ fn main() { connect_add_remove_directories(&app); connect_show_preview(&app); - reset_settings(&app); - app.run().unwrap(); + + save_settings_to_file(&app); } // TODO remove this after debugging - or leave commented diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index f329c2ca2..0570d6830 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -3,9 +3,11 @@ use std::env; use std::path::PathBuf; use crate::common::create_string_standard_list_view_from_pathbuf; -use crate::GuiState; -use crate::Settings; +use crate::{GuiState, Settings}; +use directories_next::ProjectDirs; use home::home_dir; +use log::error; +use serde::{Deserialize, Serialize}; use slint::{ComponentHandle, Model}; #[cfg(target_family = "unix")] @@ -13,15 +15,86 @@ const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", #[cfg(not(target_family = "unix"))] const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["C:\\Windows"]; +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct SettingsCustom { + #[serde(default = "default_included_directories")] pub included_directories: Vec, + #[serde(default = "default_excluded_directories")] pub excluded_directories: Vec, } +impl Default for SettingsCustom { + fn default() -> Self { + Self { + included_directories: default_included_directories(), + excluded_directories: default_excluded_directories(), + } + } +} pub fn reset_settings(app: &MainWindow) { set_settings_to_gui(app, &SettingsCustom::default()); } +pub fn load_settings_from_file(app: &MainWindow) { + let Some(config_file) = get_config_file() else { + error!("Cannot get config file"); + return; + }; + if !config_file.is_file() { + error!("Config file doesn't exists"); + return; + } + + match std::fs::read_to_string(config_file) { + Ok(serialized) => match serde_json::from_str(&serialized) { + Ok(custom_settings) => { + set_settings_to_gui(app, &custom_settings); + } + Err(e) => { + error!("Cannot deserialize settings: {e}"); + } + }, + Err(e) => { + error!("Cannot read config file: {e}"); + } + } +} + +pub fn save_settings_to_file(app: &MainWindow) { + let Some(config_file) = get_config_file() else { + error!("Cannot get config file"); + return; + }; + // Create dirs if not exists + if let Some(parent) = config_file.parent() { + if let Err(e) = std::fs::create_dir_all(parent) { + error!("Cannot create config folder: {e}"); + return; + } + } + + let collected_settings = collect_settings(app); + match serde_json::to_string_pretty(&collected_settings) { + Ok(serialized) => { + if let Err(e) = std::fs::write(config_file, serialized) { + error!("Cannot save config file: {e}"); + } + } + Err(e) => { + error!("Cannot serialize settings: {e}"); + } + } +} + +pub fn get_config_file() -> Option { + let Some(configs) = ProjectDirs::from("pl", "Qarmin", "Krokiet") else { + return None; + }; + let config_folder = configs.config_dir(); + let config_file = config_folder.join("config.json"); + Some(config_file) +} + pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { let settings = app.global::(); @@ -37,32 +110,6 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { app.global::().set_info_text("".into()); } -impl Default for SettingsCustom { - fn default() -> Self { - let mut included_directories = vec![]; - if let Ok(current_dir) = env::current_dir() { - included_directories.push(current_dir.to_string_lossy().to_string()); - } else if let Some(home_dir) = home_dir() { - included_directories.push(home_dir.to_string_lossy().to_string()); - } else if cfg!(target_family = "unix") { - included_directories.push("/".to_string()); - } else { - // This could be set to default - included_directories.push("C:\\".to_string()); - }; - included_directories.sort(); - let included_directories = included_directories.iter().map(PathBuf::from).collect::>(); - - let mut excluded_directories = DEFAULT_EXCLUDED_DIRECTORIES.iter().map(PathBuf::from).collect::>(); - excluded_directories.sort(); - - Self { - included_directories, - excluded_directories, - } - } -} - pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let settings = app.global::(); @@ -77,3 +124,25 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { excluded_directories, } } + +fn default_included_directories() -> Vec { + let mut included_directories = vec![]; + if let Ok(current_dir) = env::current_dir() { + included_directories.push(current_dir.to_string_lossy().to_string()); + } else if let Some(home_dir) = home_dir() { + included_directories.push(home_dir.to_string_lossy().to_string()); + } else if cfg!(target_family = "unix") { + included_directories.push("/".to_string()); + } else { + // This could be set to default + included_directories.push("C:\\".to_string()); + }; + included_directories.sort(); + included_directories.iter().map(PathBuf::from).collect::>() +} + +fn default_excluded_directories() -> Vec { + let mut excluded_directories = DEFAULT_EXCLUDED_DIRECTORIES.iter().map(PathBuf::from).collect::>(); + excluded_directories.sort(); + excluded_directories +} From 74ae728cde818ddecacaebaa0ca249e504039980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 13 Nov 2023 21:47:02 +0100 Subject: [PATCH 051/107] Again fixes --- krokiet/src/settings.rs | 1 + krokiet/ui/selectable_tree_view.slint | 115 ++++++++++++++------------ 2 files changed, 61 insertions(+), 55 deletions(-) diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 0570d6830..a6d3612e2 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -22,6 +22,7 @@ pub struct SettingsCustom { #[serde(default = "default_excluded_directories")] pub excluded_directories: Vec, } + impl Default for SettingsCustom { fn default() -> Self { Self { diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index 642d39313..d35e239e5 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -24,14 +24,16 @@ export component SelectableTableView inherits Rectangle { } } - ScrollView { - VerticalBox { - padding: 5px; - forward-focus: focus-item; + VerticalBox { + padding: 0px; + forward-focus: focus-item; + ScrollView { + height: 30px; + viewport-x <=> list_view.viewport-x; + vertical-stretch: 0; + HorizontalLayout { - padding: 5px; spacing: 5px; - vertical-stretch: 0; for title [idx] in root.columns: HorizontalLayout { width: root.column-sizes[idx]; Text { @@ -66,70 +68,73 @@ export component SelectableTableView inherits Rectangle { } } } + } - list_view := ListView { - min-width: 100px; + list_view := ListView { + padding: 0px; + min-width: 100px; + forward-focus: focus-item; + for r [idx] in root.values: Rectangle { + width: column_sizes[0] + column_sizes[1] + column_sizes[2] + column_sizes[3] + column_sizes[4] + column_sizes[5] + column_sizes[6] + column_sizes[7] + column_sizes[8] + column_sizes[9] + column_sizes[10] + column_sizes[11]; + + border-radius: 5px; forward-focus: focus-item; - for r [idx] in root.values: Rectangle { - border-radius: 5px; + height: 20px; + background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color)); + touch_area := TouchArea { forward-focus: focus-item; - height: 20px; - background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color)); - touch_area := TouchArea { - forward-focus: focus-item; - clicked => { - if (!r.header_row) { - r.selected_row = !r.selected_row; - if (root.selected-item == -1) { + clicked => { + if (!r.header_row) { + r.selected_row = !r.selected_row; + if (root.selected-item == -1) { + root.selected-item = idx; + } else { + if (r.selected_row == true) { + root.values[root.selected-item].selected_row = false; root.selected-item = idx; } else { - if (r.selected_row == true) { - root.values[root.selected-item].selected_row = false; - root.selected-item = idx; - } else { - root.selected-item = -1; - } + root.selected-item = -1; } + } - if (root.selected_item != -1) { - Callabler.load_image_preview(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]); - } else { - GuiState.preview-visible = false; - } + if (root.selected_item != -1) { + Callabler.load_image_preview(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]); + } else { + GuiState.preview-visible = false; } } - pointer-event(event) => { - // TODO this should be clicked by double-click - if (event.button == PointerEventButton.right && event.kind == PointerEventKind.up) { - Callabler.item_opened(r.val[root.parentPathIdx - 1]) - } else if (event.button == PointerEventButton.middle && event.kind == PointerEventKind.up) { - Callabler.item_opened(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]) - } + } + pointer-event(event) => { + // TODO this should be clicked by double-click + if (event.button == PointerEventButton.right && event.kind == PointerEventKind.up) { + Callabler.item_opened(r.val[root.parentPathIdx - 1]) + } else if (event.button == PointerEventButton.middle && event.kind == PointerEventKind.up) { + Callabler.item_opened(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]) } } + } - HorizontalLayout { + HorizontalLayout { + forward-focus: focus-item; + CheckBox { + visible: !r.header-row; + checked: r.checked && !r.header-row; + width: root.column-sizes[0]; forward-focus: focus-item; - CheckBox { - visible: !r.header-row; - checked: r.checked && !r.header-row; - width: root.column-sizes[0]; - forward-focus: focus-item; - toggled => { - r.checked = self.checked; - } + toggled => { + r.checked = self.checked; } + } - HorizontalLayout { - spacing: 5px; - for f [idx] in r.val: Text { - width: root.column-sizes[idx + 1]; - text: f; - font-size: 12px; - forward-focus: focus-item; - vertical-alignment: center; - overflow: elide; - } + HorizontalLayout { + spacing: 5px; + for f [idx] in r.val: Text { + width: root.column-sizes[idx + 1]; + text: f; + font-size: 12px; + forward-focus: focus-item; + vertical-alignment: center; + overflow: elide; } } } From a14ace1b448b04ee4785907d6bacd6544c0c93ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 15 Nov 2023 17:00:09 +0100 Subject: [PATCH 052/107] Optimization(probably) --- krokiet/ui/selectable_tree_view.slint | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index d35e239e5..be8c4f4f7 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -15,6 +15,7 @@ export component SelectableTableView inherits Rectangle { in-out property parentPathIdx; in-out property fileNameIdx; in-out property selected_item: -1; + out property list_view_width: column_sizes[0] + column_sizes[1] + column_sizes[2] + column_sizes[3] + column_sizes[4] + column_sizes[5] + column_sizes[6] + column_sizes[7] + column_sizes[8] + column_sizes[9] + column_sizes[10] + column_sizes[11]; forward-focus: focus_item; // TODO not works focus_item := FocusScope { @@ -75,7 +76,7 @@ export component SelectableTableView inherits Rectangle { min-width: 100px; forward-focus: focus-item; for r [idx] in root.values: Rectangle { - width: column_sizes[0] + column_sizes[1] + column_sizes[2] + column_sizes[3] + column_sizes[4] + column_sizes[5] + column_sizes[6] + column_sizes[7] + column_sizes[8] + column_sizes[9] + column_sizes[10] + column_sizes[11]; + width: list_view_width; border-radius: 5px; forward-focus: focus-item; From 447eb98b516839f740621028d79197ddaa170ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 16 Nov 2023 21:33:35 +0100 Subject: [PATCH 053/107] Logo --- Cargo.lock | 120 +++++++++++------- .../connect_things/connect_change_language.rs | 2 +- czkawka_gui/src/tests.rs | 2 +- krokiet/Cargo.toml | 18 +-- krokiet/icons/logo.png | Bin 11273 -> 11659 bytes krokiet/icons/settings.png | Bin 4667 -> 0 bytes krokiet/icons/settings.svg | 1 + krokiet/src/connect_delete.rs | 30 ++++- krokiet/ui/action_buttons.slint | 35 ++--- krokiet/ui/left_side_panel.slint | 2 +- 10 files changed, 130 insertions(+), 80 deletions(-) delete mode 100644 krokiet/icons/settings.png create mode 100644 krokiet/icons/settings.svg diff --git a/Cargo.lock b/Cargo.lock index 722acd233..de3cfdacd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,6 +231,19 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-channel" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d37875bd9915b7d67c2f117ea2c30a0989874d0b2cb694fe25403c85763c0c9e" +dependencies = [ + "concurrent-queue", + "event-listener 3.1.0", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + [[package]] name = "async-executor" version = "1.6.0" @@ -263,7 +276,7 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-executor", "async-io 1.13.0", "async-lock 2.8.0", @@ -298,14 +311,14 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" dependencies = [ - "async-lock 3.0.0", + "async-lock 3.1.0", "cfg-if", "concurrent-queue", "futures-io", "futures-lite 2.0.1", "parking", "polling 3.3.0", - "rustix 0.38.21", + "rustix 0.38.24", "slab", "tracing", "waker-fn", @@ -323,11 +336,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45e900cdcd39bb94a14487d3f7ef92ca222162e6c7c3fe7cb3550ea75fb486ed" +checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7" dependencies = [ - "event-listener 3.0.1", + "event-listener 3.1.0", "event-listener-strategy", "pin-project-lite", ] @@ -343,9 +356,9 @@ dependencies = [ "async-signal", "blocking", "cfg-if", - "event-listener 3.0.1", + "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.21", + "rustix 0.38.24", "windows-sys 0.48.0", ] @@ -372,7 +385,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.21", + "rustix 0.38.24", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -384,7 +397,7 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" dependencies = [ - "async-channel", + "async-channel 1.9.0", "async-global-executor", "async-io 1.13.0", "async-lock 2.8.0", @@ -593,16 +606,16 @@ dependencies = [ [[package]] name = "blocking" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel", - "async-lock 2.8.0", + "async-channel 2.1.0", + "async-lock 3.1.0", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite 1.13.0", + "futures-lite 2.0.1", "piper", "tracing", ] @@ -721,7 +734,7 @@ dependencies = [ "bitflags 2.4.1", "log", "polling 3.3.0", - "rustix 0.38.21", + "rustix 0.38.24", "slab", "thiserror", ] @@ -733,7 +746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ "calloop 0.12.3", - "rustix 0.38.21", + "rustix 0.38.24", "wayland-backend", "wayland-client", ] @@ -851,9 +864,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" dependencies = [ "clap_builder", "clap_derive", @@ -861,9 +874,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" dependencies = [ "anstream", "anstyle", @@ -1635,9 +1648,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys 0.48.0", @@ -1660,9 +1673,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "3.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cec0252c2afff729ee6f00e903d479fba81784c8e2bd77447673471fdfaea1" +checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2" dependencies = [ "concurrent-queue", "parking", @@ -1675,7 +1688,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160" dependencies = [ - "event-listener 3.0.1", + "event-listener 3.1.0", "pin-project-lite", ] @@ -1848,7 +1861,7 @@ dependencies = [ "intl-memoizer", "intl_pluralrules", "rustc-hash", - "self_cell", + "self_cell 0.10.3", "smallvec", "unic-langid", ] @@ -4277,7 +4290,7 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix 0.38.21", + "rustix 0.38.24", "tracing", "windows-sys 0.48.0", ] @@ -4780,9 +4793,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" dependencies = [ "bitflags 2.4.1", "errno", @@ -4793,9 +4806,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.8" +version = "0.21.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", "ring", @@ -4903,9 +4916,18 @@ dependencies = [ [[package]] name = "self_cell" -version = "0.10.2" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14e4d63b804dc0c7ec4a1e52bcb63f02c7ac94476755aa579edac21e01f915d" +dependencies = [ + "self_cell 1.0.2", +] + +[[package]] +name = "self_cell" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef965a420fe14fdac7dd018862966a4c14094f900e1650bbc71ddd7d580c8af" +checksum = "e388332cd64eb80cd595a00941baf513caffae8dce9cfd0467fc9c66397dade6" [[package]] name = "semver" @@ -5158,7 +5180,7 @@ dependencies = [ "libc", "log", "memmap2 0.9.0", - "rustix 0.38.21", + "rustix 0.38.24", "thiserror", "wayland-backend", "wayland-client", @@ -5241,7 +5263,7 @@ dependencies = [ "objc", "raw-window-handle 0.5.2", "redox_syscall 0.4.1", - "rustix 0.38.21", + "rustix 0.38.24", "tiny-xlib", "wasm-bindgen", "wayland-backend", @@ -5605,15 +5627,15 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.4.1", - "rustix 0.38.21", + "rustix 0.38.24", "windows-sys 0.48.0", ] [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] @@ -5882,9 +5904,9 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ "log", "once_cell", @@ -5893,9 +5915,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -6553,7 +6575,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.21", + "rustix 0.38.24", ] [[package]] @@ -6784,7 +6806,7 @@ dependencies = [ "percent-encoding", "raw-window-handle 0.5.2", "redox_syscall 0.3.5", - "rustix 0.38.21", + "rustix 0.38.24", "sctk-adwaita", "smithay-client-toolkit", "smol_str", @@ -7026,18 +7048,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.25" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" +checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.25" +version = "0.7.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" +checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" dependencies = [ "proc-macro2", "quote", diff --git a/czkawka_gui/src/connect_things/connect_change_language.rs b/czkawka_gui/src/connect_things/connect_change_language.rs index 425aa2479..f52817e16 100644 --- a/czkawka_gui/src/connect_things/connect_change_language.rs +++ b/czkawka_gui/src/connect_things/connect_change_language.rs @@ -37,7 +37,7 @@ fn change_language(gui_data: &GuiData) { pub fn load_system_language(gui_data: &GuiData) { let requested_languages = DesktopLanguageRequester::requested_languages(); - if let Some(language) = requested_languages.get(0) { + if let Some(language) = requested_languages.first() { let old_short_lang = language.to_string(); let mut short_lang = String::new(); // removes from e.g. en_zb, ending _zd since Czkawka don't support this(maybe could add this in future, but only when) diff --git a/czkawka_gui/src/tests.rs b/czkawka_gui/src/tests.rs index f70a469ee..522f0faa5 100644 --- a/czkawka_gui/src/tests.rs +++ b/czkawka_gui/src/tests.rs @@ -6,7 +6,7 @@ use crate::GuiData; pub fn validate_notebook_data(gui_data: &GuiData) { // Test treeviews names, each treeview should have set name same as variable name - for (_i, item) in gui_data.main_notebook.get_main_tree_views().iter().enumerate() { + for item in gui_data.main_notebook.get_main_tree_views().iter() { // println!("Checking {} element", i); get_notebook_enum_from_tree_view(item); diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index 0204576af..de5a11307 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -14,29 +14,29 @@ build = "build.rs" # Try to use only needed features from https://github.com/slint-ui/slint/blob/master/api/rs/slint/Cargo.toml#L23-L31 #slint = { path = "/home/rafal/test/slint/api/rs/slint/", default-features = false, features = ["std", #slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = [ -slint = { version = "1.3.0", default-features = false, features = [ +slint = { version = "1.3", default-features = false, features = [ "std", "backend-winit", "compat-1-2" ] } -rand = "0.8.5" +rand = "0.8" czkawka_core = { version = "6.1.0", path = "../czkawka_core" } chrono = "0.4.31" -open = "5.0.0" +open = "5.0" crossbeam-channel = "0.5.8" -handsome_logger = "0.8.0" -rfd = { version = "0.12.0", default-features = false, features = ["xdg-portal"] } -home = "0.5.5" +handsome_logger = "0.8" +rfd = { version = "0.12", default-features = false, features = ["xdg-portal"] } +home = "0.5" log = "0.4.20" serde = "1.0" serde_json = "1.0" -humansize = "2.1.3" -image = "0.24.7" +humansize = "2.1" +image = "0.24" directories-next = "2.0" [build-dependencies] -slint-build = "1.3.0" +slint-build = "1.3" #slint-build = { git = "https://github.com/slint-ui/slint.git" } #slint-build = { path = "/home/rafal/test/slint/api/rs/build/"} diff --git a/krokiet/icons/logo.png b/krokiet/icons/logo.png index 1064e495efc39aef590c67b8cd65c910bb2761fe..20230dc8b74b165ed3fb9aa75a638e4fa2b269ed 100644 GIT binary patch delta 8026 zcmaiZc|6o#`}dhK7)uQyLbhxzB1=dzR5aO=WQk0OO0pB;Gl}|E!gnlXr-e`mS+Wh1 zWGy25HkNE-8$0uy?&tfv@B4ZE{&>vGIiI=CIoEZaYk6PS%sjSudL>d4HT}1gDALQ# zB#zxGeiEHZ!hKt~s`OiI%*m|0@%kdS;~5LCy zUDf(sreE8H=2`&CuJ0uJ{K{?C-5M`)J0+X83L^KV)jTmzye2UZ z*A)u;v3&>j?c53@$KDfixw38Z%{#CFqBy*I>DJTLwVEq9plbUqUiQ^^0sK21hp zJMR3@84cEzwkAaj4~-_iyOSr>1>HP(Ppn)D3(mzbE0{YwyehgLG&jD~74%KZzEo8( z-zQh>tLQfXP$5yGsC|gQ!@>0PZ!YupXnz(z?VbPhiCX6&-ZY)Jd{*8HrOUW@Wyym_ z!-Jixt5fQ-9y~3`*_{(Cw#GCvHS&5=LMrI_UaQY{>)mm*Kw4wJFRAUVLi5yPruaJv zza4a%#xK`V4sRR_QD{zWI%01`zBn&zyE?zHee_E~`Sgx3)2#tJ5@IYFu2ft2SoJTb z<1P=DPPvD~IK-?a-mQ7fu}90p=H`OX#LGr>YuJmp<&*9q7Ds$O{HS~9aO-pXXA`sb zgSKCbEXK;~EVDZ-Hj}qP)56*SBzzTcKo^wY9JEbzDgw>R}3JceG7|vA!%XX;o<>U6`wqIoSDq<;Pa{4dC$B zJX2_Bh)Y2J;>xG`vdvGME3SrRh}PvCd<_l5v%qI`3 zDkvN~uBfE0qN;pMNm)^XT}(_&k6?J=#O3QAo;O|ZXi6v^J*IF}NjWN$StRNhi!s-+ z6UUBUQdBr`O#Ot4@?nKzQIRYn|BF~q$+8<2^_#`|fQqAvnzEy^y_}=Hg1Vftl7oYs zosycmoSmJz@-YVo1w}Qbs2i*Vu48ilVXFe!7F4r3V^1CYFnkFBz+$JbcLp&2yizMN zq9BFM?VP1207nn}`A6M-qvZpMtX>4ev#b*wTs%CgGIvB$qi%7@Ai~UqGuoH#_RRMC zKRd0LXu{{fGNM6J<{m3d;JokQoZJECv8Pz|%wl>Yr!Q?owthJQRch z%R4A8_yAY9fPlci1pPVxfA#pc3d>1Le^h`g6c5LE{8}Q*IVgR!!H~?hVims7NJh)Rw;H60a3>4W??1f=g3Kl%kf*k*67#$J>b;u5@ zStHVMd;EAH>6C}p<*h4+SA;lGMfQ-{6Gl46&cmKF&>Wt~9FTP_J&qcvl=4;S%ioH6e+nw#V~J$EA<%)h3A=MgMLn3!_5T>Hw@znP>gZlZPVhWL5Z9c92=Ky7H zSe&%LIF?jnS#rPCafJPvkvo!5IC%9Zm~1*_ z42M)UTd7LEDwbV~TRk z6FKM)<>AGlJ^u+gIFXuvQ;&iP2IMI%0JQ@GdYiw0;2sRJU7-Bx406GefP!Xyda}XI zzfDp8G2nJ$95DB^BcEV~6gg5tE2n!gs~B*Lw!dhLEzx4E@>0Hs+Ww18HLxvB(ebAdTke9n!X3|0AD?p;;*_jb`(=s1#}UhJ42j$ zx;|&*kp;t=o3xxG6&sGkpJxo}ci3wQ4wtNYA_&M93fR& zv996Q=+qMbU~3>faMj$5?vv1iKc1L%O9PV_OU(&RMjBR-BUpgO*Vk2@*VJwsmR!AL z=H0owqW*CFNL9wo-as?6iXV>0*SXxR3ue7Ox^S>lsJnTmXV%Tl%+&LYZcf}##Ryxv z^HNUjR#Wq`+_K5j)7MTlj^N$PPWmp41xO_|wXS5huQ-^atW~J5=vsLXt9{VO# z9^6Vk08%2UqvU({$V`N*`L!=s9o8EV$|UM|xHksWrR)u+n8pJ)v4&DZF*UgcLMCmy z%6CPJ^;!qZ*4My4Q02_Y+$B|NOtv>QX8DNJSMz>EYeC=l!kRQ1kp!N3}{0j z#h|z_TO>5VvWsEX7IgVxg$O}i(1VGj0KDsPQh;=U;vcb(=eDcR3(<2BchU2s5NJ&~ z*n&x-XW@I^5awNS0AQJQNVKbR10--(;ddz;0ABmi{(CSX zB$WjsIP1zk#k@aJ`)UYR$xGO)dCU=eL z_UkqI#fMS;c0-q#@J=xn-&qCDEZDv|#hD*#v>-_OXy#BSlImN(dG_hjkpl@!w!p%E z!F&yc*@YtN)Y%TR3cMkNp-VVmm1|p1NDVv=&We(L$JM~J#8F-%do?q(N+gDP@!G@Y zTc}U!0}^2Q<*KVah70}W1UnG}j|qHU@D-~ctLDYwm@aOigdY{FPW7VdPoh(wFy%e= zSNLmVl$SK116LE)0)qnp68P8DcI8zm*9G_t0skM;|8F{N!Ui-|6PlILKo=fb2#1_?QQ!p;3tItV z_0EVu!Bb6H(p|dXuT}d?cJ#GR_aqEl$&IuLxRnK#jH@kep?l~3qLw5 zD}M}DD+6~gVtWV|xO^czN`m-*57Huk;`CEz zb}xVWDV|g=K;r)QhMu1Z?eH997b+Nls7bv4UOdtradUtGbk70-qZ%F^aO0UNus4#M z!+;m(Wla7QEc~BgGU00C4?bv8EC`(Y>Wuy`sr8O1K>BdmivKuFEZLp^SkoZRlNAkM z!o%S|)Vzb^um=9qB>{lI!vxRaf6Ocf7vS#yHBm5^{vR@B$n3QBO%zeWQ3>}MJ=rL3 z2@n3uzp2-anBaNN@>r;3y({WZF9wAX-^B{*dh7=ZUzrB(hTBxcDd9oh0hB^D!Ucu> z2^64EZ36fGiWO<}6$EZ!!hI81z=_l{xgCMP0gH9ZNLD+v+J0s(aN7%3WI#%$yM^UQO)MwK-UZ~V=ahs zyJyvU4&RG9h?g6#z}_!XHo+O-b_TTR=$P~b9*sd{bL z8v)9~jj@6C?+61yvlF`B{j_-(;4EGpG_w)0BL}MVR{NkCV=AZ6pVqLiH|Ok6R8_S=>v)piUcU%GW*Vf)K^M(V|15Bb62GA zaAP{#z6)3^h)&&ilZI_vFl@q%PXaY&inNav*obCPU?-jd0vGgPGIN8lKj1DH`7GW1 z6^iopX%#oXXuU!Kc9bqUj0M=!wuMl5pezUs^422K+hrgofp9aVeLW`zK!j2l{u>(k zy*Q=rK3;ScVU17;0nfhWu(`h%9YSkg*m`8S)fG4&@4cX|3lt>4uT~lV$VbnluO2|9 zP70xZEohkA+{51Xe>HfVbH+=7TNuB<4B)k`#I!2$)MZGb z+<3Bc;RKQqhyw-cxe5DFM6AXGF3^5(>vX2R4GZb|Dc9mMtmElhH$q?n@gk_yF`qss z)AYJ$mzh~Yk(oL~x!!zN%UgImG-ZgL!R2i7F|Fur&u#q!;GOem(j}?6S_hdL98-U| z_nF4tmy;u>cC||CF?E_@9-T~xBjO{9XVc~oi=PjBU*38p#|(7&(48hT=?XEKk*RBk zcans=99{TmnGAqMALdtFiss;WQZ+K@4kmYXfwr;TgW2EG){Kk$(?#rfkv+ytpHW;@ zRkQ({;o?ykH>}9R(*2x%%f#9`(F4$J_CoPr{io?1U}z|8_O`^dhUpqJaBKU5tSBeZ zFD*|LN5HhhgypO$<*jf7w^Wwi*sBbf7HW7Vb_Uje`KgDH*b{~ujw_vN-``ugTprMS z>GYk`DDW_Vn8?QRE^Y1b#%w6*YVjLDdN8!MJ5p*|Mv~%x8c%x=4Fi0J`TfSE$qDQ` zk#g!?aX?D440xB`72}nGe9!8>-RX_Zn>GHc47@OKWfyn+t2ZlP{TLeT4)$8=_4zS& z^>v=S;vTUrI}E5m1il}?RR*E<#SJ_knhOvO>m3a#CpbJKI7(b>0Z4V#L}12CU)^G6 zgMjeo4e{q_p)@hZMLSIo0K6<7KrXzSO>!VA&LX!K-s>1Zx*1C9rgVv-fG{QXjmurfL2UrEgWd0F6zp<&UgV1b2x%AJrCNxZ zL!>VuMYY|*y)#Xf!4Qr5xbkicyOy~f-uZ=}e3mulQj|YypYkEl9s}?)h6{RtQr(6k zH@K`8xnO{_JC|49X>6WWs?2BbZu*|%^#oQ0G-Vk*al1AJH$>u;i@-El`P=rMAU%*^ zVnY?g4s`kK9-@53bLx;>c;JU5J8_B+TNF395VG9Lb5ZNDdvTTd9b!ee{^EN=4#DFz zxi`u>fx1p;St&qK*3gt4N!q~mK-d*4ZF{waYsQ1g$GL`!^ENx%m4xK%ILJ}p=;6tm zr<@yB2cA>+Gt+FP{KzRUS4AxInkH^abAh2yf{0mO-x9gp#FIX7khw82k}6=xoQ?Em zunD|%HCSv49vg_I>M3`L^3&O=4quiJ-{o-|otpsRO$p8ZJn=*c;Q@wTLblwz;U)irkbIvVhcgdkpQp+9 zKBdG}y0MeQ{Y=QMau##zhOXq{QkjOs@l_wzt+eEI0ny!9e=!VdpG@tJe=4H51yhUT zlLGzh#ijBp^{*nG4$Dooe?5 z^%<4DL+O%L`P6{q7;3rXgrvF(Jv7``s`NdZYM1o7e8L&$q!d=^^}>$g@uZHebkUnd zX*j9%X-VJdZKfkmF>xS*u;_F!;WuqWs?()-ecrab)_E?0nnAWMuARPP;kN(i4PDg% z+cnL>1S)^QMxDbna(6Ffop49)?jWM?;ixz5Rj8**bGNT{>W}kJZ=ex8M#w3?x5*Q) zD~r;s7HG!%jYydo(sOvp*t&*%KIHguU$uMo7>&!Ifxz(%=!i_@I`VnOp}u?g>7i^uAhV$0jDhKtp~t7SKhh?aWbSBn3Sw?$9p zZKc*ftEc$go4T2WD_$!_1BJ(6{%c2jMN2?G>%|nrwzE8V>9b?0tL>0j;8@3U~d_jG#vGd-@aB-6$a%ujG zX3lR-U%%S{HdASgqNE>~(oNbtt-j~kKC~|iX_G0C%q4i}R_70PYHRzQS7OgA4h8cM z2qIPE^g#cq!(H;zL&YbK(N(axq=LRQNn<0;R^)kQRbB;7+RuE-S#{1p^QG6dsWK)X zPoskOr#kOE1t5F#zND>1UfYk6g`bwG^tB(mm_wKKjoNCZYubiKW?%@B0 zB$=-Dr08#7h{NT4un9L@>?Metaw~~S+Y#*aS2H=kGYS<-U#s`UEn;4!0y@#J(Lb8@bM=FDbz$3&6-$;{MWeNoiu_?nLi zwS-D_x`RepcZ!e5Nzdht^4FHFe#t3RKcS7JN{I$G&)D@CX~~!p#fC?|>#LSLSZzR( zI-=OvqtD_0%|+uE@1p9_g&uk2sKvNyJa^=t;@7v=Hr(Y{NlqCv*9_$K1Lf+|qphQT z>1dj-Y(q+u<@nNU4TP>BoPp-YThD{U>3p=tl2l^c*#~DE7Wp0N&Qf=7?kqKgx&)oQ zcFrP$V`6J_Sdx)H6c9vgsnVj{c?>{*i6mV)+eVFCH;(!>72SbTibp0|`R@%@HEfB` zY+G*s_Eddc*-SI*-l_TgejuJI6u;6FZExCoz9gaIV41Z2^q_C6Uu#5xz68Mg_Rcn% z28nka+L7uVl)gN|!ya3zN#9y~s+O2<%7U|6C>tDDo{E6UqLP^#QQ}nFTgRm8WuVb~ z6l#*ad11UYBc+1}`MBlAI=z&8xO^pux$(&6+6cKTseHt@3jRDG^vSs0bfD1m_;P7| zw+lBQs+gx&eq&^FaP$>KB^Hl+Z_xOz2HdMwEY5YWFoFV~Cp)TZZI?WoJyXU7yZJ^v z)7I;ZpP5coWe4f+?=Q_5Yg#rBsO0nxt5o^43a<8BKB_{7O-)-jiV2R#nNg(senwMq zZAJdxQv~1fQn4lZA3f3Jf$jWa<=AB(+RWPKjz_1KM8T~9CN$8@Z(kpEl3cf_o<n(=G8M=5FKHK-E z^!i#nO~@Ja+x+K@sr6XN!Fd10 z#MdH!m!=PWlsD);@|Vlz)8OmL*NV|7(zUhej`oEXPmd{%?;BKKj#xjtZ*#@QQ9rksTPaz|H!JgXH46RCgi&oOOy@M_LkRS%G6ZQ?f) zH;|JN#+sOZ{;KEHjo|HhdK|LQSJ_cJzZ9Dtzk204ZtufL&v^RmV&Z0k5~JpO1tG{e zl*{enRIf-bpMA+<&)GM*ntdUUk5+Cj5OU=1rko~-{2Zpa>ymL!A6Stc>#oA} znC8Ksgn^h1iI&>3@*Ic7v?$X-O_O{PQD@z~uzN|Dq#1ck$0Axok!S-I0KZNAQuE+9 zKV1??HrVf#MQ3km=DG#;Y|KrloXvhsN$wt|EyV0E^u7tsk*jX~UcvyYQC@J`)00d) zXuYzy>=d-7b#9Sq|Gh5}i1$`Sj$wCUvy-&n=}rxorOW1TlEt#*uex@f1*D%9N9k>A zCnt`!9hj@(Aa8w+AJ~k@FV$PT8cTh~+!z={PMLG7IBKZb>?LZQJSKX07aH7N2#dC{ z+1^h$m7zDiJxZt)r!z(NEb0>~C9^e4-OP;jyPF;Le(pdgAeX)M$+?YNYzdB;qRU>X zwccfi8XjCUHtP7o^dL*p)o^i=8L5JiobSa5V9PjD>wJCRRJzP> zlJEU^GVNwHHO;g0VaPM$b!E#4zo~Kkj50i2MwuGgcaWpox(Lzn1`nvqoofbcn(K2VPqZe*gdg delta 7743 zcmai2c|4Ts+rMWF#;)v9ILQ(s`%(-=P1eXRraH-*Ez8)Rr?PYq8BR&I5{g1uvV9hvLO%W`-`Qq`el= zN zg1Mt2Zzq{T9ELw$ju;MFR~v;oivHbfEoT#DooC;ANnP?~-;~-N9h>zW^M`D;aF?#7 zPvpZ6_qT45`sh;oh{2Pj&kzLjNN;z)o);cd0-#)#|3P;ej%sig9xn20TRE! znRn&izBOI$e%EMc!)&9+y#ss$d@XJy?WaHBwf_+8Gn5##aVTg3JU;J|*3HMPQtO_V z%yRsZ!#;*$>}BqgcL;_q_m9isWr7omLpL`=1jg+~rf4GJ?jx5W*i0fpx#7kBVjeRu zYmPSRhfCHZt13AZm%BKX;9WE#$$b(Pv8sTY zlZFPyFfOI`$I|>r+X(Gs*USPl#mbLzJK;t?035+?7i@3XmcBy!qLPg{Cz!7~Co;3paPo`?5mKG2C^r2v)f6YR8(A?z8^J+%?$gpYF zVEuyTaJUxgADsY5-r8qK+Rq9Rej291oU*HK00kPI>zTNLpzBia8`P|X5JKxwl6|=> z({4-5IOHG(0B(e!zyM_l+T#~RmVdVpGA-CdM`1u}+Eo}K@iY{|j2z3^WBr%Q`rWE7 z41o5J{WxS3c>*Ca5uX2W{6`#tsb}w)`Ocmkgu%U%3m|6!76|S#h=G4Um*^iuVg6x2 z#QiG`1GGN=zUY6L0U7}03_`r7HuqFOo+v&_l7#-}2Kc3#3TjY}iaD7R0P~k9ThFdt z0m?vn6QrVW?|NfUArw3utBXkZ@1=G^0v9E^$3sJ;{r9qZ+aK`KDc%=aXx2GNpI1=> zpGNGKoNZq@U%_@HqFNBfU&l5*+#W(qicc&d~J%S%vCm(lMGe2jc4MI0#JSPtLAr91t`Yceu6`G$x9e<$^+d zU~RGV+xzi^&S*qmeZ*|sLP7dZNF4FCqPxK(G#0R0=^n_FegXL+ZYe2Ozl9|j z`90gF#}te?{mzx$Ku^+b$bq)yLo#WstBrl~$#r7L1d**nB@I13x?{k{G^0;8zDYg; z|7vIVEoVk7X&p(CLeEp?xKN%7J9~MEYj*+b)`_Pa4Cw}>!5;?#kM8B7$HsjL8>uQK zinm9?J6}OCeNemH#rd4yjQ!CBA$T%yr{5H_8j9rND%9sCWA>v)mGT!N%>`_GmxhQK z`^ArWGm*U!EZ8pY+mG&ft^Z_90Rvvd=E8|}#@_PUL5=m6UQU~Hdr^;zxOAf_o-_aL z4o`M+wDqjLW{cXk^GYItmU}bGkjxH`6>oBx@7ss~d#N8w7rTb42(coCN>&+>O3R^R zVnBL_mF}aDBZa9^SY#FsRH;u^3+J%ZYsVlV%RbdeFUQwCoT#4h4PR?lm#C7Vm>8UQ zd|JbygmKJRPDlzR&9-^Q3`e2~-?yvxe|sHAzly(Z>UU+WuYU66nQqgFpzgZR*eAg? zMLkIgmb`JCs323n&%B4}Zri0|0Kx*E+i##@|Hnzp=+!|sNObbCJfMXSNR5_lomp)2lx263r<&cvOQhRnk1R5P6cH7c+3f z=+a{_-I{<~%AXU@o+dANO~1?T7{P*w%2?gcX)Hh-WE9_RbpC#gMKAjfbnv7;TE1&7 z7Z$L18TVv!ok6nd+by=Xvwl4(P=syVD|mNEg-g)*b$U&M>}HDwgO496nKX2g@*GdA z_+iH7vfc=hXHi;BN=PBLqi>Phtx?~;O5|U-`K=8nCsQLSK%Yh3@fA+DCpbP>t)oqbpwHx2+jfI$hHBNP=0go}ev zxTQ0KAOM2^41>9ir!-Pc==(M8f`rgt1hsoe4PXf4SO8A3vD||1{(;~t>-$^L`~cw+ z#~o$^;MQ&K?3;`LzQl|cC;T;(F9KI^rp7}<2xMCyMBDGjM8ZdWwFy8{AZ|^R-$#SY zj+@dxj+45EX~AF-41>AFFgI%X1ItC%pDHs5nsej_vVeY&m>incukbq9YmL`%!Rb?2JCNppVO{yT^^F zFXt~cSjgRx9{>y)rYAscS@yfm*Jo^N54>CR5*HH(1bFLGRAZI8cy^*JDxsPigP;ip zMzu2mbB>oa{s|WpTu|E)3P^kbli(iIlmd1YfJGs?4|=js*O;=RqBuDfrE@fAaGh)K zCZp$yHyI#7Y@4IDmM}W-Cs(X4uCQR$?^tr6wC(K|`HQkN;2}fPCce`fKJN1jMY#I6 zZ71{e>7}fEog1(3b1sR%xmJHR9?A}&QZx9c&WBX|s0Sq<#)=mium{j&IJW*hSBKH< zR7M{@c#Mm%sE!lXf}e1a7uhc{;g*;Q`GFzE^^m{8dvREXwSJ7NByCq7jgvK`YaNEU zJ9_Pq#)fDlwO)U)Um++jxKijIB1QLvQ?UZ`>i>+aBAXWzrr?D7!* zKe7SR!I1xdw*Eg-{e&CXUspNchC!eOfZYs4atj(Ll96NpWX`6z@Xh@-o+70HuqO%u zAoxv=d`!4W4$)0+Trey@E=mZFhPcJBpu2N*R7hMgqk| zaS`s912LejL>&fB**!$jxH~4FKHU3-ArCy z&*jy8@XowoDK{3-SP;>_6p(9h-c>cbIENn4Q%MXe%F%QRDp;7~hD9G3g4wM5$~-00 z;C#!HBMLz9rHPpPVbL!WiTb$XP5z8~8T11GYHaEu3XrFrgOM9UN&&npwl_x+AeD{j zFzP9Q+h&}8bvcG!XOeaPm7r~Y`aGqF2~=xuJ6m1+^(DdYPbRV)`DjEKV6r>-J3$QT z4D52~z445if!dE;vUwaGE=>!BY|$Ws7jaZeMsq6$FllAjxT*+4bppPBiIqg&G;E56 zY=R;Wqi}n9(+GV-k;OsJQVwIbi5r41E*O}TL!t#q4RSol-poPSd4#A6gVnd2k5ITp zWnqxbO^_sef{u;OdLe+pm7>TX4)SIS|80!3YWf0X|2xMRGFiAm-vM;G2)1l#!+Yvg zBzN|CH{&}-;S5sPTVtcGWA(Ecy{>!au2__?fDD(Liy=;?!Xb7L~op2H37Qaa?@J7--KY$V;me zppVQtt7_Dyu^@tGP|E}bS%fRa1C=(UFV>-%jnK6|A zU1-9S{5qEKz($#e-PLz=euk^i7V>xCjdL|Z!A?=|Ro)tLxvNJd_NJ6`>mE4m7<2<3!@PMdMu6B0N zx7F1e(J|S7TU7vR0q|I&j>^4uudfOK&QRX&$LTDb{Vo8=roy{!kVckeXV#Do8tHEx zHDhK?17`p^;lQeV4h>0@lG{wYv_tXJLCsfTY1;6xo-HZy>PGm_sw%J8V{aY6>WBoI7<|1dTL`7%3%JhMI!4_&Z0LYa&8&R2;uiy2Ntf-zBeJ?O+VIr z1b^&H8TnonD_pVBUhnL)q+oIAoW=_xN*Q#RCgPX-WLUQY@H$z4DpN9&k*V~RDg=3v zdfn`C0A3FXNlTjW z-AR^*0mVzCBjp>?6lar7PIY7Hj=}*aVC-{_KJn-KUpv7Kcecz)q8BYf=_8Rz+w$Gd>Np13V3zeG zTOT72&P^qUK}OdA?fOl|$+P04&MQs|XIGY+O!V9iQ|P8!LJ`;A2Swl;{EN@}H61D2 zD7N|j#I3u@*`t3Qo&8RlQg5cI6b=!algkEpfvK6_3Yx9ig(T4Zwpa7HuH);66AwAE zRz`SS>??Fe?rpDtK&dVB27l)_k?Rp(BHJT0C@c9x^Myl*ZHtvGIW==l!Sp{UczG6( zlQJdql`pSYa?6#pA+a@^GP)v*{9qd4O;S)jvEY0_XR1qSYm=VT)LZxvdgyCvy8Bn; zBYZ@_ySd$I33XFxvO?91N5!8QKW(EI6`KX}&F3Kw5{ zN7q#}&oPpD4{2P%YAA6~Kd3Uoc02DQ&rgbeJ+bgKB}Q*1bE5{jlId^#vAEplI!W1` zHdxXs8W*B$k86UntFaN$8Yt>tuuzh&c?)PLQTx%bOX!A%h(l- z7|UavDust1yFes}ZtRy8UB7#}nTNr9n!JuifxH`Tq%#s*<0)*Tvt?Pj%9HMaP31eG zhtj$IX7cjXrFaKoq^cTtAAhTmpj(C~Y}_Sg)JSUj57twYz80(c5J_C^ori3!1{WsX z>Jl4r@exXe&NIZGIYu;?C40#{06Mahc<(oJ->Py_f*|Iw{#fd+AxX60*5_Y^{qdhI zocz@0jhB)4+|V0u%R^dyO+U@GGxR<3v%XrRaKS(uKcbpfIal=lLr-A1al^HcGtE4| zTmr6=t{vHW7=1b9DoN_;3HHuh#P#u}g@)0i&8t%w5!2q5%Jz}KvM8(&%GRG!y5C;jjj zR!iRLL~no5st^GFTIP&5-2}?E&bsKzhNpqW#T3ggjr$KJv!3gEUFSWh6dQ5f8%jJf)bE*j(93f*KFlse~t3iN43(vN6Yh}CLUzbb5(GQrG-;hgyR~~ z5b7Qmf3BOLdp9VbCPCpT(0`*%+5Nb)QJm{|-luRQeyirL{NZ_K^|1SFQl2pe)!xl( zJ3#@Sq3;GXh*5Q#>C35$Hzn#FSJZPPHtgSr>Z-MFJgV26ymeCG*b>#*;qDmpLUMCR zYBGiDc7;YYkZEV@qb+cH3r{8%fF)5GGw9O`*>rEa#USn1&pJoaytcp2tk6tiDg;td zFrz^1O2K=pYeEkgbgsYmo*9yfrDV1Q{j@z_d*=K~sBX?tT2nl6q^9Y_)VPd|)zExP z$^*Vk>lMvoCd(AYiaGT{G(A1qF6ttlru3%%+~c`HHVm*W@%VCLH|*D~QSX$T;zVdv zN7?rsZ?XRXI^u!1(Qeu5!)`h9{PC=XUDcd#zP(FXPA3!G5JVRES|Mt-%phYUenNLG zh~JoWCHd{qWHTMluDzP62(~6Ux6H~u&v^KwbgjNRa`ej*kKqq>v!w&|ui<@@`IbfI z57OR;_oQxA9-Y+W9oN~YB>1>Dk3;k01HsCZlsj>Y{St{o%l$}-S(DmTPfU&AX~$b* zGzQCRk$7id>a=&#_Ogl#(5O>4$h=Wn3)kDK<~74lO`As z_B#PjU#EmR!`)=Olf~T7FGFuGQ_bC>8@KN(sJFk5kE$*hx|zr zn3`_b?=|2g2FRo^okPf21Rsqk7D?Tkf{Mi8FFCHHMbfE1!LlqQTd0orxjfJj{7$=J&vBGCcl-Yc&SVBlFXjIedr&>ow2M>$m=X1v6fJowTgA-eozG zG+!AuHBs)Jd*UNK*Zphg#WIyX0 z`9|N8B^jP8J9CvMt%}B%qY4^Q41a$ijz5ibKi*3kT4!vGzn!&58?s31y>@AMi|*!g z>C-zyh|r8~a9^UvAut|Prc^M+0yyfe2avwJb$*Ss<-|6cZ2szn z_QcuS=SB8j8s3@JhbB72v)3|)#r-#CMj5IPy!~o94?)u!`P5X4DK&L8a1d_mQ(Fz0 z$C9Ftm*xK6S`_`5;>)mI)L)Ip=*s!eSYpqG?5AETxf4t9nMEbhGcK(EMNISRpaqW7 z#U(S6Z%pqzf86w`F>AQYS`mKr!?lS$m+LPbnckS*!si!6e=_)5OU}|xr`s6%o?`Q~ z!SV;_mNh5##kcqBk6yoWwZHUPN9~RwvGM$S$DtjW(Tvor+bmGepRc{*O}dMOl~mPN4qP3a_D4&>-bKB= zVGCDSZ@&ET;rf;JL$|VDe?LYz?`_}f9QXl(<`naw5DU%O6eGBlG%MIRrO)L76$(KK zi9Qd_RB{q*;~c!(p!oXm`wEz64T=Jd88v%Sxe7kB&dcT2<>WDSm5iQMB(4fc@KFH3 z#Yr^mb2;52dT#VQ5tSCJ|WibAsmP8GZyOehH@iWq%-HLh3{0w;J`J7rBv zAAtZ*21SJ=c_@{trlv+&qgD!DhYHi{^(qus;Wz>`5V6)R(LTg2#>o%?j5JPUyu3%^ z1ve~X(l((=GAI;a9Uk@1+u`3sCY(yPm<$SBiQbb~oU~*I1_nho@2>LQ zTgc;GT&_gRY+_nHsn=+=8VyEj^;p1XKVClP6+tD+m>8;52Ug^?P#_pUEG^e502qyu zO7(KIBzW@#!D&#)5U^}HwrmFN#L^O-MoSz3MR7HSp%jkip*l)UQfl=I6sOQ}`U1<_ zYyX?J+&pkXAmy372==e_ivk^$%dHJO1siEfP!o`W`3%OrYHZ$*a3)XI z`}i3txBIvQfS%f9Qv6QQHAUB?7?_muRCP_!H7N!rr94$#|2Miq?wuGpH+a#j0q4P@ z)r;qXv*b+M;~8ntUHQB7$ewLL@}MVkjR--?IQcit*Pd7ngh7(YYz*oPiJbXJ+@YN8 zG9Y?bG8Rgyf=fPlK>qh(j)iM@sREYYhYOybvj8Y{n9`E-3Xcus7ti?s4t?vyP+80O z%Hnkq|M&yj|F-qwPRpsXGL^V}Q&{uzu+EL=m!7RAi6dppl04a)a{t18Srs1KxciL$ zgM&}b4gJcHl^GWDq9f|lg!RD@(B`9#U+rmcy||?GZ^3WO(6k-3orWzP1G?WN?dmR3 zusbf_Oxk@z;#O@Q3|bJ0pM6jWYg-og(Ki>qKwm4b>T2>>_65J#aO%Xj%C@eS;FRYU jo~VClx$gLxL;cY5)fu< \ No newline at end of file diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index a385d5955..ec95dafa6 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -12,9 +12,18 @@ pub fn connect_delete_button(app: &MainWindow) { let active_tab = app.get_active_tab(); - match active_tab { - CurrentTab::EmptyFolders => handle_delete_empty_folders(&app), + let model = match active_tab { + CurrentTab::EmptyFolders => app.get_empty_folder_model(), _ => panic!(), + }; + + let new_model = handle_delete_items(&model); + + if let Some(new_model) = new_model { + match active_tab { + CurrentTab::EmptyFolders => app.set_empty_folder_model(new_model), + _ => panic!(), + } } }); } @@ -32,6 +41,19 @@ fn handle_delete_empty_folders(app: &MainWindow) { } } +fn handle_delete_items(items: &ModelRc) -> Option> { + let (entries_to_delete, mut entries_left) = filter_out_checked_items(items.borrow(), false); + + if !entries_to_delete.is_empty() { + remove_selected_items(entries_to_delete); + deselect_all_items(&mut entries_left); + + let r = ModelRc::new(VecModel::from(entries_left)); + return Some(r); + } + None +} + // TODO delete in parallel items, consider to add progress bar fn remove_selected_items(items: Vec) { info!("Items to remove {}", items.len()); @@ -145,13 +167,13 @@ mod tests { } #[test] - #[should_panic] + #[should_panic(expected = "First item in normal model, cannot be header")] fn test_filter_out_checked_items_one_element_invalid_normal() { let items = create_new_model(vec![(false, true, false, vec![])]); filter_out_checked_items(&items, false); } #[test] - #[should_panic] + #[should_panic(expected = "First item in header model must be a header")] fn test_filter_out_checked_items_one_element_invalid_header() { let items = create_new_model(vec![(false, false, false, vec![])]); filter_out_checked_items(&items, true); diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 48c45368f..56b5070f5 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -26,23 +26,28 @@ export component ActionButtons inherits HorizontalLayout { out property name; height: 30px; spacing: 4px; - scan_button := Button { - height: parent.height; - enabled: !scanning; - text: "Scan"; - clicked => { - root.scanning = true; - root.scan_starting(active-tab); + + Rectangle { + scan_button := Button { + height: parent.height; + enabled: !scanning; + visible: !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; + stop_button := Button { + height: parent.height; + visible: scanning; + enabled: scanning && !stop_requested; + text: "Stop"; + clicked => { + root.scan_stopping(); + root.stop_requested = true; + } } } diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index 85196aa5b..77f663bf3 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -113,7 +113,7 @@ export component LeftSidePanel { alignment: end; Image { width: 20px; - source: @image-url("../icons/settings.png"); + source: @image-url("../icons/settings.svg"); } } } From c27236e644aa2e8842254e13d63ada8599f78dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 17 Nov 2023 08:20:24 +0100 Subject: [PATCH 054/107] Removing --- krokiet/src/connect_delete.rs | 31 +++++++++++---------------- krokiet/ui/selectable_tree_view.slint | 4 ++-- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index ec95dafa6..94a06c263 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -14,38 +14,29 @@ pub fn connect_delete_button(app: &MainWindow) { let model = match active_tab { CurrentTab::EmptyFolders => app.get_empty_folder_model(), + CurrentTab::SimilarImages => app.get_similar_images_model(), + CurrentTab::EmptyFiles => app.get_empty_files_model(), _ => panic!(), }; - let new_model = handle_delete_items(&model); + let new_model = handle_delete_items(&model, active_tab == CurrentTab::EmptyFolders); if let Some(new_model) = new_model { match active_tab { CurrentTab::EmptyFolders => app.set_empty_folder_model(new_model), + CurrentTab::SimilarImages => app.set_similar_images_model(new_model), + CurrentTab::EmptyFiles => app.set_empty_files_model(new_model), _ => panic!(), } } }); } -fn handle_delete_empty_folders(app: &MainWindow) { - let r = app.get_empty_folder_model(); - let (entries_to_delete, mut entries_left) = filter_out_checked_items(r.borrow(), false); +fn handle_delete_items(items: &ModelRc, delete_empty_folders: bool) -> Option> { + let (entries_to_delete, mut entries_left) = filter_out_checked_items(items, false); if !entries_to_delete.is_empty() { - remove_selected_items(entries_to_delete); - deselect_all_items(&mut entries_left); - - let r = ModelRc::new(VecModel::from(entries_left)); - app.set_empty_folder_model(r); - } -} - -fn handle_delete_items(items: &ModelRc) -> Option> { - let (entries_to_delete, mut entries_left) = filter_out_checked_items(items.borrow(), false); - - if !entries_to_delete.is_empty() { - remove_selected_items(entries_to_delete); + remove_selected_items(entries_to_delete, delete_empty_folders); deselect_all_items(&mut entries_left); let r = ModelRc::new(VecModel::from(entries_left)); @@ -55,9 +46,12 @@ fn handle_delete_items(items: &ModelRc) -> Option) { +// For empty folders double check if folders are really empty - this function probably should be run in thread +// and at the end should be send signal to main thread to update model +fn remove_selected_items(items: Vec, delete_empty_folders: bool) { info!("Items to remove {}", items.len()); drop(items); + drop(delete_empty_folders); // items.into_iter().for_each(|_item| {}); } @@ -75,6 +69,7 @@ fn filter_out_checked_items(items: &ModelRc, have_header: bool) - let (entries_to_delete, mut entries_left): (Vec<_>, Vec<_>) = items.iter().partition(|item| item.checked); + // When have header, we must also throw out orphaned items - this needs to be if have_header && !entries_left.is_empty() { // First row must be header assert!(entries_left[0].header_row); diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index be8c4f4f7..f6b8de328 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -15,12 +15,12 @@ export component SelectableTableView inherits Rectangle { in-out property parentPathIdx; in-out property fileNameIdx; in-out property selected_item: -1; - out property list_view_width: column_sizes[0] + column_sizes[1] + column_sizes[2] + column_sizes[3] + column_sizes[4] + column_sizes[5] + column_sizes[6] + column_sizes[7] + column_sizes[8] + column_sizes[9] + column_sizes[10] + column_sizes[11]; + out property list_view_width: max(self.width - 20px, column_sizes[0] + column_sizes[1] + column_sizes[2] + column_sizes[3] + column_sizes[4] + column_sizes[5] + column_sizes[6] + column_sizes[7] + column_sizes[8] + column_sizes[9] + column_sizes[10] + column_sizes[11]); forward-focus: focus_item; // TODO not works focus_item := FocusScope { key-released(event) => { - // debug(event); + debug(event); accept } } From 87d8f90280b7e53ab5477a8e65bed00abcdf60c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 17 Nov 2023 18:14:04 +0100 Subject: [PATCH 055/107] More --- Cargo.lock | 1 + czkawka_core/Cargo.toml | 1 + czkawka_core/src/common.rs | 14 +++++++++++--- krokiet/src/main.rs | 3 ++- krokiet/ui/main_lists.slint | 6 ++++++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de3cfdacd..43bb10cc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1305,6 +1305,7 @@ dependencies = [ "rawloader", "rayon", "rust-embed", + "rustc_version", "rusty-chromaprint", "serde", "serde_json", diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index 36b6c1ef2..6aefb4dc5 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -74,6 +74,7 @@ anyhow = { version = "1.0" } state = "0.6" +rustc_version = "0.4" log = "0.4.20" handsome_logger = "0.8" fun_time = { version = "0.3.1", features = ["log"] } diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 940499449..e4e8c8073 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -18,7 +18,7 @@ use image::{DynamicImage, ImageBuffer, Rgb}; use imagepipe::{ImageSource, Pipeline}; #[cfg(feature = "heif")] use libheif_rs::{ColorSpace, HeifContext, RgbChroma}; -use log::{debug, info, LevelFilter, Record}; +use log::{debug, info, warn, LevelFilter, Record}; // #[cfg(feature = "heif")] // use libheif_rs::LibHeif; @@ -58,11 +58,19 @@ pub fn setup_logger(disabled_printing: bool) { } pub fn print_version_mode() { + let rust_version = match rustc_version::version_meta() { + Ok(meta) => meta.semver.to_string(), + Err(_) => "".to_string(), + }; + info!( - "Czkawka version: {}, was compiled with {} mode", + "App version: {}, compiled with {} mode on rustc {rust_version}", CZKAWKA_VERSION, - if cfg!(debug_assertions) { "debug" } else { "release" } + if cfg!(debug_assertions) { "debug" } else { "release" }, ); + if cfg!(debug_assertions) { + warn!("You are running debug version of app which is a lot of slower than release version."); + } } pub fn set_default_number_of_threads() { diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index e520768ec..025ee58fd 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -34,13 +34,14 @@ use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_show_preview::connect_show_preview; use crate::connect_stop::connect_stop_button; use crate::settings::{load_settings_from_file, reset_settings, save_settings_to_file}; -use czkawka_core::common::setup_logger; +use czkawka_core::common::{print_version_mode, setup_logger}; use czkawka_core::common_dir_traversal::ProgressData; use slint::{ModelRc, VecModel}; slint::include_modules!(); fn main() { setup_logger(false); + print_version_mode(); let app = MainWindow::new().unwrap(); diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index d8e102942..57220cf9b 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -43,6 +43,12 @@ export component MainList { parentPathIdx: 5; fileNameIdx: 4; } + focus_item := FocusScope { + key-released(event) => { + debug(event); + accept + } + } changed_current_tab() => { empty_folders.deselect_selected_item(); empty_files.deselect_selected_item(); From b700c010f28d2496297e73cc9a3daf072be15141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 17 Nov 2023 22:44:38 +0100 Subject: [PATCH 056/107] More --- krokiet/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/krokiet/README.md b/krokiet/README.md index 3408eedb6..4ca94c1b6 100644 --- a/krokiet/README.md +++ b/krokiet/README.md @@ -127,13 +127,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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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 | - Internal .slint language is more limited than QML(javascript flexibility is big pl)
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different ) | -| 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) and this is also
- 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
- 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 | - 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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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 | - Internal .slint language is more limited than QML(javascript flexibility is big pl)
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different
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) and this is also
- 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
- Cannot select directory - file chooser only can choose files - small thing but important for me
- Not very performant Rust <=> Javascript communication | 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 From 8834ee8f542c1c436223af541809773938542fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 18 Nov 2023 22:36:20 +0100 Subject: [PATCH 057/107] Changes --- .github/workflows/linux_cli_eyra.yml | 53 +++++++++++++++++++ Changelog.md | 6 ++- czkawka_core/src/bad_extensions.rs | 2 +- czkawka_core/src/broken_files.rs | 2 +- czkawka_core/src/common_traits.rs | 6 +-- czkawka_core/src/duplicate.rs | 7 ++- czkawka_core/src/temporary.rs | 2 +- czkawka_gui/i18n/en/czkawka_gui.ftl | 2 +- .../src/connect_things/connect_button_save.rs | 13 ++++- czkawka_gui/src/tests.rs | 2 +- krokiet/README.md | 14 ++--- krokiet/src/connect_delete.rs | 4 -- 12 files changed, 88 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/linux_cli_eyra.yml diff --git a/.github/workflows/linux_cli_eyra.yml b/.github/workflows/linux_cli_eyra.yml new file mode 100644 index 000000000..63d735769 --- /dev/null +++ b/.github/workflows/linux_cli_eyra.yml @@ -0,0 +1,53 @@ +name: 🐧 Linux CLI Eyra +on: + push: + pull_request: + schedule: + - cron: '0 0 * * 2' + +env: + CARGO_TERM_COLOR: always + +jobs: + linux-cli: + strategy: + matrix: + toolchain: [ nightly ] + type: [ release ] + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Install basic libraries + run: sudo apt-get update; sudo apt install -y + + - name: Setup rust version + run: rustup default ${{ matrix.toolchain }} + + - name: Add eyra + run: | + cd czkawka_cli + cargo add eyra --rename=std + echo 'fn main() { println!("cargo:rustc-link-arg=-nostartfiles"); }' > build.rs + cd .. + + - name: Build Release + run: cargo build --release --bin czkawka_cli + if: ${{ (matrix.type == 'release') }} + + - name: Store Linux CLI + uses: actions/upload-artifact@v3 + with: + name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }} + path: target/release/czkawka_cli + if: ${{ matrix.type == 'release' }} + + - name: Linux Regression Test + run: | + wget https://github.com/qarmin/czkawka/releases/download/6.0.0/TestFiles.zip + cd ci_tester + cargo build --release + cd .. + + ci_tester/target/release/ci_tester target/release/czkawka_cli + if: ${{ matrix.type == 'release' }} diff --git a/Changelog.md b/Changelog.md index f75055d90..c8be0514f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,15 +1,17 @@ ## Version 7.0.0 - ? ### GTK GUI -- Added drag&drop support for included/excluded folders - [#1102](https://github.com/qarmin/czkawka/pull/1102) +- Added drag&drop support for included/excluded folders - [#1106](https://github.com/qarmin/czkawka/pull/1106) ### CLI +- Providing full static rust binary with [Eyra](https://github.com/sunfishcode/eyra) - [#1102](https://github.com/qarmin/czkawka/pull/1102) ### Krokiet GUI - Initial release of new gui - [#1102](https://github.com/qarmin/czkawka/pull/1102) ### Core - Using normal crossbeam channels instead of asyncio tokio channel - [#1102](https://github.com/qarmin/czkawka/pull/1102) -- Fixed tool type when using progress of empty directories +- Fixed tool type when using progress of empty directories - [#1102](https://github.com/qarmin/czkawka/pull/1102) +- Fixed missing json support in saving size and name - [#1102](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/czkawka_core/src/bad_extensions.rs b/czkawka_core/src/bad_extensions.rs index 2b30b4d2e..429d6992b 100644 --- a/czkawka_core/src/bad_extensions.rs +++ b/czkawka_core/src/bad_extensions.rs @@ -160,7 +160,7 @@ const WORKAROUNDS: &[(&str, &str)] = &[ ("exe", "xls"), // Not sure why xls is not recognized ]; -#[derive(Clone, Serialize)] +#[derive(Clone, Serialize, Debug)] pub struct BadFileEntry { pub path: PathBuf, pub modified_date: u64, diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 5c568453b..6bd24b8c9 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -26,7 +26,7 @@ use crate::common_dir_traversal::{common_get_entry_data_metadata, common_read_di use crate::common_tool::{CommonData, CommonToolData, DeleteMethod}; use crate::common_traits::*; -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone, Serialize, Deserialize, Debug)] pub struct FileEntry { pub path: PathBuf, pub modified_date: u64, diff --git a/czkawka_core/src/common_traits.rs b/czkawka_core/src/common_traits.rs index 13a3da508..27aaebd1b 100644 --- a/czkawka_core/src/common_traits.rs +++ b/czkawka_core/src/common_traits.rs @@ -35,7 +35,7 @@ pub trait PrintResults { fn save_results_to_file_as_json(&self, file_name: &str, pretty_print: bool) -> std::io::Result<()>; - fn save_results_to_file_as_json_internal(&self, file_name: &str, item_to_serialize: &T, pretty_print: bool) -> std::io::Result<()> { + fn save_results_to_file_as_json_internal(&self, file_name: &str, item_to_serialize: &T, pretty_print: bool) -> std::io::Result<()> { if pretty_print { self.save_results_to_file_as_json_pretty(file_name, item_to_serialize) } else { @@ -44,7 +44,7 @@ pub trait PrintResults { } #[fun_time(message = "save_results_to_file_as_json_pretty", level = "debug")] - fn save_results_to_file_as_json_pretty(&self, file_name: &str, item_to_serialize: &T) -> std::io::Result<()> { + fn save_results_to_file_as_json_pretty(&self, file_name: &str, item_to_serialize: &T) -> std::io::Result<()> { let file_handler = File::create(file_name)?; let mut writer = BufWriter::new(file_handler); serde_json::to_writer_pretty(&mut writer, item_to_serialize)?; @@ -52,7 +52,7 @@ pub trait PrintResults { } #[fun_time(message = "save_results_to_file_as_json_compact", level = "debug")] - fn save_results_to_file_as_json_compact(&self, file_name: &str, item_to_serialize: &T) -> std::io::Result<()> { + fn save_results_to_file_as_json_compact(&self, file_name: &str, item_to_serialize: &T) -> std::io::Result<()> { let file_handler = File::create(file_name)?; let mut writer = BufWriter::new(file_handler); serde_json::to_writer(&mut writer, item_to_serialize)?; diff --git a/czkawka_core/src/duplicate.rs b/czkawka_core/src/duplicate.rs index 7946fe909..de47fcf5a 100644 --- a/czkawka_core/src/duplicate.rs +++ b/czkawka_core/src/duplicate.rs @@ -1160,11 +1160,14 @@ impl PrintResults for DuplicateFinder { Ok(()) } + // TODO - check if is possible to save also data in header about size and name in SizeName mode - https://github.com/qarmin/czkawka/issues/1137 fn save_results_to_file_as_json(&self, file_name: &str, pretty_print: bool) -> io::Result<()> { if self.get_use_reference() { match self.check_method { CheckingMethod::Name => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_names_referenced, pretty_print), - CheckingMethod::SizeName => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_names_referenced, pretty_print), + CheckingMethod::SizeName => { + self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_names_referenced.values().collect::>(), pretty_print) + } CheckingMethod::Size => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_referenced, pretty_print), CheckingMethod::Hash => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_hashes_referenced, pretty_print), _ => panic!(), @@ -1172,7 +1175,7 @@ impl PrintResults for DuplicateFinder { } else { match self.check_method { CheckingMethod::Name => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_names, pretty_print), - CheckingMethod::SizeName => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_names, pretty_print), + CheckingMethod::SizeName => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_names.values().collect::>(), pretty_print), CheckingMethod::Size => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size, pretty_print), CheckingMethod::Hash => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_hashes, pretty_print), _ => panic!(), diff --git a/czkawka_core/src/temporary.rs b/czkawka_core/src/temporary.rs index ac17539a6..64dc78b18 100644 --- a/czkawka_core/src/temporary.rs +++ b/czkawka_core/src/temporary.rs @@ -32,7 +32,7 @@ const TEMP_EXTENSIONS: &[&str] = &[ ".partial", ]; -#[derive(Clone, Serialize)] +#[derive(Clone, Serialize, Debug)] pub struct FileEntry { pub path: PathBuf, pub modified_date: u64, diff --git a/czkawka_gui/i18n/en/czkawka_gui.ftl b/czkawka_gui/i18n/en/czkawka_gui.ftl index 70d7780e2..68f118201 100644 --- a/czkawka_gui/i18n/en/czkawka_gui.ftl +++ b/czkawka_gui/i18n/en/czkawka_gui.ftl @@ -544,7 +544,7 @@ move_files_title_dialog = Choose folder to which you want to move duplicated fil move_files_choose_more_than_1_path = Only one path may be selected to be able to copy their duplicated files, selected {$path_number}. move_stats = Properly moved {$num_files}/{$all_files} items -save_results_to_file = Saved results both to txt and json files. +save_results_to_file = Saved results both to txt and json files into {$name} folder. search_not_choosing_any_music = ERROR: You must select at least one checkbox with music searching types. search_not_choosing_any_broken_files = ERROR: You must select at least one checkbox with type of checked broken files. diff --git a/czkawka_gui/src/connect_things/connect_button_save.rs b/czkawka_gui/src/connect_things/connect_button_save.rs index e407e0857..c06e5c44b 100644 --- a/czkawka_gui/src/connect_things/connect_button_save.rs +++ b/czkawka_gui/src/connect_things/connect_button_save.rs @@ -1,5 +1,6 @@ use std::cell::RefCell; use std::collections::HashMap; +use std::env; use std::rc::Rc; use gtk4::prelude::*; @@ -10,6 +11,7 @@ use czkawka_core::common_traits::PrintResults; use crate::flg; use crate::gui_structs::gui_data::GuiData; use crate::help_functions::BottomButtonsEnum; +use crate::localizer_core::generate_translation_hashmap; use crate::notebook_enums::*; pub fn connect_button_save(gui_data: &GuiData) { @@ -44,10 +46,15 @@ pub fn connect_button_save(gui_data: &GuiData) { NotebookMainEnum::BadExtensions => shared_bad_extensions_state.borrow().save_all_in_one("results_bad_extensions"), }; + let current_path = match env::current_dir() { + Ok(t) => t.to_string_lossy().to_string(), + Err(_) => "".to_string(), + }; + match result { Ok(()) => (), Err(e) => { - entry_info.set_text(&format!("Failed to save results to file {e}")); + entry_info.set_text(&format!("Failed to save results to folder {current_path}, reason {e}")); return; } } @@ -57,6 +64,7 @@ pub fn connect_button_save(gui_data: &GuiData) { &shared_buttons, &entry_info, &buttons_save_clone, + current_path, ); }); } @@ -66,8 +74,9 @@ fn post_save_things( shared_buttons: &Rc>>>, entry_info: &Entry, buttons_save: &Button, + current_path: String, ) { - entry_info.set_text(&flg!("save_results_to_file")); + entry_info.set_text(&flg!("save_results_to_file", generate_translation_hashmap(vec![("name", current_path),]))); // Set state { buttons_save.hide(); diff --git a/czkawka_gui/src/tests.rs b/czkawka_gui/src/tests.rs index 522f0faa5..e43b96cc3 100644 --- a/czkawka_gui/src/tests.rs +++ b/czkawka_gui/src/tests.rs @@ -6,7 +6,7 @@ use crate::GuiData; pub fn validate_notebook_data(gui_data: &GuiData) { // Test treeviews names, each treeview should have set name same as variable name - for item in gui_data.main_notebook.get_main_tree_views().iter() { + for item in &gui_data.main_notebook.get_main_tree_views() { // println!("Checking {} element", i); get_notebook_enum_from_tree_view(item); diff --git a/krokiet/README.md b/krokiet/README.md index 4ca94c1b6..a0899f773 100644 --- a/krokiet/README.md +++ b/krokiet/README.md @@ -127,13 +127,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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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 | - Internal .slint language is more limited than QML(javascript flexibility is big pl)
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different
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) and this is also
- 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
- 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 | - 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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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 | - Internal .slint language is more limited than QML(javascript flexibility is big pl)
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different
- 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) and this is also
- 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
- Cannot select directory - file chooser only can choose files - small thing but important for me
- Not very performant Rust <=> Javascript communication | 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/connect_delete.rs b/krokiet/src/connect_delete.rs index 94a06c263..46ab2eb41 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -1,5 +1,3 @@ -use std::borrow::Borrow; - use slint::{ComponentHandle, Model, ModelRc, VecModel}; use crate::{Callabler, CurrentTab, MainListModel, MainWindow}; @@ -16,7 +14,6 @@ pub fn connect_delete_button(app: &MainWindow) { CurrentTab::EmptyFolders => app.get_empty_folder_model(), CurrentTab::SimilarImages => app.get_similar_images_model(), CurrentTab::EmptyFiles => app.get_empty_files_model(), - _ => panic!(), }; let new_model = handle_delete_items(&model, active_tab == CurrentTab::EmptyFolders); @@ -26,7 +23,6 @@ pub fn connect_delete_button(app: &MainWindow) { CurrentTab::EmptyFolders => app.set_empty_folder_model(new_model), CurrentTab::SimilarImages => app.set_similar_images_model(new_model), CurrentTab::EmptyFiles => app.set_empty_files_model(new_model), - _ => panic!(), } } }); From 796233c54f249d848ba81c8ef585582912fcf740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 18 Nov 2023 23:45:52 +0100 Subject: [PATCH 058/107] Basic button handler --- krokiet/ui/main_lists.slint | 14 ++++- krokiet/ui/selectable_tree_view.slint | 82 +++++++++++++++++++++------ 2 files changed, 78 insertions(+), 18 deletions(-) diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 57220cf9b..7a8677b09 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -10,6 +10,7 @@ export component MainList { in-out property <[MainListModel]> empty_files_model; in-out property <[MainListModel]> similar_images_model; callback changed_current_tab(); + callback released_key(string); empty_folders := SelectableTableView { visible: root.active-tab == CurrentTab.EmptyFolders; @@ -45,7 +46,18 @@ export component MainList { } focus_item := FocusScope { key-released(event) => { - debug(event); + if (!self.visible) { + return; + } + if (root.active-tab == CurrentTab.EmptyFiles) { + empty_files.released_key(event); + } else if (root.active-tab == CurrentTab.EmptyFolders) { + empty-folders.released_key(event); + } else if (root.active-tab == CurrentTab.SimilarImages) { + similar-images.released_key(event); + } else { + debug("Non handled key in main_lists.slint"); + } accept } } diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index f6b8de328..96037d98e 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -16,18 +16,9 @@ export component SelectableTableView inherits Rectangle { in-out property fileNameIdx; in-out property selected_item: -1; out property list_view_width: max(self.width - 20px, column_sizes[0] + column_sizes[1] + column_sizes[2] + column_sizes[3] + column_sizes[4] + column_sizes[5] + column_sizes[6] + column_sizes[7] + column_sizes[8] + column_sizes[9] + column_sizes[10] + column_sizes[11]); - forward-focus: focus_item; - // TODO not works - focus_item := FocusScope { - key-released(event) => { - debug(event); - accept - } - } VerticalBox { padding: 0px; - forward-focus: focus-item; ScrollView { height: 30px; viewport-x <=> list_view.viewport-x; @@ -45,12 +36,10 @@ export component SelectableTableView inherits Rectangle { Rectangle { width: 1px; background: gray; - forward-focus: focus-item; TouchArea { width: 5px; x: (parent.width - self.width) / 2; property cached; - forward-focus: focus-item; pointer-event(event) => { if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) { self.cached = root.column_sizes[idx]; @@ -74,16 +63,13 @@ export component SelectableTableView inherits Rectangle { list_view := ListView { padding: 0px; min-width: 100px; - forward-focus: focus-item; for r [idx] in root.values: Rectangle { width: list_view_width; border-radius: 5px; - forward-focus: focus-item; height: 20px; background: r.header-row ? ColorPalette.list_view_normal_header_color : (touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color)); touch_area := TouchArea { - forward-focus: focus-item; clicked => { if (!r.header_row) { r.selected_row = !r.selected_row; @@ -116,12 +102,10 @@ export component SelectableTableView inherits Rectangle { } HorizontalLayout { - forward-focus: focus-item; CheckBox { visible: !r.header-row; checked: r.checked && !r.header-row; width: root.column-sizes[0]; - forward-focus: focus-item; toggled => { r.checked = self.checked; } @@ -133,7 +117,6 @@ export component SelectableTableView inherits Rectangle { width: root.column-sizes[idx + 1]; text: f; font-size: 12px; - forward-focus: focus-item; vertical-alignment: center; overflow: elide; } @@ -149,4 +132,69 @@ export component SelectableTableView inherits Rectangle { root.selected-item = -1; } } + + // TODO this should work with multiple selection and shift and control key - problably logic will need to be set in global state + public function released_key(event: KeyEvent) { + if (event.text == " ") { + if (root.selected_item != -1) { + root.values[root.selected_item].checked = !root.values[root.selected_item].checked; + } + } else if (event.text == Key.DownArrow) { + if (root.selected_item != -1) { + if (root.values.length - 1 == root.selected_item) { + // Last element, so unselect it + root.values[root.selected_item].selected_row = false; + root.selected_item = -1; + } else { + // Select next item, if next item is header row, then select second + // This should be safe, because header row should never be last item + root.values[root.selected_item].selected_row = false; + if (root.values[root.selected_item + 1].header_row) { + root.selected_item += 2; + } else { + root.selected_item += 1; + } + root.values[root.selected_item].selected_row = true; + } + } else { + // Select last item if nothing is selected + if (root.values.length > 0) { + if (root.values[0].header_row) { + root.selected_item = 1; + } else { + root.selected_item = 0; + } + root.values[root.selected_item].selected_row = true; + } + } + } else if (event.text == Key.UpArrow) { + if (root.selected_item != -1) { + if (root.selected_item == 0) { + // First element, so unselect it + root.values[root.selected_item].selected_row = false; + root.selected_item = -1; + } else { + root.values[root.selected_item].selected_row = false; + // Select previous item, if previous item is header row, then select second previous item + // This is safe, because if there is non header row upper, then can be easily selected, + // but otherwise is done -2 which for 1 (smallest possible item to set with header row) gives -1, so gives + // this non selected row + if (root.values[root.selected_item - 1].header_row) { + root.selected_item -= 2; + } else { + root.selected_item -= 1; + } + if (root.selected_item != -1) { + root.values[root.selected_item].selected_row = true; + } + } + } else { + // Select last item if nothing is selected + if (root.values.length > 0) { + root.selected_item = root.values.length - 1; + root.values[root.selected_item].selected_row = true; + } + } + } + } } From dcd30dd6eb8cb40891bf63d10feb19bbcde430a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 19 Nov 2023 10:34:44 +0100 Subject: [PATCH 059/107] Fix compilation problem --- krokiet/ui/main_lists.slint | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 7a8677b09..846fb5ee4 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -46,8 +46,8 @@ export component MainList { } focus_item := FocusScope { key-released(event) => { - if (!self.visible) { - return; + if (!self.visible || !self.has-focus) { + return accept; } if (root.active-tab == CurrentTab.EmptyFiles) { empty_files.released_key(event); From ddfb6dc73379e3d029dc25dfc201bf461ff04cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 19 Nov 2023 11:06:42 +0100 Subject: [PATCH 060/107] Hack steal click --- krokiet/ui/main_lists.slint | 12 ++++++++++-- krokiet/ui/selectable_tree_view.slint | 9 +++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 846fb5ee4..98cb1e38c 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -5,8 +5,13 @@ import {CurrentTab, TypeOfOpenedItem} from "common.slint"; import {MainListModel} from "common.slint"; export component MainList { - in-out property active-tab; - in-out property <[MainListModel]> empty_folder_model; + in-out property active-tab: CurrentTab.EmptyFolders; + in-out property <[MainListModel]> empty_folder_model: [ + {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} + ]; in-out property <[MainListModel]> empty_files_model; in-out property <[MainListModel]> similar_images_model; callback changed_current_tab(); @@ -45,6 +50,9 @@ export component MainList { fileNameIdx: 4; } focus_item := FocusScope { + x:0; + width: 0px; // Hack to not steal first click from other components - https://github.com/slint-ui/slint/issues/3503 + key-released(event) => { if (!self.visible || !self.has-focus) { return accept; diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index 96037d98e..e8ee0ac2a 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -8,8 +8,13 @@ import {GuiState} from "gui_state.slint"; export component SelectableTableView inherits Rectangle { callback item_opened(string); in property <[string]> columns; - in-out property <[MainListModel]> values; - in-out property <[length]> column_sizes; + in-out property <[MainListModel]> values: [ + {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , + {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} + ]; + in-out property <[length]> column_sizes: [30px, 80px, 150px, 160px]; private property column_number: column-sizes.length + 1; // This idx, starts from zero, but since first is always a checkbox, and is not in model.val values, remove 1 from idx in-out property parentPathIdx; From 238e3a1ba9fa60dd4917994a6f99af1856a03960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 19 Nov 2023 11:16:23 +0100 Subject: [PATCH 061/107] For now not use --- krokiet/ui/main_lists.slint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 98cb1e38c..511129db0 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -50,8 +50,8 @@ export component MainList { fileNameIdx: 4; } focus_item := FocusScope { - x:0; width: 0px; // Hack to not steal first click from other components - https://github.com/slint-ui/slint/issues/3503 + // Hack not works https://github.com/slint-ui/slint/issues/3503#issuecomment-1817809834 because disables key-released event key-released(event) => { if (!self.visible || !self.has-focus) { From 0b2b723e79d4d2684f9e71fd5f61b0afc1bf9b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 20 Nov 2023 14:44:14 +0100 Subject: [PATCH 062/107] CI --- .github/workflows/linux_cli_eyra.yml | 2 +- .github/workflows/linux_gui.yml | 59 ++++++++++++++++++++++++---- .github/workflows/mac.yml | 14 +++++++ .github/workflows/windows.yml | 39 ++++++++++++++++++ 4 files changed, 106 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux_cli_eyra.yml b/.github/workflows/linux_cli_eyra.yml index 63d735769..a577adb39 100644 --- a/.github/workflows/linux_cli_eyra.yml +++ b/.github/workflows/linux_cli_eyra.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt-get update; sudo apt install -y + run: sudo apt-get update; sudo apt install -y ffmpeg - name: Setup rust version run: rustup default ${{ matrix.toolchain }} diff --git a/.github/workflows/linux_gui.yml b/.github/workflows/linux_gui.yml index bcdd94a31..b6e34839d 100644 --- a/.github/workflows/linux_gui.yml +++ b/.github/workflows/linux_gui.yml @@ -9,6 +9,50 @@ env: CARGO_TERM_COLOR: always jobs: + linux-krokiet-gui: + strategy: + matrix: + toolchain: [ stable, 1.72.1 ] + type: [ release ] + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Install basic libraries + run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev -y + + - name: Setup rust version + run: rustup default ${{ matrix.toolchain }} + + - name: Build Release Krokiet + run: cargo build --release --bin krokiet + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0" + if: ${{ (matrix.type == 'release') }} + + - name: Store Linux GUI Krokiet + uses: actions/upload-artifact@v3 + with: + name: krokiet-${{ runner.os }}-${{ matrix.toolchain }} + path: target/release/krokiet + if: ${{ matrix.type == 'release' }} + + - name: Build Release Krokiet heif + run: cargo build --release --bin krokiet --features heif + env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-C debuginfo=0" + if: ${{ (matrix.type == 'release') }} + + - name: Store Linux GUI Krokiet heif + uses: actions/upload-artifact@v3 + with: + name: krokiet-${{ runner.os }}-${{ matrix.toolchain }}-heif + path: target/release/krokiet + if: ${{ matrix.type == 'release' }} + + linux-gui: strategy: matrix: @@ -25,32 +69,33 @@ jobs: run: rustup default ${{ matrix.toolchain }} - name: Build Release Heif - run: cargo build --release --features heif + run: cargo build --release --bin czkawka_gui --features heif env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0" - if: ${{ (matrix.type == 'release') && (matrix.toolchain == '1.72.1') }} + if: ${{ (matrix.type == 'release') }} - name: Store Linux GUI Heif uses: actions/upload-artifact@v3 with: name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}-heif path: target/release/czkawka_gui - if: ${{ matrix.type == 'release' }} + if: ${{ (matrix.type == 'release') && (matrix.toolchain == 'stable') }} - name: Build Release - run: cargo build --release + run: cargo build --release --bin czkawka_gui env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0" - if: ${{ (matrix.type == 'release') && (matrix.toolchain == 'stable') }} + if: ${{ (matrix.type == 'release') }} + # Only store stable toolchain - name: Store Linux GUI uses: actions/upload-artifact@v3 with: name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }} path: target/release/czkawka_gui - if: ${{ matrix.type == 'release' }} + if: ${{ (matrix.type == 'release') && (matrix.toolchain == 'stable') }} linux-appimage-gui: strategy: @@ -68,7 +113,7 @@ jobs: run: rustup default ${{ matrix.toolchain }} - name: Build Release - run: cargo build --release + run: cargo build --release --bin czkawka_gui env: CARGO_INCREMENTAL: 0 RUSTFLAGS: "-C debuginfo=0" diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 9bf36e5d1..4e953ce4c 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -50,6 +50,13 @@ jobs: path: target/release/czkawka_gui if: ${{ matrix.type == 'release' }} + - name: Store MacOS Krokiet + uses: actions/upload-artifact@v3 + with: + name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }} + path: target/release/krokiet + if: ${{ matrix.type == 'release' }} + - name: Build Release Heif run: cargo build --release --features heif env: @@ -68,4 +75,11 @@ jobs: with: name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}-heif path: target/release/czkawka_gui + if: ${{ matrix.type == 'release' }} + + - name: Store MacOS Krokiet Heif + uses: actions/upload-artifact@v3 + with: + name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}-heif + path: target/release/krokiet if: ${{ matrix.type == 'release' }} \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b27668321..8e89bf59a 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -9,8 +9,47 @@ env: CARGO_TERM_COLOR: always jobs: + krokiet: + strategy: + fail-fast: false + matrix: + use_heif: [ normal ] + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup rust version + run: rustup default ${{ matrix.toolchain }} + + - name: Compile Krokiet + run: cargo build --release --bin krokiet + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: krokiet-windows-${{ github.sha }}-${{ matrix.use_heif }} + path: | + target/release/krokiet.exe + if-no-files-found: error + + - name: Show console window on windows + run: sed -i 's|\#\!\[windows_subsystem|//#![windows_subsystem|' czkawka_gui/src/main.rs + + - name: Compile Krokiet Console + run: cargo build --release --bin krokiet + + - name: Upload artifacts Console + uses: actions/upload-artifact@v3 + with: + name: krokiet-windows-${{ github.sha }}-${{ matrix.use_heif }}-console + path: | + target/release/krokiet.exe + if-no-files-found: error + + container: strategy: + fail-fast: false matrix: use_heif: [ non_heif ] #, heif ] - heif problems with mingw runs-on: ubuntu-22.04 From 161c63b4c32b0fad39a985cd39de73207a81b6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 20 Nov 2023 15:17:28 +0100 Subject: [PATCH 063/107] A1 --- .github/workflows/windows.yml | 2 +- krokiet/src/main.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 8e89bf59a..5d91586cb 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -33,7 +33,7 @@ jobs: if-no-files-found: error - name: Show console window on windows - run: sed -i 's|\#\!\[windows_subsystem|//#![windows_subsystem|' czkawka_gui/src/main.rs + run: sed -i 's|\#\!\[windows_subsystem|//#![windows_subsystem|' krokiet/src/main.rs - name: Compile Krokiet Console run: cargo build --release --bin krokiet diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 025ee58fd..f080fb094 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -1,3 +1,5 @@ +// Remove console window in Windows OS +#![windows_subsystem = "windows"] #![allow(clippy::comparison_chain)] #![allow(clippy::collapsible_if)] #![allow(clippy::overly_complex_bool_expr)] // Generated code From a216285e1ae1dc862877849e515e7239590757de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 20 Nov 2023 15:22:17 +0100 Subject: [PATCH 064/107] ABC --- .github/workflows/linux_cli.yml | 2 +- .github/workflows/linux_cli_eyra.yml | 2 +- .github/workflows/linux_gui.yml | 8 ++++---- .github/workflows/quality.yml | 2 +- instructions/Installation.md | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/linux_cli.yml b/.github/workflows/linux_cli.yml index f306f9743..ba1079887 100644 --- a/.github/workflows/linux_cli.yml +++ b/.github/workflows/linux_cli.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt-get update; sudo apt install libheif-dev ffmpeg -y + run: sudo apt update; sudo apt install libheif-dev ffmpeg -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} diff --git a/.github/workflows/linux_cli_eyra.yml b/.github/workflows/linux_cli_eyra.yml index a577adb39..12463da6c 100644 --- a/.github/workflows/linux_cli_eyra.yml +++ b/.github/workflows/linux_cli_eyra.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt-get update; sudo apt install -y ffmpeg + run: sudo apt update; sudo apt install -y ffmpeg - name: Setup rust version run: rustup default ${{ matrix.toolchain }} diff --git a/.github/workflows/linux_gui.yml b/.github/workflows/linux_gui.yml index b6e34839d..b647bf1d1 100644 --- a/.github/workflows/linux_gui.yml +++ b/.github/workflows/linux_gui.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev -y + run: sudo apt update; sudo apt install libheif-dev -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} @@ -63,7 +63,7 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev -y + run: sudo apt update; sudo apt install libgtk-4-dev libheif-dev -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} @@ -107,7 +107,7 @@ jobs: - uses: actions/checkout@v3 - name: Install Dependencies - run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y + run: sudo apt update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} @@ -163,7 +163,7 @@ jobs: - uses: actions/checkout@v3 - name: Install Dependencies - run: sudo apt-get update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y xvfb + run: sudo apt update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y xvfb - name: Setup rust version run: rustup default ${{ matrix.toolchain }} diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index b28b53ff5..efd152b4e 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - name: Install Gtk 4 - run: sudo apt-get update; sudo apt install -y libgtk-4-dev libheif-dev -y + run: sudo apt update; sudo apt install -y libgtk-4-dev libheif-dev -y - name: Check the format run: cargo fmt --all -- --check diff --git a/instructions/Installation.md b/instructions/Installation.md index be0368942..a65fd1f27 100644 --- a/instructions/Installation.md +++ b/instructions/Installation.md @@ -140,7 +140,7 @@ Flathub page with Czkawka can be found [**here**](https://flathub.org/apps/detai ### PPA - Debian/Ubuntu (unofficial) ``` sudo add-apt-repository ppa:xtradeb/apps -sudo apt-get update +sudo apt update sudo apt-get install czkawka ``` From 3fcd71f80cd660a1bc05aca744e0f1e9ad9ba495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 20 Nov 2023 17:18:04 +0100 Subject: [PATCH 065/107] Traits --- .github/workflows/linux_cli.yml | 5 +--- .github/workflows/linux_cli_eyra.yml | 2 +- .github/workflows/linux_gui.yml | 42 +++++++++++++--------------- .github/workflows/mac.yml | 4 --- .github/workflows/quality.yml | 4 +-- .github/workflows/windows.yml | 10 ++++++- krokiet/Cargo.toml | 5 ++-- krokiet/src/connect_delete.rs | 4 +-- 8 files changed, 37 insertions(+), 39 deletions(-) diff --git a/.github/workflows/linux_cli.yml b/.github/workflows/linux_cli.yml index ba1079887..053f22f48 100644 --- a/.github/workflows/linux_cli.yml +++ b/.github/workflows/linux_cli.yml @@ -19,16 +19,13 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt update; sudo apt install libheif-dev ffmpeg -y + run: sudo apt update || true; sudo apt install libheif-dev ffmpeg -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} - name: Build Release run: cargo build --release --bin czkawka_cli - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" if: ${{ (matrix.type == 'release') }} - name: Store Linux CLI diff --git a/.github/workflows/linux_cli_eyra.yml b/.github/workflows/linux_cli_eyra.yml index 12463da6c..43d9b721c 100644 --- a/.github/workflows/linux_cli_eyra.yml +++ b/.github/workflows/linux_cli_eyra.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt update; sudo apt install -y ffmpeg + run: sudo apt update || true; sudo apt install -y ffmpeg - name: Setup rust version run: rustup default ${{ matrix.toolchain }} diff --git a/.github/workflows/linux_gui.yml b/.github/workflows/linux_gui.yml index b647bf1d1..c10838646 100644 --- a/.github/workflows/linux_gui.yml +++ b/.github/workflows/linux_gui.yml @@ -19,16 +19,13 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt update; sudo apt install libheif-dev -y + run: sudo apt update || true; sudo apt install libheif-dev -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} - name: Build Release Krokiet run: cargo build --release --bin krokiet - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" if: ${{ (matrix.type == 'release') }} - name: Store Linux GUI Krokiet @@ -38,11 +35,23 @@ jobs: path: target/release/krokiet if: ${{ matrix.type == 'release' }} + linux-krokiet-gui-heif: + strategy: + matrix: + toolchain: [ stable, 1.72.1 ] + type: [ release ] + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Install basic libraries + run: sudo apt update || true; sudo apt install libheif-dev -y + + - name: Setup rust version + run: rustup default ${{ matrix.toolchain }} + - name: Build Release Krokiet heif run: cargo build --release --bin krokiet --features heif - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" if: ${{ (matrix.type == 'release') }} - name: Store Linux GUI Krokiet heif @@ -52,7 +61,6 @@ jobs: path: target/release/krokiet if: ${{ matrix.type == 'release' }} - linux-gui: strategy: matrix: @@ -63,16 +71,13 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt update; sudo apt install libgtk-4-dev libheif-dev -y + run: sudo apt update || true; sudo apt install libgtk-4-dev libheif-dev -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} - name: Build Release Heif run: cargo build --release --bin czkawka_gui --features heif - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" if: ${{ (matrix.type == 'release') }} - name: Store Linux GUI Heif @@ -84,9 +89,6 @@ jobs: - name: Build Release run: cargo build --release --bin czkawka_gui - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" if: ${{ (matrix.type == 'release') }} # Only store stable toolchain @@ -107,16 +109,13 @@ jobs: - uses: actions/checkout@v3 - name: Install Dependencies - run: sudo apt update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y + run: sudo apt update || true; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} - name: Build Release run: cargo build --release --bin czkawka_gui - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" - name: Download appimage dependencies run: | @@ -163,13 +162,10 @@ jobs: - uses: actions/checkout@v3 - name: Install Dependencies - run: sudo apt update; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y xvfb + run: sudo apt update || true; sudo apt install libgtk-4-dev libheif-dev librsvg2-dev wget fuse libfuse2 -y xvfb - name: Setup rust version run: rustup default ${{ matrix.toolchain }} - name: Test run: xvfb-run cargo test - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0" diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 4e953ce4c..a9b886123 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -32,8 +32,6 @@ jobs: - name: Build Release run: cargo build --release - env: - CARGO_INCREMENTAL: 0 if: ${{ matrix.type == 'release'}} - name: Store MacOS CLI @@ -59,8 +57,6 @@ jobs: - name: Build Release Heif run: cargo build --release --features heif - env: - CARGO_INCREMENTAL: 0 if: ${{ matrix.type == 'release'}} - name: Store MacOS CLI Heif diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index efd152b4e..d1c7b9d04 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v3 - name: Install Gtk 4 - run: sudo apt update; sudo apt install -y libgtk-4-dev libheif-dev -y + run: sudo apt update || true; sudo apt install -y libgtk-4-dev libheif-dev -y - name: Check the format run: cargo fmt --all -- --check @@ -23,4 +23,4 @@ jobs: # Clippy overly_complex_bool_expr is disabled because mess with generated files in target dir # and I cannot disable it - name: Run clippy - run: cargo clippy --all-targets --all-features -- -A clippy::overly_complex_bool_expr -D warnings + run: cargo clippy --all-targets --all-features -- -D warnings diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5d91586cb..f4850f1d6 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -18,6 +18,14 @@ jobs: steps: - uses: actions/checkout@v3 + - name: Install dependencies(mostly sd) + run: | + sudo apt update || true; sudo apt install wget -y + wget https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-unknown-linux-gnu.tar.gz -O a.tar.gz + tar -xzf a.tar.gz + chmod +x sd-v1.0.0-x86_64-unknown-linux-gnu/sd + sudo cp sd-v1.0.0-x86_64-unknown-linux-gnu/sd /usr/bin/sd + - name: Setup rust version run: rustup default ${{ matrix.toolchain }} @@ -33,7 +41,7 @@ jobs: if-no-files-found: error - name: Show console window on windows - run: sed -i 's|\#\!\[windows_subsystem|//#![windows_subsystem|' krokiet/src/main.rs + run: sd -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs - name: Compile Krokiet Console run: cargo build --release --bin krokiet diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index de5a11307..3053d66ac 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -41,7 +41,6 @@ slint-build = "1.3" #slint-build = { path = "/home/rafal/test/slint/api/rs/build/"} [features] -# TODO remove from deault features skia, because is harder to cross-compile it default = ["winit_femtovg", "winit_software"] skia_opengl = ["slint/renderer-skia-opengl"] skia_vulkan = ["slint/renderer-skia-vulkan"] @@ -50,4 +49,6 @@ femtovg = ["slint/renderer-femtovg"] winit_femtovg = ["slint/renderer-winit-femtovg"] winit_skia_opengl = ["slint/renderer-winit-skia-opengl"] winit_skia_vulkan = ["slint/renderer-winit-skia-vulkan"] -winit_software = ["slint/renderer-winit-software"] \ No newline at end of file +winit_software = ["slint/renderer-winit-software"] + +heif = ["czkawka_core/heif"] diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index 46ab2eb41..1453ac955 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -158,13 +158,13 @@ mod tests { } #[test] - #[should_panic(expected = "First item in normal model, cannot be header")] + #[should_panic] fn test_filter_out_checked_items_one_element_invalid_normal() { let items = create_new_model(vec![(false, true, false, vec![])]); filter_out_checked_items(&items, false); } #[test] - #[should_panic(expected = "First item in header model must be a header")] + #[should_panic] fn test_filter_out_checked_items_one_element_invalid_header() { let items = create_new_model(vec![(false, false, false, vec![])]); filter_out_checked_items(&items, true); From c8ab75c270b166ccf437af2648e8fb29ab4d142f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 20 Nov 2023 17:30:44 +0100 Subject: [PATCH 066/107] Windows sd --- .github/workflows/windows.yml | 19 ++++++++++++------- krokiet/src/connect_delete.rs | 4 ++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index f4850f1d6..d46e0edd0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,11 +20,9 @@ jobs: - name: Install dependencies(mostly sd) run: | - sudo apt update || true; sudo apt install wget -y - wget https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-unknown-linux-gnu.tar.gz -O a.tar.gz - tar -xzf a.tar.gz - chmod +x sd-v1.0.0-x86_64-unknown-linux-gnu/sd - sudo cp sd-v1.0.0-x86_64-unknown-linux-gnu/sd /usr/bin/sd + curl https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-pc-windows-gnu.zip + Expand-Archive ./sd-v1.0.0-x86_64-pc-windows-gnu.zip + cp sd-v1.0.0-x86_64-pc-windows-gnu/sd-v1.0.0-x86_64-pc-windows-gnu/sd.exe . - name: Setup rust version run: rustup default ${{ matrix.toolchain }} @@ -41,7 +39,7 @@ jobs: if-no-files-found: error - name: Show console window on windows - run: sd -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs + run: ./sd.exe -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs - name: Compile Krokiet Console run: cargo build --release --bin krokiet @@ -143,6 +141,13 @@ jobs: image: ghcr.io/piegamesde/gtk4-cross:gtk-4.6 steps: - uses: actions/checkout@v1 + - name: Install dependencies(mostly sd) + run: | + sudo apt update || true; sudo apt install wget -y + wget https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-unknown-linux-gnu.tar.gz -O a.tar.gz + tar -xzf a.tar.gz + chmod +x sd-v1.0.0-x86_64-unknown-linux-gnu/sd + sudo cp sd-v1.0.0-x86_64-unknown-linux-gnu/sd /usr/bin/sd - name: Install additional dependencies # gio is for the build script run: dnf install wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y @@ -162,7 +167,7 @@ jobs: path: target key: windows-build-target - name: Show console window on windows - run: sed -i 's|\#\!\[windows_subsystem|//#![windows_subsystem|' czkawka_gui/src/main.rs + run: sd -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs - name: Cross compile for Windows run: | #!/bin/bash diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index 1453ac955..8d162b4d3 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -44,10 +44,10 @@ fn handle_delete_items(items: &ModelRc, delete_empty_folders: boo // TODO delete in parallel items, consider to add progress bar // For empty folders double check if folders are really empty - this function probably should be run in thread // and at the end should be send signal to main thread to update model -fn remove_selected_items(items: Vec, delete_empty_folders: bool) { +fn remove_selected_items(items: Vec, _delete_empty_folders: bool) { info!("Items to remove {}", items.len()); drop(items); - drop(delete_empty_folders); + // drop(delete_empty_folders); // items.into_iter().for_each(|_item| {}); } From d332f32271976f1c8802adc81362cb2e890b6042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 20 Nov 2023 18:48:24 +0100 Subject: [PATCH 067/107] Windows changes --- .github/workflows/windows.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d46e0edd0..cda63ca75 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,9 +20,9 @@ jobs: - name: Install dependencies(mostly sd) run: | - curl https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-pc-windows-gnu.zip - Expand-Archive ./sd-v1.0.0-x86_64-pc-windows-gnu.zip - cp sd-v1.0.0-x86_64-pc-windows-gnu/sd-v1.0.0-x86_64-pc-windows-gnu/sd.exe . + Invoke-WebRequest -Uri https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-pc-windows-gnu.zip -OutFile a.zip + Expand-Archive ./a.zip + cp a/sd-v1.0.0-x86_64-pc-windows-gnu/sd.exe . - name: Setup rust version run: rustup default ${{ matrix.toolchain }} From aa71cd04804caf53b9f34e15d0ed2c71caab71aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 20 Nov 2023 18:50:18 +0100 Subject: [PATCH 068/107] DNF --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index cda63ca75..5541a86bb 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -143,7 +143,7 @@ jobs: - uses: actions/checkout@v1 - name: Install dependencies(mostly sd) run: | - sudo apt update || true; sudo apt install wget -y + dnf install wget -y wget https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-unknown-linux-gnu.tar.gz -O a.tar.gz tar -xzf a.tar.gz chmod +x sd-v1.0.0-x86_64-unknown-linux-gnu/sd From 7ec36a77160616034de0f43a2b881aae1e79ee1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 20 Nov 2023 22:10:45 +0100 Subject: [PATCH 069/107] Bak --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 5541a86bb..ce22b41a9 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -25,7 +25,7 @@ jobs: cp a/sd-v1.0.0-x86_64-pc-windows-gnu/sd.exe . - name: Setup rust version - run: rustup default ${{ matrix.toolchain }} + run: rustup default stable-x86_64-pc-windows-gnu - name: Compile Krokiet run: cargo build --release --bin krokiet From 2f192cddcadfd80cfe54a91e211e638ac4988c06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 21 Nov 2023 22:13:45 +0100 Subject: [PATCH 070/107] SettingsList --- krokiet/src/connect_delete.rs | 2 ++ krokiet/src/connect_scan.rs | 3 +- krokiet/src/main.rs | 2 ++ krokiet/ui/common.slint | 1 + krokiet/ui/left_side_panel.slint | 15 ++++++--- krokiet/ui/main_lists.slint | 6 ++++ krokiet/ui/settings.slint | 4 +++ krokiet/ui/settings_list.slint | 52 ++++++++++++++++++++++++++++++++ 8 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 krokiet/ui/settings_list.slint diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index 8d162b4d3..89af5416c 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -14,6 +14,7 @@ pub fn connect_delete_button(app: &MainWindow) { CurrentTab::EmptyFolders => app.get_empty_folder_model(), CurrentTab::SimilarImages => app.get_similar_images_model(), CurrentTab::EmptyFiles => app.get_empty_files_model(), + CurrentTab::Settings => panic!("Button should be disabled"), }; let new_model = handle_delete_items(&model, active_tab == CurrentTab::EmptyFolders); @@ -23,6 +24,7 @@ pub fn connect_delete_button(app: &MainWindow) { CurrentTab::EmptyFolders => app.set_empty_folder_model(new_model), CurrentTab::SimilarImages => app.set_similar_images_model(new_model), CurrentTab::EmptyFiles => app.set_empty_files_model(new_model), + CurrentTab::Settings => panic!("Button should be disabled"), } } }); diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index cf3267a8f..9d545089f 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -42,7 +42,8 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender { scan_similar_images(a, progress_sender, stop_receiver, custom_settings); - } // _ => panic!(), + } + CurrentTab::Settings => panic!("Button should be disabled"), } }); } diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index f080fb094..7318a209d 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -2,6 +2,8 @@ #![windows_subsystem = "windows"] #![allow(clippy::comparison_chain)] #![allow(clippy::collapsible_if)] +#![allow(clippy::should_panic_without_expect)] +#![allow(clippy::struct_field_names)] // Generated code #![allow(clippy::overly_complex_bool_expr)] // Generated code #![allow(clippy::semicolon_if_nothing_returned)] // Generated code #![allow(clippy::used_underscore_binding)] // Generated code diff --git a/krokiet/ui/common.slint b/krokiet/ui/common.slint index b8c15eb16..f9fa58da3 100644 --- a/krokiet/ui/common.slint +++ b/krokiet/ui/common.slint @@ -2,6 +2,7 @@ export enum CurrentTab { EmptyFolders, EmptyFiles, SimilarImages, + Settings } export enum TypeOfOpenedItem { diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index 77f663bf3..90b55e00e 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -1,6 +1,7 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint"; import {CurrentTab} from "common.slint"; import {ColorPalette} from "color_palette.slint"; +import {GuiState} from "gui_state.slint"; component TabItem { in property scanning; @@ -109,11 +110,17 @@ export component LeftSidePanel { } HorizontalLayout { - height: 20px; + padding-bottom: 2px; + padding-right: 3px; alignment: end; - Image { - width: 20px; - source: @image-url("../icons/settings.svg"); + Button { + height: 50px; + width: self.height; + icon: @image-url("../icons/settings.svg"); + clicked => { + active_tab = CurrentTab.Settings; + root.changed_current_tab(); + } } } } diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 511129db0..8b0e09e67 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -3,6 +3,7 @@ import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; import {CurrentTab, TypeOfOpenedItem} from "common.slint"; import {MainListModel} from "common.slint"; +import {SettingsList} from "settings_list.slint"; export component MainList { in-out property active-tab: CurrentTab.EmptyFolders; @@ -49,6 +50,11 @@ export component MainList { parentPathIdx: 5; fileNameIdx: 4; } + + settings_list := SettingsList { + visible: root.active-tab == CurrentTab.Settings; + } + focus_item := FocusScope { width: 0px; // Hack to not steal first click from other components - https://github.com/slint-ui/slint/issues/3503 // Hack not works https://github.com/slint-ui/slint/issues/3503#issuecomment-1817809834 because disables key-released event diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index 95414c5f5..724c64664 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -1,4 +1,8 @@ export global Settings { in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}]; in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}]; + + // Settings + in-out property excluded_items: "Excluded items"; + in-out property allowed_extensions: "Allowed extensions"; } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint new file mode 100644 index 000000000..f29100705 --- /dev/null +++ b/krokiet/ui/settings_list.slint @@ -0,0 +1,52 @@ +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, ScrollView, LineEdit, SpinBox} from "std-widgets.slint"; +import { Settings } from "settings.slint"; + +global SettingsSize { + out property item_height: 30px; +} + +component TextComponent inherits HorizontalLayout { + in-out property model; + in property name; + spacing: 5px; + Text { + horizontal-stretch: 0.0; + vertical-alignment: TextVerticalAlignment.center; + text: name; + } + LineEdit { + horizontal-stretch: 1.0; + height: SettingsSize.item_height; + text: Settings.excluded_items; + } +} + +export component SettingsList inherits ScrollView { + min-height: 300px; + VerticalLayout { + spacing: 5px; + Text { + text: "Settings"; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + font-size: 20px; + } + Text { + text: "General settings"; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + } + TextComponent { + name: "Excluded item:"; + model <=> Settings.excluded_items; + } + TextComponent { + name: "Allowed extensions:"; + model <=> Settings.allowed_extensions; + } + SpinBox { + enabled: true; + height: SettingsSize.item_height; + } + } +} \ No newline at end of file From eb52abf967d0a592d0dc89c313f616a099d574de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 22 Nov 2023 12:17:14 +0100 Subject: [PATCH 071/107] Changelog + mac output --- .github/workflows/mac.yml | 4 ++-- Changelog.md | 1 + krokiet/README.md | 40 +++++++++++++++++++++------------------ 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index a9b886123..e746fccc5 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -51,7 +51,7 @@ jobs: - name: Store MacOS Krokiet uses: actions/upload-artifact@v3 with: - name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }} + name: krokiet-${{ runner.os }}-${{ matrix.toolchain }} path: target/release/krokiet if: ${{ matrix.type == 'release' }} @@ -76,6 +76,6 @@ jobs: - name: Store MacOS Krokiet Heif uses: actions/upload-artifact@v3 with: - name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}-heif + name: krokiet-${{ runner.os }}-${{ matrix.toolchain }}-heif path: target/release/krokiet if: ${{ matrix.type == 'release' }} \ No newline at end of file diff --git a/Changelog.md b/Changelog.md index c8be0514f..f96e2b461 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,6 +1,7 @@ ## Version 7.0.0 - ? ### GTK GUI - Added drag&drop support for included/excluded folders - [#1106](https://github.com/qarmin/czkawka/pull/1106) +- Added information where is saved info about scan results - [#1102](https://github.com/qarmin/czkawka/pull/1102) ### CLI - Providing full static rust binary with [Eyra](https://github.com/sunfishcode/eyra) - [#1102](https://github.com/qarmin/czkawka/pull/1102) diff --git a/krokiet/README.md b/krokiet/README.md index a0899f773..f6e41cc36 100644 --- a/krokiet/README.md +++ b/krokiet/README.md @@ -6,11 +6,11 @@ C code. 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). -## Requirements +## Usage -Krokiet should not have any special runtime requirements - it should work on almost any OpenGL ES 2 capable device. +Krokiet should not have any special runtime requirements - it should work on almost any device non-antic device. -Alternatively, it can be run with software rendering on computers that don't have graphics card. +Prebuild binaries should work on Windows 10,11, Mac ## Compilation @@ -23,10 +23,10 @@ sudo apt install libfontconfig-dev libfreetype-dev Default compilation is done by `cargo build --release` and should work on most systems. You need the latest available version of Rust to compile it, because Krokiet aims to support the latest slint verions, -that should provide best experience(fixed more bugs/new features). +that should provide best experience. -The only exception is building non default skia renderer, that require on windows msvc compiler(not sure how to exactly -install it). +The only exception is building skia renderer which is non default feature that can be enabled manually if you want to +use it, that require on windows msvc compiler(not sure how to exactly install it). Also skia renderer is written in C++ and uses on platforms like x86_64 and arm64 prebuild binaries, so if you are using different architecture, this library will be build from source, which can take a lot of time and require additional @@ -75,14 +75,15 @@ Slint: Build config: debug; Backend: software ## Different theme -App was created with fluent theme in mind, but is possible to use dark theme by setting `SLINT_STYLE` environment -variable to `fluent-dark` during compilation e.g. +App was created with dark fluent theme in mind, but is possible to use light theme by setting `SLINT_STYLE` environment +variable to `fluent-light` during compilation e.g. ``` SLINT_STYLE=fluent-light cargo run -- --path . ``` -Slint supports also other themes, but they are not officially supported by this app and may be broken. +Slint supports also other themes, but they are not officially supported by this app and may be broken(but looks that +cupertino looks quite good with current style). ``` SLINT_STYLE=cupertino-light cargo run -- --path . @@ -121,25 +122,27 @@ SLINT_STYLE=material-dark cargo run -- --path . - logo - about window - reference folders -- translations(problem is only with interface, messages like "Checking {x} file" can be easily translated from rust side) +- translations(problem is only with interface, messages like "Checking {x} file" can be easily translated from rust + side) ## Why Slint? 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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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 | - Internal .slint language is more limited than QML(javascript flexibility is big pl)
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different
- 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) and this is also
- 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
- 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 | - 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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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(javascript flexibility is hard to )
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different
- 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 have multiple limitaions in different os
- Cannot select directory - file chooser only can choose files - small thing but important for me
- Not very performant Rust <=> Javascript communication | 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 to not look at Iced which only allows to create GUI from Rust. -GTK and QT also I throw away due cross compilation problems caused mostly by using C/C++ internally. +GTK and QT also I throw away due cross compilation problems caused mostly by using C/C++ internally. Using GTK in +Czkawka was a reason why I started to find other toolkits. Tauri - I don't really like to use Javascript because I already used it with Qt(C++) + QML + Typescript combination and I found that creating ui in such language may be simple at start but later any bigger changes cause a lot of runtime @@ -148,6 +151,7 @@ errors. So only Slint left with its cons and pros. ## License + Code is licensed under MIT license but entire project is licensed under GPL-3.0 license, due Slint license restrictions. ## Name From 46a5bdd01aa97d5b47e30ef19818b61d79c8e575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 22 Nov 2023 20:45:24 +0100 Subject: [PATCH 072/107] =?UTF-8?q?Cz=C5=82ek?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/linux_cli_eyra.yml | 2 +- .github/workflows/windows.yml | 4 +++- krokiet/src/main.rs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux_cli_eyra.yml b/.github/workflows/linux_cli_eyra.yml index 43d9b721c..e398738a1 100644 --- a/.github/workflows/linux_cli_eyra.yml +++ b/.github/workflows/linux_cli_eyra.yml @@ -22,7 +22,7 @@ jobs: run: sudo apt update || true; sudo apt install -y ffmpeg - name: Setup rust version - run: rustup default ${{ matrix.toolchain }} + run: rustup default nightly-2023-11-16 - name: Add eyra run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ce22b41a9..d0d9ef096 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -39,7 +39,9 @@ jobs: if-no-files-found: error - name: Show console window on windows - run: ./sd.exe -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs + run: | + ./sd.exe -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs + cat krokiet/src/main.rs - name: Compile Krokiet Console run: cargo build --release --bin krokiet diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 7318a209d..06e9f5809 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -1,5 +1,6 @@ // Remove console window in Windows OS #![windows_subsystem = "windows"] +#![allow(unknown_lints)] // May be disabled, but locally I use nightly clippy #![allow(clippy::comparison_chain)] #![allow(clippy::collapsible_if)] #![allow(clippy::should_panic_without_expect)] @@ -79,7 +80,7 @@ pub fn to_remove_debug(app: &MainWindow) { fn to_remove_create_with_header() -> Rc> { let header_row_data: Rc> = Rc::new(VecModel::default()); - for r in 0..100_000 { + for r in 0..10_000 { let items = VecModel::default(); for c in 0..3 { From 9cbfe5274bd41d7bc85722bf6c6272098ee31d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 22 Nov 2023 21:50:42 +0100 Subject: [PATCH 073/107] Windows compilation --- .github/workflows/windows.yml | 53 +++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d0d9ef096..689dfd327 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -9,7 +9,54 @@ env: CARGO_TERM_COLOR: always jobs: - krokiet: + krokiet-compiled-on-linux: + strategy: + fail-fast: false + matrix: + use_heif: [ normal ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies(mostly sd) + run: | + wget https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-unknown-linux-gnu.tar.gz -O a.tar.gz + tar -xzf a.tar.gz + cp sd-v1.0.0-x86_64-unknown-linux-gnu/sd . + chmod +x ./sd + + - name: Setup rust version + run: | + rustup target add x86_64-pc-windows-gnu + + - name: Compile Krokiet + run: cargo build --release --target x86_64-unknown-linux-gnu --bin krokiet + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: krokiet-windows-c-on-linux-${{ github.sha }}-${{ matrix.use_heif }} + path: | + target/release/krokiet.exe + if-no-files-found: error + + - name: Show console window on windows + run: | + ./sd.exe -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs + cat krokiet/src/main.rs + + - name: Compile Krokiet Console + run: cargo build --release --target x86_64-unknown-linux-gnu --bin krokiet + + - name: Upload artifacts Console + uses: actions/upload-artifact@v3 + with: + name: krokiet-windows-c-on-linux-${{ github.sha }}-${{ matrix.use_heif }}-console + path: | + target/release/krokiet.exe + if-no-files-found: error + + krokiet-compiled-on-windows: strategy: fail-fast: false matrix: @@ -33,7 +80,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: krokiet-windows-${{ github.sha }}-${{ matrix.use_heif }} + name: krokiet-windows-c-on-windows-${{ github.sha }}-${{ matrix.use_heif }} path: | target/release/krokiet.exe if-no-files-found: error @@ -49,7 +96,7 @@ jobs: - name: Upload artifacts Console uses: actions/upload-artifact@v3 with: - name: krokiet-windows-${{ github.sha }}-${{ matrix.use_heif }}-console + name: krokiet-windows-c-on-windows-${{ github.sha }}-${{ matrix.use_heif }}-console path: | target/release/krokiet.exe if-no-files-found: error From 20c8b6ec01bbe7f76a9ab33cce2862c11c1dea63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 23 Nov 2023 07:39:17 +0100 Subject: [PATCH 074/107] Excluded items --- .github/workflows/windows.yml | 2 +- krokiet/src/settings.rs | 33 ++++++++++++++++++++++++++++----- krokiet/ui/settings_list.slint | 2 +- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 689dfd327..46aa7da6b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -42,7 +42,7 @@ jobs: - name: Show console window on windows run: | - ./sd.exe -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs + ./sd -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs cat krokiet/src/main.rs - name: Compile Krokiet Console diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index a6d3612e2..3a33d3768 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -15,12 +15,21 @@ const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", #[cfg(not(target_family = "unix"))] const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["C:\\Windows"]; +#[cfg(target_family = "unix")] +pub const DEFAULT_EXCLUDED_ITEMS: &str = "*/.git/*,*/node_modules/*,*/lost+found/*,*/Trash/*,*/.Trash-*/*,*/snap/*,/home/*/.cache/*"; +#[cfg(not(target_family = "unix"))] +pub const DEFAULT_EXCLUDED_ITEMS: &str = "*\\.git\\*,*\\node_modules\\*,*\\lost+found\\*,*:\\windows\\*,*:\\$RECYCLE.BIN\\*,*:\\$SysReset\\*,*:\\System Volume Information\\*,*:\\OneDriveTemp\\*,*:\\hiberfil.sys,*:\\pagefile.sys,*:\\swapfile.sys"; + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SettingsCustom { #[serde(default = "default_included_directories")] pub included_directories: Vec, #[serde(default = "default_excluded_directories")] pub excluded_directories: Vec, + #[serde(default = "default_excluded_items")] + pub excluded_items: String, + #[serde(default)] + pub allowed_extensions: String, } impl Default for SettingsCustom { @@ -28,12 +37,14 @@ impl Default for SettingsCustom { Self { included_directories: default_included_directories(), excluded_directories: default_excluded_directories(), + excluded_items: default_excluded_items(), + allowed_extensions: String::new(), } } } pub fn reset_settings(app: &MainWindow) { - set_settings_to_gui(app, &SettingsCustom::default()); + serde::set_settings_to_gui(app, &SettingsCustom::default()); } pub fn load_settings_from_file(app: &MainWindow) { @@ -100,12 +111,15 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { let settings = app.global::(); // Included directories - let included_items = create_string_standard_list_view_from_pathbuf(&custom_settings.included_directories); - settings.set_included_directories(included_items); + let included_directories = create_string_standard_list_view_from_pathbuf(&custom_settings.included_directories); + settings.set_included_directories(included_directories); // Excluded directories - let excluded_items = create_string_standard_list_view_from_pathbuf(&custom_settings.excluded_directories); - settings.set_excluded_directories(excluded_items); + let excluded_directories = create_string_standard_list_view_from_pathbuf(&custom_settings.excluded_directories); + settings.set_excluded_directories(excluded_directories); + + settings.set_excluded_items(custom_settings.excluded_items.clone().into()); + settings.set_allowed_extensions(custom_settings.allowed_extensions.clone().into()); // Clear text app.global::().set_info_text("".into()); @@ -120,9 +134,14 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let excluded_directories = settings.get_excluded_directories(); let excluded_directories = excluded_directories.iter().map(|x| PathBuf::from(x.text.as_str())).collect::>(); + let excluded_items = settings.get_excluded_items().to_string(); + let allowed_extensions = settings.get_allowed_extensions().to_string(); + SettingsCustom { included_directories, excluded_directories, + excluded_items, + allowed_extensions, } } @@ -147,3 +166,7 @@ fn default_excluded_directories() -> Vec { excluded_directories.sort(); excluded_directories } + +fn default_excluded_items() -> String { + DEFAULT_EXCLUDED_ITEMS.to_string() +} diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index f29100705..6b0f57c05 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -17,7 +17,7 @@ component TextComponent inherits HorizontalLayout { LineEdit { horizontal-stretch: 1.0; height: SettingsSize.item_height; - text: Settings.excluded_items; + text: model; } } From 01d1e437cfc217e0481b594b2e4afc922a42dd15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 23 Nov 2023 08:04:39 +0100 Subject: [PATCH 075/107] >F --- krokiet/src/settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 3a33d3768..dbf323484 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -44,7 +44,7 @@ impl Default for SettingsCustom { } pub fn reset_settings(app: &MainWindow) { - serde::set_settings_to_gui(app, &SettingsCustom::default()); + set_settings_to_gui(app, &SettingsCustom::default()); } pub fn load_settings_from_file(app: &MainWindow) { From 63e36caf2d2e0c5bee726f57ed60c3ad116c608d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 23 Nov 2023 09:16:57 +0100 Subject: [PATCH 076/107] Windows --- .github/workflows/windows.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 46aa7da6b..d7ab38659 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -30,14 +30,14 @@ jobs: rustup target add x86_64-pc-windows-gnu - name: Compile Krokiet - run: cargo build --release --target x86_64-unknown-linux-gnu --bin krokiet + run: cargo build --release --target x86_64-pc-windows-gnu --bin krokiet - name: Upload artifacts uses: actions/upload-artifact@v3 with: name: krokiet-windows-c-on-linux-${{ github.sha }}-${{ matrix.use_heif }} path: | - target/release/krokiet.exe + target/x86_64-pc-windows-gnu/release/krokiet.exe if-no-files-found: error - name: Show console window on windows @@ -46,14 +46,14 @@ jobs: cat krokiet/src/main.rs - name: Compile Krokiet Console - run: cargo build --release --target x86_64-unknown-linux-gnu --bin krokiet + run: cargo build --release --target x86_64-pc-windows-gnu --bin krokiet - name: Upload artifacts Console uses: actions/upload-artifact@v3 with: name: krokiet-windows-c-on-linux-${{ github.sha }}-${{ matrix.use_heif }}-console path: | - target/release/krokiet.exe + target/x86_64-pc-windows-gnu/release/krokiet.exe if-no-files-found: error krokiet-compiled-on-windows: From 329b3bd033dfce420e4dc59e1e8737b20677e0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 23 Nov 2023 10:53:36 +0100 Subject: [PATCH 077/107] Mingw --- .github/workflows/windows.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d7ab38659..7ee84a04b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,6 +20,7 @@ jobs: - name: Install dependencies(mostly sd) run: | + apt update || true;apt install -y mingw-w64 mingw-w64-x86-64-dev wget https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-unknown-linux-gnu.tar.gz -O a.tar.gz tar -xzf a.tar.gz cp sd-v1.0.0-x86_64-unknown-linux-gnu/sd . From d4dfd28790b0394ab016fd6a2d74199a028b1581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 23 Nov 2023 12:00:49 +0100 Subject: [PATCH 078/107] sudo --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 7ee84a04b..c9b112578 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,7 +20,7 @@ jobs: - name: Install dependencies(mostly sd) run: | - apt update || true;apt install -y mingw-w64 mingw-w64-x86-64-dev + sudo apt update || true;sudo apt install -y mingw-w64 mingw-w64-x86-64-dev wget https://github.com/chmln/sd/releases/download/v1.0.0/sd-v1.0.0-x86_64-unknown-linux-gnu.tar.gz -O a.tar.gz tar -xzf a.tar.gz cp sd-v1.0.0-x86_64-unknown-linux-gnu/sd . From b70ab684cd774cb9324f71208da34f6f1a116d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 23 Nov 2023 21:54:55 +0100 Subject: [PATCH 079/107] OS info --- Cargo.lock | 117 +++++++++++++++++++-------------- README.md | 37 ++--------- czkawka_cli/LICENSE | 21 ++++++ czkawka_cli/README.md | 41 ++++++++++++ czkawka_core/Cargo.toml | 1 + czkawka_core/LICENSE | 21 ++++++ czkawka_core/README.md | 3 + czkawka_core/src/common.rs | 15 ++++- LICENSE => czkawka_gui/LICENSE | 0 czkawka_gui/README.md | 68 +++++++++++++++++++ 10 files changed, 239 insertions(+), 85 deletions(-) create mode 100644 czkawka_cli/LICENSE create mode 100644 czkawka_cli/README.md create mode 100644 czkawka_core/LICENSE create mode 100644 czkawka_core/README.md rename LICENSE => czkawka_gui/LICENSE (100%) diff --git a/Cargo.lock b/Cargo.lock index 43bb10cc2..e4a8ced62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -246,15 +246,15 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.6.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" +checksum = "fc5ea910c42e5ab19012bab31f53cb4d63d54c3a27730f9a833a88efcf4bb52d" dependencies = [ - "async-lock 2.8.0", + "async-lock 3.1.1", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite 1.13.0", + "futures-lite 2.0.1", "slab", ] @@ -272,16 +272,16 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +checksum = "9b4353121d5644cdf2beb5726ab752e79a8db1ebb52031770ec47db31d245526" dependencies = [ - "async-channel 1.9.0", + "async-channel 2.1.0", "async-executor", - "async-io 1.13.0", - "async-lock 2.8.0", + "async-io 2.2.0", + "async-lock 3.1.1", "blocking", - "futures-lite 1.13.0", + "futures-lite 2.0.1", "once_cell", ] @@ -311,14 +311,14 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" dependencies = [ - "async-lock 3.1.0", + "async-lock 3.1.1", "cfg-if", "concurrent-queue", "futures-io", "futures-lite 2.0.1", "parking", "polling 3.3.0", - "rustix 0.38.24", + "rustix 0.38.25", "slab", "tracing", "waker-fn", @@ -336,9 +336,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.1.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "deb2ab2aa8a746e221ab826c73f48bc6ba41be6763f0855cb249eb6d154cf1d7" +checksum = "655b9c7fe787d3b25cc0f804a1a8401790f0c5bc395beb5a64dc77d8de079105" dependencies = [ "event-listener 3.1.0", "event-listener-strategy", @@ -358,7 +358,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.24", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -385,7 +385,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.24", + "rustix 0.38.25", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -611,7 +611,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ "async-channel 2.1.0", - "async-lock 3.1.0", + "async-lock 3.1.1", "async-task", "fastrand 2.0.1", "futures-io", @@ -734,7 +734,7 @@ dependencies = [ "bitflags 2.4.1", "log", "polling 3.3.0", - "rustix 0.38.24", + "rustix 0.38.25", "slab", "thiserror", ] @@ -746,7 +746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ "calloop 0.12.3", - "rustix 0.38.24", + "rustix 0.38.25", "wayland-backend", "wayland-client", ] @@ -1301,6 +1301,7 @@ dependencies = [ "log", "mime_guess", "once_cell", + "os_info", "pdf", "rawloader", "rayon", @@ -1981,9 +1982,9 @@ checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -2076,7 +2077,11 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" dependencies = [ + "fastrand 2.0.1", "futures-core", + "futures-io", + "memchr", + "parking", "pin-project-lite", ] @@ -3023,9 +3028,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -3598,9 +3603,9 @@ checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" [[package]] name = "lyon_algorithms" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00a0349cd8f0270781bb93a824b63df6178e3b4a27794e7be3ce3763f5a44d6e" +checksum = "a3bca95f9a4955b3e4a821fbbcd5edfbd9be2a9a50bb5758173e5358bfb4c623" dependencies = [ "lyon_path", "num-traits", @@ -4010,9 +4015,9 @@ dependencies = [ [[package]] name = "open" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfabf1927dce4d6fdf563d63328a0a506101ced3ec780ca2135747336c98cef8" +checksum = "90878fb664448b54c4e592455ad02831e23a3f7e157374a8b95654731aac7349" dependencies = [ "is-wsl", "libc", @@ -4038,6 +4043,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "os_info" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e" +dependencies = [ + "log", + "winapi", +] + [[package]] name = "overload" version = "0.1.1" @@ -4188,9 +4203,9 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pico-args" @@ -4291,7 +4306,7 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix 0.38.24", + "rustix 0.38.25", "tracing", "windows-sys 0.48.0", ] @@ -4794,9 +4809,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.24" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ad981d6c340a49cdc40a1028d9c6084ec7e9fa33fcb839cab656a267071e234" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", @@ -4944,18 +4959,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", @@ -5181,7 +5196,7 @@ dependencies = [ "libc", "log", "memmap2 0.9.0", - "rustix 0.38.24", + "rustix 0.38.25", "thiserror", "wayland-backend", "wayland-client", @@ -5264,7 +5279,7 @@ dependencies = [ "objc", "raw-window-handle 0.5.2", "redox_syscall 0.4.1", - "rustix 0.38.24", + "rustix 0.38.25", "tiny-xlib", "wasm-bindgen", "wayland-backend", @@ -5628,7 +5643,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.4.1", - "rustix 0.38.24", + "rustix 0.38.25", "windows-sys 0.48.0", ] @@ -5784,9 +5799,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d0e245e80bdc9b4e5356fc45a72184abbc3861992603f515270e9340f5a219" +checksum = "83c02bf3c538ab32ba913408224323915f4ef9a6d61c0e85d493f355921c0ece" dependencies = [ "displaydoc", ] @@ -6132,9 +6147,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5ccd538d4a604753ebc2f17cd9946e89b77bf87f6a8e2309667c6f2e87855e3" +checksum = "7830e33f6e25723d41a63f77e434159dad02919f18f55a512b5f16f3b1d77138" dependencies = [ "base64", "flate2", @@ -6148,9 +6163,9 @@ dependencies = [ [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", @@ -6233,9 +6248,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.5.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" +checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" [[package]] name = "valuable" @@ -6557,9 +6572,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] name = "weezl" @@ -6576,7 +6591,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.24", + "rustix 0.38.25", ] [[package]] @@ -6807,7 +6822,7 @@ dependencies = [ "percent-encoding", "raw-window-handle 0.5.2", "redox_syscall 0.3.5", - "rustix 0.38.24", + "rustix 0.38.25", "sctk-adwaita", "smithay-client-toolkit", "smol_str", diff --git a/README.md b/README.md index 71080b9d2..c510cd443 100644 --- a/README.md +++ b/README.md @@ -27,24 +27,12 @@ ![Czkawka](https://user-images.githubusercontent.com/41945903/145280350-506f7e94-4db0-4de7-a68d-6e7c26bbd2bf.gif) -## Supported OS -Linux - Ubuntu 22.04+, Fedora 36+, Alpine Linux 3.16+, Debian 12+ and a lot of more - -Windows - 7, 8.1, 10, 11 -MacOS - 10.15+ - -If you are looking for older version that use GTK 3 and have support for more OS(like e.g. Ubuntu 20.04), look at [4.1.0](https://github.com/qarmin/czkawka/releases/tag/4.1.0) or older versions. - -## How do I use it? -You can find the instructions on how to use Czkawka [**here**](instructions/Instruction.md). - -Some helpful tricks you can find [**here**](instructions/Instruction.md#tips-tricks-and-known-bugs) - -## Installation -Installation instructions with download links you can find [**here**](instructions/Installation.md). - -## Compilation -If you want to try and develop Czkawka or just use the latest available feature, you may want to look at the [**compilation instructions**](instructions/Compilation.md). +## Usage, installation, compilation, requirements, license +Each tool uses different technologies, so you can find instructions for each of them in the appropriate file: +- [Czkawka GUI (GTK frontend)](czkawka_gui/README.md)
+- [Czkawka CLI](czkawka_cli/README.md)
+- [Czkawka Core](czkawka_core/README.md)
+- [Krokiet GUI (Slint frontend)](krokiet/README.md)
## Benchmarks @@ -167,19 +155,6 @@ but I gave up on these ideas because they contained Polish characters, which wou At the beginning of the program creation, if the response concerning the name was unanimously negative, I prepared myself for a possible change of the name of the program, and the opinions were extremely mixed. -## License -Code is distributed under MIT license. - -Icon was created by [jannuary](https://github.com/jannuary) and licensed CC-BY-4.0. - -Windows dark theme is used from project [WhiteSur](https://github.com/slypy/whitesur-gtk4-theme) with MIT license. - -Some icons were taken from [ReShot](https://www.reshot.com) site and are licensed under Reshot Free License. - -The program is completely free to use. - -"Gratis to uczciwa cena" - "Free is a fair price" - ## Thanks Big thanks to Pádraig Brady, creator of fantastic FSlint, because without his work I wouldn't create this tool. diff --git a/czkawka_cli/LICENSE b/czkawka_cli/LICENSE new file mode 100644 index 000000000..8836e460f --- /dev/null +++ b/czkawka_cli/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-2023 Rafał Mikrut + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/czkawka_cli/README.md b/czkawka_cli/README.md new file mode 100644 index 000000000..17ffd7194 --- /dev/null +++ b/czkawka_cli/README.md @@ -0,0 +1,41 @@ +# Czkawka CLI + +CLI frontend, allows to use Czkawka from terminal. + +## Requirements +Precompiled binaries should work without any additional dependencies with Linux(Ubuntu 20.04+), Windows(10+) and macOS(10.15+). + +If you decide to compile the app, you probably will be able to run it on even older versions of OS, like Ubuntu 16.04 or Windows 7. + +On linux it is even possible with eyra to avoid entirely libc and using fully static rust binary. + +If you want to use similar videos tool, you need to install ffmpeg(optional feature, only needed when running). +- mac - `brew install ffmpeg` - https://formulae.brew.sh/formula/ffmpeg +- linux - `sudo apt install ffmpeg` +- windows - `choco install ffmpeg` - or if not working, download from https://ffmpeg.org/download.html#build-windows and unpack to location with `czkawka_cli.exe` + +## Compilation +For compilation, you need to have installed Rust via rustup - https://rustup.rs/ and compile it e.g. via +```shell +cargo run --release --bin czkawka_cli +``` + +on linux to build fully static binary you need to use +```shell +rustup default nightly-2023-11-16 # or any newer nightly that works fine with eyra +cd czkawka_cli +cargo add eyra --rename=std +echo 'fn main() { println!("cargo:rustc-link-arg=-nostartfiles"); }' > build.rs +cd .. +cargo build --release --bin czkawka_cli +``` + +## Limitations +Not all available features in core are available in CLI. + +List of not available features: +- Ability to use/choose referenced directories +- See progress of scanning + +## LICENSE +MIT \ No newline at end of file diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index 6aefb4dc5..09cf5374c 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -74,6 +74,7 @@ anyhow = { version = "1.0" } state = "0.6" +os_info = { version = "3", default-features = false } rustc_version = "0.4" log = "0.4.20" handsome_logger = "0.8" diff --git a/czkawka_core/LICENSE b/czkawka_core/LICENSE new file mode 100644 index 000000000..8836e460f --- /dev/null +++ b/czkawka_core/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020-2023 Rafał Mikrut + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/czkawka_core/README.md b/czkawka_core/README.md new file mode 100644 index 000000000..6d39322b9 --- /dev/null +++ b/czkawka_core/README.md @@ -0,0 +1,3 @@ +# Czkawka Core + +Core of Czkawka GUI/CLI and Krokiet projects. diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index e4e8c8073..cb0066179 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -62,11 +62,20 @@ pub fn print_version_mode() { Ok(meta) => meta.semver.to_string(), Err(_) => "".to_string(), }; + let info = os_info::get(); + let debug_release = if cfg!(debug_assertions) { "debug" } else { "release" }; + + let processors = match thread::available_parallelism() { + Ok(t) => t.get(), + Err(_) => 1, + }; info!( - "App version: {}, compiled with {} mode on rustc {rust_version}", - CZKAWKA_VERSION, - if cfg!(debug_assertions) { "debug" } else { "release" }, + "App version: {CZKAWKA_VERSION}, {debug_release} mode, rust {rust_version}, os {} {} [{} {}], {processors} cpu/threads", + info.os_type(), + info.version(), + std::env::consts::ARCH, + info.bitness(), ); if cfg!(debug_assertions) { warn!("You are running debug version of app which is a lot of slower than release version."); diff --git a/LICENSE b/czkawka_gui/LICENSE similarity index 100% rename from LICENSE rename to czkawka_gui/LICENSE diff --git a/czkawka_gui/README.md b/czkawka_gui/README.md index e69de29bb..d688732fa 100644 --- a/czkawka_gui/README.md +++ b/czkawka_gui/README.md @@ -0,0 +1,68 @@ +# Czkawka GUI +Czkawka GUI is a graphical user interface for Czkawka Core written with GTK 4. + +## Requirements +Requirements depends on platform that you are using: +### Linux +#### Prebuild binaries + Ubuntu - `sudo apt install libgtk-4 libheif ffmpeg -y` +#### Snap - + none - all needed libraries are bundled in snap - except ffmpeg https://github.com/snapcrafters/ffmpeg/issues/73 +#### Flatpak + none - all needed libraries are bundled +### Mac +``` +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +brew install gtk4 adwaita-icon-theme ffmpeg librsvg libheif +``` + +### Windows +All needed libraries should be bundled in zip(except ffmpeg which you need download and unpack to location with `czkawka_gui.exe` - https://ffmpeg.org/download.html#build-windows) + + +| Program | Minimal version | +|:---------:|:-----------------:| +| Rust | 1.72.1 | +| GTK | 4.6 | + +Prebuild binaries - https://github.com/qarmin/czkawka/releases/
+Snap package - https://snapcraft.io/czkawka
+Flatpak package - https://flathub.org/apps/com.github.qarmin.czkawka
+ +## Compilation +Compilation of gui is harder that compilation cli or core, because uses gtk4 which is written in C and also requires a lot build and runtime dependencies. + +### Linux (Ubuntu, but on other OS should work similar) +```shell +sudo apt install libgtk-4-dev libheif-dev -y +cargo run --release --bin czkawka_gui +``` +### Mac +```shell +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +brew install rustup gtk4 adwaita-icon-theme ffmpeg librsvg libheif pkg-config +rustup-init +cargo run --release --bin czkawka_gui +``` +### Windows +Currently, it is not possible to compile app natively on Windows, but is possible to cross-compile it from Linux.
+You can check for CI for instructions how to cross-compile app(uses prebuilt docker image) - [CI Instructions](../.github/workflows/windows.yml) + +## Limitations +Not all available features in core are available in GUI and also there are limitations between platforms: +- Snap versions not allows to use similar videos feature +- Windows version not supports heif and webp files +- Prebuild binaries for mac arm not exists + +## License +Code is distributed under MIT license. + +Icon was created by [jannuary](https://github.com/jannuary) and licensed CC-BY-4.0. + +Windows dark theme is used from project [WhiteSur](https://github.com/slypy/whitesur-gtk4-theme) with MIT license. + +Some icons were taken from [ReShot](https://www.reshot.com) site and are licensed under Reshot Free License. + +The program is completely free to use. + +"Gratis to uczciwa cena" - "Free is a fair price" \ No newline at end of file From 85da7f3febe284161ea4d68e234d25bb5994f411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 24 Nov 2023 20:13:08 +0100 Subject: [PATCH 080/107] Bigger stack size --- czkawka_core/src/common.rs | 10 +- .../connect_things/connect_button_search.rs | 386 ++++++++++-------- krokiet/src/connect_scan.rs | 235 ++++++----- krokiet/ui/settings_list.slint | 66 ++- 4 files changed, 389 insertions(+), 308 deletions(-) diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index cb0066179..8a4acd252 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -32,6 +32,8 @@ use crate::duplicate::make_hard_link; use crate::CZKAWKA_VERSION; static NUMBER_OF_THREADS: state::InitCell = state::InitCell::new(); +pub const DEFAULT_THREAD_SIZE: usize = 8 * 1024 * 1024; // 8 MB +pub const DEFAULT_WORKER_THREAD_SIZE: usize = 4 * 1024 * 1024; // 4 MB pub fn get_number_of_threads() -> usize { let data = NUMBER_OF_THREADS.get(); @@ -62,7 +64,6 @@ pub fn print_version_mode() { Ok(meta) => meta.semver.to_string(), Err(_) => "".to_string(), }; - let info = os_info::get(); let debug_release = if cfg!(debug_assertions) { "debug" } else { "release" }; let processors = match thread::available_parallelism() { @@ -70,6 +71,7 @@ pub fn print_version_mode() { Err(_) => 1, }; + let info = os_info::get(); info!( "App version: {CZKAWKA_VERSION}, {debug_release} mode, rust {rust_version}, os {} {} [{} {}], {processors} cpu/threads", info.os_type(), @@ -93,7 +95,11 @@ pub fn get_default_number_of_threads() -> usize { pub fn set_number_of_threads(thread_number: usize) { NUMBER_OF_THREADS.set(thread_number); - rayon::ThreadPoolBuilder::new().num_threads(get_number_of_threads()).build_global().unwrap(); + rayon::ThreadPoolBuilder::new() + .num_threads(get_number_of_threads()) + .stack_size(DEFAULT_WORKER_THREAD_SIZE) + .build_global() + .unwrap(); } pub const RAW_IMAGE_EXTENSIONS: &[&str] = &[ diff --git a/czkawka_gui/src/connect_things/connect_button_search.rs b/czkawka_gui/src/connect_things/connect_button_search.rs index 077e3d885..603f43c0d 100644 --- a/czkawka_gui/src/connect_things/connect_button_search.rs +++ b/czkawka_gui/src/connect_things/connect_button_search.rs @@ -12,6 +12,7 @@ use gtk4::Grid; use czkawka_core::bad_extensions::BadExtensions; use czkawka_core::big_file::BigFile; use czkawka_core::broken_files::{BrokenFiles, CheckedTypes}; +use czkawka_core::common::DEFAULT_THREAD_SIZE; use czkawka_core::common_dir_traversal::{CheckingMethod, ProgressData}; use czkawka_core::common_tool::CommonData; use czkawka_core::duplicate::DuplicateFinder; @@ -315,30 +316,33 @@ fn duplicate_search( let delete_outdated_cache = check_button_settings_duplicates_delete_outdated_cache.is_active(); // Find duplicates - thread::spawn(move || { - let mut df = DuplicateFinder::new(); - df.set_included_directory(loaded_common_items.included_directories); - df.set_excluded_directory(loaded_common_items.excluded_directories); - df.set_reference_directory(loaded_common_items.reference_directories); - df.set_recursive_search(loaded_common_items.recursive_search); - df.set_excluded_items(loaded_common_items.excluded_items); - df.set_allowed_extensions(loaded_common_items.allowed_extensions); - df.set_minimal_file_size(loaded_common_items.minimal_file_size); - df.set_maximal_file_size(loaded_common_items.maximal_file_size); - df.set_minimal_cache_file_size(loaded_common_items.minimal_cache_file_size); - df.set_minimal_prehash_cache_file_size(minimal_prehash_cache_file_size); - df.set_check_method(check_method); - df.set_hash_type(hash_type); - df.set_save_also_as_json(loaded_common_items.save_also_as_json); - df.set_ignore_hard_links(loaded_common_items.hide_hard_links); - df.set_use_cache(loaded_common_items.use_cache); - df.set_use_prehash_cache(use_prehash_cache); - df.set_delete_outdated_cache(delete_outdated_cache); - df.set_case_sensitive_name_comparison(case_sensitive_name_comparison); - df.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - df.find_duplicates(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::Duplicates(df)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut df = DuplicateFinder::new(); + df.set_included_directory(loaded_common_items.included_directories); + df.set_excluded_directory(loaded_common_items.excluded_directories); + df.set_reference_directory(loaded_common_items.reference_directories); + df.set_recursive_search(loaded_common_items.recursive_search); + df.set_excluded_items(loaded_common_items.excluded_items); + df.set_allowed_extensions(loaded_common_items.allowed_extensions); + df.set_minimal_file_size(loaded_common_items.minimal_file_size); + df.set_maximal_file_size(loaded_common_items.maximal_file_size); + df.set_minimal_cache_file_size(loaded_common_items.minimal_cache_file_size); + df.set_minimal_prehash_cache_file_size(minimal_prehash_cache_file_size); + df.set_check_method(check_method); + df.set_hash_type(hash_type); + df.set_save_also_as_json(loaded_common_items.save_also_as_json); + df.set_ignore_hard_links(loaded_common_items.hide_hard_links); + df.set_use_cache(loaded_common_items.use_cache); + df.set_use_prehash_cache(use_prehash_cache); + df.set_delete_outdated_cache(delete_outdated_cache); + df.set_case_sensitive_name_comparison(case_sensitive_name_comparison); + df.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + df.find_duplicates(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::Duplicates(df)).unwrap(); + }) + .unwrap(); } fn empty_files_search( @@ -354,18 +358,21 @@ fn empty_files_search( let tree_view_empty_files_finder = gui_data.main_notebook.tree_view_empty_files_finder.clone(); clean_tree_view(&tree_view_empty_files_finder); // Find empty files - thread::spawn(move || { - let mut vf = EmptyFiles::new(); - - vf.set_included_directory(loaded_common_items.included_directories); - vf.set_excluded_directory(loaded_common_items.excluded_directories); - vf.set_recursive_search(loaded_common_items.recursive_search); - vf.set_excluded_items(loaded_common_items.excluded_items); - vf.set_allowed_extensions(loaded_common_items.allowed_extensions); - vf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - vf.find_empty_files(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::EmptyFiles(vf)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut vf = EmptyFiles::new(); + + vf.set_included_directory(loaded_common_items.included_directories); + vf.set_excluded_directory(loaded_common_items.excluded_directories); + vf.set_recursive_search(loaded_common_items.recursive_search); + vf.set_excluded_items(loaded_common_items.excluded_items); + vf.set_allowed_extensions(loaded_common_items.allowed_extensions); + vf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + vf.find_empty_files(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::EmptyFiles(vf)).unwrap(); + }) + .unwrap(); } fn empty_directories_search( @@ -381,15 +388,18 @@ fn empty_directories_search( let tree_view_empty_folder_finder = gui_data.main_notebook.tree_view_empty_folder_finder.clone(); clean_tree_view(&tree_view_empty_folder_finder); - thread::spawn(move || { - let mut ef = EmptyFolder::new(); - ef.set_included_directory(loaded_common_items.included_directories); - ef.set_excluded_directory(loaded_common_items.excluded_directories); - ef.set_excluded_items(loaded_common_items.excluded_items); - ef.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - ef.find_empty_folders(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::EmptyFolders(ef)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut ef = EmptyFolder::new(); + ef.set_included_directory(loaded_common_items.included_directories); + ef.set_excluded_directory(loaded_common_items.excluded_directories); + ef.set_excluded_items(loaded_common_items.excluded_items); + ef.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + ef.find_empty_folders(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::EmptyFolders(ef)).unwrap(); + }) + .unwrap(); } fn big_files_search( @@ -412,20 +422,23 @@ fn big_files_search( let numbers_of_files_to_check = entry_big_files_number.text().as_str().parse::().unwrap_or(50); - thread::spawn(move || { - let mut bf = BigFile::new(); - - bf.set_included_directory(loaded_common_items.included_directories); - bf.set_excluded_directory(loaded_common_items.excluded_directories); - bf.set_recursive_search(loaded_common_items.recursive_search); - bf.set_excluded_items(loaded_common_items.excluded_items); - bf.set_allowed_extensions(loaded_common_items.allowed_extensions); - bf.set_number_of_files_to_check(numbers_of_files_to_check); - bf.set_search_mode(big_files_mode); - bf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - bf.find_big_files(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::BigFiles(bf)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut bf = BigFile::new(); + + bf.set_included_directory(loaded_common_items.included_directories); + bf.set_excluded_directory(loaded_common_items.excluded_directories); + bf.set_recursive_search(loaded_common_items.recursive_search); + bf.set_excluded_items(loaded_common_items.excluded_items); + bf.set_allowed_extensions(loaded_common_items.allowed_extensions); + bf.set_number_of_files_to_check(numbers_of_files_to_check); + bf.set_search_mode(big_files_mode); + bf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + bf.find_big_files(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::BigFiles(bf)).unwrap(); + }) + .unwrap(); } fn temporary_files_search( @@ -441,17 +454,20 @@ fn temporary_files_search( let tree_view_temporary_files_finder = gui_data.main_notebook.tree_view_temporary_files_finder.clone(); clean_tree_view(&tree_view_temporary_files_finder); - thread::spawn(move || { - let mut tf = Temporary::new(); - - tf.set_included_directory(loaded_common_items.included_directories); - tf.set_excluded_directory(loaded_common_items.excluded_directories); - tf.set_recursive_search(loaded_common_items.recursive_search); - tf.set_excluded_items(loaded_common_items.excluded_items); - tf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - tf.find_temporary_files(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::Temporary(tf)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut tf = Temporary::new(); + + tf.set_included_directory(loaded_common_items.included_directories); + tf.set_excluded_directory(loaded_common_items.excluded_directories); + tf.set_recursive_search(loaded_common_items.recursive_search); + tf.set_excluded_items(loaded_common_items.excluded_items); + tf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + tf.find_temporary_files(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::Temporary(tf)).unwrap(); + }) + .unwrap(); } fn same_music_search( @@ -509,28 +525,31 @@ fn same_music_search( let minimum_segment_duration = scale_seconds_same_music.value() as f32; if music_similarity != MusicSimilarity::NONE || check_method == CheckingMethod::AudioContent { - thread::spawn(move || { - let mut mf = SameMusic::new(); - - mf.set_included_directory(loaded_common_items.included_directories); - mf.set_excluded_directory(loaded_common_items.excluded_directories); - mf.set_reference_directory(loaded_common_items.reference_directories); - mf.set_excluded_items(loaded_common_items.excluded_items); - mf.set_use_cache(loaded_common_items.use_cache); - mf.set_minimal_file_size(loaded_common_items.minimal_file_size); - mf.set_maximal_file_size(loaded_common_items.maximal_file_size); - mf.set_allowed_extensions(loaded_common_items.allowed_extensions); - mf.set_recursive_search(loaded_common_items.recursive_search); - mf.set_music_similarity(music_similarity); - mf.set_maximum_difference(maximum_difference); - mf.set_minimum_segment_duration(minimum_segment_duration); - mf.set_check_type(check_method); - mf.set_approximate_comparison(approximate_comparison); - mf.set_save_also_as_json(loaded_common_items.save_also_as_json); - mf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - mf.find_same_music(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::SameMusic(mf)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut mf = SameMusic::new(); + + mf.set_included_directory(loaded_common_items.included_directories); + mf.set_excluded_directory(loaded_common_items.excluded_directories); + mf.set_reference_directory(loaded_common_items.reference_directories); + mf.set_excluded_items(loaded_common_items.excluded_items); + mf.set_use_cache(loaded_common_items.use_cache); + mf.set_minimal_file_size(loaded_common_items.minimal_file_size); + mf.set_maximal_file_size(loaded_common_items.maximal_file_size); + mf.set_allowed_extensions(loaded_common_items.allowed_extensions); + mf.set_recursive_search(loaded_common_items.recursive_search); + mf.set_music_similarity(music_similarity); + mf.set_maximum_difference(maximum_difference); + mf.set_minimum_segment_duration(minimum_segment_duration); + mf.set_check_type(check_method); + mf.set_approximate_comparison(approximate_comparison); + mf.set_save_also_as_json(loaded_common_items.save_also_as_json); + mf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + mf.find_same_music(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::SameMusic(mf)).unwrap(); + }) + .unwrap(); } else { let shared_buttons = gui_data.shared_buttons.clone(); let buttons_array = gui_data.bottom_buttons.buttons_array.clone(); @@ -591,21 +610,24 @@ fn broken_files_search( } if checked_types != CheckedTypes::NONE { - thread::spawn(move || { - let mut br = BrokenFiles::new(); - - br.set_included_directory(loaded_common_items.included_directories); - br.set_excluded_directory(loaded_common_items.excluded_directories); - br.set_recursive_search(loaded_common_items.recursive_search); - br.set_excluded_items(loaded_common_items.excluded_items); - br.set_use_cache(loaded_common_items.use_cache); - br.set_allowed_extensions(loaded_common_items.allowed_extensions); - br.set_save_also_as_json(loaded_common_items.save_also_as_json); - br.set_checked_types(checked_types); - br.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - br.find_broken_files(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::BrokenFiles(br)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut br = BrokenFiles::new(); + + br.set_included_directory(loaded_common_items.included_directories); + br.set_excluded_directory(loaded_common_items.excluded_directories); + br.set_recursive_search(loaded_common_items.recursive_search); + br.set_excluded_items(loaded_common_items.excluded_items); + br.set_use_cache(loaded_common_items.use_cache); + br.set_allowed_extensions(loaded_common_items.allowed_extensions); + br.set_save_also_as_json(loaded_common_items.save_also_as_json); + br.set_checked_types(checked_types); + br.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + br.find_broken_files(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::BrokenFiles(br)).unwrap(); + }) + .unwrap(); } else { let shared_buttons = gui_data.shared_buttons.clone(); let buttons_array = gui_data.bottom_buttons.buttons_array.clone(); @@ -668,29 +690,32 @@ fn similar_image_search( let delete_outdated_cache = check_button_settings_similar_images_delete_outdated_cache.is_active(); - thread::spawn(move || { - let mut sf = SimilarImages::new(); - - sf.set_included_directory(loaded_common_items.included_directories); - sf.set_excluded_directory(loaded_common_items.excluded_directories); - sf.set_reference_directory(loaded_common_items.reference_directories); - sf.set_recursive_search(loaded_common_items.recursive_search); - sf.set_excluded_items(loaded_common_items.excluded_items); - sf.set_minimal_file_size(loaded_common_items.minimal_file_size); - sf.set_maximal_file_size(loaded_common_items.maximal_file_size); - sf.set_similarity(similarity); - sf.set_use_cache(loaded_common_items.use_cache); - sf.set_hash_alg(hash_alg); - sf.set_hash_size(hash_size); - sf.set_image_filter(image_filter); - sf.set_allowed_extensions(loaded_common_items.allowed_extensions); - sf.set_delete_outdated_cache(delete_outdated_cache); - sf.set_exclude_images_with_same_size(ignore_same_size); - sf.set_save_also_as_json(loaded_common_items.save_also_as_json); - sf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - sf.find_similar_images(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::SimilarImages(sf)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut sf = SimilarImages::new(); + + sf.set_included_directory(loaded_common_items.included_directories); + sf.set_excluded_directory(loaded_common_items.excluded_directories); + sf.set_reference_directory(loaded_common_items.reference_directories); + sf.set_recursive_search(loaded_common_items.recursive_search); + sf.set_excluded_items(loaded_common_items.excluded_items); + sf.set_minimal_file_size(loaded_common_items.minimal_file_size); + sf.set_maximal_file_size(loaded_common_items.maximal_file_size); + sf.set_similarity(similarity); + sf.set_use_cache(loaded_common_items.use_cache); + sf.set_hash_alg(hash_alg); + sf.set_hash_size(hash_size); + sf.set_image_filter(image_filter); + sf.set_allowed_extensions(loaded_common_items.allowed_extensions); + sf.set_delete_outdated_cache(delete_outdated_cache); + sf.set_exclude_images_with_same_size(ignore_same_size); + sf.set_save_also_as_json(loaded_common_items.save_also_as_json); + sf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + sf.find_similar_images(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::SimilarImages(sf)).unwrap(); + }) + .unwrap(); } fn similar_video_search( @@ -715,26 +740,29 @@ fn similar_video_search( let ignore_same_size = check_button_video_ignore_same_size.is_active(); - thread::spawn(move || { - let mut sf = SimilarVideos::new(); - - sf.set_included_directory(loaded_common_items.included_directories); - sf.set_excluded_directory(loaded_common_items.excluded_directories); - sf.set_reference_directory(loaded_common_items.reference_directories); - sf.set_recursive_search(loaded_common_items.recursive_search); - sf.set_excluded_items(loaded_common_items.excluded_items); - sf.set_minimal_file_size(loaded_common_items.minimal_file_size); - sf.set_maximal_file_size(loaded_common_items.maximal_file_size); - sf.set_allowed_extensions(loaded_common_items.allowed_extensions); - sf.set_use_cache(loaded_common_items.use_cache); - sf.set_tolerance(tolerance); - sf.set_delete_outdated_cache(delete_outdated_cache); - sf.set_exclude_videos_with_same_size(ignore_same_size); - sf.set_save_also_as_json(loaded_common_items.save_also_as_json); - sf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - sf.find_similar_videos(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::SimilarVideos(sf)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut sf = SimilarVideos::new(); + + sf.set_included_directory(loaded_common_items.included_directories); + sf.set_excluded_directory(loaded_common_items.excluded_directories); + sf.set_reference_directory(loaded_common_items.reference_directories); + sf.set_recursive_search(loaded_common_items.recursive_search); + sf.set_excluded_items(loaded_common_items.excluded_items); + sf.set_minimal_file_size(loaded_common_items.minimal_file_size); + sf.set_maximal_file_size(loaded_common_items.maximal_file_size); + sf.set_allowed_extensions(loaded_common_items.allowed_extensions); + sf.set_use_cache(loaded_common_items.use_cache); + sf.set_tolerance(tolerance); + sf.set_delete_outdated_cache(delete_outdated_cache); + sf.set_exclude_videos_with_same_size(ignore_same_size); + sf.set_save_also_as_json(loaded_common_items.save_also_as_json); + sf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + sf.find_similar_videos(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::SimilarVideos(sf)).unwrap(); + }) + .unwrap(); } fn bad_symlinks_search( @@ -750,18 +778,21 @@ fn bad_symlinks_search( let tree_view_invalid_symlinks = gui_data.main_notebook.tree_view_invalid_symlinks.clone(); clean_tree_view(&tree_view_invalid_symlinks); - thread::spawn(move || { - let mut isf = InvalidSymlinks::new(); - - isf.set_included_directory(loaded_common_items.included_directories); - isf.set_excluded_directory(loaded_common_items.excluded_directories); - isf.set_recursive_search(loaded_common_items.recursive_search); - isf.set_excluded_items(loaded_common_items.excluded_items); - isf.set_allowed_extensions(loaded_common_items.allowed_extensions); - isf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - isf.find_invalid_links(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::InvalidSymlinks(isf)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut isf = InvalidSymlinks::new(); + + isf.set_included_directory(loaded_common_items.included_directories); + isf.set_excluded_directory(loaded_common_items.excluded_directories); + isf.set_recursive_search(loaded_common_items.recursive_search); + isf.set_excluded_items(loaded_common_items.excluded_items); + isf.set_allowed_extensions(loaded_common_items.allowed_extensions); + isf.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + isf.find_invalid_links(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::InvalidSymlinks(isf)).unwrap(); + }) + .unwrap(); } fn bad_extensions_search( @@ -777,20 +808,23 @@ fn bad_extensions_search( let tree_view_bad_extensions = gui_data.main_notebook.tree_view_bad_extensions.clone(); clean_tree_view(&tree_view_bad_extensions); - thread::spawn(move || { - let mut be = BadExtensions::new(); - - be.set_included_directory(loaded_common_items.included_directories); - be.set_excluded_directory(loaded_common_items.excluded_directories); - be.set_excluded_items(loaded_common_items.excluded_items); - be.set_minimal_file_size(loaded_common_items.minimal_file_size); - be.set_maximal_file_size(loaded_common_items.maximal_file_size); - be.set_allowed_extensions(loaded_common_items.allowed_extensions); - be.set_recursive_search(loaded_common_items.recursive_search); - be.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); - be.find_bad_extensions_files(Some(&stop_receiver), Some(&progress_data_sender)); - glib_stop_sender.send(Message::BadExtensions(be)).unwrap(); - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut be = BadExtensions::new(); + + be.set_included_directory(loaded_common_items.included_directories); + be.set_excluded_directory(loaded_common_items.excluded_directories); + be.set_excluded_items(loaded_common_items.excluded_items); + be.set_minimal_file_size(loaded_common_items.minimal_file_size); + be.set_maximal_file_size(loaded_common_items.maximal_file_size); + be.set_allowed_extensions(loaded_common_items.allowed_extensions); + be.set_recursive_search(loaded_common_items.recursive_search); + be.set_exclude_other_filesystems(loaded_common_items.ignore_other_filesystems); + be.find_bad_extensions_files(Some(&stop_receiver), Some(&progress_data_sender)); + glib_stop_sender.send(Message::BadExtensions(be)).unwrap(); + }) + .unwrap(); } #[fun_time(message = "clean_tree_view", level = "debug")] diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 9d545089f..8f7e58b0c 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -3,7 +3,7 @@ use crate::settings::{collect_settings, SettingsCustom}; use crate::{CurrentTab, GuiState, MainListModel, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; use crossbeam_channel::{Receiver, Sender}; -use czkawka_core::common::split_path; +use czkawka_core::common::{split_path, DEFAULT_THREAD_SIZE}; use czkawka_core::common_dir_traversal::ProgressData; use czkawka_core::common_tool::CommonData; use czkawka_core::common_traits::ResultEntry; @@ -50,40 +50,87 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender, progress_sender: Sender, stop_receiver: Receiver<()>, custom_settings: SettingsCustom) { - thread::spawn(move || { - let mut finder = SimilarImages::new(); - finder.set_included_directory(custom_settings.included_directories.clone()); - finder.set_excluded_directory(custom_settings.excluded_directories.clone()); - finder.find_similar_images(Some(&stop_receiver), Some(&progress_sender)); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut finder = SimilarImages::new(); + finder.set_included_directory(custom_settings.included_directories.clone()); + finder.set_excluded_directory(custom_settings.excluded_directories.clone()); + finder.find_similar_images(Some(&stop_receiver), Some(&progress_sender)); + + let mut vector = finder.get_similar_images().clone(); + let messages = finder.get_text_messages().create_messages_text(); + + for vec_fe in &mut vector { + vec_fe.sort_unstable_by_key(|e| e.similarity); + } - let mut vector = finder.get_similar_images().clone(); - let messages = finder.get_text_messages().create_messages_text(); + let hash_size = finder.hash_size; - for vec_fe in &mut vector { - vec_fe.sort_unstable_by_key(|e| e.similarity); - } + a.upgrade_in_event_loop(move |app| { + let number_of_empty_files = vector.len(); + let items = Rc::new(VecModel::default()); + for vec_fe in vector { + items.push(MainListModel { + checked: false, + header_row: true, + selected_row: false, + val: ModelRc::new(VecModel::default()), + }); + for fe in vec_fe { + let (directory, file) = split_path(fe.get_path()); + let data_model = create_vec_model_from_vec_string(vec![ + similar_images::get_string_from_similarity(&fe.similarity, hash_size), + format_size(fe.size, BINARY), + fe.dimensions.clone(), + file, + directory, + NaiveDateTime::from_timestamp_opt(fe.get_modified_date() as i64, 0).unwrap().to_string(), + ]); + + let main = MainListModel { + checked: false, + header_row: false, + selected_row: false, + val: ModelRc::new(data_model), + }; + items.push(main); + } + } + app.set_similar_images_model(items.into()); + app.invoke_scan_ended(format!("Found {} similar images files", number_of_empty_files).into()); + app.global::().set_info_text(messages.into()); + }) + }) + .unwrap(); +} - let hash_size = finder.hash_size; - - a.upgrade_in_event_loop(move |app| { - let number_of_empty_files = vector.len(); - let items = Rc::new(VecModel::default()); - for vec_fe in vector { - items.push(MainListModel { - checked: false, - header_row: true, - selected_row: false, - val: ModelRc::new(VecModel::default()), - }); - for fe in vec_fe { +fn scan_empty_files(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>, custom_settings: SettingsCustom) { + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut finder = EmptyFiles::new(); + finder.set_included_directory(custom_settings.included_directories.clone()); + finder.set_excluded_directory(custom_settings.excluded_directories.clone()); + finder.find_empty_files(Some(&stop_receiver), Some(&progress_sender)); + + let mut vector = finder.get_empty_files().clone(); + let messages = finder.get_text_messages().create_messages_text(); + + vector.sort_unstable_by_key(|e| { + let t = split_path(e.get_path()); + (t.0, t.1) + }); + + a.upgrade_in_event_loop(move |app| { + let number_of_empty_files = vector.len(); + let items = Rc::new(VecModel::default()); + for fe in vector { let (directory, file) = split_path(fe.get_path()); - let data_model = create_vec_model_from_vec_string(vec![ - similar_images::get_string_from_similarity(&fe.similarity, hash_size), - format_size(fe.size, BINARY), - fe.dimensions.clone(), - file, - directory, - NaiveDateTime::from_timestamp_opt(fe.get_modified_date() as i64, 0).unwrap().to_string(), + let data_model = VecModel::from_slice(&[ + SharedString::from(file), + SharedString::from(directory), + SharedString::from(NaiveDateTime::from_timestamp_opt(fe.get_modified_date() as i64, 0).unwrap().to_string()), ]); let main = MainListModel { @@ -94,92 +141,54 @@ fn scan_similar_images(a: Weak, progress_sender: Sender().set_info_text(messages.into()); - }) - }); -} - -fn scan_empty_files(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>, custom_settings: SettingsCustom) { - thread::spawn(move || { - let mut finder = EmptyFiles::new(); - finder.set_included_directory(custom_settings.included_directories.clone()); - finder.set_excluded_directory(custom_settings.excluded_directories.clone()); - finder.find_empty_files(Some(&stop_receiver), Some(&progress_sender)); - - let mut vector = finder.get_empty_files().clone(); - let messages = finder.get_text_messages().create_messages_text(); - - vector.sort_unstable_by_key(|e| { - let t = split_path(e.get_path()); - (t.0, t.1) - }); - - a.upgrade_in_event_loop(move |app| { - let number_of_empty_files = vector.len(); - let items = Rc::new(VecModel::default()); - for fe in vector { - let (directory, file) = split_path(fe.get_path()); - let data_model = VecModel::from_slice(&[ - SharedString::from(file), - SharedString::from(directory), - SharedString::from(NaiveDateTime::from_timestamp_opt(fe.get_modified_date() as i64, 0).unwrap().to_string()), - ]); - - let main = MainListModel { - checked: false, - header_row: false, - selected_row: false, - val: ModelRc::new(data_model), - }; - items.push(main); - } - app.set_empty_files_model(items.into()); - app.invoke_scan_ended(format!("Found {} empty files", number_of_empty_files).into()); - app.global::().set_info_text(messages.into()); + app.set_empty_files_model(items.into()); + app.invoke_scan_ended(format!("Found {} empty files", number_of_empty_files).into()); + app.global::().set_info_text(messages.into()); + }) }) - }); + .unwrap(); } fn scan_empty_folders(a: Weak, progress_sender: Sender, stop_receiver: Receiver<()>, custom_settings: SettingsCustom) { - thread::spawn(move || { - let mut finder = EmptyFolder::new(); - finder.set_included_directory(custom_settings.included_directories.clone()); - finder.set_excluded_directory(custom_settings.excluded_directories.clone()); - finder.find_empty_folders(Some(&stop_receiver), Some(&progress_sender)); - - let mut vector = finder.get_empty_folder_list().keys().cloned().collect::>(); - let messages = finder.get_text_messages().create_messages_text(); - - vector.sort_unstable_by_key(|e| { - let t = split_path(e.as_path()); - (t.0, t.1) - }); + thread::Builder::new() + .stack_size(DEFAULT_THREAD_SIZE) + .spawn(move || { + let mut finder = EmptyFolder::new(); + finder.set_included_directory(custom_settings.included_directories.clone()); + finder.set_excluded_directory(custom_settings.excluded_directories.clone()); + finder.find_empty_folders(Some(&stop_receiver), Some(&progress_sender)); + + let mut vector = finder.get_empty_folder_list().keys().cloned().collect::>(); + let messages = finder.get_text_messages().create_messages_text(); + + vector.sort_unstable_by_key(|e| { + let t = split_path(e.as_path()); + (t.0, t.1) + }); + + a.upgrade_in_event_loop(move |app| { + let folder_map = finder.get_empty_folder_list(); + let items = Rc::new(VecModel::default()); + for path in vector { + let (directory, file) = split_path(&path); + let data_model = VecModel::from_slice(&[ + SharedString::from(file), + SharedString::from(directory), + SharedString::from(NaiveDateTime::from_timestamp_opt(folder_map[&path].modified_date as i64, 0).unwrap().to_string()), + ]); - a.upgrade_in_event_loop(move |app| { - let folder_map = finder.get_empty_folder_list(); - let items = Rc::new(VecModel::default()); - for path in vector { - let (directory, file) = split_path(&path); - let data_model = VecModel::from_slice(&[ - SharedString::from(file), - SharedString::from(directory), - SharedString::from(NaiveDateTime::from_timestamp_opt(folder_map[&path].modified_date as i64, 0).unwrap().to_string()), - ]); - - let main = MainListModel { - checked: false, - header_row: false, - selected_row: false, - val: ModelRc::new(data_model), - }; - items.push(main); - } - app.set_empty_folder_model(items.into()); - app.invoke_scan_ended(format!("Found {} empty folders", folder_map.len()).into()); - app.global::().set_info_text(messages.into()); + let main = MainListModel { + checked: false, + header_row: false, + selected_row: false, + val: ModelRc::new(data_model), + }; + items.push(main); + } + app.set_empty_folder_model(items.into()); + app.invoke_scan_ended(format!("Found {} empty folders", folder_map.len()).into()); + app.global::().set_info_text(messages.into()); + }) }) - }); + .unwrap(); } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 6b0f57c05..b5be0c5bc 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -21,32 +21,64 @@ component TextComponent inherits HorizontalLayout { } } -export component SettingsList inherits ScrollView { - min-height: 300px; - VerticalLayout { +component MinMaxSizeComponent inherits HorizontalLayout { + spacing: 20px; + Text { + horizontal-stretch: 0.0; + text:"Size"; + vertical-alignment: TextVerticalAlignment.center; + } + HorizontalLayout { spacing: 5px; + horizontal-stretch: 1.0; Text { - text: "Settings"; - height: SettingsSize.item_height; - horizontal-alignment: TextHorizontalAlignment.center; - font-size: 20px; + text:"Min:"; + vertical-alignment: TextVerticalAlignment.center; } - Text { - text: "General settings"; + SpinBox { + enabled: true; height: SettingsSize.item_height; - horizontal-alignment: TextHorizontalAlignment.center; - } - TextComponent { - name: "Excluded item:"; - model <=> Settings.excluded_items; } - TextComponent { - name: "Allowed extensions:"; - model <=> Settings.allowed_extensions; + Text { + text:"Max:"; + vertical-alignment: TextVerticalAlignment.center; } SpinBox { enabled: true; height: SettingsSize.item_height; } } +} + +export component SettingsList inherits VerticalLayout { + preferred-height: 300px; + preferred-width: 400px; + + Text { + text: "Settings"; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + font-size: 20px; + } + ScrollView { + VerticalLayout { + spacing: 5px; + Text { + text: "General settings"; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + } + TextComponent { + name: "Excluded item:"; + model <=> Settings.excluded_items; + } + TextComponent { + name: "Allowed extensions:"; + model <=> Settings.allowed_extensions; + } + MinMaxSizeComponent { + + } + } + } } \ No newline at end of file From cc8bb6ef46861a8dc42620811dc9a52dff2ff3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 24 Nov 2023 22:08:26 +0100 Subject: [PATCH 081/107] Commons --- czkawka_core/src/common_items.rs | 5 +++++ krokiet/src/settings.rs | 18 ++-------------- krokiet/ui/callabler.slint | 3 +++ krokiet/ui/settings.slint | 3 +++ krokiet/ui/settings_list.slint | 35 ++++++++++++++++++++++++++++++-- 5 files changed, 46 insertions(+), 18 deletions(-) diff --git a/czkawka_core/src/common_items.rs b/czkawka_core/src/common_items.rs index f6ecf8cf5..668e86cf7 100644 --- a/czkawka_core/src/common_items.rs +++ b/czkawka_core/src/common_items.rs @@ -2,6 +2,11 @@ use std::path::Path; use crate::common::Common; +#[cfg(target_family = "unix")] +pub const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", "/snap"]; +#[cfg(not(target_family = "unix"))] +pub const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["C:\\Windows"]; + #[cfg(target_family = "unix")] pub const DEFAULT_EXCLUDED_ITEMS: &str = "*/.git/*,*/node_modules/*,*/lost+found/*,*/Trash/*,*/.Trash-*/*,*/snap/*,/home/*/.cache/*"; #[cfg(not(target_family = "unix"))] diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index dbf323484..cea0061fe 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -4,22 +4,13 @@ use std::path::PathBuf; use crate::common::create_string_standard_list_view_from_pathbuf; use crate::{GuiState, Settings}; +use czkawka_core::common_items::{DEFAULT_EXCLUDED_DIRECTORIES, DEFAULT_EXCLUDED_ITEMS}; use directories_next::ProjectDirs; use home::home_dir; use log::error; use serde::{Deserialize, Serialize}; use slint::{ComponentHandle, Model}; -#[cfg(target_family = "unix")] -const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["/proc", "/dev", "/sys", "/run", "/snap"]; -#[cfg(not(target_family = "unix"))] -const DEFAULT_EXCLUDED_DIRECTORIES: &[&str] = &["C:\\Windows"]; - -#[cfg(target_family = "unix")] -pub const DEFAULT_EXCLUDED_ITEMS: &str = "*/.git/*,*/node_modules/*,*/lost+found/*,*/Trash/*,*/.Trash-*/*,*/snap/*,/home/*/.cache/*"; -#[cfg(not(target_family = "unix"))] -pub const DEFAULT_EXCLUDED_ITEMS: &str = "*\\.git\\*,*\\node_modules\\*,*\\lost+found\\*,*:\\windows\\*,*:\\$RECYCLE.BIN\\*,*:\\$SysReset\\*,*:\\System Volume Information\\*,*:\\OneDriveTemp\\*,*:\\hiberfil.sys,*:\\pagefile.sys,*:\\swapfile.sys"; - #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SettingsCustom { #[serde(default = "default_included_directories")] @@ -34,12 +25,7 @@ pub struct SettingsCustom { impl Default for SettingsCustom { fn default() -> Self { - Self { - included_directories: default_included_directories(), - excluded_directories: default_excluded_directories(), - excluded_items: default_excluded_items(), - allowed_extensions: String::new(), - } + serde_json::from_str("{}").unwrap() } } diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint index 0d35e7447..2cc7ec3a0 100644 --- a/krokiet/ui/callabler.slint +++ b/krokiet/ui/callabler.slint @@ -10,4 +10,7 @@ export global Callabler { // Preview callback load_image_preview(string); + + // Settings + callback changed_settings_preset(string, int); } diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index 724c64664..faf0cf31c 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -1,4 +1,7 @@ export global Settings { + in-out property settings_preset_idx: 0; + in-out property <[string]> settings_presets: ["Preset 1", "Preset 2"]; + in-out property <[StandardListViewItem]> included_directories: [{text: "ABCD"}, {text: "BCDA"}]; in-out property <[StandardListViewItem]> excluded_directories: [{text: "ABCD"}, {text: "BCDA"}, {text: "CDFFF"}]; diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index b5be0c5bc..aaa83d169 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -1,5 +1,6 @@ -import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, ScrollView, LineEdit, SpinBox} from "std-widgets.slint"; +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, ScrollView, LineEdit, SpinBox, ComboBox, TextEdit} from "std-widgets.slint"; import { Settings } from "settings.slint"; +import { Callabler } from "callabler.slint"; global SettingsSize { out property item_height: 30px; @@ -25,7 +26,7 @@ component MinMaxSizeComponent inherits HorizontalLayout { spacing: 20px; Text { horizontal-stretch: 0.0; - text:"Size"; + text:"Items Size"; vertical-alignment: TextVerticalAlignment.center; } HorizontalLayout { @@ -50,6 +51,32 @@ component MinMaxSizeComponent inherits HorizontalLayout { } } +component Presets inherits HorizontalLayout { + spacing: 5px; + Text { + text : "Current:"; + vertical-alignment: TextVerticalAlignment.center; + } + combo_box := ComboBox { + current-index <=> Settings.settings_preset_idx; + model: Settings.settings_presets; + selected(item) => { + Callabler.changed_settings_preset(item, self.current_index); + current_name.text = item; + } + } + current_name := LineEdit { + text: Settings.settings_presets[0]; + } + Button { + text: "Save"; + clicked => { + Settings.settings_presets[combo_box.current_index] = current_name.text; + combo_box.current_value = current_name.text; + } + } +} + export component SettingsList inherits VerticalLayout { preferred-height: 300px; preferred-width: 400px; @@ -63,10 +90,14 @@ export component SettingsList inherits VerticalLayout { ScrollView { VerticalLayout { spacing: 5px; + Presets{ + height: SettingsSize.item_height; + } Text { text: "General settings"; height: SettingsSize.item_height; horizontal-alignment: TextHorizontalAlignment.center; + vertical-alignment: TextVerticalAlignment.center; } TextComponent { name: "Excluded item:"; From cbca9021d03cf72a93c08606a93455be6e7897b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 25 Nov 2023 20:21:49 +0100 Subject: [PATCH 082/107] Upd --- Cargo.lock | 4 ++ krokiet/Cargo.toml | 6 +++ krokiet/i18n.toml | 13 ++++++ krokiet/i18n/en/krokiet.ftl | 1 + krokiet/src/connect_translation.rs | 23 ++++++++++ krokiet/src/localizer_krokiet.rs | 32 ++++++++++++++ krokiet/src/main.rs | 4 ++ krokiet/ui/callabler.slint | 3 ++ krokiet/ui/settings_list.slint | 71 ++++++++++++++++++++++-------- 9 files changed, 138 insertions(+), 19 deletions(-) create mode 100644 krokiet/i18n.toml create mode 100644 krokiet/i18n/en/krokiet.ftl create mode 100644 krokiet/src/connect_translation.rs create mode 100644 krokiet/src/localizer_krokiet.rs diff --git a/Cargo.lock b/Cargo.lock index e4a8ced62..e0bed1efa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3337,11 +3337,15 @@ dependencies = [ "handsome_logger", "home", "humansize", + "i18n-embed", + "i18n-embed-fl", "image", "log", + "once_cell", "open", "rand", "rfd", + "rust-embed", "serde", "serde_json", "slint", diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index 3053d66ac..1a2c98d6e 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -35,6 +35,12 @@ humansize = "2.1" image = "0.24" directories-next = "2.0" +# Translations +i18n-embed = { version = "0.14", features = ["fluent-system", "desktop-requester"] } +i18n-embed-fl = "0.7" +rust-embed = "8.0" +once_cell = "1.18" + [build-dependencies] slint-build = "1.3" #slint-build = { git = "https://github.com/slint-ui/slint.git" } diff --git a/krokiet/i18n.toml b/krokiet/i18n.toml new file mode 100644 index 000000000..f2456c892 --- /dev/null +++ b/krokiet/i18n.toml @@ -0,0 +1,13 @@ +# (Required) The language identifier of the language used in the +# source code for gettext system, and the primary fallback language +# (for which all strings must be present) when using the fluent +# system. +fallback_language = "en" + +# Use the fluent localization system. +[fluent] +# (Required) The path to the assets directory. +# The paths inside the assets directory should be structured like so: +# `assets_dir/{language}/{domain}.ftl` +assets_dir = "i18n" + diff --git a/krokiet/i18n/en/krokiet.ftl b/krokiet/i18n/en/krokiet.ftl new file mode 100644 index 000000000..458f49059 --- /dev/null +++ b/krokiet/i18n/en/krokiet.ftl @@ -0,0 +1 @@ +settings_language = Languages \ No newline at end of file diff --git a/krokiet/src/connect_translation.rs b/krokiet/src/connect_translation.rs new file mode 100644 index 000000000..01960d8a1 --- /dev/null +++ b/krokiet/src/connect_translation.rs @@ -0,0 +1,23 @@ +use crate::localizer_krokiet::LANGUAGE_LOADER_GUI; +use crate::{Callabler, MainWindow}; +use slint::ComponentHandle; +use slint::Model; +use std::collections::HashMap; + +pub fn connect_translations(app: &MainWindow) { + app.global::().on_translate(move |text_to_translate, args| { + let text_to_translate = text_to_translate.to_string(); + + let mut arguments = HashMap::new(); + args.iter().for_each(|(key, value)| { + arguments.insert(key.to_string(), value.to_string()); + }); + + if arguments.is_empty() { + LANGUAGE_LOADER_GUI.get(&text_to_translate) + } else { + LANGUAGE_LOADER_GUI.get_args(&text_to_translate, arguments) + } + .into() + }); +} diff --git a/krokiet/src/localizer_krokiet.rs b/krokiet/src/localizer_krokiet.rs new file mode 100644 index 000000000..3362fbb2c --- /dev/null +++ b/krokiet/src/localizer_krokiet.rs @@ -0,0 +1,32 @@ +use i18n_embed::fluent::{fluent_language_loader, FluentLanguageLoader}; +use i18n_embed::{DefaultLocalizer, LanguageLoader, Localizer}; +use once_cell::sync::Lazy; +use rust_embed::RustEmbed; + +#[derive(RustEmbed)] +#[folder = "i18n/"] +struct Localizations; + +pub static LANGUAGE_LOADER_GUI: Lazy = Lazy::new(|| { + let loader: FluentLanguageLoader = fluent_language_loader!(); + + loader.load_fallback_language(&Localizations).expect("Error while loading fallback language"); + + loader +}); + +#[macro_export] +macro_rules! flk { + ($message_id:literal) => {{ + i18n_embed_fl::fl!($crate::localizer_krokiet::LANGUAGE_LOADER_GUI, $message_id) + }}; + + ($message_id:literal, $($args:expr),*) => {{ + i18n_embed_fl::fl!($crate::localizer_krokiet::LANGUAGE_LOADER_GUI, $message_id, $($args), *) + }}; +} + +// Get the `Localizer` to be used for localizing this library. +pub fn localizer_krokiet() -> Box { + Box::from(DefaultLocalizer::new(&*LANGUAGE_LOADER_GUI, &Localizations)) +} diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 06e9f5809..f0936215f 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -25,6 +25,8 @@ mod connect_progress_receiver; mod connect_scan; mod connect_show_preview; mod connect_stop; +mod connect_translation; +mod localizer_krokiet; mod settings; use crossbeam_channel::{unbounded, Receiver, Sender}; @@ -38,6 +40,7 @@ use crate::connect_directories_changes::connect_add_remove_directories; use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_show_preview::connect_show_preview; use crate::connect_stop::connect_stop_button; +use crate::connect_translation::connect_translations; use crate::settings::{load_settings_from_file, reset_settings, save_settings_to_file}; use czkawka_core::common::{print_version_mode, setup_logger}; use czkawka_core::common_dir_traversal::ProgressData; @@ -65,6 +68,7 @@ fn main() { connect_progress_gathering(&app, progress_receiver); connect_add_remove_directories(&app); connect_show_preview(&app); + connect_translations(&app); app.run().unwrap(); diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint index 2cc7ec3a0..97be1ecb2 100644 --- a/krokiet/ui/callabler.slint +++ b/krokiet/ui/callabler.slint @@ -13,4 +13,7 @@ export global Callabler { // Settings callback changed_settings_preset(string, int); + + // Translations + pure callback translate(string, [{key: string, value: string}]) -> string; } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index aaa83d169..45b288130 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -38,6 +38,7 @@ component MinMaxSizeComponent inherits HorizontalLayout { } SpinBox { enabled: true; + maximum: 999999999999999; height: SettingsSize.item_height; } Text { @@ -46,34 +47,63 @@ component MinMaxSizeComponent inherits HorizontalLayout { } SpinBox { enabled: true; + maximum: 999999999999999; height: SettingsSize.item_height; } } } -component Presets inherits HorizontalLayout { - spacing: 5px; - Text { - text : "Current:"; - vertical-alignment: TextVerticalAlignment.center; +component Presets inherits Rectangle { + property edit_name; + property current_index; + if !edit_name: HorizontalLayout { + spacing: 5px; + Text { + text : "Current:"; + vertical-alignment: TextVerticalAlignment.center; + } + combo_box := ComboBox { + current-index <=> Settings.settings_preset_idx; + model: Settings.settings_presets; + selected(item) => { + Settings.settings_preset_idx = self.current_index; + Callabler.changed_settings_preset(item, self.current_index); + } + } + Button { + text: "Edit name"; + clicked => { + root.edit_name = !root.edit_name; + } + } } - combo_box := ComboBox { - current-index <=> Settings.settings_preset_idx; - model: Settings.settings_presets; - selected(item) => { - Callabler.changed_settings_preset(item, self.current_index); - current_name.text = item; + if edit_name : HorizontalLayout{ + spacing: 5px; + Text { + text: "Choose name for prefix " + (Settings.settings_preset_idx + 1); + vertical-alignment: TextVerticalAlignment.center; + } + current_name := LineEdit { + text: Settings.settings_presets[Settings.settings_preset_idx]; + } + Button { + text: "Save"; + clicked => { + Settings.settings_presets[Settings.settings_preset_idx] = current_name.text; + edit_name = false; + } } } - current_name := LineEdit { - text: Settings.settings_presets[0]; +} + +component Language inherits HorizontalLayout { + spacing: 5px; + Text { + text: Callabler.translate("settings_language", []); + vertical-alignment: TextVerticalAlignment.center; } - Button { - text: "Save"; - clicked => { - Settings.settings_presets[combo_box.current_index] = current_name.text; - combo_box.current_value = current_name.text; - } + ComboBox { + model: ["English"]; } } @@ -93,6 +123,9 @@ export component SettingsList inherits VerticalLayout { Presets{ height: SettingsSize.item_height; } + Language { + height: SettingsSize.item_height; + } Text { text: "General settings"; height: SettingsSize.item_height; From e2bd4467682a10fa4068be6880aac6ac1746849e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 25 Nov 2023 23:47:58 +0100 Subject: [PATCH 083/107] Just --- Cargo.lock | 140 +++++++++++---- .../connect_things/connect_progress_window.rs | 34 ++-- krokiet/src/main.rs | 4 +- krokiet/src/settings.rs | 160 +++++++++++++++--- krokiet/ui/left_side_panel.slint | 8 +- krokiet/ui/settings_list.slint | 2 +- 6 files changed, 268 insertions(+), 80 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e0bed1efa..4eb97f9aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,12 +233,12 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37875bd9915b7d67c2f117ea2c30a0989874d0b2cb694fe25403c85763c0c9e" +checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" dependencies = [ "concurrent-queue", - "event-listener 3.1.0", + "event-listener 4.0.0", "event-listener-strategy", "futures-core", "pin-project-lite", @@ -246,11 +246,11 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5ea910c42e5ab19012bab31f53cb4d63d54c3a27730f9a833a88efcf4bb52d" +checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" dependencies = [ - "async-lock 3.1.1", + "async-lock 3.1.2", "async-task", "concurrent-queue", "fastrand 2.0.1", @@ -276,10 +276,10 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b4353121d5644cdf2beb5726ab752e79a8db1ebb52031770ec47db31d245526" dependencies = [ - "async-channel 2.1.0", + "async-channel 2.1.1", "async-executor", - "async-io 2.2.0", - "async-lock 3.1.1", + "async-io 2.2.1", + "async-lock 3.1.2", "blocking", "futures-lite 2.0.1", "once_cell", @@ -307,22 +307,21 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9d5715c2d329bf1b4da8d60455b99b187f27ba726df2883799af9af60997" +checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" dependencies = [ - "async-lock 3.1.1", + "async-lock 3.1.2", "cfg-if", "concurrent-queue", "futures-io", "futures-lite 2.0.1", "parking", - "polling 3.3.0", + "polling 3.3.1", "rustix 0.38.25", "slab", "tracing", - "waker-fn", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -336,11 +335,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.1.1" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "655b9c7fe787d3b25cc0f804a1a8401790f0c5bc395beb5a64dc77d8de079105" +checksum = "dea8b3453dd7cc96711834b75400d671b73e3656975fa68d9f277163b7f7e316" dependencies = [ - "event-listener 3.1.0", + "event-listener 4.0.0", "event-listener-strategy", "pin-project-lite", ] @@ -379,7 +378,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.2.0", + "async-io 2.2.1", "async-lock 2.8.0", "atomic-waker", "cfg-if", @@ -610,8 +609,8 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ - "async-channel 2.1.0", - "async-lock 3.1.1", + "async-channel 2.1.1", + "async-lock 3.1.2", "async-task", "fastrand 2.0.1", "futures-io", @@ -733,7 +732,7 @@ checksum = "7b50b5a44d59a98c55a9eeb518f39bf7499ba19fd98ee7d22618687f3f10adbf" dependencies = [ "bitflags 2.4.1", "log", - "polling 3.3.0", + "polling 3.3.1", "rustix 0.38.25", "slab", "thiserror", @@ -1684,13 +1683,24 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "event-listener" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + [[package]] name = "event-listener-strategy" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96b852f1345da36d551b9473fa1e2b1eb5c5195585c6c018118bc92a8d91160" +checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ - "event-listener 3.1.0", + "event-listener 4.0.0", "pin-project-lite", ] @@ -4303,16 +4313,16 @@ dependencies = [ [[package]] name = "polling" -version = "3.3.0" +version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53b6af1f60f36f8c2ac2aad5459d75a5a9b4be1e8cdd40264f315d78193e531" +checksum = "cf63fa624ab313c11656b4cda960bfc46c410187ad493c41f6ba2d8c1e991c9e" dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", "rustix 0.38.25", "tracing", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -6151,9 +6161,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7830e33f6e25723d41a63f77e434159dad02919f18f55a512b5f16f3b1d77138" +checksum = "f8cdd25c339e200129fe4de81451814e5228c9b771d57378817d6117cc2b3f97" dependencies = [ "base64", "flate2", @@ -6683,6 +6693,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -6713,6 +6732,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -6725,6 +6759,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -6737,6 +6777,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -6749,6 +6795,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -6761,6 +6813,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -6773,6 +6831,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -6785,6 +6849,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -6797,11 +6867,17 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winit" -version = "0.29.3" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161598019a9da35ab6c34dc46cd13546cba9dbf9816475d4dd9a639455016563" +checksum = "d25d662bb83b511acd839534bb2d88521b0bbc81440969cb077d23c4db9e62c7" dependencies = [ "ahash", "android-activity", diff --git a/czkawka_gui/src/connect_things/connect_progress_window.rs b/czkawka_gui/src/connect_things/connect_progress_window.rs index 1b99421da..facf5f45f 100644 --- a/czkawka_gui/src/connect_things/connect_progress_window.rs +++ b/czkawka_gui/src/connect_things/connect_progress_window.rs @@ -28,21 +28,25 @@ pub fn connect_progress_window(gui_data: &GuiData, progress_receiver: Receiver

process_bar_duplicates(&gui_data, &item), - ToolType::EmptyFiles => process_bar_empty_files(&gui_data, &item), - ToolType::EmptyFolders => process_bar_empty_folder(&gui_data, &item), - ToolType::BigFile => process_bar_big_files(&gui_data, &item), - ToolType::SameMusic => process_bar_same_music(&gui_data, &item), - ToolType::SimilarImages => process_bar_similar_images(&gui_data, &item), - ToolType::SimilarVideos => process_bar_similar_videos(&gui_data, &item), - ToolType::TemporaryFiles => process_bar_temporary(&gui_data, &item), - ToolType::InvalidSymlinks => process_bar_invalid_symlinks(&gui_data, &item), - ToolType::BrokenFiles => process_bar_broken_files(&gui_data, &item), - ToolType::BadExtensions => process_bar_bad_extensions(&gui_data, &item), - ToolType::None => panic!(), + loop { + let item = progress_receiver.try_recv(); + if let Ok(item) = item { + match item.tool_type { + ToolType::Duplicate => process_bar_duplicates(&gui_data, &item), + ToolType::EmptyFiles => process_bar_empty_files(&gui_data, &item), + ToolType::EmptyFolders => process_bar_empty_folder(&gui_data, &item), + ToolType::BigFile => process_bar_big_files(&gui_data, &item), + ToolType::SameMusic => process_bar_same_music(&gui_data, &item), + ToolType::SimilarImages => process_bar_similar_images(&gui_data, &item), + ToolType::SimilarVideos => process_bar_similar_videos(&gui_data, &item), + ToolType::TemporaryFiles => process_bar_temporary(&gui_data, &item), + ToolType::InvalidSymlinks => process_bar_invalid_symlinks(&gui_data, &item), + ToolType::BrokenFiles => process_bar_broken_files(&gui_data, &item), + ToolType::BadExtensions => process_bar_bad_extensions(&gui_data, &item), + ToolType::None => panic!(), + } + } else { + break; } } glib::timeout_future(Duration::from_millis(300)).await; diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index f0936215f..6352f0e0f 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -41,7 +41,7 @@ use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_show_preview::connect_show_preview; use crate::connect_stop::connect_stop_button; use crate::connect_translation::connect_translations; -use crate::settings::{load_settings_from_file, reset_settings, save_settings_to_file}; +use crate::settings::{create_default_settings_files, load_settings_from_file, reset_settings, save_settings_to_file}; use czkawka_core::common::{print_version_mode, setup_logger}; use czkawka_core::common_dir_traversal::ProgressData; use slint::{ModelRc, VecModel}; @@ -58,7 +58,7 @@ fn main() { to_remove_debug(&app); - reset_settings(&app); + create_default_settings_files(); load_settings_from_file(&app); connect_delete_button(&app); diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index cea0061fe..0f02abea5 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -1,13 +1,14 @@ use crate::MainWindow; +use std::cmp::{max, min}; use std::env; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use crate::common::create_string_standard_list_view_from_pathbuf; use crate::{GuiState, Settings}; use czkawka_core::common_items::{DEFAULT_EXCLUDED_DIRECTORIES, DEFAULT_EXCLUDED_ITEMS}; use directories_next::ProjectDirs; use home::home_dir; -use log::error; +use log::{error, info}; use serde::{Deserialize, Serialize}; use slint::{ComponentHandle, Model}; @@ -29,70 +30,150 @@ impl Default for SettingsCustom { } } +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct BasicSettings { + #[serde(default = "default_language")] + pub language: String, + #[serde(default)] + pub default_preset: i32, + #[serde(default = "default_preset_names")] + pub preset_names: Vec, +} + +impl Default for BasicSettings { + fn default() -> Self { + serde_json::from_str("{}").unwrap() + } +} + +pub fn create_default_settings_files() { + let base_config_file = get_base_config_file(); + if let Some(base_config_file) = base_config_file { + if !base_config_file.is_file() { + let _ = save_data_to_file(Some(base_config_file), &BasicSettings::default()); + } + } + for i in 0..10 { + let config_file = get_config_file(i); + if let Some(config_file) = config_file { + if !config_file.is_file() { + let _ = save_data_to_file(Some(config_file), &SettingsCustom::default()); + } + } + } +} + pub fn reset_settings(app: &MainWindow) { set_settings_to_gui(app, &SettingsCustom::default()); } pub fn load_settings_from_file(app: &MainWindow) { - let Some(config_file) = get_config_file() else { - error!("Cannot get config file"); - return; + let result_base_settings = load_data_from_file::(get_base_config_file()); + let base_settings; + if let Ok(base_settings_temp) = result_base_settings { + base_settings = base_settings_temp; + } else { + info!("Cannot load base settings, using default instead"); + base_settings = BasicSettings::default(); + } + + let results_custom_settings = load_data_from_file::(get_config_file(base_settings.default_preset)); + let custom_settings; + if let Ok(custom_settings_temp) = results_custom_settings { + custom_settings = custom_settings_temp; + } else { + info!("Cannot load custom settings, using default instead"); + custom_settings = SettingsCustom::default(); + } + + set_settings_to_gui(app, &custom_settings); + set_base_settings_to_gui(app, &base_settings); +} + +pub fn save_settings_to_file(app: &MainWindow) { + let current_item = app.global::().get_settings_preset_idx(); + let result = save_data_to_file(get_config_file(current_item), &collect_settings(app)); + + if let Err(e) = result { + error!("{e}"); + } +} + +pub fn load_data_from_file(config_data: Option) -> Result +where + for<'de> T: Deserialize<'de>, +{ + let Some(config_data) = config_data else { + return Err("Cannot get config file".into()); }; - if !config_file.is_file() { - error!("Config file doesn't exists"); - return; + if !config_data.is_file() { + return Err("Config file doesn't exists".into()); } - match std::fs::read_to_string(config_file) { + match std::fs::read_to_string(config_data) { Ok(serialized) => match serde_json::from_str(&serialized) { - Ok(custom_settings) => { - set_settings_to_gui(app, &custom_settings); - } + Ok(custom_settings) => Ok(custom_settings), Err(e) => { - error!("Cannot deserialize settings: {e}"); + return Err(format!("Cannot deserialize settings: {e}")); } }, Err(e) => { - error!("Cannot read config file: {e}"); + return Err(format!("Cannot read config file: {e}")); } } } -pub fn save_settings_to_file(app: &MainWindow) { - let Some(config_file) = get_config_file() else { - error!("Cannot get config file"); - return; +pub fn save_data_to_file(config_file: Option, serializable_data: &T) -> Result<(), String> +where + T: Serialize, +{ + let Some(config_file) = config_file else { + return Err("Cannot get config file".into()); }; // Create dirs if not exists if let Some(parent) = config_file.parent() { if let Err(e) = std::fs::create_dir_all(parent) { - error!("Cannot create config folder: {e}"); - return; + return Err(format!("Cannot create config folder: {e}")); } } - let collected_settings = collect_settings(app); - match serde_json::to_string_pretty(&collected_settings) { + match serde_json::to_string_pretty(&serializable_data) { Ok(serialized) => { if let Err(e) = std::fs::write(config_file, serialized) { - error!("Cannot save config file: {e}"); + return Err(format!("Cannot save config file: {e}")); } } Err(e) => { - error!("Cannot serialize settings: {e}"); + return Err(format!("Cannot serialize settings: {e}")); } } + Ok(()) +} + +pub fn get_base_config_file() -> Option { + let Some(configs) = ProjectDirs::from("pl", "Qarmin", "Krokiet") else { + return None; + }; + let config_folder = configs.config_dir(); + let base_config_file = config_folder.join("config_general.json"); + Some(base_config_file) } +pub fn get_config_file(number: i32) -> Option { + let number = max(min(number, 9), 0); -pub fn get_config_file() -> Option { let Some(configs) = ProjectDirs::from("pl", "Qarmin", "Krokiet") else { return None; }; let config_folder = configs.config_dir(); - let config_file = config_folder.join("config.json"); + let config_file = config_folder.join(format!("config_preset_{number}.json")); Some(config_file) } +pub fn set_base_settings_to_gui(app: &MainWindow, basic_settings: &BasicSettings) { + let settings = app.global::(); + // settings.set_language(basic_settings.language.clone()); + settings.set_settings_preset_idx(basic_settings.default_preset); +} pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { let settings = app.global::(); @@ -131,6 +212,20 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { } } +pub fn collect_base_settings(app: &MainWindow) -> BasicSettings { + let settings = app.global::(); + + let default_preset = settings.get_settings_preset_idx(); + let preset_names = settings.get_settings_presets().iter().map(|x| x.to_string()).collect::>(); + + assert_eq!(preset_names.len(), 10); + BasicSettings { + language: "en".to_string(), + default_preset, + preset_names, + } +} + fn default_included_directories() -> Vec { let mut included_directories = vec![]; if let Ok(current_dir) = env::current_dir() { @@ -156,3 +251,16 @@ fn default_excluded_directories() -> Vec { fn default_excluded_items() -> String { DEFAULT_EXCLUDED_ITEMS.to_string() } + +fn default_language() -> String { + "en".to_string() +} + +fn default_preset_names() -> Vec { + vec![ + "Preset 0", "Preset 1", "Preset 2", "Preset 3", "Preset 4", "Preset 5", "Preset 6", "Preset 7", "Preset 8", "Preset 9", + ] + .iter() + .map(|x| x.to_string()) + .collect::>() +} diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index 90b55e00e..2d69c2ce5 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -110,12 +110,12 @@ export component LeftSidePanel { } HorizontalLayout { - padding-bottom: 2px; - padding-right: 3px; alignment: end; Button { - height: 50px; - width: self.height; + min-width: 20px; + min-height: 20px; + max-height: self.width; + preferred-height: self.width; icon: @image-url("../icons/settings.svg"); clicked => { active_tab = CurrentTab.Settings; diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 45b288130..1320f71ca 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -26,7 +26,7 @@ component MinMaxSizeComponent inherits HorizontalLayout { spacing: 20px; Text { horizontal-stretch: 0.0; - text:"Items Size"; + text:"Items Size(Kb)"; vertical-alignment: TextVerticalAlignment.center; } HorizontalLayout { From 4d516dfe914f2f1d5fdf02ae8aff50efcdf816a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 26 Nov 2023 00:46:00 +0100 Subject: [PATCH 084/107] UUU --- krokiet/src/localizer_krokiet.rs | 10 +- krokiet/src/main.rs | 5 +- krokiet/src/settings.rs | 157 ++++++++++++++++++++++++++----- krokiet/ui/callabler.slint | 5 +- krokiet/ui/main_window.slint | 8 +- krokiet/ui/settings.slint | 3 + krokiet/ui/settings_list.slint | 29 +++++- 7 files changed, 177 insertions(+), 40 deletions(-) diff --git a/krokiet/src/localizer_krokiet.rs b/krokiet/src/localizer_krokiet.rs index 3362fbb2c..2c0cabccd 100644 --- a/krokiet/src/localizer_krokiet.rs +++ b/krokiet/src/localizer_krokiet.rs @@ -1,5 +1,5 @@ use i18n_embed::fluent::{fluent_language_loader, FluentLanguageLoader}; -use i18n_embed::{DefaultLocalizer, LanguageLoader, Localizer}; +use i18n_embed::LanguageLoader; use once_cell::sync::Lazy; use rust_embed::RustEmbed; @@ -26,7 +26,7 @@ macro_rules! flk { }}; } -// Get the `Localizer` to be used for localizing this library. -pub fn localizer_krokiet() -> Box { - Box::from(DefaultLocalizer::new(&*LANGUAGE_LOADER_GUI, &Localizations)) -} +// // Get the `Localizer` to be used for localizing this library. +// pub fn localizer_krokiet() -> Box { +// Box::from(DefaultLocalizer::new(&*LANGUAGE_LOADER_GUI, &Localizations)) +// } diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 6352f0e0f..47b78b1d5 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -41,7 +41,7 @@ use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_show_preview::connect_show_preview; use crate::connect_stop::connect_stop_button; use crate::connect_translation::connect_translations; -use crate::settings::{create_default_settings_files, load_settings_from_file, reset_settings, save_settings_to_file}; +use crate::settings::{connect_changing_settings_preset, create_default_settings_files, load_settings_from_file, save_all_settings_to_file}; use czkawka_core::common::{print_version_mode, setup_logger}; use czkawka_core::common_dir_traversal::ProgressData; use slint::{ModelRc, VecModel}; @@ -69,10 +69,11 @@ fn main() { connect_add_remove_directories(&app); connect_show_preview(&app); connect_translations(&app); + connect_changing_settings_preset(&app); app.run().unwrap(); - save_settings_to_file(&app); + save_all_settings_to_file(&app); } // TODO remove this after debugging - or leave commented diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 0f02abea5..f69cd9661 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -1,16 +1,16 @@ -use crate::MainWindow; +use crate::{Callabler, MainWindow}; use std::cmp::{max, min}; use std::env; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; -use crate::common::create_string_standard_list_view_from_pathbuf; +use crate::common::{create_string_standard_list_view_from_pathbuf, create_vec_model_from_vec_string}; use crate::{GuiState, Settings}; use czkawka_core::common_items::{DEFAULT_EXCLUDED_DIRECTORIES, DEFAULT_EXCLUDED_ITEMS}; use directories_next::ProjectDirs; use home::home_dir; -use log::{error, info}; +use log::{debug, error, info}; use serde::{Deserialize, Serialize}; -use slint::{ComponentHandle, Model}; +use slint::{ComponentHandle, Model, ModelRc}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SettingsCustom { @@ -22,6 +22,10 @@ pub struct SettingsCustom { pub excluded_items: String, #[serde(default)] pub allowed_extensions: String, + #[serde(default = "minimum_file_size")] + pub minimum_file_size: i32, + #[serde(default = "maximum_file_size")] + pub maximum_file_size: i32, } impl Default for SettingsCustom { @@ -46,6 +50,68 @@ impl Default for BasicSettings { } } +pub fn connect_changing_settings_preset(app: &MainWindow) { + let a = app.as_weak(); + app.global::().on_changed_settings_preset(move || { + let app = a.upgrade().unwrap(); + let current_item = app.global::().get_settings_preset_idx(); + let loaded_data = load_data_from_file::(get_config_file(current_item)); + match loaded_data { + Ok(loaded_data) => { + set_settings_to_gui(&app, &loaded_data); + app.set_text_summary_text(format!("Changed and loaded properly preset {}", current_item + 1).into()); + } + Err(e) => { + set_settings_to_gui(&app, &SettingsCustom::default()); + app.set_text_summary_text(format!("Cannot change and load preset {} - reason {e}", current_item + 1).into()); + } + } + }); + let a = app.as_weak(); + app.global::().on_save_current_preset(move || { + let app = a.upgrade().unwrap(); + let settings = app.global::(); + let current_item = settings.get_settings_preset_idx(); + let result = save_data_to_file(get_config_file(current_item), &collect_settings(&app)); + match result { + Ok(()) => { + app.set_text_summary_text(format!("Saved preset {}", current_item + 1).into()); + } + Err(e) => { + app.set_text_summary_text(format!("Cannot save preset {} - reason {e}", current_item + 1).into()); + error!("{e}"); + } + } + }); + let a = app.as_weak(); + app.global::().on_reset_current_preset(move || { + let app = a.upgrade().unwrap(); + let settings = app.global::(); + let current_item = settings.get_settings_preset_idx(); + set_settings_to_gui(&app, &SettingsCustom::default()); + app.set_text_summary_text(format!("Reset preset {}", current_item + 1).into()); + }); + let a = app.as_weak(); + app.global::().on_load_current_preset(move || { + let app = a.upgrade().unwrap(); + let settings = app.global::(); + let current_item = settings.get_settings_preset_idx(); + let loaded_data = load_data_from_file::(get_config_file(current_item)); + match loaded_data { + Ok(loaded_data) => { + set_settings_to_gui(&app, &loaded_data); + app.set_text_summary_text(format!("Loaded preset {}", current_item + 1).into()); + } + Err(e) => { + set_settings_to_gui(&app, &SettingsCustom::default()); + let err_message = format!("Cannot load preset {} - reason {e}", current_item + 1); + app.set_text_summary_text(err_message.into()); + error!("{e}"); + } + } + }); +} + pub fn create_default_settings_files() { let base_config_file = get_base_config_file(); if let Some(base_config_file) = base_config_file { @@ -53,7 +119,8 @@ pub fn create_default_settings_files() { let _ = save_data_to_file(Some(base_config_file), &BasicSettings::default()); } } - for i in 0..10 { + + for i in 1..=10 { let config_file = get_config_file(i); if let Some(config_file) = config_file { if !config_file.is_file() { @@ -63,12 +130,9 @@ pub fn create_default_settings_files() { } } -pub fn reset_settings(app: &MainWindow) { - set_settings_to_gui(app, &SettingsCustom::default()); -} - pub fn load_settings_from_file(app: &MainWindow) { let result_base_settings = load_data_from_file::(get_base_config_file()); + let base_settings; if let Ok(base_settings_temp) = result_base_settings { base_settings = base_settings_temp; @@ -78,6 +142,7 @@ pub fn load_settings_from_file(app: &MainWindow) { } let results_custom_settings = load_data_from_file::(get_config_file(base_settings.default_preset)); + let custom_settings; if let Ok(custom_settings_temp) = results_custom_settings { custom_settings = custom_settings_temp; @@ -90,7 +155,20 @@ pub fn load_settings_from_file(app: &MainWindow) { set_base_settings_to_gui(app, &base_settings); } -pub fn save_settings_to_file(app: &MainWindow) { +pub fn save_all_settings_to_file(app: &MainWindow) { + save_base_settings_to_file(app); + save_custom_settings_to_file(app); +} + +pub fn save_base_settings_to_file(app: &MainWindow) { + let result = save_data_to_file(get_base_config_file(), &collect_base_settings(app)); + + if let Err(e) = result { + error!("{e}"); + } +} + +pub fn save_custom_settings_to_file(app: &MainWindow) { let current_item = app.global::().get_settings_preset_idx(); let result = save_data_to_file(get_config_file(current_item), &collect_settings(app)); @@ -99,34 +177,36 @@ pub fn save_settings_to_file(app: &MainWindow) { } } -pub fn load_data_from_file(config_data: Option) -> Result +pub fn load_data_from_file(config_file: Option) -> Result where for<'de> T: Deserialize<'de>, { - let Some(config_data) = config_data else { + let current_time = std::time::Instant::now(); + let Some(config_file) = config_file else { return Err("Cannot get config file".into()); }; - if !config_data.is_file() { + if !config_file.is_file() { return Err("Config file doesn't exists".into()); } - match std::fs::read_to_string(config_data) { + let result = match std::fs::read_to_string(&config_file) { Ok(serialized) => match serde_json::from_str(&serialized) { Ok(custom_settings) => Ok(custom_settings), - Err(e) => { - return Err(format!("Cannot deserialize settings: {e}")); - } + Err(e) => Err(format!("Cannot deserialize settings: {e}")), }, - Err(e) => { - return Err(format!("Cannot read config file: {e}")); - } - } + Err(e) => Err(format!("Cannot read config file: {e}")), + }; + + debug!("Loading data from file {:?} took {:?}", config_file, current_time.elapsed()); + + result } pub fn save_data_to_file(config_file: Option, serializable_data: &T) -> Result<(), String> where T: Serialize, { + let current_time = std::time::Instant::now(); let Some(config_file) = config_file else { return Err("Cannot get config file".into()); }; @@ -139,7 +219,7 @@ where match serde_json::to_string_pretty(&serializable_data) { Ok(serialized) => { - if let Err(e) = std::fs::write(config_file, serialized) { + if let Err(e) = std::fs::write(&config_file, serialized) { return Err(format!("Cannot save config file: {e}")); } } @@ -147,6 +227,8 @@ where return Err(format!("Cannot serialize settings: {e}")); } } + + debug!("Saving data to file {:?} took {:?}", config_file, current_time.elapsed()); Ok(()) } @@ -173,6 +255,7 @@ pub fn set_base_settings_to_gui(app: &MainWindow, basic_settings: &BasicSettings let settings = app.global::(); // settings.set_language(basic_settings.language.clone()); settings.set_settings_preset_idx(basic_settings.default_preset); + settings.set_settings_presets(ModelRc::new(create_vec_model_from_vec_string(basic_settings.preset_names.clone()))); } pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { let settings = app.global::(); @@ -187,6 +270,8 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { settings.set_excluded_items(custom_settings.excluded_items.clone().into()); settings.set_allowed_extensions(custom_settings.allowed_extensions.clone().into()); + settings.set_minimum_file_size(custom_settings.minimum_file_size); + settings.set_maximum_file_size(custom_settings.maximum_file_size); // Clear text app.global::().set_info_text("".into()); @@ -203,12 +288,16 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let excluded_items = settings.get_excluded_items().to_string(); let allowed_extensions = settings.get_allowed_extensions().to_string(); + let minimum_file_size = settings.get_minimum_file_size(); + let maximum_file_size = settings.get_maximum_file_size(); SettingsCustom { included_directories, excluded_directories, excluded_items, allowed_extensions, + minimum_file_size, + maximum_file_size, } } @@ -257,10 +346,26 @@ fn default_language() -> String { } fn default_preset_names() -> Vec { - vec![ - "Preset 0", "Preset 1", "Preset 2", "Preset 3", "Preset 4", "Preset 5", "Preset 6", "Preset 7", "Preset 8", "Preset 9", + [ + "Preset 1", + "Preset 2", + "Preset 3", + "Preset 4", + "Preset 5", + "Preset 6", + "Preset 7", + "Preset 8", + "Preset 9", + "Preset 10", ] .iter() - .map(|x| x.to_string()) + .map(|x| (*x).to_string()) .collect::>() } + +fn minimum_file_size() -> i32 { + 16 +} +fn maximum_file_size() -> i32 { + i32::MAX +} diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint index 97be1ecb2..04ea7a775 100644 --- a/krokiet/ui/callabler.slint +++ b/krokiet/ui/callabler.slint @@ -12,7 +12,10 @@ export global Callabler { callback load_image_preview(string); // Settings - callback changed_settings_preset(string, int); + callback changed_settings_preset(); + callback save_current_preset(); + callback load_current_preset(); + callback reset_current_preset(); // Translations pure callback translate(string, [{key: string, value: string}]) -> string; diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index 69d3aa229..e9b3dad7a 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -24,6 +24,7 @@ export component MainWindow inherits Window { preferred-width: 800px; min-height: 300px; preferred-height: 600px; + in-out property text_summary_text: ""; in-out property stop_requested: false; in-out property scanning: false; in-out property progress_datas: { @@ -96,16 +97,17 @@ export component MainWindow inherits Window { active-tab <=> root.active-tab; stop_requested <=> root.stop-requested; scan_stopping => { - text_summary.text = "Stopping scan, please wait..."; + text_summary_text = "Stopping scan, please wait..."; root.scan_stopping(); } scan_starting(item) => { - text-summary.text = "Searching..."; + text_summary_text = "Searching..."; root.scan_starting(item); } } text_summary := LineEdit { + text: text_summary_text; read-only: true; } @@ -177,7 +179,7 @@ export component MainWindow inherits Window { } scan_ended(scan_text) => { - text-summary.text = scan_text; + text_summary_text = scan_text; root.scanning = false; root.stop_requested = false; } diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index faf0cf31c..d33707cb8 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -8,4 +8,7 @@ export global Settings { // Settings in-out property excluded_items: "Excluded items"; in-out property allowed_extensions: "Allowed extensions"; + in-out property minimum_file_size: 0; + in-out property maximum_file_size: 0; + } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 1320f71ca..e2a1526d7 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -18,7 +18,7 @@ component TextComponent inherits HorizontalLayout { LineEdit { horizontal-stretch: 1.0; height: SettingsSize.item_height; - text: model; + text <=> model; } } @@ -40,6 +40,7 @@ component MinMaxSizeComponent inherits HorizontalLayout { enabled: true; maximum: 999999999999999; height: SettingsSize.item_height; + value <=> Settings.minimum_file_size; } Text { text:"Max:"; @@ -49,6 +50,7 @@ component MinMaxSizeComponent inherits HorizontalLayout { enabled: true; maximum: 999999999999999; height: SettingsSize.item_height; + value <=> Settings.maximum_file_size; } } } @@ -59,7 +61,7 @@ component Presets inherits Rectangle { if !edit_name: HorizontalLayout { spacing: 5px; Text { - text : "Current:"; + text : "Current Preset:"; vertical-alignment: TextVerticalAlignment.center; } combo_box := ComboBox { @@ -67,7 +69,7 @@ component Presets inherits Rectangle { model: Settings.settings_presets; selected(item) => { Settings.settings_preset_idx = self.current_index; - Callabler.changed_settings_preset(item, self.current_index); + Callabler.changed_settings_preset(); } } Button { @@ -145,4 +147,25 @@ export component SettingsList inherits VerticalLayout { } } } + HorizontalLayout { + spacing: 5px; + Button { + text: "Save"; + clicked => { + Callabler.save_current_preset(); + } + } + Button { + text: "Load"; + clicked => { + Callabler.load_current_preset(); + } + } + Button { + text: "Reset"; + clicked => { + Callabler.reset_current_preset(); + } + } + } } \ No newline at end of file From f3a4ca7c2e09cab9564b02bacaa178c87bee80ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 26 Nov 2023 11:10:15 +0100 Subject: [PATCH 085/107] Minimum/Maximum --- krokiet/src/connect_scan.rs | 90 ++++++++++++++++----------------- krokiet/src/settings.rs | 31 ++++++++---- krokiet/ui/action_buttons.slint | 2 +- krokiet/ui/settings.slint | 4 +- krokiet/ui/settings_list.slint | 16 +++--- 5 files changed, 75 insertions(+), 68 deletions(-) diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 8f7e58b0c..5e210bc08 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -1,4 +1,3 @@ -use crate::common::create_vec_model_from_vec_string; use crate::settings::{collect_settings, SettingsCustom}; use crate::{CurrentTab, GuiState, MainListModel, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; @@ -54,8 +53,7 @@ fn scan_similar_images(a: Weak, progress_sender: Sender, progress_sender: Sender, progress_sender: Sender, .stack_size(DEFAULT_THREAD_SIZE) .spawn(move || { let mut finder = EmptyFiles::new(); - finder.set_included_directory(custom_settings.included_directories.clone()); - finder.set_excluded_directory(custom_settings.excluded_directories.clone()); + set_common_settings(&mut finder, &custom_settings); finder.find_empty_files(Some(&stop_receiver), Some(&progress_sender)); let mut vector = finder.get_empty_files().clone(); @@ -128,18 +114,12 @@ fn scan_empty_files(a: Weak, progress_sender: Sender, for fe in vector { let (directory, file) = split_path(fe.get_path()); let data_model = VecModel::from_slice(&[ - SharedString::from(file), - SharedString::from(directory), - SharedString::from(NaiveDateTime::from_timestamp_opt(fe.get_modified_date() as i64, 0).unwrap().to_string()), + file.into(), + directory.into(), + NaiveDateTime::from_timestamp_opt(fe.get_modified_date() as i64, 0).unwrap().to_string().into(), ]); - let main = MainListModel { - checked: false, - header_row: false, - selected_row: false, - val: ModelRc::new(data_model), - }; - items.push(main); + insert_data_to_model(&items, data_model, false); } app.set_empty_files_model(items.into()); app.invoke_scan_ended(format!("Found {} empty files", number_of_empty_files).into()); @@ -154,8 +134,7 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender .stack_size(DEFAULT_THREAD_SIZE) .spawn(move || { let mut finder = EmptyFolder::new(); - finder.set_included_directory(custom_settings.included_directories.clone()); - finder.set_excluded_directory(custom_settings.excluded_directories.clone()); + set_common_settings(&mut finder, &custom_settings); finder.find_empty_folders(Some(&stop_receiver), Some(&progress_sender)); let mut vector = finder.get_empty_folder_list().keys().cloned().collect::>(); @@ -172,18 +151,12 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender for path in vector { let (directory, file) = split_path(&path); let data_model = VecModel::from_slice(&[ - SharedString::from(file), - SharedString::from(directory), - SharedString::from(NaiveDateTime::from_timestamp_opt(folder_map[&path].modified_date as i64, 0).unwrap().to_string()), + file.into(), + directory.into(), + NaiveDateTime::from_timestamp_opt(folder_map[&path].modified_date as i64, 0).unwrap().to_string().into(), ]); - let main = MainListModel { - checked: false, - header_row: false, - selected_row: false, - val: ModelRc::new(data_model), - }; - items.push(main); + insert_data_to_model(&items, data_model, false); } app.set_empty_folder_model(items.into()); app.invoke_scan_ended(format!("Found {} empty folders", folder_map.len()).into()); @@ -192,3 +165,26 @@ fn scan_empty_folders(a: Weak, progress_sender: Sender }) .unwrap(); } + +fn insert_data_to_model(items: &Rc>, data_model: ModelRc, header_row: bool) { + let main = MainListModel { + checked: false, + header_row, + selected_row: false, + val: ModelRc::new(data_model), + }; + items.push(main); +} + +fn set_common_settings(component: &mut T, custom_settings: &SettingsCustom) +where + T: CommonData, +{ + component.set_included_directory(custom_settings.included_directories.clone()); + component.set_excluded_directory(custom_settings.excluded_directories.clone()); + component.set_recursive_search(true); // TODO bind + component.set_minimal_file_size(custom_settings.minimum_file_size as u64 * 1024); + component.set_minimal_file_size(custom_settings.maximum_file_size as u64 * 1024); + component.set_allowed_extensions(custom_settings.allowed_extensions.clone()); + component.set_excluded_items(custom_settings.excluded_items.split(',').map(str::to_string).collect()); +} diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index f69cd9661..9db4efcbc 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -12,6 +12,9 @@ use log::{debug, error, info}; use serde::{Deserialize, Serialize}; use slint::{ComponentHandle, Model, ModelRc}; +pub const DEFAULT_MINIMUM_SIZE: i32 = 16 * 1024; +pub const DEFAULT_MAXIMUM_SIZE: i32 = i32::MAX; + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SettingsCustom { #[serde(default = "default_included_directories")] @@ -133,7 +136,7 @@ pub fn create_default_settings_files() { pub fn load_settings_from_file(app: &MainWindow) { let result_base_settings = load_data_from_file::(get_base_config_file()); - let base_settings; + let mut base_settings; if let Ok(base_settings_temp) = result_base_settings { base_settings = base_settings_temp; } else { @@ -151,6 +154,18 @@ pub fn load_settings_from_file(app: &MainWindow) { custom_settings = SettingsCustom::default(); } + // Validate here values and set "proper" + // preset_names should have 10 items + if base_settings.preset_names.len() > 10 { + base_settings.preset_names.truncate(10); + } else if base_settings.preset_names.len() < 10 { + while base_settings.preset_names.len() < 10 { + base_settings.preset_names.push(format!("Preset {}", base_settings.preset_names.len() + 1)); + } + } + base_settings.default_preset = max(min(base_settings.default_preset, 9), 0); + + // Ended validating set_settings_to_gui(app, &custom_settings); set_base_settings_to_gui(app, &base_settings); } @@ -241,8 +256,6 @@ pub fn get_base_config_file() -> Option { Some(base_config_file) } pub fn get_config_file(number: i32) -> Option { - let number = max(min(number, 9), 0); - let Some(configs) = ProjectDirs::from("pl", "Qarmin", "Krokiet") else { return None; }; @@ -270,8 +283,8 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { settings.set_excluded_items(custom_settings.excluded_items.clone().into()); settings.set_allowed_extensions(custom_settings.allowed_extensions.clone().into()); - settings.set_minimum_file_size(custom_settings.minimum_file_size); - settings.set_maximum_file_size(custom_settings.maximum_file_size); + settings.set_minimum_file_size(custom_settings.minimum_file_size.to_string().into()); + settings.set_maximum_file_size(custom_settings.maximum_file_size.to_string().into()); // Clear text app.global::().set_info_text("".into()); @@ -288,8 +301,8 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let excluded_items = settings.get_excluded_items().to_string(); let allowed_extensions = settings.get_allowed_extensions().to_string(); - let minimum_file_size = settings.get_minimum_file_size(); - let maximum_file_size = settings.get_maximum_file_size(); + let minimum_file_size = settings.get_minimum_file_size().parse::().unwrap_or(DEFAULT_MINIMUM_SIZE); + let maximum_file_size = settings.get_maximum_file_size().parse::().unwrap_or(DEFAULT_MAXIMUM_SIZE); SettingsCustom { included_directories, @@ -364,8 +377,8 @@ fn default_preset_names() -> Vec { } fn minimum_file_size() -> i32 { - 16 + DEFAULT_MINIMUM_SIZE } fn maximum_file_size() -> i32 { - i32::MAX + DEFAULT_MAXIMUM_SIZE } diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 56b5070f5..645447ab0 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -30,7 +30,7 @@ export component ActionButtons inherits HorizontalLayout { Rectangle { scan_button := Button { height: parent.height; - enabled: !scanning; + enabled: !scanning && active-tab != CurrentTab.Settings; visible: !scanning; text: "Scan"; clicked => { diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index d33707cb8..d2f5d80fb 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -8,7 +8,7 @@ export global Settings { // Settings in-out property excluded_items: "Excluded items"; in-out property allowed_extensions: "Allowed extensions"; - in-out property minimum_file_size: 0; - in-out property maximum_file_size: 0; + in-out property minimum_file_size: 0; + in-out property maximum_file_size: 0; } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index e2a1526d7..9ceaa7d6f 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -2,6 +2,8 @@ import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListV import { Settings } from "settings.slint"; import { Callabler } from "callabler.slint"; +// TODO use Spinbox instead LineEdit {} to be able to set only numbers + global SettingsSize { out property item_height: 30px; } @@ -26,7 +28,7 @@ component MinMaxSizeComponent inherits HorizontalLayout { spacing: 20px; Text { horizontal-stretch: 0.0; - text:"Items Size(Kb)"; + text:"Items Size(Bytes)"; vertical-alignment: TextVerticalAlignment.center; } HorizontalLayout { @@ -36,21 +38,17 @@ component MinMaxSizeComponent inherits HorizontalLayout { text:"Min:"; vertical-alignment: TextVerticalAlignment.center; } - SpinBox { - enabled: true; - maximum: 999999999999999; + LineEdit { height: SettingsSize.item_height; - value <=> Settings.minimum_file_size; + text <=> Settings.minimum_file_size; } Text { text:"Max:"; vertical-alignment: TextVerticalAlignment.center; } - SpinBox { - enabled: true; - maximum: 999999999999999; + LineEdit { height: SettingsSize.item_height; - value <=> Settings.maximum_file_size; + text <=> Settings.maximum_file_size; } } } From 26ce7de410b33e8ff891fb9c6e4c9eb482951d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 26 Nov 2023 13:33:53 +0100 Subject: [PATCH 086/107] ID --- .github/workflows/quality.yml | 2 -- .github/workflows/windows.yml | 37 +++++--------------------- Cargo.lock | 12 ++++----- README.md | 11 -------- czkawka_gui/README.md | 49 ++++++++++++++++++++++++----------- krokiet/README.md | 23 +++++++--------- 6 files changed, 57 insertions(+), 77 deletions(-) diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index d1c7b9d04..482717c61 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -20,7 +20,5 @@ jobs: - name: Check the format run: cargo fmt --all -- --check - # Clippy overly_complex_bool_expr is disabled because mess with generated files in target dir - # and I cannot disable it - name: Run clippy run: cargo clippy --all-targets --all-features -- -D warnings diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c9b112578..1d5fb6169 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -116,21 +116,10 @@ jobs: - name: Install additional dependencies # gio is for the build script run: dnf install wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - target: x86_64-pc-windows-gnu - - name: Cache ~/.cargo - uses: actions/cache@v1 - with: - path: ~/.cargo - key: windows-dotcargo - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: windows-build-target + + - name: Setup rust version + run: | + rustup target add x86_64-pc-windows-gnu - name: Cross compile for Windows Heif run: | @@ -201,21 +190,9 @@ jobs: - name: Install additional dependencies # gio is for the build script run: dnf install wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - target: x86_64-pc-windows-gnu - - name: Cache ~/.cargo - uses: actions/cache@v1 - with: - path: ~/.cargo - key: windows-dotcargo - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: windows-build-target + - name: Setup rust version + run: | + rustup target add x86_64-pc-windows-gnu - name: Show console window on windows run: sd -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs - name: Cross compile for Windows diff --git a/Cargo.lock b/Cargo.lock index 4eb97f9aa..80c8ce0ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1387,7 +1387,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "lock_api", "once_cell", "parking_lot_core", @@ -2639,9 +2639,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" @@ -3127,7 +3127,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -4416,9 +4416,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] diff --git a/README.md b/README.md index c510cd443..24b6ed0d3 100644 --- a/README.md +++ b/README.md @@ -144,17 +144,6 @@ You can also help by doing other things: - Creating videos - [First Video](https://www.youtube.com/watch?v=CWlRiTD4vDc) or [Spanish Tutorial](https://www.youtube.com/watch?v=V9x-pHJRmKY) - Recommending it to others -## Name -Czkawka is a Polish word which means _hiccup_. - -I chose this name because I wanted to hear people speaking other languages pronounce it, so feel free to spell it the way you want. - -This name is not as bad as it seems, because I was also thinking about using words like _żółć_, _gżegżółka_ or _żołądź_, -but I gave up on these ideas because they contained Polish characters, which would cause difficulty in searching for the project. - -At the beginning of the program creation, if the response concerning the name was unanimously negative, I prepared myself -for a possible change of the name of the program, and the opinions were extremely mixed. - ## Thanks Big thanks to Pádraig Brady, creator of fantastic FSlint, because without his work I wouldn't create this tool. diff --git a/czkawka_gui/README.md b/czkawka_gui/README.md index d688732fa..f1dcd9f3b 100644 --- a/czkawka_gui/README.md +++ b/czkawka_gui/README.md @@ -1,15 +1,20 @@ # Czkawka GUI Czkawka GUI is a graphical user interface for Czkawka Core written with GTK 4. +![Screenshot from 2023-11-26 12-43-32](https://github.com/qarmin/czkawka/assets/41945903/722ed490-0be1-4dac-bcfc-182a4d0787dc) + ## Requirements -Requirements depends on platform that you are using: +Requirements depends on platform that you are using. + +Prebuild binareies are available here - https://github.com/qarmin/czkawka/releases/ + ### Linux #### Prebuild binaries Ubuntu - `sudo apt install libgtk-4 libheif ffmpeg -y` #### Snap - - none - all needed libraries are bundled in snap - except ffmpeg https://github.com/snapcrafters/ffmpeg/issues/73 + none - all needed libraries are bundled in snap [except ffmpeg](https://github.com/snapcrafters/ffmpeg/issues/73) - https://snapcraft.io/czkawka #### Flatpak - none - all needed libraries are bundled + none - all needed libraries are bundled - https://flathub.org/apps/com.github.qarmin.czkawka ### Mac ``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" @@ -19,19 +24,21 @@ brew install gtk4 adwaita-icon-theme ffmpeg librsvg libheif ### Windows All needed libraries should be bundled in zip(except ffmpeg which you need download and unpack to location with `czkawka_gui.exe` - https://ffmpeg.org/download.html#build-windows) +You can also install app via msys2(webp and heif should work here) - https://www.msys2.org/#installation (czkawka package - https://packages.msys2.org/base/mingw-w64-czkawka) +``` +pacman -S mingw-w64-x86_64-czkawka-gui +``` +and you can create shortcut to `C:\msys64\mingw64\bin\czkawka_gui.exe` + +## Compilation +Compilation of gui is harder that compilation cli or core, because uses gtk4 which is written in C and also requires a lot build and runtime dependencies. +### Requirements | Program | Minimal version | |:---------:|:-----------------:| | Rust | 1.72.1 | | GTK | 4.6 | -Prebuild binaries - https://github.com/qarmin/czkawka/releases/
-Snap package - https://snapcraft.io/czkawka
-Flatpak package - https://flathub.org/apps/com.github.qarmin.czkawka
- -## Compilation -Compilation of gui is harder that compilation cli or core, because uses gtk4 which is written in C and also requires a lot build and runtime dependencies. - ### Linux (Ubuntu, but on other OS should work similar) ```shell sudo apt install libgtk-4-dev libheif-dev -y @@ -45,13 +52,14 @@ rustup-init cargo run --release --bin czkawka_gui ``` ### Windows -Currently, it is not possible to compile app natively on Windows, but is possible to cross-compile it from Linux.
-You can check for CI for instructions how to cross-compile app(uses prebuilt docker image) - [CI Instructions](../.github/workflows/windows.yml) +Currently, there is no instruction how to compile app on Windows natively.
+You can check for CI for instructions how to cross-compile app from linux to windows(uses prebuilt docker image) - [CI Instructions](../.github/workflows/windows.yml)
+There exists mingw recipe which you can try to convert for your purposes - https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-czkawka/PKGBUILD ## Limitations -Not all available features in core are available in GUI and also there are limitations between platforms: +Not all available features other components implemented here, so this is list of limitations: - Snap versions not allows to use similar videos feature -- Windows version not supports heif and webp files +- Windows version not supports heif and webp files with prebuild binaries - Prebuild binaries for mac arm not exists ## License @@ -65,4 +73,15 @@ Some icons were taken from [ReShot](https://www.reshot.com) site and are license The program is completely free to use. -"Gratis to uczciwa cena" - "Free is a fair price" \ No newline at end of file +"Gratis to uczciwa cena" - "Free is a fair price" + +## Name +Czkawka is a Polish word which means _hiccup_. + +I chose this name because I wanted to hear people speaking other languages pronounce it, so feel free to spell it the way you want. + +This name is not as bad as it seems, because I was also thinking about using words like _żółć_, _gżegżółka_ or _żołądź_, +but I gave up on these ideas because they contained Polish characters, which would cause difficulty in searching for the project. + +At the beginning of the program creation, if the response concerning the name was unanimously negative, I prepared myself +for a possible change of the name of the program, and the opinions were extremely mixed. diff --git a/krokiet/README.md b/krokiet/README.md index f6e41cc36..7ba9f93fc 100644 --- a/krokiet/README.md +++ b/krokiet/README.md @@ -10,7 +10,9 @@ frontend(but of course I want implement most of features from other project). Krokiet should not have any special runtime requirements - it should work on almost any device non-antic device. -Prebuild binaries should work on Windows 10,11, Mac +Prebuild binaries should work on Windows 10,11, Mac, Ubuntu 22.04/20.04 and similar(libheif version + czkawka_gui requires Ubuntu 22.04+ and rest Ubuntu 20.04) - https://github.com/qarmin/czkawka/releases/ + + ## Compilation @@ -99,13 +101,10 @@ SLINT_STYLE=material-dark cargo run -- --path . - Modifying user interface - gui is written in simple language similar to qml, that can be modified in vscode/web with live preview - [slint live preview example](https://slint.dev/releases/1.3.0/editor/?load_demo=examples/printerdemo/ui/printerdemo.slint) -- Improving libraries used by Krokiet e.g. czkawka_core, image-rs etc. - Improving app rust code ## Missing features available in GTK 4 frontend -- preview support -- selecting/deselecting results - icons in buttons - resizable input files panel - settings @@ -115,9 +114,7 @@ SLINT_STYLE=material-dark cargo run -- --path . - saving results - symlink/hardlink - implementing all modes -- multiple languages - multiple selection -- key selection support - proper popup windows - slint not handle them properly - logo - about window @@ -129,13 +126,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
- Big cross compilation problems and hard to setup on non windows platforms
- Very easy to create and use invalid state in QML(unexpected null/undefined values 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(javascript flexibility is hard to )
- Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems
- Commercial license or GPL(is available also different
- 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 have multiple limitaions in different os
- 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 | - 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 | 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 From 41dd352e79fff87cb3ab8b52ab10ac206cac5ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 26 Nov 2023 14:04:13 +0100 Subject: [PATCH 087/107] Scripts --- .github/workflows/windows.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1d5fb6169..d8f1396e7 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -108,14 +108,16 @@ jobs: fail-fast: false matrix: use_heif: [ non_heif ] #, heif ] - heif problems with mingw - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest container: image: ghcr.io/piegamesde/gtk4-cross:gtk-4.6 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Install additional dependencies # gio is for the build script - run: dnf install wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y + run: | + dnf install curl wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - name: Setup rust version run: | @@ -179,7 +181,7 @@ jobs: container: image: ghcr.io/piegamesde/gtk4-cross:gtk-4.6 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Install dependencies(mostly sd) run: | dnf install wget -y @@ -189,7 +191,10 @@ jobs: sudo cp sd-v1.0.0-x86_64-unknown-linux-gnu/sd /usr/bin/sd - name: Install additional dependencies # gio is for the build script - run: dnf install wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y + run: | + dnf install curl wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + - name: Setup rust version run: | rustup target add x86_64-pc-windows-gnu From c416fbdd4093b894c5bca986056775a4548c1a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 26 Nov 2023 14:08:43 +0100 Subject: [PATCH 088/107] ABCD --- .github/workflows/windows.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index d8f1396e7..1ffe963ba 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -118,9 +118,7 @@ jobs: run: | dnf install curl wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - - - name: Setup rust version - run: | + source "$HOME/.cargo/env" rustup target add x86_64-pc-windows-gnu - name: Cross compile for Windows Heif @@ -194,10 +192,9 @@ jobs: run: | dnf install curl wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - - - name: Setup rust version - run: | + source "$HOME/.cargo/env" rustup target add x86_64-pc-windows-gnu + - name: Show console window on windows run: sd -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs - name: Cross compile for Windows From 2c264fa52659ded0d5c5f468073d7b792f55ae4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 26 Nov 2023 14:16:55 +0100 Subject: [PATCH 089/107] Source --- .github/workflows/windows.yml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1ffe963ba..f9797152c 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -107,7 +107,7 @@ jobs: strategy: fail-fast: false matrix: - use_heif: [ non_heif ] #, heif ] - heif problems with mingw + use_heif: [ non_heif ] runs-on: ubuntu-latest container: image: ghcr.io/piegamesde/gtk4-cross:gtk-4.6 @@ -121,19 +121,9 @@ jobs: source "$HOME/.cargo/env" rustup target add x86_64-pc-windows-gnu - - name: Cross compile for Windows Heif - run: | - #!/bin/bash - set -euo pipefail - export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/ - cargo build --target=x86_64-pc-windows-gnu --release --locked --features heif - mkdir -p package - cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe package/ - cp target/x86_64-pc-windows-gnu/release/czkawka_cli.exe package/ - if: ${{ matrix.use_heif == 'heif' }} - - name: Cross compile for Windows run: | + source "$HOME/.cargo/env" #!/bin/bash set -euo pipefail export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/ @@ -141,7 +131,6 @@ jobs: mkdir -p package cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe package/ cp target/x86_64-pc-windows-gnu/release/czkawka_cli.exe package/ - if: ${{ matrix.use_heif == 'non_heif' }} - name: Package run: | @@ -199,6 +188,7 @@ jobs: run: sd -s '#![windows_subsystem = "windows"]' '//#![windows_subsystem = "windows"]' krokiet/src/main.rs - name: Cross compile for Windows run: | + source "$HOME/.cargo/env" #!/bin/bash set -euo pipefail export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/ From b713df75d36faeb9fd1f817aa6ea558de706413d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 26 Nov 2023 20:00:05 +0100 Subject: [PATCH 090/107] Bind more settings --- krokiet/src/main.rs | 1 + krokiet/src/set_initial_gui_info.rs | 13 ++++++ krokiet/src/settings.rs | 28 +++++++++++++ krokiet/ui/gui_state.slint | 2 + krokiet/ui/settings.slint | 6 ++- krokiet/ui/settings_list.slint | 61 ++++++++++++++++++++++++++++- 6 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 krokiet/src/set_initial_gui_info.rs diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 47b78b1d5..6200857fc 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -27,6 +27,7 @@ mod connect_show_preview; mod connect_stop; mod connect_translation; mod localizer_krokiet; +mod set_initial_gui_info; mod settings; use crossbeam_channel::{unbounded, Receiver, Sender}; diff --git a/krokiet/src/set_initial_gui_info.rs b/krokiet/src/set_initial_gui_info.rs new file mode 100644 index 000000000..b463c748e --- /dev/null +++ b/krokiet/src/set_initial_gui_info.rs @@ -0,0 +1,13 @@ +use crate::GuiState; +use crate::{Callabler, CurrentTab, MainListModel, MainWindow}; +use log::info; +use slint::{ComponentHandle, Model, ModelRc, VecModel}; +use std::thread; + +fn set_initial_gui_infos(app: &MainWindow) { + let threads = match thread::available_parallelism() { + Ok(t) => t.get(), + Err(_) => 1, + }; + app.global::().set_maximum_threads(threads as f32); +} diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 9db4efcbc..e015aee57 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -29,6 +29,16 @@ pub struct SettingsCustom { pub minimum_file_size: i32, #[serde(default = "maximum_file_size")] pub maximum_file_size: i32, + #[serde(default = "ttrue")] + pub use_cache: bool, + #[serde(default)] + pub save_also_as_json: bool, + #[serde(default)] + pub move_deleted_files_to_trash: bool, + #[serde(default)] + pub ignore_other_file_systems: bool, + #[serde(default)] + pub thread_number: i32, } impl Default for SettingsCustom { @@ -285,6 +295,11 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { settings.set_allowed_extensions(custom_settings.allowed_extensions.clone().into()); settings.set_minimum_file_size(custom_settings.minimum_file_size.to_string().into()); settings.set_maximum_file_size(custom_settings.maximum_file_size.to_string().into()); + settings.set_use_cache(custom_settings.use_cache); + settings.set_save_as_json(custom_settings.save_also_as_json); + settings.set_move_to_trash(custom_settings.move_deleted_files_to_trash); + settings.set_ignore_other_filesystems(custom_settings.ignore_other_file_systems); + settings.set_thread_number(custom_settings.thread_number as f32); // Clear text app.global::().set_info_text("".into()); @@ -304,6 +319,11 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let minimum_file_size = settings.get_minimum_file_size().parse::().unwrap_or(DEFAULT_MINIMUM_SIZE); let maximum_file_size = settings.get_maximum_file_size().parse::().unwrap_or(DEFAULT_MAXIMUM_SIZE); + let use_cache = settings.get_use_cache(); + let save_also_as_json = settings.get_save_as_json(); + let move_deleted_files_to_trash = settings.get_move_to_trash(); + let ignore_other_file_systems = settings.get_ignore_other_filesystems(); + let thread_number = settings.get_thread_number().round() as i32; SettingsCustom { included_directories, excluded_directories, @@ -311,6 +331,11 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { allowed_extensions, minimum_file_size, maximum_file_size, + use_cache, + save_also_as_json, + move_deleted_files_to_trash, + ignore_other_file_systems, + thread_number, } } @@ -382,3 +407,6 @@ fn minimum_file_size() -> i32 { fn maximum_file_size() -> i32 { DEFAULT_MAXIMUM_SIZE } +fn ttrue() -> bool { + true +} diff --git a/krokiet/ui/gui_state.slint b/krokiet/ui/gui_state.slint index 30d1187a2..ab08c8c0e 100644 --- a/krokiet/ui/gui_state.slint +++ b/krokiet/ui/gui_state.slint @@ -2,4 +2,6 @@ export global GuiState { in-out property info_text: "Nothing to report"; in-out property preview_visible; in-out property preview_image; + + in-out property maximum_threads: 8; } diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index d2f5d80fb..5e1ecae0c 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -10,5 +10,9 @@ export global Settings { in-out property allowed_extensions: "Allowed extensions"; in-out property minimum_file_size: 0; in-out property maximum_file_size: 0; - + in-out property use_cache: false; + in-out property save_as_json: false; + in-out property move_to_trash: false; + in-out property ignore_other_filesystems: false; + in-out property thread_number: 0; } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 9ceaa7d6f..25c2e66a3 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -1,6 +1,7 @@ -import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, ScrollView, LineEdit, SpinBox, ComboBox, TextEdit} from "std-widgets.slint"; +import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, ScrollView, LineEdit, SpinBox, ComboBox, TextEdit, Slider} from "std-widgets.slint"; import { Settings } from "settings.slint"; import { Callabler } from "callabler.slint"; +import { GuiState } from "gui_state.slint"; // TODO use Spinbox instead LineEdit {} to be able to set only numbers @@ -24,6 +25,44 @@ component TextComponent inherits HorizontalLayout { } } +component CheckBoxComponent inherits HorizontalLayout { + in-out property model; + in property name; + spacing: 5px; + CheckBox { + horizontal-stretch: 1.0; + height: SettingsSize.item_height; + checked <=> model; + text: name; + } + Rectangle {} +} + +component ThreadSliderComponent inherits HorizontalLayout { + in-out property minimum_number; + in-out property maximum_number; + in-out property name; + spacing: 5px; + + Text { + text <=> name; + vertical-alignment: TextVerticalAlignment.center; + height: SettingsSize.item_height; + } + slider := Slider { + enabled: true; + height: SettingsSize.item_height; + minimum: minimum_number; + maximum <=> maximum_number; + value <=> Settings.thread_number; + } + Text { + height: SettingsSize.item_height; + vertical-alignment: TextVerticalAlignment.center; + text: round(slider.value) == 0 ? ("All (" + GuiState.maximum_threads + "/" + GuiState.maximum_threads + ")") : (round(slider.value) + "/" + GuiState.maximum_threads); + } +} + component MinMaxSizeComponent inherits HorizontalLayout { spacing: 20px; Text { @@ -143,6 +182,26 @@ export component SettingsList inherits VerticalLayout { MinMaxSizeComponent { } + CheckBoxComponent { + name: "Use Cache"; + model <=> Settings.use_cache; + } + CheckBoxComponent { + name: "Also save cache as JSON file"; + model <=> Settings.save_as_json; + } + CheckBoxComponent { + name: "Move deleted files to trash"; + model <=> Settings.move_to_trash; + } + CheckBoxComponent { + name: "Ignore other filesystems (only Linux)"; + model <=> Settings.ignore_other_filesystems; + } + ThreadSliderComponent { + name: "Thread number"; + maximum_number <=> GuiState.maximum_threads; + } } } HorizontalLayout { From 62fbfe0510d523025c783c4f0a0cc3e34259c247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 26 Nov 2023 21:45:58 +0100 Subject: [PATCH 091/107] Limit thread number --- czkawka_core/src/common.rs | 9 +++++---- krokiet/src/main.rs | 2 ++ krokiet/src/set_initial_gui_info.rs | 19 ++++++++++--------- krokiet/src/settings.rs | 4 +++- krokiet/ui/gui_state.slint | 2 +- krokiet/ui/settings.slint | 2 +- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 8a4acd252..138f7e47b 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -59,6 +59,10 @@ pub fn setup_logger(disabled_printing: bool) { handsome_logger::TermLogger::init(config, TerminalMode::Mixed, ColorChoice::Always).unwrap(); } +pub fn get_available_threads() -> usize { + thread::available_parallelism().map(std::num::NonZeroUsize::get).unwrap_or(1) +} + pub fn print_version_mode() { let rust_version = match rustc_version::version_meta() { Ok(meta) => meta.semver.to_string(), @@ -66,10 +70,7 @@ pub fn print_version_mode() { }; let debug_release = if cfg!(debug_assertions) { "debug" } else { "release" }; - let processors = match thread::available_parallelism() { - Ok(t) => t.get(), - Err(_) => 1, - }; + let processors = get_available_threads(); let info = os_info::get(); info!( diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 6200857fc..361a5486d 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -42,6 +42,7 @@ use crate::connect_progress_receiver::connect_progress_gathering; use crate::connect_show_preview::connect_show_preview; use crate::connect_stop::connect_stop_button; use crate::connect_translation::connect_translations; +use crate::set_initial_gui_info::set_initial_gui_infos; use crate::settings::{connect_changing_settings_preset, create_default_settings_files, load_settings_from_file, save_all_settings_to_file}; use czkawka_core::common::{print_version_mode, setup_logger}; use czkawka_core::common_dir_traversal::ProgressData; @@ -62,6 +63,7 @@ fn main() { create_default_settings_files(); load_settings_from_file(&app); + set_initial_gui_infos(&app); connect_delete_button(&app); connect_scan_button(&app, progress_sender, stop_receiver); connect_stop_button(&app, stop_sender); diff --git a/krokiet/src/set_initial_gui_info.rs b/krokiet/src/set_initial_gui_info.rs index b463c748e..618db873b 100644 --- a/krokiet/src/set_initial_gui_info.rs +++ b/krokiet/src/set_initial_gui_info.rs @@ -1,13 +1,14 @@ -use crate::GuiState; -use crate::{Callabler, CurrentTab, MainListModel, MainWindow}; -use log::info; -use slint::{ComponentHandle, Model, ModelRc, VecModel}; use std::thread; -fn set_initial_gui_infos(app: &MainWindow) { - let threads = match thread::available_parallelism() { - Ok(t) => t.get(), - Err(_) => 1, - }; +use czkawka_core::common::get_available_threads; +use slint::ComponentHandle; + +use crate::GuiState; +use crate::MainWindow; + +// Some info needs to be send to gui at the start like available thread number in OS. +// +pub fn set_initial_gui_infos(app: &MainWindow) { + let threads = get_available_threads(); app.global::().set_maximum_threads(threads as f32); } diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index e015aee57..0206a3fd5 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -5,6 +5,7 @@ use std::path::PathBuf; use crate::common::{create_string_standard_list_view_from_pathbuf, create_vec_model_from_vec_string}; use crate::{GuiState, Settings}; +use czkawka_core::common::get_available_threads; use czkawka_core::common_items::{DEFAULT_EXCLUDED_DIRECTORIES, DEFAULT_EXCLUDED_ITEMS}; use directories_next::ProjectDirs; use home::home_dir; @@ -156,7 +157,7 @@ pub fn load_settings_from_file(app: &MainWindow) { let results_custom_settings = load_data_from_file::(get_config_file(base_settings.default_preset)); - let custom_settings; + let mut custom_settings; if let Ok(custom_settings_temp) = results_custom_settings { custom_settings = custom_settings_temp; } else { @@ -174,6 +175,7 @@ pub fn load_settings_from_file(app: &MainWindow) { } } base_settings.default_preset = max(min(base_settings.default_preset, 9), 0); + custom_settings.thread_number = max(min(custom_settings.thread_number, get_available_threads() as i32), 0); // Ended validating set_settings_to_gui(app, &custom_settings); diff --git a/krokiet/ui/gui_state.slint b/krokiet/ui/gui_state.slint index ab08c8c0e..f94167193 100644 --- a/krokiet/ui/gui_state.slint +++ b/krokiet/ui/gui_state.slint @@ -3,5 +3,5 @@ export global GuiState { in-out property preview_visible; in-out property preview_image; - in-out property maximum_threads: 8; + in-out property maximum_threads: 40; } diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index 5e1ecae0c..011083161 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -14,5 +14,5 @@ export global Settings { in-out property save_as_json: false; in-out property move_to_trash: false; in-out property ignore_other_filesystems: false; - in-out property thread_number: 0; + in-out property thread_number: 4; } From fca5dd94aec1c08526aea998ca260acebaec3a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Mon, 27 Nov 2023 09:54:39 +0100 Subject: [PATCH 092/107] Cross-compile --- Changelog.md | 1 + czkawka_core/Cargo.toml | 2 +- czkawka_gui/Cargo.toml | 2 +- krokiet/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index f96e2b461..f15730d37 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,6 +13,7 @@ - Using normal crossbeam channels instead of asyncio tokio channel - [#1102](https://github.com/qarmin/czkawka/pull/1102) - Fixed tool type when using progress of empty directories - [#1102](https://github.com/qarmin/czkawka/pull/1102) - Fixed missing json support in saving size and name - [#1102](https://github.com/qarmin/czkawka/pull/1102) +- Fix cross-compiled debug windows build - [#1102](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/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index 09cf5374c..2ff40f1e7 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -56,7 +56,7 @@ serde_json = "1.0" # Language i18n-embed = { version = "0.14", features = ["fluent-system", "desktop-requester"] } i18n-embed-fl = "0.7" -rust-embed = "8.0" +rust-embed = { version = "8.0", features = ["debug-embed"] } once_cell = "1.18" # Raw image files diff --git a/czkawka_gui/Cargo.toml b/czkawka_gui/Cargo.toml index f76f38018..030c9641f 100644 --- a/czkawka_gui/Cargo.toml +++ b/czkawka_gui/Cargo.toml @@ -43,7 +43,7 @@ fs_extra = "1.3" # Language i18n-embed = { version = "0.14", features = ["fluent-system", "desktop-requester"] } i18n-embed-fl = "0.7" -rust-embed = "8.0" +rust-embed = { version = "8.0", features = ["debug-embed"] } once_cell = "1.18" log = "0.4.20" diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index 1a2c98d6e..f704246cb 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -38,7 +38,7 @@ directories-next = "2.0" # Translations i18n-embed = { version = "0.14", features = ["fluent-system", "desktop-requester"] } i18n-embed-fl = "0.7" -rust-embed = "8.0" +rust-embed = { version = "8.0", features = ["debug-embed"] } once_cell = "1.18" [build-dependencies] From 994477eee11562993e041b8b31bf4df0fefd315e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 28 Nov 2023 11:22:18 +0100 Subject: [PATCH 093/107] Slint 1.3.1 --- Cargo.lock | 409 ++++++++++++---------------- Changelog.md | 3 +- krokiet/src/set_initial_gui_info.rs | 2 - krokiet/src/settings.rs | 4 + krokiet/ui/action_buttons.slint | 7 +- krokiet/ui/settings.slint | 16 ++ krokiet/ui/settings_list.slint | 68 +++++ 7 files changed, 273 insertions(+), 236 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 80c8ce0ac..4f42650f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -709,21 +709,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "calloop" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea4bfce4c7fbd71e5bb8a7063b6cc7eed48c6d29ee9a08332a59e5d9d93e5c4" -dependencies = [ - "bitflags 1.3.2", - "io-lifetimes", - "log", - "nix 0.26.4", - "polling 2.8.0", - "slab", - "thiserror", -] - [[package]] name = "calloop" version = "0.12.3" @@ -744,7 +729,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ - "calloop 0.12.3", + "calloop", "rustix 0.38.25", "wayland-backend", "wayland-client", @@ -863,9 +848,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.8" +version = "4.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" +checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272" dependencies = [ "clap_builder", "clap_derive", @@ -873,9 +858,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.8" +version = "4.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" +checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1" dependencies = [ "anstream", "anstyle", @@ -917,22 +902,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8191fa7302e03607ff0e237d4246cc043ff5b3cb9409d995172ba3bea16b807" -[[package]] -name = "cocoa" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" -dependencies = [ - "bitflags 1.3.2", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics 0.22.3", - "foreign-types 0.3.2", - "libc", - "objc", -] - [[package]] name = "cocoa" version = "0.25.0" @@ -943,8 +912,8 @@ dependencies = [ "block", "cocoa-foundation", "core-foundation", - "core-graphics 0.23.1", - "foreign-types 0.5.0", + "core-graphics", + "foreign-types", "libc", "objc", ] @@ -1085,19 +1054,6 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" -[[package]] -name = "core-graphics" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", - "foreign-types 0.3.2", - "libc", -] - [[package]] name = "core-graphics" version = "0.23.1" @@ -1107,7 +1063,7 @@ dependencies = [ "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types 0.5.0", + "foreign-types", "libc", ] @@ -1124,13 +1080,13 @@ dependencies = [ [[package]] name = "core-text" -version = "19.2.0" +version = "20.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" +checksum = "c9d2790b5c08465d49f8dc05c8bcae9fea467855947db39b0f8145c091aaced5" dependencies = [ "core-foundation", - "core-graphics 0.22.3", - "foreign-types 0.3.2", + "core-graphics", + "foreign-types", "libc", ] @@ -1395,9 +1351,9 @@ dependencies = [ [[package]] name = "data-url" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5" +checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a" [[package]] name = "datasize" @@ -1550,21 +1506,44 @@ checksum = "edf9159ef4bcecd0c5e4cbeb573b8d0037493403d542780dba5d840bbf9df56f" dependencies = [ "bitflags 1.3.2", "bytemuck", - "drm-ffi", + "drm-ffi 0.5.0", "drm-fourcc", "nix 0.26.4", ] +[[package]] +name = "drm" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb1b703ffbc7ebd216eba7900008049a56ace55580ecb2ee7fa801e8d8be87" +dependencies = [ + "bitflags 2.4.1", + "bytemuck", + "drm-ffi 0.6.0", + "drm-fourcc", + "nix 0.27.1", +] + [[package]] name = "drm-ffi" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1352481b7b90e27a8a1bf8ef6b33cf18b98dba7c410e75c24bb3eef2f0d8d525" dependencies = [ - "drm-sys", + "drm-sys 0.4.0", "nix 0.26.4", ] +[[package]] +name = "drm-ffi" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba7d1c19c4b6270e89d59fb27dc6d02a317c658a8a54e54781e1db9b5947595d" +dependencies = [ + "drm-sys 0.5.0", + "nix 0.27.1", +] + [[package]] name = "drm-fourcc" version = "2.2.0" @@ -1580,6 +1559,12 @@ dependencies = [ "libc", ] +[[package]] +name = "drm-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a4f1c0468062a56cd5705f1e3b5409eb286d5596a2028ec8e947595d7e715ae" + [[package]] name = "dwrote" version = "0.11.0" @@ -1649,12 +1634,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1766,9 +1751,9 @@ dependencies = [ [[package]] name = "femtovg" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3a2d0ff0df09856a5c1c89cc83863a1f0f994c55452186621bb57a01f270b3" +checksum = "d900654f23fe7c254442e1902e22dff2c3facf61bc0fb6531cc103b66467864e" dependencies = [ "bitflags 2.4.1", "fnv", @@ -1778,7 +1763,7 @@ dependencies = [ "imgref", "lru", "rgb", - "rustybuzz", + "rustybuzz 0.11.0", "unicode-bidi", "unicode-segmentation", "wasm-bindgen", @@ -1926,13 +1911,13 @@ dependencies = [ [[package]] name = "fontdb" -version = "0.14.1" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8d8cbea8f21307d7e84bca254772981296f058a1d36b461bf4d83a7499fc9e" +checksum = "020e203f177c0fb250fb19455a252e838d2bbbce1f80f25ecc42402aafa8cd38" dependencies = [ "fontconfig-parser", "log", - "memmap2 0.6.2", + "memmap2 0.8.0", "slotmap", "tinyvec", "ttf-parser 0.19.2", @@ -1948,15 +1933,6 @@ dependencies = [ "ttf-parser 0.15.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 0.1.1", -] - [[package]] name = "foreign-types" version = "0.5.0" @@ -1964,7 +1940,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" dependencies = [ "foreign-types-macros", - "foreign-types-shared 0.3.1", + "foreign-types-shared", ] [[package]] @@ -1978,12 +1954,6 @@ dependencies = [ "syn 2.0.39", ] -[[package]] -name = "foreign-types-shared" -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" @@ -2142,7 +2112,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2ec389cda876966cf824111bf6e533fb934c711d473498279964a990853b3c6" dependencies = [ "bitflags 1.3.2", - "drm", + "drm 0.9.0", "drm-fourcc", "gbm-sys", "libc", @@ -2399,9 +2369,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.12.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728" +checksum = "886c2a30b160c4c6fec8f987430c26b526b7988ca71f664e6a699ddf6f9601e4" dependencies = [ "js-sys", "slotmap", @@ -2690,12 +2660,12 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8955a5385270c9a8d76530e872a397eb6717bd1020f16c09c7f9c7fc1a59cd39" +checksum = "4a1d48fd53065a53f0a0d889afbeabc5bf93f221ad3e30381e233cfae4006daa" dependencies = [ - "calloop 0.11.0", - "drm", + "calloop", + "drm 0.9.0", "gbm", "glutin", "i-slint-common", @@ -2712,9 +2682,9 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "059bb78add36aaa9cc1a4f7e5978f47e5ec1ece31ca281451cc646ef3a7e4d85" +checksum = "840585129a6c33578da729cb58101e52d6cf75171eda7fb0165d23644c0b1389" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2726,14 +2696,14 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8992e2356a2331502261987d2a6803e798bf7a2a5272907713c08f46a7ad0652" +checksum = "f9740bdfde0e273caab6350946f13158d67aaf0b6959d946669fbd18d7911b6f" dependencies = [ "bytemuck", "cfg-if", "cfg_aliases", - "cocoa 0.24.1", + "cocoa", "const-field-offset", "copypasta", "derive_more", @@ -2762,9 +2732,9 @@ dependencies = [ [[package]] name = "i-slint-common" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "181a597710932e4ba09cd29fed3d479587fe33d3c880b0addd5421dbed4940bd" +checksum = "22fce76fae27a1fd3e8b7169bafe3b6f1cd92a4ad391b8e5020043c0576b4184" dependencies = [ "cfg-if", "derive_more", @@ -2774,9 +2744,9 @@ dependencies = [ [[package]] name = "i-slint-compiler" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0020485613a80b6dfe86a46f93c946b8382045ccbb29f7b9faf20725658fc7f0" +checksum = "d323113803c5ea180d511f544f311cf9d9042c199d65d3dc04066c6512345b9b" dependencies = [ "by_address", "codemap", @@ -2786,7 +2756,7 @@ dependencies = [ "fontdue", "i-slint-common", "image", - "itertools 0.11.0", + "itertools 0.12.0", "linked_hash_set", "lyon_extra", "lyon_path", @@ -2804,9 +2774,9 @@ dependencies = [ [[package]] name = "i-slint-core" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "408aa4fe8a28ae7284d18d0b35612fe172c096392dc429342e3626926c70e595" +checksum = "8a6a3baff84623830ffbaa14bd2da6735e0a521e2f8295bf5fedfbbe4b67044a" dependencies = [ "auto_enums", "bytemuck", @@ -2831,7 +2801,7 @@ dependencies = [ "portable-atomic", "resvg", "rgb", - "rustybuzz", + "rustybuzz 0.11.0", "scoped-tls-hkt", "scopeguard", "slab", @@ -2848,9 +2818,9 @@ dependencies = [ [[package]] name = "i-slint-core-macros" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d582a1644a5d818ee813f393490a5b2496936ef3962b62ff077e42a81626ef" +checksum = "e8724b37ae221878cdc4428a22299f4543bc6cf393ea4c3c27fa56532f24e214" dependencies = [ "quote", "syn 2.0.39", @@ -2858,9 +2828,9 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc056f6daab6224bb55a55751456ab2897a41ade84ca7772001a1cff46a6b26" +checksum = "c7cc37619fced5635cb257ae397f1b617e634eadc43d5e889cc061395319383b" dependencies = [ "cfg-if", "const-field-offset", @@ -2880,7 +2850,7 @@ dependencies = [ "raw-window-handle 0.5.2", "rgb", "scoped-tls-hkt", - "ttf-parser 0.18.1", + "ttf-parser 0.20.0", "unicode-script", "unicode-segmentation", "vtable", @@ -2891,20 +2861,20 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c4893627aa07956397bc997b4bcb83a22e1b364f8109be72505168837e2eb7" +checksum = "67d279b3d6d7271934103bf03eecbd86a4cc3773d9ccc5e25163fc4fe59b7d7d" dependencies = [ "ash", "bytemuck", "cfg-if", "cfg_aliases", - "cocoa 0.24.1", + "cocoa", "const-field-offset", "core-foundation", "core-graphics-types", "derive_more", - "foreign-types 0.3.2", + "foreign-types", "glow", "glutin", "i-slint-common", @@ -2985,9 +2955,9 @@ dependencies = [ [[package]] name = "i18n-embed-impl" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a4d5bff745c9a6e1459c490059281b353a4ab0a4e1e58b3eeeaef71f97d07b" +checksum = "81093c4701672f59416582fe3145676126fd23ba5db910acad0793c1108aaa58" dependencies = [ "find-crate", "i18n-config", @@ -3268,9 +3238,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" dependencies = [ "either", ] @@ -3323,9 +3293,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -3611,9 +3581,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.10.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" +checksum = "2994eeba8ed550fd9b47a0b38f0242bc3344e496483c6180b69139cc2fa5d1d7" [[package]] name = "lyon_algorithms" @@ -3687,18 +3657,9 @@ checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[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.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" +checksum = "43a5a03cefb0d953ec0be133036f14e109412fa594edc2f77227249db66cc3ed" dependencies = [ "libc", ] @@ -3732,16 +3693,17 @@ dependencies = [ [[package]] name = "metal" -version = "0.24.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" +checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.1", "block", "core-graphics-types", - "foreign-types 0.3.2", + "foreign-types", "log", "objc", + "paste", ] [[package]] @@ -4617,15 +4579,15 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "resvg" -version = "0.34.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0e3d65cea36eefb28a020edb6e66341764e00cd4b426e0c1f0599b1adaa78f5" +checksum = "cc7980f653f9a7db31acff916a262c3b78c562919263edea29bf41a056e20497" dependencies = [ "log", "pico-args", "rgb", "svgtypes", - "tiny-skia 0.10.0", + "tiny-skia", "usvg", ] @@ -4874,17 +4836,33 @@ dependencies = [ [[package]] name = "rustybuzz" -version = "0.7.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162bdf42e261bee271b3957691018634488084ef577dddeb6420a9684cab2a6a" +checksum = "71cd15fef9112a1f94ac64b58d1e4628192631ad6af4dc69997f995459c874e7" dependencies = [ "bitflags 1.3.2", "bytemuck", "smallvec", - "ttf-parser 0.18.1", + "ttf-parser 0.19.2", + "unicode-bidi-mirroring", + "unicode-ccc", + "unicode-properties", + "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", + "smallvec", + "ttf-parser 0.20.0", "unicode-bidi-mirroring", "unicode-ccc", - "unicode-general-category", + "unicode-properties", "unicode-script", ] @@ -4941,7 +4919,7 @@ dependencies = [ "log", "memmap2 0.9.0", "smithay-client-toolkit", - "tiny-skia 0.11.2", + "tiny-skia", ] [[package]] @@ -5143,9 +5121,9 @@ dependencies = [ [[package]] name = "slint" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9d589a30c2812877798eecf2b5cb51e7f2c4531f7c9e8746be6b25a24f37e6" +checksum = "d1376acd8d87420776a8b7379f7a86887f91027eba81ae0c89a41e9199e4320c" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5160,21 +5138,21 @@ dependencies = [ [[package]] name = "slint-build" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2edbdfb7bdb1688273656c301ffa221a3939869620e7a12f02d7cae6532098ee" +checksum = "56ff1cc8914b4ee969702a19a5254565d82ce56b7520fa8cd2b494ca31a6983b" dependencies = [ "i-slint-compiler", "spin_on", "thiserror", - "toml_edit 0.20.7", + "toml_edit 0.21.0", ] [[package]] name = "slint-macros" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee1b8b49389eb768793499fce1c60d613ac52d14fe77383a65f233327cd65715" +checksum = "a82260f35cceae7d0339177f2d2c30693b94b9436508046723493098e1c085b7" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -5204,7 +5182,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60e3d9941fa3bacf7c2bf4b065304faa14164151254cd16ce1b1bc8fc381600f" dependencies = [ "bitflags 2.4.1", - "calloop 0.12.3", + "calloop", "calloop-wayland-source", "cursor-icon", "libc", @@ -5283,10 +5261,11 @@ dependencies = [ "as-raw-xcb-connection", "bytemuck", "cfg_aliases", - "cocoa 0.25.0", - "core-graphics 0.23.1", + "cocoa", + "core-graphics", + "drm 0.10.0", "fastrand 2.0.1", - "foreign-types 0.5.0", + "foreign-types", "js-sys", "log", "memmap2 0.9.0", @@ -5405,9 +5384,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "svgtypes" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed4b0611e7f3277f68c0fa18e385d9e2d26923691379690039548f867cef02a7" +checksum = "d71499ff2d42f59d26edb21369a308ede691421f79ebc0f001e2b1fd3a7c9e52" dependencies = [ "kurbo", "siphasher", @@ -5748,21 +5727,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-skia" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7db11798945fa5c3e5490c794ccca7c6de86d3afdd54b4eb324109939c6f37bc" -dependencies = [ - "arrayref", - "arrayvec", - "bytemuck", - "cfg-if", - "log", - "png", - "tiny-skia-path 0.10.0", -] - [[package]] name = "tiny-skia" version = "0.11.2" @@ -5774,18 +5738,8 @@ dependencies = [ "bytemuck", "cfg-if", "log", - "tiny-skia-path 0.11.2", -] - -[[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", + "png", + "tiny-skia-path", ] [[package]] @@ -5999,12 +5953,6 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" -[[package]] -name = "ttf-parser" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633" - [[package]] name = "ttf-parser" version = "0.19.2" @@ -6108,12 +6056,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" @@ -6135,6 +6077,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-properties" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f91c8b21fbbaa18853c3d0801c78f4fc94cdb976699bb03e832e75f7fd22f0" + [[package]] name = "unicode-script" version = "0.5.5" @@ -6195,9 +6143,9 @@ checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "usvg" -version = "0.34.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2304b933107198a910c1f3219acb65246f2b148f862703cffd51c6e62156abe" +checksum = "c51daa774fe9ee5efcf7b4fec13019b8119cda764d9a8b5b06df02bb1445c656" dependencies = [ "base64", "log", @@ -6210,9 +6158,9 @@ dependencies = [ [[package]] name = "usvg-parser" -version = "0.34.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b940fea80394e3b14cb21c83fa1b8f8a41023c25929bba68bb84a76193ebed" +checksum = "45c88a5ffaa338f0e978ecf3d4e00d8f9f493e29bed0752e1a808a1db16afc40" dependencies = [ "data-url", "flate2", @@ -6228,14 +6176,14 @@ dependencies = [ [[package]] name = "usvg-text-layout" -version = "0.34.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69dfd6119f431aa7e969b4a69f9cc8b9ae37b8ae85bb26780ccfa3beaf8b71eb" +checksum = "4d2374378cb7a3fb8f33894e0fdb8625e1bbc4f25312db8d91f862130b541593" dependencies = [ "fontdb", "kurbo", "log", - "rustybuzz", + "rustybuzz 0.10.0", "unicode-bidi", "unicode-script", "unicode-vo", @@ -6244,14 +6192,14 @@ dependencies = [ [[package]] name = "usvg-tree" -version = "0.34.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3185eb13b6e3d3cf1817d29612251cc308d5a7e5e6235362e67efe832435c6d9" +checksum = "6cacb0c5edeaf3e80e5afcf5b0d4004cc1d36318befc9a7c6606507e5d0f4062" dependencies = [ "rctree", "strict-num", "svgtypes", - "tiny-skia-path 0.10.0", + "tiny-skia-path", ] [[package]] @@ -6309,9 +6257,9 @@ dependencies = [ [[package]] name = "vk-parse" -version = "0.8.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6a0bda9bbe6b9e50e6456c80aa8fe4cca3b21e4311a1130c41e4915ec2e32a" +checksum = "81086c28be67a8759cd80cbb3c8f7b520e0874605fc5eb74d5a1c9c2d1878e79" dependencies = [ "xml-rs", ] @@ -6341,9 +6289,9 @@ dependencies = [ [[package]] name = "vulkano" -version = "0.33.0" +version = "0.34.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e1f15eeb9d93a05eb3c237332a10806eac1eb82444e54485bfcc1859c483c23" +checksum = "70f4278f76307b3c388679234b397b4f90de29cdba53873c26b624ed82653d75" dependencies = [ "ahash", "ash", @@ -6352,13 +6300,14 @@ dependencies = [ "crossbeam-queue", "half", "heck", - "indexmap 1.9.3", - "libloading 0.7.4", + "indexmap 2.1.0", + "libloading 0.8.1", "objc", "once_cell", "parking_lot", "proc-macro2", "quote", + "raw-window-handle 0.5.2", "regex", "serde", "serde_json", @@ -6391,9 +6340,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -6401,9 +6350,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", @@ -6416,9 +6365,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ "cfg-if", "js-sys", @@ -6428,9 +6377,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6438,9 +6387,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", @@ -6451,9 +6400,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "wayland-backend" @@ -6884,10 +6833,10 @@ dependencies = [ "atomic-waker", "bitflags 2.4.1", "bytemuck", - "calloop 0.12.3", + "calloop", "cfg_aliases", "core-foundation", - "core-graphics 0.23.1", + "core-graphics", "cursor-icon", "icrate", "js-sys", @@ -7015,12 +6964,12 @@ dependencies = [ [[package]] name = "xkbcommon" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c286371c44b3572d19b09196c129a8fff47d7704d6494daefb44fec10f0278ab" +checksum = "13867d259930edc7091a6c41b4ce6eee464328c6ff9659b7e4c668ca20d4c91e" dependencies = [ "libc", - "memmap2 0.7.1", + "memmap2 0.8.0", "xkeysym", ] diff --git a/Changelog.md b/Changelog.md index f15730d37..391135a8c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,7 @@ ## Version 7.0.0 - ? ### GTK GUI - Added drag&drop support for included/excluded folders - [#1106](https://github.com/qarmin/czkawka/pull/1106) -- Added information where is saved info about scan results - [#1102](https://github.com/qarmin/czkawka/pull/1102) +- Added information where are saved scan results - [#1102](https://github.com/qarmin/czkawka/pull/1102) ### CLI - Providing full static rust binary with [Eyra](https://github.com/sunfishcode/eyra) - [#1102](https://github.com/qarmin/czkawka/pull/1102) @@ -14,6 +14,7 @@ - Fixed tool type when using progress of empty directories - [#1102](https://github.com/qarmin/czkawka/pull/1102) - Fixed missing json support in saving size and name - [#1102](https://github.com/qarmin/czkawka/pull/1102) - Fix cross-compiled debug windows build - [#1102](https://github.com/qarmin/czkawka/pull/1102) +- Added bigger stack size by default(fixes stack overflow in some musl apps) - [#1102](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/src/set_initial_gui_info.rs b/krokiet/src/set_initial_gui_info.rs index 618db873b..da2c59ded 100644 --- a/krokiet/src/set_initial_gui_info.rs +++ b/krokiet/src/set_initial_gui_info.rs @@ -1,5 +1,3 @@ -use std::thread; - use czkawka_core::common::get_available_threads; use slint::ComponentHandle; diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 0206a3fd5..bd17bfa94 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -31,6 +31,8 @@ pub struct SettingsCustom { #[serde(default = "maximum_file_size")] pub maximum_file_size: i32, #[serde(default = "ttrue")] + pub recursive_search: bool, + #[serde(default = "ttrue")] pub use_cache: bool, #[serde(default)] pub save_also_as_json: bool, @@ -321,6 +323,7 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let minimum_file_size = settings.get_minimum_file_size().parse::().unwrap_or(DEFAULT_MINIMUM_SIZE); let maximum_file_size = settings.get_maximum_file_size().parse::().unwrap_or(DEFAULT_MAXIMUM_SIZE); + let recursive_search = settings.get_recursive_search(); let use_cache = settings.get_use_cache(); let save_also_as_json = settings.get_save_as_json(); let move_deleted_files_to_trash = settings.get_move_to_trash(); @@ -333,6 +336,7 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { allowed_extensions, minimum_file_size, maximum_file_size, + recursive_search, use_cache, save_also_as_json, move_deleted_files_to_trash, diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 645447ab0..614ee503e 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -22,6 +22,7 @@ export component ActionButtons inherits HorizontalLayout { in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; in-out property stop_requested: false; in-out property scanning; + in-out property lists_enabled: active-tab != CurrentTab.Settings; in-out property active-tab; out property name; height: 30px; @@ -30,7 +31,7 @@ export component ActionButtons inherits HorizontalLayout { Rectangle { scan_button := Button { height: parent.height; - enabled: !scanning && active-tab != CurrentTab.Settings; + enabled: !scanning && lists_enabled; visible: !scanning; text: "Scan"; clicked => { @@ -42,7 +43,7 @@ export component ActionButtons inherits HorizontalLayout { stop_button := Button { height: parent.height; visible: scanning; - enabled: scanning && !stop_requested; + enabled: scanning && !stop_requested && root.lists_enabled; text: "Stop"; clicked => { root.scan_stopping(); @@ -57,7 +58,7 @@ export component ActionButtons inherits HorizontalLayout { delete_button := Button { height: parent.height; - enabled: !scanning; + enabled: !scanning && lists_enabled; text: "Delete"; clicked => { Callabler.delete_selected_items(); diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index 011083161..15819ddfb 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -10,9 +10,25 @@ export global Settings { in-out property allowed_extensions: "Allowed extensions"; in-out property minimum_file_size: 0; in-out property maximum_file_size: 0; + in-out property recursive_search: true; in-out property use_cache: false; in-out property save_as_json: false; in-out property move_to_trash: false; in-out property ignore_other_filesystems: false; in-out property thread_number: 4; + + in-out property duplicate_image_preview; + in-out property duplicate_hide_hard_links; + in-out property duplicate_use_prehash; + in-out property duplicate_minimal_hash_cache_size; + in-out property duplicate_minimal_prehash_cache_size; + in-out property duplicate_delete_outdated_entries; + + in-out property similar_images_show_image_preview; + in-out property similar_images_delete_outdated_entries; + + // in-out property similar_videos_show_video_preview; // TODO - maybe someday + in-out property similar_videos_delete_outdated_entries; + + in-out property similar_music_delete_outdated_entries; } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 25c2e66a3..837199c9a 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -181,6 +181,10 @@ export component SettingsList inherits VerticalLayout { } MinMaxSizeComponent { + } + CheckBoxComponent { + name: "Recursive"; + model <=> Settings.recursive_search; } CheckBoxComponent { name: "Use Cache"; @@ -202,6 +206,70 @@ export component SettingsList inherits VerticalLayout { name: "Thread number"; maximum_number <=> GuiState.maximum_threads; } + Text { + text: "Duplicate settings"; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + vertical-alignment: TextVerticalAlignment.center; + } + CheckBoxComponent { + name: "Image preview"; + model <=> Settings.duplicate_image_preview; + } + CheckBoxComponent { + name: "Hide hard links"; + model <=> Settings.duplicate_hide_hard_links; + } + CheckBoxComponent { + name: "Use prehash"; + model <=> Settings.duplicate_use_prehash; + } + TextComponent { + name: "Minimal size of cached files - Hash (KB)"; + model <=> Settings.duplicate_minimal_hash_cache_size; + } + TextComponent { + name: "Minimal size of cached files - Prehash (KB)"; + model <=> Settings.duplicate_minimal_prehash_cache_size; + } + CheckBoxComponent { + name: "Delete outdated entries"; + model <=> Settings.duplicate_delete_outdated_entries; + } + Text { + text: "Similar Images settings"; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + vertical-alignment: TextVerticalAlignment.center; + } + CheckBoxComponent { + name: "Image preview"; + model <=> Settings.similar_images_show_image_preview; + } + CheckBoxComponent { + name: "Delete outdated entries"; + model <=> Settings.similar_images_delete_outdated_entries; + } + Text { + text: "Similar Videos settings"; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + vertical-alignment: TextVerticalAlignment.center; + } + CheckBoxComponent { + name: "Delete outdated entries"; + model <=> Settings.similar_videos_delete_outdated_entries; + } + Text { + text: "Similar Music settings"; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + vertical-alignment: TextVerticalAlignment.center; + } + CheckBoxComponent { + name: "Delete outdated entries"; + model <=> Settings.similar_music_delete_outdated_entries; + } } } HorizontalLayout { From 606b57b6ff723260bd2adcc16a9328c665b0d494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Wed, 29 Nov 2023 20:02:26 +0100 Subject: [PATCH 094/107] Random --- krokiet/src/settings.rs | 96 +++++++++++++++++++------- krokiet/ui/action_buttons.slint | 23 ++++++ krokiet/ui/callabler.slint | 4 ++ krokiet/ui/gui_state.slint | 6 ++ krokiet/ui/main_window.slint | 70 ++++--------------- krokiet/ui/popup_new_directories.slint | 76 ++++++++++++++++++++ krokiet/ui/popup_select.slint | 74 ++++++++++++++++++++ 7 files changed, 268 insertions(+), 81 deletions(-) create mode 100644 krokiet/ui/popup_new_directories.slint create mode 100644 krokiet/ui/popup_select.slint diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index bd17bfa94..00b577d82 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -1,20 +1,24 @@ -use crate::{Callabler, MainWindow}; use std::cmp::{max, min}; use std::env; use std::path::PathBuf; -use crate::common::{create_string_standard_list_view_from_pathbuf, create_vec_model_from_vec_string}; -use crate::{GuiState, Settings}; -use czkawka_core::common::get_available_threads; -use czkawka_core::common_items::{DEFAULT_EXCLUDED_DIRECTORIES, DEFAULT_EXCLUDED_ITEMS}; use directories_next::ProjectDirs; use home::home_dir; use log::{debug, error, info}; use serde::{Deserialize, Serialize}; use slint::{ComponentHandle, Model, ModelRc}; -pub const DEFAULT_MINIMUM_SIZE: i32 = 16 * 1024; -pub const DEFAULT_MAXIMUM_SIZE: i32 = i32::MAX; +use czkawka_core::common::get_available_threads; +use czkawka_core::common_items::{DEFAULT_EXCLUDED_DIRECTORIES, DEFAULT_EXCLUDED_ITEMS}; + +use crate::common::{create_string_standard_list_view_from_pathbuf, create_vec_model_from_vec_string}; +use crate::{Callabler, MainWindow}; +use crate::{GuiState, Settings}; + +pub const DEFAULT_MINIMUM_SIZE_KB: i32 = 16; +pub const DEFAULT_MAXIMUM_SIZE_KB: i32 = i32::MAX / 1024; +pub const DEFAULT_MINIMUM_CACHE_SIZE: i32 = 256; +pub const DEFAULT_MINIMUM_PREHASH_CACHE_SIZE: i32 = 256; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SettingsCustom { @@ -42,6 +46,26 @@ pub struct SettingsCustom { pub ignore_other_file_systems: bool, #[serde(default)] pub thread_number: i32, + #[serde(default = "ttrue")] + pub duplicate_image_preview: bool, + #[serde(default = "ttrue")] + pub duplicate_hide_hard_links: bool, + #[serde(default = "ttrue")] + pub duplicate_use_prehash: bool, + #[serde(default = "minimal_hash_cache_size")] + pub duplicate_minimal_hash_cache_size: i32, + #[serde(default = "minimal_prehash_cache_size")] + pub duplicate_minimal_prehash_cache_size: i32, + #[serde(default = "ttrue")] + pub duplicate_delete_outdated_entries: bool, + #[serde(default = "ttrue")] + pub similar_images_show_image_preview: bool, + #[serde(default = "ttrue")] + pub similar_images_delete_outdated_entries: bool, + #[serde(default = "ttrue")] + pub similar_videos_delete_outdated_entries: bool, + #[serde(default = "ttrue")] + pub similar_music_delete_outdated_entries: bool, } impl Default for SettingsCustom { @@ -320,8 +344,8 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let excluded_items = settings.get_excluded_items().to_string(); let allowed_extensions = settings.get_allowed_extensions().to_string(); - let minimum_file_size = settings.get_minimum_file_size().parse::().unwrap_or(DEFAULT_MINIMUM_SIZE); - let maximum_file_size = settings.get_maximum_file_size().parse::().unwrap_or(DEFAULT_MAXIMUM_SIZE); + let minimum_file_size = settings.get_minimum_file_size().parse::().unwrap_or(DEFAULT_MINIMUM_SIZE_KB); + let maximum_file_size = settings.get_maximum_file_size().parse::().unwrap_or(DEFAULT_MAXIMUM_SIZE_KB); let recursive_search = settings.get_recursive_search(); let use_cache = settings.get_use_cache(); @@ -329,6 +353,24 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let move_deleted_files_to_trash = settings.get_move_to_trash(); let ignore_other_file_systems = settings.get_ignore_other_filesystems(); let thread_number = settings.get_thread_number().round() as i32; + + let duplicate_image_preview = settings.get_duplicate_image_preview(); + let duplicate_hide_hard_links = settings.get_duplicate_hide_hard_links(); + let duplicate_use_prehash = settings.get_duplicate_use_prehash(); + let duplicate_minimal_hash_cache_size = settings.get_duplicate_minimal_hash_cache_size().parse::().unwrap_or(DEFAULT_MINIMUM_CACHE_SIZE); + let duplicate_minimal_prehash_cache_size = settings + .get_duplicate_minimal_prehash_cache_size() + .parse::() + .unwrap_or(DEFAULT_MINIMUM_PREHASH_CACHE_SIZE); + let duplicate_delete_outdated_entries = settings.get_duplicate_delete_outdated_entries(); + + let similar_images_show_image_preview = settings.get_similar_images_show_image_preview(); + let similar_images_delete_outdated_entries = settings.get_similar_images_delete_outdated_entries(); + + let similar_videos_delete_outdated_entries = settings.get_similar_videos_delete_outdated_entries(); + + let similar_music_delete_outdated_entries = settings.get_similar_music_delete_outdated_entries(); + SettingsCustom { included_directories, excluded_directories, @@ -342,6 +384,16 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { move_deleted_files_to_trash, ignore_other_file_systems, thread_number, + duplicate_image_preview, + duplicate_hide_hard_links, + duplicate_use_prehash, + duplicate_minimal_hash_cache_size, + duplicate_minimal_prehash_cache_size, + duplicate_delete_outdated_entries, + similar_images_show_image_preview, + similar_images_delete_outdated_entries, + similar_videos_delete_outdated_entries, + similar_music_delete_outdated_entries, } } @@ -390,29 +442,21 @@ fn default_language() -> String { } fn default_preset_names() -> Vec { - [ - "Preset 1", - "Preset 2", - "Preset 3", - "Preset 4", - "Preset 5", - "Preset 6", - "Preset 7", - "Preset 8", - "Preset 9", - "Preset 10", - ] - .iter() - .map(|x| (*x).to_string()) - .collect::>() + (0..10).map(|x| format!("Preset {}", x + 1)).collect::>() } fn minimum_file_size() -> i32 { - DEFAULT_MINIMUM_SIZE + DEFAULT_MINIMUM_SIZE_KB } fn maximum_file_size() -> i32 { - DEFAULT_MAXIMUM_SIZE + DEFAULT_MAXIMUM_SIZE_KB } fn ttrue() -> bool { true } +fn minimal_hash_cache_size() -> i32 { + DEFAULT_MINIMUM_CACHE_SIZE +} +fn minimal_prehash_cache_size() -> i32 { + DEFAULT_MINIMUM_PREHASH_CACHE_SIZE +} diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 614ee503e..9e47e02c1 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -23,6 +23,7 @@ export component ActionButtons inherits HorizontalLayout { in-out property stop_requested: false; in-out property scanning; in-out property lists_enabled: active-tab != CurrentTab.Settings; + // in-out property <> in-out property active-tab; out property name; height: 30px; @@ -65,6 +66,28 @@ export component ActionButtons inherits HorizontalLayout { } } + popup_item := PopupWindow { + height: root.height; + width: root.width; + close-on-click: true; + VerticalLayout { + for i[idx] in ["A","B","C"]: Rectangle { + background: red; + } + } + } + + select_button := Button { + height: parent.height; + enabled: !scanning && lists_enabled; + text: "Select"; + clicked => { + debug("Selected"); + popup_item.show(); + // Callabler.select_items(); + } + } + Rectangle { horizontal-stretch: 0.5; } diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint index 04ea7a775..767bf66bc 100644 --- a/krokiet/ui/callabler.slint +++ b/krokiet/ui/callabler.slint @@ -7,6 +7,7 @@ export global Callabler { callback item_opened(string); callback delete_selected_items(); + // callback (); // Preview callback load_image_preview(string); @@ -19,4 +20,7 @@ export global Callabler { // Translations pure callback translate(string, [{key: string, value: string}]) -> string; + + // Only Slint + callback open_select_popup(); } diff --git a/krokiet/ui/gui_state.slint b/krokiet/ui/gui_state.slint index f94167193..890ec1ee1 100644 --- a/krokiet/ui/gui_state.slint +++ b/krokiet/ui/gui_state.slint @@ -1,7 +1,13 @@ +// State to show export global GuiState { + in-out property app_width; + in-out property app_height; + in-out property info_text: "Nothing to report"; in-out property preview_visible; in-out property preview_image; in-out property maximum_threads: 40; + + in-out property choosing_include_directories; } diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index e9b3dad7a..c89c85094 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -12,6 +12,8 @@ import { BottomPanel } from "bottom_panel.slint"; import {ColorPalette} from "color_palette.slint"; import {GuiState} from "gui_state.slint"; import { Preview } from "preview.slint"; +import {PopupNewDirectories} from "popup_new_directories.slint"; +import { PopupSelect } from "popup_select.slint"; export {Settings, Callabler, GuiState} @@ -46,6 +48,7 @@ export component MainWindow inherits Window { {checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]} ]; in-out property <[MainListModel]> similar_images_model: []; + VerticalBox { HorizontalBox { vertical-stretch: 1.0; @@ -112,71 +115,28 @@ export component MainWindow inherits Window { } bottom_panel := BottomPanel { - property included-directories; - // TODO why cannot set popup_item property? Strange limitation - - bottom-panel-visibility <=> action_buttons.bottom-panel-visibility; + bottom-panel-visibility <=> action_buttons.bottom_panel_visibility; vertical-stretch: 0.0; - folder_choose_requested(included-directories) => { - root.folder_choose_requested(included-directories) + folder_choose_requested(included_directories) => { + root.folder_choose_requested(included_directories) } - show_manual_add_dialog(included-directories) => { - self.included-directories = included-directories; - popup-item.show() + show_manual_add_dialog(included_directories) => { + GuiState.choosing_include_directories = included_directories; + new_directory_popup_window.show_popup() } } } - popup_item := PopupWindow { + new_directory_popup_window := PopupNewDirectories { height: root.height; width: root.width; - property included_directories; - private property text_data; - close-on-click: false; - HorizontalLayout { - alignment: LayoutAlignment.center; - VerticalLayout { - alignment: LayoutAlignment.center; - Rectangle { - clip: true; - width: popup_item.width - 20px; - height: popup_item.height - 20px; - border-radius: 20px; - background: ColorPalette.popup_background; - VerticalLayout { - Text { - text: "Please add directories one per line"; - horizontal-alignment: TextHorizontalAlignment.center; - } - - TextEdit { - vertical-stretch: 1.0; - text <=> text-data; - } + } - HorizontalLayout { - min-height: 20px; - Button { - enabled: text-data != ""; - text: "OK"; - clicked => { - Callabler.added_manual_directories(bottom-panel.included-directories, text_data); - popup-item.close(); - } - } + // select_popup_window := PopupSelect { + // height: root.height; + // width: root.width; + // } - Button { - text: "Cancel"; - clicked => { - popup-item.close(); - } - } - } - } - } - } - } - } scan_ended(scan_text) => { text_summary_text = scan_text; diff --git a/krokiet/ui/popup_new_directories.slint b/krokiet/ui/popup_new_directories.slint new file mode 100644 index 000000000..6a6c6d819 --- /dev/null +++ b/krokiet/ui/popup_new_directories.slint @@ -0,0 +1,76 @@ +import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint"; +import {SelectableTableView} from "selectable_tree_view.slint"; +import {LeftSidePanel} from "left_side_panel.slint"; +import {MainList} from "main_lists.slint"; +import {CurrentTab, ProgressToSend} from "common.slint"; +import { ActionButtons } from "action_buttons.slint"; +import { Progress } from "progress.slint"; +import {MainListModel} from "common.slint"; +import {Settings} from "settings.slint"; +import {Callabler} from "callabler.slint"; +import { BottomPanel } from "bottom_panel.slint"; +import {ColorPalette} from "color_palette.slint"; +import {GuiState} from "gui_state.slint"; +import { Preview } from "preview.slint"; + +export component PopupNewDirectories inherits Rectangle { + callback show_popup(); + + popup_window := PopupWindow { + width: root.width; + height: root.height; + + property included_directories; + private property text_data; + close-on-click: false; + HorizontalLayout { + alignment: LayoutAlignment.center; + VerticalLayout { + alignment: LayoutAlignment.center; + Rectangle { + clip: true; + width: root.width - 20px; + height: root.height - 20px; + border-radius: 20px; + background: ColorPalette.popup_background; + VerticalLayout { + Text { + text: "Please add directories one per line"; + horizontal-alignment: TextHorizontalAlignment.center; + } + + TextEdit { + vertical-stretch: 1.0; + text <=> text-data; + } + + HorizontalLayout { + min-height: 20px; + Button { + enabled: text-data != ""; + text: "OK"; + clicked => { + Callabler.added_manual_directories(GuiState.choosing_include_directories, text_data); + debug("OK"); + popup_window.close(); + } + } + + Button { + text: "Cancel"; + clicked => { + debug("Cancel"); + popup_window.close(); + } + } + } + } + } + } + } + } + + show_popup() => { + popup_window.show(); + } +} \ No newline at end of file diff --git a/krokiet/ui/popup_select.slint b/krokiet/ui/popup_select.slint new file mode 100644 index 000000000..394e9d4b8 --- /dev/null +++ b/krokiet/ui/popup_select.slint @@ -0,0 +1,74 @@ +import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint"; +import {SelectableTableView} from "selectable_tree_view.slint"; +import {LeftSidePanel} from "left_side_panel.slint"; +import {MainList} from "main_lists.slint"; +import {CurrentTab, ProgressToSend} from "common.slint"; +import { ActionButtons } from "action_buttons.slint"; +import { Progress } from "progress.slint"; +import {MainListModel} from "common.slint"; +import {Settings} from "settings.slint"; +import {Callabler} from "callabler.slint"; +import { BottomPanel } from "bottom_panel.slint"; +import {ColorPalette} from "color_palette.slint"; +import {GuiState} from "gui_state.slint"; +import { Preview } from "preview.slint"; + +export component PopupSelect inherits Rectangle { + callback show_popup(); + + popup_window := PopupWindow { + width: root.width; + height: root.height; + + property included_directories; + private property text_data; + close-on-click: false; + HorizontalLayout { + alignment: LayoutAlignment.center; + VerticalLayout { + alignment: LayoutAlignment.center; + Rectangle { + clip: true; + width: root.width - 20px; + height: root.height - 20px; + border-radius: 20px; + background: ColorPalette.popup_background; + VerticalLayout { + Text { + text: "Please add directories one per line"; + horizontal-alignment: TextHorizontalAlignment.center; + } + + TextEdit { + vertical-stretch: 1.0; + text <=> text-data; + } + + HorizontalLayout { + min-height: 20px; + Button { + enabled: text-data != ""; + text: "OK"; + clicked => { + Callabler.added_manual_directories(GuiState.choosing_include_directories, text_data); + popup_window.close(); + } + } + + Button { + text: "Cancel"; + clicked => { + popup_window.close(); + } + } + } + } + } + } + } + } + + show_popup() => { + popup_window.show(); + } +} \ No newline at end of file From 363d49679baf24a1f0f89c1595d1025d7bf597de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Thu, 30 Nov 2023 22:38:29 +0100 Subject: [PATCH 095/107] Trying more --- .github/workflows/linux_cli_eyra.yml | 3 +- Cargo.lock | 124 ++++++++++++------------- krokiet/Cargo.toml | 8 +- krokiet/src/settings.rs | 12 +++ krokiet/ui/gui_state.slint | 1 + krokiet/ui/left_side_panel.slint | 39 +++++--- krokiet/ui/main_window.slint | 28 ++++-- krokiet/ui/popup_new_directories.slint | 14 ++- krokiet/ui/settings_list.slint | 8 +- 9 files changed, 141 insertions(+), 96 deletions(-) diff --git a/.github/workflows/linux_cli_eyra.yml b/.github/workflows/linux_cli_eyra.yml index e398738a1..637020509 100644 --- a/.github/workflows/linux_cli_eyra.yml +++ b/.github/workflows/linux_cli_eyra.yml @@ -21,8 +21,9 @@ jobs: - name: Install basic libraries run: sudo apt update || true; sudo apt install -y ffmpeg + # New versions of nightly rust may call new unimplemented in eyra functions, so use const version - name: Setup rust version - run: rustup default nightly-2023-11-16 + run: rustup default nightly-2023-11-29 - name: Add eyra run: | diff --git a/Cargo.lock b/Cargo.lock index 4f42650f7..5db8cf9c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,6 +63,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-activity" version = "0.5.0" @@ -982,8 +988,7 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6304465f16f463cddc572b737c3df93576edd3a6b53f057bd8beeb29f4ef8dfd" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "const-field-offset-macro", "field-offset", @@ -992,8 +997,7 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57aaaad9185d3bcb3afe63549d8ba60b2fb0ea8dc2da83f62dd56805edf56fd1" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "proc-macro2", "quote", @@ -1040,9 +1044,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -1050,9 +1054,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core-graphics" @@ -1925,12 +1929,12 @@ dependencies = [ [[package]] name = "fontdue" -version = "0.7.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0793f5137567643cf65ea42043a538804ff0fbf288649e2141442b602d81f9bc" +checksum = "9099a2f86b8e674b75d03ff154b3fe4c5208ed249ced8d69cc313a9fa40bb488" dependencies = [ - "hashbrown 0.13.2", - "ttf-parser 0.15.2", + "hashbrown 0.14.3", + "ttf-parser 0.20.0", ] [[package]] @@ -2348,11 +2352,12 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globalcache" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469dba5c15b33d67400508ff1f640e8906fa6c8d5ee80540203eb9029ce475df" +checksum = "82f58e0fc23e475cc9a0a4cc3ab9c2ef335c205de4f90ccc2e4e521a924ef746" dependencies = [ "async-trait", + "tuple", ] [[package]] @@ -2600,19 +2605,14 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", + "allocator-api2", ] -[[package]] -name = "hashbrown" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" - [[package]] name = "heck" version = "0.4.1" @@ -2661,8 +2661,7 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1d48fd53065a53f0a0d889afbeabc5bf93f221ad3e30381e233cfae4006daa" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "calloop", "drm 0.9.0", @@ -2683,8 +2682,7 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "840585129a6c33578da729cb58101e52d6cf75171eda7fb0165d23644c0b1389" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2697,8 +2695,7 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9740bdfde0e273caab6350946f13158d67aaf0b6959d946669fbd18d7911b6f" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "bytemuck", "cfg-if", @@ -2733,8 +2730,7 @@ dependencies = [ [[package]] name = "i-slint-common" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fce76fae27a1fd3e8b7169bafe3b6f1cd92a4ad391b8e5020043c0576b4184" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "cfg-if", "derive_more", @@ -2745,8 +2741,7 @@ dependencies = [ [[package]] name = "i-slint-compiler" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d323113803c5ea180d511f544f311cf9d9042c199d65d3dc04066c6512345b9b" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "by_address", "codemap", @@ -2775,8 +2770,7 @@ dependencies = [ [[package]] name = "i-slint-core" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6a3baff84623830ffbaa14bd2da6735e0a521e2f8295bf5fedfbbe4b67044a" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "auto_enums", "bytemuck", @@ -2819,8 +2813,7 @@ dependencies = [ [[package]] name = "i-slint-core-macros" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8724b37ae221878cdc4428a22299f4543bc6cf393ea4c3c27fa56532f24e214" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "quote", "syn 2.0.39", @@ -2829,8 +2822,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cc37619fced5635cb257ae397f1b617e634eadc43d5e889cc061395319383b" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "cfg-if", "const-field-offset", @@ -2862,8 +2854,7 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67d279b3d6d7271934103bf03eecbd86a4cc3773d9ccc5e25163fc4fe59b7d7d" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "ash", "bytemuck", @@ -3501,9 +3492,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "locale_config" @@ -4627,9 +4618,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.5" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" dependencies = [ "cc", "getrandom", @@ -4792,7 +4783,7 @@ dependencies = [ "bitflags 2.4.1", "errno", "libc", - "linux-raw-sys 0.4.11", + "linux-raw-sys 0.4.12", "windows-sys 0.48.0", ] @@ -5122,8 +5113,7 @@ dependencies = [ [[package]] name = "slint" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1376acd8d87420776a8b7379f7a86887f91027eba81ae0c89a41e9199e4320c" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5139,8 +5129,7 @@ dependencies = [ [[package]] name = "slint-build" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ff1cc8914b4ee969702a19a5254565d82ce56b7520fa8cd2b494ca31a6983b" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "i-slint-compiler", "spin_on", @@ -5151,8 +5140,7 @@ dependencies = [ [[package]] name = "slint-macros" version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82260f35cceae7d0339177f2d2c30693b94b9436508046723493098e1c085b7" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -5947,12 +5935,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622b09ce2fe2df4618636fb92176d205662f59803f39e70d1c333393082de96c" -[[package]] -name = "ttf-parser" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" - [[package]] name = "ttf-parser" version = "0.19.2" @@ -5965,6 +5947,16 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" +[[package]] +name = "tuple" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39a40ba241047e1174c927dc5f61c141a166b938d61a2ff61838441368cc7d0e" +dependencies = [ + "num-traits", + "serde", +] + [[package]] name = "type-map" version = "0.4.0" @@ -6267,8 +6259,7 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f4c7506238561777a1861d3dc3c0001877c475187e7bc4392ea87ebf631fd9c" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "const-field-offset", "portable-atomic", @@ -6279,8 +6270,7 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b2b8eecdb8e4284adf5546fc518f048f6dc33e7203dbe36fa93a4add39b31f6" +source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" dependencies = [ "proc-macro2", "quote", @@ -6515,9 +6505,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -7093,18 +7083,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.26" +version = "0.7.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97e415490559a91254a2979b4829267a57d2fcd741a98eee8b722fb57289aa0" +checksum = "f43de342578a3a14a9314a2dab1942cbfcbe5686e1f91acdc513058063eafe18" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.26" +version = "0.7.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd7e48ccf166952882ca8bd778a43502c64f33bf94c12ebe2a7f08e5a0f6689f" +checksum = "e1012d89e3acb79fad7a799ce96866cfb8098b74638465ea1b1533d35900ca90" dependencies = [ "proc-macro2", "quote", diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index f704246cb..2f961205a 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -13,8 +13,8 @@ build = "build.rs" [dependencies] # Try to use only needed features from https://github.com/slint-ui/slint/blob/master/api/rs/slint/Cargo.toml#L23-L31 #slint = { path = "/home/rafal/test/slint/api/rs/slint/", default-features = false, features = ["std", -#slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = [ -slint = { version = "1.3", default-features = false, features = [ +slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = [ +#slint = { version = "1.3", default-features = false, features = [ "std", "backend-winit", "compat-1-2" @@ -42,8 +42,8 @@ rust-embed = { version = "8.0", features = ["debug-embed"] } once_cell = "1.18" [build-dependencies] -slint-build = "1.3" -#slint-build = { git = "https://github.com/slint-ui/slint.git" } +#slint-build = "1.3" +slint-build = { git = "https://github.com/slint-ui/slint.git" } #slint-build = { path = "/home/rafal/test/slint/api/rs/build/"} [features] diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 00b577d82..e239ab388 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -329,6 +329,18 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { settings.set_ignore_other_filesystems(custom_settings.ignore_other_file_systems); settings.set_thread_number(custom_settings.thread_number as f32); + settings.set_recursive_search(custom_settings.recursive_search); + settings.set_duplicate_image_preview(custom_settings.duplicate_image_preview); + settings.set_duplicate_hide_hard_links(custom_settings.duplicate_hide_hard_links); + settings.set_duplicate_use_prehash(custom_settings.duplicate_use_prehash); + settings.set_duplicate_minimal_hash_cache_size(custom_settings.duplicate_minimal_hash_cache_size.to_string().into()); + settings.set_duplicate_minimal_prehash_cache_size(custom_settings.duplicate_minimal_prehash_cache_size.to_string().into()); + settings.set_duplicate_delete_outdated_entries(custom_settings.duplicate_delete_outdated_entries); + settings.set_similar_images_show_image_preview(custom_settings.similar_images_show_image_preview); + settings.set_similar_images_delete_outdated_entries(custom_settings.similar_images_delete_outdated_entries); + settings.set_similar_videos_delete_outdated_entries(custom_settings.similar_videos_delete_outdated_entries); + settings.set_similar_music_delete_outdated_entries(custom_settings.similar_music_delete_outdated_entries); + // Clear text app.global::().set_info_text("".into()); } diff --git a/krokiet/ui/gui_state.slint b/krokiet/ui/gui_state.slint index 890ec1ee1..0735369b6 100644 --- a/krokiet/ui/gui_state.slint +++ b/krokiet/ui/gui_state.slint @@ -10,4 +10,5 @@ export global GuiState { in-out property maximum_threads: 40; in-out property choosing_include_directories; + in-out property visible_tool_settings; } diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index 2d69c2ce5..ea620e327 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -109,17 +109,34 @@ export component LeftSidePanel { } } - HorizontalLayout { - alignment: end; - Button { - min-width: 20px; - min-height: 20px; - max-height: self.width; - preferred-height: self.width; - icon: @image-url("../icons/settings.svg"); - clicked => { - active_tab = CurrentTab.Settings; - root.changed_current_tab(); + Rectangle { + HorizontalLayout { + alignment: start; + Button { + enabled: active-tab != CurrentTab.Settings; + min-width: 20px; + min-height: 20px; + max-height: self.width; + preferred-height: self.width; + icon: @image-url("../icons/settings.svg"); + clicked => { + debug("Changed showing settings"); + GuiState.visible_tool_settings != !GuiState.visible-tool-settings; + } + } + } + HorizontalLayout { + alignment: end; + Button { + min-width: 20px; + min-height: 20px; + max-height: self.width; + preferred-height: self.width; + icon: @image-url("../icons/settings.svg"); + clicked => { + active_tab = CurrentTab.Settings; + root.changed_current_tab(); + } } } } diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index c89c85094..b5e498f8f 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -14,6 +14,7 @@ import {GuiState} from "gui_state.slint"; import { Preview } from "preview.slint"; import {PopupNewDirectories} from "popup_new_directories.slint"; import { PopupSelect } from "popup_select.slint"; +import { ToolSettings } from "tool_settings.slint"; export {Settings, Callabler, GuiState} @@ -22,10 +23,12 @@ export component MainWindow inherits Window { callback scan_starting(CurrentTab); callback folder_choose_requested(bool); callback scan_ended(string); + min-width: 300px; preferred-width: 800px; min-height: 300px; preferred-height: 600px; + in-out property text_summary_text: ""; in-out property stop_requested: false; in-out property scanning: false; @@ -34,7 +37,7 @@ export component MainWindow inherits Window { all_progress: 20, step_name: "Cache", }; - in-out property active-tab: CurrentTab.EmptyFolders; + in-out property active_tab: CurrentTab.EmptyFolders; in-out property <[MainListModel]> empty_folder_model: [ {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , @@ -65,11 +68,12 @@ export component MainWindow inherits Window { VerticalLayout { horizontal-stretch: 1.0; + min_width: 300px; Rectangle { vertical-stretch: 1.0; main_list := MainList { x: 0; - width: GuiState.preview_visible ? parent.width / 2 : parent.width; + width: preview_or_tool_settings.visible ? parent.width / 2 : parent.width; height: parent.height; horizontal-stretch: 0.5; active-tab <=> root.active-tab; @@ -77,13 +81,23 @@ export component MainWindow inherits Window { empty_files_model <=> root.empty_files_model; similar_images_model <=> root.similar_images_model; } - Preview { + preview_or_tool_settings := Rectangle { + visible: (GuiState.preview_visible || GuiState.visible_tool_settings) && active_tab != CurrentTab.Settings; height: parent.height; x: parent.width / 2; - width: GuiState.preview_visible ? parent.width / 2 : 0; - visible: GuiState.preview_visible; - source: GuiState.preview_image; - image-fit: ImageFit.contain; + width: self.visible ? parent.width / 2 : 0; + Preview { + height: parent.height; + width: parent.width; + visible: GuiState.preview_visible && !GuiState.visible_tool_settings; + source: GuiState.preview_image; + image-fit: ImageFit.contain; + } + ToolSettings { + height: parent.height; + width: parent.width; + visible: GuiState.visible_tool_settings; + } } } diff --git a/krokiet/ui/popup_new_directories.slint b/krokiet/ui/popup_new_directories.slint index 6a6c6d819..a920dbf80 100644 --- a/krokiet/ui/popup_new_directories.slint +++ b/krokiet/ui/popup_new_directories.slint @@ -9,11 +9,14 @@ import {MainListModel} from "common.slint"; import {Settings} from "settings.slint"; import {Callabler} from "callabler.slint"; import { BottomPanel } from "bottom_panel.slint"; -import {ColorPalette} from "color_palette.slint"; -import {GuiState} from "gui_state.slint"; +import { ColorPalette } from "color_palette.slint"; +import { GuiState } from "gui_state.slint"; import { Preview } from "preview.slint"; export component PopupNewDirectories inherits Rectangle { + width: 400px; + height: 400px; + callback show_popup(); popup_window := PopupWindow { @@ -70,6 +73,13 @@ export component PopupNewDirectories inherits Rectangle { } } + // Button { + // text:"KKK"; + // clicked => { + // show-popup(); + // } + // } + show_popup() => { popup_window.show(); } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 837199c9a..4a04fc670 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -207,7 +207,7 @@ export component SettingsList inherits VerticalLayout { maximum_number <=> GuiState.maximum_threads; } Text { - text: "Duplicate settings"; + text: "Duplicate tool"; height: SettingsSize.item_height; horizontal-alignment: TextHorizontalAlignment.center; vertical-alignment: TextVerticalAlignment.center; @@ -237,7 +237,7 @@ export component SettingsList inherits VerticalLayout { model <=> Settings.duplicate_delete_outdated_entries; } Text { - text: "Similar Images settings"; + text: "Similar Images tool"; height: SettingsSize.item_height; horizontal-alignment: TextHorizontalAlignment.center; vertical-alignment: TextVerticalAlignment.center; @@ -251,7 +251,7 @@ export component SettingsList inherits VerticalLayout { model <=> Settings.similar_images_delete_outdated_entries; } Text { - text: "Similar Videos settings"; + text: "Similar Videos tool"; height: SettingsSize.item_height; horizontal-alignment: TextHorizontalAlignment.center; vertical-alignment: TextVerticalAlignment.center; @@ -261,7 +261,7 @@ export component SettingsList inherits VerticalLayout { model <=> Settings.similar_videos_delete_outdated_entries; } Text { - text: "Similar Music settings"; + text: "Similar Music tool"; height: SettingsSize.item_height; horizontal-alignment: TextHorizontalAlignment.center; vertical-alignment: TextVerticalAlignment.center; From d9841939424ff7efe011c170a810ef5b9e74ed55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 1 Dec 2023 20:39:27 +0100 Subject: [PATCH 096/107] Slint 1.3.2 and changes --- Cargo.lock | 120 +++++++++++++++----------- czkawka_core/src/common.rs | 32 ++----- krokiet/Cargo.toml | 8 +- krokiet/src/connect_scan.rs | 9 +- krokiet/src/main.rs | 3 +- krokiet/src/settings.rs | 3 +- krokiet/ui/left_side_panel.slint | 3 +- krokiet/ui/main_window.slint | 2 +- krokiet/ui/selectable_tree_view.slint | 2 +- krokiet/ui/settings_list.slint | 38 ++++---- 10 files changed, 106 insertions(+), 114 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5db8cf9c6..545d69f4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -324,7 +324,7 @@ dependencies = [ "futures-lite 2.0.1", "parking", "polling 3.3.1", - "rustix 0.38.25", + "rustix 0.38.26", "slab", "tracing", "windows-sys 0.52.0", @@ -363,7 +363,7 @@ dependencies = [ "cfg-if", "event-listener 3.1.0", "futures-lite 1.13.0", - "rustix 0.38.25", + "rustix 0.38.26", "windows-sys 0.48.0", ] @@ -390,7 +390,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 0.38.25", + "rustix 0.38.26", "signal-hook-registry", "slab", "windows-sys 0.48.0", @@ -724,7 +724,7 @@ dependencies = [ "bitflags 2.4.1", "log", "polling 3.3.1", - "rustix 0.38.25", + "rustix 0.38.26", "slab", "thiserror", ] @@ -736,7 +736,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" dependencies = [ "calloop", - "rustix 0.38.25", + "rustix 0.38.26", "wayland-backend", "wayland-client", ] @@ -988,7 +988,8 @@ dependencies = [ [[package]] name = "const-field-offset" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6304465f16f463cddc572b737c3df93576edd3a6b53f057bd8beeb29f4ef8dfd" dependencies = [ "const-field-offset-macro", "field-offset", @@ -997,7 +998,8 @@ dependencies = [ [[package]] name = "const-field-offset-macro" version = "0.1.3" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57aaaad9185d3bcb3afe63549d8ba60b2fb0ea8dc2da83f62dd56805edf56fd1" dependencies = [ "proc-macro2", "quote", @@ -1073,9 +1075,9 @@ dependencies = [ [[package]] name = "core-graphics-types" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -2352,9 +2354,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globalcache" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82f58e0fc23e475cc9a0a4cc3ab9c2ef335c205de4f90ccc2e4e521a924ef746" +checksum = "ccd40efe5b4f0021ca3c36a140cb365563be3c579653b573a5a8ac69bd6f9028" dependencies = [ "async-trait", "tuple", @@ -2660,8 +2662,9 @@ dependencies = [ [[package]] name = "i-slint-backend-linuxkms" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d0c47573bf4fb9ffbab394464e51b564465e83e5860d4269e78f6c08cd4be9" dependencies = [ "calloop", "drm 0.9.0", @@ -2681,8 +2684,9 @@ dependencies = [ [[package]] name = "i-slint-backend-selector" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "074d3ca24790f1be67e969c86356483cf9bef58ca77ef5d0a8051d25ddddc601" dependencies = [ "cfg-if", "i-slint-backend-linuxkms", @@ -2694,8 +2698,9 @@ dependencies = [ [[package]] name = "i-slint-backend-winit" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "565ece613df99476e516a8a3c853269795fc06b553f66ed0a8f7159d4cb5c975" dependencies = [ "bytemuck", "cfg-if", @@ -2729,8 +2734,9 @@ dependencies = [ [[package]] name = "i-slint-common" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6666bf1b9c3140d426071dda1af839ce46c0f482f3513eecf700609f0cd43865" dependencies = [ "cfg-if", "derive_more", @@ -2740,8 +2746,9 @@ dependencies = [ [[package]] name = "i-slint-compiler" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27248681505254959a803253f3c8539b66412c14654d2dc905be869a7ff20159" dependencies = [ "by_address", "codemap", @@ -2769,8 +2776,9 @@ dependencies = [ [[package]] name = "i-slint-core" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "462a3ca4e929f66d39a00436257baa5a4fb3e287c16675f2219757b67b2dad94" dependencies = [ "auto_enums", "bytemuck", @@ -2812,8 +2820,9 @@ dependencies = [ [[package]] name = "i-slint-core-macros" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9148dba9642f055cdda5060f2e82be4a4c1c4a046ea1d08970e9279220b7ed13" dependencies = [ "quote", "syn 2.0.39", @@ -2821,8 +2830,9 @@ dependencies = [ [[package]] name = "i-slint-renderer-femtovg" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58e3d130c56f63fa13ec909ba868af84f2e763ff177f5c00857a91e61e65bb55" dependencies = [ "cfg-if", "const-field-offset", @@ -2853,8 +2863,9 @@ dependencies = [ [[package]] name = "i-slint-renderer-skia" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb23ce40a535a99e735a5b5be696a9aaf0b67a84287c0857f01dd29b2d62fb2" dependencies = [ "ash", "bytemuck", @@ -4273,7 +4284,7 @@ dependencies = [ "cfg-if", "concurrent-queue", "pin-project-lite", - "rustix 0.38.25", + "rustix 0.38.26", "tracing", "windows-sys 0.52.0", ] @@ -4776,15 +4787,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.25" +version = "0.38.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" dependencies = [ "bitflags 2.4.1", "errno", "libc", "linux-raw-sys 0.4.12", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -5112,8 +5123,9 @@ dependencies = [ [[package]] name = "slint" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39bf2b4e9a979d7a191d5e71728c1d15f8af8049f44208cb337126c17474f166" dependencies = [ "const-field-offset", "i-slint-backend-selector", @@ -5128,8 +5140,9 @@ dependencies = [ [[package]] name = "slint-build" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc96ba4cee939fb4015c213309fcdfe83178730766dbb5fb643d5938030d63e7" dependencies = [ "i-slint-compiler", "spin_on", @@ -5139,8 +5152,9 @@ dependencies = [ [[package]] name = "slint-macros" -version = "1.3.1" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f6e88032ed51af2445d1b317af16778348566ddc5b397fc4e5bb1bb6b358976" dependencies = [ "i-slint-compiler", "proc-macro2", @@ -5150,9 +5164,9 @@ dependencies = [ [[package]] name = "slotmap" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" dependencies = [ "version_check", ] @@ -5176,7 +5190,7 @@ dependencies = [ "libc", "log", "memmap2 0.9.0", - "rustix 0.38.25", + "rustix 0.38.26", "thiserror", "wayland-backend", "wayland-client", @@ -5260,7 +5274,7 @@ dependencies = [ "objc", "raw-window-handle 0.5.2", "redox_syscall 0.4.1", - "rustix 0.38.25", + "rustix 0.38.26", "tiny-xlib", "wasm-bindgen", "wayland-backend", @@ -5624,7 +5638,7 @@ dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall 0.4.1", - "rustix 0.38.25", + "rustix 0.38.26", "windows-sys 0.48.0", ] @@ -6259,7 +6273,8 @@ dependencies = [ [[package]] name = "vtable" version = "0.1.11" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f4c7506238561777a1861d3dc3c0001877c475187e7bc4392ea87ebf631fd9c" dependencies = [ "const-field-offset", "portable-atomic", @@ -6270,7 +6285,8 @@ dependencies = [ [[package]] name = "vtable-macro" version = "0.1.10" -source = "git+https://github.com/slint-ui/slint.git#a9976171f9ac42a62a4c6a25f79fa9c1137c49b4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b2b8eecdb8e4284adf5546fc518f048f6dc33e7203dbe36fa93a4add39b31f6" dependencies = [ "proc-macro2", "quote", @@ -6544,7 +6560,7 @@ dependencies = [ "either", "home", "once_cell", - "rustix 0.38.25", + "rustix 0.38.26", ] [[package]] @@ -6841,7 +6857,7 @@ dependencies = [ "percent-encoding", "raw-window-handle 0.5.2", "redox_syscall 0.3.5", - "rustix 0.38.25", + "rustix 0.38.26", "sctk-adwaita", "smithay-client-toolkit", "smol_str", @@ -7083,18 +7099,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.27" +version = "0.7.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43de342578a3a14a9314a2dab1942cbfcbe5686e1f91acdc513058063eafe18" +checksum = "7d6f15f7ade05d2a4935e34a457b936c23dc70a05cc1d97133dc99e7a3fe0f0e" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.27" +version = "0.7.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1012d89e3acb79fad7a799ce96866cfb8098b74638465ea1b1533d35900ca90" +checksum = "dbbad221e3f78500350ecbd7dfa4e63ef945c05f4c61cb7f4d3f84cd0bba649b" dependencies = [ "proc-macro2", "quote", diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 138f7e47b..05e78d26d 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -211,22 +211,12 @@ pub fn get_dynamic_image_from_raw_image(path: impl AsRef + std::fmt::Debug let mut start_timer = Instant::now(); let mut times = Vec::new(); - let file_handler = match OpenOptions::new().read(true).open(&path) { - Ok(t) => t, - Err(_e) => { - return None; - } - }; + let file_handler = OpenOptions::new().read(true).open(&path).ok()?; times.push(("After opening", start_timer.elapsed())); start_timer = Instant::now(); let mut reader = BufReader::new(file_handler); - let raw = match rawloader::decode(&mut reader) { - Ok(raw) => raw, - Err(_e) => { - return None; - } - }; + let raw = rawloader::decode(&mut reader).ok()?; times.push(("After decoding", start_timer.elapsed())); start_timer = Instant::now(); @@ -236,30 +226,18 @@ pub fn get_dynamic_image_from_raw_image(path: impl AsRef + std::fmt::Debug times.push(("After creating source", start_timer.elapsed())); start_timer = Instant::now(); - let mut pipeline = match Pipeline::new_from_source(source) { - Ok(pipeline) => pipeline, - Err(_e) => { - return None; - } - }; + let mut pipeline = Pipeline::new_from_source(source).ok()?; times.push(("After creating pipeline", start_timer.elapsed())); start_timer = Instant::now(); pipeline.run(None); - let image = match pipeline.output_8bit(None) { - Ok(image) => image, - Err(_e) => { - return None; - } - }; + let image = pipeline.output_8bit(None).ok()?; times.push(("After creating image", start_timer.elapsed())); start_timer = Instant::now(); - let Some(image) = ImageBuffer::, Vec>::from_raw(image.width as u32, image.height as u32, image.data) else { - return None; - }; + let image = ImageBuffer::, Vec>::from_raw(image.width as u32, image.height as u32, image.data)?; times.push(("After creating image buffer", start_timer.elapsed())); start_timer = Instant::now(); diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index 2f961205a..f704246cb 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -13,8 +13,8 @@ build = "build.rs" [dependencies] # Try to use only needed features from https://github.com/slint-ui/slint/blob/master/api/rs/slint/Cargo.toml#L23-L31 #slint = { path = "/home/rafal/test/slint/api/rs/slint/", default-features = false, features = ["std", -slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = [ -#slint = { version = "1.3", default-features = false, features = [ +#slint = { git = "https://github.com/slint-ui/slint.git", default-features = false, features = [ +slint = { version = "1.3", default-features = false, features = [ "std", "backend-winit", "compat-1-2" @@ -42,8 +42,8 @@ rust-embed = { version = "8.0", features = ["debug-embed"] } once_cell = "1.18" [build-dependencies] -#slint-build = "1.3" -slint-build = { git = "https://github.com/slint-ui/slint.git" } +slint-build = "1.3" +#slint-build = { git = "https://github.com/slint-ui/slint.git" } #slint-build = { path = "/home/rafal/test/slint/api/rs/build/"} [features] diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 5e210bc08..ff59e9848 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -69,7 +69,7 @@ fn scan_similar_images(a: Weak, progress_sender: Sender { debug("Changed showing settings"); - GuiState.visible_tool_settings != !GuiState.visible-tool-settings; + GuiState.visible_tool_settings = !GuiState.visible-tool-settings; } } } HorizontalLayout { alignment: end; Button { + enabled: active-tab != CurrentTab.Settings; min-width: 20px; min-height: 20px; max-height: self.width; diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index b5e498f8f..0d7853532 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -61,7 +61,7 @@ export component MainWindow inherits Window { scanning <=> root.scanning; active-tab <=> root.active-tab; changed_current_tab() => { - GuiState.preview-visible = false; + GuiState.preview_visible = false; main_list.changed_current_tab(); } } diff --git a/krokiet/ui/selectable_tree_view.slint b/krokiet/ui/selectable_tree_view.slint index e8ee0ac2a..6d3b4c105 100644 --- a/krokiet/ui/selectable_tree_view.slint +++ b/krokiet/ui/selectable_tree_view.slint @@ -92,7 +92,7 @@ export component SelectableTableView inherits Rectangle { if (root.selected_item != -1) { Callabler.load_image_preview(r.val[root.parentPathIdx - 1] + "/" + r.val[root.fileNameIdx - 1]); } else { - GuiState.preview-visible = false; + GuiState.preview_visible = false; } } } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 4a04fc670..f32e11f4d 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -145,6 +145,12 @@ component Language inherits HorizontalLayout { model: ["English"]; } } +component HeaderText inherits Text { + font-size: 15px; + height: SettingsSize.item_height; + horizontal-alignment: TextHorizontalAlignment.center; + vertical-alignment: TextVerticalAlignment.center; +} export component SettingsList inherits VerticalLayout { preferred-height: 300px; @@ -162,14 +168,12 @@ export component SettingsList inherits VerticalLayout { Presets{ height: SettingsSize.item_height; } - Language { - height: SettingsSize.item_height; - } - Text { + // TODO Maybe someday + // Language { + // height: SettingsSize.item_height; + // } + HeaderText { text: "General settings"; - height: SettingsSize.item_height; - horizontal-alignment: TextHorizontalAlignment.center; - vertical-alignment: TextVerticalAlignment.center; } TextComponent { name: "Excluded item:"; @@ -206,11 +210,8 @@ export component SettingsList inherits VerticalLayout { name: "Thread number"; maximum_number <=> GuiState.maximum_threads; } - Text { + HeaderText { text: "Duplicate tool"; - height: SettingsSize.item_height; - horizontal-alignment: TextHorizontalAlignment.center; - vertical-alignment: TextVerticalAlignment.center; } CheckBoxComponent { name: "Image preview"; @@ -236,11 +237,8 @@ export component SettingsList inherits VerticalLayout { name: "Delete outdated entries"; model <=> Settings.duplicate_delete_outdated_entries; } - Text { + HeaderText { text: "Similar Images tool"; - height: SettingsSize.item_height; - horizontal-alignment: TextHorizontalAlignment.center; - vertical-alignment: TextVerticalAlignment.center; } CheckBoxComponent { name: "Image preview"; @@ -250,21 +248,15 @@ export component SettingsList inherits VerticalLayout { name: "Delete outdated entries"; model <=> Settings.similar_images_delete_outdated_entries; } - Text { + HeaderText { text: "Similar Videos tool"; - height: SettingsSize.item_height; - horizontal-alignment: TextHorizontalAlignment.center; - vertical-alignment: TextVerticalAlignment.center; } CheckBoxComponent { name: "Delete outdated entries"; model <=> Settings.similar_videos_delete_outdated_entries; } - Text { + HeaderText { text: "Similar Music tool"; - height: SettingsSize.item_height; - horizontal-alignment: TextHorizontalAlignment.center; - vertical-alignment: TextVerticalAlignment.center; } CheckBoxComponent { name: "Delete outdated entries"; From 19f272d8d9c83127a28a24c689f8b793e13882e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 1 Dec 2023 20:49:51 +0100 Subject: [PATCH 097/107] Broken --- czkawka_core/src/broken_files.rs | 4 +--- czkawka_core/src/common.rs | 5 +---- czkawka_core/src/temporary.rs | 4 +--- krokiet/src/settings.rs | 8 ++------ krokiet/ui/left_side_panel.slint | 1 - krokiet/ui/settings_list.slint | 20 ++++++++++---------- 6 files changed, 15 insertions(+), 27 deletions(-) diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 6bd24b8c9..915a75d30 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -190,9 +190,7 @@ impl BrokenFiles { ) -> Option { atomic_counter.fetch_add(1, Ordering::Relaxed); - let Some(file_name_lowercase) = get_lowercase_name(entry_data, warnings) else { - return None; - }; + let file_name_lowercase = get_lowercase_name(entry_data, warnings)?; if !self.common_data.allowed_extensions.matches_filename(&file_name_lowercase) { return None; diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 05e78d26d..f6d059da6 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -176,10 +176,7 @@ pub fn open_cache_folder(cache_file_name: &str, save_to_cache: bool, use_json: b file_handler_default = Some(t); } else { if use_json { - file_handler_json = Some(match OpenOptions::new().read(true).open(&cache_file_json) { - Ok(t) => t, - Err(_) => return None, - }); + file_handler_json = Some(OpenOptions::new().read(true).open(&cache_file_json).ok()?); } else { // messages.push(format!("Cannot find or open cache file {}", cache_file.display())); // No error or warning return None; diff --git a/czkawka_core/src/temporary.rs b/czkawka_core/src/temporary.rs index 64dc78b18..51d82d643 100644 --- a/czkawka_core/src/temporary.rs +++ b/czkawka_core/src/temporary.rs @@ -152,9 +152,7 @@ impl Temporary { ) -> Option { atomic_counter.fetch_add(1, Ordering::Relaxed); - let Some(file_name_lowercase) = get_lowercase_name(entry_data, warnings) else { - return None; - }; + let file_name_lowercase = get_lowercase_name(entry_data, warnings)?; if !TEMP_EXTENSIONS.iter().any(|f| file_name_lowercase.ends_with(f)) { return None; diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 6008cbc0f..1444ca783 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -287,17 +287,13 @@ where } pub fn get_base_config_file() -> Option { - let Some(configs) = ProjectDirs::from("pl", "Qarmin", "Krokiet") else { - return None; - }; + let configs = ProjectDirs::from("pl", "Qarmin", "Krokiet")?; let config_folder = configs.config_dir(); let base_config_file = config_folder.join("config_general.json"); Some(base_config_file) } pub fn get_config_file(number: i32) -> Option { - let Some(configs) = ProjectDirs::from("pl", "Qarmin", "Krokiet") else { - return None; - }; + let configs = ProjectDirs::from("pl", "Qarmin", "Krokiet")?; let config_folder = configs.config_dir(); let config_file = config_folder.join(format!("config_preset_{number}.json")); Some(config_file) diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index fc5f89b43..4211eb5a3 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -120,7 +120,6 @@ export component LeftSidePanel { preferred-height: self.width; icon: @image-url("../icons/settings.svg"); clicked => { - debug("Changed showing settings"); GuiState.visible_tool_settings = !GuiState.visible-tool-settings; } } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index f32e11f4d..2ab09b0b8 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -135,16 +135,16 @@ component Presets inherits Rectangle { } } -component Language inherits HorizontalLayout { - spacing: 5px; - Text { - text: Callabler.translate("settings_language", []); - vertical-alignment: TextVerticalAlignment.center; - } - ComboBox { - model: ["English"]; - } -} +// component Language inherits HorizontalLayout { +// spacing: 5px; +// Text { +// text: Callabler.translate("settings_language", []); +// vertical-alignment: TextVerticalAlignment.center; +// } +// ComboBox { +// model: ["English"]; +// } +// } component HeaderText inherits Text { font-size: 15px; height: SettingsSize.item_height; From 70bb713bda9ea75754037d6ff6623f41b920fd46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 1 Dec 2023 23:43:26 +0100 Subject: [PATCH 098/107] Libraw --- .github/workflows/linux_gui.yml | 21 +++++++++----------- .github/workflows/quality.yml | 5 ++++- Cargo.lock | 20 +++++++++++++++++++ Changelog.md | 1 + czkawka_cli/Cargo.toml | 1 + czkawka_cli/README.md | 15 ++++++++------ czkawka_core/Cargo.toml | 5 ++++- czkawka_core/src/common.rs | 35 ++++++++++++++++++++++++++------- czkawka_gui/Cargo.toml | 1 + czkawka_gui/README.md | 12 +++++++---- krokiet/Cargo.toml | 1 + 11 files changed, 86 insertions(+), 31 deletions(-) diff --git a/.github/workflows/linux_gui.yml b/.github/workflows/linux_gui.yml index c10838646..aca39f590 100644 --- a/.github/workflows/linux_gui.yml +++ b/.github/workflows/linux_gui.yml @@ -18,9 +18,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install basic libraries - run: sudo apt update || true; sudo apt install libheif-dev -y - - name: Setup rust version run: rustup default ${{ matrix.toolchain }} @@ -45,19 +42,19 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt update || true; sudo apt install libheif-dev -y + run: sudo apt update || true; sudo apt install libheif-dev libraw-dev -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} - name: Build Release Krokiet heif - run: cargo build --release --bin krokiet --features heif + run: cargo build --release --bin krokiet --features "heif,libraw" if: ${{ (matrix.type == 'release') }} - - name: Store Linux GUI Krokiet heif + - name: Store Linux GUI Krokiet heif libraw uses: actions/upload-artifact@v3 with: - name: krokiet-${{ runner.os }}-${{ matrix.toolchain }}-heif + name: krokiet-${{ runner.os }}-${{ matrix.toolchain }}-heif-libraw path: target/release/krokiet if: ${{ matrix.type == 'release' }} @@ -71,19 +68,19 @@ jobs: - uses: actions/checkout@v3 - name: Install basic libraries - run: sudo apt update || true; sudo apt install libgtk-4-dev libheif-dev -y + run: sudo apt update || true; sudo apt install libgtk-4-dev libheif-dev libraw-dev -y - name: Setup rust version run: rustup default ${{ matrix.toolchain }} - - name: Build Release Heif - run: cargo build --release --bin czkawka_gui --features heif + - name: Build Release Heif Libraw + run: cargo build --release --bin czkawka_gui --features "heif,libraw" if: ${{ (matrix.type == 'release') }} - - name: Store Linux GUI Heif + - name: Store Linux GUI Heif Libraw uses: actions/upload-artifact@v3 with: - name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}-heif + name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}-heif-libraw path: target/release/czkawka_gui if: ${{ (matrix.type == 'release') && (matrix.toolchain == 'stable') }} diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 482717c61..60e3bd80e 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -15,10 +15,13 @@ jobs: - uses: actions/checkout@v3 - name: Install Gtk 4 - run: sudo apt update || true; sudo apt install -y libgtk-4-dev libheif-dev -y + run: sudo apt update || true; sudo apt install -y libgtk-4-dev libraw-dev libheif-dev -y - name: Check the format run: cargo fmt --all -- --check - name: Run clippy run: cargo clippy --all-targets --all-features -- -D warnings + + - name: Run clippy + run: cargo clippy -- -D warnings diff --git a/Cargo.lock b/Cargo.lock index 545d69f4d..be1ad3a3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1258,6 +1258,7 @@ dependencies = [ "infer", "libheif-rs", "libheif-sys", + "libraw-rs", "lofty", "log", "mime_guess", @@ -3428,6 +3429,25 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libraw-rs" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ec60aab878560c299c6e70a0c6dc2278a2159ac6fe09650917266b8985387f" +dependencies = [ + "libraw-rs-sys", +] + +[[package]] +name = "libraw-rs-sys" +version = "0.0.4+libraw-0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba094a3b8b04cc42fdeafaff06f81d3b13a7d01cc7a8eae55b943dae1b65c3cc" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "libredox" version = "0.0.1" diff --git a/Changelog.md b/Changelog.md index 391135a8c..89b8d1cc2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -15,6 +15,7 @@ - Fixed missing json support in saving size and name - [#1102](https://github.com/qarmin/czkawka/pull/1102) - Fix cross-compiled debug windows build - [#1102](https://github.com/qarmin/czkawka/pull/1102) - Added bigger stack size by default(fixes stack overflow in some musl apps) - [#1102](https://github.com/qarmin/czkawka/pull/1102) +- Added optional libraw dependency(better single-core performance and support more raw files) - [#1102](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/czkawka_cli/Cargo.toml b/czkawka_cli/Cargo.toml index 2eb75bc77..1a3d539cc 100644 --- a/czkawka_cli/Cargo.toml +++ b/czkawka_cli/Cargo.toml @@ -23,3 +23,4 @@ czkawka_core = { path = "../czkawka_core", version = "6.1.0", features = [] } [features] default = [] heif = ["czkawka_core/heif"] +libraw = ["czkawka_core/libraw"] diff --git a/czkawka_cli/README.md b/czkawka_cli/README.md index 17ffd7194..fb808d89c 100644 --- a/czkawka_cli/README.md +++ b/czkawka_cli/README.md @@ -9,18 +9,21 @@ If you decide to compile the app, you probably will be able to run it on even ol On linux it is even possible with eyra to avoid entirely libc and using fully static rust binary. -If you want to use similar videos tool, you need to install ffmpeg(optional feature, only needed when running). -- mac - `brew install ffmpeg` - https://formulae.brew.sh/formula/ffmpeg -- linux - `sudo apt install ffmpeg` -- windows - `choco install ffmpeg` - or if not working, download from https://ffmpeg.org/download.html#build-windows and unpack to location with `czkawka_cli.exe` +If you want to use similar videos tool, you need to install ffmpeg(runtime dependency) or use heif/libraw(build/runtime dependency) you need to install required packages. +- mac - `brew install ffmpeg libraw libheif` - https://formulae.brew.sh/formula/ffmpeg +- linux - `sudo apt install ffmpeg libraw-dev libheif-dev` +- windows - `choco install ffmpeg` - or if not working, download from https://ffmpeg.org/download.html#build-windows and unpack to location with `czkawka_cli.exe`, heif and libraw are not supported on windows ## Compilation For compilation, you need to have installed Rust via rustup - https://rustup.rs/ and compile it e.g. via ```shell cargo run --release --bin czkawka_cli ``` - -on linux to build fully static binary you need to use +you can enable additional features via +```shell +cargo run --release --bin czkawka_cli --features "heif,libraw" +``` +on linux to build fully static binary with eyra you need to use (this is only for crazy people, so just use command above if you don't know what you are doing) ```shell rustup default nightly-2023-11-16 # or any newer nightly that works fine with eyra cd czkawka_cli diff --git a/czkawka_core/Cargo.toml b/czkawka_core/Cargo.toml index 2ff40f1e7..897d4dd94 100644 --- a/czkawka_core/Cargo.toml +++ b/czkawka_core/Cargo.toml @@ -62,6 +62,7 @@ once_cell = "1.18" # Raw image files rawloader = "0.37" imagepipe = "0.5" +libraw-rs = { version = "0.0.4", optional = true } # Checking for invalid extensions mime_guess = "2.0" @@ -69,9 +70,10 @@ infer = "0.15" # Heif/Heic libheif-rs = { version = "=0.18.0", optional = true } # Do not upgrade now, since Ubuntu 22.04 not works with newer version -libheif-sys = { version = "=1.14.2", optional = true } # 1.14.3 brake compilation on Ubuntu 22.04 +libheif-sys = { version = "=1.14.2", optional = true } # 1.14.3 brake compilation on Ubuntu 22.04, so pin it to this version anyhow = { version = "1.0" } + state = "0.6" os_info = { version = "3", default-features = false } @@ -83,3 +85,4 @@ fun_time = { version = "0.3.1", features = ["log"] } [features] default = [] heif = ["dep:libheif-rs", "dep:libheif-sys"] +libraw = ["dep:libraw-rs"] \ No newline at end of file diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index f6d059da6..e19307424 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -1,6 +1,7 @@ +#[allow(unused_imports)] +// I don't wanna fight with unused imports in this file, so simply ignore it to avoid too much complexity use std::ffi::OsString; use std::fs::{DirEntry, File, OpenOptions}; -use std::io::BufReader; use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::Arc; @@ -18,7 +19,10 @@ use image::{DynamicImage, ImageBuffer, Rgb}; use imagepipe::{ImageSource, Pipeline}; #[cfg(feature = "heif")] use libheif_rs::{ColorSpace, HeifContext, RgbChroma}; +#[cfg(feature = "libraw")] +use libraw::Processor; use log::{debug, info, warn, LevelFilter, Record}; +use rawloader::RawLoader; // #[cfg(feature = "heif")] // use libheif_rs::LibHeif; @@ -204,16 +208,33 @@ pub fn get_dynamic_image_from_heic(path: &str) -> Result { .ok_or_else(|| anyhow::anyhow!("Failed to create image buffer")) } +#[cfg(feature = "libraw")] +pub fn get_dynamic_image_from_raw_image(path: impl AsRef) -> Option { + let buf = fs::read(path.as_ref()).ok()?; + + let processor = Processor::new(); + let start_timer = Instant::now(); + let processed = processor.process_8bit(&buf).expect("processing successful"); + println!("Processing took {:?}", start_timer.elapsed()); + + let width = processed.width(); + let height = processed.height(); + dbg!(width, height); + + let data = processed.to_vec(); + + let buffer = ImageBuffer::from_raw(width, height, data)?; + // Utwórz DynamicImage z ImageBuffer + Some(DynamicImage::ImageRgb8(buffer)) +} + +#[cfg(not(feature = "libraw"))] pub fn get_dynamic_image_from_raw_image(path: impl AsRef + std::fmt::Debug) -> Option { let mut start_timer = Instant::now(); let mut times = Vec::new(); - let file_handler = OpenOptions::new().read(true).open(&path).ok()?; - times.push(("After opening", start_timer.elapsed())); - start_timer = Instant::now(); - - let mut reader = BufReader::new(file_handler); - let raw = rawloader::decode(&mut reader).ok()?; + let loader = RawLoader::new(); + let raw = loader.decode_file(path.as_ref()).ok()?; times.push(("After decoding", start_timer.elapsed())); start_timer = Instant::now(); diff --git a/czkawka_gui/Cargo.toml b/czkawka_gui/Cargo.toml index 030c9641f..743d05083 100644 --- a/czkawka_gui/Cargo.toml +++ b/czkawka_gui/Cargo.toml @@ -59,3 +59,4 @@ winapi = { version = "0.3.9", features = ["combaseapi", "objbase", "shobjidl_cor [features] default = [] heif = ["czkawka_core/heif"] +libraw = ["czkawka_core/libraw"] diff --git a/czkawka_gui/README.md b/czkawka_gui/README.md index f1dcd9f3b..07739fa87 100644 --- a/czkawka_gui/README.md +++ b/czkawka_gui/README.md @@ -10,7 +10,7 @@ Prebuild binareies are available here - https://github.com/qarmin/czkawka/releas ### Linux #### Prebuild binaries - Ubuntu - `sudo apt install libgtk-4 libheif ffmpeg -y` + Ubuntu - `sudo apt install libgtk-4 libheif libraw ffmpeg -y` #### Snap - none - all needed libraries are bundled in snap [except ffmpeg](https://github.com/snapcrafters/ffmpeg/issues/73) - https://snapcraft.io/czkawka #### Flatpak @@ -18,7 +18,7 @@ Prebuild binareies are available here - https://github.com/qarmin/czkawka/releas ### Mac ``` /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -brew install gtk4 adwaita-icon-theme ffmpeg librsvg libheif +brew install gtk4 adwaita-icon-theme ffmpeg librsvg libheif libraw ``` ### Windows @@ -41,15 +41,19 @@ Compilation of gui is harder that compilation cli or core, because uses gtk4 whi ### Linux (Ubuntu, but on other OS should work similar) ```shell -sudo apt install libgtk-4-dev libheif-dev -y +sudo apt install libgtk-4-dev libheif-dev libraw-dev -y cargo run --release --bin czkawka_gui +# Or with support for heif and libraw +cargo run --release --bin czkawka_gui --features "heif,libraw" ``` ### Mac ```shell /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -brew install rustup gtk4 adwaita-icon-theme ffmpeg librsvg libheif pkg-config +brew install rustup gtk4 adwaita-icon-theme ffmpeg librsvg libheif libraw pkg-config rustup-init cargo run --release --bin czkawka_gui +# Or with support for heif and libraw +cargo run --release --bin czkawka_gui --features "heif,libraw" ``` ### Windows Currently, there is no instruction how to compile app on Windows natively.
diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index f704246cb..ba4cb0a54 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -58,3 +58,4 @@ winit_skia_vulkan = ["slint/renderer-winit-skia-vulkan"] winit_software = ["slint/renderer-winit-software"] heif = ["czkawka_core/heif"] +libraw = ["czkawka_core/libraw"] From 6e9dc8f03b48a91f3bf45eb1800efc6780105f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Fri, 1 Dec 2023 23:52:32 +0100 Subject: [PATCH 099/107] Tool Settings --- krokiet/ui/tool_settings.slint | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 krokiet/ui/tool_settings.slint diff --git a/krokiet/ui/tool_settings.slint b/krokiet/ui/tool_settings.slint new file mode 100644 index 000000000..fc4165270 --- /dev/null +++ b/krokiet/ui/tool_settings.slint @@ -0,0 +1,22 @@ +import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint"; +import {SelectableTableView} from "selectable_tree_view.slint"; +import {LeftSidePanel} from "left_side_panel.slint"; +import {MainList} from "main_lists.slint"; +import {CurrentTab, ProgressToSend} from "common.slint"; +import { ActionButtons } from "action_buttons.slint"; +import { Progress } from "progress.slint"; +import {MainListModel} from "common.slint"; +import {Settings} from "settings.slint"; +import {Callabler} from "callabler.slint"; +import { BottomPanel } from "bottom_panel.slint"; +import {ColorPalette} from "color_palette.slint"; +import {GuiState} from "gui_state.slint"; +import { Preview } from "preview.slint"; +import {PopupNewDirectories} from "popup_new_directories.slint"; +import { PopupSelect } from "popup_select.slint"; +export component ToolSettings inherits Rectangle { + width: 300px; + height: 300px; + in-out property active_tab; + background: red; +} \ No newline at end of file From 6aaa1b9f583e878d40daa322a3d408ebeec9ad0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 2 Dec 2023 08:54:28 +0100 Subject: [PATCH 100/107] Less amount of conversions --- krokiet/src/common.rs | 4 ++-- krokiet/src/connect_delete.rs | 2 +- krokiet/src/connect_directories_changes.rs | 6 +++--- krokiet/src/connect_progress_receiver.rs | 8 ++++---- krokiet/src/connect_scan.rs | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/krokiet/src/common.rs b/krokiet/src/common.rs index 7444fa915..1a9f518d7 100644 --- a/krokiet/src/common.rs +++ b/krokiet/src/common.rs @@ -6,7 +6,7 @@ use std::path::PathBuf; // .iter() // .map(|x| { // let mut element = StandardListViewItem::default(); -// element.text = SharedString::from(x.to_string()); +// element.text = x.into(); // element // }) // .collect::>(); @@ -17,7 +17,7 @@ pub fn create_string_standard_list_view_from_pathbuf(items: &[PathBuf]) -> Model .iter() .map(|x| { let mut element = StandardListViewItem::default(); - element.text = SharedString::from(x.to_string_lossy().to_string()); + element.text = x.to_string_lossy().to_string().into(); element }) .collect::>(); diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index 89af5416c..ec3d142c0 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -238,7 +238,7 @@ mod tests { fn create_new_model(items: Vec<(bool, bool, bool, Vec<&'static str>)>) -> ModelRc { let model = VecModel::default(); for item in items { - let all_items = item.3.iter().map(|item| SharedString::from(*item)).collect::>(); + let all_items: Vec = item.3.iter().map(|item| item.into()).collect::>(); let all_items = VecModel::from(all_items); model.push(MainListModel { checked: item.0, diff --git a/krokiet/src/connect_directories_changes.rs b/krokiet/src/connect_directories_changes.rs index 80a919d8c..be8d5a7e6 100644 --- a/krokiet/src/connect_directories_changes.rs +++ b/krokiet/src/connect_directories_changes.rs @@ -24,7 +24,7 @@ fn connect_add_manual_directories(app: &MainWindow) { let mut included_model = included_model.iter().collect::>(); included_model.extend(non_empty_lines.iter().map(|x| { let mut element = slint::StandardListViewItem::default(); - element.text = slint::SharedString::from((*x).to_string()); + element.text = (*x).into(); element })); included_model.sort_by_cached_key(|x| x.text.to_string()); @@ -35,7 +35,7 @@ fn connect_add_manual_directories(app: &MainWindow) { let mut excluded_model = excluded_model.iter().collect::>(); excluded_model.extend(non_empty_lines.iter().map(|x| { let mut element = slint::StandardListViewItem::default(); - element.text = slint::SharedString::from((*x).to_string()); + element.text = (*x).into(); element })); excluded_model.sort_by_cached_key(|x| x.text.to_string()); @@ -106,7 +106,7 @@ fn connect_add_directories(app: &MainWindow) { .iter() .map(|x| { let mut element = slint::StandardListViewItem::default(); - element.text = slint::SharedString::from(x.to_string()); + element.text = x.into(); element }) .collect::>(); diff --git a/krokiet/src/connect_progress_receiver.rs b/krokiet/src/connect_progress_receiver.rs index 24d32fdb6..376ec3806 100644 --- a/krokiet/src/connect_progress_receiver.rs +++ b/krokiet/src/connect_progress_receiver.rs @@ -2,7 +2,7 @@ use crate::{MainWindow, ProgressToSend}; use crossbeam_channel::Receiver; use czkawka_core::common_dir_traversal::{ProgressData, ToolType}; -use slint::{ComponentHandle, SharedString}; +use slint::ComponentHandle; use std::thread; pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver) { @@ -21,7 +21,7 @@ pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver< to_send = ProgressToSend { all_progress, current_progress, - step_name: SharedString::from(format!("Checked {} files", progress_data.entries_checked)), + step_name: format!("Checked {} files", progress_data.entries_checked).into(), }; } ToolType::EmptyFolders => { @@ -29,7 +29,7 @@ pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver< to_send = ProgressToSend { all_progress, current_progress, - step_name: SharedString::from(format!("Checked {} folders", progress_data.entries_checked)), + step_name: format!("Checked {} folders", progress_data.entries_checked).into(), }; } ToolType::SimilarImages => { @@ -55,7 +55,7 @@ pub fn connect_progress_gathering(app: &MainWindow, progress_receiver: Receiver< to_send = ProgressToSend { all_progress, current_progress, - step_name: SharedString::from(step_name), + step_name: step_name.into(), }; } _ => { diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index ff59e9848..8dfb00b38 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -26,7 +26,7 @@ pub fn connect_scan_button(app: &MainWindow, progress_sender: Sender Date: Sat, 2 Dec 2023 12:48:47 +0100 Subject: [PATCH 101/107] A --- README.md | 53 ++++++++++++++++++----------------- czkawka_core/src/common.rs | 2 +- instructions/Compilation.md | 7 +++++ instructions/Installation.md | 7 +++++ instructions/Translations.md | 4 +++ krokiet/src/connect_delete.rs | 2 +- 6 files changed, 48 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 24b6ed0d3..b740b9a13 100644 --- a/README.md +++ b/README.md @@ -87,31 +87,34 @@ Similar images which check 349 image files that occupied 1.7 GB Bleachbit is a master at finding and removing temporary files, while Czkawka only finds the most basic ones. So these two apps shouldn't be compared directly or be considered as an alternative to one another. -| | Czkawka | FSlint | DupeGuru | Bleachbit | -|:------------------------:|:-----------:|:----------:|:-----------------:|:-----------:| -| Language | Rust | Python | Python/Obj-C | Python | -| OS | Lin,Mac,Win | Lin | Lin,Mac,Win | Lin,Mac,Win | -| Framework | GTK 4 | PyGTK2 | Qt 5 (PyQt)/Cocoa | PyGTK3 | -| Duplicate finder | ✔ | ✔ | ✔ | | -| Empty files | ✔ | ✔ | | | -| Empty folders | ✔ | ✔ | | | -| Temporary files | ✔ | ✔ | | ✔ | -| Big files | ✔ | | | | -| Similar images | ✔ | | ✔ | | -| Similar videos | ✔ | | | | -| Music duplicates(tags) | ✔ | | ✔ | | -| Invalid symlinks | ✔ | ✔ | | | -| Broken files | ✔ | | | | -| Names conflict | ✔ | ✔ | | | -| Invalid names/extensions | ✔ | ✔ | | | -| Installed packages | | ✔ | | | -| Bad ID | | ✔ | | | -| Non stripped binaries | | ✔ | | | -| Redundant whitespace | | ✔ | | | -| Overwriting files | | ✔ | | ✔ | -| Multiple languages | ✔ | ✔ | ✔ | ✔ | -| Cache support | ✔ | | ✔ | | -| In active development | Yes | No | Yes | Yes | +In this comparison remember, that even if app have same features they may work different(e.g. one app may have more options to choose than other). + +| | Czkawka | Krokiet | FSlint | DupeGuru | Bleachbit | +|:------------------------:|:-----------:|:-----------:|:------:|:------------------:|:-----------:| +| Language | Rust | Rust | Python | Python/Obj-C | Python | +| Framework base language | C | Rust | C | C/C++/Obj-C/Swift | C | +| Framework | GTK 4 | Slint | PyGTK2 | Qt 5 (PyQt)/Cocoa | PyGTK3 | +| OS | Lin,Mac,Win | Lin,Mac,Win | Lin | Lin,Mac,Win | Lin,Mac,Win | +| Duplicate finder | ✔ | ✔ | ✔ | ✔ | | +| Empty files | ✔ | ✔ | ✔ | | | +| Empty folders | ✔ | ✔ | ✔ | | | +| Temporary files | ✔ | ✔ | ✔ | | ✔ | +| Big files | ✔ | ✔ | | | | +| Similar images | ✔ | ✔ | | ✔ | | +| Similar videos | ✔ | ✔ | | | | +| Music duplicates(tags) | ✔ | ✔ | | ✔ | | +| Invalid symlinks | ✔ | ✔ | ✔ | | | +| Broken files | ✔ | ✔ | | | | +| Names conflict | ✔ | ✔ | ✔ | | | +| Invalid names/extensions | ✔ | ✔ | ✔ | | | +| Installed packages | | | ✔ | | | +| Bad ID | | | ✔ | | | +| Non stripped binaries | | | ✔ | | | +| Redundant whitespace | | | ✔ | | | +| Overwriting files | | | ✔ | | ✔ | +| Multiple languages | ✔ | | ✔ | ✔ | ✔ | +| Cache support | ✔ | ✔ | | ✔ | | +| In active development | Yes | | No | Yes | Yes | ## Other apps There are many similar applications to Czkawka on the Internet, which do some things better and some things worse: diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index e19307424..a0df6aa57 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -1,4 +1,4 @@ -#[allow(unused_imports)] +#![allow(unused_imports)] // I don't wanna fight with unused imports in this file, so simply ignore it to avoid too much complexity use std::ffi::OsString; use std::fs::{DirEntry, File, OpenOptions}; diff --git a/instructions/Compilation.md b/instructions/Compilation.md index 535318f3d..287b6479a 100644 --- a/instructions/Compilation.md +++ b/instructions/Compilation.md @@ -1,5 +1,12 @@ # Compiling Czkawka from sources +This instruction is outdated and will be removed in one of next version, please look at README.md files in each module folder for more up to date instructions. +- [Czkawka GUI (GTK frontend)](../czkawka_gui/README.md)
+- [Czkawka CLI](../czkawka_cli/README.md)
+- [Czkawka Core](../czkawka_core/README.md)
+- [Krokiet GUI (Slint frontend)](../krokiet/README.md)
+ + ## Requirements If you only want the terminal version without a GUI, just skip all the packages with `gtk` in their names. diff --git a/instructions/Installation.md b/instructions/Installation.md index a65fd1f27..df4e1d0d0 100644 --- a/instructions/Installation.md +++ b/instructions/Installation.md @@ -1,4 +1,11 @@ # Installation + +This instruction is outdated and will be removed in one of next version, please look at README.md files in each module folder for more up to date instructions. +- [Czkawka GUI (GTK frontend)](../czkawka_gui/README.md)
+- [Czkawka CLI](../czkawka_cli/README.md)
+- [Czkawka Core](../czkawka_core/README.md)
+- [Krokiet GUI (Slint frontend)](../krokiet/README.md)
+ ## Requirements ### Linux If you use Snap, Flatpak or Appimage, you need to only install ffmpeg if you want to use Similar Videos tool. diff --git a/instructions/Translations.md b/instructions/Translations.md index 4c6010f2b..d4e14aed0 100644 --- a/instructions/Translations.md +++ b/instructions/Translations.md @@ -8,6 +8,10 @@ Main/Default language is English, but also Polish is officially supported. Translating is mostly done by site - https://crowdin.com/project/czkawka +If you want to translate Czkawka to your language, you can do it in this site. + +Next chapters are only for internal use, so just use crowdin page. + ## How to translate Czkawka? Base translatable strings are placed under `i18n/en/czkawka_gui.ftl` file. diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index ec3d142c0..cbf53a716 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -238,7 +238,7 @@ mod tests { fn create_new_model(items: Vec<(bool, bool, bool, Vec<&'static str>)>) -> ModelRc { let model = VecModel::default(); for item in items { - let all_items: Vec = item.3.iter().map(|item| item.into()).collect::>(); + let all_items: Vec = item.3.iter().map(|item| (*item).into()).collect::>(); let all_items = VecModel::from(all_items); model.push(MainListModel { checked: item.0, From af16c5366fffb8cd6a59d2d583a2e9161aa0b1c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 2 Dec 2023 15:49:37 +0100 Subject: [PATCH 102/107] Active tab --- krokiet/src/connect_delete.rs | 4 ++-- krokiet/ui/action_buttons.slint | 6 +++--- krokiet/ui/gui_state.slint | 5 +++++ krokiet/ui/left_side_panel.slint | 21 ++++++++------------- krokiet/ui/main_lists.slint | 16 ++++++++-------- krokiet/ui/main_window.slint | 12 ++++-------- krokiet/ui/settings_list.slint | 20 ++++++++++++++++---- krokiet/ui/tool_settings.slint | 10 ++++++++-- 8 files changed, 54 insertions(+), 40 deletions(-) diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index cbf53a716..2d5bf5647 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -1,6 +1,6 @@ use slint::{ComponentHandle, Model, ModelRc, VecModel}; -use crate::{Callabler, CurrentTab, MainListModel, MainWindow}; +use crate::{Callabler, CurrentTab, GuiState, MainListModel, MainWindow}; use log::info; pub fn connect_delete_button(app: &MainWindow) { @@ -8,7 +8,7 @@ pub fn connect_delete_button(app: &MainWindow) { app.global::().on_delete_selected_items(move || { let app = a.upgrade().unwrap(); - let active_tab = app.get_active_tab(); + let active_tab = app.global::().get_active_tab(); let model = match active_tab { CurrentTab::EmptyFolders => app.get_empty_folder_model(), diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 9e47e02c1..6f8fe4c78 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -4,6 +4,7 @@ import {MainList} from "main_lists.slint"; import {CurrentTab} from "common.slint"; import {BottomPanelVisibility} from "common.slint"; import {Callabler} from "callabler.slint"; +import {GuiState} from "gui_state.slint"; export component VisibilityButton inherits Button { in-out property button_visibility; @@ -22,9 +23,8 @@ export component ActionButtons inherits HorizontalLayout { in-out property bottom_panel_visibility: BottomPanelVisibility.Directories; in-out property stop_requested: false; in-out property scanning; - in-out property lists_enabled: active-tab != CurrentTab.Settings; + in-out property lists_enabled: GuiState.active_tab != CurrentTab.Settings; // in-out property <> - in-out property active-tab; out property name; height: 30px; spacing: 4px; @@ -37,7 +37,7 @@ export component ActionButtons inherits HorizontalLayout { text: "Scan"; clicked => { root.scanning = true; - root.scan_starting(active-tab); + root.scan_starting(GuiState.active_tab); } } diff --git a/krokiet/ui/gui_state.slint b/krokiet/ui/gui_state.slint index 0735369b6..97570ba98 100644 --- a/krokiet/ui/gui_state.slint +++ b/krokiet/ui/gui_state.slint @@ -1,3 +1,5 @@ +import {CurrentTab} from "common.slint"; + // State to show export global GuiState { in-out property app_width; @@ -11,4 +13,7 @@ export global GuiState { in-out property choosing_include_directories; in-out property visible_tool_settings; + + in-out property available_subsettings: active_tab == CurrentTab.SimilarImages; + in-out property active_tab: CurrentTab.EmptyFiles; } diff --git a/krokiet/ui/left_side_panel.slint b/krokiet/ui/left_side_panel.slint index 4211eb5a3..7521ef7b9 100644 --- a/krokiet/ui/left_side_panel.slint +++ b/krokiet/ui/left_side_panel.slint @@ -5,7 +5,6 @@ import {GuiState} from "gui_state.slint"; component TabItem { in property scanning; - in-out property active-tab; in property text; in property curr_tab; callback changed_current_tab(); @@ -16,10 +15,10 @@ component TabItem { background: touch-area.has-hover ? ColorPalette.tab-hovered-color : transparent; touch_area := TouchArea { clicked => { - if (root.active-tab == root.curr-tab) { + if (GuiState.active_tab == root.curr-tab) { return; } - root.active-tab = root.curr-tab; + GuiState.active_tab = root.curr-tab; changed_current_tab(); } } @@ -32,7 +31,7 @@ component TabItem { empty_rectangle := Rectangle { } current_rectangle := Rectangle { - visible: (root.active-tab == root.curr-tab); + visible: (GuiState.active_tab == root.curr-tab); border-radius: 2px; width: 5px; height: 0px; @@ -53,17 +52,16 @@ component TabItem { } states [ - is-selected when root.active-tab == root.curr-tab: { + is-selected when GuiState.active_tab == root.curr-tab: { current_rectangle.height: layout_rectangle.height; } - is-not-selected when root.active-tab != root.curr-tab: { + is-not-selected when GuiState.active_tab != root.curr-tab: { current_rectangle.height: 0px; } ] } export component LeftSidePanel { - in-out property active-tab; in-out property scanning; callback changed_current_tab(); width: 120px; @@ -85,7 +83,6 @@ export component LeftSidePanel { height: parent.element-size; scanning: scanning; text: "Empty Folders"; - active-tab <=> root.active-tab; curr_tab: CurrentTab.EmptyFolders; changed_current_tab() => {root.changed_current_tab();} } @@ -94,7 +91,6 @@ export component LeftSidePanel { height: parent.element-size; scanning: scanning; text: "Empty Files"; - active-tab <=> root.active-tab; curr_tab: CurrentTab.EmptyFiles; changed_current_tab() => {root.changed_current_tab();} } @@ -103,7 +99,6 @@ export component LeftSidePanel { height: parent.element-size; scanning: scanning; text: "Similar Images"; - active-tab <=> root.active-tab; curr_tab: CurrentTab.SimilarImages; changed_current_tab() => {root.changed_current_tab();} } @@ -113,7 +108,7 @@ export component LeftSidePanel { HorizontalLayout { alignment: start; Button { - enabled: active-tab != CurrentTab.Settings; + enabled: GuiState.active_tab != CurrentTab.Settings && GuiState.available_subsettings; min-width: 20px; min-height: 20px; max-height: self.width; @@ -127,14 +122,14 @@ export component LeftSidePanel { HorizontalLayout { alignment: end; Button { - enabled: active-tab != CurrentTab.Settings; + enabled: GuiState.active_tab != CurrentTab.Settings; min-width: 20px; min-height: 20px; max-height: self.width; preferred-height: self.width; icon: @image-url("../icons/settings.svg"); clicked => { - active_tab = CurrentTab.Settings; + GuiState.active_tab = CurrentTab.Settings; root.changed_current_tab(); } } diff --git a/krokiet/ui/main_lists.slint b/krokiet/ui/main_lists.slint index 8b0e09e67..fd68a2fea 100644 --- a/krokiet/ui/main_lists.slint +++ b/krokiet/ui/main_lists.slint @@ -4,9 +4,9 @@ import {LeftSidePanel} from "left_side_panel.slint"; import {CurrentTab, TypeOfOpenedItem} from "common.slint"; import {MainListModel} from "common.slint"; import {SettingsList} from "settings_list.slint"; +import {GuiState} from "gui_state.slint"; export component MainList { - in-out property active-tab: CurrentTab.EmptyFolders; in-out property <[MainListModel]> empty_folder_model: [ {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , @@ -19,7 +19,7 @@ export component MainList { callback released_key(string); empty_folders := SelectableTableView { - visible: root.active-tab == CurrentTab.EmptyFolders; + visible: GuiState.active_tab == CurrentTab.EmptyFolders; min-width: 200px; height: parent.height; columns: ["Selection", "Folder Name", "Path", "Modification Date"]; @@ -30,7 +30,7 @@ export component MainList { } empty_files := SelectableTableView { - visible: root.active-tab == CurrentTab.EmptyFiles; + visible: GuiState.active_tab == CurrentTab.EmptyFiles; min-width: 200px; height: parent.height; columns: ["Selection", "File Name", "Path", "Modification Date"]; @@ -41,7 +41,7 @@ export component MainList { } similar_images := SelectableTableView { - visible: root.active-tab == CurrentTab.SimilarImages; + visible: GuiState.active_tab == CurrentTab.SimilarImages; min-width: 200px; height: parent.height; columns: ["Selection", "Similarity", "Size", "Dimensions", "File Name", "Path", "Modification Date"]; @@ -52,7 +52,7 @@ export component MainList { } settings_list := SettingsList { - visible: root.active-tab == CurrentTab.Settings; + visible: GuiState.active_tab == CurrentTab.Settings; } focus_item := FocusScope { @@ -63,11 +63,11 @@ export component MainList { if (!self.visible || !self.has-focus) { return accept; } - if (root.active-tab == CurrentTab.EmptyFiles) { + if (GuiState.active_tab == CurrentTab.EmptyFiles) { empty_files.released_key(event); - } else if (root.active-tab == CurrentTab.EmptyFolders) { + } else if (GuiState.active_tab == CurrentTab.EmptyFolders) { empty-folders.released_key(event); - } else if (root.active-tab == CurrentTab.SimilarImages) { + } else if (GuiState.active_tab == CurrentTab.SimilarImages) { similar-images.released_key(event); } else { debug("Non handled key in main_lists.slint"); diff --git a/krokiet/ui/main_window.slint b/krokiet/ui/main_window.slint index 0d7853532..c22e21062 100644 --- a/krokiet/ui/main_window.slint +++ b/krokiet/ui/main_window.slint @@ -37,7 +37,6 @@ export component MainWindow inherits Window { all_progress: 20, step_name: "Cache", }; - in-out property active_tab: CurrentTab.EmptyFolders; in-out property <[MainListModel]> empty_folder_model: [ {checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} , {checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} , @@ -59,7 +58,6 @@ export component MainWindow inherits Window { LeftSidePanel { horizontal-stretch: 0.0; scanning <=> root.scanning; - active-tab <=> root.active-tab; changed_current_tab() => { GuiState.preview_visible = false; main_list.changed_current_tab(); @@ -76,27 +74,26 @@ export component MainWindow inherits Window { width: preview_or_tool_settings.visible ? parent.width / 2 : parent.width; height: parent.height; horizontal-stretch: 0.5; - active-tab <=> root.active-tab; empty_folder_model <=> root.empty_folder_model; empty_files_model <=> root.empty_files_model; similar_images_model <=> root.similar_images_model; } preview_or_tool_settings := Rectangle { - visible: (GuiState.preview_visible || GuiState.visible_tool_settings) && active_tab != CurrentTab.Settings; + visible: (GuiState.preview_visible || tool_settings.visible) && GuiState.active_tab != CurrentTab.Settings; height: parent.height; x: parent.width / 2; width: self.visible ? parent.width / 2 : 0; Preview { height: parent.height; width: parent.width; - visible: GuiState.preview_visible && !GuiState.visible_tool_settings; + visible: GuiState.preview_visible && !tool_settings.visible; source: GuiState.preview_image; image-fit: ImageFit.contain; } - ToolSettings { + tool_settings := ToolSettings { height: parent.height; width: parent.width; - visible: GuiState.visible_tool_settings; + visible: GuiState.visible_tool_settings && GuiState.available_subsettings; } } } @@ -111,7 +108,6 @@ export component MainWindow inherits Window { action_buttons := ActionButtons { vertical-stretch: 0.0; scanning <=> root.scanning; - active-tab <=> root.active-tab; stop_requested <=> root.stop-requested; scan_stopping => { text_summary_text = "Stopping scan, please wait..."; diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 2ab09b0b8..0d29b5bfb 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -43,6 +43,8 @@ component ThreadSliderComponent inherits HorizontalLayout { in-out property maximum_number; in-out property name; spacing: 5px; + + callback changed <=> slider.changed; Text { text <=> name; @@ -156,6 +158,8 @@ export component SettingsList inherits VerticalLayout { preferred-height: 300px; preferred-width: 400px; + in-out property restart_required; + Text { text: "Settings"; height: SettingsSize.item_height; @@ -164,6 +168,7 @@ export component SettingsList inherits VerticalLayout { } ScrollView { VerticalLayout { + padding-right: 15px; spacing: 5px; Presets{ height: SettingsSize.item_height; @@ -209,6 +214,13 @@ export component SettingsList inherits VerticalLayout { ThreadSliderComponent { name: "Thread number"; maximum_number <=> GuiState.maximum_threads; + changed => { + restart_required = true; + } + } + if restart_required: Text { + text: "---You need to restart app to apply changes in thread number---"; + horizontal-alignment: TextHorizontalAlignment.center; } HeaderText { text: "Duplicate tool"; @@ -221,14 +233,14 @@ export component SettingsList inherits VerticalLayout { name: "Hide hard links"; model <=> Settings.duplicate_hide_hard_links; } - CheckBoxComponent { - name: "Use prehash"; - model <=> Settings.duplicate_use_prehash; - } TextComponent { name: "Minimal size of cached files - Hash (KB)"; model <=> Settings.duplicate_minimal_hash_cache_size; } + CheckBoxComponent { + name: "Use prehash"; + model <=> Settings.duplicate_use_prehash; + } TextComponent { name: "Minimal size of cached files - Prehash (KB)"; model <=> Settings.duplicate_minimal_prehash_cache_size; diff --git a/krokiet/ui/tool_settings.slint b/krokiet/ui/tool_settings.slint index fc4165270..d0f228fd2 100644 --- a/krokiet/ui/tool_settings.slint +++ b/krokiet/ui/tool_settings.slint @@ -14,9 +14,15 @@ import {GuiState} from "gui_state.slint"; import { Preview } from "preview.slint"; import {PopupNewDirectories} from "popup_new_directories.slint"; import { PopupSelect } from "popup_select.slint"; + export component ToolSettings inherits Rectangle { width: 300px; height: 300px; - in-out property active_tab; - background: red; + + if GuiState.active_tab == CurrentTab.SimilarImages: VerticalLayout { + Text { + text: " Subsettings"; + font-size: 15px; + } + } } \ No newline at end of file From f059b2aa8b448ddaeefa5381bc5d5bbc1641bc60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 2 Dec 2023 17:25:10 +0100 Subject: [PATCH 103/107] Almost subsettings --- krokiet/ui/settings.slint | 13 +++++ krokiet/ui/tool_settings.slint | 87 ++++++++++++++++++++++++++++++---- 2 files changed, 92 insertions(+), 8 deletions(-) diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index 15819ddfb..45c40530a 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -31,4 +31,17 @@ export global Settings { in-out property similar_videos_delete_outdated_entries; in-out property similar_music_delete_outdated_entries; + + + // Allowed subsettings + // Duplicate + in-out property <[string]> duplicate_sub_available_hash_size: ["8", "16", "32", "64"]; + in-out property duplicate_sub_hash_size_index: 0; + in-out property <[string]> duplicate_sub_available_resize_algorithm: ["Lanczos3", "Nearest", "Triangle", "Gaussian", "CatmullRom"]; + in-out property duplicate_sub_resize_algorithm_index: 0; + in-out property <[string]> duplicate_sub_available_hash_type: ["Gradient", "Mean", "VertGradient", "BlockHash", "DoubleGradient"]; + in-out property duplicate_sub_hash_type_index: 0; + in-out property duplicate_sub_max_similarity: 40; + in-out property duplicate_sub_current_similarity: 20; + in-out property duplicate_sub_ignore_same_size; } diff --git a/krokiet/ui/tool_settings.slint b/krokiet/ui/tool_settings.slint index d0f228fd2..12a6bd924 100644 --- a/krokiet/ui/tool_settings.slint +++ b/krokiet/ui/tool_settings.slint @@ -1,4 +1,4 @@ -import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint"; +import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit, ScrollView, ComboBox, Slider} from "std-widgets.slint"; import {SelectableTableView} from "selectable_tree_view.slint"; import {LeftSidePanel} from "left_side_panel.slint"; import {MainList} from "main_lists.slint"; @@ -15,14 +15,85 @@ import { Preview } from "preview.slint"; import {PopupNewDirectories} from "popup_new_directories.slint"; import { PopupSelect } from "popup_select.slint"; -export component ToolSettings inherits Rectangle { - width: 300px; - height: 300px; +component ComboBoxWrapper inherits HorizontalLayout { + in-out property text; + in-out property <[string]> model; + in-out property current_index; + spacing: 5px; + Text { + text <=> root.text; + vertical_alignment: TextVerticalAlignment.center; + } + ComboBox { + model: root.model; + current_index <=> root.current_index; + } +} + +component CheckBoxWrapper inherits CheckBox { - if GuiState.active_tab == CurrentTab.SimilarImages: VerticalLayout { - Text { - text: " Subsettings"; - font-size: 15px; +} + +component SubsettingsHeader inherits Text { + text: "Subsettings"; + font-size: 15px; +} + +component SliderWrapper inherits HorizontalLayout { + in-out property maximum; + in-out property value; + in-out property text; + in-out property end_text; + in-out property end_text_size; + spacing: 5px; + Text { + text: root.text; + } + Slider { + min-width: 30px; + minimum: 0; + maximum <=> root.maximum; + value <=> root.value; + } + Text { + text: root.end_text; + width: root.end_text_size; + } +} + +export component ToolSettings { + ScrollView { + if GuiState.active_tab == CurrentTab.SimilarImages: VerticalLayout { + spacing: 5px; + padding: 10px; + SubsettingsHeader { } + ComboBoxWrapper { + text: "Hash size"; + model: Settings.duplicate_sub_available_hash_size; + current_index: Settings.duplicate_sub_hash_size_index; + } + ComboBoxWrapper { + text: "Resize Algorithm"; + model: Settings.duplicate_sub_available_resize_algorithm; + current_index: Settings.duplicate_sub_resize_algorithm_index; + } + ComboBoxWrapper { + text: "Hash type"; + model: Settings.duplicate_sub_available_hash_type; + current_index: Settings.duplicate_sub_hash_type_index; + } + CheckBoxWrapper { + text: "Ignore same size"; + checked: Settings.duplicate_sub_ignore_same_size; + } + SliderWrapper { + text: "Max difference"; + end_text: "(" + round(Settings.duplicate_sub_current_similarity) + "/" + round(Settings.duplicate_sub_max_similarity) + ")"; + end_text_size: 40px; + maximum <=> Settings.duplicate_sub_max_similarity; + value <=> Settings.duplicate_sub_current_similarity; + } + Rectangle {} } } } \ No newline at end of file From 68fd7b9fa91197594963ae8d5503c69b05cc0c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sat, 2 Dec 2023 23:02:16 +0100 Subject: [PATCH 104/107] More --- Cargo.lock | 1 + czkawka_core/src/common.rs | 7 ++ krokiet/Cargo.toml | 1 + krokiet/src/connect_open.rs | 25 +++++++ krokiet/src/connect_scan.rs | 17 ++++- krokiet/src/set_initial_gui_info.rs | 22 +++++- krokiet/src/settings.rs | 109 +++++++++++++++++++++++++++- krokiet/ui/callabler.slint | 3 + krokiet/ui/settings.slint | 18 ++--- krokiet/ui/settings_list.slint | 20 +++++ krokiet/ui/tool_settings.slint | 20 ++--- 11 files changed, 221 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index be1ad3a3c..c5e1cbd94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3323,6 +3323,7 @@ dependencies = [ "i18n-embed", "i18n-embed-fl", "image", + "image_hasher", "log", "once_cell", "open", diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index a0df6aa57..7e5b5f0a8 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -100,6 +100,13 @@ pub fn get_default_number_of_threads() -> usize { pub fn set_number_of_threads(thread_number: usize) { NUMBER_OF_THREADS.set(thread_number); + let additional_message = if thread_number == 0 { + " (0 - means that all available threads will be used)" + } else { + "" + }; + debug!("Number of threads set to {thread_number}{additional_message}"); + rayon::ThreadPoolBuilder::new() .num_threads(get_number_of_threads()) .stack_size(DEFAULT_WORKER_THREAD_SIZE) diff --git a/krokiet/Cargo.toml b/krokiet/Cargo.toml index ba4cb0a54..e1365913f 100644 --- a/krokiet/Cargo.toml +++ b/krokiet/Cargo.toml @@ -34,6 +34,7 @@ serde_json = "1.0" humansize = "2.1" image = "0.24" directories-next = "2.0" +image_hasher = "1.2" # Translations i18n-embed = { version = "0.14", features = ["fluent-system", "desktop-requester"] } diff --git a/krokiet/src/connect_open.rs b/krokiet/src/connect_open.rs index 1b98363e6..d9e99b497 100644 --- a/krokiet/src/connect_open.rs +++ b/krokiet/src/connect_open.rs @@ -1,4 +1,6 @@ use crate::{Callabler, MainWindow}; +use directories_next::ProjectDirs; +use log::error; use slint::ComponentHandle; pub fn connect_open_items(app: &MainWindow) { @@ -11,4 +13,27 @@ pub fn connect_open_items(app: &MainWindow) { }; // TODO - this should be added to line edit }); + + app.global::().on_open_config_folder(move || { + let Some(dirs) = ProjectDirs::from("pl", "Qarmin", "Krokiet") else { + error!("Failed to open config folder"); + return; + }; + let config_folder = dirs.config_dir(); + if let Err(e) = open::that(config_folder) { + error!("Failed to open config folder {:?}: {e}", config_folder); + } + }); + + // Cache uses Czkawka name to easily change between apps + app.global::().on_open_cache_folder(move || { + let Some(dirs) = ProjectDirs::from("pl", "Qarmin", "Czkawka") else { + error!("Failed to open cache folder"); + return; + }; + let cache_folder = dirs.cache_dir(); + if let Err(e) = open::that(cache_folder) { + error!("Failed to open cache folder {:?}: {e}", cache_folder); + } + }); } diff --git a/krokiet/src/connect_scan.rs b/krokiet/src/connect_scan.rs index 8dfb00b38..7e3c83473 100644 --- a/krokiet/src/connect_scan.rs +++ b/krokiet/src/connect_scan.rs @@ -1,4 +1,4 @@ -use crate::settings::{collect_settings, SettingsCustom}; +use crate::settings::{collect_settings, SettingsCustom, ALLOWED_HASH_TYPE_VALUES, ALLOWED_RESIZE_ALGORITHM_VALUES}; use crate::{CurrentTab, GuiState, MainListModel, MainWindow, ProgressToSend}; use chrono::NaiveDateTime; use crossbeam_channel::{Receiver, Sender}; @@ -54,6 +54,21 @@ fn scan_similar_images(a: Weak, progress_sender: Sender(); app.global::().set_maximum_threads(threads as f32); + + let available_hash_size: Vec = ALLOWED_HASH_SIZE_VALUES + .iter() + .map(|(hash_size, _max_similarity)| hash_size.to_string().into()) + .collect::>(); + let available_resize_algorithm: Vec = ALLOWED_RESIZE_ALGORITHM_VALUES + .iter() + .map(|(_settings_key, gui_name, _filter_type)| (*gui_name).into()) + .collect::>(); + let available_hash_type: Vec = ALLOWED_HASH_TYPE_VALUES + .iter() + .map(|(_settings_key, gui_name, _hash_type)| (*gui_name).into()) + .collect::>(); + + settings.set_similar_images_sub_available_hash_size(VecModel::from_slice(&available_hash_size)); + settings.set_similar_images_sub_available_resize_algorithm(VecModel::from_slice(&available_resize_algorithm)); + settings.set_similar_images_sub_available_hash_type(VecModel::from_slice(&available_hash_type)); } diff --git a/krokiet/src/settings.rs b/krokiet/src/settings.rs index 1444ca783..1a5bc3317 100644 --- a/krokiet/src/settings.rs +++ b/krokiet/src/settings.rs @@ -4,7 +4,8 @@ use std::path::PathBuf; use directories_next::ProjectDirs; use home::home_dir; -use log::{debug, error, info}; +use image_hasher::{FilterType, HashAlg}; +use log::{debug, error, info, warn}; use serde::{Deserialize, Serialize}; use slint::{ComponentHandle, Model, ModelRc}; @@ -20,6 +21,26 @@ pub const DEFAULT_MAXIMUM_SIZE_KB: i32 = i32::MAX / 1024; pub const DEFAULT_MINIMUM_CACHE_SIZE: i32 = 256; pub const DEFAULT_MINIMUM_PREHASH_CACHE_SIZE: i32 = 256; +// (Hash size, Maximum difference) - Ehh... to simplify it, just use everywhere 40 as maximum similarity - for now I'm to lazy to change it, when hash size changes +// So if you want to change it, you need to change it in multiple places +pub const ALLOWED_HASH_SIZE_VALUES: &[(u8, u8)] = &[(8, 40), (16, 40), (32, 40), (64, 40)]; + +pub const ALLOWED_RESIZE_ALGORITHM_VALUES: &[(&str, &str, FilterType)] = &[ + ("lanczos3", "Lanczos3", FilterType::Lanczos3), + ("gaussian", "Gaussian", FilterType::Gaussian), + ("catmullrom", "CatmullRom", FilterType::CatmullRom), + ("triangle", "Triangle", FilterType::Triangle), + ("nearest", "Nearest", FilterType::Nearest), +]; + +pub const ALLOWED_HASH_TYPE_VALUES: &[(&str, &str, HashAlg)] = &[ + ("mean", "Mean", HashAlg::Mean), + ("gradient", "Gradient", HashAlg::Gradient), + ("blockhash", "BlockHash", HashAlg::Blockhash), + ("vertgradient", "VertGradient", HashAlg::VertGradient), + ("doublegradient", "DoubleGradient", HashAlg::DoubleGradient), +]; + #[derive(Debug, Clone, Serialize, Deserialize)] pub struct SettingsCustom { #[serde(default = "default_included_directories")] @@ -66,6 +87,20 @@ pub struct SettingsCustom { pub similar_videos_delete_outdated_entries: bool, #[serde(default = "ttrue")] pub similar_music_delete_outdated_entries: bool, + #[serde(default = "default_sub_hash_size")] + pub similar_images_sub_hash_size: u8, + #[serde(default = "default_hash_type")] + pub similar_images_sub_hash_type: String, + #[serde(default = "default_resize_algorithm")] + pub similar_images_sub_resize_algorithm: String, + #[serde(default)] + pub similar_images_sub_ignore_same_size: bool, + #[serde(default = "default_similarity")] + pub similar_images_sub_similarity: i32, +} + +pub fn default_similarity() -> i32 { + 10 } impl Default for SettingsCustom { @@ -338,6 +373,52 @@ pub fn set_settings_to_gui(app: &MainWindow, custom_settings: &SettingsCustom) { settings.set_similar_videos_delete_outdated_entries(custom_settings.similar_videos_delete_outdated_entries); settings.set_similar_music_delete_outdated_entries(custom_settings.similar_music_delete_outdated_entries); + let similar_images_sub_hash_size_idx = if let Some(idx) = ALLOWED_HASH_SIZE_VALUES + .iter() + .position(|(hash_size, _max_similarity)| *hash_size == custom_settings.similar_images_sub_hash_size) + { + idx + } else { + warn!( + "Value of hash size \"{}\" is invalid, setting it to default value", + custom_settings.similar_images_sub_hash_size + ); + 0 + }; + settings.set_similar_images_sub_hash_size_index(similar_images_sub_hash_size_idx as i32); + + let similar_images_sub_hash_type_idx = if let Some(idx) = ALLOWED_HASH_TYPE_VALUES + .iter() + .position(|(settings_key, _gui_name, _hash_type)| *settings_key == custom_settings.similar_images_sub_hash_type) + { + idx + } else { + warn!( + "Value of hash type \"{}\" is invalid, setting it to default value", + custom_settings.similar_images_sub_hash_type + ); + 0 + }; + settings.set_similar_images_sub_hash_type_index(similar_images_sub_hash_type_idx as i32); + + let similar_images_sub_resize_algorithm_idx = if let Some(idx) = ALLOWED_RESIZE_ALGORITHM_VALUES + .iter() + .position(|(settings_key, _gui_name, _resize_alg)| *settings_key == custom_settings.similar_images_sub_resize_algorithm) + { + idx + } else { + warn!( + "Value of resize algorithm \"{}\" is invalid, setting it to default value", + custom_settings.similar_images_sub_resize_algorithm + ); + 0 + }; + settings.set_similar_images_sub_resize_algorithm_index(similar_images_sub_resize_algorithm_idx as i32); + + settings.set_similar_images_sub_ignore_same_size(custom_settings.similar_images_sub_ignore_same_size); + settings.set_similar_images_sub_max_similarity(40.0); // TODO this is now set to stable 40 + settings.set_similar_images_sub_current_similarity(custom_settings.similar_images_sub_similarity as f32); + // Clear text app.global::().set_info_text("".into()); } @@ -380,6 +461,17 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { let similar_music_delete_outdated_entries = settings.get_similar_music_delete_outdated_entries(); + let similar_images_sub_hash_size_idx = settings.get_similar_images_sub_hash_size_index(); + let similar_images_sub_hash_size = ALLOWED_HASH_SIZE_VALUES[similar_images_sub_hash_size_idx as usize].0; + + let similar_images_sub_hash_type_idx = settings.get_similar_images_sub_hash_type_index(); + let similar_images_sub_hash_type = ALLOWED_HASH_TYPE_VALUES[similar_images_sub_hash_type_idx as usize].0.to_string(); + + let similar_images_sub_resize_algorithm_idx = settings.get_similar_images_sub_resize_algorithm_index(); + let similar_images_sub_resize_algorithm = ALLOWED_RESIZE_ALGORITHM_VALUES[similar_images_sub_resize_algorithm_idx as usize].0.to_string(); + + let similar_images_sub_ignore_same_size = settings.get_similar_images_sub_ignore_same_size(); + let similar_images_sub_similarity = settings.get_similar_images_sub_current_similarity().round() as i32; SettingsCustom { included_directories, excluded_directories, @@ -403,6 +495,11 @@ pub fn collect_settings(app: &MainWindow) -> SettingsCustom { similar_images_delete_outdated_entries, similar_videos_delete_outdated_entries, similar_music_delete_outdated_entries, + similar_images_sub_hash_size, + similar_images_sub_hash_type, + similar_images_sub_resize_algorithm, + similar_images_sub_ignore_same_size, + similar_images_sub_similarity, } } @@ -469,3 +566,13 @@ fn minimal_hash_cache_size() -> i32 { fn minimal_prehash_cache_size() -> i32 { DEFAULT_MINIMUM_PREHASH_CACHE_SIZE } + +pub fn default_resize_algorithm() -> String { + ALLOWED_RESIZE_ALGORITHM_VALUES[0].0.to_string() +} +pub fn default_hash_type() -> String { + ALLOWED_HASH_TYPE_VALUES[0].0.to_string() +} +pub fn default_sub_hash_size() -> u8 { + 16 +} diff --git a/krokiet/ui/callabler.slint b/krokiet/ui/callabler.slint index 767bf66bc..3d1516852 100644 --- a/krokiet/ui/callabler.slint +++ b/krokiet/ui/callabler.slint @@ -23,4 +23,7 @@ export global Callabler { // Only Slint callback open_select_popup(); + + callback open_config_folder(); + callback open_cache_folder(); } diff --git a/krokiet/ui/settings.slint b/krokiet/ui/settings.slint index 45c40530a..9a646f5bd 100644 --- a/krokiet/ui/settings.slint +++ b/krokiet/ui/settings.slint @@ -35,13 +35,13 @@ export global Settings { // Allowed subsettings // Duplicate - in-out property <[string]> duplicate_sub_available_hash_size: ["8", "16", "32", "64"]; - in-out property duplicate_sub_hash_size_index: 0; - in-out property <[string]> duplicate_sub_available_resize_algorithm: ["Lanczos3", "Nearest", "Triangle", "Gaussian", "CatmullRom"]; - in-out property duplicate_sub_resize_algorithm_index: 0; - in-out property <[string]> duplicate_sub_available_hash_type: ["Gradient", "Mean", "VertGradient", "BlockHash", "DoubleGradient"]; - in-out property duplicate_sub_hash_type_index: 0; - in-out property duplicate_sub_max_similarity: 40; - in-out property duplicate_sub_current_similarity: 20; - in-out property duplicate_sub_ignore_same_size; + in-out property <[string]> similar_images_sub_available_hash_size: ["8", "16", "32", "64"]; + in-out property similar_images_sub_hash_size_index: 0; + in-out property <[string]> similar_images_sub_available_resize_algorithm: ["Lanczos3", "Nearest", "Triangle", "Gaussian", "CatmullRom"]; + in-out property similar_images_sub_resize_algorithm_index: 0; + in-out property <[string]> similar_images_sub_available_hash_type: ["Gradient", "Mean", "VertGradient", "BlockHash", "DoubleGradient"]; + in-out property similar_images_sub_hash_type_index: 0; + in-out property similar_images_sub_max_similarity: 40; + in-out property similar_images_sub_current_similarity: 20; + in-out property similar_images_sub_ignore_same_size; } diff --git a/krokiet/ui/settings_list.slint b/krokiet/ui/settings_list.slint index 0d29b5bfb..c85c17bfb 100644 --- a/krokiet/ui/settings_list.slint +++ b/krokiet/ui/settings_list.slint @@ -154,6 +154,22 @@ component HeaderText inherits Text { vertical-alignment: TextVerticalAlignment.center; } +component ConfigCacheButtons inherits HorizontalLayout { + spacing: 20px; + Button { + text: "Open config folder"; + clicked => { + Callabler.open_config_folder(); + } + } + Button { + text: "Open cache folder"; + clicked => { + Callabler.open_cache_folder(); + } + } +} + export component SettingsList inherits VerticalLayout { preferred-height: 300px; preferred-width: 400px; @@ -169,6 +185,7 @@ export component SettingsList inherits VerticalLayout { ScrollView { VerticalLayout { padding-right: 15px; + padding-bottom: 10px; spacing: 5px; Presets{ height: SettingsSize.item_height; @@ -274,6 +291,9 @@ export component SettingsList inherits VerticalLayout { name: "Delete outdated entries"; model <=> Settings.similar_music_delete_outdated_entries; } + ConfigCacheButtons { + + } } } HorizontalLayout { diff --git a/krokiet/ui/tool_settings.slint b/krokiet/ui/tool_settings.slint index 12a6bd924..17e3083fc 100644 --- a/krokiet/ui/tool_settings.slint +++ b/krokiet/ui/tool_settings.slint @@ -69,29 +69,29 @@ export component ToolSettings { SubsettingsHeader { } ComboBoxWrapper { text: "Hash size"; - model: Settings.duplicate_sub_available_hash_size; - current_index: Settings.duplicate_sub_hash_size_index; + model: Settings.similar_images_sub_available_hash_size; + current_index: Settings.similar_images_sub_hash_size_index; } ComboBoxWrapper { text: "Resize Algorithm"; - model: Settings.duplicate_sub_available_resize_algorithm; - current_index: Settings.duplicate_sub_resize_algorithm_index; + model: Settings.similar_images_sub_available_resize_algorithm; + current_index: Settings.similar_images_sub_resize_algorithm_index; } ComboBoxWrapper { text: "Hash type"; - model: Settings.duplicate_sub_available_hash_type; - current_index: Settings.duplicate_sub_hash_type_index; + model: Settings.similar_images_sub_available_hash_type; + current_index: Settings.similar_images_sub_hash_type_index; } CheckBoxWrapper { text: "Ignore same size"; - checked: Settings.duplicate_sub_ignore_same_size; + checked: Settings.similar_images_sub_ignore_same_size; } SliderWrapper { text: "Max difference"; - end_text: "(" + round(Settings.duplicate_sub_current_similarity) + "/" + round(Settings.duplicate_sub_max_similarity) + ")"; + end_text: "(" + round(Settings.similar_images_sub_current_similarity) + "/" + round(Settings.similar_images_sub_max_similarity) + ")"; end_text_size: 40px; - maximum <=> Settings.duplicate_sub_max_similarity; - value <=> Settings.duplicate_sub_current_similarity; + maximum <=> Settings.similar_images_sub_max_similarity; + value <=> Settings.similar_images_sub_current_similarity; } Rectangle {} } From 0bee05f2a0fd56913ad5d4948c3f5e0851919a2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 3 Dec 2023 10:54:39 +0100 Subject: [PATCH 105/107] Update --- Cargo.lock | 34 ++++++------- czkawka_core/src/common.rs | 79 +++++++++++++++++++++++++++++-- czkawka_gui/src/help_functions.rs | 6 +-- krokiet/Cargo.toml | 1 + krokiet/src/common.rs | 26 ++++++++++ krokiet/src/connect_delete.rs | 44 +++++++++++++---- krokiet/src/main.rs | 14 +++--- krokiet/ui/action_buttons.slint | 1 + 8 files changed, 163 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5e1cbd94..ccfd7cce0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -256,11 +256,11 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" dependencies = [ - "async-lock 3.1.2", + "async-lock 3.2.0", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite 2.0.1", + "futures-lite 2.1.0", "slab", ] @@ -285,9 +285,9 @@ dependencies = [ "async-channel 2.1.1", "async-executor", "async-io 2.2.1", - "async-lock 3.1.2", + "async-lock 3.2.0", "blocking", - "futures-lite 2.0.1", + "futures-lite 2.1.0", "once_cell", ] @@ -317,11 +317,11 @@ version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" dependencies = [ - "async-lock 3.1.2", + "async-lock 3.2.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.0.1", + "futures-lite 2.1.0", "parking", "polling 3.3.1", "rustix 0.38.26", @@ -341,9 +341,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.1.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dea8b3453dd7cc96711834b75400d671b73e3656975fa68d9f277163b7f7e316" +checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" dependencies = [ "event-listener 4.0.0", "event-listener-strategy", @@ -616,11 +616,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ "async-channel 2.1.1", - "async-lock 3.1.2", + "async-lock 3.2.0", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite 2.0.1", + "futures-lite 2.1.0", "piper", "tracing", ] @@ -978,9 +978,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" dependencies = [ "crossbeam-utils", ] @@ -1393,9 +1393,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", ] @@ -2060,14 +2060,13 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3831c2651acb5177cbd83943f3d9c8912c5ad03c76afcc0e9511ba568ec5ebb" +checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" dependencies = [ "fastrand 2.0.1", "futures-core", "futures-io", - "memchr", "parking", "pin-project-lite", ] @@ -3328,6 +3327,7 @@ dependencies = [ "once_cell", "open", "rand", + "rayon", "rfd", "rust-embed", "serde", diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index 7e5b5f0a8..551939b47 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -21,8 +21,9 @@ use imagepipe::{ImageSource, Pipeline}; use libheif_rs::{ColorSpace, HeifContext, RgbChroma}; #[cfg(feature = "libraw")] use libraw::Processor; -use log::{debug, info, warn, LevelFilter, Record}; +use log::{debug, error, info, warn, LevelFilter, Record}; use rawloader::RawLoader; +use symphonia::core::conv::IntoSample; // #[cfg(feature = "heif")] // use libheif_rs::LibHeif; @@ -39,6 +40,11 @@ static NUMBER_OF_THREADS: state::InitCell = state::InitCell::new(); pub const DEFAULT_THREAD_SIZE: usize = 8 * 1024 * 1024; // 8 MB pub const DEFAULT_WORKER_THREAD_SIZE: usize = 4 * 1024 * 1024; // 4 MB +#[cfg(not(target_family = "windows"))] +pub const CHARACTER: char = '/'; +#[cfg(target_family = "windows")] +pub const CHARACTER: char = '\\'; + pub fn get_number_of_threads() -> usize { let data = NUMBER_OF_THREADS.get(); if *data >= 1 { @@ -146,6 +152,46 @@ pub const SEND_PROGRESS_DATA_TIME_BETWEEN: u32 = 200; //ms pub struct Common(); +pub fn remove_folder_if_contains_only_empty_folders(path: impl AsRef) -> bool { + let path = path.as_ref(); + if !path.is_dir() { + error!("Trying to remove folder which is not a directory"); + return false; + } + + let mut entries_to_check = Vec::new(); + let Ok(initial_entry) = path.read_dir() else { + return false; + }; + for entry in initial_entry { + if let Ok(entry) = entry { + entries_to_check.push(entry); + } else { + return false; + } + } + loop { + let Some(entry) = entries_to_check.pop() else { + break; + }; + if !entry.path().is_dir() { + return false; + } + let Ok(internal_read_dir) = entry.path().read_dir() else { + return false; + }; + for internal_elements in internal_read_dir { + if let Ok(internal_element) = internal_elements { + entries_to_check.push(internal_element); + } else { + return false; + } + } + } + + fs::remove_dir_all(path).is_ok() +} + pub fn open_cache_folder(cache_file_name: &str, save_to_cache: bool, use_json: bool, warnings: &mut Vec) -> Option<((Option, PathBuf), (Option, PathBuf))> { if let Some(proj_dirs) = ProjectDirs::from("pl", "Qarmin", "Czkawka") { let cache_dir = PathBuf::from(proj_dirs.cache_dir()); @@ -573,9 +619,36 @@ pub fn send_info_and_wait_for_ending_all_threads(progress_thread_run: &Arc usize { + match active_tab { + CurrentTab::EmptyFolders => 1, + CurrentTab::EmptyFiles => 1, + CurrentTab::SimilarImages => 4, + CurrentTab::Settings => panic!("Button should be disabled"), + } +} +pub fn get_name_idx(active_tab: CurrentTab) -> usize { + match active_tab { + CurrentTab::EmptyFolders => 0, + CurrentTab::EmptyFiles => 0, + CurrentTab::SimilarImages => 3, + CurrentTab::Settings => panic!("Button should be disabled"), + } +} +pub fn get_is_header_mode(active_tab: CurrentTab) -> bool { + match active_tab { + CurrentTab::EmptyFolders | CurrentTab::EmptyFiles => false, + CurrentTab::SimilarImages => true, + CurrentTab::Settings => panic!("Button should be disabled"), + } +} + // pub fn create_string_standard_list_view(items: &[String]) -> ModelRc { // let new_folders_standard_list_view = items // .iter() diff --git a/krokiet/src/connect_delete.rs b/krokiet/src/connect_delete.rs index 2d5bf5647..b278be568 100644 --- a/krokiet/src/connect_delete.rs +++ b/krokiet/src/connect_delete.rs @@ -1,7 +1,10 @@ use slint::{ComponentHandle, Model, ModelRc, VecModel}; +use crate::common::{get_is_header_mode, get_name_idx, get_path_idx}; use crate::{Callabler, CurrentTab, GuiState, MainListModel, MainWindow}; +use czkawka_core::common::{remove_folder_if_contains_only_empty_folders, CHARACTER}; use log::info; +use rayon::prelude::*; pub fn connect_delete_button(app: &MainWindow) { let a = app.as_weak(); @@ -17,7 +20,7 @@ pub fn connect_delete_button(app: &MainWindow) { CurrentTab::Settings => panic!("Button should be disabled"), }; - let new_model = handle_delete_items(&model, active_tab == CurrentTab::EmptyFolders); + let new_model = handle_delete_items(&model, active_tab); if let Some(new_model) = new_model { match active_tab { @@ -27,17 +30,19 @@ pub fn connect_delete_button(app: &MainWindow) { CurrentTab::Settings => panic!("Button should be disabled"), } } + + app.global::().set_preview_visible(false); }); } -fn handle_delete_items(items: &ModelRc, delete_empty_folders: bool) -> Option> { - let (entries_to_delete, mut entries_left) = filter_out_checked_items(items, false); +fn handle_delete_items(items: &ModelRc, active_tab: CurrentTab) -> Option> { + let (entries_to_delete, mut entries_left) = filter_out_checked_items(items, get_is_header_mode(active_tab)); if !entries_to_delete.is_empty() { - remove_selected_items(entries_to_delete, delete_empty_folders); + remove_selected_items(entries_to_delete, active_tab); deselect_all_items(&mut entries_left); - let r = ModelRc::new(VecModel::from(entries_left)); + let r = ModelRc::new(VecModel::from(entries_left)); // TODO here maybe should also stay old model if entries cannot be removed return Some(r); } None @@ -46,11 +51,30 @@ fn handle_delete_items(items: &ModelRc, delete_empty_folders: boo // TODO delete in parallel items, consider to add progress bar // For empty folders double check if folders are really empty - this function probably should be run in thread // and at the end should be send signal to main thread to update model -fn remove_selected_items(items: Vec, _delete_empty_folders: bool) { - info!("Items to remove {}", items.len()); - drop(items); - // drop(delete_empty_folders); - // items.into_iter().for_each(|_item| {}); +// TODO handle also situations where cannot delete file/folder +fn remove_selected_items(items: Vec, active_tab: CurrentTab) { + let path_idx = get_path_idx(active_tab); + let name_idx = get_name_idx(active_tab); + let items_to_remove = items + .iter() + .map(|item| { + let path = item.val.iter().nth(path_idx).unwrap(); + let name = item.val.iter().nth(name_idx).unwrap(); + format!("{}{}{}", path, CHARACTER, name) + }) + .collect::>(); + + info!("Removing items: {:?} {:?}", items_to_remove, active_tab); + // Iterate over empty folders and not delete them if they are not empty + if active_tab == CurrentTab::EmptyFolders { + items_to_remove.into_par_iter().for_each(|item| { + remove_folder_if_contains_only_empty_folders(item); + }); + } else { + items_to_remove.into_par_iter().for_each(|item| { + let _ = std::fs::remove_file(item); + }); + } } fn deselect_all_items(items: &mut [MainListModel]) { diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index f28016ff0..24acf4476 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -58,7 +58,7 @@ fn main() { let (progress_sender, progress_receiver): (Sender, Receiver) = unbounded(); let (stop_sender, stop_receiver): (Sender<()>, Receiver<()>) = unbounded(); - to_remove_debug(&app); + // to_remove_debug(&app); set_initial_gui_infos(&app); @@ -80,12 +80,12 @@ fn main() { save_all_settings_to_file(&app); } -// TODO remove this after debugging - or leave commented -pub fn to_remove_debug(app: &MainWindow) { - app.set_empty_folder_model(to_remove_create_without_header("@@").into()); - app.set_empty_files_model(to_remove_create_without_header("%%").into()); - app.set_similar_images_model(to_remove_create_with_header().into()); -} +// // TODO remove this after debugging - or leave commented +// pub fn to_remove_debug(app: &MainWindow) { +// app.set_empty_folder_model(to_remove_create_without_header("@@").into()); +// app.set_empty_files_model(to_remove_create_without_header("%%").into()); +// app.set_similar_images_model(to_remove_create_with_header().into()); +// } fn to_remove_create_with_header() -> Rc> { let header_row_data: Rc> = Rc::new(VecModel::default()); diff --git a/krokiet/ui/action_buttons.slint b/krokiet/ui/action_buttons.slint index 6f8fe4c78..996f6cb35 100644 --- a/krokiet/ui/action_buttons.slint +++ b/krokiet/ui/action_buttons.slint @@ -78,6 +78,7 @@ export component ActionButtons inherits HorizontalLayout { } select_button := Button { + visible: false; height: parent.height; enabled: !scanning && lists_enabled; text: "Select"; From b2891758a94b74dc6be494a730a9ebe99e545dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 3 Dec 2023 11:09:56 +0100 Subject: [PATCH 106/107] Eh.. --- krokiet/src/main.rs | 90 ++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 24acf4476..74b1550ff 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -87,48 +87,48 @@ fn main() { // app.set_similar_images_model(to_remove_create_with_header().into()); // } -fn to_remove_create_with_header() -> Rc> { - let header_row_data: Rc> = Rc::new(VecModel::default()); - for r in 0..10_000 { - let items = VecModel::default(); - - for c in 0..3 { - items.push(slint::format!("Item {r}.{c}")); - } - - let is_header = r % 3 == 0; - let is_checked = (r % 2 == 0) && !is_header; - - let item = MainListModel { - checked: is_checked, - header_row: is_header, - selected_row: false, - val: ModelRc::new(items), - }; - - header_row_data.push(item); - } - header_row_data -} -fn to_remove_create_without_header(s: &str) -> Rc> { - let non_header_row_data: Rc> = Rc::new(VecModel::default()); - for r in 0..100_000 { - let items = VecModel::default(); - - for c in 0..3 { - items.push(slint::format!("Item {r}.{c}.{s}")); - } - - let is_checked = r % 2 == 0; - - let item = MainListModel { - checked: is_checked, - header_row: false, - selected_row: false, - val: ModelRc::new(items), - }; - - non_header_row_data.push(item); - } - non_header_row_data -} +// fn to_remove_create_with_header() -> Rc> { +// let header_row_data: Rc> = Rc::new(VecModel::default()); +// for r in 0..10_000 { +// let items = VecModel::default(); +// +// for c in 0..3 { +// items.push(slint::format!("Item {r}.{c}")); +// } +// +// let is_header = r % 3 == 0; +// let is_checked = (r % 2 == 0) && !is_header; +// +// let item = MainListModel { +// checked: is_checked, +// header_row: is_header, +// selected_row: false, +// val: ModelRc::new(items), +// }; +// +// header_row_data.push(item); +// } +// header_row_data +// } +// fn to_remove_create_without_header(s: &str) -> Rc> { +// let non_header_row_data: Rc> = Rc::new(VecModel::default()); +// for r in 0..100_000 { +// let items = VecModel::default(); +// +// for c in 0..3 { +// items.push(slint::format!("Item {r}.{c}.{s}")); +// } +// +// let is_checked = r % 2 == 0; +// +// let item = MainListModel { +// checked: is_checked, +// header_row: false, +// selected_row: false, +// val: ModelRc::new(items), +// }; +// +// non_header_row_data.push(item); +// } +// non_header_row_data +// } From 9fef3b4692cfe614365d9f4ce1ff1e50dc0a81c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Sun, 3 Dec 2023 11:16:28 +0100 Subject: [PATCH 107/107] Eh2.. --- krokiet/src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/krokiet/src/main.rs b/krokiet/src/main.rs index 74b1550ff..612ffcd52 100644 --- a/krokiet/src/main.rs +++ b/krokiet/src/main.rs @@ -31,7 +31,7 @@ mod set_initial_gui_info; mod settings; use crossbeam_channel::{unbounded, Receiver, Sender}; -use std::rc::Rc; +// use std::rc::Rc; use crate::connect_delete::connect_delete_button; use crate::connect_open::connect_open_items; @@ -46,7 +46,7 @@ use crate::set_initial_gui_info::set_initial_gui_infos; use crate::settings::{connect_changing_settings_preset, create_default_settings_files, load_settings_from_file, save_all_settings_to_file}; use czkawka_core::common::{print_version_mode, setup_logger}; use czkawka_core::common_dir_traversal::ProgressData; -use slint::{ModelRc, VecModel}; +// use slint::{ModelRc, VecModel}; slint::include_modules!(); fn main() {