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-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-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 => {
|
|
|
|
Settings.remove_item_directories(true, included-list.current-item);
|
|
|
|
}
|
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 => {
|
|
|
|
Settings.remove_item_directories(false, excluded-list.current-item);
|
|
|
|
}
|
2023-11-02 04:36:38 +13:00
|
|
|
}
|
2023-11-07 03:50:02 +13:00
|
|
|
Button {
|
|
|
|
text: "Manual Add";
|
|
|
|
clicked => {
|
|
|
|
popup_item.show();
|
|
|
|
}
|
|
|
|
}
|
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-07 03:50:02 +13:00
|
|
|
|
|
|
|
popup_item := PopupWindow {
|
|
|
|
height: root.height;
|
|
|
|
width: root.width;
|
|
|
|
|
|
|
|
private property <string> text_data;
|
|
|
|
|
|
|
|
close-on-click: false;
|
|
|
|
|
|
|
|
TextEdit {
|
|
|
|
text <=> text-data;
|
|
|
|
}
|
|
|
|
TextEdit {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
background: red;
|
|
|
|
border-radius: 3px;
|
|
|
|
border-width: 2px;
|
|
|
|
border-color: blue;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2023-11-02 04:36:38 +13:00
|
|
|
}
|
2023-11-02 05:47:45 +13:00
|
|
|
// TODO this should be a normal read only Text editor
|
2023-11-03 06:29:38 +13:00
|
|
|
component TextErrorsPanel inherits TextEdit {
|
|
|
|
height: 20px;
|
|
|
|
read-only: true;
|
|
|
|
text: "Something\nShould be\nASFASF\nasgasg\nASfgasga\nasfgAGAWGW\nAfgAWFGAWG\nfawfafgweg\nAFGWGTwgwg\nGawgAWFWAF\nawfawgaw\nasfa \nasfawgw\nawfawg\nRRRRRR";
|
|
|
|
|
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
|
|
|
in-out property <string> console_text;
|
|
|
|
|
2023-11-02 09:52:25 +13:00
|
|
|
callback folder-choose-requested(bool);
|
2023-11-03 06:29:38 +13:00
|
|
|
callback set_console_text(string);
|
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-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 {
|
2023-11-03 06:29:38 +13:00
|
|
|
text: console_text;
|
|
|
|
|
2023-11-02 05:47:45 +13:00
|
|
|
width: parent.width;
|
|
|
|
height: parent.height;
|
|
|
|
}
|
2023-11-03 06:29:38 +13:00
|
|
|
|
|
|
|
set_console_text(text) => {
|
|
|
|
console_text = text;
|
|
|
|
}
|
2023-11-02 05:47:45 +13:00
|
|
|
}
|