mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
Show 100% for 500ms on complete.
This commit is contained in:
parent
ababf3d70b
commit
e3d6267647
2 changed files with 13 additions and 5 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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<qsizetype>(1, step / 16) : step;
|
||||
if (offset - lastReported < reportingStep && offset < size) {
|
||||
return;
|
||||
}
|
||||
lastReported = offset;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue