1
0
Fork 0
mirror of synced 2024-05-17 19:03:08 +12:00
This commit is contained in:
Rafał Mikrut 2023-11-18 22:36:20 +01:00
parent b700c010f2
commit 8834ee8f54
12 changed files with 88 additions and 25 deletions

53
.github/workflows/linux_cli_eyra.yml vendored Normal file
View file

@ -0,0 +1,53 @@
name: 🐧 Linux CLI Eyra
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 2'
env:
CARGO_TERM_COLOR: always
jobs:
linux-cli:
strategy:
matrix:
toolchain: [ nightly ]
type: [ release ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install basic libraries
run: sudo apt-get update; sudo apt install -y
- name: Setup rust version
run: rustup default ${{ matrix.toolchain }}
- name: Add eyra
run: |
cd czkawka_cli
cargo add eyra --rename=std
echo 'fn main() { println!("cargo:rustc-link-arg=-nostartfiles"); }' > build.rs
cd ..
- name: Build Release
run: cargo build --release --bin czkawka_cli
if: ${{ (matrix.type == 'release') }}
- name: Store Linux CLI
uses: actions/upload-artifact@v3
with:
name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }}
path: target/release/czkawka_cli
if: ${{ matrix.type == 'release' }}
- name: Linux Regression Test
run: |
wget https://github.com/qarmin/czkawka/releases/download/6.0.0/TestFiles.zip
cd ci_tester
cargo build --release
cd ..
ci_tester/target/release/ci_tester target/release/czkawka_cli
if: ${{ matrix.type == 'release' }}

View file

@ -1,15 +1,17 @@
## Version 7.0.0 - ?
### GTK GUI
- Added drag&drop support for included/excluded folders - [#1102](https://github.com/qarmin/czkawka/pull/1102)
- Added drag&drop support for included/excluded folders - [#1106](https://github.com/qarmin/czkawka/pull/1106)
### CLI
- Providing full static rust binary with [Eyra](https://github.com/sunfishcode/eyra) - [#1102](https://github.com/qarmin/czkawka/pull/1102)
### Krokiet GUI
- Initial release of new gui - [#1102](https://github.com/qarmin/czkawka/pull/1102)
### Core
- Using normal crossbeam channels instead of asyncio tokio channel - [#1102](https://github.com/qarmin/czkawka/pull/1102)
- Fixed tool type when using progress of empty directories
- Fixed tool type when using progress of empty directories - [#1102](https://github.com/qarmin/czkawka/pull/1102)
- Fixed missing json support in saving size and name - [#1102](https://github.com/qarmin/czkawka/pull/1102)
## Version 6.1.0 - 15.10.2023r
- BREAKING CHANGE - Changed cache saving method, deduplicated, optimized and simplified procedure(all files needs to be hashed again) - [#1072](https://github.com/qarmin/czkawka/pull/1072), [#1086](https://github.com/qarmin/czkawka/pull/1086)

View file

@ -160,7 +160,7 @@ const WORKAROUNDS: &[(&str, &str)] = &[
("exe", "xls"), // Not sure why xls is not recognized
];
#[derive(Clone, Serialize)]
#[derive(Clone, Serialize, Debug)]
pub struct BadFileEntry {
pub path: PathBuf,
pub modified_date: u64,

View file

@ -26,7 +26,7 @@ use crate::common_dir_traversal::{common_get_entry_data_metadata, common_read_di
use crate::common_tool::{CommonData, CommonToolData, DeleteMethod};
use crate::common_traits::*;
#[derive(Clone, Serialize, Deserialize)]
#[derive(Clone, Serialize, Deserialize, Debug)]
pub struct FileEntry {
pub path: PathBuf,
pub modified_date: u64,

View file

@ -35,7 +35,7 @@ pub trait PrintResults {
fn save_results_to_file_as_json(&self, file_name: &str, pretty_print: bool) -> std::io::Result<()>;
fn save_results_to_file_as_json_internal<T: Serialize>(&self, file_name: &str, item_to_serialize: &T, pretty_print: bool) -> std::io::Result<()> {
fn save_results_to_file_as_json_internal<T: Serialize + std::fmt::Debug>(&self, file_name: &str, item_to_serialize: &T, pretty_print: bool) -> std::io::Result<()> {
if pretty_print {
self.save_results_to_file_as_json_pretty(file_name, item_to_serialize)
} else {
@ -44,7 +44,7 @@ pub trait PrintResults {
}
#[fun_time(message = "save_results_to_file_as_json_pretty", level = "debug")]
fn save_results_to_file_as_json_pretty<T: Serialize>(&self, file_name: &str, item_to_serialize: &T) -> std::io::Result<()> {
fn save_results_to_file_as_json_pretty<T: Serialize + std::fmt::Debug>(&self, file_name: &str, item_to_serialize: &T) -> std::io::Result<()> {
let file_handler = File::create(file_name)?;
let mut writer = BufWriter::new(file_handler);
serde_json::to_writer_pretty(&mut writer, item_to_serialize)?;
@ -52,7 +52,7 @@ pub trait PrintResults {
}
#[fun_time(message = "save_results_to_file_as_json_compact", level = "debug")]
fn save_results_to_file_as_json_compact<T: Serialize>(&self, file_name: &str, item_to_serialize: &T) -> std::io::Result<()> {
fn save_results_to_file_as_json_compact<T: Serialize + std::fmt::Debug>(&self, file_name: &str, item_to_serialize: &T) -> std::io::Result<()> {
let file_handler = File::create(file_name)?;
let mut writer = BufWriter::new(file_handler);
serde_json::to_writer(&mut writer, item_to_serialize)?;

View file

@ -1160,11 +1160,14 @@ impl PrintResults for DuplicateFinder {
Ok(())
}
// TODO - check if is possible to save also data in header about size and name in SizeName mode - https://github.com/qarmin/czkawka/issues/1137
fn save_results_to_file_as_json(&self, file_name: &str, pretty_print: bool) -> io::Result<()> {
if self.get_use_reference() {
match self.check_method {
CheckingMethod::Name => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_names_referenced, pretty_print),
CheckingMethod::SizeName => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_names_referenced, pretty_print),
CheckingMethod::SizeName => {
self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_names_referenced.values().collect::<Vec<_>>(), pretty_print)
}
CheckingMethod::Size => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_referenced, pretty_print),
CheckingMethod::Hash => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_hashes_referenced, pretty_print),
_ => panic!(),
@ -1172,7 +1175,7 @@ impl PrintResults for DuplicateFinder {
} else {
match self.check_method {
CheckingMethod::Name => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_names, pretty_print),
CheckingMethod::SizeName => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_names, pretty_print),
CheckingMethod::SizeName => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size_names.values().collect::<Vec<_>>(), pretty_print),
CheckingMethod::Size => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_size, pretty_print),
CheckingMethod::Hash => self.save_results_to_file_as_json_internal(file_name, &self.files_with_identical_hashes, pretty_print),
_ => panic!(),

View file

@ -32,7 +32,7 @@ const TEMP_EXTENSIONS: &[&str] = &[
".partial",
];
#[derive(Clone, Serialize)]
#[derive(Clone, Serialize, Debug)]
pub struct FileEntry {
pub path: PathBuf,
pub modified_date: u64,

View file

@ -544,7 +544,7 @@ move_files_title_dialog = Choose folder to which you want to move duplicated fil
move_files_choose_more_than_1_path = Only one path may be selected to be able to copy their duplicated files, selected {$path_number}.
move_stats = Properly moved {$num_files}/{$all_files} items
save_results_to_file = Saved results both to txt and json files.
save_results_to_file = Saved results both to txt and json files into {$name} folder.
search_not_choosing_any_music = ERROR: You must select at least one checkbox with music searching types.
search_not_choosing_any_broken_files = ERROR: You must select at least one checkbox with type of checked broken files.

View file

@ -1,5 +1,6 @@
use std::cell::RefCell;
use std::collections::HashMap;
use std::env;
use std::rc::Rc;
use gtk4::prelude::*;
@ -10,6 +11,7 @@ use czkawka_core::common_traits::PrintResults;
use crate::flg;
use crate::gui_structs::gui_data::GuiData;
use crate::help_functions::BottomButtonsEnum;
use crate::localizer_core::generate_translation_hashmap;
use crate::notebook_enums::*;
pub fn connect_button_save(gui_data: &GuiData) {
@ -44,10 +46,15 @@ pub fn connect_button_save(gui_data: &GuiData) {
NotebookMainEnum::BadExtensions => shared_bad_extensions_state.borrow().save_all_in_one("results_bad_extensions"),
};
let current_path = match env::current_dir() {
Ok(t) => t.to_string_lossy().to_string(),
Err(_) => "<unknown>".to_string(),
};
match result {
Ok(()) => (),
Err(e) => {
entry_info.set_text(&format!("Failed to save results to file {e}"));
entry_info.set_text(&format!("Failed to save results to folder {current_path}, reason {e}"));
return;
}
}
@ -57,6 +64,7 @@ pub fn connect_button_save(gui_data: &GuiData) {
&shared_buttons,
&entry_info,
&buttons_save_clone,
current_path,
);
});
}
@ -66,8 +74,9 @@ fn post_save_things(
shared_buttons: &Rc<RefCell<HashMap<NotebookMainEnum, HashMap<BottomButtonsEnum, bool>>>>,
entry_info: &Entry,
buttons_save: &Button,
current_path: String,
) {
entry_info.set_text(&flg!("save_results_to_file"));
entry_info.set_text(&flg!("save_results_to_file", generate_translation_hashmap(vec![("name", current_path),])));
// Set state
{
buttons_save.hide();

View file

@ -6,7 +6,7 @@ use crate::GuiData;
pub fn validate_notebook_data(gui_data: &GuiData) {
// Test treeviews names, each treeview should have set name same as variable name
for item in gui_data.main_notebook.get_main_tree_views().iter() {
for item in &gui_data.main_notebook.get_main_tree_views() {
// println!("Checking {} element", i);
get_notebook_enum_from_tree_view(item);

View file

@ -127,13 +127,13 @@ SLINT_STYLE=material-dark cargo run -- --path .
There are multiple reasons why I decided to use Slint as toolkit for Krokiet over other toolkits.
| Toolkit | Pros | Cons |
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Gtk 4 | - Hard compilation/cross compilation and bundling all required libraries - mostly on windows </br> - Cambalache can be used to create graphically gui </br> - Good gtk4-rs bindings(but sometimes not really intuitive) | - Hard compilation/cross compilation and bundling all required libraries - mostly on windows </br> - Forcing the use of a specific gui creation style </br> - Strange crashes, not working basic features, etc.(again, mostly on windows) </br> - Forcing to use bugged/outdated but dynamically loaded version of libraries on linux (e.g. 4.6 on Ubuntu 22.04) - not all fixes are backported |
| Qt | - QML support - simplify creating of gui from code it is easy to use and powerful </br> - Very flexible framework <br/> - Typescript/javascript <=> qml interoperability </br> - Probably the most mature GUI library | - New and limited qt bindings <br/> - Big cross compilation problems and hard to setup on non windows platforms <br/> - Very easy to create and use invalid state in QML(unexpected null/undefined values etc.) <br/> - Commercial license or GPL |
| Slint | - Internal language is compiled to native code <br/> - Live gui preview with Vscode/Vscodium without needing to use rust <br/> - Full rust solution - easy to compile/cross compile, minimal runtime requirements | - Internal .slint language is more limited than QML(javascript flexibility is big pl) <br/> - Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems <br/> - Commercial license or GPL(is available also different <br/> Popup windows almost not exists <br/> Internal widgets are almost not customizable and usually quite limited ) |
| Iced | - ~100% rust code - so compilation is simple </br> - Elm architecture - simple to understand | - Mostly maintained by one person - slows down fixing bugs and implementing new features </br> - GUI can be created only from rust code, which really is bad for creating complex GUIs(mostly due rust compile times) and this is also </br> - Docs are almost non-existent |
| Tauri | - Easy to create ui(at least for web developers) - uses html/css/js</br>- Quite portable | - Webview dependency - it is not really lightweight and can be hard to compile on some platforms</br>- Cannot select directory - file chooser only can choose files - small thing but important for me</br>- Not very performant Rust <=> Javascript communication |
| Toolkit | Pros | Cons |
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Gtk 4 | - Hard compilation/cross compilation and bundling all required libraries - mostly on windows </br> - Cambalache can be used to create graphically gui </br> - Good gtk4-rs bindings(but sometimes not really intuitive) | - Hard compilation/cross compilation and bundling all required libraries - mostly on windows </br> - Forcing the use of a specific gui creation style </br> - Strange crashes, not working basic features, etc.(again, mostly on windows) </br> - Forcing to use bugged/outdated but dynamically loaded version of libraries on linux (e.g. 4.6 on Ubuntu 22.04) - not all fixes are backported |
| Qt | - QML support - simplify creating of gui from code it is easy to use and powerful </br> - Very flexible framework <br/> - Typescript/javascript <=> qml interoperability </br> - Probably the most mature GUI library | - New and limited qt bindings <br/> - Big cross compilation problems and hard to setup on non windows platforms <br/> - Very easy to create and use invalid state in QML(unexpected null/undefined values etc.) <br/> - Commercial license or GPL |
| Slint | - Internal language is compiled to native code <br/> - Live gui preview with Vscode/Vscodium without needing to use rust <br/> - Full rust solution - easy to compile/cross compile, minimal runtime requirements | - Internal .slint language is more limited than QML(javascript flexibility is big pl) <br/> - Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems <br/> - Commercial license or GPL(is available also different <br/> - Popup windows almost not exists <br/> - Internal widgets are almost not customizable and usually quite limited ) |
| Iced | - ~100% rust code - so compilation is simple </br> - Elm architecture - simple to understand | - Mostly maintained by one person - slows down fixing bugs and implementing new features </br> - GUI can be created only from rust code, which really is bad for creating complex GUIs(mostly due rust compile times) and this is also </br> - Docs are almost non-existent |
| Tauri | - Easy to create ui(at least for web developers) - uses html/css/js</br>- Quite portable | - Webview dependency - it is not really lightweight and can be hard to compile on some platforms</br>- Cannot select directory - file chooser only can choose files - small thing but important for me</br>- Not very performant Rust <=> Javascript communication |
Since I don't have time to create really complex and good looking GUI, I needed a helper tool to create GUI not from
Rust(I don't want to use different language, because this will make communication with czkawka_core harder) so I decided

View file

@ -1,5 +1,3 @@
use std::borrow::Borrow;
use slint::{ComponentHandle, Model, ModelRc, VecModel};
use crate::{Callabler, CurrentTab, MainListModel, MainWindow};
@ -16,7 +14,6 @@ pub fn connect_delete_button(app: &MainWindow) {
CurrentTab::EmptyFolders => app.get_empty_folder_model(),
CurrentTab::SimilarImages => app.get_similar_images_model(),
CurrentTab::EmptyFiles => app.get_empty_files_model(),
_ => panic!(),
};
let new_model = handle_delete_items(&model, active_tab == CurrentTab::EmptyFolders);
@ -26,7 +23,6 @@ pub fn connect_delete_button(app: &MainWindow) {
CurrentTab::EmptyFolders => app.set_empty_folder_model(new_model),
CurrentTab::SimilarImages => app.set_similar_images_model(new_model),
CurrentTab::EmptyFiles => app.set_empty_files_model(new_model),
_ => panic!(),
}
}
});