Fill the song cache when the settings menu is closed

Raising the cache size used to have no effect until the next song was
played. Downloads now start when the settings window closes, so clicking
the number up and down while it is open does not start any downloads.
This commit is contained in:
Sansan committed 2026-10-06 08:32:56 +02:00
1 parent 16724922ed
commit 1acc757981
2 files changed
+63

No files matched your search

+7
View File
@@ -174,6 +174,7 @@ func _ready() -> void:
music_player_container.connect("play_next_song", play_next_song)
music_player_container.connect("update_song_list", update_song_list)
settings_window.connect("server_changed", server_updated)
settings_window.visibility_changed.connect(_on_settings_window_visibility_changed)
sync_window.connect("sync_started", _on_sync_started)
sync_window.connect("sync_finished", _on_sync_finished)
@@ -277,6 +278,12 @@ func play_next_song() -> void:
#"/music/rand"
#"/music/addQue"
#"/music/info"
# The cache size can be changed in the settings. Waiting until the settings are closed
# avoids starting downloads while the user is still clicking the number up and down.
func _on_settings_window_visibility_changed() -> void:
if !settings_window.visible && !Playlist.is_song_downloading && Playlist.should_preload_more_songs():
fetch_song()
func fetch_song() -> void:
print("fetch_song")
Playlist.is_song_downloading = true