2023-11-02 04:36:38 +13:00
|
|
|
|
2023-11-03 06:29:38 +13:00
|
|
|
import {Button, StandardListView, VerticalBox, ScrollView, TextEdit} from "std-widgets.slint";
|
2023-11-02 04:36:38 +13:00
|
|
|
import {Settings} from "settings.slint";
|
2023-11-02 05:47:45 +13:00
|
|
|
import {BottomPanelVisibility} from "common.slint";
|
2023-11-08 09:52:43 +13:00
|
|
|
import {Callabler} from "callabler.slint";
|
2023-11-02 04:36:38 +13:00
|
|
|
|
2023-11-02 05:47:45 +13:00
|
|
|
component DirectoriesPanel {
|
2023-11-02 09:52:25 +13:00
|
|
|
callback folder-choose-requested(bool);
|
2023-11-08 09:52:43 +13:00
|
|
|
callback show_manual_add_dialog(bool);
|
2023-11-02 04:36:38 +13:00
|
|
|
|
2023-11-07 03:50:02 +13:00
|
|
|
// Included directories
|
2023-11-02 04:36:38 +13:00
|
|
|
HorizontalLayout {
|
|
|
|
VerticalLayout {
|
2023-11-07 03:50:02 +13:00
|
|
|
horizontal-stretch: 0.0;
|
2023-11-02 04:36:38 +13:00
|
|
|
Button {
|
|
|
|
text: "Add";
|
2023-11-02 09:52:25 +13:00
|
|
|
clicked => {
|
|
|
|
folder-choose-requested(true);
|
|
|
|
}
|
2023-11-02 04:36:38 +13:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Remove";
|
2023-11-05 22:01:37 +13:00
|
|
|
clicked => {
|
2023-11-08 09:52:43 +13:00
|
|
|
Callabler.remove_item_directories(true, included-list.current-item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Manual Add";
|
|
|
|
clicked => {
|
|
|
|
show_manual_add_dialog(true);
|
2023-11-05 22:01:37 +13:00
|
|
|
}
|
2023-11-02 04:36:38 +13:00
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
vertical-stretch: 1.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
VerticalLayout {
|
2023-11-07 03:50:02 +13:00
|
|
|
horizontal-stretch: 1.0;
|
2023-11-02 04:36:38 +13:00
|
|
|
Rectangle {
|
|
|
|
Text {
|
|
|
|
text: "Included Directories";
|
|
|
|
}
|
|
|
|
}
|
2023-11-05 22:01:37 +13:00
|
|
|
included_list := StandardListView {
|
2023-11-02 04:36:38 +13:00
|
|
|
model: Settings.included-directories;
|
|
|
|
}
|
|
|
|
}
|
2023-11-07 03:50:02 +13:00
|
|
|
|
|
|
|
// Excluded directories
|
2023-11-02 04:36:38 +13:00
|
|
|
VerticalLayout {
|
2023-11-07 03:50:02 +13:00
|
|
|
horizontal-stretch: 0.0;
|
2023-11-02 04:36:38 +13:00
|
|
|
Button {
|
|
|
|
text: "Add";
|
2023-11-02 09:52:25 +13:00
|
|
|
clicked => {
|
|
|
|
folder-choose-requested(false);
|
|
|
|
}
|
2023-11-02 04:36:38 +13:00
|
|
|
}
|
|
|
|
Button {
|
|
|
|
text: "Remove";
|
2023-11-05 22:01:37 +13:00
|
|
|
clicked => {
|
2023-11-08 09:52:43 +13:00
|
|
|
Callabler.remove_item_directories(false, excluded-list.current-item);
|
2023-11-05 22:01:37 +13:00
|
|
|
}
|
2023-11-02 04:36:38 +13:00
|
|
|
}
|
2023-11-07 03:50:02 +13:00
|
|
|
Button {
|
|
|
|
text: "Manual Add";
|
|
|
|
clicked => {
|
2023-11-08 09:52:43 +13:00
|
|
|
show_manual_add_dialog(false);
|
2023-11-07 03:50:02 +13:00
|
|
|
}
|
|
|
|
}
|
2023-11-02 04:36:38 +13:00
|
|
|
Rectangle {
|
|
|
|
vertical-stretch: 1.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
VerticalLayout {
|
2023-11-07 03:50:02 +13:00
|
|
|
horizontal-stretch: 1.0;
|
2023-11-02 04:36:38 +13:00
|
|
|
Rectangle {
|
|
|
|
Text {
|
|
|
|
text: "Excluded Directories";
|
|
|
|
}
|
|
|
|
}
|
2023-11-05 22:01:37 +13:00
|
|
|
excluded_list := StandardListView {
|
2023-11-02 04:36:38 +13:00
|
|
|
model: Settings.excluded-directories;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-11 04:49:54 +13:00
|
|
|
|
2023-11-03 06:29:38 +13:00
|
|
|
component TextErrorsPanel inherits TextEdit {
|
|
|
|
height: 20px;
|
|
|
|
read-only: true;
|
2023-11-11 04:49:54 +13:00
|
|
|
text <=> Settings.info_text;
|
2023-11-03 06:29:38 +13:00
|
|
|
|
2023-11-02 05:47:45 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
export component BottomPanel {
|
|
|
|
in-out property <BottomPanelVisibility> bottom_panel_visibility: BottomPanelVisibility.Directories;
|
2023-11-03 06:29:38 +13:00
|
|
|
|
2023-11-02 09:52:25 +13:00
|
|
|
callback folder-choose-requested(bool);
|
2023-11-08 09:52:43 +13:00
|
|
|
callback show_manual_add_dialog(bool);
|
2023-11-02 05:47:45 +13:00
|
|
|
|
|
|
|
min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px;
|
|
|
|
min-width: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 400px;
|
|
|
|
|
|
|
|
if bottom-panel-visibility == BottomPanelVisibility.Directories: DirectoriesPanel {
|
|
|
|
width: parent.width;
|
|
|
|
height: parent.height;
|
2023-11-02 09:52:25 +13:00
|
|
|
folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)}
|
2023-11-08 09:52:43 +13:00
|
|
|
show_manual_add_dialog(included-directories) => {root.show_manual_add_dialog(included-directories)}
|
2023-11-02 05:47:45 +13:00
|
|
|
}
|
2023-11-03 06:29:38 +13:00
|
|
|
|
2023-11-02 05:47:45 +13:00
|
|
|
if bottom-panel-visibility == BottomPanelVisibility.TextErrors : TextErrorsPanel {
|
|
|
|
width: parent.width;
|
|
|
|
height: parent.height;
|
|
|
|
}
|
|
|
|
}
|