1
0
Fork 0
mirror of synced 2024-05-03 03:52:58 +12:00

Slint files

This commit is contained in:
Rafał Mikrut 2024-02-10 16:21:21 +01:00
parent de1dc2794a
commit 8939d514bf
7 changed files with 76 additions and 103 deletions

View file

@ -5,6 +5,7 @@ import {CurrentTab} from "common.slint";
import {BottomPanelVisibility} from "common.slint";
import {Callabler} from "callabler.slint";
import {GuiState} from "gui_state.slint";
import { ContextMenu } from "widgets/context_menu.slint";
export component VisibilityButton inherits Button {
in-out property <BottomPanelVisibility> button_visibility;
@ -20,6 +21,7 @@ export component VisibilityButton inherits Button {
export component ActionButtons inherits HorizontalLayout {
callback scan_stopping;
callback scan_starting(CurrentTab);
callback show_select_popup(length, length);
in-out property <BottomPanelVisibility> bottom_panel_visibility: BottomPanelVisibility.Directories;
in-out property <bool> stop_requested: false;
in-out property <bool> scanning;
@ -65,26 +67,13 @@ export component ActionButtons inherits HorizontalLayout {
}
}
popup_item := PopupWindow {
height: root.height;
width: root.width;
close-on-click: true;
VerticalLayout {
for i[idx] in ["A","B","C"]: Rectangle {
background: red;
}
}
}
select_button := Button {
visible: false;
height: parent.height;
enabled: !scanning && lists_enabled;
text: "Select";
clicked => {
debug("Selected");
popup_item.show();
// Callabler.select_items();
show_select_popup(self.x - self.width / 2, self.y + parent.y);
}
}

View file

@ -108,15 +108,12 @@ export component ExcludedDirectories {
}
}
HorizontalLayout {
spacing: 5px;
Text {
x: 5px;
width: parent.width;
Text {
horizontal-stretch: 1.0;
text: r.path;
vertical-alignment: center;
}
height: parent.height;
text: r.path;
vertical-alignment: center;
}
}
}

View file

@ -13,7 +13,7 @@ import {ColorPalette} from "color_palette.slint";
import {GuiState} from "gui_state.slint";
import { Preview } from "preview.slint";
import {PopupNewDirectories} from "popup_new_directories.slint";
import { PopupSelect } from "popup_select.slint";
import { PopupSelectResults } from "popup_select_results.slint";
import { ToolSettings } from "tool_settings.slint";
export {Settings, Callabler, GuiState}
@ -117,6 +117,11 @@ export component MainWindow inherits Window {
text_summary_text = "Searching...";
root.scan_starting(item);
}
show_select_popup(x_offset, y_offset) => {
select_popup_window.x_offset = x_offset;
select_popup_window.y_offset = y_offset - select-popup-window.all_items_height - 5px;
select_popup_window.show_popup();
}
}
text_summary := LineEdit {
@ -142,10 +147,16 @@ export component MainWindow inherits Window {
width: root.width;
}
// select_popup_window := PopupSelect {
// height: root.height;
// width: root.width;
// }
select_popup_window := PopupSelectResults {
property <length> x_offset: 0;
property <length> y_offset: 0;
x: parent.x + x_offset;
y: parent.y + y_offset;
height: root.height;
width: root.width;
}
scan_ended(scan_text) => {

View file

@ -1,74 +0,0 @@
import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint";
import {SelectableTableView} from "selectable_tree_view.slint";
import {LeftSidePanel} from "left_side_panel.slint";
import {MainList} from "main_lists.slint";
import {CurrentTab, ProgressToSend} from "common.slint";
import { ActionButtons } from "action_buttons.slint";
import { Progress } from "progress.slint";
import {MainListModel} from "common.slint";
import {Settings} from "settings.slint";
import {Callabler} from "callabler.slint";
import { BottomPanel } from "bottom_panel.slint";
import {ColorPalette} from "color_palette.slint";
import {GuiState} from "gui_state.slint";
import { Preview } from "preview.slint";
export component PopupSelect inherits Rectangle {
callback show_popup();
popup_window := PopupWindow {
width: root.width;
height: root.height;
property <bool> included_directories;
private property <string> text_data;
close-on-click: false;
HorizontalLayout {
alignment: LayoutAlignment.center;
VerticalLayout {
alignment: LayoutAlignment.center;
Rectangle {
clip: true;
width: root.width - 20px;
height: root.height - 20px;
border-radius: 20px;
background: ColorPalette.popup_background;
VerticalLayout {
Text {
text: "Please add directories one per line";
horizontal-alignment: TextHorizontalAlignment.center;
}
TextEdit {
vertical-stretch: 1.0;
text <=> text-data;
}
HorizontalLayout {
min-height: 20px;
Button {
enabled: text-data != "";
text: "OK";
clicked => {
Callabler.added_manual_directories(GuiState.choosing_include_directories, text_data);
popup_window.close();
}
}
Button {
text: "Cancel";
clicked => {
popup_window.close();
}
}
}
}
}
}
}
}
show_popup() => {
popup_window.show();
}
}

View file

@ -0,0 +1,51 @@
import { Button, VerticalBox ,TextEdit, HorizontalBox, TabWidget, ListView, StandardListView, StandardTableView, CheckBox, LineEdit} from "std-widgets.slint";
import {SelectableTableView} from "selectable_tree_view.slint";
import {LeftSidePanel} from "left_side_panel.slint";
import {MainList} from "main_lists.slint";
import {CurrentTab, ProgressToSend} from "common.slint";
import { ActionButtons } from "action_buttons.slint";
import { Progress } from "progress.slint";
import {MainListModel} from "common.slint";
import {Settings} from "settings.slint";
import {Callabler} from "callabler.slint";
import { BottomPanel } from "bottom_panel.slint";
import {ColorPalette} from "color_palette.slint";
import {GuiState} from "gui_state.slint";
import { Preview } from "preview.slint";
export component PopupSelectResults inherits Rectangle {
callback show_popup();
property <[{data: string, name: string}]> model: [{data: "SELECT_ALL", name: "Select All"}, {data: "DESELECT_ALL", name: "Deselect All"}, {data: "INVERT_SELECTION", name: "Invert Selection"}];
property <length> item_height: 30px;
property <length> item_width: 140px;
out property <length> all_items_height: item_height * model.length;
popup_window := PopupWindow {
width: item_width;
height: all_items_height;
close-on-click: true;
Rectangle {
width: parent.width;
height: parent.height;
background: ColorPalette.popup_background;
VerticalLayout {
for i in model: Button {
text: i.name;
height: item_height;
width: item_width;
clicked => {
debug(i.data);
popup_window.close();
}
}
}
}
}
show_popup() => {
popup_window.show();
}
}

View file

@ -7,7 +7,7 @@ export global Settings {
in-out property <[IncludedDirectoriesModel]> included_directories_model: [{path: "/home/path", referenced_folder: false, selected_row: false}];
in-out property <int> included_directories_model_selected_idx: -1;
in-out property <[ExcludedDirectoriesModel]> excluded_directories_model: [{path:"/home/path", selected_row: false}, {path:"/home/path", selected_row: false}];
in-out property <[ExcludedDirectoriesModel]> excluded_directories_model: [{path:"/home/path", selected_row: false}, {path:"/home/a", selected_row: false}];
in-out property <int> excluded_directories_model_selected_idx: -1;
// Settings

View file

@ -13,7 +13,6 @@ import {ColorPalette} from "color_palette.slint";
import {GuiState} from "gui_state.slint";
import { Preview } from "preview.slint";
import {PopupNewDirectories} from "popup_new_directories.slint";
import { PopupSelect } from "popup_select.slint";
component ComboBoxWrapper inherits HorizontalLayout {
in-out property <string> text;