main/ holds the main window and top bar, quiz/ the quiz and its parts, player/ the music player, popups/ every popup and what they share, data/ the songs, players, playlist and settings, server/ the MusicServer client, common/ the list row and GameLog, and themes/ the themes and style boxes.
30 lines
852 B
GDScript
30 lines
852 B
GDScript
class_name QRPopup
|
|
extends BasePopup
|
|
## Shows a QR code with the address of the search page on the MusicServer, so players
|
|
## can search for soundtracks on their phones.
|
|
|
|
@onready var qr_panel: Panel = $QRPanel
|
|
@onready var qr_code_rect: QRCodeRect = %QRCodeRect
|
|
@onready var url_label: Label = %URLLabel
|
|
|
|
|
|
func _ready() -> void:
|
|
qr_code_rect.light_module_color = Color.WHITE
|
|
qr_code_rect.dark_module_color = Color.BLACK
|
|
qr_code_rect.quiet_zone_size = 4
|
|
|
|
# Generate QR code for the search URL
|
|
var url: String = Settings.default_path + "/search"
|
|
qr_code_rect.data = url
|
|
url_label.text = qr_code_rect.data
|
|
GameLog.debug("QR code generated for: ", url)
|
|
|
|
|
|
func open() -> void:
|
|
super()
|
|
# Regenerate QR code in case settings changed
|
|
var url: String = Settings.default_path + "/search"
|
|
qr_code_rect.data = url
|
|
url_label.text = qr_code_rect.data
|
|
|