Make UI take less space (#500)

pull/501/head
Rafał Mikrut 1 year ago committed by GitHub
parent 89f24f14b5
commit 975b285c1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -91,31 +91,31 @@ 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 |
| | Czkawka | FSlint | DupeGuru | Bleachbit |
|:----------------------:|:-----------:|:----------:|:-----------------:|:-----------:|
| Language | Rust | Python | Python/Obj-C | Python |
| Language | Rust | Python | Python/Obj-C | Python |
| OS | Lin,Mac,Win | Lin | Lin,Mac,Win | Lin,Mac,Win |
| Framework | GTK 3 | 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 | | • | | |
| Framework | GTK 3 | 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 | | • | | |
| Installed packages | | • | | |
| Invalid names | | • | | |
| Bad ID | | • | | |
| Non stripped binaries | | • | | |
| Redundant whitespace | | • | | |
| Overwriting files | | • | | • |
| Multiple languages(po) | | • | • | • |
| Cache support | | | • | |
| In active development | Yes | No | Yes | Yes |
| Multiple languages(po) | • | • | • | • |
| 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.

@ -36,7 +36,7 @@ pub struct ProgressData {
pub files_to_check: usize,
}
#[derive(PartialEq, Eq, Clone, Debug)]
#[derive(PartialEq, Eq, Clone, Debug, Copy)]
pub enum CheckingMethod {
None,
Name,
@ -502,7 +502,7 @@ impl DuplicateFinder {
let progress_send = progress_sender.clone();
let progress_thread_run = progress_thread_run.clone();
let atomic_file_counter = atomic_file_counter.clone();
let checking_method = self.check_method.clone();
let checking_method = self.check_method;
let max_stage = match self.check_method {
CheckingMethod::Size => 0,
CheckingMethod::Hash => 2,
@ -511,7 +511,7 @@ impl DuplicateFinder {
progress_thread_handle = thread::spawn(move || loop {
progress_send
.unbounded_send(ProgressData {
checking_method: checking_method.clone(),
checking_method,
current_stage: 0,
max_stage,
files_checked: atomic_file_counter.load(Ordering::Relaxed) as usize,
@ -688,11 +688,11 @@ impl DuplicateFinder {
let progress_thread_run = progress_thread_run.clone();
let atomic_file_counter = atomic_file_counter.clone();
let files_to_check = self.files_with_identical_size.iter().map(|e| e.1.len()).sum();
let checking_method = self.check_method.clone();
let checking_method = self.check_method;
progress_thread_handle = thread::spawn(move || loop {
progress_send
.unbounded_send(ProgressData {
checking_method: checking_method.clone(),
checking_method,
current_stage: 1,
max_stage: 2,
files_checked: atomic_file_counter.load(Ordering::Relaxed) as usize,
@ -855,11 +855,11 @@ impl DuplicateFinder {
let progress_thread_run = progress_thread_run.clone();
let atomic_file_counter = atomic_file_counter.clone();
let files_to_check = pre_checked_map.iter().map(|(_size, vec_file_entry)| vec_file_entry.len()).sum();
let checking_method = self.check_method.clone();
let checking_method = self.check_method;
progress_thread_handle = thread::spawn(move || loop {
progress_send
.unbounded_send(ProgressData {
checking_method: checking_method.clone(),
checking_method,
current_stage: 2,
max_stage: 2,
files_checked: atomic_file_counter.load(Ordering::Relaxed) as usize,

@ -14,10 +14,12 @@ use czkawka_core::same_music::MusicSimilarity;
use czkawka_core::similar_images;
use crate::gui_data::GuiData;
use crate::help_combo_box::IMAGES_HASH_SIZE_COMBO_BOX;
use crate::help_functions::*;
use crate::notebook_enums::*;
pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<Message>) {
let combo_box_image_hash_size = gui_data.main_notebook.combo_box_image_hash_size.clone();
let buttons_search = gui_data.bottom_buttons.buttons_search.clone();
let notebook_main = gui_data.main_notebook.notebook_main.clone();
let entry_info = gui_data.entry_info.clone();
@ -47,10 +49,6 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
let buttons_names = gui_data.bottom_buttons.buttons_names.clone();
let window_progress = gui_data.progress_window.window_progress.clone();
let taskbar_state = gui_data.taskbar_state.clone();
let radio_button_similar_hash_size_8 = gui_data.main_notebook.radio_button_similar_hash_size_8.clone();
let radio_button_similar_hash_size_16 = gui_data.main_notebook.radio_button_similar_hash_size_16.clone();
let radio_button_similar_hash_size_32 = gui_data.main_notebook.radio_button_similar_hash_size_32.clone();
let radio_button_similar_hash_size_64 = gui_data.main_notebook.radio_button_similar_hash_size_64.clone();
let notebook_upper = gui_data.upper_notebook.notebook_upper.clone();
let button_settings = gui_data.header.button_settings.clone();
let button_app_info = gui_data.header.button_app_info.clone();
@ -70,18 +68,8 @@ pub fn connect_compute_results(gui_data: &GuiData, glib_stop_receiver: Receiver<
taskbar_state.borrow().hide();
let hash_size;
if radio_button_similar_hash_size_8.is_active() {
hash_size = 8;
} else if radio_button_similar_hash_size_16.is_active() {
hash_size = 16;
} else if radio_button_similar_hash_size_32.is_active() {
hash_size = 32;
} else if radio_button_similar_hash_size_64.is_active() {
hash_size = 64;
} else {
panic!("No radio button is pressed");
}
let hash_size_index = combo_box_image_hash_size.active().unwrap() as usize;
let hash_size = IMAGES_HASH_SIZE_COMBO_BOX[hash_size_index] as u8;
match msg {
Message::Duplicates(df) => {

@ -4,12 +4,11 @@ use std::thread;
use glib::Sender;
use gtk::prelude::*;
use img_hash::{FilterType, HashAlg};
use crate::fl;
use czkawka_core::big_file::BigFile;
use czkawka_core::broken_files::BrokenFiles;
use czkawka_core::duplicate::{DuplicateFinder, HashType};
use czkawka_core::duplicate::DuplicateFinder;
use czkawka_core::empty_files::EmptyFiles;
use czkawka_core::empty_folder::EmptyFolder;
use czkawka_core::invalid_symlinks::InvalidSymlinks;
@ -20,6 +19,7 @@ use czkawka_core::temporary::Temporary;
use czkawka_core::*;
use crate::gui_data::GuiData;
use crate::help_combo_box::{DUPLICATES_CHECK_METHOD_COMBO_BOX, DUPLICATES_HASH_TYPE_COMBO_BOX, IMAGES_HASH_SIZE_COMBO_BOX, IMAGES_HASH_TYPE_COMBO_BOX, IMAGES_RESIZE_ALGORITHM_COMBO_BOX};
use crate::help_functions::*;
use crate::notebook_enums::*;
use crate::taskbar_progress::tbp_flags::TBPF_NOPROGRESS;
@ -39,6 +39,11 @@ pub fn connect_button_search(
futures_sender_invalid_symlinks: futures::channel::mpsc::UnboundedSender<invalid_symlinks::ProgressData>,
futures_sender_broken_files: futures::channel::mpsc::UnboundedSender<broken_files::ProgressData>,
) {
let combo_box_image_hash_size = gui_data.main_notebook.combo_box_image_hash_size.clone();
let combo_box_image_hash_algorithm = gui_data.main_notebook.combo_box_image_hash_algorithm.clone();
let combo_box_image_resize_algorithm = gui_data.main_notebook.combo_box_image_resize_algorithm.clone();
let combo_box_duplicate_check_method = gui_data.main_notebook.combo_box_duplicate_check_method.clone();
let combo_box_duplicate_hash_type = gui_data.main_notebook.combo_box_duplicate_hash_type.clone();
let buttons_array = gui_data.bottom_buttons.buttons_array.clone();
let check_button_image_ignore_same_size = gui_data.main_notebook.check_button_image_ignore_same_size.clone();
let buttons_names = gui_data.bottom_buttons.buttons_names.clone();
@ -57,17 +62,11 @@ pub fn connect_button_search(
let check_button_settings_use_cache = gui_data.settings.check_button_settings_use_cache.clone();
let entry_allowed_extensions = gui_data.upper_notebook.entry_allowed_extensions.clone();
let entry_big_files_number = gui_data.main_notebook.entry_big_files_number.clone();
let entry_duplicate_maximal_size = gui_data.main_notebook.entry_duplicate_maximal_size.clone();
let entry_duplicate_minimal_size = gui_data.main_notebook.entry_duplicate_minimal_size.clone();
let entry_excluded_items = gui_data.upper_notebook.entry_excluded_items.clone();
let entry_same_music_maximal_size = gui_data.main_notebook.entry_same_music_maximal_size.clone();
let entry_same_music_minimal_size = gui_data.main_notebook.entry_same_music_minimal_size.clone();
let entry_general_maximal_size = gui_data.upper_notebook.entry_general_maximal_size.clone();
let entry_general_minimal_size = gui_data.upper_notebook.entry_general_minimal_size.clone();
let entry_settings_cache_file_minimal_size = gui_data.settings.entry_settings_cache_file_minimal_size.clone();
let entry_settings_prehash_cache_file_minimal_size = gui_data.settings.entry_settings_prehash_cache_file_minimal_size.clone();
let entry_similar_images_maximal_size = gui_data.main_notebook.entry_similar_images_maximal_size.clone();
let entry_similar_images_minimal_size = gui_data.main_notebook.entry_similar_images_minimal_size.clone();
let entry_similar_videos_maximal_size = gui_data.main_notebook.entry_similar_videos_maximal_size.clone();
let entry_similar_videos_minimal_size = gui_data.main_notebook.entry_similar_videos_minimal_size.clone();
let grid_progress_stages = gui_data.progress_window.grid_progress_stages.clone();
let image_preview_similar_images = gui_data.main_notebook.image_preview_similar_images.clone();
let label_stage = gui_data.progress_window.label_stage.clone();
@ -75,26 +74,6 @@ pub fn connect_button_search(
let notebook_upper = gui_data.upper_notebook.notebook_upper.clone();
let progress_bar_all_stages = gui_data.progress_window.progress_bar_all_stages.clone();
let progress_bar_current_stage = gui_data.progress_window.progress_bar_current_stage.clone();
let radio_button_duplicates_hash = gui_data.main_notebook.radio_button_duplicates_hash.clone();
let radio_button_duplicates_name = gui_data.main_notebook.radio_button_duplicates_name.clone();
let radio_button_duplicates_size = gui_data.main_notebook.radio_button_duplicates_size.clone();
let radio_button_hash_type_blake3 = gui_data.main_notebook.radio_button_hash_type_blake3.clone();
let radio_button_hash_type_crc32 = gui_data.main_notebook.radio_button_hash_type_crc32.clone();
let radio_button_hash_type_xxh3 = gui_data.main_notebook.radio_button_hash_type_xxh3.clone();
let radio_button_resize_algorithm_catmullrom = gui_data.main_notebook.radio_button_resize_algorithm_catmullrom.clone();
let radio_button_resize_algorithm_gaussian = gui_data.main_notebook.radio_button_resize_algorithm_gaussian.clone();
let radio_button_resize_algorithm_lanczos3 = gui_data.main_notebook.radio_button_resize_algorithm_lanczos3.clone();
let radio_button_resize_algorithm_nearest = gui_data.main_notebook.radio_button_resize_algorithm_nearest.clone();
let radio_button_resize_algorithm_triangle = gui_data.main_notebook.radio_button_resize_algorithm_triangle.clone();
let radio_button_similar_hash_algorithm_blockhash = gui_data.main_notebook.radio_button_similar_hash_algorithm_blockhash.clone();
let radio_button_similar_hash_algorithm_doublegradient = gui_data.main_notebook.radio_button_similar_hash_algorithm_doublegradient.clone();
let radio_button_similar_hash_algorithm_gradient = gui_data.main_notebook.radio_button_similar_hash_algorithm_gradient.clone();
let radio_button_similar_hash_algorithm_mean = gui_data.main_notebook.radio_button_similar_hash_algorithm_mean.clone();
let radio_button_similar_hash_algorithm_vertgradient = gui_data.main_notebook.radio_button_similar_hash_algorithm_vertgradient.clone();
let radio_button_similar_hash_size_16 = gui_data.main_notebook.radio_button_similar_hash_size_16.clone();
let radio_button_similar_hash_size_32 = gui_data.main_notebook.radio_button_similar_hash_size_32.clone();
let radio_button_similar_hash_size_64 = gui_data.main_notebook.radio_button_similar_hash_size_64.clone();
let radio_button_similar_hash_size_8 = gui_data.main_notebook.radio_button_similar_hash_size_8.clone();
let scale_similarity_similar_images = gui_data.main_notebook.scale_similarity_similar_images.clone();
let scale_similarity_similar_videos = gui_data.main_notebook.scale_similarity_similar_videos.clone();
let shared_buttons = gui_data.shared_buttons.clone();
@ -157,29 +136,14 @@ pub fn connect_button_search(
get_list_store(&tree_view_duplicate_finder).clear();
let check_method;
if radio_button_duplicates_name.is_active() {
check_method = duplicate::CheckingMethod::Name;
} else if radio_button_duplicates_size.is_active() {
check_method = duplicate::CheckingMethod::Size;
} else if radio_button_duplicates_hash.is_active() {
check_method = duplicate::CheckingMethod::Hash;
} else {
panic!("No radio button is pressed");
}
let minimal_file_size = entry_duplicate_minimal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 8);
let maximal_file_size = entry_duplicate_maximal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 1024 * 1024 * 1024);
let hash_type: HashType;
if radio_button_hash_type_blake3.is_active() {
hash_type = duplicate::HashType::Blake3;
} else if radio_button_hash_type_crc32.is_active() {
hash_type = duplicate::HashType::Crc32;
} else if radio_button_hash_type_xxh3.is_active() {
hash_type = duplicate::HashType::Xxh3;
} else {
panic!("No radio button is pressed");
}
let check_method_index = combo_box_duplicate_check_method.active().unwrap() as usize;
let check_method = DUPLICATES_CHECK_METHOD_COMBO_BOX[check_method_index].check_method;
let hash_type_index = combo_box_duplicate_hash_type.active().unwrap() as usize;
let hash_type = DUPLICATES_HASH_TYPE_COMBO_BOX[hash_type_index].hash_type;
let minimal_file_size = entry_general_minimal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 8);
let maximal_file_size = entry_general_maximal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 1024 * 1024 * 1024);
let use_prehash_cache = check_button_duplicates_use_prehash_cache.is_active();
let minimal_prehash_cache_file_size = entry_settings_prehash_cache_file_minimal_size.text().as_str().parse::<u64>().unwrap_or(0);
@ -300,51 +264,17 @@ pub fn connect_button_search(
get_list_store(&tree_view_similar_images_finder).clear();
let hash_size;
if radio_button_similar_hash_size_8.is_active() {
hash_size = 8;
} else if radio_button_similar_hash_size_16.is_active() {
hash_size = 16;
} else if radio_button_similar_hash_size_32.is_active() {
hash_size = 32;
} else if radio_button_similar_hash_size_64.is_active() {
hash_size = 64;
} else {
panic!("No radio button is pressed");
}
let hash_size_index = combo_box_image_hash_size.active().unwrap() as usize;
let hash_size = IMAGES_HASH_SIZE_COMBO_BOX[hash_size_index] as u8;
let image_filter;
if radio_button_resize_algorithm_catmullrom.is_active() {
image_filter = FilterType::CatmullRom;
} else if radio_button_resize_algorithm_lanczos3.is_active() {
image_filter = FilterType::Lanczos3;
} else if radio_button_resize_algorithm_nearest.is_active() {
image_filter = FilterType::Nearest;
} else if radio_button_resize_algorithm_triangle.is_active() {
image_filter = FilterType::Triangle;
} else if radio_button_resize_algorithm_gaussian.is_active() {
image_filter = FilterType::Gaussian;
} else {
panic!("No radio button is pressed");
}
let image_filter_index = combo_box_image_resize_algorithm.active().unwrap() as usize;
let image_filter = IMAGES_RESIZE_ALGORITHM_COMBO_BOX[image_filter_index].filter;
let hash_alg;
if radio_button_similar_hash_algorithm_blockhash.is_active() {
hash_alg = HashAlg::Blockhash;
} else if radio_button_similar_hash_algorithm_gradient.is_active() {
hash_alg = HashAlg::Gradient;
} else if radio_button_similar_hash_algorithm_mean.is_active() {
hash_alg = HashAlg::Mean;
} else if radio_button_similar_hash_algorithm_vertgradient.is_active() {
hash_alg = HashAlg::VertGradient;
} else if radio_button_similar_hash_algorithm_doublegradient.is_active() {
hash_alg = HashAlg::DoubleGradient;
} else {
panic!("No radio button is pressed");
}
let hash_alg_index = combo_box_image_hash_algorithm.active().unwrap() as usize;
let hash_alg = IMAGES_HASH_TYPE_COMBO_BOX[hash_alg_index].hash_alg;
let minimal_file_size = entry_similar_images_minimal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 16);
let maximal_file_size = entry_similar_images_maximal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 1024 * 1024 * 1024);
let minimal_file_size = entry_general_minimal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 16);
let maximal_file_size = entry_general_maximal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 1024 * 1024 * 1024);
let ignore_same_size = check_button_image_ignore_same_size.is_active();
@ -381,8 +311,8 @@ pub fn connect_button_search(
get_list_store(&tree_view_similar_videos_finder).clear();
let minimal_file_size = entry_similar_videos_minimal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 16);
let maximal_file_size = entry_similar_videos_maximal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 1024 * 1024 * 1024);
let minimal_file_size = entry_general_minimal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 16);
let maximal_file_size = entry_general_maximal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 1024 * 1024 * 1024);
let tolerance = scale_similarity_similar_videos.value() as i32;
@ -413,8 +343,8 @@ pub fn connect_button_search(
get_list_store(&tree_view_same_music_finder).clear();
let minimal_file_size = entry_same_music_minimal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 8);
let maximal_file_size = entry_same_music_maximal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 1024 * 1024 * 1024);
let minimal_file_size = entry_general_minimal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 8);
let maximal_file_size = entry_general_maximal_size.text().as_str().parse::<u64>().unwrap_or(1024 * 1024 * 1024 * 1024);
let approximate_comparison = check_button_music_approximate_comparison.is_active();
let mut music_similarity: MusicSimilarity = MusicSimilarity::NONE;

@ -1,21 +1,18 @@
use czkawka_core::duplicate::CheckingMethod;
use gtk::prelude::*;
use crate::gui_data::GuiData;
use crate::help_combo_box::DUPLICATES_CHECK_METHOD_COMBO_BOX;
pub fn connect_duplicate_buttons(gui_data: &GuiData) {
let radio_button_duplicates_hash = gui_data.main_notebook.radio_button_duplicates_hash.clone();
let radio_button_hash_type_blake3 = gui_data.main_notebook.radio_button_hash_type_blake3.clone();
let radio_button_hash_type_xxh3 = gui_data.main_notebook.radio_button_hash_type_xxh3.clone();
let radio_button_hash_type_crc32 = gui_data.main_notebook.radio_button_hash_type_crc32.clone();
radio_button_duplicates_hash.connect_toggled(move |radio_button_duplicates_hash| {
if radio_button_duplicates_hash.is_active() {
radio_button_hash_type_blake3.set_sensitive(true);
radio_button_hash_type_xxh3.set_sensitive(true);
radio_button_hash_type_crc32.set_sensitive(true);
pub fn connect_duplicate_combo_box(gui_data: &GuiData) {
let combo_box_duplicate_check_method = gui_data.main_notebook.combo_box_duplicate_check_method.clone();
let combo_box_duplicate_hash_type = gui_data.main_notebook.combo_box_duplicate_hash_type.clone();
combo_box_duplicate_check_method.connect_changed(move |combo_box_duplicate_check_method| {
let chosen_index = combo_box_duplicate_check_method.active().unwrap() as usize;
if DUPLICATES_CHECK_METHOD_COMBO_BOX[chosen_index].check_method == CheckingMethod::Hash {
combo_box_duplicate_hash_type.set_sensitive(true);
} else {
radio_button_hash_type_blake3.set_sensitive(false);
radio_button_hash_type_xxh3.set_sensitive(false);
radio_button_hash_type_crc32.set_sensitive(false);
combo_box_duplicate_hash_type.set_sensitive(false);
}
});
}

@ -3,49 +3,40 @@ use gtk::prelude::*;
use czkawka_core::similar_images::{get_string_from_similarity, Similarity, SIMILAR_VALUES};
use crate::gui_data::GuiData;
use crate::help_combo_box::IMAGES_HASH_SIZE_COMBO_BOX;
pub fn connect_similar_image_size_change(gui_data: &GuiData) {
let label_similar_images_minimal_similarity = gui_data.main_notebook.label_similar_images_minimal_similarity.clone();
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[0][5]), 8));
{
let radio_button_similar_hash_size_8 = gui_data.main_notebook.radio_button_similar_hash_size_8.clone();
let label_similar_images_minimal_similarity = gui_data.main_notebook.label_similar_images_minimal_similarity.clone();
let scale_similarity_similar_images = gui_data.main_notebook.scale_similarity_similar_images.clone();
radio_button_similar_hash_size_8.connect_toggled(move |_| {
scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[0][5] as f64);
scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[0][5] as f64);
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[0][5]), 8));
});
}
{
let radio_button_similar_hash_size_16 = gui_data.main_notebook.radio_button_similar_hash_size_16.clone();
let label_similar_images_minimal_similarity = gui_data.main_notebook.label_similar_images_minimal_similarity.clone();
let scale_similarity_similar_images = gui_data.main_notebook.scale_similarity_similar_images.clone();
radio_button_similar_hash_size_16.connect_toggled(move |_| {
scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[1][5] as f64);
scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[1][5] as f64);
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[1][5]), 16));
});
}
{
let radio_button_similar_hash_size_32 = gui_data.main_notebook.radio_button_similar_hash_size_32.clone();
let label_similar_images_minimal_similarity = gui_data.main_notebook.label_similar_images_minimal_similarity.clone();
let scale_similarity_similar_images = gui_data.main_notebook.scale_similarity_similar_images.clone();
radio_button_similar_hash_size_32.connect_toggled(move |_| {
scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[2][5] as f64);
scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[2][5] as f64);
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[2][5]), 32));
});
}
{
let radio_button_similar_hash_size_64 = gui_data.main_notebook.radio_button_similar_hash_size_64.clone();
let label_similar_images_minimal_similarity = gui_data.main_notebook.label_similar_images_minimal_similarity.clone();
let scale_similarity_similar_images = gui_data.main_notebook.scale_similarity_similar_images.clone();
radio_button_similar_hash_size_64.connect_toggled(move |_| {
scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[3][5] as f64);
scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[3][5] as f64);
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[3][5]), 64));
});
}
let combo_box_image_hash_size = gui_data.main_notebook.combo_box_image_hash_size.clone();
let label_similar_images_minimal_similarity = gui_data.main_notebook.label_similar_images_minimal_similarity.clone();
let scale_similarity_similar_images = gui_data.main_notebook.scale_similarity_similar_images.clone();
combo_box_image_hash_size.connect_changed(move |combo_box_image_hash_size| {
let hash_size_index = combo_box_image_hash_size.active().unwrap() as usize;
let hash_size = IMAGES_HASH_SIZE_COMBO_BOX[hash_size_index];
match hash_size {
8 => {
scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[0][5] as f64);
scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[0][5] as f64);
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[0][5]), 8));
}
16 => {
scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[1][5] as f64);
scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[1][5] as f64);
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[1][5]), 16));
}
32 => {
scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[2][5] as f64);
scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[2][5] as f64);
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[2][5]), 32));
}
64 => {
scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[3][5] as f64);
scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[3][5] as f64);
label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[3][5]), 64));
}
_ => panic!(),
}
});
}

@ -1,4 +1,6 @@
use crate::fl;
use crate::help_combo_box::IMAGES_HASH_SIZE_COMBO_BOX;
use czkawka_core::similar_images::{get_string_from_similarity, Similarity, SIMILAR_VALUES};
use gtk::prelude::*;
use gtk::{EventControllerKey, TreeView};
@ -30,7 +32,8 @@ pub struct GuiMainNotebook {
pub tree_view_invalid_symlinks: gtk::TreeView,
pub tree_view_broken_files: gtk::TreeView,
pub evk_tree_view_duplicate_finder: gtk::EventControllerKey, // TODO, in GTK4 this can be changed to e.g. add_controller which is not 100% compatible with this - https://discourse.gnome.org/t/how-to-convert-code-to-use-eventcontrollerkey/8198/2
// TODO, in GTK4 this can be changed to e.g. add_controller which is not 100% compatible with this - https://discourse.gnome.org/t/how-to-convert-code-to-use-eventcontrollerkey/8198/2
pub evk_tree_view_duplicate_finder: gtk::EventControllerKey,
pub evk_tree_view_empty_folder_finder: gtk::EventControllerKey,
pub evk_tree_view_empty_files_finder: gtk::EventControllerKey,
pub evk_tree_view_temporary_files_finder: gtk::EventControllerKey,
@ -41,85 +44,54 @@ pub struct GuiMainNotebook {
pub evk_tree_view_invalid_symlinks: gtk::EventControllerKey,
pub evk_tree_view_broken_files: gtk::EventControllerKey,
pub entry_similar_images_minimal_size: gtk::Entry,
pub entry_similar_images_maximal_size: gtk::Entry,
pub entry_similar_videos_minimal_size: gtk::Entry,
pub entry_similar_videos_maximal_size: gtk::Entry,
pub entry_duplicate_minimal_size: gtk::Entry,
pub entry_duplicate_maximal_size: gtk::Entry,
pub entry_same_music_minimal_size: gtk::Entry,
pub entry_same_music_maximal_size: gtk::Entry,
// General
pub entry_big_files_number: gtk::Entry,
// Duplicate
pub combo_box_duplicate_check_method: gtk::ComboBoxText,
pub combo_box_duplicate_hash_type: gtk::ComboBoxText,
pub label_duplicate_check_method: gtk::Label,
pub label_duplicate_hash_type: gtk::Label,
//// Check Buttons
pub check_button_music_title: gtk::CheckButton,
pub check_button_music_artist: gtk::CheckButton,
pub check_button_music_album_title: gtk::CheckButton,
pub check_button_music_album_artist: gtk::CheckButton,
pub check_button_music_year: gtk::CheckButton,
pub check_button_music_approximate_comparison: gtk::CheckButton,
pub image_preview_duplicates: gtk::Image,
//// Radio Buttons
// Duplicates
pub radio_button_duplicates_name: gtk::RadioButton,
pub radio_button_duplicates_size: gtk::RadioButton,
pub radio_button_duplicates_hash: gtk::RadioButton,
// Big file
pub label_big_shown_files: gtk::Label,
pub entry_big_files_number: gtk::Entry,
// Similar Images
pub scale_similarity_similar_images: gtk::Scale,
pub scale_similarity_similar_videos: gtk::Scale,
pub radio_button_hash_type_blake3: gtk::RadioButton,
pub radio_button_hash_type_crc32: gtk::RadioButton,
pub radio_button_hash_type_xxh3: gtk::RadioButton,
pub radio_button_resize_algorithm_lanczos3: gtk::RadioButton,
pub radio_button_resize_algorithm_nearest: gtk::RadioButton,
pub radio_button_resize_algorithm_triangle: gtk::RadioButton,
pub radio_button_resize_algorithm_gaussian: gtk::RadioButton,
pub radio_button_resize_algorithm_catmullrom: gtk::RadioButton,
pub radio_button_similar_hash_algorithm_gradient: gtk::RadioButton,
pub radio_button_similar_hash_algorithm_blockhash: gtk::RadioButton,
pub radio_button_similar_hash_algorithm_mean: gtk::RadioButton,
pub radio_button_similar_hash_algorithm_vertgradient: gtk::RadioButton,
pub radio_button_similar_hash_algorithm_doublegradient: gtk::RadioButton,
pub label_image_resize_algorithm: gtk::Label,
pub label_image_hash_type: gtk::Label,
pub label_image_hash_size: gtk::Label,
pub radio_button_similar_hash_size_8: gtk::RadioButton,
pub radio_button_similar_hash_size_16: gtk::RadioButton,
pub radio_button_similar_hash_size_32: gtk::RadioButton,
pub radio_button_similar_hash_size_64: gtk::RadioButton,
pub combo_box_image_resize_algorithm: gtk::ComboBoxText,
pub combo_box_image_hash_algorithm: gtk::ComboBoxText,
pub combo_box_image_hash_size: gtk::ComboBoxText,
pub check_button_image_ignore_same_size: gtk::CheckButton,
pub check_button_video_ignore_same_size: gtk::CheckButton,
pub label_similar_images_minimal_similarity: gtk::Label,
pub label_duplicate_check_method: gtk::Label,
pub label_duplicate_hash_type: gtk::Label,
pub label_duplicate_size_bytes: gtk::Label,
pub label_duplicate_min_size: gtk::Label,
pub label_duplicate_max_size: gtk::Label,
pub label_big_shown_files: gtk::Label,
pub label_image_resize_algorithm: gtk::Label,
pub label_image_hash_type: gtk::Label,
pub label_image_hash_size: gtk::Label,
pub label_image_size_bytes: gtk::Label,
pub label_image_min_size: gtk::Label,
pub label_image_max_size: gtk::Label,
pub label_image_similarity: gtk::Label,
pub label_image_similarity_max: gtk::Label,
pub image_preview_similar_images: gtk::Image,
pub label_similar_images_minimal_similarity: gtk::Label,
// Video
pub label_video_similarity: gtk::Label,
pub label_video_similarity_min: gtk::Label,
pub label_video_similarity_max: gtk::Label,
pub label_video_size_bytes: gtk::Label,
pub label_video_min_size: gtk::Label,
pub label_video_max_size: gtk::Label,
pub label_music_size_bytes: gtk::Label,
pub label_music_min_size: gtk::Label,
pub label_music_max_size: gtk::Label,
pub image_preview_similar_images: gtk::Image,
pub image_preview_duplicates: gtk::Image,
pub scale_similarity_similar_videos: gtk::Scale,
// Music
pub check_button_music_title: gtk::CheckButton,
pub check_button_music_artist: gtk::CheckButton,
pub check_button_music_album_title: gtk::CheckButton,
pub check_button_music_album_artist: gtk::CheckButton,
pub check_button_music_year: gtk::CheckButton,
pub check_button_music_approximate_comparison: gtk::CheckButton,
}
impl GuiMainNotebook {
@ -182,14 +154,8 @@ impl GuiMainNotebook {
// let evk_tree_view_broken_files: gtk4::EventControllerKey = EventControllerKey::new();
// tree_view_broken_files.add_controller(&evk_tree_view_broken_files);
let entry_similar_images_minimal_size: gtk::Entry = builder.object("entry_similar_images_minimal_size").unwrap();
let entry_similar_images_maximal_size: gtk::Entry = builder.object("entry_similar_images_maximal_size").unwrap();
let entry_similar_videos_minimal_size: gtk::Entry = builder.object("entry_similar_videos_minimal_size").unwrap();
let entry_similar_videos_maximal_size: gtk::Entry = builder.object("entry_similar_videos_maximal_size").unwrap();
let entry_duplicate_minimal_size: gtk::Entry = builder.object("entry_duplicate_minimal_size").unwrap();
let entry_duplicate_maximal_size: gtk::Entry = builder.object("entry_duplicate_maximal_size").unwrap();
let entry_same_music_minimal_size: gtk::Entry = builder.object("entry_same_music_minimal_size").unwrap();
let entry_same_music_maximal_size: gtk::Entry = builder.object("entry_same_music_maximal_size").unwrap();
let combo_box_duplicate_check_method: gtk::ComboBoxText = builder.object("combo_box_duplicate_check_method").unwrap();
let combo_box_duplicate_hash_type: gtk::ComboBoxText = builder.object("combo_box_duplicate_hash_type").unwrap();
let entry_big_files_number: gtk::Entry = builder.object("entry_big_files_number").unwrap();
@ -202,61 +168,30 @@ impl GuiMainNotebook {
let check_button_music_approximate_comparison: gtk::CheckButton = builder.object("check_button_music_approximate_comparison").unwrap();
//// Radio Buttons
let radio_button_duplicates_name: gtk::RadioButton = builder.object("radio_button_duplicates_name").unwrap();
let radio_button_duplicates_size: gtk::RadioButton = builder.object("radio_button_duplicates_size").unwrap();
let radio_button_duplicates_hash: gtk::RadioButton = builder.object("radio_button_duplicates_hash").unwrap();
let scale_similarity_similar_images: gtk::Scale = builder.object("scale_similarity_similar_images").unwrap();
let scale_similarity_similar_videos: gtk::Scale = builder.object("scale_similarity_similar_videos").unwrap();
let radio_button_hash_type_blake3: gtk::RadioButton = builder.object("radio_button_hash_type_blake3").unwrap();
let radio_button_hash_type_crc32: gtk::RadioButton = builder.object("radio_button_hash_type_crc32").unwrap();
let radio_button_hash_type_xxh3: gtk::RadioButton = builder.object("radio_button_hash_type_xxh3").unwrap();
let radio_button_resize_algorithm_lanczos3: gtk::RadioButton = builder.object("radio_button_resize_algorithm_lanczos3").unwrap();
let radio_button_resize_algorithm_nearest: gtk::RadioButton = builder.object("radio_button_resize_algorithm_nearest").unwrap();
let radio_button_resize_algorithm_triangle: gtk::RadioButton = builder.object("radio_button_resize_algorithm_triangle").unwrap();
let radio_button_resize_algorithm_gaussian: gtk::RadioButton = builder.object("radio_button_resize_algorithm_gaussian").unwrap();
let radio_button_resize_algorithm_catmullrom: gtk::RadioButton = builder.object("radio_button_resize_algorithm_catmullrom").unwrap();
let radio_button_similar_hash_algorithm_gradient: gtk::RadioButton = builder.object("radio_button_similar_hash_algorithm_gradient").unwrap();
let radio_button_similar_hash_algorithm_blockhash: gtk::RadioButton = builder.object("radio_button_similar_hash_algorithm_blockhash").unwrap();
let radio_button_similar_hash_algorithm_mean: gtk::RadioButton = builder.object("radio_button_similar_hash_algorithm_mean").unwrap();
let radio_button_similar_hash_algorithm_vertgradient: gtk::RadioButton = builder.object("radio_button_similar_hash_algorithm_vertgradient").unwrap();
let radio_button_similar_hash_algorithm_doublegradient: gtk::RadioButton = builder.object("radio_button_similar_hash_algorithm_doublegradient").unwrap();
let radio_button_similar_hash_size_8: gtk::RadioButton = builder.object("radio_button_similar_hash_size_8").unwrap();
let radio_button_similar_hash_size_16: gtk::RadioButton = builder.object("radio_button_similar_hash_size_16").unwrap();
let radio_button_similar_hash_size_32: gtk::RadioButton = builder.object("radio_button_similar_hash_size_32").unwrap();
let radio_button_similar_hash_size_64: gtk::RadioButton = builder.object("radio_button_similar_hash_size_64").unwrap();
let combo_box_image_resize_algorithm: gtk::ComboBoxText = builder.object("combo_box_image_resize_algorithm").unwrap();
let combo_box_image_hash_algorithm: gtk::ComboBoxText = builder.object("combo_box_image_hash_algorithm").unwrap();
let combo_box_image_hash_size: gtk::ComboBoxText = builder.object("combo_box_image_hash_size").unwrap();
let check_button_image_ignore_same_size: gtk::CheckButton = builder.object("check_button_image_ignore_same_size").unwrap();
let check_button_video_ignore_same_size: gtk::CheckButton = builder.object("check_button_video_ignore_same_size").unwrap();
let label_similar_images_minimal_similarity: gtk::Label = builder.object("label_similar_images_minimal_similarity").unwrap();
let label_duplicate_check_method: gtk::Label = builder.object("label_duplicate_check_method").unwrap();
let label_duplicate_hash_type: gtk::Label = builder.object("label_duplicate_hash_type").unwrap();
let label_duplicate_size_bytes: gtk::Label = builder.object("label_duplicate_size_bytes").unwrap();
let label_duplicate_min_size: gtk::Label = builder.object("label_duplicate_min_size").unwrap();
let label_duplicate_max_size: gtk::Label = builder.object("label_duplicate_max_size").unwrap();
let label_big_shown_files: gtk::Label = builder.object("label_big_shown_files").unwrap();
let label_image_resize_algorithm: gtk::Label = builder.object("label_image_resize_algorithm").unwrap();
let label_image_hash_type: gtk::Label = builder.object("label_image_hash_type").unwrap();
let label_image_hash_size: gtk::Label = builder.object("label_image_hash_size").unwrap();
let label_image_size_bytes: gtk::Label = builder.object("label_image_size_bytes").unwrap();
let label_image_min_size: gtk::Label = builder.object("label_image_min_size").unwrap();
let label_image_max_size: gtk::Label = builder.object("label_image_max_size").unwrap();
let label_image_similarity: gtk::Label = builder.object("label_image_similarity").unwrap();
let label_image_similarity_max: gtk::Label = builder.object("label_image_similarity_max").unwrap();
let label_video_similarity: gtk::Label = builder.object("label_video_similarity").unwrap();
let label_video_similarity_min: gtk::Label = builder.object("label_video_similarity_min").unwrap();
let label_video_similarity_max: gtk::Label = builder.object("label_video_similarity_max").unwrap();
let label_video_size_bytes: gtk::Label = builder.object("label_video_size_bytes").unwrap();
let label_video_min_size: gtk::Label = builder.object("label_video_min_size").unwrap();
let label_video_max_size: gtk::Label = builder.object("label_video_max_size").unwrap();
let label_music_size_bytes: gtk::Label = builder.object("label_music_size_bytes").unwrap();
let label_music_min_size: gtk::Label = builder.object("label_music_min_size").unwrap();
let label_music_max_size: gtk::Label = builder.object("label_music_max_size").unwrap();
let image_preview_similar_images: gtk::Image = builder.object("image_preview_similar_images").unwrap();
let image_preview_duplicates: gtk::Image = builder.object("image_preview_duplicates").unwrap();
@ -293,70 +228,36 @@ impl GuiMainNotebook {
evk_tree_view_same_music_finder,
evk_tree_view_invalid_symlinks,
evk_tree_view_broken_files,
entry_similar_images_minimal_size,
entry_similar_images_maximal_size,
entry_similar_videos_minimal_size,
entry_similar_videos_maximal_size,
entry_duplicate_minimal_size,
entry_big_files_number,
entry_same_music_minimal_size,
check_button_music_title,
check_button_music_artist,
check_button_music_album_title,
check_button_music_album_artist,
check_button_music_year,
check_button_music_approximate_comparison,
radio_button_duplicates_name,
radio_button_duplicates_size,
radio_button_duplicates_hash,
scale_similarity_similar_images,
scale_similarity_similar_videos,
radio_button_hash_type_blake3,
radio_button_hash_type_crc32,
radio_button_hash_type_xxh3,
radio_button_resize_algorithm_lanczos3,
radio_button_resize_algorithm_nearest,
radio_button_resize_algorithm_triangle,
radio_button_resize_algorithm_gaussian,
radio_button_resize_algorithm_catmullrom,
radio_button_similar_hash_algorithm_gradient,
radio_button_similar_hash_algorithm_blockhash,
radio_button_similar_hash_algorithm_mean,
radio_button_similar_hash_algorithm_vertgradient,
radio_button_similar_hash_algorithm_doublegradient,
radio_button_similar_hash_size_8,
radio_button_similar_hash_size_16,
radio_button_similar_hash_size_32,
radio_button_similar_hash_size_64,
check_button_image_ignore_same_size,
label_similar_images_minimal_similarity,
label_duplicate_check_method,
label_duplicate_hash_type,
label_duplicate_size_bytes,
label_duplicate_min_size,
label_duplicate_max_size,
combo_box_duplicate_check_method,
label_big_shown_files,
label_image_resize_algorithm,
label_image_hash_type,
label_image_hash_size,
label_image_size_bytes,
label_image_min_size,
label_image_max_size,
combo_box_image_resize_algorithm,
combo_box_image_hash_algorithm,
label_image_similarity,
label_image_similarity_max,
label_video_similarity,
label_video_similarity_min,
label_video_similarity_max,
label_video_size_bytes,
label_video_min_size,
label_video_max_size,
label_music_size_bytes,
label_music_min_size,
label_music_max_size,
image_preview_similar_images,
entry_duplicate_maximal_size,
entry_same_music_maximal_size,
image_preview_duplicates,
combo_box_duplicate_hash_type,
combo_box_image_hash_size,
check_button_video_ignore_same_size,
}
}
@ -383,46 +284,58 @@ impl GuiMainNotebook {
self.check_button_music_year.set_label(&fl!("music_year_checkbox"));
self.check_button_music_approximate_comparison.set_label(&fl!("music_comparison_checkbox"));
self.radio_button_duplicates_name.set_label(&fl!("duplicate_mode_name_checkbox"));
self.radio_button_duplicates_size.set_label(&fl!("duplicate_mode_size_checkbox"));
self.radio_button_duplicates_hash.set_label(&fl!("duplicate_mode_hash_checkbox"));
self.radio_button_duplicates_name.set_tooltip_text(Some(&fl!("duplicate_mode_name_checkbox_tooltip")));
self.radio_button_duplicates_size.set_tooltip_text(Some(&fl!("duplicate_mode_size_checkbox_tooltip")));
self.radio_button_duplicates_hash.set_tooltip_text(Some(&fl!("duplicate_mode_hash_checkbox_tooltip")));
self.radio_button_hash_type_blake3.set_tooltip_text(Some(&fl!("duplicate_hash_checkbox_blake3")));
self.radio_button_hash_type_crc32.set_tooltip_text(Some(&fl!("duplicate_hash_checkbox_crc32")));
self.radio_button_hash_type_xxh3.set_tooltip_text(Some(&fl!("duplicate_hash_checkbox_xxh3")));
self.radio_button_similar_hash_size_8.set_tooltip_text(Some(&fl!("image_hash_checkbox_8")));
self.radio_button_similar_hash_size_16.set_tooltip_text(Some(&fl!("image_hash_checkbox_16")));
self.radio_button_similar_hash_size_32.set_tooltip_text(Some(&fl!("image_hash_checkbox_32")));
self.radio_button_similar_hash_size_64.set_tooltip_text(Some(&fl!("image_hash_checkbox_64")));
self.check_button_music_approximate_comparison.set_tooltip_text(Some(&fl!("music_comparison_checkbox_tooltip")));
self.label_duplicate_check_method.set_label(&fl!("main_label_check_method"));
self.label_duplicate_hash_type.set_label(&fl!("main_label_hash_type"));
self.label_duplicate_size_bytes.set_label(&fl!("main_label_size_bytes"));
self.label_duplicate_min_size.set_label(&fl!("main_label_min_size"));
self.label_duplicate_max_size.set_label(&fl!("main_label_max_size"));
self.label_big_shown_files.set_label(&fl!("main_label_shown_files"));
self.label_image_resize_algorithm.set_label(&fl!("main_label_resize_algorithm"));
self.label_image_hash_type.set_label(&fl!("main_label_hash_type"));
self.label_image_hash_size.set_label(&fl!("main_label_hash_size"));
self.label_image_size_bytes.set_label(&fl!("main_label_size_bytes"));
self.label_image_min_size.set_label(&fl!("main_label_min_size"));
self.label_image_max_size.set_label(&fl!("main_label_max_size"));
self.label_image_similarity.set_label(&fl!("main_label_similarity"));
self.label_image_similarity_max.set_label(&fl!("core_similarity_very_high"));
self.label_video_similarity.set_label(&fl!("main_label_similarity"));
self.label_video_similarity_min.set_label(&fl!("core_similarity_minimal"));
self.label_video_similarity_max.set_label(&fl!("core_similarity_very_high"));
self.label_video_size_bytes.set_label(&fl!("main_label_size_bytes"));
self.label_video_min_size.set_label(&fl!("main_label_min_size"));
self.label_video_max_size.set_label(&fl!("main_label_max_size"));
self.label_music_size_bytes.set_label(&fl!("main_label_size_bytes"));
self.label_music_min_size.set_label(&fl!("main_label_min_size"));
self.label_music_max_size.set_label(&fl!("main_label_max_size"));
self.label_duplicate_check_method.set_tooltip_text(Some(&fl!("duplicate_check_method_tooltip")));
self.combo_box_duplicate_check_method.set_tooltip_text(Some(&fl!("duplicate_check_method_tooltip")));
self.label_duplicate_hash_type.set_tooltip_text(Some(&fl!("duplicate_hash_type_tooltip")));
self.combo_box_duplicate_hash_type.set_tooltip_text(Some(&fl!("duplicate_hash_type_tooltip")));
self.combo_box_image_hash_size.set_tooltip_text(Some(&fl!("image_hash_size_tooltip")));
self.label_image_hash_size.set_tooltip_text(Some(&fl!("image_hash_size_tooltip")));
self.combo_box_image_resize_algorithm.set_tooltip_text(Some(&fl!("image_resize_filter_tooltip")));
self.label_image_resize_algorithm.set_tooltip_text(Some(&fl!("image_resize_filter_tooltip")));
self.combo_box_image_hash_algorithm.set_tooltip_text(Some(&fl!("image_hash_alg_tooltip")));
self.label_image_hash_type.set_tooltip_text(Some(&fl!("image_hash_alg_tooltip")));
self.check_button_image_ignore_same_size.set_tooltip_text(Some(&fl!("check_button_general_same_size_tooltip")));
self.check_button_video_ignore_same_size.set_tooltip_text(Some(&fl!("check_button_general_same_size_tooltip")));
self.check_button_image_ignore_same_size.set_label(&fl!("check_button_general_same_size"));
self.check_button_video_ignore_same_size.set_label(&fl!("check_button_general_same_size"));
{
let hash_size_index = self.combo_box_image_hash_size.active().unwrap() as usize;
let hash_size = IMAGES_HASH_SIZE_COMBO_BOX[hash_size_index];
match hash_size {
8 => {
self.label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[0][5]), 8));
}
16 => {
self.label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[1][5]), 16));
}
32 => {
self.label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[2][5]), 32));
}
64 => {
self.label_similar_images_minimal_similarity.set_text(&get_string_from_similarity(&Similarity::Similar(SIMILAR_VALUES[3][5]), 64));
}
_ => panic!(),
}
}
// Change name of main notebook tabs
let vec_children: Vec<gtk::Widget> = self.notebook_main.children();

@ -31,6 +31,12 @@ pub struct GuiUpperNotebook {
pub label_excluded_items: gtk::Label,
pub label_allowed_extensions: gtk::Label,
pub entry_general_minimal_size: gtk::Entry,
pub entry_general_maximal_size: gtk::Entry,
pub label_general_size_bytes: gtk::Label,
pub label_general_min_size: gtk::Label,
pub label_general_max_size: gtk::Label,
}
impl GuiUpperNotebook {
@ -61,6 +67,12 @@ impl GuiUpperNotebook {
let label_excluded_items: gtk::Label = builder.object("label_excluded_items").unwrap();
let label_allowed_extensions: gtk::Label = builder.object("label_allowed_extensions").unwrap();
let entry_general_minimal_size: gtk::Entry = builder.object("entry_general_minimal_size").unwrap();
let entry_general_maximal_size: gtk::Entry = builder.object("entry_general_maximal_size").unwrap();
let label_general_size_bytes: gtk::Label = builder.object("label_general_size_bytes").unwrap();
let label_general_min_size: gtk::Label = builder.object("label_general_min_size").unwrap();
let label_general_max_size: gtk::Label = builder.object("label_general_max_size").unwrap();
Self {
notebook_upper,
scrolled_window_included_directories,
@ -80,6 +92,11 @@ impl GuiUpperNotebook {
buttons_remove_excluded_directory,
label_excluded_items,
label_allowed_extensions,
entry_general_minimal_size,
entry_general_maximal_size,
label_general_size_bytes,
label_general_min_size,
label_general_max_size,
}
}
pub fn update_language(&self) {
@ -108,6 +125,16 @@ impl GuiUpperNotebook {
self.label_excluded_items.set_label(&fl!("upper_excluded_items"));
self.label_allowed_extensions.set_label(&fl!("upper_allowed_extensions"));
self.label_general_size_bytes.set_label(&fl!("main_label_size_bytes"));
self.label_general_min_size.set_label(&fl!("main_label_min_size"));
self.label_general_max_size.set_label(&fl!("main_label_max_size"));
self.label_general_size_bytes.set_tooltip_text(Some(&fl!("main_label_size_bytes_tooltip")));
self.label_general_min_size.set_tooltip_text(Some(&fl!("main_label_size_bytes_tooltip")));
self.label_general_max_size.set_tooltip_text(Some(&fl!("main_label_size_bytes_tooltip")));
self.entry_general_minimal_size.set_tooltip_text(Some(&fl!("main_label_size_bytes_tooltip")));
self.entry_general_maximal_size.set_tooltip_text(Some(&fl!("main_label_size_bytes_tooltip")));
let vec_children: Vec<gtk::Widget> = self.notebook_upper.children();
for (upper_enum, fl_thing) in [

@ -0,0 +1,89 @@
use czkawka_core::duplicate::{CheckingMethod, HashType};
use img_hash::{FilterType, HashAlg};
pub struct HashTypeStruct {
pub eng_name: &'static str,
pub hash_type: HashType,
}
pub const DUPLICATES_HASH_TYPE_COMBO_BOX: [HashTypeStruct; 3] = [
HashTypeStruct {
eng_name: "Blake3",
hash_type: HashType::Blake3,
},
HashTypeStruct { eng_name: "CRC32", hash_type: HashType::Crc32 },
HashTypeStruct { eng_name: "XXH3", hash_type: HashType::Xxh3 },
];
pub struct CheckMethodStruct {
pub eng_name: &'static str,
pub check_method: CheckingMethod,
}
pub const DUPLICATES_CHECK_METHOD_COMBO_BOX: [CheckMethodStruct; 3] = [
CheckMethodStruct {
eng_name: "Hash",
check_method: CheckingMethod::Hash,
},
CheckMethodStruct {
eng_name: "Size",
check_method: CheckingMethod::Size,
},
CheckMethodStruct {
eng_name: "Name",
check_method: CheckingMethod::Name,
},
];
pub struct ImageResizeAlgStruct {
pub eng_name: &'static str,
pub filter: FilterType,
}
pub const IMAGES_RESIZE_ALGORITHM_COMBO_BOX: [ImageResizeAlgStruct; 5] = [
ImageResizeAlgStruct {
eng_name: "Lanczos3",
filter: FilterType::Lanczos3,
},
ImageResizeAlgStruct {
eng_name: "Nearest",
filter: FilterType::Nearest,
},
ImageResizeAlgStruct {
eng_name: "Triangle",
filter: FilterType::Triangle,
},
ImageResizeAlgStruct {
eng_name: "Gaussian",
filter: FilterType::Gaussian,
},
ImageResizeAlgStruct {
eng_name: "CatmullRom",
filter: FilterType::CatmullRom,
},
];
pub struct ImageHashTypeStruct {
pub eng_name: &'static str,
pub hash_alg: HashAlg,
}
pub const IMAGES_HASH_TYPE_COMBO_BOX: [ImageHashTypeStruct; 5] = [
ImageHashTypeStruct {
eng_name: "Gradient",
hash_alg: HashAlg::Gradient,
},
ImageHashTypeStruct { eng_name: "Mean", hash_alg: HashAlg::Mean },
ImageHashTypeStruct {
eng_name: "VertGradient",
hash_alg: HashAlg::VertGradient,
},
ImageHashTypeStruct {
eng_name: "Blackhash",
hash_alg: HashAlg::Blockhash,
},
ImageHashTypeStruct {
eng_name: "DoubleGradient",
hash_alg: HashAlg::DoubleGradient,
},
];
pub const IMAGES_HASH_SIZE_COMBO_BOX: [i32; 4] = [8, 16, 32, 64];

@ -17,6 +17,7 @@ use czkawka_core::similar_videos::MAX_TOLERANCE;
use crate::create_tree_view::*;
use crate::delete_things;
use crate::gui_data::*;
use crate::help_combo_box::{DUPLICATES_CHECK_METHOD_COMBO_BOX, DUPLICATES_HASH_TYPE_COMBO_BOX, IMAGES_HASH_SIZE_COMBO_BOX, IMAGES_HASH_TYPE_COMBO_BOX, IMAGES_RESIZE_ALGORITHM_COMBO_BOX};
use crate::help_functions::*;
use crate::language_functions::LANGUAGES_ALL;
use crate::notebook_enums::NotebookMainEnum;
@ -42,7 +43,7 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
buttons_hardlink.hide();
buttons_move.hide();
}
//// Initialize language combobox
//// Initialize language combo box
{
let combo_box_settings_language = gui_data.settings.combo_box_settings_language.clone();
for lang in LANGUAGES_ALL {
@ -50,6 +51,46 @@ pub fn initialize_gui(gui_data: &mut GuiData) {
}
combo_box_settings_language.set_active(Some(0));
}
//// Initialize main window combo boxes
{
{
let combo_box_duplicate_check_method = gui_data.main_notebook.combo_box_duplicate_check_method.clone();
for check_type in &DUPLICATES_CHECK_METHOD_COMBO_BOX {
combo_box_duplicate_check_method.append_text(check_type.eng_name);
}
combo_box_duplicate_check_method.set_active(Some(0));
}
{
let combo_box_duplicate_hash_type = gui_data.main_notebook.combo_box_duplicate_hash_type.clone();
for hash_type in &DUPLICATES_HASH_TYPE_COMBO_BOX {
combo_box_duplicate_hash_type.append_text(hash_type.eng_name);
}
combo_box_duplicate_hash_type.set_active(Some(0));
}
}
{
{
let combo_box_image_hash_algorithm = gui_data.main_notebook.combo_box_image_hash_algorithm.clone();
for check_type in &IMAGES_HASH_TYPE_COMBO_BOX {
combo_box_image_hash_algorithm.append_text(check_type.eng_name);
}
combo_box_image_hash_algorithm.set_active(Some(0));
}
{
let combo_box_image_hash_size = gui_data.main_notebook.combo_box_image_hash_size.clone();
for check_type in &IMAGES_HASH_SIZE_COMBO_BOX {
combo_box_image_hash_size.append_text(&check_type.to_string());
}
combo_box_image_hash_size.set_active(Some(0));
}
{
let combo_box_image_resize_algorithm = gui_data.main_notebook.combo_box_image_resize_algorithm.clone();
for resize in &IMAGES_RESIZE_ALGORITHM_COMBO_BOX {
combo_box_image_resize_algorithm.append_text(resize.eng_name);
}
combo_box_image_resize_algorithm.set_active(Some(0));
}
}
//// Initialize main scrolled view with notebook
{

@ -17,7 +17,7 @@ use crate::connect_button_search::*;
use crate::connect_button_select::*;
use crate::connect_button_stop::*;
use crate::connect_change_language::*;
use crate::connect_duplicate_buttons::*;
use crate::connect_duplicate_buttons::connect_duplicate_combo_box;
use crate::connect_header_buttons::*;
use crate::connect_notebook_tabs::*;
use crate::connect_popovers::*;
@ -60,6 +60,7 @@ mod gui_popovers;
mod gui_progress_dialog;
mod gui_settings;
mod gui_upper_notebook;
mod help_combo_box;
mod help_functions;
mod initialize_gui;
mod language_functions;
@ -127,7 +128,7 @@ fn main() {
connect_button_stop(&gui_data);
connect_button_hardlink_symlink(&gui_data);
connect_button_move(&gui_data);
connect_duplicate_buttons(&gui_data);
connect_duplicate_combo_box(&gui_data);
connect_notebook_tabs(&gui_data);
connect_selection_of_directories(&gui_data);
connect_popovers(&gui_data);

@ -479,7 +479,7 @@ Author: Rafał Mikrut
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">0</property>
</packing>
</child>
<child>
@ -513,6 +513,86 @@ Author: Rafał Mikrut
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="spacing">8</property>
<child>
<object class="GtkLabel" id="label_general_size_bytes">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">File Size(bytes)</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_general_min_size">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Min:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_general_minimal_size">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="max-length">15</property>
<property name="text" translatable="yes">8192</property>
<property name="caps-lock-warning">False</property>
<property name="input-purpose">number</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_general_max_size">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Max:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_general_maximal_size">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="max-length">15</property>
<property name="text" translatable="yes">1099512000000</property>
<property name="caps-lock-warning">False</property>
<property name="input-purpose">number</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
@ -567,7 +647,8 @@ Author: Rafał Mikrut
<object class="GtkLabel" id="label_duplicate_check_method">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Check method:</property>
<property name="margin-end">3</property>
<property name="label" translatable="yes">Check method</property>
</object>
<packing>
<property name="expand">False</property>
@ -576,13 +657,9 @@ Author: Rafał Mikrut
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radio_button_duplicates_hash">
<property name="label" translatable="yes">Hash</property>
<object class="GtkComboBoxText" id="combo_box_duplicate_check_method">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="active">True</property>
<property name="draw-indicator">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
@ -590,165 +667,24 @@ Author: Rafał Mikrut
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radio_button_duplicates_size">
<property name="label" translatable="yes">Size</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="dra