diff --git a/src/duckstation-qt/autoupdaterdialog.cpp b/src/duckstation-qt/autoupdaterdialog.cpp index 0eff388f9..44b860589 100644 --- a/src/duckstation-qt/autoupdaterdialog.cpp +++ b/src/duckstation-qt/autoupdaterdialog.cpp @@ -103,6 +103,15 @@ bool AutoUpdaterDialog::isSupported() #endif } +bool AutoUpdaterDialog::isOfficialBuild() +{ +#if !__has_include("scmversion/tag.h") + return false; +#else + return true; +#endif +} + bool AutoUpdaterDialog::warnAboutUnofficialBuild() { // @@ -746,7 +755,8 @@ bool AutoUpdaterDialog::processUpdate(const std::vector& update_data) } if (info.suffix() != QStringLiteral("app")) { - reportError(fmt::format("Unexpected application suffix {} on {}.", info.suffix().toStdString(), bundle_path.value())); + reportError( + fmt::format("Unexpected application suffix {} on {}.", info.suffix().toStdString(), bundle_path.value())); return false; } diff --git a/src/duckstation-qt/autoupdaterdialog.h b/src/duckstation-qt/autoupdaterdialog.h index 324fcb8d8..1da1b90ef 100644 --- a/src/duckstation-qt/autoupdaterdialog.h +++ b/src/duckstation-qt/autoupdaterdialog.h @@ -33,6 +33,7 @@ public: static QStringList getTagList(); static std::string getDefaultTag(); static void cleanupAfterUpdate(); + static bool isOfficialBuild(); static bool warnAboutUnofficialBuild(); Q_SIGNALS: diff --git a/src/duckstation-qt/interfacesettingswidget.cpp b/src/duckstation-qt/interfacesettingswidget.cpp index 555d4239d..b0f394fb4 100644 --- a/src/duckstation-qt/interfacesettingswidget.cpp +++ b/src/duckstation-qt/interfacesettingswidget.cpp @@ -82,7 +82,8 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget populateLanguageDropdown(m_ui.language); SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.language, "Main", "Language", QtHost::GetDefaultLanguage()); - connect(m_ui.language, QOverload::of(&QComboBox::currentIndexChanged), this, &InterfaceSettingsWidget::onLanguageChanged); + connect(m_ui.language, QOverload::of(&QComboBox::currentIndexChanged), this, + &InterfaceSettingsWidget::onLanguageChanged); onRenderToSeparateWindowChanged(); @@ -118,24 +119,27 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget dialog->registerWidgetHelp(m_ui.enableDiscordPresence, tr("Enable Discord Presence"), tr("Unchecked"), tr("Shows the game you are currently playing as part of your profile in Discord.")); + dialog->registerWidgetHelp(m_ui.autoUpdateEnabled, tr("Enable Automatic Update Check"), tr("Checked"), + tr("Automatically checks for updates to the program on startup. Updates can be deferred " + "until later or skipped entirely.")); + + m_ui.autoUpdateCurrentVersion->setText(tr("%1 (%2)").arg(g_scm_tag_str).arg(g_scm_date_str)); + if (!m_dialog->isPerGameSettings() && AutoUpdaterDialog::isSupported()) { SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.autoUpdateEnabled, "AutoUpdater", "CheckAtStartup", true); - dialog->registerWidgetHelp(m_ui.autoUpdateEnabled, tr("Enable Automatic Update Check"), tr("Checked"), - tr("Automatically checks for updates to the program on startup. Updates can be deferred " - "until later or skipped entirely.")); - m_ui.autoUpdateTag->addItems(AutoUpdaterDialog::getTagList()); SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag", AutoUpdaterDialog::getDefaultTag()); - - m_ui.autoUpdateCurrentVersion->setText(tr("%1 (%2)").arg(g_scm_tag_str).arg(g_scm_date_str)); - connect(m_ui.checkForUpdates, &QPushButton::clicked, []() { g_main_window->checkForUpdates(true); }); + connect(m_ui.checkForUpdates, &QPushButton::clicked, this, []() { g_main_window->checkForUpdates(true); }); } else { - m_ui.verticalLayout->removeWidget(m_ui.updatesGroup); - m_ui.updatesGroup->hide(); + m_ui.autoUpdateTag->addItem(tr("Unavailable")); + m_ui.autoUpdateEnabled->setEnabled(false); + m_ui.autoUpdateTag->setEnabled(false); + m_ui.checkForUpdates->setEnabled(false); + m_ui.updatesGroup->setEnabled(false); } } diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 09cbeedee..cbf255bc0 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -2872,16 +2872,18 @@ void MainWindow::checkForUpdates(bool display_message) mbox.setTextFormat(Qt::RichText); QString message; -#ifdef _WIN32 - message = - tr("

Sorry, you are trying to update a DuckStation version which is not an official GitHub release. To " - "prevent incompatibilities, the auto-updater is only enabled on official builds.

" - "

To obtain an official build, please follow the instructions under \"Downloading and Running\" at the " - "link below:

" - "

https://github.com/stenzek/duckstation/

"); -#else - message = tr("Automatic updating is not supported on the current platform."); -#endif + if (!AutoUpdaterDialog::isOfficialBuild()) + { + message = + tr("

Sorry, you are trying to update a DuckStation version which is not an official GitHub release. To " + "prevent incompatibilities, the auto-updater is only enabled on official builds.

" + "

Please download an official release from from duckstation.org.

"); + } + else + { + message = tr("Automatic updating is not supported on the current platform."); + } mbox.setText(message); mbox.setIcon(QMessageBox::Critical);