Support appending and overriding existing elements from project
This commit is contained in:
parent
47b5de2d6a
commit
a9801e9fe2
|
@ -70,8 +70,11 @@ pub(super) fn on_load_project_clicked(tim_manager: MutexTIMManager) -> impl FnMu
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut tim_manager = tim_manager.lock().expect("VRAM already locked");
|
let mut tim_manager = tim_manager.lock().expect("VRAM already locked");
|
||||||
clear_all_vram_images(main_tab, &mut tim_manager);
|
|
||||||
main_window.invoke_clear_file_tab_current_selected_file();
|
if !main_window.get_project_widget_append_project_elements() {
|
||||||
|
clear_all_vram_images(main_tab, &mut tim_manager);
|
||||||
|
main_window.invoke_clear_file_tab_current_selected_file();
|
||||||
|
}
|
||||||
|
|
||||||
for job in new_project.jobs {
|
for job in new_project.jobs {
|
||||||
let (_, _) = tim_manager.load_unadded_tim(&job.file_path)?;
|
let (_, _) = tim_manager.load_unadded_tim(&job.file_path)?;
|
||||||
|
|
|
@ -14,6 +14,8 @@ export component MainWindow inherits Window {
|
||||||
// Project widget values
|
// Project widget values
|
||||||
in-out property project_widget-open_project_path <=> file_tab.project_widget-open_project_path;
|
in-out property project_widget-open_project_path <=> file_tab.project_widget-open_project_path;
|
||||||
in-out property project_widget-save_project_path <=> file_tab.project_widget-save_project_path;
|
in-out property project_widget-save_project_path <=> file_tab.project_widget-save_project_path;
|
||||||
|
in-out property project_widget-append_project_elements <=> file_tab.project_widget-append_project_elements;
|
||||||
|
in-out property project_widget-use_rel_paths <=> file_tab.project_widget-use_rel_paths;
|
||||||
callback project_widget-load_project_clicked <=> file_tab.project_widget-load_project_clicked;
|
callback project_widget-load_project_clicked <=> file_tab.project_widget-load_project_clicked;
|
||||||
callback project_widget-save_project_clicked <=> file_tab.project_widget-save_project_clicked;
|
callback project_widget-save_project_clicked <=> file_tab.project_widget-save_project_clicked;
|
||||||
callback project_widget-browse_open_project_clicked <=> file_tab.project_widget-browse_open_project_clicked;
|
callback project_widget-browse_open_project_clicked <=> file_tab.project_widget-browse_open_project_clicked;
|
||||||
|
|
|
@ -8,6 +8,8 @@ export enum State {
|
||||||
component ProjectWidget inherits Rectangle {
|
component ProjectWidget inherits Rectangle {
|
||||||
in-out property <string> open_project_path;
|
in-out property <string> open_project_path;
|
||||||
in-out property <string> save_project_path;
|
in-out property <string> save_project_path;
|
||||||
|
in-out property <bool> append_project_elements;
|
||||||
|
in-out property <bool> use_rel_paths;
|
||||||
|
|
||||||
callback load_project_clicked();
|
callback load_project_clicked();
|
||||||
callback save_project_clicked();
|
callback save_project_clicked();
|
||||||
|
@ -24,7 +26,7 @@ component ProjectWidget inherits Rectangle {
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
Text {
|
Text {
|
||||||
text: "Select a project to open. Any existing changes will be dropped";
|
text: "Select a project to open.";
|
||||||
}
|
}
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
|
@ -39,6 +41,15 @@ component ProjectWidget inherits Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: start;
|
||||||
|
CheckBox {
|
||||||
|
text: "Append elements from project";
|
||||||
|
toggled() => {
|
||||||
|
root.append_project_elements = self.checked;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
Button {
|
Button {
|
||||||
|
@ -72,7 +83,8 @@ component ProjectWidget inherits Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CheckBox {
|
CheckBox {
|
||||||
text: "Use relative path for files";
|
text: "Use relative path for files";
|
||||||
|
checked: root.use_rel_paths;
|
||||||
}
|
}
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
alignment: start;
|
alignment: start;
|
||||||
|
@ -282,6 +294,8 @@ export component FileTab inherits Rectangle {
|
||||||
// For project widget
|
// For project widget
|
||||||
in-out property <string> project_widget-open_project_path;
|
in-out property <string> project_widget-open_project_path;
|
||||||
in-out property <string> project_widget-save_project_path;
|
in-out property <string> project_widget-save_project_path;
|
||||||
|
in-out property <bool> project_widget-append_project_elements;
|
||||||
|
in-out property <bool> project_widget-use_rel_paths;
|
||||||
callback project_widget-load_project_clicked();
|
callback project_widget-load_project_clicked();
|
||||||
callback project_widget-save_project_clicked();
|
callback project_widget-save_project_clicked();
|
||||||
callback project_widget-browse_open_project_clicked();
|
callback project_widget-browse_open_project_clicked();
|
||||||
|
@ -332,9 +346,11 @@ export component FileTab inherits Rectangle {
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
alignment: start;
|
alignment: start;
|
||||||
if root.state == State.Project : ProjectWidget {
|
if root.state == State.Project : ProjectWidget {
|
||||||
open_project_path <=> root.project_widget-open_project_path;
|
open_project_path <=> root.project_widget-open_project_path;
|
||||||
save_project_path <=> root.project_widget-save_project_path;
|
save_project_path <=> root.project_widget-save_project_path;
|
||||||
|
append_project_elements <=> root.project_widget-append_project_elements;
|
||||||
|
use_rel_paths <=> root.project_widget-use_rel_paths;
|
||||||
|
|
||||||
load_project_clicked() => {
|
load_project_clicked() => {
|
||||||
root.project_widget-load_project_clicked();
|
root.project_widget-load_project_clicked();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue