1
0
Fork 0
mirror of synced 2024-06-17 18:04:46 +12:00
czkawka/krokiet/ui/included_directories.slint

107 lines
3.5 KiB
Plaintext
Raw Normal View History

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