Skip to content

Commit

Permalink
Trash music (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
qarmin authored May 30, 2022
1 parent 19afce5 commit 3748411
Show file tree
Hide file tree
Showing 9 changed files with 150 additions and 40 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ results*.txt
TestSuite*
*.snap
flatpak/
*.zip
*.zip
*.zst
138 changes: 116 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ members = [
"czkawka_gui",
]
[profile.release]
# Panic = "abort" will crash entire app when processing invalid image file.
# Since crash happens in external library, this is only way to handle this(I think).
# panic = "unwind" in opposite to "abort", allows to catch panic!()
# Since Czkawka parse different types of files with few libraries, it is possible
# that some files will cause crash, so at this moment I don't recommend to use "abort"
# until you are ready to occasional crashes
panic = "unwind"

# LTO setting is disabled by default, because release mode is usually needed to develop app and compilation with LTO would take a lot of time
Expand Down
11 changes: 11 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## Version 5.0.0 - ?.?.2022r
- GTK 4 port - [#466](https://github.com/qarmin/czkawka/pull/466)
- Resize preview with window - [#466](https://github.com/qarmin/czkawka/pull/466)
- Fix removing only one item from list view - [#466](https://github.com/qarmin/czkawka/pull/466)
- Fix showing help command in duplicate CLI mode - [#720](https://github.com/qarmin/czkawka/pull/720)
- Fix freeze when not choosing any tag in similiar music mode - [TODO]()
- Read more tags from music files - [#705](https://github.com/qarmin/czkawka/pull/705)
- Improve checking for invalid extensions - [#705](https://github.com/qarmin/czkawka/pull/705)
- Support for finding invalid PDF files - [#705](https://github.com/qarmin/czkawka/pull/705)
- Re-enable checking for broken music files(`libasound.so.2` no longer needed) - [#705](https://github.com/qarmin/czkawka/pull/705)

## Version 4.1.0 - 24.04.2022r
- New mode - finding files whose content not match with their extension - [#678](https://github.com/qarmin/czkawka/pull/678)
- Builtin icons - no more invalid, theme/OS dependant icons - [#659](https://github.com/qarmin/czkawka/pull/659)
Expand Down
5 changes: 1 addition & 4 deletions czkawka_core/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ pub const ZIP_FILES_EXTENSIONS: &[&str] = &[".zip"];
pub const PDF_FILES_EXTENSIONS: &[&str] = &[".pdf"];

pub const AUDIO_FILES_EXTENSIONS: &[&str] = &[
".mp3", ".flac", ".wav", ".ogg", ".m4a", ".aac", ".aiff", ".pcm", ".aif", ".aiff", ".aifc", ".m3a", ".mp2", ".mp4a", ".mp2a", ".mpga", ".wave", ".weba",
".wma",
/*".ac3",*/
/*".oga", https://github.com/Serial-ATA/lofty-rs/issues/47#issuecomment-1120414259*/
".mp3", ".flac", ".wav", ".ogg", ".m4a", ".aac", ".aiff", ".pcm", ".aif", ".aiff", ".aifc", ".m3a", ".mp2", ".mp4a", ".mp2a", ".mpga", ".wave", ".weba", ".wma", ".oga",
];

pub const VIDEO_FILES_EXTENSIONS: &[&str] = &[
Expand Down
2 changes: 1 addition & 1 deletion czkawka_gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ regex = "1.5.5"
image_hasher = "1.0.0"

# Move files to trash
trash = "1.3.0"
trash = "2.1.4"

# For moving files(why std::fs doesn't have such features)
fs_extra = "1.2.0"
Expand Down
5 changes: 5 additions & 0 deletions czkawka_gui/src/connect_things/connect_button_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ pub fn connect_button_search(
);
entry_info.set_text(&flg!("search_not_choosing_any_music"));
show_dialog.store(false, Ordering::Relaxed);

notebook_main.set_sensitive(true);
notebook_upper.set_sensitive(true);
button_settings.set_sensitive(true);
button_app_info.set_sensitive(true);
}
}
NotebookMainEnum::Symlinks => {
Expand Down
1 change: 0 additions & 1 deletion czkawka_gui/src/connect_things/connect_button_stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub fn connect_button_stop(gui_data: &GuiData) {
let button_stop_in_dialog = gui_data.progress_window.button_stop_in_dialog.clone();
let stop_dialog = gui_data.progress_window.window_progress.clone();
let stop_sender = gui_data.stop_sender.clone();
// TODO GTK 4 change this to connect released, not sure why not works here

button_stop_in_dialog.connect_clicked(move |_a| {
stop_dialog.set_title(Some(&format!("{} ({})", flg!("window_progress_title"), flg!("progress_stop_additional_message"))));
Expand Down
19 changes: 10 additions & 9 deletions czkawka_gui/src/initialize_gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,16 +538,17 @@ fn connect_event_mouse(gui_data: &GuiData) {
let check_button_settings_show_preview = gui_data.settings.check_button_settings_show_preview_duplicates.clone();
let image_preview = gui_data.main_notebook.image_preview_duplicates.clone();
let preview_path = gui_data.preview_path.clone();
let tree_view = gui_data.main_notebook.tree_view_duplicate_finder.clone();

let gc = gui_data.main_notebook.gc_tree_view_duplicate_finder.clone();
tree_view.set_property("activate-on-single-click", true);

// TODO GTK 4, currently not works, connect_pressed shows previous thing
gc.connect_released(move |gc, _event, _, _| {
let tree_view = gc.widget().downcast::<gtk4::TreeView>().unwrap();
// TODO GTK 4, currently not works, connect_pressed shows previous thing - https://gitlab.gnome.org/GNOME/gtk/-/issues/4939
// Use connect_released when it will be fixed, currently using connect_row_activated workaround
tree_view.connect_row_activated(move |tree_view, _b, _c| {
let nb_object = &NOTEBOOKS_INFOS[NotebookMainEnum::Duplicate as usize];
let preview_path = preview_path.clone();
show_preview(
&tree_view,
tree_view,
&text_view_errors,
&check_button_settings_show_preview,
&image_preview,
Expand All @@ -563,16 +564,16 @@ fn connect_event_mouse(gui_data: &GuiData) {
let check_button_settings_show_preview = gui_data.settings.check_button_settings_show_preview_similar_images.clone();
let preview_path = gui_data.preview_path.clone();
let image_preview = gui_data.main_notebook.image_preview_similar_images.clone();
let tree_view = gui_data.main_notebook.tree_view_similar_images_finder.clone();

let gc = gui_data.main_notebook.gc_tree_view_similar_images_finder.clone();
tree_view.set_property("activate-on-single-click", true);

// TODO GTK 4, currently not works, connect_pressed shows previous thing
gc.connect_released(move |gc, _event, _, _| {
let tree_view = gc.widget().downcast::<gtk4::TreeView>().unwrap();
tree_view.connect_row_activated(move |tree_view, _b, _c| {
let nb_object = &NOTEBOOKS_INFOS[NotebookMainEnum::SimilarImages as usize];
let preview_path = preview_path.clone();
show_preview(
&tree_view,
tree_view,
&text_view_errors,
&check_button_settings_show_preview,
&image_preview,
Expand Down

0 comments on commit 3748411

Please sign in to comment.