2024-01-13 12:57:51 +00:00
|
|
|
|
|
|
|
import {Button, StandardListView, VerticalBox, ListView, ScrollView, TextEdit, CheckBox} from "std-widgets.slint";
|
|
|
|
import {Callabler} from "callabler.slint";
|
2024-01-21 15:10:09 +00:00
|
|
|
import {IncludedDirectoriesModel, ExcludedDirectoriesModel} from "common.slint";
|
|
|
|
import {ColorPalette} from "color_palette.slint";
|
2024-01-13 12:57:51 +00:00
|
|
|
|
|
|
|
export component InlcudedDirectories {
|
2024-01-21 15:10:09 +00:00
|
|
|
in-out property <[IncludedDirectoriesModel]> model: [{path: "/home/path", referenced_folder: false, selected_row: false}];
|
2024-01-13 12:57:51 +00:00
|
|
|
in-out property <int> current_index: -1;
|
|
|
|
|
|
|
|
in-out property <length> size_referenced_folder: 40px;
|
|
|
|
|
|
|
|
min-width: 50px;
|
|
|
|
VerticalLayout {
|
|
|
|
HorizontalLayout {
|
|
|
|
spacing: 5px;
|
|
|
|
Text {
|
|
|
|
text: "Referenced folder";
|
|
|
|
width: size_referenced_folder;
|
|
|
|
}
|
|
|
|
Text{
|
|
|
|
horizontal-stretch: 1.0;
|
|
|
|
text: "Path";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ListView {
|
|
|
|
for data in model : Rectangle {
|
|
|
|
height: 30px;
|
|
|
|
border_radius: 5px;
|
|
|
|
width: parent.width;
|
|
|
|
HorizontalLayout {
|
|
|
|
spacing: 5px;
|
|
|
|
width: parent.width;
|
|
|
|
|
|
|
|
CheckBox {
|
2024-01-21 15:10:09 +00:00
|
|
|
checked: data.referenced_folder;
|
2024-01-13 12:57:51 +00:00
|
|
|
width: size_referenced_folder;
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
horizontal-stretch: 1.0;
|
|
|
|
text: data.path;
|
|
|
|
vertical-alignment: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-21 15:10:09 +00:00
|
|
|
export component ExcludedDirectories {
|
|
|
|
in-out property <[ExcludedDirectoriesModel]> model: [{path:"/home/path", selected_row: false}, {path:"/home/path", selected_row: false}, ];
|
2024-01-13 12:57:51 +00:00
|
|
|
in-out property <int> current_index: -1;
|
|
|
|
private property <PointerEvent> event;
|
|
|
|
|
|
|
|
min-width: 50px;
|
|
|
|
VerticalLayout {
|
|
|
|
HorizontalLayout {
|
|
|
|
spacing: 5px;
|
|
|
|
Text {
|
|
|
|
text: "Path";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ListView {
|
2024-01-21 15:10:09 +00:00
|
|
|
for r[idx] in model : Rectangle {
|
2024-01-13 12:57:51 +00:00
|
|
|
height: 30px;
|
|
|
|
border_radius: 5px;
|
|
|
|
width: parent.width;
|
|
|
|
|
2024-01-21 15:10:09 +00:00
|
|
|
background: touch-area.has-hover ? (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color) : (r.selected_row ? ColorPalette.list-view-normal-selected-header : ColorPalette.list_view_normal_color);
|
|
|
|
|
2024-01-13 12:57:51 +00:00
|
|
|
touch_area := TouchArea {
|
|
|
|
clicked => {
|
|
|
|
if (current_index == -1) {
|
2024-01-21 15:10:09 +00:00
|
|
|
r.selected_row = true;
|
|
|
|
} else {
|
|
|
|
if (current_index != idx) {
|
|
|
|
model[current_index].selected_row = false;
|
|
|
|
}
|
|
|
|
r.selected_row = true;
|
2024-01-13 12:57:51 +00:00
|
|
|
}
|
2024-01-21 15:10:09 +00:00
|
|
|
current_index = idx;
|
2024-01-13 12:57:51 +00:00
|
|
|
}
|
|
|
|
double-clicked => {
|
2024-01-21 15:10:09 +00:00
|
|
|
Callabler.item_opened(r.path);
|
2024-01-13 12:57:51 +00:00
|
|
|
}
|
|
|
|
pointer-event(event) => {
|
|
|
|
root.event = event;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HorizontalLayout {
|
|
|
|
spacing: 5px;
|
|
|
|
width: parent.width;
|
|
|
|
|
|
|
|
Text {
|
|
|
|
horizontal-stretch: 1.0;
|
2024-01-21 15:10:09 +00:00
|
|
|
text: r.path;
|
2024-01-13 12:57:51 +00:00
|
|
|
vertical-alignment: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|