2
0
mirror of https://github.com/qarmin/czkawka synced 2024-11-12 01:10:45 +00:00
czkawka/krokiet/ui/included_directories.slint
Rafał Mikrut 5c36888825 Zmiany
2024-01-21 16:10:09 +01:00

105 lines
3.5 KiB
Plaintext

import {Button, StandardListView, VerticalBox, ListView, ScrollView, TextEdit, CheckBox} from "std-widgets.slint";
import {Callabler} from "callabler.slint";
import {IncludedDirectoriesModel, ExcludedDirectoriesModel} from "common.slint";
import {ColorPalette} from "color_palette.slint";
export component InlcudedDirectories {
in-out property <[IncludedDirectoriesModel]> model: [{path: "/home/path", referenced_folder: false, selected_row: false}];
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 {
checked: data.referenced_folder;
width: size_referenced_folder;
}
Text {
horizontal-stretch: 1.0;
text: data.path;
vertical-alignment: center;
}
}
}
}
}
}
export component ExcludedDirectories {
in-out property <[ExcludedDirectoriesModel]> model: [{path:"/home/path", selected_row: false}, {path:"/home/path", selected_row: false}, ];
in-out property <int> current_index: -1;
private property <PointerEvent> event;
min-width: 50px;
VerticalLayout {
HorizontalLayout {
spacing: 5px;
Text {
text: "Path";
}
}
ListView {
for r[idx] in model : Rectangle {
height: 30px;
border_radius: 5px;
width: parent.width;
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);
touch_area := TouchArea {
clicked => {
if (current_index == -1) {
r.selected_row = true;
} else {
if (current_index != idx) {
model[current_index].selected_row = false;
}
r.selected_row = true;
}
current_index = idx;
}
double-clicked => {
Callabler.item_opened(r.path);
}
pointer-event(event) => {
root.event = event;
}
}
HorizontalLayout {
spacing: 5px;
width: parent.width;
Text {
horizontal-stretch: 1.0;
text: r.path;
vertical-alignment: center;
}
}
}
}
}
}