Avoid QProgressBar overflow by normalizing to kilobytes (fixes #4341) (#4354)

* qt: normalize large progress totals to kilobytes to avoid QProgressBar overflow (#4341); docs: update CONTRIBUTORS

* update

* revert: keep ProgressManager generic; no autoscaling in progress.py

* revert: keep ProgressManager generic; do scaling only in full sync

* Simplify sync progress update by scaling to KB, fix CONTRIBUTORS
This commit is contained in:
matbe766 2025-10-02 11:59:09 +02:00 committed by GitHub
parent 0986af4f81
commit b2bb85b1a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View file

@ -247,6 +247,8 @@ Hanna Nilsén <hanni614@student.liu.se>
Elias Johansson Lara <elias.johanssonlara@gmail.com>
Toby Penner <tobypenner01@gmail.com>
Danilo Spillebeen <spillebeendanilo@gmail.com>
Matbe766 <matildabergstrom01@gmail.com>
********************

View file

@ -209,11 +209,20 @@ def on_full_sync_timer(mw: aqt.main.AnkiQt, label: str) -> None:
return
sync_progress = progress.full_sync
# If we've reached total, show the "checking" label
if sync_progress.transferred == sync_progress.total:
label = tr.sync_checking()
total = sync_progress.total
transferred = sync_progress.transferred
# Scale both to kilobytes with floor division
max_for_bar = total // 1024
value_for_bar = transferred // 1024
mw.progress.update(
value=sync_progress.transferred,
max=sync_progress.total,
value=value_for_bar,
max=max_for_bar,
process=False,
label=label,
)