184 lines
7.4 KiB
Text
184 lines
7.4 KiB
Text
import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint";
|
|
import {SelectableTableView} from "selectable_tree_view.slint";
|
|
import {LeftSidePanel} from "left_side_panel.slint";
|
|
import {MainList} from "main_lists.slint";
|
|
import {CurrentTab, ProgressToSend} from "common.slint";
|
|
import { ActionButtons } from "action_buttons.slint";
|
|
import { Progress } from "progress.slint";
|
|
import {MainListModel} from "common.slint";
|
|
import {Settings} from "settings.slint";
|
|
import {Callabler} from "callabler.slint";
|
|
import { BottomPanel } from "bottom_panel.slint";
|
|
import {ColorPalette} from "color_palette.slint";
|
|
import {GuiState} from "gui_state.slint";
|
|
import { Preview } from "preview.slint";
|
|
|
|
export {Settings, Callabler, GuiState}
|
|
|
|
export component MainWindow inherits Window {
|
|
callback scan_stopping;
|
|
callback scan_starting(CurrentTab);
|
|
callback folder_choose_requested(bool);
|
|
callback scan_ended(string);
|
|
min-width: 300px;
|
|
preferred-width: 800px;
|
|
min-height: 300px;
|
|
preferred-height: 600px;
|
|
in-out property <bool> stop_requested: false;
|
|
in-out property <bool> scanning: false;
|
|
in-out property <ProgressToSend> progress_datas: {
|
|
current_progress: 15,
|
|
all_progress: 20,
|
|
step_name: "Cache",
|
|
};
|
|
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"]}
|
|
];
|
|
in-out property <[MainListModel]> empty_files_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"]}
|
|
];
|
|
in-out property <[MainListModel]> similar_images_model: [];
|
|
VerticalBox {
|
|
HorizontalBox {
|
|
vertical-stretch: 1.0;
|
|
preferred-height: 300px;
|
|
LeftSidePanel {
|
|
horizontal-stretch: 0.0;
|
|
scanning <=> root.scanning;
|
|
active-tab <=> root.active-tab;
|
|
changed_current_tab() => {
|
|
GuiState.preview-visible = false;
|
|
main_list.changed_current_tab();
|
|
}
|
|
}
|
|
|
|
VerticalLayout {
|
|
horizontal-stretch: 1.0;
|
|
Rectangle {
|
|
vertical-stretch: 1.0;
|
|
main_list := MainList {
|
|
x: 0;
|
|
width: GuiState.preview_visible ? parent.width / 2 : parent.width;
|
|
height: parent.height;
|
|
horizontal-stretch: 0.5;
|
|
active-tab <=> root.active-tab;
|
|
empty_folder_model <=> root.empty_folder_model;
|
|
empty_files_model <=> root.empty_files_model;
|
|
similar_images_model <=> root.similar_images_model;
|
|
}
|
|
Preview {
|
|
height: parent.height;
|
|
x: parent.width / 2;
|
|
width: GuiState.preview_visible ? parent.width / 2 : 0;
|
|
visible: GuiState.preview_visible;
|
|
source: GuiState.preview_image;
|
|
image-fit: ImageFit.contain;
|
|
}
|
|
}
|
|
|
|
if root.scanning: Progress {
|
|
horizontal-stretch: 0.0;
|
|
progress_datas <=> root.progress_datas;
|
|
}
|
|
}
|
|
}
|
|
|
|
action_buttons := ActionButtons {
|
|
vertical-stretch: 0.0;
|
|
scanning <=> root.scanning;
|
|
active-tab <=> root.active-tab;
|
|
stop_requested <=> root.stop-requested;
|
|
scan_stopping => {
|
|
text_summary.text = "Stopping scan, please wait...";
|
|
root.scan_stopping();
|
|
}
|
|
scan_starting(item) => {
|
|
text-summary.text = "Searching...";
|
|
root.scan_starting(item);
|
|
}
|
|
}
|
|
|
|
text_summary := LineEdit {
|
|
read-only: true;
|
|
}
|
|
|
|
bottom_panel := BottomPanel {
|
|
property <bool> included-directories;
|
|
// TODO why cannot set popup_item property? Strange limitation
|
|
|
|
bottom-panel-visibility <=> action_buttons.bottom-panel-visibility;
|
|
vertical-stretch: 0.0;
|
|
folder_choose_requested(included-directories) => {
|
|
root.folder_choose_requested(included-directories)
|
|
}
|
|
show_manual_add_dialog(included-directories) => {
|
|
self.included-directories = included-directories;
|
|
popup-item.show()
|
|
}
|
|
}
|
|
}
|
|
|
|
popup_item := PopupWindow {
|
|
height: root.height;
|
|
width: root.width;
|
|
property <bool> included_directories;
|
|
private property <string> text_data;
|
|
close-on-click: false;
|
|
HorizontalLayout {
|
|
alignment: LayoutAlignment.center;
|
|
VerticalLayout {
|
|
alignment: LayoutAlignment.center;
|
|
Rectangle {
|
|
clip: true;
|
|
width: popup_item.width - 20px;
|
|
height: popup_item.height - 20px;
|
|
border-radius: 20px;
|
|
background: ColorPalette.popup_background;
|
|
VerticalLayout {
|
|
Text {
|
|
text: "Please add directories one per line";
|
|
horizontal-alignment: TextHorizontalAlignment.center;
|
|
}
|
|
|
|
TextEdit {
|
|
vertical-stretch: 1.0;
|
|
text <=> text-data;
|
|
}
|
|
|
|
HorizontalLayout {
|
|
min-height: 20px;
|
|
Button {
|
|
enabled: text-data != "";
|
|
text: "OK";
|
|
clicked => {
|
|
Callabler.added_manual_directories(bottom-panel.included-directories, text_data);
|
|
popup-item.close();
|
|
}
|
|
}
|
|
|
|
Button {
|
|
text: "Cancel";
|
|
clicked => {
|
|
popup-item.close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
scan_ended(scan_text) => {
|
|
text-summary.text = scan_text;
|
|
root.scanning = false;
|
|
root.stop_requested = false;
|
|
}
|
|
}
|