1
0
Fork 0
mirror of synced 2024-06-18 02:15:30 +12:00

Windows CI and basic choosing broken files

This commit is contained in:
Rafał Mikrut 2022-06-10 17:40:55 +02:00
parent b530019807
commit 81e9989361
8 changed files with 218 additions and 47 deletions

View file

@ -9,27 +9,65 @@ env:
CARGO_TERM_COLOR: always
jobs:
windows-gui-release-normal-app:
runs-on: ubuntu-latest
steps:
- run: |
echo This job does not specify a container.
echo It runs directly on the virtual machine.
name: Run on VM
container:
runs-on: ubuntu-latest
container: mglolenstine/gtk4-cross:rust-gtk-4.6
runs-on: ubuntu-22.04
container:
image: ghcr.io/piegamesde/gtk4-cross:gtk-4.6
steps:
- run: |
echo This job does specify a container.
echo It runs in the container instead of the VM.
git clone https://github.com/qarmin/czkawka.git
build
zip -r gtk_app.zip target/x86_64-pc-windows-gnu/release/czkawka_gui.exe
name: Run in container
- name: Store Windows GUI CrossComplile
uses: actions/upload-artifact@v2
- uses: actions/checkout@v1
- 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:
name: czkawka_gui-release-console-${{ matrix.toolchain }}
path: gtk_app.zip
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: Cross compile for Windows
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
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/
- name: Package
run: |
#!/bin/bash
set -euo pipefail
cp -t package $(pds -vv -f package/*.exe)
# Add gdbus which is recommended on Windows (why?)
cp $MINGW_PREFIX/bin/gdbus.exe package
# Handle the glib schema compilation as well
glib-compile-schemas $MINGW_PREFIX/share/glib-2.0/schemas/
mkdir -p package/share/glib-2.0/schemas/
cp -T $MINGW_PREFIX/share/glib-2.0/schemas/gschemas.compiled package/share/glib-2.0/schemas/gschemas.compiled
# Pixbuf stuff, in order to get SVGs (scalable icons) to load
mkdir -p package/lib/gdk-pixbuf-2.0
cp -rT $MINGW_PREFIX/lib/gdk-pixbuf-2.0 package/lib/gdk-pixbuf-2.0
cp -f -t package $(pds -vv -f $MINGW_PREFIX/lib/gdk-pixbuf-2.0/2.10.0/loaders/*)
find package -iname "*.dll" -or -iname "*.exe" -type f -exec mingw-strip {} +
cd package/share
wget2 https://github.com/qarmin/czkawka/files/8880216/gtk4_theme.zip
unzip gtk4_theme.zip
rm gtk4_theme.zip
cd ../..
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: czkawka-windows-${{ github.sha }}
path: |
./package
if-no-files-found: error

View file

@ -57,6 +57,19 @@ pub enum TypeOfFile {
PDF,
}
bitflags! {
pub struct CheckedFiles : u32 {
const NONE = 0;
const TRACK_TITLE = 0b1;
const TRACK_ARTIST = 0b10;
const YEAR = 0b100;
const LENGTH = 0b1000;
const GENRE = 0b10000;
const BITRATE = 0b100000;
}
}
/// Info struck with helpful information's about results
#[derive(Default)]
pub struct Info {

View file

@ -116,6 +116,11 @@ main_label_shown_files = Number of shown files
main_label_resize_algorithm = Resize algorithm
main_label_similarity = Similarity{" "}
main_check_box_broken_files_audio = Audio
main_check_box_broken_files_pdf = Pdf
main_check_box_broken_files_archive = Archive
main_check_box_broken_files_image = Image
check_button_general_same_size = Ignore same size
check_button_general_same_size_tooltip = Ignore from results, files which have identical size - usually this are 1:1 duplicates

View file

@ -109,6 +109,12 @@ pub struct GuiMainNotebook {
pub scale_similarity_similar_videos: Scale,
// Broken Files
pub check_button_broken_files_audio: CheckButton,
pub check_button_broken_files_pdf: CheckButton,
pub check_button_broken_files_archive: CheckButton,
pub check_button_broken_files_image: CheckButton,
// Music
pub check_button_music_title: CheckButton,
pub check_button_music_artist: CheckButton,
@ -209,6 +215,11 @@ impl GuiMainNotebook {
let check_button_music_length: CheckButton = builder.object("check_button_music_length").unwrap();
let check_button_music_approximate_comparison: CheckButton = builder.object("check_button_music_approximate_comparison").unwrap();
let check_button_broken_files_audio: CheckButton = builder.object("check_button_broken_files_audio").unwrap();
let check_button_broken_files_pdf: CheckButton = builder.object("check_button_broken_files_pdf").unwrap();
let check_button_broken_files_archive: CheckButton = builder.object("check_button_broken_files_archive").unwrap();
let check_button_broken_files_image: CheckButton = builder.object("check_button_broken_files_image").unwrap();
let scale_similarity_similar_images: Scale = builder.object("scale_similarity_similar_images").unwrap();
let scale_similarity_similar_videos: Scale = builder.object("scale_similarity_similar_videos").unwrap();
@ -284,6 +295,9 @@ impl GuiMainNotebook {
check_button_music_approximate_comparison,
scale_similarity_similar_images,
scale_similarity_similar_videos,
check_button_broken_files_audio,
check_button_broken_files_pdf,
check_button_broken_files_archive,
check_button_image_ignore_same_size,
label_similar_images_minimal_similarity,
label_duplicate_check_method,
@ -321,6 +335,7 @@ impl GuiMainNotebook {
gc_tree_view_bad_extensions,
combo_box_big_files_mode,
label_big_files_mode,
check_button_broken_files_image,
}
}
@ -396,6 +411,11 @@ impl GuiMainNotebook {
self.check_button_image_fast_compare
.set_tooltip_text(Some(&flg!("main_notebook_image_fast_compare_tooltip")));
self.check_button_broken_files_audio.set_label(Some(&flg!("main_check_box_broken_files_audio")));
self.check_button_broken_files_archive.set_label(Some(&flg!("main_check_box_broken_files_archive")));
self.check_button_broken_files_image.set_label(Some(&flg!("main_check_box_broken_files_image")));
self.check_button_broken_files_pdf.set_label(Some(&flg!("main_check_box_broken_files_pdf")));
{
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];

View file

@ -42,6 +42,11 @@ const DEFAULT_IMAGE_REMOVE_AUTO_OUTDATED_CACHE: bool = true;
const DEFAULT_DUPLICATE_REMOVE_AUTO_OUTDATED_CACHE: bool = true;
const DEFAULT_DUPLICATE_CASE_SENSITIVE_NAME_CHECKING: bool = false;
const DEFAULT_BROKEN_FILES_PDF: bool = true;
const DEFAULT_BROKEN_FILES_AUDIO: bool = true;
const DEFAULT_BROKEN_FILES_ARCHIVE: bool = true;
const DEFAULT_BROKEN_FILES_IMAGE: bool = true;
const DEFAULT_NUMBER_OF_BIGGEST_FILES: &str = "50";
const DEFAULT_SIMILAR_IMAGES_SIMILARITY: i32 = 0;
const DEFAULT_SIMILAR_IMAGES_IGNORE_SAME_SIZE: bool = false;
@ -427,6 +432,10 @@ enum LoadText {
SimilarVideosIgnoreSameSize,
MusicApproximateComparison,
DuplicateNameCaseSensitive,
BrokenFilesPdf,
BrokenFilesAudio,
BrokenFilesImage,
BrokenFilesArchive,
}
fn create_hash_map() -> (HashMap<LoadText, String>, HashMap<String, LoadText>) {
@ -469,6 +478,10 @@ fn create_hash_map() -> (HashMap<LoadText, String>, HashMap<String, LoadText>) {
(LoadText::MusicApproximateComparison, "music_approximate_comparison"),
(LoadText::DuplicateNameCaseSensitive, "duplicate_name_case_sensitive"),
(LoadText::ComboBoxBigFiles, "combo_box_big_files_mode"),
(LoadText::BrokenFilesPdf, "broken_files_pdf"),
(LoadText::BrokenFilesAudio, "broken_files_audio"),
(LoadText::BrokenFilesImage, "broken_files_image"),
(LoadText::BrokenFilesArchive, "broken_files_archive"),
];
let mut hashmap_ls: HashMap<LoadText, String> = Default::default();
let mut hashmap_sl: HashMap<String, LoadText> = Default::default();
@ -583,6 +596,23 @@ pub fn save_configuration(manual_execution: bool, upper_notebook: &GuiUpperNoteb
settings.check_button_settings_show_text_view.is_active(),
);
saving_struct.save_var(
hashmap_ls.get(&LoadText::BrokenFilesArchive).unwrap().to_string(),
main_notebook.check_button_broken_files_archive.is_active(),
);
saving_struct.save_var(
hashmap_ls.get(&LoadText::BrokenFilesImage).unwrap().to_string(),
main_notebook.check_button_broken_files_image.is_active(),
);
saving_struct.save_var(
hashmap_ls.get(&LoadText::BrokenFilesAudio).unwrap().to_string(),
main_notebook.check_button_broken_files_audio.is_active(),
);
saving_struct.save_var(
hashmap_ls.get(&LoadText::BrokenFilesPdf).unwrap().to_string(),
main_notebook.check_button_broken_files_pdf.is_active(),
);
// Others
saving_struct.save_var(
hashmap_ls.get(&LoadText::MinimalCacheSize).unwrap().to_string(),
@ -756,6 +786,11 @@ pub fn load_configuration(
DEFAULT_DUPLICATE_CASE_SENSITIVE_NAME_CHECKING,
);
let check_button_broken_files_archive = loaded_entries.get_integer(hashmap_ls.get(&LoadText::BrokenFilesArchive).unwrap().clone(), DEFAULT_BROKEN_FILES_ARCHIVE);
let check_button_broken_files_pdf = loaded_entries.get_integer(hashmap_ls.get(&LoadText::BrokenFilesPdf).unwrap().clone(), DEFAULT_BROKEN_FILES_ARCHIVE);
let check_button_broken_files_image = loaded_entries.get_integer(hashmap_ls.get(&LoadText::BrokenFilesImage).unwrap().clone(), DEFAULT_BROKEN_FILES_ARCHIVE);
let check_button_broken_files_audio = loaded_entries.get_integer(hashmap_ls.get(&LoadText::BrokenFilesAudio).unwrap().clone(), DEFAULT_BROKEN_FILES_ARCHIVE);
// Setting data
if manual_execution || loading_at_start {
{
@ -880,6 +915,11 @@ pub fn load_configuration(
main_notebook.check_button_video_ignore_same_size.set_active(similar_videos_ignore_same_size);
main_notebook.scale_similarity_similar_videos.set_value(similar_videos_similarity as f64);
main_notebook.check_button_broken_files_audio.set_active(check_button_broken_files_audio);
main_notebook.check_button_broken_files_pdf.set_active(check_button_broken_files_pdf);
main_notebook.check_button_broken_files_image.set_active(check_button_broken_files_image);
main_notebook.check_button_broken_files_archive.set_active(check_button_broken_files_archive);
{
let combo_chosen_index = main_notebook.combo_box_duplicate_check_method.active().unwrap();
@ -1004,6 +1044,11 @@ pub fn reset_configuration(manual_clearing: bool, upper_notebook: &GuiUpperNoteb
main_notebook.combo_box_image_hash_size.set_active(Some(0));
main_notebook.combo_box_big_files_mode.set_active(Some(0));
main_notebook.check_button_broken_files_audio.set_active(DEFAULT_BROKEN_FILES_AUDIO);
main_notebook.check_button_broken_files_pdf.set_active(DEFAULT_BROKEN_FILES_PDF);
main_notebook.check_button_broken_files_archive.set_active(DEFAULT_BROKEN_FILES_ARCHIVE);
main_notebook.check_button_broken_files_image.set_active(DEFAULT_BROKEN_FILES_IMAGE);
main_notebook.scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[0][5] as f64); // DEFAULT FOR MAX of 8
main_notebook.scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[0][5] as f64);

View file

@ -167,7 +167,7 @@
(5,129,"GtkScrolledWindow","scrolled_window_invalid_symlinks",128,None,None,None,None),
(5,130,"GtkLabel",None,128,None,None,None,None),
(5,131,"GtkNotebookPage",None,56,None,None,None,9),
(5,132,"GtkScrolledWindow","scrolled_window_broken_files",131,None,None,None,None),
(5,132,"GtkBox",None,131,None,None,None,None),
(5,133,"GtkLabel",None,131,None,None,None,None),
(5,134,"GtkNotebookPage",None,56,None,None,None,10),
(5,135,"GtkScrolledWindow","scrolled_window_bad_extensions",134,None,None,None,None),
@ -225,6 +225,12 @@
(5,220,"GtkImage",None,219,None,None,None,None),
(5,221,"GtkComboBoxText","combo_box_big_files_mode",74,None,None,None,1),
(5,222,"GtkLabel","label_big_files_mode",74,None,None,None,None),
(5,223,"GtkScrolledWindow","scrolled_window_broken_files",132,None,None,None,1),
(5,224,"GtkBox",None,132,None,None,None,None),
(5,225,"GtkCheckButton","check_button_broken_files_audio",224,None,None,None,None),
(5,226,"GtkCheckButton","check_button_broken_files_pdf",224,None,None,None,1),
(5,227,"GtkCheckButton","check_button_broken_files_archive",224,None,None,None,2),
(5,228,"GtkCheckButton","check_button_broken_files_image",224,None,None,None,3),
(6,1,"GtkPopover","popover_right_click",None,None,None,None,None),
(6,2,"GtkBox",None,1,None,None,None,None),
(6,3,"GtkButton","buttons_popover_right_click_open_file",2,None,None,None,None),
@ -284,12 +290,12 @@
(9,27,"GtkBox",None,26,None,None,None,None),
(9,28,"GtkCheckButton","check_button_settings_hide_hard_links",27,None,None,None,None),
(9,29,"GtkCheckButton","check_button_settings_show_preview_duplicates",27,None,None,None,1),
(9,30,"GtkCheckButton","check_button_settings_duplicates_delete_outdated_cache",27,None,None,None,2),
(9,30,"GtkCheckButton","check_button_settings_duplicates_delete_outdated_cache",27,None,None,None,8),
(9,31,"GtkBox",None,27,None,None,None,3),
(9,32,"GtkLabel","label_settings_duplicate_minimal_size_cache",31,None,None,None,None),
(9,33,"GtkEntry","entry_settings_cache_file_minimal_size",31,None,None,None,1),
(9,34,"GtkCheckButton","check_button_duplicates_use_prehash_cache",27,None,None,None,4),
(9,35,"GtkButton","button_settings_duplicates_clear_cache",27,None,None,None,5),
(9,35,"GtkButton","button_settings_duplicates_clear_cache",27,None,None,None,9),
(9,36,"GtkBox",None,27,None,None,None,6),
(9,37,"GtkLabel","label_settings_duplicate_minimal_size_cache_prehash",36,None,None,None,None),
(9,38,"GtkEntry","entry_settings_prehash_cache_file_minimal_size",36,None,None,None,1),
@ -302,7 +308,7 @@
(9,45,"GtkLabel",None,40,None,None,None,None),
(9,46,"GtkNotebookPage",None,6,None,None,None,3),
(9,47,"GtkBox",None,46,None,None,None,None),
(9,48,"GtkButton","button_settings_similar_videos_clear_cache",47,None,None,None,None),
(9,48,"GtkButton","button_settings_similar_videos_clear_cache",47,None,None,None,3),
(9,49,"GtkCheckButton","check_button_settings_similar_videos_delete_outdated_cache",47,None,None,None,1),
(9,50,"GtkLabel",None,46,None,None,None,None),
(9,51,"GtkBox",None,3,None,None,None,2),
@ -629,6 +635,7 @@
(5,131,"GtkNotebookPage","child",None,None,None,None,None,132),
(5,131,"GtkNotebookPage","position","9",None,None,None,None,None),
(5,131,"GtkNotebookPage","tab",None,None,None,None,None,133),
(5,132,"GtkOrientable","orientation","vertical",None,None,None,None,None),
(5,132,"GtkWidget","focusable","1",None,None,None,None,None),
(5,133,"GtkLabel","label","Broken Files",1,None,None,None,None),
(5,134,"GtkNotebookPage","child",None,None,None,None,None,135),
@ -729,6 +736,15 @@
(5,220,"GtkImage","icon-name","image-missing",None,None,None,None,None),
(5,220,"GtkWidget","halign","center",None,None,None,None,None),
(5,222,"GtkLabel","label","VVV",None,None,None,None,None),
(5,223,"GtkWidget","vexpand","True",None,None,None,None,None),
(5,225,"GtkCheckButton","active","True",None,None,None,None,None),
(5,225,"GtkCheckButton","label","Audio",None,None,None,None,None),
(5,226,"GtkCheckButton","active","True",None,None,None,None,None),
(5,226,"GtkCheckButton","label","PDF",None,None,None,None,None),
(5,227,"GtkCheckButton","active","True",None,None,None,None,None),
(5,227,"GtkCheckButton","label","Archive",None,None,None,None,None),
(5,228,"GtkCheckButton","active","True",None,None,None,None,None),
(5,228,"GtkCheckButton","label","Image",None,None,None,None,None),
(6,1,"GtkPopover","child",None,None,None,None,None,2),
(6,1,"GtkPopover","position","left",None,None,None,None,None),
(6,2,"GtkOrientable","orientation","vertical",None,None,None,None,None),

View file

@ -778,8 +778,42 @@
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkScrolledWindow" id="scrolled_window_broken_files">
<object class="GtkBox">
<property name="focusable">1</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkCheckButton" id="check_button_broken_files_audio">
<property name="active">True</property>
<property name="label">Audio</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check_button_broken_files_pdf">
<property name="active">True</property>
<property name="label">PDF</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check_button_broken_files_archive">
<property name="active">True</property>
<property name="label">Archive</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check_button_broken_files_image">
<property name="active">True</property>
<property name="label">Image</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_broken_files">
<property name="vexpand">True</property>
</object>
</child>
</object>
</property>
<property name="position">9</property>

View file

@ -156,13 +156,6 @@
<property name="label" translatable="yes">Show image preview</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check_button_settings_duplicates_delete_outdated_cache">
<property name="active">1</property>
<property name="focusable">1</property>
<property name="label" translatable="yes">Delete outdated cache entries automatically</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="margin-end">4</property>
@ -190,14 +183,6 @@
<property name="label" translatable="yes">Use prehash cache</property>
</object>
</child>
<child>
<object class="GtkButton" id="button_settings_duplicates_clear_cache">
<property name="focusable">1</property>
<property name="label" translatable="yes">Remove outdated results from duplicates cache</property>
<property name="receives-default">1</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="margin-end">4</property>
@ -219,6 +204,21 @@
</child>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check_button_settings_duplicates_delete_outdated_cache">
<property name="active">1</property>
<property name="focusable">1</property>
<property name="label" translatable="yes">Delete outdated cache entries automatically</property>
</object>
</child>
<child>
<object class="GtkButton" id="button_settings_duplicates_clear_cache">
<property name="focusable">1</property>
<property name="label" translatable="yes">Remove outdated results from duplicates cache</property>
<property name="receives-default">1</property>
<property name="valign">center</property>
</object>
</child>
</object>
</property>
<property name="position">1</property>
@ -271,6 +271,12 @@
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="check_button_settings_similar_videos_delete_outdated_cache">
<property name="focusable">1</property>
<property name="label" translatable="yes">Delete outdated cache entries automatically</property>
</object>
</child>
<child>
<object class="GtkButton" id="button_settings_similar_videos_clear_cache">
<property name="focusable">1</property>
@ -279,12 +285,6 @@
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check_button_settings_similar_videos_delete_outdated_cache">
<property name="focusable">1</property>
<property name="label" translatable="yes">Delete outdated cache entries automatically</property>
</object>
</child>
</object>
</property>
<property name="position">3</property>