1
0
Fork 0
mirror of synced 2024-05-03 12:03:22 +12:00

Fix loading invalid item

This commit is contained in:
Rafał Mikrut 2024-02-24 10:46:34 +01:00
parent 4851372b95
commit 562e16cad2
2 changed files with 11 additions and 10 deletions

View file

@ -30,7 +30,7 @@ release build usually take > 60 minutes.
As workaround you can use this command, which require nightly version of rust:
```
RUSTFLAGS="-Zmir-enable-passes=-ScalarReplacementOfAggregates" cargo build --release
RUSTFLAGS="-Zmir-enable-passes=-ScalarReplacementOfAggregates" cargo +nightly build --release
```
The only exception is building skia renderer which is non default feature that can be enabled manually if you want to
@ -113,13 +113,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 | - Good Linux support </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/> - Hard to cross-compile <br/> - Very easy to create and use invalid state in QML(unexpected null/undefined values, messed properties bindings 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 </br> - Static type checks in slint files | - Internal .slint language is more limited than QML <br/> - Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems <br/> - Only GPL is only available open-source license <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) </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 and on Linux e.g. webRTC not working</br>- Cannot select directory - file chooser only can choose files - small thing but important for me</br>- Not very performant Rust <=> Javascript communication (less problematic with [Tauri 2](https://github.com/tauri-apps/tauri/pull/7170#issuecomment-1583279023) ) |
| Toolkit | Pros | Cons |
|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Gtk 4 | - Good Linux support </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/> - Hard to cross-compile <br/> - Very easy to create and use invalid state in QML(unexpected null/undefined values, messed properties bindings 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 </br> - Static type checks in slint files | - Internal .slint language is more limited than QML <br/> - Out of bounds and similar errors are quietly being corrected instead printing error - this can lead to hard to debug problems <br/> - Only GPL is only available open-source license <br/> - Popup windows almost not exists <br/> - Internal widgets are almost not customizable and usually quite limited </br> - Creating big/good looking with custom widgets gui is very hard |
| 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) </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 and on Linux e.g. webRTC not working</br>- Cannot select directory - file chooser only can choose files - small thing but important for me</br>- Not very performant Rust <=> Javascript communication (less problematic with [Tauri 2](https://github.com/tauri-apps/tauri/pull/7170#issuecomment-1583279023)) </br> - Uses Javascript/Typescript which is a lot of harder to update/maintain than rust due being less strict |
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
@ -130,7 +130,8 @@ Czkawka was a reason why I started to find other toolkits.
Tauri - I don't really like to use Javascript because I already used it with Qt(C++) + QML + Typescript combination and
I found that creating ui in such language may be simple at start but later any bigger changes cause a lot of runtime
errors.
errors. Despite these problems, my next project(closed source), will just use Tauri + slint, because actually in that
case it is rather the best option.
So only Slint left with its cons and pros.

View file

@ -198,7 +198,7 @@ pub fn connect_changing_settings_preset(app: &MainWindow) {
app.global::<Callabler>().on_changed_settings_preset(move || {
let app = a.upgrade().unwrap();
let current_item = app.global::<Settings>().get_settings_preset_idx();
let loaded_data = load_data_from_file::<SettingsCustom>(get_config_file(current_item + 1));
let loaded_data = load_data_from_file::<SettingsCustom>(get_config_file(current_item));
match loaded_data {
Ok(loaded_data) => {
set_settings_to_gui(&app, &loaded_data);