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-23 17:28:06 +00:00
|
|
|
import {Settings} from "settings.slint";
|
2024-01-13 12:57:51 +00:00
|
|
|
|
2024-01-23 17:28:06 +00:00
|
|
|
export component IncludedDirectories {
|
2024-02-03 17:47:00 +00:00
|
|
|
in-out property <[IncludedDirectoriesModel]> model <=> Settings.included_directories_model;
|
|
|
|
in-out property <int> current_index <=> Settings.included_directories_model_selected_idx;
|
2024-01-13 12:57:51 +00:00
|
|
|
|
2024-01-23 17:28:06 +00:00
|
|
|
in-out property <length> size_referenced_folder: 33px;
|
2024-01-13 12:57:51 +00:00
|
|
|
|
|
|
|
min-width: 50px;
|
|
|
|
VerticalLayout {
|
|
|
|
HorizontalLayout {
|
|
|
|
spacing: 5px;
|
|
|
|
Text {
|
2024-01-23 17:28:06 +00:00
|
|
|
text: "Ref";
|
2024-01-13 12:57:51 +00:00
|
|
|
width: size_referenced_folder;
|
2024-01-23 17:28:06 +00:00
|
|
|
horizontal-alignment: center;
|
2024-01-13 12:57:51 +00:00
|
|
|
}
|
|
|
|
Text{
|
|
|
|
horizontal-stretch: 1.0;
|
|
|
|
text: "Path";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ListView {
|
2024-02-03 17:47:00 +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-02-03 17:47:00 +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);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-13 12:57:51 +00:00
|
|
|
HorizontalLayout {
|
|
|
|
spacing: 5px;
|
|
|
|
width: parent.width;
|
|
|
|
|
|
|
|
CheckBox {
|
2024-02-03 17:47:00 +00:00
|
|
|
checked: r.referenced_folder;
|
|
|
|
toggled => {
|
|
|
|
model[idx].referenced_folder = self.checked;
|
|
|
|
}
|
2024-01-13 12:57:51 +00:00
|
|
|
width: size_referenced_folder;
|
|
|
|
}
|
|
|
|
Text {
|
|
|
|
horizontal-stretch: 1.0;
|
2024-02-03 17:47:00 +00:00
|
|
|
text: r.path;
|
2024-01-13 12:57:51 +00:00
|
|
|
vertical-alignment: center;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-21 15:10:09 +00:00
|
|
|
export component ExcludedDirectories {
|
2024-02-03 17:47:00 +00:00
|
|
|
in-out property <[ExcludedDirectoriesModel]> model <=> Settings.excluded_directories_model;
|
|
|
|
in-out property <int> current_index <=> Settings.excluded_directories_model_selected_idx;
|
2024-01-13 12:57:51 +00:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|