Qt: Always display version info in settings
This commit is contained in:
parent
417c1e43dd
commit
5433b30fec
|
@ -103,6 +103,15 @@ bool AutoUpdaterDialog::isSupported()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AutoUpdaterDialog::isOfficialBuild()
|
||||||
|
{
|
||||||
|
#if !__has_include("scmversion/tag.h")
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool AutoUpdaterDialog::warnAboutUnofficialBuild()
|
bool AutoUpdaterDialog::warnAboutUnofficialBuild()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -746,7 +755,8 @@ bool AutoUpdaterDialog::processUpdate(const std::vector<u8>& update_data)
|
||||||
}
|
}
|
||||||
if (info.suffix() != QStringLiteral("app"))
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
static QStringList getTagList();
|
static QStringList getTagList();
|
||||||
static std::string getDefaultTag();
|
static std::string getDefaultTag();
|
||||||
static void cleanupAfterUpdate();
|
static void cleanupAfterUpdate();
|
||||||
|
static bool isOfficialBuild();
|
||||||
static bool warnAboutUnofficialBuild();
|
static bool warnAboutUnofficialBuild();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
@ -82,7 +82,8 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
|
||||||
|
|
||||||
populateLanguageDropdown(m_ui.language);
|
populateLanguageDropdown(m_ui.language);
|
||||||
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.language, "Main", "Language", QtHost::GetDefaultLanguage());
|
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();
|
onRenderToSeparateWindowChanged();
|
||||||
|
|
||||||
|
@ -118,24 +119,27 @@ InterfaceSettingsWidget::InterfaceSettingsWidget(SettingsWindow* dialog, QWidget
|
||||||
dialog->registerWidgetHelp(m_ui.enableDiscordPresence, tr("Enable Discord Presence"), tr("Unchecked"),
|
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."));
|
tr("Shows the game you are currently playing as part of your profile in Discord."));
|
||||||
|
|
||||||
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"),
|
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 "
|
tr("Automatically checks for updates to the program on startup. Updates can be deferred "
|
||||||
"until later or skipped entirely."));
|
"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);
|
||||||
m_ui.autoUpdateTag->addItems(AutoUpdaterDialog::getTagList());
|
m_ui.autoUpdateTag->addItems(AutoUpdaterDialog::getTagList());
|
||||||
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag",
|
SettingWidgetBinder::BindWidgetToStringSetting(sif, m_ui.autoUpdateTag, "AutoUpdater", "UpdateTag",
|
||||||
AutoUpdaterDialog::getDefaultTag());
|
AutoUpdaterDialog::getDefaultTag());
|
||||||
|
connect(m_ui.checkForUpdates, &QPushButton::clicked, this, []() { g_main_window->checkForUpdates(true); });
|
||||||
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); });
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ui.verticalLayout->removeWidget(m_ui.updatesGroup);
|
m_ui.autoUpdateTag->addItem(tr("Unavailable"));
|
||||||
m_ui.updatesGroup->hide();
|
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);
|
mbox.setTextFormat(Qt::RichText);
|
||||||
|
|
||||||
QString message;
|
QString message;
|
||||||
#ifdef _WIN32
|
if (!AutoUpdaterDialog::isOfficialBuild())
|
||||||
|
{
|
||||||
message =
|
message =
|
||||||
tr("<p>Sorry, you are trying to update a DuckStation version which is not an official GitHub release. To "
|
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>"
|
"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 "
|
"<p>Please download an official release from from <a "
|
||||||
"link below:</p>"
|
"href=\"https://www.duckstation.org/\">duckstation.org</a>.</p>");
|
||||||
"<p><a href=\"https://github.com/stenzek/duckstation/\">https://github.com/stenzek/duckstation/</a></p>");
|
}
|
||||||
#else
|
else
|
||||||
|
{
|
||||||
message = tr("Automatic updating is not supported on the current platform.");
|
message = tr("Automatic updating is not supported on the current platform.");
|
||||||
#endif
|
}
|
||||||
|
|
||||||
mbox.setText(message);
|
mbox.setText(message);
|
||||||
mbox.setIcon(QMessageBox::Critical);
|
mbox.setIcon(QMessageBox::Critical);
|
||||||
|
|
Loading…
Reference in New Issue