Compare commits
6 Commits
b35967d6dc
...
6fa574c921
Author | SHA1 | Date |
---|---|---|
|
6fa574c921 | |
|
5a4760b272 | |
|
d9facb8d61 | |
|
d72d8bd84a | |
|
c237a9af45 | |
|
88c8923989 |
|
@ -1,5 +1,6 @@
|
||||||
use crate::MainWindow;
|
use crate::MainWindow;
|
||||||
use super::MainWindowRef;
|
use super::{GUIElements, GUIElementsRef, MainWindowRef};
|
||||||
|
use slint::Image;
|
||||||
|
|
||||||
pub struct FileTab {
|
pub struct FileTab {
|
||||||
main_window: MainWindowRef
|
main_window: MainWindowRef
|
||||||
|
@ -10,10 +11,48 @@ impl FileTab {
|
||||||
FileTab{main_window}
|
FileTab{main_window}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_browse_file(&self, mut function: impl FnMut(&MainWindow) + 'static) {
|
pub fn clear_load(&self) {
|
||||||
|
let main_window = self.main_window.borrow();
|
||||||
|
|
||||||
|
main_window.set_file_tab_browse_path("".into());
|
||||||
|
main_window.set_file_tab_image_data(Image::default());
|
||||||
|
main_window.set_file_tab_image_name("".into());
|
||||||
|
main_window.set_file_tab_enable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn update_new_load(&self, file_name: Option<String>, image: Image) {
|
||||||
|
let main_window = self.main_window.borrow();
|
||||||
|
|
||||||
|
main_window.set_file_tab_image_data(image);
|
||||||
|
if let Some(file_name) = file_name {
|
||||||
|
main_window.set_file_tab_image_name(file_name.into());
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
main_window.set_file_tab_image_name("".into());
|
||||||
|
}
|
||||||
|
main_window.set_file_tab_enable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_file_name(&self) -> String {
|
||||||
|
self.main_window.borrow().get_file_tab_image_name().to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_browse_file(&self, gui_elements: GUIElementsRef, mut function: impl FnMut(&mut GUIElements, &MainWindow) + 'static) {
|
||||||
let main_window_cloned = self.main_window.clone();
|
let main_window_cloned = self.main_window.clone();
|
||||||
|
let gui_cloned = gui_elements.clone();
|
||||||
|
|
||||||
self.main_window.borrow().on_file_tab_browse_convert_image(move || {
|
self.main_window.borrow().on_file_tab_browse_convert_image(move || {
|
||||||
function(&main_window_cloned.borrow());
|
function(&mut gui_cloned.borrow_mut(), &main_window_cloned.borrow());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn on_add_image(&self, gui_elements: GUIElementsRef, mut function: impl FnMut(&mut GUIElements, &MainWindow) + 'static) {
|
||||||
|
let main_window_cloned = self.main_window.clone();
|
||||||
|
let gui_cloned = gui_elements.clone();
|
||||||
|
|
||||||
|
self.main_window.borrow().on_file_tab_add_convert_image(move || {
|
||||||
|
function(&mut gui_cloned.borrow_mut(), &main_window_cloned.borrow());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,8 +2,7 @@ use crate::{gui::{VRAM_HEIGHT, VRAM_WIDTH}, MainWindow, VRAMImage};
|
||||||
use super::{GUIElementsRef, MainWindowRef};
|
use super::{GUIElementsRef, MainWindowRef};
|
||||||
|
|
||||||
use slint::Model;
|
use slint::Model;
|
||||||
use std::{ffi::OsStr, path::PathBuf, rc::Rc};
|
use std::rc::Rc;
|
||||||
use tool_helper::Error;
|
|
||||||
|
|
||||||
pub struct MainTab {
|
pub struct MainTab {
|
||||||
main_window: MainWindowRef,
|
main_window: MainWindowRef,
|
||||||
|
@ -23,22 +22,15 @@ impl MainTab {
|
||||||
MainTab{main_window, vram_file_list, vram_image_list}
|
MainTab{main_window, vram_file_list, vram_image_list}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_new_vram_file(&mut self, file: PathBuf) -> Result<(), Error> {
|
pub fn add_new_vram_file(&mut self, file_name: &String, image: slint::Image) {
|
||||||
let vram_image = VRAMImage{
|
let vram_image = VRAMImage{
|
||||||
img: slint::Image::load_from_path(&file).or_else(|_| {Err(Error::from_str("Failed loading image"))})?,
|
img: image,
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0
|
y: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
let img_size = vram_image.img.size();
|
|
||||||
if img_size.width > VRAM_WIDTH as u32 || img_size.height > VRAM_HEIGHT as u32 {
|
|
||||||
return Err(Error::from_text(format!("Image size ({}; {}) is to big for VRAM ({}, {})", img_size.width, img_size.height, VRAM_WIDTH, VRAM_HEIGHT)));
|
|
||||||
}
|
|
||||||
|
|
||||||
let file_name = file.file_name().get_or_insert(OsStr::new("<No file name>")).to_string_lossy().to_string();
|
|
||||||
self.vram_file_list.push(slint::StandardListViewItem::from(file_name.as_str()));
|
self.vram_file_list.push(slint::StandardListViewItem::from(file_name.as_str()));
|
||||||
self.vram_image_list.push(vram_image);
|
self.vram_image_list.push(vram_image);
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_vram_file(&mut self, idx: usize) {
|
pub fn remove_vram_file(&mut self, idx: usize) {
|
||||||
|
@ -87,12 +79,4 @@ impl MainTab {
|
||||||
function(&mut gui_cloned.borrow_mut().main_tab, &main_window_cloned.borrow(), idx);
|
function(&mut gui_cloned.borrow_mut().main_tab, &main_window_cloned.borrow(), idx);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_add_file(&self, gui_elements: GUIElementsRef, mut function: impl FnMut(&mut MainTab, &MainWindow) + 'static) {
|
|
||||||
let main_window_cloned = self.main_window.clone();
|
|
||||||
let gui_cloned = gui_elements.clone();
|
|
||||||
self.main_window.borrow().on_main_tab_add_file_clicked(move || {
|
|
||||||
function(&mut gui_cloned.borrow_mut().main_tab, &main_window_cloned.borrow());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,3 +1 @@
|
||||||
pub fn hello_world() {
|
pub mod logic;
|
||||||
println!("Hello Planschi");
|
|
||||||
}
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
pub mod tim;
|
||||||
|
use slint::Image;
|
||||||
|
use tim::TIMInfo;
|
||||||
|
|
||||||
|
pub struct Logic {
|
||||||
|
unadded_tim: UnaddedTIM,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Logic {
|
||||||
|
pub fn new() -> Logic {
|
||||||
|
Logic{unadded_tim: UnaddedTIM::empty()}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_unadded_tim(&mut self, info: TIMInfo, image: Image) {
|
||||||
|
self.unadded_tim = UnaddedTIM::new(info, image);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn add_unadded_tim_as(&mut self, _name: &String) -> Image {
|
||||||
|
let _info = self.unadded_tim.take_info();
|
||||||
|
self.unadded_tim.take_image()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct UnaddedTIM {
|
||||||
|
info: TIMInfo,
|
||||||
|
image: Image,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl UnaddedTIM {
|
||||||
|
pub fn new(info: TIMInfo, image: Image) -> UnaddedTIM {
|
||||||
|
UnaddedTIM{info, image}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn take_info(&mut self) -> TIMInfo {
|
||||||
|
std::mem::take(&mut self.info)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn take_image(&mut self) -> Image {
|
||||||
|
std::mem::take(&mut self.image)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn empty() -> UnaddedTIM {
|
||||||
|
UnaddedTIM{info: TIMInfo{}, image: Image::default()}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
use std::path::PathBuf;
|
||||||
|
use tool_helper::Error;
|
||||||
|
|
||||||
|
pub struct TIMInfo {}
|
||||||
|
|
||||||
|
impl std::default::Default for TIMInfo {
|
||||||
|
fn default() -> Self {
|
||||||
|
TIMInfo{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn load_image(path: PathBuf) -> Result<(slint::Image, TIMInfo), Error> {
|
||||||
|
Ok((slint::Image::load_from_path(&path).or_else(|_| {Err(Error::from_str("Failed loading image"))})?, TIMInfo{}))
|
||||||
|
}
|
|
@ -2,19 +2,22 @@
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||||
|
|
||||||
mod gui;
|
mod gui;
|
||||||
use gui::GUIElements;
|
use gui::{GUIElements, VRAM_WIDTH, VRAM_HEIGHT};
|
||||||
use rfd::{FileDialog, MessageDialog};
|
use rfd::{FileDialog, MessageDialog};
|
||||||
use std::{cell::RefCell, rc::Rc};
|
use std::{cell::RefCell, rc::Rc};
|
||||||
use slint::SharedString;
|
use slint::SharedString;
|
||||||
|
use tim_tool::logic::{tim::load_image, Logic};
|
||||||
|
|
||||||
slint::include_modules!();
|
slint::include_modules!();
|
||||||
|
|
||||||
|
|
||||||
fn main() -> Result<(), slint::PlatformError> {
|
fn main() -> Result<(), slint::PlatformError> {
|
||||||
|
let logic_ref = Rc::new(RefCell::new(Logic::new()));
|
||||||
let main_window_ref = Rc::new(RefCell::new(MainWindow::new()?));
|
let main_window_ref = Rc::new(RefCell::new(MainWindow::new()?));
|
||||||
let gui_elements_ref = Rc::new(RefCell::new(GUIElements::new(main_window_ref.clone())?));
|
let gui_elements_ref = Rc::new(RefCell::new(GUIElements::new(main_window_ref.clone())?));
|
||||||
|
|
||||||
setup_main_tab(gui_elements_ref.clone());
|
setup_main_tab(gui_elements_ref.clone());
|
||||||
setup_file_tab(gui_elements_ref.clone());
|
setup_file_tab(gui_elements_ref.clone(), logic_ref);
|
||||||
|
|
||||||
let main_window = main_window_ref.borrow();
|
let main_window = main_window_ref.borrow();
|
||||||
main_window.run()
|
main_window.run()
|
||||||
|
@ -32,29 +35,19 @@ fn setup_main_tab(gui_elements_ref: Rc<RefCell<GUIElements>>) {
|
||||||
main_tab.remove_vram_file(idx as usize);
|
main_tab.remove_vram_file(idx as usize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gui_elements.main_tab.on_add_file(gui_elements_ref.clone(), move |main_tab, _main_window| {
|
|
||||||
let file = FileDialog::new()
|
|
||||||
.add_filter("Images", &["png", "bmp", "jpeg"])
|
|
||||||
.add_filter("All", &[""])
|
|
||||||
.set_title("Add TIM image")
|
|
||||||
.pick_file();
|
|
||||||
|
|
||||||
if let Some(file) = file {
|
|
||||||
if let Result::Err(error) = main_tab.add_new_vram_file(file) {
|
|
||||||
MessageDialog::new().set_title("Loading Image failed").set_level(rfd::MessageLevel::Error).set_description(error.to_string()).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn setup_file_tab(gui_elements_ref: Rc<RefCell<GUIElements>>) {
|
fn setup_file_tab(gui_elements_ref: Rc<RefCell<GUIElements>>, logic_ref: Rc<RefCell<Logic>>) {
|
||||||
let gui_elements = gui_elements_ref.borrow();
|
let gui_elements = gui_elements_ref.borrow();
|
||||||
|
|
||||||
gui_elements.file_tab.on_browse_file(move |main_window| {
|
let logic = logic_ref.clone();
|
||||||
|
gui_elements.file_tab.on_browse_file(gui_elements_ref.clone(), move |gui_elements, main_window| {
|
||||||
|
fn show_error_message(text: String) {
|
||||||
|
MessageDialog::new().set_title("Loading Image failed").set_level(rfd::MessageLevel::Error).set_description(text).show();
|
||||||
|
}
|
||||||
|
|
||||||
let file = FileDialog::new()
|
let file = FileDialog::new()
|
||||||
.add_filter("Images", &["png", "bmp", "jpeg"])
|
.add_filter("Images (.png; .bmp; .jpeg)", &["png", "bmp", "jpeg"])
|
||||||
.add_filter("All", &[""])
|
|
||||||
.set_title("Select image file")
|
.set_title("Select image file")
|
||||||
.pick_file();
|
.pick_file();
|
||||||
|
|
||||||
|
@ -62,6 +55,40 @@ fn setup_file_tab(gui_elements_ref: Rc<RefCell<GUIElements>>) {
|
||||||
if let Some(file_path) = file.to_str() {
|
if let Some(file_path) = file.to_str() {
|
||||||
main_window.set_file_tab_browse_path(SharedString::from(file_path));
|
main_window.set_file_tab_browse_path(SharedString::from(file_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let file_tab = &gui_elements.file_tab;
|
||||||
|
let file_name = if let Some(name) = file.file_name() {Some(name.to_string_lossy().to_string())} else {None};
|
||||||
|
|
||||||
|
let (image, info) = match load_image(file) {
|
||||||
|
Ok((image, info)) => (image, info),
|
||||||
|
Err(error) => {
|
||||||
|
file_tab.clear_load();
|
||||||
|
show_error_message(error.to_string());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let img_size = image.size();
|
||||||
|
if img_size.width > VRAM_WIDTH as u32 || img_size.height > VRAM_HEIGHT as u32 {
|
||||||
|
file_tab.clear_load();
|
||||||
|
show_error_message(format!("Image size ({}; {}) is to big for VRAM ({}, {})", img_size.width, img_size.height, VRAM_WIDTH, VRAM_HEIGHT));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
logic.borrow_mut().set_unadded_tim(info, image.clone());
|
||||||
|
file_tab.update_new_load(file_name, image);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let logic = logic_ref.clone();
|
||||||
|
gui_elements.file_tab.on_add_image(gui_elements_ref.clone(), move |gui_elements, main_window| {
|
||||||
|
let main_tab = &mut gui_elements.main_tab;
|
||||||
|
let file_tab = &gui_elements.file_tab;
|
||||||
|
|
||||||
|
let file_name = file_tab.get_file_name();
|
||||||
|
main_tab.add_new_vram_file(&file_name, logic.borrow_mut().add_unadded_tim_as(&file_name));
|
||||||
|
|
||||||
|
file_tab.clear_load();
|
||||||
|
main_window.invoke_change_to_main();
|
||||||
|
});
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import { AboutTab } from "./tab/about-tab.slint";
|
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 { MainTab } from "./tab/main-tab.slint";
|
||||||
import { TabWidget } from "std-widgets.slint";
|
import { TabWidget } from "std-widgets.slint";
|
||||||
|
|
||||||
|
@ -9,13 +9,16 @@ export component MainWindow inherits Window {
|
||||||
in-out property main_tab_vram_file_list <=> main_tab.vram_files;
|
in-out property main_tab_vram_file_list <=> main_tab.vram_files;
|
||||||
in-out property main_tab_vram_images <=> main_tab.vram_images;
|
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 main_tab_remove_file_clicked <=> main_tab.remove_file_clicked;
|
||||||
callback move_vram_image <=> main_tab.move_vram_image;
|
callback move_vram_image <=> main_tab.move_vram_image;
|
||||||
|
|
||||||
// Convert Image values
|
// Convert Image values
|
||||||
in-out property file_tab_browse_path <=> file_tab.conv_image_path;
|
in-out property file_tab_browse_path <=> file_tab.conv_image_path;
|
||||||
|
in-out property file_tab_image_data <=> file_tab.conv_image_data;
|
||||||
|
in-out property file_tab_image_name <=> file_tab.conv_image_name;
|
||||||
|
in-out property file_tab_enable <=> file_tab.conv_image_enable;
|
||||||
callback file_tab_browse_convert_image <=> file_tab.conv_image_browse_clicked;
|
callback file_tab_browse_convert_image <=> file_tab.conv_image_browse_clicked;
|
||||||
|
callback file_tab_add_convert_image <=> file_tab.conv_image_add_clicked;
|
||||||
|
|
||||||
title: "TIM Tool 0.1.0";
|
title: "TIM Tool 0.1.0";
|
||||||
width: tab_widget.width;
|
width: tab_widget.width;
|
||||||
|
@ -40,6 +43,7 @@ export component MainWindow inherits Window {
|
||||||
main_tab := MainTab {
|
main_tab := MainTab {
|
||||||
x: 0px;
|
x: 0px;
|
||||||
y: 0px;
|
y: 0px;
|
||||||
|
add_file_clicked => {root.change_to_load_file()}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Tab {
|
Tab {
|
||||||
|
@ -47,4 +51,13 @@ export component MainWindow inherits Window {
|
||||||
AboutTab {}
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,59 +1,107 @@
|
||||||
import { Button, TabWidget, LineEdit, GroupBox } from "std-widgets.slint";
|
import { Button, TabWidget, LineEdit, GroupBox } from "std-widgets.slint";
|
||||||
|
|
||||||
enum State {
|
export enum State {
|
||||||
|
Project,
|
||||||
ConvertImage,
|
ConvertImage,
|
||||||
Test
|
|
||||||
}
|
}
|
||||||
|
|
||||||
component ConvertImageWidget inherits Rectangle {
|
component ProjectWidget inherits Rectangle {
|
||||||
in-out property <string> path;
|
|
||||||
|
|
||||||
callback browse_clicked();
|
|
||||||
|
|
||||||
background: #D0D0D0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
|
|
||||||
GroupBox {
|
|
||||||
title: "Convert image to TIM";
|
|
||||||
x: 4px;
|
|
||||||
y: 4px;
|
|
||||||
|
|
||||||
VerticalLayout {
|
|
||||||
alignment: start;
|
|
||||||
Text {
|
|
||||||
text: "Select image file to convert to TIM";
|
|
||||||
}
|
|
||||||
LineEdit {
|
|
||||||
width: 200%;
|
|
||||||
text: path;
|
|
||||||
}
|
|
||||||
HorizontalLayout {
|
|
||||||
alignment: start;
|
|
||||||
padding: 4px;
|
|
||||||
Button {
|
|
||||||
text: "Browse";
|
|
||||||
clicked => {browse_clicked();}
|
|
||||||
}
|
|
||||||
Button {
|
|
||||||
text: "Convert";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
component TestWidget inherits Rectangle {
|
|
||||||
Text {
|
Text {
|
||||||
text: "!!Planschbecken!!";
|
text: "!!Planschbecken!!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
component ConvertImageWidget inherits Rectangle {
|
||||||
|
in-out property <string> image_path;
|
||||||
|
in-out property <image> image_data;
|
||||||
|
in-out property <string> image_name;
|
||||||
|
in-out property <bool> enable_button: false;
|
||||||
|
|
||||||
|
callback browse_clicked();
|
||||||
|
callback add_clicked();
|
||||||
|
|
||||||
|
background: #D0D0D0;
|
||||||
|
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: start;
|
||||||
|
GroupBox {
|
||||||
|
title: "Add image file";
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: start;
|
||||||
|
padding: 4px;
|
||||||
|
Text {
|
||||||
|
text: "Select image file to convert to be used with TIM Tool";
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
padding: 4px;
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Text {
|
||||||
|
text: "Name: ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LineEdit {
|
||||||
|
text: root.image_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: start;
|
||||||
|
padding: 4px;
|
||||||
|
Button {
|
||||||
|
text: "Add Image";
|
||||||
|
enabled: root.enable_button;
|
||||||
|
clicked => {root.add_clicked();}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export component FileTab inherits Rectangle {
|
export component FileTab inherits Rectangle {
|
||||||
in-out property <string> conv_image_path;
|
in-out property <string> conv_image_path;
|
||||||
|
in-out property <image> conv_image_data;
|
||||||
|
in-out property <string> conv_image_name;
|
||||||
|
in-out property <bool> conv_image_enable;
|
||||||
|
in-out property <State> state;
|
||||||
callback conv_image_browse_clicked;
|
callback conv_image_browse_clicked;
|
||||||
|
callback conv_image_add_clicked;
|
||||||
|
|
||||||
property <State> state: ConvertImage;
|
|
||||||
x: 0px;
|
x: 0px;
|
||||||
y: 0px;
|
y: 0px;
|
||||||
|
|
||||||
|
@ -65,15 +113,15 @@ export component FileTab inherits Rectangle {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "Convert image file";
|
text: "Projects";
|
||||||
clicked => {
|
clicked => {
|
||||||
root.state = State.ConvertImage;
|
root.state = State.Project;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
text: "Testing";
|
text: "Add Image";
|
||||||
clicked => {
|
clicked => {
|
||||||
root.state = State.Test;
|
root.state = State.ConvertImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,13 +129,21 @@ export component FileTab inherits Rectangle {
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
alignment: start;
|
alignment: start;
|
||||||
|
if root.state == State.Project : ProjectWidget {
|
||||||
|
}
|
||||||
if root.state == State.ConvertImage : ConvertImageWidget {
|
if root.state == State.ConvertImage : ConvertImageWidget {
|
||||||
path <=> root.conv_image_path;
|
image_path <=> root.conv_image_path;
|
||||||
|
image_data <=> root.conv_image_data;
|
||||||
|
image_name <=> root.conv_image_name;
|
||||||
|
enable_button <=> root.conv_image_enable;
|
||||||
|
|
||||||
browse_clicked => {
|
browse_clicked => {
|
||||||
root.conv_image_browse_clicked();
|
root.conv_image_browse_clicked();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if root.state == State.Test : TestWidget {
|
add_clicked => {
|
||||||
|
root.conv_image_add_clicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue