Added storage for settings

This commit is contained in:
Jaby 2025-04-05 23:36:58 +02:00 committed by cody
parent 9501954587
commit 4942012da1
2 changed files with 29 additions and 11 deletions

View File

@ -91,9 +91,11 @@ impl MainTab {
image: vram_image.image,
},
info: VRAMInfo {
x: vram_image.x as i32,
y: vram_image.y as i32,
encoding_str: SharedString::from(encoding_str),
x: vram_image.x as i32,
y: vram_image.y as i32,
encoding_str: SharedString::from(encoding_str),
use_compression: false,
trans_setting: 0,
palette_count,
is_palette,
}

View File

@ -7,11 +7,13 @@ struct VRAMImgData {
}
struct VRAMInfo {
x: int,
y: int,
encoding_str: string,
palette_count: int,
is_palette: bool, // < Can we combine the palette into this, instead of having it separate?
x: int,
y: int,
encoding_str: string,
use_compression: bool,
trans_setting: int,
palette_count: int,
is_palette: bool, // < Can we combine the palette into this, instead of having it separate?
}
struct VRAMData {
@ -313,8 +315,14 @@ export component MainTab inherits Rectangle {
VerticalLayout {
alignment: start;
lz4_check_box := CheckBox {
text: "Compress (lz4)";
text: "Compress (lz4)";
enabled: file_settings_box.enabled;
toggled => {
if(vram_files_list.current-item != -1) {
root.vram_data[vram_files_list.current-item].info.use_compression = self.checked;
}
}
}
GroupBox {
@ -325,13 +333,21 @@ export component MainTab inherits Rectangle {
trans_combo_box := ComboBox {
model: ["No transparency", "First color transparent", "PSX semi-transparency", "Both"];
enabled: file_settings_box.enabled;
selected(current-value) => {
if(vram_files_list.current-item != -1) {
root.vram_data[vram_files_list.current-item].info.trans_setting = self.current-index;
}
}
}
}
}
}
public function set_active(item: int) {
self.enabled = true;
public function set_active(current-item: int) {
lz4_check_box.checked = root.vram_data[current-item].info.use_compression;
trans_combo_box.current-index = root.vram_data[current-item].info.trans_setting;
self.enabled = true;
}
public function set_inactive() {