Address review feedback on spoiler update lifecycle

Only remove the spoiler file when the user unchecks the setting; opening
Settings no longer queues an unrequested reload for a leftover file.
Remove the spoilersUpdatedSuccessfully signal, which had no receiver.
This commit is contained in:
Lukas Brübach 2026-11-04 17:39:39 +01:00
parent 7f66cab73a
commit 0c59e5d6c6
3 changed files with 4 additions and 7 deletions

View file

@ -280,10 +280,6 @@ void SpoilerBackgroundUpdater::finish(const QString &error, bool updated)
notificationIcon->showMessage(tr("Spoilers have been updated!"), notificationIcon->showMessage(tr("Spoilers have been updated!"),
tr("The card database now includes the downloaded spoilers.")); tr("The card database now includes the downloaded spoilers."));
} }
if (!guard) {
return;
}
emit spoilersUpdatedSuccessfully();
} else if (seasonEnded && !cancelled && notificationIcon) { } else if (seasonEnded && !cancelled && notificationIcon) {
notificationIcon->showMessage(tr("Spoiler season has ended"), notificationIcon->showMessage(tr("Spoiler season has ended"),
tr("The spoiler database was removed. Please run Oracle to get released cards.")); tr("The spoiler database was removed. Please run Oracle to get released cards."));

View file

@ -61,7 +61,6 @@ private:
void reloadDatabase(bool updated); void reloadDatabase(bool updated);
signals: signals:
void spoilersUpdatedSuccessfully();
void spoilerCheckerDone(); void spoilerCheckerDone();
void spoilerUpdateFailed(const QString &message); void spoilerUpdateFailed(const QString &message);
}; };

View file

@ -409,8 +409,10 @@ void DeckEditorSettingsPage::setSpoilersEnabled(bool anInput)
lastUpdatedLabel.setEnabled(anInput); lastUpdatedLabel.setEnabled(anInput);
infoOnSpoilersLabel.setEnabled(anInput); infoOnSpoilersLabel.setEnabled(anInput);
if (!anInput && (sender() == &mcDownloadSpoilersCheckBox || // Only react to the user disabling the setting. The constructor calls this to
QFileInfo::exists(SettingsCache::instance().paths().getSpoilerCardDatabasePath()))) { // initialize the controls, and a leftover spoiler file is recovered through the
// Reload Card Database button rather than an unrequested reload on page open.
if (!anInput && sender() == &mcDownloadSpoilersCheckBox) {
observeSpoilerUpdater(SpoilerBackgroundUpdater::deleteSpoilerFile()); observeSpoilerUpdater(SpoilerBackgroundUpdater::deleteSpoilerFile());
} }
unlockSettings(); unlockSettings();