diff --git a/src/citron/game_list.cpp b/src/citron/game_list.cpp index 21ec0cae7..8b669928f 100644 --- a/src/citron/game_list.cpp +++ b/src/citron/game_list.cpp @@ -683,6 +683,18 @@ play_time_manager{play_time_manager_}, system{system_} { online_status_timer = new QTimer(this); connect(online_status_timer, &QTimer::timeout, this, &GameList::UpdateOnlineStatus); online_status_timer->start(5000); // Your refresh interval + + // Configure the new timer for debouncing configuration changes + config_update_timer.setSingleShot(true); + connect(&config_update_timer, &QTimer::timeout, this, &GameList::UpdateOnlineStatus); +} + +void GameList::OnConfigurationChanged() { + // This function debounces the update requests. Instead of starting a network + // request immediately, it starts a 500ms timer. If another config change happens, + // the timer is simply reset. The network request will only happen once, 500ms + // after the *last* change was made. + config_update_timer.start(500); } void GameList::UnloadController() { diff --git a/src/citron/game_list.h b/src/citron/game_list.h index ce7674a28..98f88d956 100644 --- a/src/citron/game_list.h +++ b/src/citron/game_list.h @@ -141,6 +141,9 @@ signals: void PopulatingCompleted(); void SaveConfig(); +public slots: + void OnConfigurationChanged(); + private slots: void OnItemExpanded(const QModelIndex& item); void OnTextChanged(const QString& new_text); @@ -201,6 +204,7 @@ private: ControllerNavigation* controller_navigation = nullptr; CompatibilityList compatibility_list; QTimer* online_status_timer; + QTimer config_update_timer; // NEW: Timer for debouncing config changes friend class GameListSearchField;