Skip to content

Commit

Permalink
Fixes again
Browse files Browse the repository at this point in the history
  • Loading branch information
qarmin committed Oct 6, 2024
1 parent c72760a commit be3c227
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 9 deletions.
9 changes: 8 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
regenerated
from scratch(it uses new name)

### Known regressions

- Slint 1.8 which Krokiet uses requires femtovg 0.9.2 which broke font
rendering - https://github.com/slint-ui/slint/issues/6298

### Core

- Removed some unnecessary panics - [#1354](https://github.com/qarmin/czkawka/pull/1354)
Expand All @@ -27,7 +32,7 @@
- Added avif support(via external C library, not enabled by
default) - [#1358](https://github.com/qarmin/czkawka/pull/1358)
- Integer overflow are enabled by default(prepare for reporting bugs, slower performance and
unstability) - [#1358](https://github.com/qarmin/czkawka/pull/1358)
general unstability) - [#1358](https://github.com/qarmin/czkawka/pull/1358)
- Fixed crash when loading invalid image cache - [#1230](https://github.com/qarmin/czkawka/pull/1230)

### Krokiet
Expand All @@ -41,6 +46,8 @@
- Modify logo a little - [#1359](https://github.com/qarmin/czkawka/pull/1359)
- Avoid errors when trying to load preview of not supported file - [#1359](https://github.com/qarmin/czkawka/pull/1359)
- Added ability to show preview of referenced folders - [#1359](https://github.com/qarmin/czkawka/pull/1359)
- Enable selecting with space and jumping over entries with
arrows and opening with enter - [#1359](https://github.com/qarmin/czkawka/pull/1359)

### GTK GUI

Expand Down
2 changes: 2 additions & 0 deletions krokiet/ui/left_side_panel.slint
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export component LeftSidePanel {
HorizontalLayout {
alignment: end;
Button {
checkable: true;
checked: GuiState.visible_tool_settings;
visible: GuiState.available_subsettings;
min-width: 20px;
min-height: 20px;
Expand Down
27 changes: 25 additions & 2 deletions krokiet/ui/main_lists.slint
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ export component MainList {
}

focus_item := FocusScope {
width: 0px; // Hack to not steal first click from other components - https://github.com/slint-ui/slint/issues/3503
// TODO consider to remove that - looks that hack not works and is unnecessary
// width: 0px; // Hack to not steal first click from other components - https://github.com/slint-ui/slint/issues/3503
// Hack not works https://github.com/slint-ui/slint/issues/3503#issuecomment-1817809834 because disables key-released event

key-released(event) => {
Expand All @@ -183,9 +184,31 @@ export component MainList {
empty_folders.released_key(event);
} else if (GuiState.active_tab == CurrentTab.SimilarImages) {
similar_images.released_key(event);
} else if (GuiState.active_tab == CurrentTab.BadExtensions) {
bad_extensions.released_key(event);
} else if (GuiState.active_tab == CurrentTab.BigFiles) {
big_files.released_key(event);
} else if (GuiState.active_tab == CurrentTab.DuplicateFiles) {
duplicates.released_key(event);
} else if (GuiState.active_tab == CurrentTab.TemporaryFiles) {
temporary_files.released_key(event);
} else if (GuiState.active_tab == CurrentTab.SimilarVideos) {
similar_videos.released_key(event);
} else if (GuiState.active_tab == CurrentTab.SimilarMusic) {
similar_music.released_key(event);
} else if (GuiState.active_tab == CurrentTab.InvalidSymlinks) {
invalid_symlink.released_key(event);
} else if (GuiState.active_tab == CurrentTab.BrokenFiles) {
broken_files.released_key(event);
} else {
debug("Non handled key in main_lists.slint");
debug("Non handled key in main_lists.slint", event, GuiState.active_tab);
}



// else {
// debug("Non handled key in main_lists.slint", event, GuiState.active_tab);
// }
accept
}
}
Expand Down
28 changes: 22 additions & 6 deletions krokiet/ui/selectable_tree_view.slint
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ export component SelectableTableView inherits Rectangle {
}

if (root.selected_item != -1) {
Callabler.load_image_preview(r.val_str[root.parentPathIdx - 1] + "/" + r.val_str[root.fileNameIdx - 1]);
showPreview();
} else {
GuiState.preview_visible = false;
}
}
}
double-clicked => {
if (r.header_row && !r.filled_header_row) {
return;
}
Callabler.item_opened(r.val_str[root.parentPathIdx - 1] + "/" + r.val_str[root.fileNameIdx - 1])
if (r.header_row && !r.filled_header_row) {
return;
}
openSelectedItem();
}
pointer-event(event) => {
// TODO this should be clicked by double-click - https://github.com/slint-ui/slint/issues/4235
Expand Down Expand Up @@ -151,12 +151,24 @@ export component SelectableTableView inherits Rectangle {
}
}

function showPreview() {
Callabler.load_image_preview(root.values[root.selected_item].val_str[root.parentPathIdx - 1] + "/" + root.values[root.selected_item].val_str[root.fileNameIdx - 1]);
}

function openSelectedItem() {
Callabler.item_opened(root.values[root.selected_item].val_str[root.parentPathIdx - 1] + "/" + root.values[root.selected_item].val_str[root.fileNameIdx - 1]);
}

// TODO this should work with multiple selection and shift and control key - problably logic will need to be set in global state
public function released_key(event: KeyEvent) {
if (event.text == " ") {
if (root.selected_item != -1) {
if (root.selected_item != -1 && !root.values[root.selected_item].header_row) {
root.values[root.selected_item].checked = !root.values[root.selected_item].checked;
}
} else if (event.text == "\n" ) {
if (root.selected_item != -1) {
openSelectedItem();
}
} else if (event.text == Key.DownArrow) {
if (root.selected_item != -1) {
if (root.values.length - 1 == root.selected_item) {
Expand All @@ -173,6 +185,7 @@ export component SelectableTableView inherits Rectangle {
root.selected_item += 1;
}
root.values[root.selected_item].selected_row = true;
showPreview();
}
} else {
// Select last item if nothing is selected
Expand All @@ -183,6 +196,7 @@ export component SelectableTableView inherits Rectangle {
root.selected_item = 0;
}
root.values[root.selected_item].selected_row = true;
showPreview();
}
}
} else if (event.text == Key.UpArrow) {
Expand All @@ -204,13 +218,15 @@ export component SelectableTableView inherits Rectangle {
}
if (root.selected_item != -1) {
root.values[root.selected_item].selected_row = true;
showPreview();
}
}
} else {
// Select last item if nothing is selected
if (root.values.length > 0) {
root.selected_item = root.values.length - 1;
root.values[root.selected_item].selected_row = true;
showPreview();
}
}
}
Expand Down

0 comments on commit be3c227

Please sign in to comment.