mirror of
https://github.com/stenzek/duckstation.git
synced 2026-05-21 07:26:42 +00:00
Qt: Add indication that update check is in progress
Only for manually initiated update checks as feedback for the action triggering.
This commit is contained in:
@@ -1387,9 +1387,7 @@ void MainWindow::onPauseActionToggled(bool checked)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Restore action state.
|
// Restore action state.
|
||||||
Host::RunOnUIThread([]() {
|
Host::RunOnUIThread([]() { g_main_window->m_ui.actionPause->setChecked(false); });
|
||||||
g_main_window->m_ui.actionPause->setChecked(false);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2288,7 +2286,11 @@ void MainWindow::updateWindowState()
|
|||||||
|
|
||||||
void MainWindow::setProgressBar(int current, int total)
|
void MainWindow::setProgressBar(int current, int total)
|
||||||
{
|
{
|
||||||
|
// avoid frequent updates by normalizing value first
|
||||||
|
const int maximum = (total != 0) ? 100 : 0;
|
||||||
const int value = (total != 0) ? ((current * 100) / total) : 0;
|
const int value = (total != 0) ? ((current * 100) / total) : 0;
|
||||||
|
if (m_status_progress_widget->maximum() != maximum)
|
||||||
|
m_status_progress_widget->setMaximum(maximum);
|
||||||
if (m_status_progress_widget->value() != value)
|
if (m_status_progress_widget->value() != value)
|
||||||
m_status_progress_widget->setValue(value);
|
m_status_progress_widget->setValue(value);
|
||||||
|
|
||||||
@@ -3374,12 +3376,30 @@ void MainWindow::checkForUpdates(bool display_message)
|
|||||||
m_auto_updater_dialog = AutoUpdaterDialog::create(this, &error);
|
m_auto_updater_dialog = AutoUpdaterDialog::create(this, &error);
|
||||||
if (!m_auto_updater_dialog)
|
if (!m_auto_updater_dialog)
|
||||||
{
|
{
|
||||||
QtUtils::AsyncMessageBox(
|
if (display_message)
|
||||||
this, QMessageBox::Critical, tr("Error"),
|
{
|
||||||
tr("Failed to create auto updater: %1").arg(QString::fromStdString(error.GetDescription())));
|
QtUtils::AsyncMessageBox(
|
||||||
|
this, QMessageBox::Critical, tr("Error"),
|
||||||
|
tr("Failed to create auto updater: %1").arg(QString::fromStdString(error.GetDescription())));
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// display status message indicating check is in progress
|
||||||
|
// technically this could conflict with the game list refresh, but this is only for manual update checks.
|
||||||
|
// by that point the game list refresh should have completed anyway
|
||||||
|
if (display_message)
|
||||||
|
{
|
||||||
|
setProgressBar(0, 0);
|
||||||
|
m_ui.statusBar->showMessage(tr("Checking for updates..."));
|
||||||
|
|
||||||
|
connect(m_auto_updater_dialog, &AutoUpdaterDialog::updateCheckCompleted, this, [this](bool) {
|
||||||
|
clearProgressBar();
|
||||||
|
m_ui.statusBar->clearMessage();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
connect(m_auto_updater_dialog, &AutoUpdaterDialog::closed, this, [this]() {
|
connect(m_auto_updater_dialog, &AutoUpdaterDialog::closed, this, [this]() {
|
||||||
if (!m_auto_updater_dialog)
|
if (!m_auto_updater_dialog)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user