add and edit installs
This commit is contained in:
53
UI/Dialogs/InstallEditDialog.gd
Normal file
53
UI/Dialogs/InstallEditDialog.gd
Normal file
@ -0,0 +1,53 @@
|
||||
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)
|
77
UI/Dialogs/InstallEditDialog.tscn
Normal file
77
UI/Dialogs/InstallEditDialog.tscn
Normal file
@ -0,0 +1,77 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://u0de32p0bb61"]
|
||||
|
||||
[ext_resource type="Script" path="res://UI/Dialogs/InstallEditDialog.gd" id="1_qfdve"]
|
||||
[ext_resource type="PackedScene" uid="uid://ig4wkr1lxvbv" path="res://UI/Components/OverrideEditorSettingsMenu/OverrideEditorSettingsMenu.tscn" id="2_elqgy"]
|
||||
|
||||
[node name="InstallEditDialog" type="ConfirmationDialog"]
|
||||
initial_position = 1
|
||||
title = "Edit Install"
|
||||
size = Vector2i(678, 419)
|
||||
script = ExtResource("1_qfdve")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
offset_left = 8.0
|
||||
offset_top = 8.0
|
||||
offset_right = 670.0
|
||||
offset_bottom = 370.0
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Name"
|
||||
|
||||
[node name="NameLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer2"]
|
||||
layout_mode = 2
|
||||
text = "Icon"
|
||||
|
||||
[node name="IconPathLineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "Optional"
|
||||
|
||||
[node name="OpenIconFileDialogButton" type="Button" parent="VBoxContainer/HBoxContainer2"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "F"
|
||||
|
||||
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3"]
|
||||
layout_mode = 2
|
||||
text = "Godot Version"
|
||||
|
||||
[node name="VersionSelector" type="OptionButton" parent="VBoxContainer/HBoxContainer3"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 150)
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="OverrideEditorSettingsMenu" parent="VBoxContainer/ScrollContainer" instance=ExtResource("2_elqgy")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/CenterContainer"]
|
||||
layout_mode = 2
|
||||
text = "Install overrides take precedence over group overrides."
|
||||
horizontal_alignment = 1
|
Reference in New Issue
Block a user