[PictureLoader] Add the localized picture URL explicitly, not implicitly

Address review: silently prepending the Scryfall named-picture URL to the
download list whenever a non-English card language was active was surprising,
consumed quota per card when it failed, and could grab the wrong (canon) art on
name collisions, with no way to turn it off.

The insert is now opt-in and user-controlled: changing the card language adds
the template to the top of the download URLs once (persisted, documented in the
re-import prompt, and editable/removable in the deck editor settings), while the
picture loader no longer injects it at request time.
This commit is contained in:
Lukas Brübach 2026-09-18 05:11:49 +02:00
parent 5c8535dae5
commit fa89662172
4 changed files with 38 additions and 23 deletions

View file

@ -9,6 +9,9 @@ const QStringList DownloadSettings::DEFAULT_DOWNLOAD_URLS = {
"https://gatherer.wizards.com/Handlers/Image.ashx?multiverseid=!set:muid!&type=card",
"https://gatherer.wizards.com/Handlers/Image.ashx?name=!name!&type=card"};
const QString DownloadSettings::SCRYFALL_NAMED_LOCALIZED_URL =
"https://api.scryfall.com/cards/named?fuzzy=!localizedName!&lang=!sflang!&format=image&face=!prop:side!";
DownloadSettings::DownloadSettings(const QString &settingPath, QObject *parent = nullptr)
: SettingsManager(settingPath + "downloads.ini", "downloads", QString(), parent)
{
@ -29,6 +32,18 @@ void DownloadSettings::resetToDefaultURLs()
setValue(QVariant::fromValue(DEFAULT_DOWNLOAD_URLS), "urls");
}
bool DownloadSettings::addLocalizedScryfallUrl()
{
const QStringList urls = getAllURLs();
if (urls.contains(SCRYFALL_NAMED_LOCALIZED_URL)) {
return false;
}
QStringList updated = urls;
updated.prepend(SCRYFALL_NAMED_LOCALIZED_URL);
setDownloadUrls(updated);
return true;
}
bool DownloadSettings::getPicDownload() const
{
return getValue("pictureDownload", QString(), QString(), true).toBool();