Preserve data across the Straywild transition
This commit is contained in:
parent
737d1cf2e0
commit
98a27e2f53
28 changed files with 577 additions and 94 deletions
|
|
@ -40,6 +40,7 @@ signal opened
|
|||
signal crisp_reset_focus_requested
|
||||
signal panel_visibility_changed(is_visible: bool)
|
||||
signal navigation_transition_started
|
||||
signal data_root_changed
|
||||
|
||||
enum PresentationMode {
|
||||
TITLE_EMBEDDED,
|
||||
|
|
@ -612,6 +613,7 @@ func _refresh_data_page() -> void:
|
|||
%DataStorageMode.text = "storage mode: " + _data_root.storage_mode_text()
|
||||
%ChangeDataFolder.disabled = (
|
||||
_data_root.override_active
|
||||
or _presentation_mode != PresentationMode.TITLE_EMBEDDED
|
||||
or (_network_session != null and _network_session.is_session_active())
|
||||
)
|
||||
var fingerprint: String = (
|
||||
|
|
@ -668,6 +670,9 @@ func _choose_data_folder() -> void:
|
|||
if _data_root == null or _data_root.override_active:
|
||||
_feedback.text = "the data folder is externally managed."
|
||||
return
|
||||
if _presentation_mode != PresentationMode.TITLE_EMBEDDED:
|
||||
_feedback.text = "return to title to change the data folder."
|
||||
return
|
||||
if _network_session != null and _network_session.is_session_active():
|
||||
_feedback.text = "return to title to change the data folder."
|
||||
return
|
||||
|
|
@ -684,6 +689,12 @@ func _choose_data_folder() -> void:
|
|||
|
||||
|
||||
func _change_data_folder(path: String) -> void:
|
||||
if (
|
||||
_presentation_mode != PresentationMode.TITLE_EMBEDDED
|
||||
or (_network_session != null and _network_session.is_session_active())
|
||||
):
|
||||
_feedback.text = "return to title to change the data folder."
|
||||
return
|
||||
var result: Dictionary = PortableDataMigration.migrate_active_to(
|
||||
_data_root, path
|
||||
)
|
||||
|
|
@ -697,9 +708,7 @@ func _change_data_folder(path: String) -> void:
|
|||
).to_lower()
|
||||
_refresh_data_page()
|
||||
return
|
||||
_feedback.text = "data folder changed. straywild will close safely."
|
||||
_refresh_data_page()
|
||||
get_tree().call_deferred("quit")
|
||||
_complete_data_root_change("data folder changed.")
|
||||
else:
|
||||
_feedback.text = str(
|
||||
result.get("message", "could not change the data folder.")
|
||||
|
|
@ -717,8 +726,7 @@ func _show_existing_data_folder_choice(path: String) -> void:
|
|||
dialog.add_button("replace selected data", false, "replace")
|
||||
dialog.confirmed.connect(func() -> void:
|
||||
if _data_root.use_existing_root(path):
|
||||
_feedback.text = "data folder changed. straywild will close safely."
|
||||
get_tree().call_deferred("quit")
|
||||
_complete_data_root_change("data folder changed.")
|
||||
else:
|
||||
_feedback.text = _data_root.error_message
|
||||
dialog.queue_free()
|
||||
|
|
@ -733,7 +741,7 @@ func _show_existing_data_folder_choice(path: String) -> void:
|
|||
result.get("message", "could not replace selected data.")
|
||||
)
|
||||
if bool(result.get("ok", false)):
|
||||
get_tree().call_deferred("quit")
|
||||
_complete_data_root_change(_feedback.text.to_lower())
|
||||
dialog.queue_free()
|
||||
)
|
||||
_interface_fonts.apply_utility_theme(dialog)
|
||||
|
|
@ -744,6 +752,12 @@ func _show_existing_data_folder_choice(path: String) -> void:
|
|||
)
|
||||
|
||||
|
||||
func _complete_data_root_change(message: String) -> void:
|
||||
_feedback.text = message
|
||||
_refresh_data_page()
|
||||
data_root_changed.emit()
|
||||
|
||||
|
||||
func _choose_identity_export(identity_type: String) -> void:
|
||||
if not _identity_operation_allowed():
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue