Add check_app_updates setting and UI
Introduce a new "check_app_updates" configuration (default: true) to allow users to enable/disable automatic YTSage update checks. Adds a styled checkbox to the Updater tab with getter, loads the setting (defaults to enabled for older configs), and saves it from the custom options dialog. The main update check now respects this setting and will skip checking when disabled. Also include English localization entries for the new UI strings.
This commit is contained in:
@@ -972,6 +972,11 @@ class CustomOptionsDialog(QDialog):
|
||||
ConfigManager.set("check_beta_updates", beta_enabled)
|
||||
logger.info(f"Saved beta updates setting: {beta_enabled}")
|
||||
|
||||
# Save app update checker setting
|
||||
app_updates_enabled = self.updater_tab.get_app_update_checker_setting()
|
||||
ConfigManager.set("check_app_updates", app_updates_enabled)
|
||||
logger.info(f"Saved app updates checker setting: {app_updates_enabled}")
|
||||
|
||||
except Exception as e:
|
||||
logger.exception(f"Error saving auto-update settings: {e}")
|
||||
|
||||
|
||||
@@ -445,6 +445,33 @@ class UpdaterTabWidget(QWidget):
|
||||
# === App Updates Section ===
|
||||
app_update_group = QGroupBox(_("settings.app_updates_title"))
|
||||
app_update_layout = QVBoxLayout()
|
||||
|
||||
self.app_updates_checkbox = QCheckBox(_("settings.check_app_updates"))
|
||||
self.app_updates_checkbox.setStyleSheet(
|
||||
"""
|
||||
QCheckBox {
|
||||
color: #ffffff;
|
||||
spacing: 5px;
|
||||
padding: 3px;
|
||||
}
|
||||
QCheckBox::indicator {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 9px;
|
||||
}
|
||||
QCheckBox::indicator:unchecked {
|
||||
border: 2px solid #666666;
|
||||
background: #1d1e22;
|
||||
border-radius: 9px;
|
||||
}
|
||||
QCheckBox::indicator:checked {
|
||||
border: 2px solid #c90000;
|
||||
background: #c90000;
|
||||
border-radius: 9px;
|
||||
}
|
||||
"""
|
||||
)
|
||||
app_update_layout.addWidget(self.app_updates_checkbox)
|
||||
|
||||
self.beta_updates_checkbox = QCheckBox(_("settings.check_beta_updates"))
|
||||
self.beta_updates_checkbox.setStyleSheet(
|
||||
@@ -655,6 +682,10 @@ class UpdaterTabWidget(QWidget):
|
||||
# Load beta setting
|
||||
beta_enabled = ConfigManager.get("check_beta_updates") or False
|
||||
self.beta_updates_checkbox.setChecked(beta_enabled)
|
||||
|
||||
# Load app update checker setting (default enabled for older configs)
|
||||
app_updates_enabled = ConfigManager.get("check_app_updates")
|
||||
self.app_updates_checkbox.setChecked(app_updates_enabled is not False)
|
||||
|
||||
# Set current selection based on saved settings
|
||||
current_frequency = auto_settings["frequency"]
|
||||
@@ -697,6 +728,10 @@ class UpdaterTabWidget(QWidget):
|
||||
def get_beta_update_setting(self) -> bool:
|
||||
"""Returns the beta update setting from the dialog."""
|
||||
return self.beta_updates_checkbox.isChecked()
|
||||
|
||||
def get_app_update_checker_setting(self) -> bool:
|
||||
"""Returns the app version checker setting from the dialog."""
|
||||
return self.app_updates_checkbox.isChecked()
|
||||
|
||||
def _on_channel_changed(self, checked: bool) -> None:
|
||||
"""Handle channel selection change."""
|
||||
|
||||
@@ -958,6 +958,10 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin, AnalysisMixin):
|
||||
|
||||
def check_for_updates(self) -> None:
|
||||
"""Starts the update check in a background thread."""
|
||||
if ConfigManager.get("check_app_updates") is False:
|
||||
logger.info("App version checker is disabled in settings.")
|
||||
return
|
||||
|
||||
self.update_thread = UpdateCheckThread(self.version)
|
||||
self.update_thread.update_available.connect(self.show_update_dialog)
|
||||
self.update_thread.start()
|
||||
|
||||
Reference in New Issue
Block a user