mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
b55a462945
After months of work and over a hundred commits on this repo alone (not to mention the old, half-working repos on GitHub), StreamGraph is finally ready to be shown to the public, even if in an incomplete state. This PR is a culmination of numerous design discussions, re-writes, and hours spent by both @Eroax and myself. Reviewed-on: https://codeberg.org/Eroax/StreamGraph/pulls/18 Co-authored-by: Lera Elvoé <yagich@poto.cafe> Co-committed-by: Lera Elvoé <yagich@poto.cafe>
63 lines
1.5 KiB
GDScript
63 lines
1.5 KiB
GDScript
# (c) 2023-present Eroax
|
|
# (c) 2023-present Yagich
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
extends ConfirmationDialog
|
|
class_name OBSWebsocketSetupDialog
|
|
|
|
@onready var port_spin_box: SpinBox = %PortSpinBox
|
|
@onready var password_line_edit: LineEdit = %PasswordLineEdit
|
|
@onready var connect_button: Button = %ConnectButton
|
|
|
|
signal connect_button_pressed(state: ConnectionState)
|
|
|
|
enum ConnectionState {
|
|
DISCONNECTED,
|
|
CONNECTING,
|
|
CONNECTED,
|
|
}
|
|
var state: ConnectionState
|
|
|
|
@onready var _old_port: int = port_spin_box.value
|
|
@onready var _old_password: String = password_line_edit.text
|
|
|
|
|
|
func get_port() -> int:
|
|
return int(port_spin_box.value)
|
|
|
|
|
|
func get_password() -> String:
|
|
return password_line_edit.text
|
|
|
|
|
|
func set_button_state(p_state: ConnectionState) -> void:
|
|
connect_button.disabled = p_state == ConnectionState.CONNECTING
|
|
state = p_state
|
|
|
|
match p_state:
|
|
ConnectionState.DISCONNECTED:
|
|
connect_button.text = "Connect"
|
|
ConnectionState.CONNECTING:
|
|
connect_button.text = "Connecting..."
|
|
ConnectionState.CONNECTED:
|
|
connect_button.text = "Disconnect"
|
|
|
|
|
|
func _ready() -> void:
|
|
connect_button.pressed.connect(
|
|
func():
|
|
connect_button_pressed.emit(state)
|
|
)
|
|
|
|
canceled.connect(
|
|
func():
|
|
print("canceled")
|
|
port_spin_box.value = float(_old_port)
|
|
password_line_edit.text = _old_password
|
|
)
|
|
|
|
confirmed.connect(
|
|
func():
|
|
print("confirmed")
|
|
_old_port = int(port_spin_box.value)
|
|
_old_password = password_line_edit.text
|
|
)
|