1
0
Fork 0
mirror of synced 2024-06-30 03:50:52 +12:00
czkawka/krokiet/ui/bottom_panel.slint

127 lines
3.3 KiB
Plaintext
Raw Normal View History

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-13 01:54:59 +13:00
import {GuiState} from "gui_state.slint";
2023-11-02 04:36:38 +13:00
2023-11-12 21:09:15 +13:00
component DirectoriesPanel inherits HorizontalLayout {
callback folder_choose_requested(bool);
2023-11-08 09:52:43 +13:00
callback show_manual_add_dialog(bool);
2023-11-07 03:50:02 +13:00
// Included directories
2023-11-12 21:09:15 +13:00
VerticalLayout {
horizontal-stretch: 0.0;
spacing: 5px;
Button {
text: "Add";
clicked => {
folder_choose_requested(true);
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
Button {
text: "Remove";
clicked => {
Callabler.remove_item_directories(true, included-list.current-item);
2023-11-08 09:52:43 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
Button {
text: "Manual Add";
clicked => {
show_manual_add_dialog(true);
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
Rectangle {
vertical-stretch: 1.0;
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
VerticalLayout {
horizontal-stretch: 1.0;
Rectangle {
Text {
text: "Included Directories";
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
included_list := StandardListView {
model: Settings.included-directories;
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-07 03:50:02 +13:00
2023-11-12 21:09:15 +13:00
// Excluded directories
VerticalLayout {
horizontal-stretch: 0.0;
spacing: 5px;
Button {
text: "Add";
clicked => {
folder_choose_requested(false);
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
Button {
text: "Remove";
clicked => {
Callabler.remove_item_directories(false, excluded-list.current-item);
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
Button {
text: "Manual Add";
clicked => {
show_manual_add_dialog(false);
2023-11-07 03:50:02 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
Rectangle {
vertical-stretch: 1.0;
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
VerticalLayout {
horizontal-stretch: 1.0;
Rectangle {
Text {
text: "Excluded Directories";
2023-11-02 04:36:38 +13:00
}
2023-11-12 21:09:15 +13:00
}
2023-11-11 05:11:32 +13:00
2023-11-12 21:09:15 +13:00
excluded_list := StandardListView {
model: Settings.excluded-directories;
2023-11-02 04:36:38 +13:00
}
}
}
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-12 07:10:07 +13:00
wrap: TextWrap.no-wrap;
2023-11-13 01:54:59 +13:00
text <=> GuiState.info_text;
2023-11-02 05:47:45 +13:00
}
export component BottomPanel {
in-out property <BottomPanelVisibility> bottom_panel_visibility: BottomPanelVisibility.Directories;
2023-11-12 21:09:15 +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-12 21:09:15 +13:00
folder_choose_requested(included-directories) => {
root.folder_choose_requested(included-directories)
2023-11-11 05:11:32 +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-11 05:11:32 +13:00
if bottom-panel-visibility == BottomPanelVisibility.TextErrors: TextErrorsPanel {
2023-11-02 05:47:45 +13:00
width: parent.width;
height: parent.height;
}
}