1
0
Fork 0
mirror of synced 2024-09-29 16:51:57 +13:00
czkawka/krokiet/ui/main_lists.slint

78 lines
3.4 KiB
Text
Raw Normal View History

2023-10-22 22:32:13 +13:00
import { Button, VerticalBox , HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox} from "std-widgets.slint";
import {SelectableTableView} from "selectable_tree_view.slint";
import {LeftSidePanel} from "left_side_panel.slint";
2023-10-22 23:18:41 +13:00
import {CurrentTab, TypeOfOpenedItem} from "common.slint";
2023-10-29 05:20:46 +13:00
import {MainListModel} from "common.slint";
2023-10-22 22:32:13 +13:00
export component MainList {
2023-11-19 23:06:42 +13:00
in-out property <CurrentTab> active-tab: CurrentTab.EmptyFolders;
in-out property <[MainListModel]> empty_folder_model: [
{checked: false, selected_row: false, header_row: true, val: ["kropkarz", "/Xd1", "24.10.2023"]} ,
{checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} ,
{checked: false, selected_row: false, header_row: false, val: ["witasphere", "/Xd1/Imagerren2", "25.11.1991"]} ,
{checked: true, selected_row: false, header_row: false, val: ["lokkaler", "/Xd1/Vide2", "01.23.1911"]}
];
2023-10-29 07:08:14 +13:00
in-out property <[MainListModel]> empty_files_model;
in-out property <[MainListModel]> similar_images_model;
2023-11-13 04:00:55 +13:00
callback changed_current_tab();
2023-11-19 11:45:52 +13:00
callback released_key(string);
2023-11-13 01:54:59 +13:00
2023-11-13 04:00:55 +13:00
empty_folders := SelectableTableView {
2023-11-13 01:54:59 +13:00
visible: root.active-tab == CurrentTab.EmptyFolders;
2023-10-22 22:32:13 +13:00
min-width: 200px;
2023-11-13 01:54:59 +13:00
height: parent.height;
2023-11-13 04:00:55 +13:00
columns: ["Selection", "Folder Name", "Path", "Modification Date"];
column-sizes: [35px, 100px, 350px, 150px];
2023-10-22 22:32:13 +13:00
values <=> empty-folder-model;
2023-10-22 23:18:41 +13:00
parentPathIdx: 2;
fileNameIdx: 1;
2023-10-22 22:32:13 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-13 04:00:55 +13:00
empty_files := SelectableTableView {
2023-11-13 01:54:59 +13:00
visible: root.active-tab == CurrentTab.EmptyFiles;
2023-10-29 07:08:14 +13:00
min-width: 200px;
2023-11-13 01:54:59 +13:00
height: parent.height;
2023-11-13 04:00:55 +13:00
columns: ["Selection", "File Name", "Path", "Modification Date"];
column-sizes: [35px, 100px, 350px, 150px];
2023-10-29 07:08:14 +13:00
values <=> empty-files-model;
parentPathIdx: 2;
fileNameIdx: 1;
}
2023-10-22 22:32:13 +13:00
2023-11-13 04:00:55 +13:00
similar_images := SelectableTableView {
2023-11-13 01:54:59 +13:00
visible: root.active-tab == CurrentTab.SimilarImages;
2023-10-29 07:08:14 +13:00
min-width: 200px;
2023-11-13 01:54:59 +13:00
height: parent.height;
2023-11-13 04:00:55 +13:00
columns: ["Selection", "Similarity", "Size", "Dimensions", "File Name", "Path", "Modification Date"];
column-sizes: [35px, 80px, 80px, 80px, 100px, 350px, 150px];
2023-10-29 07:08:14 +13:00
values <=> similar-images-model;
2023-11-12 07:10:07 +13:00
parentPathIdx: 5;
fileNameIdx: 4;
2023-10-29 07:08:14 +13:00
}
2023-11-18 06:14:04 +13:00
focus_item := FocusScope {
2023-11-19 23:06:42 +13:00
width: 0px; // Hack to not steal first click from other components - https://github.com/slint-ui/slint/issues/3503
2023-11-19 23:16:23 +13:00
// Hack not works https://github.com/slint-ui/slint/issues/3503#issuecomment-1817809834 because disables key-released event
2023-11-19 23:06:42 +13:00
2023-11-18 06:14:04 +13:00
key-released(event) => {
2023-11-19 22:34:44 +13:00
if (!self.visible || !self.has-focus) {
return accept;
2023-11-19 11:45:52 +13:00
}
if (root.active-tab == CurrentTab.EmptyFiles) {
empty_files.released_key(event);
} else if (root.active-tab == CurrentTab.EmptyFolders) {
empty-folders.released_key(event);
} else if (root.active-tab == CurrentTab.SimilarImages) {
similar-images.released_key(event);
} else {
debug("Non handled key in main_lists.slint");
}
2023-11-18 06:14:04 +13:00
accept
}
}
2023-11-13 04:00:55 +13:00
changed_current_tab() => {
empty_folders.deselect_selected_item();
empty_files.deselect_selected_item();
similar_images.deselect_selected_item();
}
2023-11-11 05:11:32 +13:00
}