Add UI for project approach

This commit is contained in:
Jaby 2025-02-15 10:11:06 +01:00
parent b35967d6dc
commit 88c8923989
2 changed files with 16 additions and 16 deletions

View File

@ -1,11 +1,11 @@
import { Button, TabWidget, LineEdit, GroupBox } from "std-widgets.slint"; import { Button, TabWidget, LineEdit, GroupBox } from "std-widgets.slint";
enum State { enum State {
ConvertImage, OpenProject,
Test SaveProject
} }
component ConvertImageWidget inherits Rectangle { component OpenProjectWidget inherits Rectangle {
in-out property <string> path; in-out property <string> path;
callback browse_clicked(); callback browse_clicked();
@ -15,14 +15,14 @@ component ConvertImageWidget inherits Rectangle {
height: 100%; height: 100%;
GroupBox { GroupBox {
title: "Convert image to TIM"; title: "Open project";
x: 4px; x: 4px;
y: 4px; y: 4px;
VerticalLayout { VerticalLayout {
alignment: start; alignment: start;
Text { Text {
text: "Select image file to convert to TIM"; text: "Select project file to open with TIM Tool";
} }
LineEdit { LineEdit {
width: 200%; width: 200%;
@ -43,7 +43,7 @@ component ConvertImageWidget inherits Rectangle {
} }
} }
component TestWidget inherits Rectangle { component SaveProjectWidget inherits Rectangle {
Text { Text {
text: "!!Planschbecken!!"; text: "!!Planschbecken!!";
} }
@ -53,7 +53,7 @@ export component FileTab inherits Rectangle {
in-out property <string> conv_image_path; in-out property <string> conv_image_path;
callback conv_image_browse_clicked; callback conv_image_browse_clicked;
property <State> state: ConvertImage; property <State> state;
x: 0px; x: 0px;
y: 0px; y: 0px;
@ -65,15 +65,15 @@ export component FileTab inherits Rectangle {
alignment: start; alignment: start;
Button { Button {
text: "Convert image file"; text: "Open project";
clicked => { clicked => {
root.state = State.ConvertImage; root.state = State.OpenProject;
} }
} }
Button { Button {
text: "Testing"; text: "Save project";
clicked => { clicked => {
root.state = State.Test; root.state = State.SaveProject;
} }
} }
} }
@ -81,13 +81,13 @@ export component FileTab inherits Rectangle {
VerticalLayout { VerticalLayout {
padding: 4px; padding: 4px;
alignment: start; alignment: start;
if root.state == State.ConvertImage : ConvertImageWidget { if root.state == State.OpenProject : OpenProjectWidget {
path <=> root.conv_image_path; path <=> root.conv_image_path;
browse_clicked => { browse_clicked => {
root.conv_image_browse_clicked(); root.conv_image_browse_clicked();
} }
} }
if root.state == State.Test : TestWidget { if root.state == State.SaveProject : SaveProjectWidget {
} }
} }
} }

View File

@ -91,7 +91,7 @@ export component MainTab inherits Rectangle {
HorizontalLayout { HorizontalLayout {
padding: 4px; padding: 4px;
GroupBox { GroupBox {
title: "Added TIMs"; title: "Added files";
VerticalLayout { VerticalLayout {
alignment: start; alignment: start;
padding: 4px; padding: 4px;
@ -103,11 +103,11 @@ export component MainTab inherits Rectangle {
HorizontalLayout { HorizontalLayout {
padding: 4px; padding: 4px;
Button { Button {
text: "Add TIM"; text: "Add file";
clicked => {root.add_file_clicked();} clicked => {root.add_file_clicked();}
} }
Button { Button {
text: "Remove TIM"; text: "Remove file";
clicked => { clicked => {
root.remove_file_clicked(vram_files_list.current_item); root.remove_file_clicked(vram_files_list.current_item);
vram_files_list.current-item = -1; vram_files_list.current-item = -1;