Skip to content

Commit db9a9e7

Browse files
committed
Qt: Add indication that update check is in progress
Only for manually initiated update checks as feedback for the action triggering.
1 parent fe8b8f0 commit db9a9e7

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/duckstation-qt/mainwindow.cpp

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,9 +1387,7 @@ void MainWindow::onPauseActionToggled(bool checked)
13871387
else
13881388
{
13891389
// Restore action state.
1390-
Host::RunOnUIThread([]() {
1391-
g_main_window->m_ui.actionPause->setChecked(false);
1392-
});
1390+
Host::RunOnUIThread([]() { g_main_window->m_ui.actionPause->setChecked(false); });
13931391
}
13941392
});
13951393
}
@@ -2288,7 +2286,11 @@ void MainWindow::updateWindowState()
22882286

22892287
void MainWindow::setProgressBar(int current, int total)
22902288
{
2289+
// avoid frequent updates by normalizing value first
2290+
const int maximum = (total != 0) ? 100 : 0;
22912291
const int value = (total != 0) ? ((current * 100) / total) : 0;
2292+
if (m_status_progress_widget->maximum() != maximum)
2293+
m_status_progress_widget->setMaximum(maximum);
22922294
if (m_status_progress_widget->value() != value)
22932295
m_status_progress_widget->setValue(value);
22942296

@@ -3374,12 +3376,30 @@ void MainWindow::checkForUpdates(bool display_message)
33743376
m_auto_updater_dialog = AutoUpdaterDialog::create(this, &error);
33753377
if (!m_auto_updater_dialog)
33763378
{
3377-
QtUtils::AsyncMessageBox(
3378-
this, QMessageBox::Critical, tr("Error"),
3379-
tr("Failed to create auto updater: %1").arg(QString::fromStdString(error.GetDescription())));
3379+
if (display_message)
3380+
{
3381+
QtUtils::AsyncMessageBox(
3382+
this, QMessageBox::Critical, tr("Error"),
3383+
tr("Failed to create auto updater: %1").arg(QString::fromStdString(error.GetDescription())));
3384+
}
3385+
33803386
return;
33813387
}
33823388

3389+
// display status message indicating check is in progress
3390+
// technically this could conflict with the game list refresh, but this is only for manual update checks.
3391+
// by that point the game list refresh should have completed anyway
3392+
if (display_message)
3393+
{
3394+
setProgressBar(0, 0);
3395+
m_ui.statusBar->showMessage(tr("Checking for updates..."));
3396+
3397+
connect(m_auto_updater_dialog, &AutoUpdaterDialog::updateCheckCompleted, this, [this](bool) {
3398+
clearProgressBar();
3399+
m_ui.statusBar->clearMessage();
3400+
});
3401+
}
3402+
33833403
connect(m_auto_updater_dialog, &AutoUpdaterDialog::closed, this, [this]() {
33843404
if (!m_auto_updater_dialog)
33853405
return;

0 commit comments

Comments
 (0)