Add fallback urls for cards without a muId set

We only have a good HQ source for them; any idea on a low-quality
source?
This commit is contained in:
Fabio Bas 2014-11-10 00:23:41 +01:00
parent 6b1df247d1
commit fc1d06e13b
3 changed files with 30 additions and 6 deletions

View file

@ -224,16 +224,18 @@ QString PictureLoader::getPicUrl()
return picUrl;
}
// otherwise, fallback to the default url
picUrl = picDownloadHq ? settingsCache->getPicUrlHq() : settingsCache->getPicUrl();
picUrl.replace("!name!", QUrl::toPercentEncoding(card->getCorrectedName()));
// if a card has a muid, use the default url; if not, use the fallback
int muid = set ? muid = card->getMuId(set->getShortName()) : 0;
if(muid)
picUrl = picDownloadHq ? settingsCache->getPicUrlHq() : settingsCache->getPicUrl();
else
picUrl = picDownloadHq ? settingsCache->getPicUrlHqFallback() : settingsCache->getPicUrlFallback();
picUrl.replace("!name!", QUrl::toPercentEncoding(card->getCorrectedName()));
picUrl.replace("!cardid!", QUrl::toPercentEncoding(QString::number(muid)));
if (set) {
picUrl.replace("!setcode!", QUrl::toPercentEncoding(set->getShortName()));
picUrl.replace("!setname!", QUrl::toPercentEncoding(set->getLongName()));
int muid = card->getMuId(set->getShortName());
if (muid)
picUrl.replace("!cardid!", QUrl::toPercentEncoding(QString::number(muid)));
}
if (picUrl.contains("!name!") ||