From e948887faa17dac46a7c719c992bea109c9a5d52 Mon Sep 17 00:00:00 2001 From: Jaby Date: Tue, 4 Mar 2025 20:40:50 +0100 Subject: [PATCH] Add GUI for palette width/height --- src/Tools/tim_tool/ui/app-window.slint | 2 +- src/Tools/tim_tool/ui/tab/file-tab.slint | 63 +++++++++++++++++------- 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/src/Tools/tim_tool/ui/app-window.slint b/src/Tools/tim_tool/ui/app-window.slint index 93f1149c..56c6b093 100644 --- a/src/Tools/tim_tool/ui/app-window.slint +++ b/src/Tools/tim_tool/ui/app-window.slint @@ -18,7 +18,7 @@ export component MainWindow inherits Window { in-out property file_tab_palette_data <=> file_tab.conv_palette_data; in-out property file_tab_palette_visible <=> file_tab.conv_palette_enable; in-out property file_tab_image_name <=> file_tab.conv_image_name; - in-out property file_tab_enable <=> file_tab.conv_image_enable; + in-out property file_tab_enable <=> file_tab.conv_enable_view; callback file_tab_browse_convert_image <=> file_tab.conv_image_browse_clicked; callback file_tab_add_convert_image <=> file_tab.conv_image_add_clicked; diff --git a/src/Tools/tim_tool/ui/tab/file-tab.slint b/src/Tools/tim_tool/ui/tab/file-tab.slint index d3685932..536a98a6 100644 --- a/src/Tools/tim_tool/ui/tab/file-tab.slint +++ b/src/Tools/tim_tool/ui/tab/file-tab.slint @@ -16,7 +16,7 @@ component ConvertImageWidget inherits Rectangle { in-out property image_data; in-out property palette_data; in-out property image_name; - in-out property enable_button: false; + in-out property enable_view: false; in-out property palette_visible: false; callback browse_clicked(); @@ -75,19 +75,48 @@ component ConvertImageWidget inherits Rectangle { width: 4px; height: 1px; } - Rectangle { - width: 256px + 2*4px; // < Because of border - height: 256px + 2*4px; // < Because of border - background: #404040; - border-color: #808080; - border-width: 4px; - palette_image := Image { - width: 256px; - height: 256px; - source: root.palette_data; - visible: root.palette_visible; - image-fit: contain; - image-rendering: pixelated; + VerticalLayout { + Rectangle { + width: 256px + 2*4px; // < Because of border + height: 256px + 2*4px; // < Because of border + background: #404040; + border-color: #808080; + border-width: 4px; + palette_image := Image { + width: 256px; + height: 256px; + source: root.palette_data; + visible: root.palette_visible; + image-fit: contain; + image-rendering: pixelated; + } + } + HorizontalLayout { + alignment: start; + VerticalLayout { + VerticalLayout { + alignment: center; + Text { + text: "Width: "; + } + } + VerticalLayout { + alignment: center; + Text { + text: "Height: "; + } + } + } + VerticalLayout { + LineEdit { + width: 40pt; + enabled: root.enable_view; + } + LineEdit { + width: 40pt; + enabled: root.enable_view; + } + } } } } @@ -109,7 +138,7 @@ component ConvertImageWidget inherits Rectangle { padding: 4px; Button { text: "Add Image"; - enabled: root.enable_button; + enabled: root.enable_view; clicked => {root.add_clicked();} } } @@ -133,7 +162,7 @@ export component FileTab inherits Rectangle { in-out property conv_palette_data; in-out property conv_palette_enable; in-out property conv_image_name; - in-out property conv_image_enable; + in-out property conv_enable_view; in-out property state; callback conv_image_browse_clicked; callback conv_image_add_clicked; @@ -173,7 +202,7 @@ export component FileTab inherits Rectangle { palette_data <=> root.conv_palette_data; palette_visible <=> root.conv_palette_enable; image_name <=> root.conv_image_name; - enable_button <=> root.conv_image_enable; + enable_view <=> root.conv_enable_view; browse_clicked => { root.conv_image_browse_clicked();