QT: AutoUpdate -Formatting/Always Show Changelog (#2401)

* QT: AutoUpdate - Text formatting

* +

* Always Show Changelog

* +

update Channel is already called once, it doesn't need to be called again
This commit is contained in:
DanielSvoboda 2025-02-12 14:04:35 -03:00 committed by GitHub
parent 98eb8cb741
commit 642c0bc367
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 178 additions and 21 deletions

View file

@ -55,6 +55,7 @@ static bool isDebugDump = false;
static bool isShaderDebug = false;
static bool isShowSplash = false;
static bool isAutoUpdate = false;
static bool isAlwaysShowChangelog = false;
static bool isNullGpu = false;
static bool shouldCopyGPUBuffers = false;
static bool shouldDumpShaders = false;
@ -237,6 +238,10 @@ bool autoUpdate() {
return isAutoUpdate;
}
bool alwaysShowChangelog() {
return isAlwaysShowChangelog;
}
bool nullGpu() {
return isNullGpu;
}
@ -337,6 +342,10 @@ void setAutoUpdate(bool enable) {
isAutoUpdate = enable;
}
void setAlwaysShowChangelog(bool enable) {
isAlwaysShowChangelog = enable;
}
void setNullGpu(bool enable) {
isNullGpu = enable;
}
@ -678,6 +687,7 @@ void load(const std::filesystem::path& path) {
}
isShowSplash = toml::find_or<bool>(general, "showSplash", true);
isAutoUpdate = toml::find_or<bool>(general, "autoUpdate", false);
isAlwaysShowChangelog = toml::find_or<bool>(general, "alwaysShowChangelog", false);
separateupdatefolder = toml::find_or<bool>(general, "separateUpdateEnabled", false);
compatibilityData = toml::find_or<bool>(general, "compatibilityEnabled", false);
checkCompatibilityOnStartup =
@ -811,6 +821,7 @@ void save(const std::filesystem::path& path) {
data["General"]["chooseHomeTab"] = chooseHomeTab;
data["General"]["showSplash"] = isShowSplash;
data["General"]["autoUpdate"] = isAutoUpdate;
data["General"]["alwaysShowChangelog"] = isAlwaysShowChangelog;
data["General"]["separateUpdateEnabled"] = separateupdatefolder;
data["General"]["compatibilityEnabled"] = compatibilityData;
data["General"]["checkCompatibilityOnStartup"] = checkCompatibilityOnStartup;
@ -932,6 +943,7 @@ void setDefaultValues() {
isShaderDebug = false;
isShowSplash = false;
isAutoUpdate = false;
isAlwaysShowChangelog = false;
isNullGpu = false;
shouldDumpShaders = false;
vblankDivider = 1;

View file

@ -57,6 +57,7 @@ bool debugDump();
bool collectShadersForDebug();
bool showSplash();
bool autoUpdate();
bool alwaysShowChangelog();
bool nullGpu();
bool copyGPUCmdBuffers();
bool dumpShaders();
@ -68,6 +69,7 @@ void setDebugDump(bool enable);
void setCollectShaderForDebug(bool enable);
void setShowSplash(bool enable);
void setAutoUpdate(bool enable);
void setAlwaysShowChangelog(bool enable);
void setNullGpu(bool enable);
void setAllowHDR(bool enable);
void setCopyGPUCmdBuffers(bool enable);

View file

@ -198,29 +198,45 @@ void CheckUpdate::setupUI(const QString& downloadUrl, const QString& latestDate,
QString updateChannel = QString::fromStdString(Config::getUpdateChannel());
QString updateText =
QString("<p><b><br>" + tr("Update Channel") + ": </b>" + updateChannel + "<br><b>" +
tr("Current Version") + ":</b> %1 (%2)<br><b>" + tr("Latest Version") +
":</b> %3 (%4)</p><p>" + tr("Do you want to update?") + "</p>")
.arg(currentRev.left(7), currentDate, latestRev, latestDate);
QString updateText = QString("<p><b>" + tr("Update Channel") + ": </b>" + updateChannel +
"<br>"
"<table><tr>"
"<td><b>" +
tr("Current Version") +
":</b></td>"
"<td>%1</td>"
"<td>(%2)</td>"
"</tr><tr>"
"<td><b>" +
tr("Latest Version") +
":</b></td>"
"<td>%3</td>"
"<td>(%4)</td>"
"</tr></table></p>")
.arg(currentRev.left(7), currentDate, latestRev, latestDate);
QLabel* updateLabel = new QLabel(updateText, this);
layout->addWidget(updateLabel);
// Setup bottom layout with action buttons
QHBoxLayout* bottomLayout = new QHBoxLayout();
autoUpdateCheckBox = new QCheckBox(tr("Check for Updates at Startup"), this);
layout->addWidget(autoUpdateCheckBox);
QHBoxLayout* updatePromptLayout = new QHBoxLayout();
QLabel* updatePromptLabel = new QLabel(tr("Do you want to update?"), this);
updatePromptLayout->addWidget(updatePromptLabel);
yesButton = new QPushButton(tr("Update"), this);
noButton = new QPushButton(tr("No"), this);
yesButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
noButton->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
bottomLayout->addWidget(autoUpdateCheckBox);
QSpacerItem* spacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
bottomLayout->addItem(spacer);
updatePromptLayout->addItem(spacer);
updatePromptLayout->addWidget(yesButton);
updatePromptLayout->addWidget(noButton);
bottomLayout->addWidget(yesButton);
bottomLayout->addWidget(noButton);
layout->addLayout(bottomLayout);
layout->addLayout(updatePromptLayout);
// Don't show changelog button if:
// The current version is a pre-release and the version to be downloaded is a release.
@ -241,19 +257,27 @@ void CheckUpdate::setupUI(const QString& downloadUrl, const QString& latestDate,
connect(toggleButton, &QPushButton::clicked,
[this, textField, toggleButton, currentRev, latestRev, downloadUrl, latestDate,
currentDate]() {
QString updateChannel = QString::fromStdString(Config::getUpdateChannel());
if (!textField->isVisible()) {
requestChangelog(currentRev, latestRev, downloadUrl, latestDate,
currentDate);
textField->setVisible(true);
toggleButton->setText(tr("Hide Changelog"));
adjustSize();
textField->setFixedWidth(textField->width() + 20);
} else {
textField->setVisible(false);
toggleButton->setText(tr("Show Changelog"));
adjustSize();
}
});
if (Config::alwaysShowChangelog()) {
requestChangelog(currentRev, latestRev, downloadUrl, latestDate, currentDate);
textField->setVisible(true);
toggleButton->setText(tr("Hide Changelog"));
adjustSize();
textField->setFixedWidth(textField->width() + 20);
}
}
connect(yesButton, &QPushButton::clicked, this, [this, downloadUrl]() {

View file

@ -137,9 +137,15 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
#if (QT_VERSION < QT_VERSION_CHECK(6, 7, 0))
connect(ui->updateCheckBox, &QCheckBox::stateChanged, this,
[](int state) { Config::setAutoUpdate(state == Qt::Checked); });
connect(ui->changelogCheckBox, &QCheckBox::stateChanged, this,
[](int state) { Config::setAlwaysShowChangelog(state == Qt::Checked); });
#else
connect(ui->updateCheckBox, &QCheckBox::checkStateChanged, this,
[](Qt::CheckState state) { Config::setAutoUpdate(state == Qt::Checked); });
connect(ui->changelogCheckBox, &QCheckBox::checkStateChanged, this,
[](Qt::CheckState state) { Config::setAlwaysShowChangelog(state == Qt::Checked); });
#endif
connect(ui->updateComboBox, &QComboBox::currentTextChanged, this,
@ -391,6 +397,8 @@ void SettingsDialog::LoadValuesFromConfig() {
#ifdef ENABLE_UPDATER
ui->updateCheckBox->setChecked(toml::find_or<bool>(data, "General", "autoUpdate", false));
ui->changelogCheckBox->setChecked(
toml::find_or<bool>(data, "General", "alwaysShowChangelog", false));
std::string updateChannel = toml::find_or<std::string>(data, "General", "updateChannel", "");
if (updateChannel != "Release" && updateChannel != "Nightly") {
if (Common::isRelease) {
@ -651,6 +659,7 @@ void SettingsDialog::UpdateSettings() {
Config::setCollectShaderForDebug(ui->collectShaderCheckBox->isChecked());
Config::setCopyGPUCmdBuffers(ui->copyGPUBuffersCheckBox->isChecked());
Config::setAutoUpdate(ui->updateCheckBox->isChecked());
Config::setAlwaysShowChangelog(ui->changelogCheckBox->isChecked());
Config::setUpdateChannel(ui->updateComboBox->currentText().toStdString());
Config::setChooseHomeTab(ui->chooseHomeTabComboBox->currentText().toStdString());
Config::setCompatibilityEnabled(ui->enableCompatibilityCheckBox->isChecked());

View file

@ -74,7 +74,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>535</height>
<height>536</height>
</rect>
</property>
<layout class="QVBoxLayout" name="generalTabVLayout" stretch="0">
@ -346,7 +346,7 @@
<property name="title">
<string>Update</string>
</property>
<layout class="QVBoxLayout" name="UpdateLayout" stretch="0,0,0">
<layout class="QVBoxLayout" name="UpdateLayout" stretch="0,0,0,0">
<property name="spacing">
<number>6</number>
</property>
@ -465,6 +465,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="changelogCheckBox">
<property name="text">
<string>Always Show Changelog</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -488,7 +495,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>535</height>
<height>536</height>
</rect>
</property>
<layout class="QVBoxLayout" name="guiTabVLayout" stretch="0">
@ -937,7 +944,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>535</height>
<height>536</height>
</rect>
</property>
<layout class="QVBoxLayout" name="graphicsTabVLayout" stretch="0,0">
@ -1181,7 +1188,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>535</height>
<height>536</height>
</rect>
</property>
<layout class="QVBoxLayout" name="userTabVLayout" stretch="0,0,1">
@ -1325,7 +1332,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>535</height>
<height>536</height>
</rect>
</property>
<layout class="QVBoxLayout" name="inputTabVLayout" stretch="0,0">
@ -1609,7 +1616,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>535</height>
<height>536</height>
</rect>
</property>
<layout class="QVBoxLayout" name="pathsTabLayout">
@ -1699,7 +1706,7 @@
<x>0</x>
<y>0</y>
<width>946</width>
<height>535</height>
<height>536</height>
</rect>
</property>
<layout class="QVBoxLayout" name="debugTabVLayout" stretch="0,0">

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Tjek for opdateringer ved start</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Vis altid changelog</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Opdateringskanal</translation>

View file

@ -752,6 +752,10 @@
<source>Check for Updates at Startup</source>
<translation>Beim Start nach Updates suchen</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Changelog immer anzeigen</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Update-Kanal</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Έλεγχος για ενημερώσεις κατά την εκκίνηση</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Πάντα εμφάνιση ιστορικού αλλαγών</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Κανάλι Ενημέρωσης</translation>

View file

@ -740,6 +740,10 @@
<source>Check for Updates at Startup</source>
<translation>Check for Updates at Startup</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Always Show Changelog</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Update Channel</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Buscar actualizaciones al iniciar</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Mostrar siempre el registro de cambios</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Canal de Actualización</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>بررسی بهروزرسانیها در زمان راهاندازی</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>نمایش دائم تاریخچه تغییرات</translation>
</message>
<message>
<source>Update Channel</source>
<translation>کانال بهروزرسانی</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Tarkista Päivitykset Käynnistäessä</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Näytä aina muutoshistoria</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Päivityskanava</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Vérif. maj au démarrage</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Afficher toujours le changelog</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Canal de Mise à Jour</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Frissítések keresése indításkor</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Mindig mutasd a változásnaplót</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Frissítési Csatorna</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Periksa pembaruan saat mulai</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Selalu Tampilkan Riwayat Perubahan</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Saluran Pembaruan</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Verifica aggiornamenti allavvio</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Mostra sempre il changelog</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Canale di Aggiornamento</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation></translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation></translation>
</message>
<message>
<source>Update Channel</source>
<translation></translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Check for Updates at Startup</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation> </translation>
</message>
<message>
<source>Update Channel</source>
<translation>Update Channel</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Tikrinti naujinimus paleidus</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Visada rodyti pakeitimų žurnalą</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Atnaujinimo Kanalas</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Bij opstart op updates controleren</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Altijd changelog tonen</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Updatekanaal</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Sprawdź aktualizacje przy starcie</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Zawsze pokazuj dziennik zmian</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Kanał Aktualizacji</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Verificar Atualizações ao Iniciar</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Sempre Mostrar o Changelog</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Canal de Atualização</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Verifică actualizări la pornire</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Arată întotdeauna jurnalul modificărilor</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Canal de Actualizare</translation>

View file

@ -796,6 +796,10 @@
<source>Check for Updates at Startup</source>
<translation>Проверка при запуске</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Всегда показывать журнал изменений</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Канал обновления</translation>

View file

@ -736,6 +736,10 @@
<source>Check for Updates at Startup</source>
<translation>Kontrollo për përditësime nisje</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Shfaq gjithmonë regjistrin e ndryshimeve</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Kanali i përditësimit</translation>

View file

@ -1423,6 +1423,10 @@
<source>Check for Updates at Startup</source>
<translation>Leta efter uppdateringar vid uppstart</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Visa alltid ändringsloggen</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Uppdateringskanal</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Başlangıçta güncellemeleri kontrol et</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Her zaman değişiklik günlüğünü göster</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Güncelleme Kanalı</translation>

View file

@ -793,6 +793,10 @@
<source>Check for Updates at Startup</source>
<translation>Перевіряти оновлення під час запуску</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Завжди показувати журнал змін</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Канал оновлення</translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation>Kiểm tra cập nhật khi khởi đng</translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation>Luôn hiển thị nhật thay đi</translation>
</message>
<message>
<source>Update Channel</source>
<translation>Kênh Cập Nhật</translation>

View file

@ -728,7 +728,6 @@
<source>Guest Debug Markers</source>
<translation>Geust </translation>
</message>
<message>
<source>Update</source>
<translation></translation>
@ -737,6 +736,10 @@
<source>Check for Updates at Startup</source>
<translation></translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation></translation>
</message>
<message>
<source>Update Channel</source>
<translation></translation>

View file

@ -728,6 +728,10 @@
<source>Check for Updates at Startup</source>
<translation></translation>
</message>
<message>
<source>Always Show Changelog</source>
<translation></translation>
</message>
<message>
<source>Update Channel</source>
<translation></translation>