diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 92e141c3..6d32e35c 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -18,7 +18,10 @@ jobs: run: sudo apt update || true; sudo apt install -y libgtk-4-dev libraw-dev libheif-dev libavif-dev libdav1d-dev -y - name: Setup rust version - run: rustup default 1.85.0 + run: | + rustup default 1.85.0 + rustup component add rustfmt + rustup component add clippy - name: Check the format run: cargo fmt --all -- --check diff --git a/Changelog.md b/Changelog.md index ca306998..8cd2e370 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,14 +19,14 @@ - Using reusable and bigger buffer for reading files in duplicate mode - [#1425](https://github.com/qarmin/czkawka/pull/1425) - Option to use a lot of faster image resizing, to speedup image hashing - [#1458](https://github.com/qarmin/czkawka/pull/1458) - Added to logs info about os and compiled app features - [#1458](https://github.com/qarmin/czkawka/pull/1458) -- Added size progress in duplicate mode - [#1458](https://github.com/qarmin/czkawka/pull/1458) +- Added size progress in duplicate and similar images mode - [#1458](https://github.com/qarmin/czkawka/pull/1458) - Ability to stop calculating hash of bigger files in the middle of process - [#1458](https://github.com/qarmin/czkawka/pull/1458) - Using multithreading, to filter out hard links - [#1458](https://github.com/qarmin/czkawka/pull/1458) - Decreased prehash read file size to max 4k bytes - [#1458](https://github.com/qarmin/czkawka/pull/1458) ### Krokiet - Changed default tab to duplicate files - [#1368](https://github.com/qarmin/czkawka/pull/1368) -- Progress bar in duplicate mode, now shows progress of processed bytes, not files - [#1458](https://github.com/qarmin/czkawka/pull/1458) +- Progress bar in duplicate and similar images mode, now shows progress of processed bytes, not files - [#1458](https://github.com/qarmin/czkawka/pull/1458) ### GTK GUI - Added window icon in wayland - [#1400](https://github.com/qarmin/czkawka/pull/1400) diff --git a/czkawka_core/src/common.rs b/czkawka_core/src/common.rs index edc6020b..6692e93f 100644 --- a/czkawka_core/src/common.rs +++ b/czkawka_core/src/common.rs @@ -91,21 +91,24 @@ pub fn print_version_mode() { if cfg!(target_feature = "sse2") { app_cpu_version = "x86-64-v1 (SSE2)"; } - if cfg!(any(target_arch = "x86", target_arch = "x86_64")) && is_x86_feature_detected!("sse2") { + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + if is_x86_feature_detected!("sse2") { os_cpu_version = "x86-64-v1 (SSE2)"; } if cfg!(target_feature = "popcnt") { app_cpu_version = "x86-64-v2 (SSE4.2 + POPCNT)"; } - if cfg!(any(target_arch = "x86", target_arch = "x86_64")) && is_x86_feature_detected!("popcnt") { + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + if is_x86_feature_detected!("popcnt") { os_cpu_version = "x86-64-v2 (SSE4.2 + POPCNT)"; } if cfg!(target_feature = "avx2") { app_cpu_version = "x86-64-v3 (AVX2) or x86-64-v4 (AVX-512)"; } - if cfg!(any(target_arch = "x86", target_arch = "x86_64")) && is_x86_feature_detected!("avx2") { + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + if is_x86_feature_detected!("avx2") { os_cpu_version = "x86-64-v3 (AVX2)"; } @@ -115,7 +118,8 @@ pub fn print_version_mode() { if cfg!(target_feature = "avx512f") { app_cpu_version = "x86-64-v4 (AVX-512)"; } - if cfg!(any(target_arch = "x86", target_arch = "x86_64")) && is_x86_feature_detected!("avx512f") { + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] + if is_x86_feature_detected!("avx512f") { os_cpu_version = "x86-64-v4 (AVX-512)"; } diff --git a/czkawka_core/src/similar_images.rs b/czkawka_core/src/similar_images.rs index 54862f63..ab2e5c59 100644 --- a/czkawka_core/src/similar_images.rs +++ b/czkawka_core/src/similar_images.rs @@ -274,12 +274,12 @@ impl SimilarImages { let (loaded_hash_map, records_already_cached, non_cached_files_to_check) = self.hash_images_load_cache(); - let (progress_thread_handle, progress_thread_run, items_counter, check_was_stopped, _size_counter) = prepare_thread_handler_common( + let (progress_thread_handle, progress_thread_run, items_counter, check_was_stopped, size_counter) = prepare_thread_handler_common( progress_sender, CurrentStage::SimilarImagesCalculatingHashes, non_cached_files_to_check.len(), self.get_test_type(), - 0, + non_cached_files_to_check.values().map(|entry| entry.size).sum(), ); debug!("hash_images - start hashing images"); @@ -291,6 +291,7 @@ impl SimilarImages { check_was_stopped.store(true, Ordering::Relaxed); return None; } + size_counter.fetch_add(file_entry.size, Ordering::Relaxed); if let Err(e) = self.collect_image_file_entry(&mut file_entry) { return Some(Err(e)); } diff --git a/czkawka_gui/i18n/en/czkawka_gui.ftl b/czkawka_gui/i18n/en/czkawka_gui.ftl index 3a92f70f..05396e48 100644 --- a/czkawka_gui/i18n/en/czkawka_gui.ftl +++ b/czkawka_gui/i18n/en/czkawka_gui.ftl @@ -485,7 +485,7 @@ progress_scanning_general_file = {$file_number -> progress_scanning_extension_of_files = Checking extension of {$file_checked}/{$all_files} file progress_scanning_broken_files = Checking {$file_checked}/{$all_files} file progress_scanning_video = Hashing of {$file_checked}/{$all_files} video -progress_scanning_image = Hashing of {$file_checked}/{$all_files} image +progress_scanning_image = Hashing of {$file_checked}/{$all_files} image ({$data_checked}/{$all_data}) progress_comparing_image_hashes = Comparing {$file_checked}/{$all_files} image hash progress_scanning_music_tags_end = Comparing tags of {$file_checked}/{$all_files} music file progress_scanning_music_tags = Reading tags of {$file_checked}/{$all_files} music file diff --git a/czkawka_gui/src/connect_things/connect_progress_window.rs b/czkawka_gui/src/connect_things/connect_progress_window.rs index 400ca8ac..f2723e66 100644 --- a/czkawka_gui/src/connect_things/connect_progress_window.rs +++ b/czkawka_gui/src/connect_things/connect_progress_window.rs @@ -157,14 +157,21 @@ fn progress_default(gui_data: &GuiData, item: &ProgressData) { } fn common_set_data(item: &ProgressData, progress_bar_all_stages: &ProgressBar, progress_bar_current_stage: &ProgressBar, taskbar_state: &Rc>) { + let (current_items_checked, current_stage_items_to_check) = if item.bytes_to_check > 0 { + (item.bytes_checked, item.bytes_to_check) + } else { + (item.entries_checked as u64, item.entries_to_check as u64) + }; + if item.entries_to_check != 0 { - let all_stages = (item.current_stage_idx as f64 + item.entries_checked as f64 / item.entries_to_check as f64) / (item.max_stage_idx + 1) as f64; + let all_stages = (item.current_stage_idx as f64 + current_items_checked as f64 / current_stage_items_to_check as f64) / (item.max_stage_idx + 1) as f64; let all_stages = all_stages.min(0.99); progress_bar_all_stages.set_fraction(all_stages); - progress_bar_current_stage.set_fraction(item.entries_checked as f64 / item.entries_to_check as f64); + progress_bar_current_stage.set_fraction(current_items_checked as f64 / item.entries_to_check as f64); + taskbar_state.borrow().set_progress_value( - ((item.current_stage_idx as usize) * item.entries_to_check + item.entries_checked) as u64, - item.entries_to_check as u64 * (item.max_stage_idx + 1) as u64, + (item.current_stage_idx as u64) * current_stage_items_to_check + current_items_checked, + current_stage_items_to_check * (item.max_stage_idx + 1) as u64, ); } else { let all_stages = (item.current_stage_idx as f64) / (item.max_stage_idx + 1) as f64; diff --git a/krokiet/src/connect_progress_receiver.rs b/krokiet/src/connect_progress_receiver.rs index d64f3b89..2d61e088 100644 --- a/krokiet/src/connect_progress_receiver.rs +++ b/krokiet/src/connect_progress_receiver.rs @@ -95,7 +95,13 @@ fn progress_default(item: &ProgressData) -> ProgressToSend { format!("Comparing content of {}/{} audio file", item.entries_checked, item.entries_to_check) } CurrentStage::SimilarImagesCalculatingHashes => { - format!("Hashing of {}/{} image", item.entries_checked, item.entries_to_check) + format!( + "Hashing of {}/{} image ({}/{})", + item.entries_checked, + item.entries_to_check, + format_size(item.bytes_checked, BINARY), + format_size(item.bytes_to_check, BINARY) + ) } CurrentStage::SimilarImagesComparingHashes => { format!("Comparing {}/{} image hash", item.entries_checked, item.entries_to_check) @@ -148,11 +154,17 @@ fn no_current_stage_get_data(item: &ProgressData) -> (i32, i32) { // 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, i32) { + let (current_items_checked, current_stage_items_to_check) = if item.bytes_to_check > 0 { + (item.bytes_checked, item.bytes_to_check) + } else { + (item.entries_checked as u64, item.entries_to_check as u64) + }; + if item.entries_to_check != 0 { - let all_stages = (item.current_stage_idx as f64 + item.entries_checked as f64 / item.entries_to_check as f64) / (item.max_stage_idx + 1) as f64; + let all_stages = (item.current_stage_idx as f64 + current_items_checked as f64 / current_stage_items_to_check as f64) / (item.max_stage_idx + 1) as f64; let all_stages = all_stages.min(0.99); - let current_stage = item.entries_checked as f64 / item.entries_to_check as f64; + let current_stage = current_items_checked as f64 / current_stage_items_to_check as f64; let current_stage = current_stage.min(0.99); let current_stage_size = if item.bytes_to_check != 0 { diff --git a/krokiet/ui/progress.slint b/krokiet/ui/progress.slint index 364b7c7d..ed69cd23 100644 --- a/krokiet/ui/progress.slint +++ b/krokiet/ui/progress.slint @@ -55,7 +55,7 @@ export component Progress { Text { visible: progress_datas.current_progress >= -0.001; vertical-alignment: TextVerticalAlignment.center; - text: progress_datas.current_progress + "%"; + text: (progress_datas.current_progress_size == -1 ? progress_datas.current_progress : progress_datas.current_progress_size) + "%"; } Text {