qt: Workaround for Qt directoryChanged event spam on macOS (#1665)
Some checks are pending
citra-build / source (push) Waiting to run
citra-build / linux (appimage) (push) Waiting to run
citra-build / linux (appimage-wayland) (push) Waiting to run
citra-build / linux (fresh) (push) Waiting to run
citra-build / macos (arm64) (push) Waiting to run
citra-build / macos (x86_64) (push) Waiting to run
citra-build / macos-universal (push) Blocked by required conditions
citra-build / windows (msvc) (push) Waiting to run
citra-build / windows (msys2) (push) Waiting to run
citra-build / android (googleplay) (push) Waiting to run
citra-build / android (vanilla) (push) Waiting to run
citra-build / docker (push) Waiting to run
citra-format / clang-format (push) Waiting to run
citra-transifex / transifex (push) Waiting to run

* qt: Workaround for Qt directoryChanged event spam on macOS

* Use steady_clock instead of system_clock
This commit is contained in:
OpenSauce 2026-01-21 21:15:49 +00:00 committed by GitHub
parent 3fdcd6b7dc
commit a5ac24adc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -1113,13 +1113,21 @@ const QStringList GameList::supported_file_extensions = {
};
void GameList::RefreshGameDirectory() {
// Do not scan directories when the system is powered on, it will be
// repopulated on shutdown anyways.
if (Core::System::GetInstance().IsPoweredOn()) {
return;
}
const auto time_now = std::chrono::steady_clock::now();
// Max of 1 refresh every 1 second.
if (time_last_refresh + std::chrono::seconds(1) > time_now) {
return;
}
time_last_refresh = time_now;
if (!UISettings::values.game_dirs.isEmpty() && current_worker != nullptr) {
LOG_INFO(Frontend, "Change detected in the applications directory. Reloading game list.");
PopulateAsync(UISettings::values.game_dirs);

View File

@ -153,6 +153,8 @@ private:
friend class GameListSearchField;
const PlayTime::PlayTimeManager& play_time_manager;
std::chrono::time_point<std::chrono::steady_clock> time_last_refresh;
};
class GameListPlaceholder : public QWidget {