mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-31 23:25:54 -04:00
open_link signal
This commit is contained in:
parent
c868162ed8
commit
1b80249b2b
10 changed files with 29 additions and 8 deletions
9
app/scripts/resources/app_events.gd
Normal file
9
app/scripts/resources/app_events.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends Resource
|
||||
class_name AppEvents
|
||||
|
||||
signal open_link(uri: String)
|
||||
|
||||
|
||||
func open_link_emit(uri: String) -> void:
|
||||
OS.shell_open(uri) # TODO: move somewhere else
|
||||
open_link.emit(uri)
|
|
@ -1,5 +1,6 @@
|
|||
extends CommandSync
|
||||
|
||||
@export var app_events: AppEvents
|
||||
@export var gate_events: GateEvents
|
||||
@export var command_events: CommandEvents
|
||||
|
||||
|
@ -47,7 +48,7 @@ func _execute_function(command: Command) -> Variant:
|
|||
|
||||
"open_link":
|
||||
if wrong_args_count(command, 1): return ERR_INVALID_PARAMETER
|
||||
OS.shell_open(command.args[0])
|
||||
app_events.open_link_emit(command.args[0])
|
||||
|
||||
_:
|
||||
Debug.logerr("Command %s not implemented" % [command.name])
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
extends RoundButton
|
||||
|
||||
@export var url: String
|
||||
@export var app_events: AppEvents
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -10,4 +11,4 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func open_help_url() -> void:
|
||||
OS.shell_open(url)
|
||||
app_events.open_link_emit(url)
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
extends RichTextLabel
|
||||
|
||||
@export var app_events: AppEvents
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
meta_clicked.connect(on_meta_clicked)
|
||||
|
||||
|
||||
func on_meta_clicked(meta) -> void:
|
||||
OS.shell_open(str(meta))
|
||||
app_events.open_link_emit(str(meta))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue