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

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 // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -559,6 +559,7 @@ void QtConfig::ReadMiscellaneousValues() {
ReadBasicSetting(Settings::values.log_filter); ReadBasicSetting(Settings::values.log_filter);
ReadBasicSetting(Settings::values.log_regex_filter); ReadBasicSetting(Settings::values.log_regex_filter);
ReadBasicSetting(Settings::values.enable_gamemode); ReadBasicSetting(Settings::values.enable_gamemode);
ReadBasicSetting(UISettings::values.check_for_update_on_start);
qt_config->endGroup(); qt_config->endGroup();
} }
@ -795,7 +796,6 @@ void QtConfig::ReadUIValues() {
ReadBasicSetting(UISettings::values.enable_discord_presence); ReadBasicSetting(UISettings::values.enable_discord_presence);
ReadBasicSetting(UISettings::values.screenshot_resolution_factor); ReadBasicSetting(UISettings::values.screenshot_resolution_factor);
ReadUpdaterValues();
ReadUILayoutValues(); ReadUILayoutValues();
ReadUIGameListValues(); ReadUIGameListValues();
ReadShortcutValues(); ReadShortcutValues();
@ -861,15 +861,6 @@ void QtConfig::ReadUILayoutValues() {
qt_config->endGroup(); 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() { void QtConfig::ReadWebServiceValues() {
qt_config->beginGroup(QStringLiteral("WebService")); qt_config->beginGroup(QStringLiteral("WebService"));
@ -1123,6 +1114,7 @@ void QtConfig::SaveMiscellaneousValues() {
WriteBasicSetting(Settings::values.log_filter); WriteBasicSetting(Settings::values.log_filter);
WriteBasicSetting(Settings::values.log_regex_filter); WriteBasicSetting(Settings::values.log_regex_filter);
WriteBasicSetting(Settings::values.enable_gamemode); WriteBasicSetting(Settings::values.enable_gamemode);
WriteBasicSetting(UISettings::values.check_for_update_on_start);
qt_config->endGroup(); qt_config->endGroup();
} }
@ -1310,7 +1302,6 @@ void QtConfig::SaveUIValues() {
WriteBasicSetting(UISettings::values.enable_discord_presence); WriteBasicSetting(UISettings::values.enable_discord_presence);
WriteBasicSetting(UISettings::values.screenshot_resolution_factor); WriteBasicSetting(UISettings::values.screenshot_resolution_factor);
SaveUpdaterValues();
SaveUILayoutValues(); SaveUILayoutValues();
SaveUIGameListValues(); SaveUIGameListValues();
SaveShortcutValues(); SaveShortcutValues();
@ -1374,15 +1365,6 @@ void QtConfig::SaveUILayoutValues() {
qt_config->endGroup(); 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() { void QtConfig::SaveWebServiceValues() {
qt_config->beginGroup(QStringLiteral("WebService")); 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 // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -48,7 +48,6 @@ private:
void ReadUIValues(); void ReadUIValues();
void ReadUIGameListValues(); void ReadUIGameListValues();
void ReadUILayoutValues(); void ReadUILayoutValues();
void ReadUpdaterValues();
void ReadUtilityValues(); void ReadUtilityValues();
void ReadWebServiceValues(); void ReadWebServiceValues();
void ReadVideoDumpingValues(); void ReadVideoDumpingValues();
@ -70,7 +69,6 @@ private:
void SaveUIValues(); void SaveUIValues();
void SaveUIGameListValues(); void SaveUIGameListValues();
void SaveUILayoutValues(); void SaveUILayoutValues();
void SaveUpdaterValues();
void SaveUtilityValues(); void SaveUtilityValues();
void SaveWebServiceValues(); void SaveWebServiceValues();
void SaveVideoDumpingValues(); 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 // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // 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_display_label->setMinimumWidth(width);
ui->emulation_speed_combo->setVisible(!Settings::IsConfiguringGlobal()); ui->emulation_speed_combo->setVisible(!Settings::IsConfiguringGlobal());
ui->screenshot_combo->setVisible(!Settings::IsConfiguringGlobal()); ui->screenshot_combo->setVisible(!Settings::IsConfiguringGlobal());
ui->updateBox->setVisible(UISettings::values.updater_found);
#ifndef __unix__ #ifndef __unix__
ui->toggle_gamemode->setVisible(false); ui->toggle_gamemode->setVisible(false);
#endif #endif
#ifndef ENABLE_QT_UPDATE_CHECKER
ui->toggle_update_checker->setVisible(false);
#endif
SetupPerGameUI(); SetupPerGameUI();
SetConfiguration(); SetConfiguration();
@ -77,10 +79,8 @@ void ConfigureGeneral::SetConfiguration() {
ui->toggle_background_mute->setChecked( ui->toggle_background_mute->setChecked(
UISettings::values.mute_when_in_background.GetValue()); UISettings::values.mute_when_in_background.GetValue());
ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue()); ui->toggle_hide_mouse->setChecked(UISettings::values.hide_mouse.GetValue());
ui->toggle_update_checker->setChecked(
ui->toggle_update_check->setChecked(
UISettings::values.check_for_update_on_start.GetValue()); UISettings::values.check_for_update_on_start.GetValue());
ui->toggle_auto_update->setChecked(UISettings::values.update_on_close.GetValue());
#ifdef __unix__ #ifdef __unix__
ui->toggle_gamemode->setChecked(Settings::values.enable_gamemode.GetValue()); ui->toggle_gamemode->setChecked(Settings::values.enable_gamemode.GetValue());
#endif #endif
@ -178,9 +178,7 @@ void ConfigureGeneral::ApplyConfiguration() {
UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked();
UISettings::values.mute_when_in_background = ui->toggle_background_mute->isChecked(); UISettings::values.mute_when_in_background = ui->toggle_background_mute->isChecked();
UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked(); UISettings::values.hide_mouse = ui->toggle_hide_mouse->isChecked();
UISettings::values.check_for_update_on_start = ui->toggle_update_checker->isChecked();
UISettings::values.check_for_update_on_start = ui->toggle_update_check->isChecked();
UISettings::values.update_on_close = ui->toggle_auto_update->isChecked();
#ifdef __unix__ #ifdef __unix__
Settings::values.enable_gamemode = ui->toggle_gamemode->isChecked(); Settings::values.enable_gamemode = ui->toggle_gamemode->isChecked();
#endif #endif
@ -211,9 +209,9 @@ void ConfigureGeneral::SetupPerGameUI() {
}); });
ui->general_group->setVisible(false); ui->general_group->setVisible(false);
ui->updateBox->setVisible(false);
ui->button_reset_defaults->setVisible(false); ui->button_reset_defaults->setVisible(false);
ui->toggle_gamemode->setVisible(false); ui->toggle_gamemode->setVisible(false);
ui->toggle_update_checker->setVisible(false);
ConfigurationShared::SetColoredComboBox( ConfigurationShared::SetColoredComboBox(
ui->region_combobox, ui->widget_region, ui->region_combobox, ui->widget_region,

View File

@ -57,26 +57,10 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="updateBox">
<property name="title">
<string>Updates</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="QCheckBox" name="toggle_update_check"> <widget class="QCheckBox" name="toggle_update_checker">
<property name="text"> <property name="text">
<string>Check for updates on start</string> <string>Check for updates</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="toggle_auto_update">
<property name="text">
<string>Silently auto update after closing</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -324,8 +308,7 @@
<tabstop>toggle_check_exit</tabstop> <tabstop>toggle_check_exit</tabstop>
<tabstop>toggle_background_pause</tabstop> <tabstop>toggle_background_pause</tabstop>
<tabstop>toggle_hide_mouse</tabstop> <tabstop>toggle_hide_mouse</tabstop>
<tabstop>toggle_update_check</tabstop> <tabstop>toggle_update_checker</tabstop>
<tabstop>toggle_auto_update</tabstop>
<tabstop>button_reset_defaults</tabstop> <tabstop>button_reset_defaults</tabstop>
</tabstops> </tabstops>
<resources/> <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 // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // 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> pause_when_in_background{false, "pauseWhenInBackground"};
Settings::Setting<bool> mute_when_in_background{false, "muteWhenInBackground"}; Settings::Setting<bool> mute_when_in_background{false, "muteWhenInBackground"};
Settings::Setting<bool> hide_mouse{false, "hideInactiveMouse"}; 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"}; Settings::Setting<bool> check_for_update_on_start{true, "check_for_update_on_start"};
// Discord RPC // Discord RPC