diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a874a313d..2aaa800f4 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -256,6 +256,7 @@ Eltaurus jariji Francisco Esteva SelfishPig +SecretX ******************** diff --git a/ftl/core/preferences.ftl b/ftl/core/preferences.ftl index 23b72f267..e7c237849 100644 --- a/ftl/core/preferences.ftl +++ b/ftl/core/preferences.ftl @@ -40,7 +40,9 @@ preferences-theme-follow-system = Follow System preferences-theme-light = Light preferences-theme-dark = Dark preferences-v3-scheduler = V3 scheduler +preferences-updates = Updates preferences-check-for-updates = Check for program updates +preferences-check-for-addon-updates = Check for add-on updates preferences-ignore-accents-in-search = Ignore accents in search (slower) preferences-backup-explanation = Anki periodically backs up your collection. After backups are more than 2 days old, diff --git a/qt/aqt/forms/preferences.ui b/qt/aqt/forms/preferences.ui index 0035e1f42..67cd67a5f 100644 --- a/qt/aqt/forms/preferences.ui +++ b/qt/aqt/forms/preferences.ui @@ -82,19 +82,29 @@ - + + + + + + + preferences_updates + + + - - - 0 - 0 - - preferences_check_for_updates + + + + preferences_check_for_addon_updates + + + @@ -1254,6 +1264,7 @@ lang video_driver check_for_updates + check_for_addon_updates theme styleComboBox uiScale diff --git a/qt/aqt/main.py b/qt/aqt/main.py index c707d1b2a..3a320d386 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1022,6 +1022,11 @@ title="{}" {}>{}""".format( def maybe_check_for_addon_updates( self, on_done: Callable[[list[DownloadLogEntry]], None] | None = None ) -> None: + if not self.pm.check_for_addon_updates(): + if on_done: + on_done([]) + return + last_check = self.pm.last_addon_update_check() elap = int_time() - last_check diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 939dd8c2c..17664586b 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -224,6 +224,12 @@ class Preferences(QDialog): self.form.check_for_updates.setChecked(self.mw.pm.check_for_updates()) qconnect(self.form.check_for_updates.stateChanged, self.mw.pm.set_update_check) + self.form.check_for_addon_updates.setChecked(self.mw.pm.check_for_addon_updates()) + qconnect( + self.form.check_for_addon_updates.stateChanged, + self.mw.pm.set_check_for_addon_updates, + ) + self.update_login_status() qconnect(self.form.syncLogout.clicked, self.sync_logout) qconnect(self.form.syncLogin.clicked, self.sync_login) diff --git a/qt/aqt/profiles.py b/qt/aqt/profiles.py index 919be170c..15587467d 100644 --- a/qt/aqt/profiles.py +++ b/qt/aqt/profiles.py @@ -596,6 +596,12 @@ create table if not exists profiles def set_last_addon_update_check(self, secs: int) -> None: self.meta["last_addon_update_check"] = secs + def check_for_addon_updates(self) -> bool: + return self.meta.get("check_for_addon_updates", True) + + def set_check_for_addon_updates(self, on: bool) -> None: + self.meta["check_for_addon_updates"] = on + @deprecated(info="use theme_manager.night_mode") def night_mode(self) -> bool: return theme_manager.night_mode