use slint::{ComponentHandle, SharedString, VecModel}; use czkawka_core::common::get_all_available_threads; use crate::settings::{ALLOWED_HASH_SIZE_VALUES, ALLOWED_HASH_TYPE_VALUES, ALLOWED_RESIZE_ALGORITHM_VALUES}; use crate::{GuiState, MainWindow, Settings}; // 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_all_available_threads(); let settings = app.global::(); 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)); }