1
0
Fork 0
mirror of synced 2024-05-17 19:03:08 +12:00
This commit is contained in:
Rafał Mikrut 2023-11-02 18:29:38 +01:00
parent adb905f9b7
commit f4ff67b71b
4 changed files with 63 additions and 28 deletions

View file

@ -6,6 +6,9 @@ use slint::{ComponentHandle, ModelRc, SharedString, StandardListViewItem, VecMod
pub fn reset_settings(app: &MainWindow) {
let settings = app.global::<Settings>();
// app.width(1000);
app.invoke_set_console_text(SharedString::from(""));
// Get current folder where executed binary is
let current_folder = env::current_dir();
let mut included_directories = vec![];

View file

@ -21,7 +21,7 @@ export component ActionButtons inherits HorizontalLayout {
callback deleted;
callback scan_stopping;
callback scan_starting(CurrentTab);
in-out property <BottomPanelVisibility> bottom_panel_visibility: BottomPanelVisibility.Directories;
in-out property <bool> stop_requested: false;
in-out property <bool> scanning;
@ -48,6 +48,11 @@ export component ActionButtons inherits HorizontalLayout {
root.stop_requested = true;
}
}
Rectangle {
horizontal-stretch: 0.5;
}
delete_button:= Button {
height: parent.height;
enabled: !scanning;
@ -56,25 +61,33 @@ export component ActionButtons inherits HorizontalLayout {
root.deleted();
}
}
Rectangle {
horizontal-stretch: 0.5;
}
VisibilityButton {
height: parent.height;
button-visibility: BottomPanelVisibility.Directories;
bottom_panel_visibility <=> bottom_panel_visibility;
text: "Dirs";
}
VisibilityButton {
height: parent.height;
button-visibility: BottomPanelVisibility.NotVisible;
bottom_panel_visibility <=> bottom_panel_visibility;
text: "NotVS";
}
VisibilityButton {
height: parent.height;
button-visibility: BottomPanelVisibility.TextErrors;
bottom_panel_visibility <=> bottom_panel_visibility;
text: "Text";
HorizontalLayout {
padding: 0px;
spacing: 0px;
VisibilityButton {
height: parent.height;
button-visibility: BottomPanelVisibility.Directories;
bottom_panel_visibility <=> bottom_panel_visibility;
text: "Dirs";
}
VisibilityButton {
height: parent.height;
button-visibility: BottomPanelVisibility.TextErrors;
bottom_panel_visibility <=> bottom_panel_visibility;
text: "Text";
}
VisibilityButton {
height: parent.height;
button-visibility: BottomPanelVisibility.NotVisible;
bottom_panel_visibility <=> bottom_panel_visibility;
text: "NotVS";
}
}
}

View file

@ -1,5 +1,5 @@
import {Button, StandardListView, VerticalBox} from "std-widgets.slint";
import {Button, StandardListView, VerticalBox, ScrollView, TextEdit} from "std-widgets.slint";
import {Settings} from "settings.slint";
import {BottomPanelVisibility} from "common.slint";
@ -61,15 +61,19 @@ component DirectoriesPanel {
}
}
// TODO this should be a normal read only Text editor
component TextErrorsPanel {
Rectangle {
background: red;
}
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 set_console_text(string);
min-height: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 150px;
min-width: bottom-panel-visibility == BottomPanelVisibility.NotVisible ? 0px : 400px;
@ -79,8 +83,15 @@ export component BottomPanel {
height: parent.height;
folder-choose-requested(included-directories) => {root.folder-choose-requested(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;
}
}

View file

@ -11,17 +11,22 @@ import { BottomPanel } from "bottom_panel.slint";
export {Settings}
export component Raw inherits Window {
preferred-width: 2000px;
}
export component MainWindow inherits Window {
callback deleted;
callback scan_stopping;
callback scan_starting(CurrentTab);
callback item_opened(string);
callback folder-choose-requested(bool);
callback set_console_text(string);
callback scan_ended();
min-width: 300px;
preferred-width: 1024px;
preferred-width: 2000px;
min-height: 300px;
preferred-height: 600px;
@ -71,7 +76,6 @@ export component MainWindow inherits Window {
VerticalBox {
HorizontalBox {
vertical-stretch: 1.0;
// min-width: 600px;
preferred-height: 300px;
LeftSidePanel {
@ -115,13 +119,17 @@ export component MainWindow inherits Window {
text_summary := LineEdit {
read-only: true;
}
BottomPanel {
bottom_panel := BottomPanel {
bottom-panel-visibility <=> action_buttons.bottom-panel-visibility;
vertical-stretch: 0.0;
folder-choose-requested(included-directories) => {root.folder-choose-requested(included-directories)}
}
}
set_console_text(text) => {
bottom-panel.set_console_text(text);
}
scan_ended() => {
text-summary.text = ""; // TODO this should be filled with results
root.scanning = false;