diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 9d28f4fc5e..87849bc83f 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -139,7 +139,7 @@ game_list_frame::game_list_frame(std::shared_ptr gui_settings, std connect(&m_refresh_watcher, &QFutureWatcher::finished, this, &game_list_frame::OnRefreshFinished); connect(&m_refresh_watcher, &QFutureWatcher::canceled, this, [this]() { - gui::utils::stop_future_watcher(m_size_watcher, true); + gui::utils::stop_future_watcher(m_size_watcher, true, m_size_watcher_cancel); gui::utils::stop_future_watcher(m_repaint_watcher, true); m_path_list.clear(); @@ -436,7 +436,10 @@ std::string game_list_frame::GetDataDirBySerial(const std::string& serial) void game_list_frame::Refresh(const bool from_drive, const bool scroll_after) { - gui::utils::stop_future_watcher(m_size_watcher, true); + if (from_drive) + { + gui::utils::stop_future_watcher(m_size_watcher, true, m_size_watcher_cancel); + } gui::utils::stop_future_watcher(m_repaint_watcher, true); gui::utils::stop_future_watcher(m_refresh_watcher, from_drive); @@ -714,7 +717,7 @@ void game_list_frame::Refresh(const bool from_drive, const bool scroll_after) void game_list_frame::OnRefreshFinished() { - gui::utils::stop_future_watcher(m_size_watcher, true); + gui::utils::stop_future_watcher(m_size_watcher, true, m_size_watcher_cancel); gui::utils::stop_future_watcher(m_repaint_watcher, true); for (auto&& g : m_games.pop_all()) diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 325cd40713..280f6540b1 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -2982,6 +2982,10 @@ void main_window::keyPressEvent(QKeyEvent *keyEvent) { ui->toolbar_fullscreen->trigger(); } + else if ((keyEvent->modifiers() & Qt::ControlModifier) && keyEvent->key() == Qt::Key_F5) + { + m_game_list_frame->Refresh(true); + } } void main_window::mouseDoubleClickEvent(QMouseEvent *event) diff --git a/rpcs3/rpcs3qt/qt_utils.h b/rpcs3/rpcs3qt/qt_utils.h index 0292b5631d..c6487a4847 100644 --- a/rpcs3/rpcs3qt/qt_utils.h +++ b/rpcs3/rpcs3qt/qt_utils.h @@ -1,6 +1,7 @@ #pragma once #include "util/types.hpp" +#include "util/atomic.hpp" #include #include @@ -130,13 +131,19 @@ namespace gui QString format_byte_size(usz size); template - void stop_future_watcher(QFutureWatcher& watcher, bool cancel) + void stop_future_watcher(QFutureWatcher& watcher, bool cancel, std::shared_ptr> cancel_flag = nullptr) { - if (watcher.isRunning()) + if (watcher.isStarted() || watcher.isRunning()) { if (cancel) { watcher.cancel(); + + // We use an optional cancel flag since the QFutureWatcher::canceled signal seems to be very unreliable + if (cancel_flag) + { + *cancel_flag = true; + } } watcher.waitForFinished(); }