Create a simple Job

This commit is contained in:
2025-03-19 20:21:45 +01:00
parent b394330405
commit 7a197d9b71
4 changed files with 22 additions and 18 deletions

View File

@@ -1,10 +1,8 @@
use std::fmt::format;
use crate::{gui::{main_tab::MainTab, MutexTIMManager, VRAM_HEIGHT, VRAM_WIDTH}, MainWindow, VRAMInfo};
use crate::{gui::{main_tab::MainTab, MutexTIMManager, VRAM_HEIGHT, VRAM_WIDTH}, MainWindow};
use super::FileTab;
use rfd::FileDialog;
use slint::SharedString;
use tim_tool::logic::{project::{Job, Project}, tim::{self, types::Encoding}};
use tim_tool::logic::{project::{Job, Project}, tim::types::Encoding};
use tool_helper::Error;
pub(super) fn on_browse_file(tim_manager: MutexTIMManager) -> impl FnMut(&mut FileTab, &MainWindow) -> Result<(), Error> + 'static {
@@ -77,7 +75,7 @@ pub(super) fn on_save_project_clicked(tim_manager: MutexTIMManager) -> impl FnMu
}
let mut cur_job = None;
let mut project = Project::new(tim_info.into_iter().zip(vram_info.into_iter()).filter_map(|(tim, vram)| {
let mut project = Project::new(tim_info.into_iter().zip(vram_info.into_iter()).filter_map(|(tim, (file_name, vram))| {
if vram.is_palette {
// Add palette to cur_job
None
@@ -85,9 +83,11 @@ pub(super) fn on_save_project_clicked(tim_manager: MutexTIMManager) -> impl FnMu
else {
// We are done with the old job
let prev_job = std::mem::replace(&mut cur_job, None);
let prev_job = std::mem::replace(&mut cur_job, None);
cur_job = Some(Job::new("Planschi".to_owned(), std::path::PathBuf::from("value")));
if let Some(tim) = tim {
cur_job = Some(Job::new(file_name, tim.get_path()));
}
prev_job
}
}).collect());
@@ -95,7 +95,7 @@ pub(super) fn on_save_project_clicked(tim_manager: MutexTIMManager) -> impl FnMu
project.push(cur_job);
}
Err(Error::from_text(format!("Adding {} jobs", project.len())))
Err(Error::from_text(format!("Adding {:?} jobs", project)))
}
}