[Oracle/Client] Report card database download progress

Card database updates ran invisibly: MTGJSON parsing spun an indeterminate
bar on the UI thread and the set import blocked the window, while the
onboarding wizard spawned `oracle -b` with no progress to show at all.

- Add byte-level scan progress to `RawJson::scanSetRanges` via an optional
  callback, throttled to ~100 reports per scan.
- Emit `OracleImporter::dataReadProgress` during the scan and import sets on a
  worker thread, driving the wizard's progress bar per set.
- With `-b`, write machine-readable `PROGRESS <stage> <done> <total>` lines to
  stdout for the download/scan/import stages; stderr keeps the log output.
- Parse the oracle stdout in `MainWindow` and forward it to the onboarding
  wizard, giving the card database step a determinate bar with stage-specific
  status text.
- Guard the async workers against the wizard being closed mid-run.
- Add Google Test coverage for scan progress reporting.
This commit is contained in:
Lukas Brübach 2026-09-06 10:31:05 +02:00
parent ada774f5cc
commit c47dc578e0
15 changed files with 510 additions and 98 deletions

View file

@ -83,13 +83,14 @@ private:
QFutureWatcher<bool> watcher;
QFuture<bool> future;
QByteArray jsonData;
private slots:
void actLoadSetsFile();
void actRestoreDefaultUrl();
void actDownloadProgressSetsFile(qint64 received, qint64 total);
void actDownloadFinishedSetsFile();
void updateParsingProgress(int bytesRead, int totalBytes);
void scanProgressToStdout(int bytesRead, int totalBytes);
void importFinished();
void zipDownloadFailed(const QString &message);
};
@ -103,16 +104,21 @@ public:
private:
QTextEdit *messageLog;
QProgressBar *progressBar;
QCheckBox *defaultPathCheckBox;
QLabel *pathLabel;
QLabel *saveLabel;
QFutureWatcher<int> importWatcher;
QFuture<int> importFuture;
protected:
void initializePage() override;
void cleanupPage() override;
bool validatePage() override;
private slots:
void importFinished();
void updateTotalProgress(int cardsImported, int setIndex, const QString &setName);
};