From 076f4a6293837fc004c9e05963134ee97c5d1db0 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 4 Jan 2025 16:59:31 +1000 Subject: [PATCH] Qt: Fix delay in progress dialog opening Applies to updater, verify, etc. --- src/duckstation-qt/autoupdaterdialog.cpp | 1 + src/duckstation-qt/gamesummarywidget.cpp | 1 + src/duckstation-qt/qthost.cpp | 1 + src/duckstation-qt/qtprogresscallback.cpp | 12 +++++++----- src/duckstation-qt/qtprogresscallback.h | 2 ++ 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/duckstation-qt/autoupdaterdialog.cpp b/src/duckstation-qt/autoupdaterdialog.cpp index dc53d891f..606f910e9 100644 --- a/src/duckstation-qt/autoupdaterdialog.cpp +++ b/src/duckstation-qt/autoupdaterdialog.cpp @@ -533,6 +533,7 @@ void AutoUpdaterDialog::downloadUpdateClicked() progress.SetStatusText(tr("Downloading %1...").arg(m_latest_sha).toUtf8().constData()); progress.GetDialog().setWindowIcon(windowIcon()); progress.SetCancellable(true); + progress.MakeVisible(); m_http->CreateRequest( m_download_url.toStdString(), diff --git a/src/duckstation-qt/gamesummarywidget.cpp b/src/duckstation-qt/gamesummarywidget.cpp index 493cc922a..5b55656d5 100644 --- a/src/duckstation-qt/gamesummarywidget.cpp +++ b/src/duckstation-qt/gamesummarywidget.cpp @@ -492,6 +492,7 @@ void GameSummaryWidget::onComputeHashClicked() QtModalProgressCallback progress_callback(this); progress_callback.SetCancellable(true); progress_callback.SetProgressRange(image->GetTrackCount()); + progress_callback.MakeVisible(); std::vector track_hashes; track_hashes.reserve(image->GetTrackCount()); diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index a8238e858..ba48ebb5d 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -292,6 +292,7 @@ std::optional QtHost::DownloadFile(QWidget* parent, const QString& title, progress.GetDialog().setWindowTitle(title); progress.GetDialog().setWindowIcon(GetAppIcon()); progress.SetCancellable(true); + progress.MakeVisible(); http->CreateRequest( std::move(url), diff --git a/src/duckstation-qt/qtprogresscallback.cpp b/src/duckstation-qt/qtprogresscallback.cpp index 9ebd565b8..d8d504cf8 100644 --- a/src/duckstation-qt/qtprogresscallback.cpp +++ b/src/duckstation-qt/qtprogresscallback.cpp @@ -97,11 +97,13 @@ void QtModalProgressCallback::checkForDelayedShow() return; if (m_show_timer.GetTimeSeconds() >= m_show_delay) - { - m_dialog.setRange(0, m_progress_range); - m_dialog.setValue(m_progress_value); - m_dialog.show(); - } + MakeVisible(); +} +void QtModalProgressCallback::MakeVisible() +{ + m_dialog.setRange(0, m_progress_range); + m_dialog.setValue(m_progress_value); + m_dialog.show(); } // NOTE: We deliberately don't set the thread parent, because otherwise we can't move it. diff --git a/src/duckstation-qt/qtprogresscallback.h b/src/duckstation-qt/qtprogresscallback.h index 69058bc70..dda0f1a7f 100644 --- a/src/duckstation-qt/qtprogresscallback.h +++ b/src/duckstation-qt/qtprogresscallback.h @@ -31,6 +31,8 @@ public: bool ModalConfirmation(const std::string_view message) override; void ModalInformation(const std::string_view message) override; + void MakeVisible(); + private Q_SLOTS: void dialogCancelled();