mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-04-09 02:41:26 -06:00
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
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:
parent
3fdcd6b7dc
commit
a5ac24adc5
@ -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);
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user