From 489344866bc07371b50d4b7c457fd08d013f1166 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 30 Apr 2024 01:57:20 +0300 Subject: [PATCH] Hide some preferences in non-desktop versions Properties such as FFMPEG, native file dialog & single window don't make sense to exist in Web & potentially mobile platforms. --- src/Preferences/PreferencesDialog.gd | 17 +++++++++++------ src/Preferences/PreferencesDialog.tscn | 12 ++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Preferences/PreferencesDialog.gd b/src/Preferences/PreferencesDialog.gd index ca2d6ea50..6a8d017df 100644 --- a/src/Preferences/PreferencesDialog.gd +++ b/src/Preferences/PreferencesDialog.gd @@ -188,7 +188,7 @@ var preferences: Array[Preference] = [ Preference.new("tablet_driver", "Drivers/DriversContainer/TabletDriver", "selected", 0, true) ] -var content_list := [] +var content_list := PackedStringArray([]) var selected_item := 0 @onready var list: ItemList = $HSplitContainer/List @@ -242,12 +242,10 @@ func _ready() -> void: continue child.confirmed.connect(Tools.update_hint_tooltips) - for child in right_side.get_children(): - content_list.append(child.name) - if OS.get_name() == "Web": - content_list.erase("Startup") - right_side.get_node("Startup").queue_free() + var startup := right_side.get_node("Startup") + right_side.remove_child(startup) + startup.queue_free() right_side.get_node("Language").visible = true Global.open_last_project = false elif OS.get_name() == "Windows": @@ -256,6 +254,11 @@ func _ready() -> void: for driver in DisplayServer.tablet_get_driver_count(): var driver_name := DisplayServer.tablet_get_driver_name(driver) tablet_driver.add_item(driver_name, driver) + if not OS.has_feature("pc"): + get_tree().call_group(&"DesktopOnly", &"queue_free") + + for child in right_side.get_children(): + content_list.append(child.name) # Create buttons for each language var system_language := language.get_node(^"System Language") as Button @@ -273,6 +276,8 @@ func _ready() -> void: button.pressed.connect(_on_language_pressed.bind(button.get_index())) for pref in preferences: + if not right_side.has_node(pref.node_path): + continue var node := right_side.get_node(pref.node_path) var restore_default_button := RestoreDefaultButton.new() restore_default_button.setting_name = pref.prop_name diff --git a/src/Preferences/PreferencesDialog.tscn b/src/Preferences/PreferencesDialog.tscn index 8f1484a6e..34feff5bb 100644 --- a/src/Preferences/PreferencesDialog.tscn +++ b/src/Preferences/PreferencesDialog.tscn @@ -91,11 +91,11 @@ layout_mode = 2 mouse_default_cursor_shape = 2 text = "On" -[node name="FFMPEGPathLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Startup/StartupContainer"] +[node name="FFMPEGPathLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Startup/StartupContainer" groups=["DesktopOnly"]] layout_mode = 2 text = "FFMPEG path" -[node name="FFMPEGPath" type="LineEdit" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Startup/StartupContainer"] +[node name="FFMPEGPath" type="LineEdit" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Startup/StartupContainer" groups=["DesktopOnly"]] layout_mode = 2 [node name="Language" type="VBoxContainer" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide"] @@ -219,12 +219,12 @@ mouse_default_cursor_shape = 2 button_pressed = true text = "On" -[node name="NativeFileDialogsLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"] +[node name="NativeFileDialogsLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions" groups=["DesktopOnly"]] layout_mode = 2 size_flags_horizontal = 3 text = "Use native file dialogs" -[node name="NativeFileDialogs" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"] +[node name="NativeFileDialogs" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions" groups=["DesktopOnly"]] layout_mode = 2 size_flags_horizontal = 3 tooltip_text = "When this setting is enabled, the native file dialogs of the operating system are being used, instead of Pixelorama's custom ones." @@ -232,12 +232,12 @@ mouse_default_cursor_shape = 2 button_pressed = true text = "On" -[node name="SingleWindowModeLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"] +[node name="SingleWindowModeLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions" groups=["DesktopOnly"]] layout_mode = 2 size_flags_horizontal = 3 text = "Single window mode" -[node name="SingleWindowMode" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions"] +[node name="SingleWindowMode" type="CheckBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/InterfaceOptions" groups=["DesktopOnly"]] layout_mode = 2 size_flags_horizontal = 3 tooltip_text = "When this setting is enabled, Pixelorama's subwindows will be embedded in the main window, otherwise each dialog will be its own separate window."