Add option to filter games not available on the current platform
The new 'Only show games available on this platform' checkbox in the plugin settings drops games whose platforms don't include the OS OpenGamepadUI is running on (e.g. Windows-only games on Linux). Games with no platform info at all (HTML5) are kept since there's nothing to filter on. The setting is read on every library load, so toggling it reloads the itch.io library without a restart.
This commit is contained in:
parent
f7d8f09f92
commit
b0183b7c20
5 changed files with 56 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ const icon := preload("res://plugins/itch/assets/itch.svg")
|
|||
@onready var api_key_box: LineEdit = $%ApiKeyInput
|
||||
@onready var save_button: Button = $%SaveButton
|
||||
@onready var help_label: Label = $%HelpLabel
|
||||
@onready var filter_check: CheckBox = $%FilterUnsupported
|
||||
|
||||
@onready var itch: ItchClient = get_tree().get_first_node_in_group("itch_client")
|
||||
|
||||
|
|
@ -27,6 +28,8 @@ func _ready() -> void:
|
|||
api_key_box.text = api_key
|
||||
api_key_box.secret = true
|
||||
|
||||
filter_check.button_pressed = settings_manager.get_value("plugin.itch", "filter_unsupported", true) as bool
|
||||
|
||||
help_label.text = "Get an API key from https://itch.io/user/settings/api-keys"
|
||||
|
||||
_update_status()
|
||||
|
|
@ -34,6 +37,7 @@ func _ready() -> void:
|
|||
itch.logged_in.connect(_on_login)
|
||||
|
||||
save_button.pressed.connect(_on_save_button)
|
||||
filter_check.toggled.connect(_on_filter_toggled)
|
||||
|
||||
|
||||
func _update_status() -> void:
|
||||
|
|
@ -68,3 +72,13 @@ func _on_save_button() -> void:
|
|||
if api_key == "":
|
||||
return
|
||||
itch.login_with_api_key(api_key)
|
||||
|
||||
|
||||
## Persists the platform filter and reloads the itch.io library so the
|
||||
## change applies without restarting. The setting is read back by
|
||||
## library_itch.gd on every library load, so toggling just re-filters.
|
||||
func _on_filter_toggled(pressed: bool) -> void:
|
||||
settings_manager.set_value("plugin.itch", "filter_unsupported", pressed)
|
||||
var library_manager := load("res://core/global/library_manager.tres") as LibraryManager
|
||||
if library_manager:
|
||||
library_manager.load_library("itch")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue