qt: Added setting "Check for updates"

This commit is contained in:
OpenSauce04 2025-03-11 19:51:03 +00:00 committed by PabloMK7
parent 2234fa93cb
commit d10a1f1a87
6 changed files with 28 additions and 67 deletions

View File

@ -309,6 +309,7 @@ GMainWindow::GMainWindow(Core::System& system_)
}
#ifdef ENABLE_QT_UPDATE_CHECKER
if (UISettings::values.check_for_update_on_start) {
const std::optional<std::string> latest_release = UpdateChecker::CheckForUpdate();
if (latest_release && latest_release.value() != Common::g_build_fullname) {
if (QMessageBox::information(
@ -316,11 +317,13 @@ GMainWindow::GMainWindow(Core::System& system_)
tr("Update %1 for Azahar is available.\nWould you like to download it?")
.arg(QString::fromStdString(latest_release.value())),
QMessageBox::Yes | QMessageBox::Ignore) == QMessageBox::Yes) {
QDesktopServices::openUrl(QUrl(QString::fromStdString(
"https://github.com/azahar-emu/azahar/releases/tag/" + latest_release.value())));
QDesktopServices::openUrl(QUrl(
QString::fromStdString("https://github.com/azahar-emu/azahar/releases/tag/" +
latest_release.value())));
exit(0);
}
}
}
#endif
#ifdef __unix__

View File

@ -1,4 +1,4 @@
// Copyright 2014 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@ -559,6 +559,7 @@ void QtConfig::ReadMiscellaneousValues() {
ReadBasicSetting(Settings::values.log_filter);
ReadBasicSetting(Settings::values.log_regex_filter);
ReadBasicSetting(Settings::values.enable_gamemode);
ReadBasicSetting(UISettings::values.check_for_update_on_start);
qt_config->endGroup();
}
@ -795,7 +796,6 @@ void QtConfig::ReadUIValues() {
ReadBasicSetting(UISettings::values.enable_discord_presence);
ReadBasicSetting(UISettings::values.screenshot_resolution_factor);
ReadUpdaterValues();
ReadUILayoutValues();
ReadUIGameListValues();
ReadShortcutValues();
@ -861,15 +861,6 @@ void QtConfig::ReadUILayoutValues() {
qt_config->endGroup();
}
void QtConfig::ReadUpdaterValues() {
qt_config->beginGroup(QStringLiteral("Updater"));
ReadBasicSetting(UISettings::values.check_for_update_on_start);
ReadBasicSetting(UISettings::values.update_on_close);
qt_config->endGroup();
}
void QtConfig::ReadWebServiceValues() {
qt_config->beginGroup(QStringLiteral("WebService"));
@ -1123,6 +1114,7 @@ void QtConfig::SaveMiscellaneousValues() {
WriteBasicSetting(Settings::values.log_filter);
WriteBasicSetting(Settings::values.log_regex_filter);
WriteBasicSetting(Settings::values.enable_gamemode);
WriteBasicSetting(UISettings::values.check_for_update_on_start);
qt_config->endGroup();
}
@ -1310,7 +1302,6 @@ void QtConfig::SaveUIValues() {
WriteBasicSetting(UISettings::values.enable_discord_presence);
WriteBasicSetting(UISettings::values.screenshot_resolution_factor);
SaveUpdaterValues();
SaveUILayoutValues();
SaveUIGameListValues();
SaveShortcutValues();
@ -1374,15 +1365,6 @@ void QtConfig::SaveUILayoutValues() {
qt_config->endGroup();
}
void QtConfig::SaveUpdaterValues() {
qt_config->beginGroup(QStringLiteral("Updater"));
WriteBasicSetting(UISettings::values.check_for_update_on_start);
WriteBasicSetting(UISettings::values.update_on_close);
qt_config->endGroup();
}
void QtConfig::SaveWebServiceValues() {
qt_config->beginGroup(QStringLiteral("WebService"));

View File

@ -1,4 +1,4 @@
// Copyright 2014 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@ -48,7 +48,6 @@ private:
void ReadUIValues();
void ReadUIGameListValues();
void ReadUILayoutValues();
void ReadUpdaterValues();
void ReadUtilityValues();
void ReadWebServiceValues();
void ReadVideoDumpingValues();
@ -70,7 +69,6 @@ private:
void SaveUIValues();
void SaveUIGameListValues();
void SaveUILayoutValues();
void SaveUpdaterValues();
void SaveUtilityValues();
void SaveWebServiceValues();
void SaveVideoDumpingValues();

View File

@ -1,4 +1,4 @@
// Copyright 2016 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@ -35,10 +35,12 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
ui->emulation_speed_display_label->setMinimumWidth(width);
ui->emulation_speed_combo->setVisible(!Settings::IsConfiguringGlobal());
ui->screenshot_combo->setVisible(!Settings::IsConfiguringGlobal());
ui->updateBox->setVisible(UISettings::values.updater_found);
#ifndef __unix__
ui->toggle_gamemode->setVisible(false);
#endif
#ifndef ENABLE_QT_UPDATE_CHECKER
ui->toggle_update_checker->setVisible(false);
#endif
SetupPerGameUI();
SetConfiguration();
@ -77,10 +79,8 @@ void ConfigureGeneral::SetConfiguration() {
ui->toggle_background_mute->setChecked(
UISettings::values.mute_when_in_background.GetValue());
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue());
ui->toggle_update_check->setChecked(
ui->toggle_update_checker->setChecked(
UISettings::values.check_for_update_on_start.GetValue());
ui->toggle_auto_update->setChecked(UISettings::values.update_on_close.GetValue());
#ifdef __unix__
ui->toggle_gamemode->setChecked(Settings::values.enable_gamemode.GetValue());
#endif
@ -178,9 +178,7 @@ void ConfigureGeneral::ApplyConfiguration() {
UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked();
UISettings::values.mute_when_in_background = ui->toggle_background_mute->isChecked();
UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked();
UISettings::values.check_for_update_on_start = ui->toggle_update_check->isChecked();
UISettings::values.update_on_close = ui->toggle_auto_update->isChecked();
UISettings::values.check_for_update_on_start = ui->toggle_update_checker->isChecked();
#ifdef __unix__
Settings::values.enable_gamemode = ui->toggle_gamemode->isChecked();
#endif
@ -211,9 +209,9 @@ void ConfigureGeneral::SetupPerGameUI() {
});
ui->general_group->setVisible(false);
ui->updateBox->setVisible(false);
ui->button_reset_defaults->setVisible(false);
ui->toggle_gamemode->setVisible(false);
ui->toggle_update_checker->setVisible(false);
ConfigurationShared::SetColoredComboBox(
ui->region_combobox, ui->widget_region,

View File

@ -57,26 +57,10 @@
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="updateBox">
<property name="title">
<string>Updates</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QCheckBox" name="toggle_update_check">
<widget class="QCheckBox" name="toggle_update_checker">
<property name="text">
<string>Check for updates on start</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_auto_update">
<property name="text">
<string>Silently auto update after closing</string>
<string>Check for updates</string>
</property>
</widget>
</item>
@ -324,8 +308,7 @@
<tabstop>toggle_check_exit</tabstop>
<tabstop>toggle_background_pause</tabstop>
<tabstop>toggle_hide_mouse</tabstop>
<tabstop>toggle_update_check</tabstop>
<tabstop>toggle_auto_update</tabstop>
<tabstop>toggle_update_checker</tabstop>
<tabstop>button_reset_defaults</tabstop>
</tabstops>
<resources/>

View File

@ -1,4 +1,4 @@
// Copyright 2016 Citra Emulator Project
// Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@ -82,9 +82,6 @@ struct Values {
Settings::Setting<bool> pause_when_in_background{false, "pauseWhenInBackground"};
Settings::Setting<bool> mute_when_in_background{false, "muteWhenInBackground"};
Settings::Setting<bool> hide_mouse{false, "hideInactiveMouse"};
bool updater_found;
Settings::Setting<bool> update_on_close{false, "update_on_close"};
Settings::Setting<bool> check_for_update_on_start{true, "check_for_update_on_start"};
// Discord RPC