Don't save card pictures if we don't have a proper set name for it
This commit is contained in:
parent
3bce98e3a9
commit
88dfea8ece
1 changed files with 17 additions and 13 deletions
|
@ -248,21 +248,25 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
|
||||||
extension = ".jpg";
|
extension = ".jpg";
|
||||||
|
|
||||||
if (imgReader.read(&testImage)) {
|
if (imgReader.read(&testImage)) {
|
||||||
if (!QDir().mkpath(picsPath + "/downloadedPics/" + cardBeingDownloaded.getSetName())) {
|
QString setName = cardBeingDownloaded.getSetName();
|
||||||
qDebug() << picsPath + "/downloadedPics/" + cardBeingDownloaded.getSetName() + " could not be created.";
|
if(!setName.isEmpty())
|
||||||
return;
|
{
|
||||||
|
if (!QDir().mkpath(picsPath + "/downloadedPics/" + setName)) {
|
||||||
|
qDebug() << picsPath + "/downloadedPics/" + setName + " could not be created.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString suffix;
|
||||||
|
if (!cardBeingDownloaded.getStripped())
|
||||||
|
suffix = ".full";
|
||||||
|
|
||||||
|
QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + extension);
|
||||||
|
if (!newPic.open(QIODevice::WriteOnly))
|
||||||
|
return;
|
||||||
|
newPic.write(picData);
|
||||||
|
newPic.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString suffix;
|
|
||||||
if (!cardBeingDownloaded.getStripped())
|
|
||||||
suffix = ".full";
|
|
||||||
|
|
||||||
QFile newPic(picsPath + "/downloadedPics/" + cardBeingDownloaded.getSetName() + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + extension);
|
|
||||||
if (!newPic.open(QIODevice::WriteOnly))
|
|
||||||
return;
|
|
||||||
newPic.write(picData);
|
|
||||||
newPic.close();
|
|
||||||
|
|
||||||
emit imageLoaded(cardBeingDownloaded.getCard(), testImage);
|
emit imageLoaded(cardBeingDownloaded.getCard(), testImage);
|
||||||
} else if (cardBeingDownloaded.getHq()) {
|
} else if (cardBeingDownloaded.getHq()) {
|
||||||
qDebug() << "HQ: received invalid picture. URL:" << reply->request().url();
|
qDebug() << "HQ: received invalid picture. URL:" << reply->request().url();
|
||||||
|
|
Loading…
Reference in a new issue