From a6cf3207761947e60b25c37de3e1c2ad18f7f1a6 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 19 Jul 2024 14:56:24 +1000 Subject: [PATCH] Qt: Fix scan percent dropping back to 0% at end --- src/duckstation-qt/gamelistrefreshthread.cpp | 17 +++++++++++++++++ src/duckstation-qt/gamelistrefreshthread.h | 3 +++ 2 files changed, 20 insertions(+) diff --git a/src/duckstation-qt/gamelistrefreshthread.cpp b/src/duckstation-qt/gamelistrefreshthread.cpp index 712712042..c51f18a91 100644 --- a/src/duckstation-qt/gamelistrefreshthread.cpp +++ b/src/duckstation-qt/gamelistrefreshthread.cpp @@ -22,6 +22,23 @@ void AsyncRefreshProgressCallback::Cancel() m_cancelled = true; } +void AsyncRefreshProgressCallback::PushState() +{ + ProgressCallback::PushState(); +} + +void AsyncRefreshProgressCallback::PopState() +{ + ProgressCallback::PopState(); + + if (static_cast(m_progress_range) == m_last_range && static_cast(m_progress_value) == m_last_value) + return; + + m_last_range = static_cast(m_progress_range); + m_last_value = static_cast(m_progress_value); + fireUpdate(); +} + void AsyncRefreshProgressCallback::SetStatusText(const std::string_view text) { const QString new_text = QtUtils::StringViewToQString(text); diff --git a/src/duckstation-qt/gamelistrefreshthread.h b/src/duckstation-qt/gamelistrefreshthread.h index 647281209..9c0e736f9 100644 --- a/src/duckstation-qt/gamelistrefreshthread.h +++ b/src/duckstation-qt/gamelistrefreshthread.h @@ -18,6 +18,9 @@ public: void Cancel(); + void PushState() override; + void PopState() override; + void SetStatusText(const std::string_view text) override; void SetProgressRange(u32 range) override; void SetProgressValue(u32 value) override;