Redirect to file dialog

This commit is contained in:
2025-02-15 11:16:49 +01:00
parent 88c8923989
commit c237a9af45
5 changed files with 43 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
import { AboutTab } from "./tab/about-tab.slint";
import { FileTab } from "./tab/file-tab.slint";
import { FileTab, State } from "./tab/file-tab.slint";
import { MainTab } from "./tab/main-tab.slint";
import { TabWidget } from "std-widgets.slint";
@@ -9,7 +9,6 @@ export component MainWindow inherits Window {
in-out property main_tab_vram_file_list <=> main_tab.vram_files;
in-out property main_tab_vram_images <=> main_tab.vram_images;
callback main_tab_add_file_clicked <=> main_tab.add_file_clicked;
callback main_tab_remove_file_clicked <=> main_tab.remove_file_clicked;
callback move_vram_image <=> main_tab.move_vram_image;
@@ -40,6 +39,7 @@ export component MainWindow inherits Window {
main_tab := MainTab {
x: 0px;
y: 0px;
add_file_clicked => {root.change_to_load_file()}
}
}
Tab {
@@ -47,4 +47,13 @@ export component MainWindow inherits Window {
AboutTab {}
}
}
public function change_to_load_file() {
file_tab.state = State.ConvertImage;
tab_widget.current-index = 0;
}
public function change_to_main() {
tab_widget.current-index = 1;
}
}

View File

@@ -1,11 +1,17 @@
import { Button, TabWidget, LineEdit, GroupBox } from "std-widgets.slint";
enum State {
OpenProject,
SaveProject
export enum State {
Project,
ConvertImage,
}
component OpenProjectWidget inherits Rectangle {
component ProjectWidget inherits Rectangle {
Text {
text: "!!Planschbecken!!";
}
}
component ConvertImageWidget inherits Rectangle {
in-out property <string> path;
callback browse_clicked();
@@ -43,17 +49,11 @@ component OpenProjectWidget inherits Rectangle {
}
}
component SaveProjectWidget inherits Rectangle {
Text {
text: "!!Planschbecken!!";
}
}
export component FileTab inherits Rectangle {
in-out property <string> conv_image_path;
in-out property <State> state;
callback conv_image_browse_clicked;
property <State> state;
x: 0px;
y: 0px;
@@ -65,15 +65,15 @@ export component FileTab inherits Rectangle {
alignment: start;
Button {
text: "Open project";
text: "Projects";
clicked => {
root.state = State.OpenProject;
root.state = State.Project;
}
}
Button {
text: "Save project";
text: "Add Image";
clicked => {
root.state = State.SaveProject;
root.state = State.ConvertImage;
}
}
}
@@ -81,14 +81,15 @@ export component FileTab inherits Rectangle {
VerticalLayout {
padding: 4px;
alignment: start;
if root.state == State.OpenProject : OpenProjectWidget {
if root.state == State.Project : ProjectWidget {
}
if root.state == State.ConvertImage : ConvertImageWidget {
path <=> root.conv_image_path;
browse_clicked => {
root.conv_image_browse_clicked();
}
}
if root.state == State.SaveProject : SaveProjectWidget {
}
}
}
}