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 {
|
|
|
|
in-out property <CurrentTab> active-tab;
|
2023-10-29 05:20:46 +13:00
|
|
|
in-out property <[MainListModel]> empty_folder_model;
|
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 {
|
|
|
|
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
|
|
|
}
|