From e3d6267647ae5948030dca24498969e213ac3ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Mon, 7 Sep 2026 03:15:07 +0200 Subject: [PATCH] Show 100% for 500ms on complete. --- oracle/src/pages.cpp | 11 ++++++++--- oracle/src/raw_json_scanner.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/oracle/src/pages.cpp b/oracle/src/pages.cpp index 002cf9993..aa2c35eff 100644 --- a/oracle/src/pages.cpp +++ b/oracle/src/pages.cpp @@ -648,12 +648,17 @@ void LoadSetsPage::importFinished() return; } - // Snap the bar to 100% so the tail never looks stuck at 99% while the next - // page's own import progress is being set up. + // Snap the bar to 100% and hold it there for a moment so the completed state + // is actually visible before the next page's own import progress takes over + // (a zero-length deferral can still fire before the repaint is delivered). progressBar->setMaximum(1); progressBar->setValue(1); progressLabel->setText(tr("Parsing file (100%)")); - wizard()->next(); + QTimer::singleShot(500, this, [this] { + if (wizard()->currentPage() == this) { + wizard()->next(); + } + }); } SaveSetsPage::SaveSetsPage(QWidget *parent) : OracleWizardPage(parent) diff --git a/oracle/src/raw_json_scanner.cpp b/oracle/src/raw_json_scanner.cpp index 747a34814..8c4633598 100644 --- a/oracle/src/raw_json_scanner.cpp +++ b/oracle/src/raw_json_scanner.cpp @@ -18,7 +18,9 @@ constexpr int kMaxNestingDepth = 1024; * Threaded through the skip walk so progress can be reported without materializing * the whole document. Reports are rate-limited so a GUI showing progress isn't * flooded with interrupts: a callback is invoked at most ~100 times per scan - * regardless of element count. + * regardless of element count. The closing stretch (the last ~1%) is reported + * more finely so a large document doesn't stall the progress bar on the final + * percent before the scan wraps up. */ struct ScanProgress { @@ -41,7 +43,8 @@ struct ScanProgress if (offset == lastReported) { return; // the final element often already sits exactly at the end } - if (offset - lastReported < step && offset < size) { + const qsizetype reportingStep = offset >= size - step ? std::max(1, step / 16) : step; + if (offset - lastReported < reportingStep && offset < size) { return; } lastReported = offset;