mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-05 18:23:39 -04:00
qt: Workaround for Qt directoryChanged event spam on macOS (#1665)
* 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
2 changed files with 11 additions and 1 deletions
|
|
@ -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…
Add table
Reference in a new issue