mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
In the backup confirmation dialog, change "Delete" to "Discard all" and add Cancel button
Cancel and X button keep the backups in memory, discard deletes them.
This commit is contained in:
parent
a478dee88e
commit
e2550bba47
21
src/Main.gd
21
src/Main.gd
|
@ -6,6 +6,7 @@ var is_quitting_on_save := false
|
||||||
var cursor_image: Texture = preload("res://assets/graphics/cursor.png")
|
var cursor_image: Texture = preload("res://assets/graphics/cursor.png")
|
||||||
|
|
||||||
onready var ui := $MenuAndUI/UI/DockableContainer
|
onready var ui := $MenuAndUI/UI/DockableContainer
|
||||||
|
onready var backup_confirmation: ConfirmationDialog = $Dialogs/BackupConfirmation
|
||||||
onready var quit_dialog: ConfirmationDialog = find_node("QuitDialog")
|
onready var quit_dialog: ConfirmationDialog = find_node("QuitDialog")
|
||||||
onready var quit_and_save_dialog: ConfirmationDialog = find_node("QuitAndSaveDialog")
|
onready var quit_and_save_dialog: ConfirmationDialog = find_node("QuitAndSaveDialog")
|
||||||
|
|
||||||
|
@ -147,8 +148,7 @@ func _show_splash_screen() -> void:
|
||||||
|
|
||||||
func _handle_backup() -> void:
|
func _handle_backup() -> void:
|
||||||
# If backup file exists, Pixelorama was not closed properly (probably crashed) - reopen backup
|
# If backup file exists, Pixelorama was not closed properly (probably crashed) - reopen backup
|
||||||
var backup_confirmation: ConfirmationDialog = $Dialogs/BackupConfirmation
|
backup_confirmation.add_button("Discard All", false, "discard")
|
||||||
backup_confirmation.get_cancel().text = tr("Delete")
|
|
||||||
if Global.config_cache.has_section("backups"):
|
if Global.config_cache.has_section("backups"):
|
||||||
var project_paths = Global.config_cache.get_section_keys("backups")
|
var project_paths = Global.config_cache.get_section_keys("backups")
|
||||||
if project_paths.size() > 0:
|
if project_paths.size() > 0:
|
||||||
|
@ -161,11 +161,11 @@ func _handle_backup() -> void:
|
||||||
backup_confirmation.connect(
|
backup_confirmation.connect(
|
||||||
"confirmed", self, "_on_BackupConfirmation_confirmed", [project_paths, backup_paths]
|
"confirmed", self, "_on_BackupConfirmation_confirmed", [project_paths, backup_paths]
|
||||||
)
|
)
|
||||||
backup_confirmation.get_cancel().connect(
|
backup_confirmation.connect(
|
||||||
"pressed", self, "_on_BackupConfirmation_delete", [project_paths, backup_paths]
|
"custom_action",
|
||||||
)
|
self,
|
||||||
backup_confirmation.get_close_button().connect(
|
"_on_BackupConfirmation_custom_action",
|
||||||
"pressed", self, "_on_BackupConfirmation_delete", [project_paths, backup_paths]
|
[project_paths, backup_paths]
|
||||||
)
|
)
|
||||||
backup_confirmation.popup_centered()
|
backup_confirmation.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
@ -334,7 +334,12 @@ func _on_BackupConfirmation_confirmed(project_paths: Array, backup_paths: Array)
|
||||||
Global.top_menu_container.file_menu.set_item_text(6, tr("Export"))
|
Global.top_menu_container.file_menu.set_item_text(6, tr("Export"))
|
||||||
|
|
||||||
|
|
||||||
func _on_BackupConfirmation_delete(project_paths: Array, backup_paths: Array) -> void:
|
func _on_BackupConfirmation_custom_action(
|
||||||
|
action: String, project_paths: Array, backup_paths: Array
|
||||||
|
) -> void:
|
||||||
|
backup_confirmation.hide()
|
||||||
|
if action != "discard":
|
||||||
|
return
|
||||||
for i in range(project_paths.size()):
|
for i in range(project_paths.size()):
|
||||||
OpenSave.remove_backup_by_path(project_paths[i], backup_paths[i])
|
OpenSave.remove_backup_by_path(project_paths[i], backup_paths[i])
|
||||||
# Reopen last project
|
# Reopen last project
|
||||||
|
|
Loading…
Reference in a new issue