1
0
Fork 0
mirror of synced 2024-06-01 18:19:46 +12:00
czkawka/krokiet/ui/bottom_panel.slint
2023-11-07 21:52:43 +01:00

124 lines
3.8 KiB
Plaintext

import {Button, StandardListView, VerticalBox, ScrollView, TextEdit} from "std-widgets.slint";
import {Settings} from "settings.slint";
import {BottomPanelVisibility} from "common.slint";
import {Callabler} from "callabler.slint";
component DirectoriesPanel {
callback folder-choose-requested(bool);
callback show_manual_add_dialog(bool);
// Included directories
HorizontalLayout {
VerticalLayout {
horizontal-stretch: 0.0;
Button {
text: "Add";
clicked => {
folder-choose-requested(true);
}
}
Button {
text: "Remove";
clicked => {
Callabler.remove_item_directories(true, included-list.current-item);
}
}
Button {
text: "Manual Add";
clicked => {
show_manual_add_dialog(true);
}
}
Rectangle {
vertical-stretch: 1.0;
}
}
VerticalLayout {
horizontal-stretch: 1.0;
Rectangle {
Text {
text: "Included Directories";
}
}
included_list := StandardListView {
model: Settings.included-directories;
}
}
// Excluded directories
VerticalLayout {
horizontal-stretch: 0.0;
Button {
text: "Add";
clicked => {
folder-choose-requested(false);
}
}
Button {
text: "Remove";
clicked => {
Callabler.remove_item_directories(false, excluded-list.current-item);
}
}
Button {
text: "Manual Add";
clicked => {
show_manual_add_dialog(false);
}
}
Rectangle {
vertical-stretch: 1.0;
}
}
VerticalLayout {
horizontal-stretch: 1.0;
Rectangle {
Text {
text: "Excluded Directories";
}
}
excluded_list := StandardListView {
model: Settings.excluded-directories;
}
}
}
}
// TODO this should be a normal read only Text editor
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";
}
export component BottomPanel {
in-out property <BottomPanelVisibility> bottom_panel_visibility: BottomPanelVisibility.Directories;
in-out property <string> console_text;
callback folder-choose-requested(bool);
callback show_manual_add_dialog(bool);
callback set_console_text(string);
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;
folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)}
show_manual_add_dialog(included-directories) => {root.show_manual_add_dialog(included-directories)}
}
if bottom-panel-visibility == BottomPanelVisibility.TextErrors : TextErrorsPanel {
text: console_text;
width: parent.width;
height: parent.height;
}
set_console_text(text) => {
console_text = text;
}
}