Obtain all required vectors; Quick draft for project
This commit is contained in:
parent
6a1b87cdb1
commit
602fb3a5c2
|
@ -65,8 +65,12 @@ pub(super) fn on_load_project_clicked() -> impl FnMut(&mut FileTab, &MainWindow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn on_save_project_clicked() -> impl FnMut(&mut FileTab, &MainWindow) -> Result<(), Error> + 'static {
|
pub(super) fn on_save_project_clicked(tim_manager: MutexTIMManager) -> impl FnMut(&mut FileTab, &MainTab, &MainWindow) -> Result<(), Error> + 'static {
|
||||||
move |_file_tab, _main_window| {
|
move |_file_tab, main_tab, _main_window| {
|
||||||
|
let _tim_info = tim_manager.lock().expect("VRAM already locked").clone_added_tims();
|
||||||
|
let _vram_info = main_tab.clone_vram_info();
|
||||||
|
|
||||||
|
|
||||||
Err(Error::not_implemented("on_save_project_clicked"))
|
Err(Error::not_implemented("on_save_project_clicked"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,9 +65,9 @@ impl FileTab {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let (cloned_object, cloned_main_window, mut function) = (object.clone(), main_window.clone(), callbacks::on_add_image(tim_manager.clone()));
|
let (cloned_object, cloned_main_tab, cloned_main_window, mut function) = (object.clone(), main_tab.clone(), main_window.clone(), callbacks::on_add_image(tim_manager.clone()));
|
||||||
main_window.borrow().on_file_tab_add_convert_image(move || {
|
main_window.borrow().on_file_tab_add_convert_image(move || {
|
||||||
if let Err(error) = function(&mut cloned_object.borrow_mut(), &mut main_tab.borrow_mut(), &cloned_main_window.borrow()) {
|
if let Err(error) = function(&mut cloned_object.borrow_mut(), &mut cloned_main_tab.borrow_mut(), &cloned_main_window.borrow()) {
|
||||||
display_error("Adding file failed", &error.to_string());
|
display_error("Adding file failed", &error.to_string());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -80,9 +80,9 @@ impl FileTab {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let (cloned_object, cloned_main_window, mut function) = (object.clone(), main_window.clone(), callbacks::on_save_project_clicked());
|
let (cloned_object, cloned_main_tab, cloned_main_window, mut function) = (object.clone(), main_tab.clone(), main_window.clone(), callbacks::on_save_project_clicked(tim_manager.clone()));
|
||||||
main_window.borrow().on_project_widget_save_project_clicked (move || {
|
main_window.borrow().on_project_widget_save_project_clicked (move || {
|
||||||
if let Err(error) = function(&mut cloned_object.borrow_mut(), &cloned_main_window.borrow()) {
|
if let Err(error) = function(&mut cloned_object.borrow_mut(), &cloned_main_tab.borrow(), &cloned_main_window.borrow()) {
|
||||||
display_error("Saving project failed", &error.to_string());
|
display_error("Saving project failed", &error.to_string());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -155,13 +155,13 @@ impl MainTab {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*pub fn _clone_vram_images(&self) -> Vec<VRAMInfo> {
|
pub fn clone_vram_info(&self) -> Vec<VRAMInfo> {
|
||||||
let vram_data = self.vram.lock().expect("VRAM already locked");
|
let vram_data = self.vram.lock().expect("VRAM already locked");
|
||||||
let mut images = Vec::new();
|
let mut infos = Vec::new();
|
||||||
|
|
||||||
for image in vram_data.image_list.iter() {
|
for vram_data in vram_data.info.iter() {
|
||||||
images.push(image.clone());
|
infos.push(vram_data.info.clone());
|
||||||
}
|
}
|
||||||
images
|
infos
|
||||||
}*/
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
pub mod project;
|
||||||
pub mod tim;
|
pub mod tim;
|
||||||
pub mod tim_mgr;
|
pub mod tim_mgr;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
struct Job {
|
||||||
|
name: String,
|
||||||
|
file_path: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Job {
|
||||||
|
pub fn new(name: String, file_path: PathBuf) -> Job {
|
||||||
|
Job{name, file_path}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Project {
|
||||||
|
jobs: Vec<Job>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Project {
|
||||||
|
pub fn new(jobs: Vec<Job>) -> Project {
|
||||||
|
Project{jobs}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ use slint::{Rgba8Pixel, SharedPixelBuffer};
|
||||||
use tool_helper::Error;
|
use tool_helper::Error;
|
||||||
use types::Encoding;
|
use types::Encoding;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct TIMInfo {
|
pub struct TIMInfo {
|
||||||
_path: PathBuf,
|
_path: PathBuf,
|
||||||
image_data: SharedPixelBuffer<Rgba8Pixel>,
|
image_data: SharedPixelBuffer<Rgba8Pixel>,
|
||||||
|
@ -119,6 +120,7 @@ impl TIMInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
struct PaletteInfo {
|
struct PaletteInfo {
|
||||||
data: Vec<Rgba8Pixel>,
|
data: Vec<Rgba8Pixel>,
|
||||||
width: u32,
|
width: u32,
|
||||||
|
|
|
@ -69,4 +69,8 @@ impl TIMManager {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn clone_added_tims(&self) -> Vec<Option<TIMInfo>> {
|
||||||
|
self.added_tims.clone()
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue