mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-22 08:15:39 +00:00
Qt: Always display version info in settings
This commit is contained in:
parent
026c7fce7e
commit
facfea5389
|
@ -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<u8>& 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
static QStringList getTagList();
|
||||
static std::string getDefaultTag();
|
||||
static void cleanupAfterUpdate();
|
||||
static bool isOfficialBuild();
|
||||
static bool warnAboutUnofficialBuild();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -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<int>::of(&QComboBox::currentIndexChanged), this, &InterfaceSettingsWidget::onLanguageChanged);
|
||||
connect(m_ui.language, QOverload<int>::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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2872,16 +2872,18 @@ void MainWindow::checkForUpdates(bool display_message)
|
|||
mbox.setTextFormat(Qt::RichText);
|
||||
|
||||
QString message;
|
||||
#ifdef _WIN32
|
||||
message =
|
||||
tr("<p>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.</p>"
|
||||
"<p>To obtain an official build, please follow the instructions under \"Downloading and Running\" at the "
|
||||
"link below:</p>"
|
||||
"<p><a href=\"https://github.com/stenzek/duckstation/\">https://github.com/stenzek/duckstation/</a></p>");
|
||||
#else
|
||||
message = tr("Automatic updating is not supported on the current platform.");
|
||||
#endif
|
||||
if (!AutoUpdaterDialog::isOfficialBuild())
|
||||
{
|
||||
message =
|
||||
tr("<p>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.</p>"
|
||||
"<p>Please download an official release from from <a "
|
||||
"href=\"https://www.duckstation.org/\">duckstation.org</a>.</p>");
|
||||
}
|
||||
else
|
||||
{
|
||||
message = tr("Automatic updating is not supported on the current platform.");
|
||||
}
|
||||
|
||||
mbox.setText(message);
|
||||
mbox.setIcon(QMessageBox::Critical);
|
||||
|
|
Loading…
Reference in a new issue