From 75122c3c9d7cf874ff94ce09ed5c1be6db6f177e Mon Sep 17 00:00:00 2001 From: Peng Liu Date: Mon, 4 Aug 2014 17:01:58 -0400 Subject: [PATCH] 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. --- cockatrice/src/carddatabase.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index f7296f7d..583f339f 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -233,8 +233,11 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply) if (picData.left(8) == QByteArray::fromHex("89504E470D0A1A0A")) extension = ".png"; - if (!testImage.save(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."; + 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); } else if (cardBeingDownloaded.getHq()) {