Switched back to using QFile instead of QImage for saving as QImage's save function adds overhead to the file size, leaving me unsure whether the original image is affected.

This commit is contained in:
Peng Liu 2014-08-04 17:01:58 -04:00
parent 387086cb4c
commit 75122c3c9d

View file

@ -233,8 +233,11 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
if (picData.left(8) == QByteArray::fromHex("89504E470D0A1A0A")) if (picData.left(8) == QByteArray::fromHex("89504E470D0A1A0A"))
extension = ".png"; extension = ".png";
if (!testImage.save(picsPath + "/downloadedPics/" + cardBeingDownloaded.getSetName() + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + extension)) QFile newPic(picsPath + "/downloadedPics/" + cardBeingDownloaded.getSetName() + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + extension);
qDebug() << picsPath.toUtf8() + "/downloadedPics/" + cardBeingDownloaded.getSetName().toUtf8() + "/" + cardBeingDownloaded.getCard()->getCorrectedName().toUtf8() + suffix.toUtf8() + extension.toUtf8() + "was not successfully saved."; 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()) {