This commit is contained in:
Face
2025-09-07 19:14:17 +03:00
parent 7220880e95
commit b4e151e79f
5 changed files with 587 additions and 0 deletions

View File

@@ -2,12 +2,14 @@ extends Button
const HISTORY = preload("res://Scenes/BrowserMenus/history.tscn")
const SETTINGS = preload("res://Scenes/BrowserMenus/settings.tscn")
const HELP = preload("res://Scenes/BrowserMenus/help.tscn")
@onready var tab_container: TabManager = $"../../TabContainer"
@onready var main: Main = $"../../../"
var history_scene: PopupPanel = null
var settings_scene: PopupPanel = null
var help_scene: PopupPanel = null
func _on_pressed() -> void:
%OptionsMenu.show()
@@ -44,6 +46,8 @@ func _on_options_menu_id_pressed(id: int) -> void:
show_history()
if id == 5: # downloads
show_downloads()
if id == 8: # help
show_help()
if id == 9: # settings
show_settings()
if id == 10: # exit
@@ -67,6 +71,19 @@ func _on_history_closed() -> void:
func show_downloads() -> void:
main.download_manager.show_downloads_history()
func show_help() -> void:
if help_scene == null:
help_scene = HELP.instantiate()
main.add_child(help_scene)
help_scene.connect("popup_hide", _on_help_closed)
else:
help_scene.show()
func _on_help_closed() -> void:
if help_scene:
help_scene.hide()
func show_settings() -> void:
if settings_scene == null:
settings_scene = SETTINGS.instantiate()

View File

@@ -0,0 +1,74 @@
extends PopupPanel
@onready var shortcuts_tab: Button = $HSplitContainer/Sidebar/VBoxContainer/TabShortcuts
@onready var browser_tab: Button = $HSplitContainer/Sidebar/VBoxContainer/TabBrowser
@onready var protocol_tab: Button = $HSplitContainer/Sidebar/VBoxContainer/TabProtocol
@onready var scripting_tab: Button = $HSplitContainer/Sidebar/VBoxContainer/TabScripting
@onready var shortcuts_panel: VBoxContainer = $HSplitContainer/Content/ScrollContainer/ContentStack/ShortcutsPanel
@onready var browser_panel: VBoxContainer = $HSplitContainer/Content/ScrollContainer/ContentStack/BrowserPanel
@onready var protocol_panel: VBoxContainer = $HSplitContainer/Content/ScrollContainer/ContentStack/ProtocolPanel
@onready var scripting_panel: VBoxContainer = $HSplitContainer/Content/ScrollContainer/ContentStack/ScriptingPanel
func _ready() -> void:
shortcuts_tab.pressed.connect(_on_shortcuts_tab_pressed)
browser_tab.pressed.connect(_on_browser_tab_pressed)
protocol_tab.pressed.connect(_on_protocol_tab_pressed)
scripting_tab.pressed.connect(_on_scripting_tab_pressed)
show_shortcuts_panel()
func _on_shortcuts_tab_pressed() -> void:
show_shortcuts_panel()
func _on_browser_tab_pressed() -> void:
show_browser_panel()
func _on_protocol_tab_pressed() -> void:
show_protocol_panel()
func _on_scripting_tab_pressed() -> void:
show_scripting_panel()
func show_shortcuts_panel() -> void:
shortcuts_panel.visible = true
browser_panel.visible = false
protocol_panel.visible = false
scripting_panel.visible = false
update_tab_colors(shortcuts_tab)
func show_browser_panel() -> void:
shortcuts_panel.visible = false
browser_panel.visible = true
protocol_panel.visible = false
scripting_panel.visible = false
update_tab_colors(browser_tab)
func show_protocol_panel() -> void:
shortcuts_panel.visible = false
browser_panel.visible = false
protocol_panel.visible = true
scripting_panel.visible = false
update_tab_colors(protocol_tab)
func show_scripting_panel() -> void:
shortcuts_panel.visible = false
browser_panel.visible = false
protocol_panel.visible = false
scripting_panel.visible = true
update_tab_colors(scripting_tab)
func update_tab_colors(active_tab: Button) -> void:
var tabs = [shortcuts_tab, browser_tab, protocol_tab, scripting_tab]
for tab in tabs:
if tab == active_tab:
tab.modulate = Color.WHITE
tab.add_theme_color_override("font_color", Color.WHITE)
else:
tab.modulate = Color(0.8, 0.8, 0.8)
tab.add_theme_color_override("font_color", Color(0.8, 0.8, 0.8))

View File

@@ -0,0 +1 @@
uid://bcew7v6hqhjox

View File

@@ -16,6 +16,7 @@ func init(element, parser: HTMLParser) -> void:
var element_id = element.get_attribute("id")
if element_id.is_empty():
var unique_id = "elem_" + str(Time.get_ticks_msec()) + "_" + str(randi())
element.set_attribute("id", unique_id)
element_id = unique_id
parser.register_dom_node(element, self)