1
0
Fork 0
mirror of synced 2024-06-02 10:35:02 +12:00

Compare window partial fixes

This commit is contained in:
Rafał Mikrut 2022-05-21 10:08:36 +02:00
parent c930e90555
commit da5e5267d4
8 changed files with 119 additions and 135 deletions

View file

@ -150,7 +150,7 @@ jobs:
linux-gui-${{github.ref}}-${{github.sha}}
- name: Install Gtk, Mingw, unzip, zip and wget
run: sudo apt-get update; sudo apt install libgtk-4-dev libasound2-dev -y
run: sudo apt-get update; sudo apt install libgtk-4-dev libasound2-dev fuse libfuse2 -y
- name: Build GUI Debug
run: cargo build --bin czkawka_gui
@ -214,7 +214,7 @@ jobs:
linux-appimage-gui-${{github.ref}}-${{github.sha}}
- name: Install Gtk,
run: sudo apt-get update; sudo apt install libgtk-4-dev libasound2-dev librsvg2-dev wget -y
run: sudo apt-get update; sudo apt install libgtk-4-dev libasound2-dev librsvg2-dev wget fuse libfuse2 -y
- name: Build GUI Release
run: cargo build --release --bin czkawka_gui

View file

@ -38,6 +38,8 @@ pub fn connect_button_compare(gui_data: &GuiData) {
let image_compare_left = gui_data.compare_images.image_compare_left.clone();
let image_compare_right = gui_data.compare_images.image_compare_right.clone();
window_compare.set_default_size(700, 700);
button_compare.connect_clicked(move |_| {
let nb_number = notebook_main.current_page().unwrap();
let tree_view = &main_tree_views[nb_number as usize];
@ -86,17 +88,18 @@ pub fn connect_button_compare(gui_data: &GuiData) {
let window_compare = gui_data.compare_images.window_compare.clone();
let image_compare_left = gui_data.compare_images.image_compare_left.clone();
let image_compare_right = gui_data.compare_images.image_compare_right.clone();
// window_compare.connect_delete_event(move |window_compare, _| { // TODO GTK4
// window_compare.hide();
// *shared_image_cache.borrow_mut() = Vec::new();
// *shared_current_path.borrow_mut() = None;
// *shared_current_of_groups.borrow_mut() = 0;
// *shared_numbers_of_groups.borrow_mut() = 0;
// *shared_using_for_preview.borrow_mut() = (None, None);
// image_compare_left.set_from_pixbuf(None);
// image_compare_right.set_from_pixbuf(None);
// gtk4::Inhibit(true)
// });
window_compare.connect_close_request(move |window_compare| {
// TODO GTK4
window_compare.hide();
*shared_image_cache.borrow_mut() = Vec::new();
*shared_current_path.borrow_mut() = None;
*shared_current_of_groups.borrow_mut() = 0;
*shared_numbers_of_groups.borrow_mut() = 0;
*shared_using_for_preview.borrow_mut() = (None, None);
image_compare_left.set_from_pixbuf(None);
image_compare_right.set_from_pixbuf(None);
gtk4::Inhibit(true)
});
let button_go_previous_compare_group = gui_data.compare_images.button_go_previous_compare_group.clone();
let button_go_next_compare_group = gui_data.compare_images.button_go_next_compare_group.clone();
@ -202,13 +205,13 @@ pub fn connect_button_compare(gui_data: &GuiData) {
);
});
// TODO GTK 4
// // TODO GTK 4
// let check_button_left_preview_text = gui_data.compare_images.check_button_left_preview_text.clone();
// let shared_using_for_preview = gui_data.compare_images.shared_using_for_preview.clone();
// let notebook_main = gui_data.main_notebook.notebook_main.clone();
// let shared_current_path = gui_data.compare_images.shared_current_path.clone();
// let main_tree_views = gui_data.main_notebook.get_main_tree_views();
// check_button_left_preview_text.connect_clicked(move |check_button_left_preview_text| {
// check_button_left_preview_text.connect_(move |check_button_left_preview_text| {
// let nb_number = notebook_main.current_page().unwrap();
// let tree_view = &main_tree_views[nb_number as usize];
// let nb_object = &NOTEBOOKS_INFOS[nb_number as usize];
@ -285,13 +288,13 @@ fn populate_groups_at_start(
let cache_all_images = generate_cache_for_results(all_vec);
// This is safe, because cache have at least 2 results
// image_compare_left.set_from_pixbuf(cache_all_images[0].2.pixbuf().as_ref()); // TODO GTK 4
// image_compare_right.set_from_pixbuf(cache_all_images[1].2.pixbuf().as_ref()); // TODO GTK 4
image_compare_left.set_paintable(cache_all_images[0].2.paintable().as_ref()); // TODO GTK 4
image_compare_right.set_paintable(cache_all_images[1].2.paintable().as_ref()); // TODO GTK 4
*shared_using_for_preview.borrow_mut() = (Some(cache_all_images[0].4.clone()), Some(cache_all_images[1].4.clone()));
check_button_left_preview_text.set_label(Some(&format!("1. {}", get_max_file_name(&cache_all_images[0].0, 70))));
check_button_right_preview_text.set_label(Some(&format!("2. {}", get_max_file_name(&cache_all_images[1].0, 70))));
check_button_left_preview_text.set_label(Some(&format!("1. {}", get_max_file_name(&cache_all_images[0].0, 60))));
check_button_right_preview_text.set_label(Some(&format!("2. {}", get_max_file_name(&cache_all_images[1].0, 60))));
label_group_info.set_text(
flg!(
@ -502,11 +505,11 @@ fn populate_similar_scrolled_view(
button_left.connect_clicked(move |_button_left| {
shared_using_for_preview_clone.borrow_mut().0 = Some(tree_path_clone.clone());
update_bottom_buttons(&all_gtk_box_clone, shared_using_for_preview_clone.clone(), shared_image_cache_clone.clone());
// image_compare_left.set_from_pixbuf(big_thumbnail_clone.pixbuf().as_ref()); // TODO GTK 4
image_compare_left.set_paintable(big_thumbnail_clone.paintable().as_ref()); // TODO GTK 4
let is_active = model_clone.get::<bool>(&model_clone.iter(&tree_path_clone).unwrap(), column_selection);
check_button_left_preview_text_clone.set_active(is_active);
check_button_left_preview_text_clone.set_label(Some(&format!("{}. {}", number + 1, get_max_file_name(&path_clone, 70))));
check_button_left_preview_text_clone.set_label(Some(&format!("{}. {}", number + 1, get_max_file_name(&path_clone, 60))));
});
let big_thumbnail_clone = big_thumbnail.clone();
@ -521,11 +524,11 @@ fn populate_similar_scrolled_view(
button_right.connect_clicked(move |_button_right| {
shared_using_for_preview_clone.borrow_mut().1 = Some(tree_path_clone.clone());
update_bottom_buttons(&all_gtk_box_clone, shared_using_for_preview_clone.clone(), shared_image_cache_clone.clone());
// image_compare_right.set_from_pixbuf(big_thumbnail_clone.pixbuf().as_ref()); // TODO GTK 4
image_compare_right.set_paintable(big_thumbnail_clone.paintable().as_ref()); // TODO GTK 4
let is_active = model_clone.get::<bool>(&model_clone.iter(&tree_path_clone).unwrap(), column_selection);
check_button_right_preview_text_clone.set_active(is_active);
check_button_right_preview_text_clone.set_label(Some(&format!("{}. {}", number + 1, get_max_file_name(&path_clone, 70))));
check_button_right_preview_text_clone.set_label(Some(&format!("{}. {}", number + 1, get_max_file_name(&path_clone, 60))));
});
smaller_box.append(&button_left);

View file

@ -292,7 +292,7 @@ pub fn empty_folder_remover(
let mut messages: String = "".to_string();
// Must be deleted from end to start, because when deleting entries, TreePath(and also TreeIter) will points to invalid data
for (counter, tree_path) in selected_rows.iter().rev().enumerate() {
for tree_path in selected_rows.iter().rev() {
let iter = model.iter(tree_path).unwrap();
let name = model.get::<String>(&iter, column_file_name);
@ -408,7 +408,7 @@ pub fn basic_remove(
}
// Must be deleted from end to start, because when deleting entries, TreePath(and also TreeIter) will points to invalid data
for (counter, tree_path) in selected_rows.iter().rev().enumerate() {
for tree_path in selected_rows.iter().rev() {
let iter = model.iter(tree_path).unwrap();
let name = model.get::<String>(&iter, column_file_name);

View file

@ -200,7 +200,7 @@ fn hardlink_symlink(
}
if hardlinking == TypeOfTool::Hardlinking {
for symhardlink_data in vec_symhardlink_data {
for (counter, file_to_hardlink) in symhardlink_data.files_to_symhardlink.into_iter().enumerate() {
for file_to_hardlink in symhardlink_data.files_to_symhardlink.into_iter() {
if let Err(e) = make_hard_link(&PathBuf::from(&symhardlink_data.original_data), &PathBuf::from(&file_to_hardlink)) {
add_text_to_text_view(text_view_errors, format!("{} {}, reason {}", flg!("hardlink_failed"), file_to_hardlink, e).as_str());
continue;

View file

@ -23,7 +23,7 @@ pub fn connect_button_stop(gui_data: &GuiData) {
let gc_button_stop_in_dialog = gui_data.progress_window.gc_button_stop_in_dialog.clone();
let stop_sender = gui_data.stop_sender.clone();
// TODO GTK 4 change this to connect released, not sure why not works here
gc_button_stop_in_dialog.connect_pressed(move |a, _b, _c, _d| {
gc_button_stop_in_dialog.connect_pressed(move |_a, _b, _c, _d| {
send_stop_message(&stop_sender);
});
}

View file

@ -22,22 +22,20 @@
<object>
(3,1,"GtkAboutDialog","about_dialog",None,None,None,None,None),
(4,1,"GtkDialog","window_compare",None,None,None,None,None),
(4,2,"GtkBox",None,1,"content_area",None,None,None),
(4,2,"GtkBox",None,1,None,None,None,None),
(4,3,"GtkBox",None,2,None,None,None,None),
(4,4,"GtkBox",None,3,None,None,None,None),
(4,5,"GtkLabel","label_group_info",4,None,None,None,None),
(4,6,"GtkButton","button_go_next_compare_group",4,None,None,None,1),
(4,7,"GtkImage",None,6,None,None,None,None),
(4,8,"GtkButton","button_go_previous_compare_group",4,None,None,None,2),
(4,9,"GtkImage",None,8,None,None,None,None),
(4,10,"GtkBox",None,3,None,None,None,1),
(4,11,"GtkCheckButton","check_button_left_preview_text",10,None,None,None,None),
(4,12,"GtkCheckButton","check_button_right_preview_text",10,None,None,None,1),
(4,13,"GtkBox",None,3,None,None,None,2),
(4,14,"GtkImage","image_compare_left",13,None,None,None,None),
(4,15,"GtkImage","image_compare_right",13,None,None,None,1),
(4,16,"GtkScrolledWindow","scrolled_window_compare_choose_images",3,None,None,None,3),
(4,17,"GtkBox",None,1,None,None,None,1),
(4,4,"GtkLabel","label_group_info",3,None,None,None,None),
(4,5,"GtkButton","button_go_next_compare_group",3,None,None,None,1),
(4,6,"GtkImage",None,5,None,None,None,None),
(4,7,"GtkButton","button_go_previous_compare_group",3,None,None,None,2),
(4,8,"GtkImage",None,7,None,None,None,None),
(4,9,"GtkBox",None,2,None,None,None,1),
(4,10,"GtkCheckButton","check_button_left_preview_text",9,None,None,None,None),
(4,11,"GtkCheckButton","check_button_right_preview_text",9,None,None,None,1),
(4,12,"GtkBox",None,2,None,None,None,2),
(4,13,"GtkImage","image_compare_left",12,None,None,None,None),
(4,14,"GtkImage","image_compare_right",12,None,None,None,1),
(4,15,"GtkScrolledWindow","scrolled_window_compare_choose_images",2,None,None,None,3),
(5,1,"GtkAdjustment","adjustment1",None,None,None,None,None),
(5,2,"GtkWindow","window_main",None,None,None,None,None),
(5,3,"GtkBox",None,2,None,None,None,None),
@ -317,30 +315,25 @@
(3,1,"GtkAboutDialog","logo-icon-name","help-about-symbolic",None,None,None,None,None),
(3,1,"GtkAboutDialog","program-name","Czkawka",None,None,None,None,None),
(3,1,"GtkAboutDialog","version","4.1.0",None,None,None,None,None),
(4,2,"GtkBox","spacing","2",None,None,None,None,None),
(4,2,"GtkOrientable","orientation","vertical",None,None,None,None,None),
(4,2,"GtkWidget","visible","0",None,None,None,None,None),
(4,3,"GtkOrientable","orientation","vertical",None,None,None,None,None),
(4,3,"GtkWidget","vexpand","1",None,None,None,None,None),
(4,5,"GtkLabel","label","Group XD/PER XD (99 images in current group)",1,None,None,None,None),
(4,5,"GtkWidget","halign","center",None,None,None,None,None),
(4,5,"GtkWidget","hexpand","1",None,None,None,None,None),
(4,6,"GtkWidget","focusable","1",None,None,None,None,None),
(4,6,"GtkWidget","receives-default","1",None,None,None,None,None),
(4,7,"GtkImage","icon-name","image-missing",None,None,None,None,None),
(4,8,"GtkWidget","focusable","1",None,None,None,None,None),
(4,8,"GtkWidget","receives-default","1",None,None,None,None,None),
(4,9,"GtkImage","icon-name","image-missing",None,None,None,None,None),
(4,10,"GtkBox","homogeneous","1",None,None,None,None,None),
(4,11,"GtkCheckButton","label","First Game",1,None,None,None,None),
(4,2,"GtkWidget","vexpand","1",None,None,None,None,None),
(4,4,"GtkLabel","label","Group XD/PER XD (99 images in current group)",1,None,None,None,None),
(4,4,"GtkWidget","halign","center",None,None,None,None,None),
(4,4,"GtkWidget","hexpand","1",None,None,None,None,None),
(4,5,"GtkWidget","focusable","1",None,None,None,None,None),
(4,5,"GtkWidget","receives-default","1",None,None,None,None,None),
(4,6,"GtkImage","icon-name","image-missing",None,None,None,None,None),
(4,7,"GtkWidget","focusable","1",None,None,None,None,None),
(4,7,"GtkWidget","receives-default","1",None,None,None,None,None),
(4,8,"GtkImage","icon-name","image-missing",None,None,None,None,None),
(4,9,"GtkBox","homogeneous","1",None,None,None,None,None),
(4,10,"GtkCheckButton","label","First Game",1,None,None,None,None),
(4,10,"GtkWidget","focusable","1",None,None,None,None,None),
(4,11,"GtkCheckButton","label","Second Game",1,None,None,None,None),
(4,11,"GtkWidget","focusable","1",None,None,None,None,None),
(4,12,"GtkCheckButton","label","Second Game",1,None,None,None,None),
(4,12,"GtkWidget","focusable","1",None,None,None,None,None),
(4,13,"GtkBox","homogeneous","1",None,None,None,None,None),
(4,13,"GtkWidget","vexpand","1",None,None,None,None,None),
(4,16,"GtkWidget","focusable","1",None,None,None,None,None),
(4,17,"GtkWidget","can-focus","False",None,None,None,None,None),
(4,17,"GtkWidget","valign","center",None,None,None,None,None),
(4,12,"GtkBox","homogeneous","1",None,None,None,None,None),
(4,12,"GtkWidget","vexpand","1",None,None,None,None,None),
(4,15,"GtkWidget","focusable","1",None,None,None,None,None),
(5,1,"GtkAdjustment","page-increment","10",None,None,None,None,None),
(5,1,"GtkAdjustment","step-increment","1",None,None,None,None,None),
(5,1,"GtkAdjustment","upper","100",None,None,None,None,None),

View file

@ -4,90 +4,77 @@
<!-- interface-name compare_images.ui -->
<requires lib="gtk" version="4.0"/>
<object class="GtkDialog" id="window_compare">
<child internal-child="content_area">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<property name="visible">0</property>
<property name="vexpand">1</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="vexpand">1</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="label_group_info">
<property name="halign">center</property>
<property name="hexpand">1</property>
<property name="label" translatable="yes">Group XD/PER XD (99 images in current group)</property>
</object>
</child>
<child>
<object class="GtkButton" id="button_go_next_compare_group">
<property name="focusable">1</property>
<property name="receives-default">1</property>
<child>
<object class="GtkImage">
<property name="icon-name">image-missing</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="button_go_previous_compare_group">
<property name="focusable">1</property>
<property name="receives-default">1</property>
<child>
<object class="GtkImage">
<property name="icon-name">image-missing</property>
</object>
</child>
</object>
</child>
<object class="GtkLabel" id="label_group_info">
<property name="halign">center</property>
<property name="hexpand">1</property>
<property name="label" translatable="yes">Group XD/PER XD (99 images in current group)</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="homogeneous">1</property>
<child>
<object class="GtkCheckButton" id="check_button_left_preview_text">
<property name="focusable">1</property>
<property name="label" translatable="yes">First Game</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check_button_right_preview_text">
<property name="focusable">1</property>
<property name="label" translatable="yes">Second Game</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="homogeneous">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkImage" id="image_compare_left"/>
</child>
<child>
<object class="GtkImage" id="image_compare_right"/>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_compare_choose_images">
<object class="GtkButton" id="button_go_next_compare_group">
<property name="focusable">1</property>
<property name="receives-default">1</property>
<child>
<object class="GtkImage">
<property name="icon-name">image-missing</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="button_go_previous_compare_group">
<property name="focusable">1</property>
<property name="receives-default">1</property>
<child>
<object class="GtkImage">
<property name="icon-name">image-missing</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="valign">center</property>
<child>
<object class="GtkBox">
<property name="homogeneous">1</property>
<child>
<object class="GtkCheckButton" id="check_button_left_preview_text">
<property name="focusable">1</property>
<property name="label" translatable="yes">First Game</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check_button_right_preview_text">
<property name="focusable">1</property>
<property name="label" translatable="yes">Second Game</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="homogeneous">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkImage" id="image_compare_left"/>
</child>
<child>
<object class="GtkImage" id="image_compare_right"/>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_compare_choose_images">
<property name="focusable">1</property>
</object>
</child>
</object>
</child>
</object>

View file

@ -29,6 +29,7 @@
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkBox">
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">