54 lines
1.8 KiB
GDScript
54 lines
1.8 KiB
GDScript
extends ConfirmationDialog
|
|
class_name InstallEditDialog
|
|
|
|
@onready var name_line_edit: LineEdit = %NameLineEdit
|
|
@onready var icon_path_line_edit: LineEdit = %IconPathLineEdit
|
|
@onready var open_icon_file_dialog_button: Button = %OpenIconFileDialogButton
|
|
@onready var override_editor_settings_menu: OverrideEditorSettingsMenu = %OverrideEditorSettingsMenu
|
|
@onready var version_selector: OptionButton = %VersionSelector
|
|
|
|
var install_metadata: InstallMetadata
|
|
|
|
|
|
func clear() -> void:
|
|
name_line_edit.clear()
|
|
icon_path_line_edit.clear()
|
|
override_editor_settings_menu.clear()
|
|
install_metadata = InstallMetadata.new()
|
|
|
|
version_selector.clear()
|
|
for version in ReleasesManager.get_installed_versions():
|
|
version_selector.add_item(version)
|
|
version_selector.set_item_metadata(
|
|
version_selector.get_item_count() - 1,
|
|
ReleasesManager.get_version_metadata(version).binary_path)
|
|
|
|
|
|
func get_install_metadata() -> InstallMetadata:
|
|
install_metadata.name = name_line_edit.text
|
|
install_metadata.icon_path = icon_path_line_edit.text
|
|
install_metadata.local_overrides = override_editor_settings_menu.get_overrides()
|
|
install_metadata.binary_path = version_selector.get_selected_metadata()
|
|
|
|
return install_metadata
|
|
|
|
|
|
func fill_from_install_metadata() -> void:
|
|
name_line_edit.text = install_metadata.name
|
|
icon_path_line_edit.text = install_metadata.icon_path
|
|
override_editor_settings_menu.fill_from_dictionary(install_metadata.local_overrides)
|
|
var item_id: int = -1
|
|
for i in version_selector.get_item_count():
|
|
if version_selector.get_item_metadata(i) == install_metadata.binary_path:
|
|
item_id = i
|
|
break
|
|
version_selector.select(item_id)
|
|
|
|
|
|
func clear_ok_button_connections() -> void:
|
|
for connection in get_signal_connection_list("confirmed"):
|
|
var callable := connection["callable"] as Callable
|
|
var _signal := connection["signal"] as Signal
|
|
|
|
_signal.disconnect(callable)
|