readability: rename constants, variables, extract enums across plugins

- itch: UPPER_CASE constants, CACHE_NAMESPACE, butler_process/rpc_socket/connection_state, LOGIN_METHOD enum, SETTINGS_SECTION, signal handler renames
- artprovider: UPPER_CASE constants, _enriched_meta, _find_game_dict, dead code removal, named poll intervals
- session-switch: MAX_POLL_FRAMES, _poll_for_power_menu, BUTTON_LABEL const
This commit is contained in:
Jose Falanga 2026-08-19 16:41:31 -03:00
parent 7ee08ac571
commit 97c1519833
4 changed files with 61 additions and 56 deletions

View file

@ -11,6 +11,8 @@ var settings_manager := load("res://core/global/settings_manager.tres") as Setti
var notification_manager := load("res://core/global/notification_manager.tres") as NotificationManager
const icon := preload("res://plugins/itch/assets/itch.svg")
enum LOGIN_METHOD { API_KEY = 0, PASSWORD = 1 }
@onready var status := $%Status as StatusPanel
@onready var connected_status := $%ConnectedStatus as StatusPanel
@onready var logged_in_status := $%LoggedInStatus as StatusPanel
@ -44,7 +46,7 @@ func _ready() -> void:
# Configure connected status
connected_status.status = connected_status.STATUS.ACTIVE
if itch.state != itch.STATE.BOOT:
if itch.connection_state != itch.STATE.BOOT:
connected_status.color = "green"
itch.client_ready.connect(func():
connected_status.color = "green"
@ -82,8 +84,8 @@ func _ready() -> void:
show_purchases_check.button_pressed = settings_manager.get_value("plugin.itch", "show_purchases", true) as bool
# Connect signals
save_button.pressed.connect(_on_save_button)
logout_button.pressed.connect(_on_logout_button)
save_button.pressed.connect(_on_save_pressed)
logout_button.pressed.connect(_on_logout_pressed)
login_method.item_selected.connect(_on_login_method_changed)
filter_check.toggled.connect(_on_filter_toggled)
show_purchases_check.toggled.connect(_on_show_purchases_toggled)
@ -105,17 +107,17 @@ func _on_login(login_status: ItchClient.LOGIN_STATUS, _profile: Dictionary) -> v
func _on_login_method_changed(idx: int) -> void:
# API key mode: show API key input, hide user/pass.
# Password mode: show user/pass, hide API key.
var is_api := idx == 0
var is_api := idx == LOGIN_METHOD.API_KEY
api_key_box.visible = is_api
username_box.visible = not is_api
password_box.visible = not is_api
func _on_save_button() -> void:
func _on_save_pressed() -> void:
var method: int = login_method.selected
settings_manager.set_value("plugin.itch", "login_method", method)
if method == 0:
if method == LOGIN_METHOD.API_KEY:
# API key login
settings_manager.set_value("plugin.itch", "username", "")
var api_key: String = api_key_box.text.strip_edges()
@ -133,11 +135,11 @@ func _on_save_button() -> void:
itch.login_with_password(uname, password)
func _on_logout_button() -> void:
func _on_logout_pressed() -> void:
var method: int = login_method.selected
# Clear saved credentials
if method == 0:
if method == LOGIN_METHOD.API_KEY:
settings_manager.set_value("plugin.itch", "api_key", "")
api_key_box.text = ""
else: