From d72d8bd84a469f81bf25a0f12d5fc668f99de7d2 Mon Sep 17 00:00:00 2001 From: Jaby Date: Sat, 15 Feb 2025 12:03:15 +0100 Subject: [PATCH] Update UI again --- src/Tools/tim_tool/ui/app-window.slint | 1 + src/Tools/tim_tool/ui/tab/file-tab.slint | 93 +++++++++++++++++------- 2 files changed, 66 insertions(+), 28 deletions(-) diff --git a/src/Tools/tim_tool/ui/app-window.slint b/src/Tools/tim_tool/ui/app-window.slint index 2e408a2b..d962b68b 100644 --- a/src/Tools/tim_tool/ui/app-window.slint +++ b/src/Tools/tim_tool/ui/app-window.slint @@ -14,6 +14,7 @@ export component MainWindow inherits Window { // Convert Image values in-out property file_tab_browse_path <=> file_tab.conv_image_path; + in-out property file_tab_image_data <=> file_tab.conv_image_data; callback file_tab_browse_convert_image <=> file_tab.conv_image_browse_clicked; title: "TIM Tool 0.1.0"; diff --git a/src/Tools/tim_tool/ui/tab/file-tab.slint b/src/Tools/tim_tool/ui/tab/file-tab.slint index e42a928f..aa97b6f7 100644 --- a/src/Tools/tim_tool/ui/tab/file-tab.slint +++ b/src/Tools/tim_tool/ui/tab/file-tab.slint @@ -12,45 +12,82 @@ component ProjectWidget inherits Rectangle { } component ConvertImageWidget inherits Rectangle { - in-out property path; + in-out property image_path; + in-out property image_data; callback browse_clicked(); background: #D0D0D0; - width: 100%; - height: 100%; - GroupBox { - title: "Open project"; - x: 4px; - y: 4px; - - VerticalLayout { - alignment: start; - Text { - text: "Select project file to open with TIM Tool"; - } - LineEdit { - width: 200%; - text: path; - } - HorizontalLayout { + VerticalLayout { + alignment: start; + GroupBox { + title: "Add image file"; + VerticalLayout { alignment: start; - padding: 4px; - Button { - text: "Browse"; - clicked => {browse_clicked();} + padding: 4px; + Text { + text: "Select image file to convert to be used with TIM Tool"; } - Button { - text: "Convert"; - } - } + HorizontalLayout { + alignment: start; + padding: 4px; + LineEdit { + width: 300pt; + text: image_path; + } + Button { + text: "Browse"; + clicked => {browse_clicked();} + } + } + } + } + + GroupBox { + title: "Loaded image"; + VerticalLayout { + alignment: start; + padding: 4px; + HorizontalLayout { + alignment: center; + Rectangle { + width: 256px; + height: 256px; + background: #000000; + Image { + width: 256px; + height: 256px; + source: root.image_data; + image-fit: contain; + } + } + } + HorizontalLayout { + alignment: start; + VerticalLayout { + alignment: center; + Text { + text: "Name: "; + } + } + LineEdit {} + } + HorizontalLayout { + alignment: start; + Button { + text: "Add Image"; + enabled: false; + } + } + } } } } export component FileTab inherits Rectangle { in-out property conv_image_path; + in-out property conv_image_data; in-out property state; callback conv_image_browse_clicked; @@ -84,12 +121,12 @@ export component FileTab inherits Rectangle { if root.state == State.Project : ProjectWidget { } if root.state == State.ConvertImage : ConvertImageWidget { - path <=> root.conv_image_path; + image_path <=> root.conv_image_path; + image_data <=> root.conv_image_data; browse_clicked => { root.conv_image_browse_clicked(); } } - } } } \ No newline at end of file