Qt: remove seemingly obsolete processEvents

Replace them with early outs on cancel.
The processEvents was probably added to allow user interaction.
But it works fine without it as far as I can tell.
This commit is contained in:
Megamouse 2024-05-04 22:43:54 +02:00
parent d6d6ce9c5f
commit 281f248d91
1 changed files with 15 additions and 2 deletions

View File

@ -374,12 +374,16 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after)
{
for (const auto& entry : fs::dir(path))
{
if (m_parsing_watcher.isCanceled())
{
break;
}
if (!entry.is_directory || entry.name == "." || entry.name == "..")
{
continue;
}
QApplication::processEvents();
std::lock_guard lock(m_path_mutex);
m_path_entries.emplace_back(path_entry{path + entry.name, is_disc, false});
}
@ -392,6 +396,11 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after)
for (const auto& [serial, path] : Emu.GetGamesConfig().get_games())
{
if (m_parsing_watcher.isCanceled())
{
break;
}
std::string game_dir = path;
game_dir.resize(game_dir.find_last_not_of('/') + 1);
@ -406,7 +415,6 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after)
game_dir = game_dir.substr(0, game_dir.size() - 4);
}
QApplication::processEvents();
std::lock_guard lock(m_path_mutex);
m_path_entries.emplace_back(path_entry{game_dir, false, true});
}
@ -649,6 +657,11 @@ void game_list_frame::OnParsingFinished()
{
for (const auto& entry : fs::dir(path))
{
if (m_refresh_watcher.isCanceled())
{
break;
}
if (!entry.is_directory || entry.name == "." || entry.name == "..")
{
continue;