Skip to content

Commit ce09f31

Browse files
committed
Zapomnieć
1 parent e731f5e commit ce09f31

14 files changed

+311
-61
lines changed

Cargo.lock

+249-43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

czkawka_cli/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ homepage = "https://github.com/qarmin/czkawka"
1010
repository = "https://github.com/qarmin/czkawka"
1111

1212
[dependencies]
13-
clap = { version = "3.2.21", features = ["derive"] }
13+
clap = { version = "3.2.22", features = ["derive"] }
1414

1515
# For enum types
1616
image_hasher = "1.0.0"

czkawka_core/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ serde_json = "1.0.85"
5656
i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] }
5757
i18n-embed-fl = "0.6.4"
5858
rust-embed = "6.4.1"
59-
once_cell = "1.14.0"
59+
once_cell = "1.15.0"
6060

6161
# Raw image files
6262
rawloader = "0.37.1"
@@ -72,6 +72,8 @@ num_cpus = "1.13.1"
7272
libheif-rs = { version = "0.15.0", optional = true }
7373
anyhow = { version = "1.0.65", optional = true }
7474

75+
state= "0.5.3"
76+
7577
[features]
7678
default = []
7779
heif = ["dep:libheif-rs", "dep:anyhow"]

czkawka_core/src/common.rs

+16
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,22 @@ use imagepipe::{ImageSource, Pipeline};
1313
#[cfg(feature = "heif")]
1414
use libheif_rs::{Channel, ColorSpace, HeifContext, RgbChroma};
1515

16+
static NUMBER_OF_THREADS: state::Storage<usize> = state::Storage::new();
17+
18+
pub fn get_number_of_threads() -> usize {
19+
let data = NUMBER_OF_THREADS.get();
20+
if *data >= 1 {
21+
*data
22+
} else {
23+
num_cpus::get()
24+
}
25+
}
26+
pub fn set_number_of_threads(thread_number: usize) {
27+
NUMBER_OF_THREADS.set(thread_number);
28+
29+
rayon::ThreadPoolBuilder::new().num_threads(get_number_of_threads()).build_global().unwrap();
30+
}
31+
1632
/// Class for common functions used across other class/functions
1733
pub const RAW_IMAGE_EXTENSIONS: &[&str] = &[
1834
".mrw", ".arw", ".srf", ".sr2", ".mef", ".orf", ".srw", ".erf", ".kdc", ".kdc", ".dcs", ".rw2", ".raf", ".dcr", ".dng", ".pef", ".crw", ".iiq", ".3fr", ".nrw", ".nef", ".mos",

czkawka_core/src/similar_images.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ use serde::{Deserialize, Serialize};
2222
#[cfg(feature = "heif")]
2323
use crate::common::get_dynamic_image_from_heic;
2424
use crate::common::{
25-
create_crash_message, get_dynamic_image_from_raw_image, open_cache_folder, Common, HEIC_EXTENSIONS, IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS, LOOP_DURATION, RAW_IMAGE_EXTENSIONS,
25+
create_crash_message, get_dynamic_image_from_raw_image, get_number_of_threads, open_cache_folder, Common, HEIC_EXTENSIONS, IMAGE_RS_SIMILAR_IMAGES_EXTENSIONS, LOOP_DURATION,
26+
RAW_IMAGE_EXTENSIONS,
2627
};
2728
use crate::common_directory::Directories;
2829
use crate::common_extensions::Extensions;
@@ -736,7 +737,7 @@ impl SimilarImages {
736737
let mut files_from_referenced_folders = HashMap::new();
737738
let mut normal_files = HashMap::new();
738739

739-
let number_of_processors = num_cpus::get();
740+
let number_of_processors = get_number_of_threads();
740741
let chunk_size;
741742
let mut chunks: Vec<&[&Vec<u8>]>;
742743

czkawka_gui/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ futures = "0.3.24"
2626
directories-next = "2.0.0"
2727

2828
# For opening files
29-
open = "3.0.2"
29+
open = "3.0.3"
3030

3131
# To get image preview
3232
image = "0.24.3"
@@ -47,7 +47,7 @@ fs_extra = "1.2.0"
4747
i18n-embed = { version = "0.13.4", features = ["fluent-system", "desktop-requester"] }
4848
i18n-embed-fl = "0.6.4"
4949
rust-embed = "6.4.1"
50-
once_cell = "1.14.0"
50+
once_cell = "1.15.0"
5151

5252
[target.'cfg(windows)'.dependencies]
5353
winapi = { version = "0.3.9", features = ["combaseapi", "objbase", "shobjidl_core", "windef", "winerror", "wtypesbase", "winuser"] }

czkawka_gui/ui/about_dialog.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<!-- Created with Cambalache 0.11.2 -->
2+
<!-- Created with Cambalache 0.10.3 -->
33
<interface>
44
<!-- interface-name about_dialog.ui -->
55
<requires lib="gtk" version="4.0"/>

czkawka_gui/ui/compare_images.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<!-- Created with Cambalache 0.11.2 -->
2+
<!-- Created with Cambalache 0.10.3 -->
33
<interface>
44
<!-- interface-name compare_images.ui -->
55
<requires lib="gtk" version="4.0"/>

czkawka_gui/ui/czkawka.cmb

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
22
<!DOCTYPE cambalache-project SYSTEM "cambalache-project.dtd">
3-
<cambalache-project version="0.11.0" target_tk="gtk-4.0">
3+
<cambalache-project version="0.10.3" target_tk="gtk-4.0">
44
<ui>
55
(3,None,"about_dialog.ui","about_dialog.ui",None,None,None,None,None,None),
66
(4,None,"compare_images.ui","compare_images.ui",None,None,None,None,None,None),
@@ -314,7 +314,10 @@
314314
(9,52,"GtkButton","button_settings_load_configuration",51,None,None,None,None),
315315
(9,53,"GtkButton","button_settings_reset_configuration",51,None,None,None,1),
316316
(9,54,"GtkButton","button_settings_save_configuration",51,None,None,None,2),
317-
(9,55,"GtkCheckButton","check_button_settings_one_filesystem",9,None,None,None,10)
317+
(9,55,"GtkCheckButton","check_button_settings_one_filesystem",9,None,None,None,10),
318+
(9,56,"GtkBox",None,9,None,None,None,11),
319+
(9,57,"GtkLabel","label_settings_number_of_threads",56,None,None,None,None),
320+
(9,58,"GtkScale","scale_settings_number_of_threads",56,None,None,None,1)
318321
</object>
319322
<object_property>
320323
(3,1,"GtkAboutDialog","comments","2020 - 2022 Rafał Mikrut(qarmin)\n\nThis program is free to use and will always be.\n",1,None,None,None,None),
@@ -951,7 +954,15 @@
951954
(9,54,"GtkWidget","receives-default","1",None,None,None,None,None),
952955
(9,55,"GtkCheckButton","active","1",None,None,None,None,None),
953956
(9,55,"GtkCheckButton","label","Exclude other filesystems(Linux)",None,None,None,None,None),
954-
(9,55,"GtkWidget","focusable","1",None,None,None,None,None)
957+
(9,55,"GtkWidget","focusable","1",None,None,None,None,None),
958+
(9,57,"GtkLabel","label","Number of used threads",None,None,None,None,None),
959+
(9,58,"GtkRange","fill-level","100",None,None,None,None,None),
960+
(9,58,"GtkRange","round-digits","1",None,None,None,None,None),
961+
(9,58,"GtkScale","digits","0",None,None,None,None,None),
962+
(9,58,"GtkScale","draw-value","1",None,None,None,None,None),
963+
(9,58,"GtkScale","value-pos","right",None,None,None,None,None),
964+
(9,58,"GtkWidget","focusable","1",None,None,None,None,None),
965+
(9,58,"GtkWidget","hexpand","1",None,None,None,None,None)
955966
</object_property>
956967
<object_layout_property>
957968
(8,17,18,"GtkGridLayoutChild","column","0",None,None,None,None),

czkawka_gui/ui/main_window.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<!-- Created with Cambalache 0.11.2 -->
2+
<!-- Created with Cambalache 0.10.3 -->
33
<interface>
44
<!-- interface-name main_window.ui -->
55
<requires lib="gtk" version="4.0"/>

czkawka_gui/ui/popover_right_click.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<!-- Created with Cambalache 0.11.2 -->
2+
<!-- Created with Cambalache 0.10.3 -->
33
<interface>
44
<!-- interface-name popover_right_click.ui -->
55
<requires lib="gtk" version="4.0"/>

czkawka_gui/ui/popover_select.ui

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<!-- Created with Cambalache 0.11.2 -->
2+
<!-- Created with Cambalache 0.10.3 -->
33
<interface>
44
<!-- interface-name popover_select.ui -->
55
<requires lib="gtk" version="4.0"/>

czkawka_gui/ui/progress.ui

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<!-- Created with Cambalache 0.11.2 -->
2+
<!-- Created with Cambalache 0.10.3 -->
33
<interface>
44
<!-- interface-name progress.ui -->
55
<requires lib="gtk" version="4.0"/>
@@ -75,7 +75,6 @@
7575
<property name="valign">center</property>
7676
<child>
7777
<object class="GtkBox">
78-
<property name="spacing">5</property>
7978
<child>
8079
<object class="GtkImage">
8180
<property name="icon-name">image-missing</property>

czkawka_gui/ui/settings.ui

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version='1.0' encoding='UTF-8'?>
2-
<!-- Created with Cambalache 0.11.2 -->
2+
<!-- Created with Cambalache 0.10.3 -->
33
<interface>
44
<!-- interface-name settings.ui -->
55
<requires lib="gtk" version="4.0"/>
@@ -114,6 +114,21 @@
114114
<property name="label">Exclude other filesystems(Linux)</property>
115115
</object>
116116
</child>
117+
<child>
118+
<object class="GtkBox">
119+
<child>
120+
<object class="GtkLabel" id="label_settings_number_of_threads">
121+
<property name="label">Number of used threads</property>
122+
</object>
123+
</child>
124+
<child>
125+
<object class="GtkScale" id="scale_settings_number_of_threads">
126+
<property name="hexpand">True</property>
127+
<property name="vexpand">True</property>
128+
</object>
129+
</child>
130+
</object>
131+
</child>
117132
</object>
118133
</child>
119134
<child>
@@ -153,7 +168,7 @@
153168
<object class="GtkCheckButton" id="check_button_settings_hide_hard_links">
154169
<property name="active">1</property>
155170
<property name="focusable">1</property>
156-
<property name="label" translatable="yes">Hide hard links(only Linux and macOS)</property>
171+
<property name="label" translatable="yes">Hide hard links(only Linux and MacOS)</property>
157172
</object>
158173
</child>
159174
<child>

0 commit comments

Comments
 (0)