From 781460d6ac0785688f9b3fcbe470a35da159399a Mon Sep 17 00:00:00 2001 From: Peng Liu Date: Mon, 11 Aug 2014 04:37:00 -0400 Subject: [PATCH] Cockatrice can now load images both with and without .full. Will need to clean-up bool stripped (used to determine .full suffix inclusion). --- cockatrice/src/carddatabase.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 79a225ec..b389e6ec 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -135,14 +135,14 @@ void PictureLoader::processLoadQueue() mutex.unlock(); //The list of paths to the folders in which to search for images - QList picsPaths = QList() << _picsPath + "/CUSTOM/" + ptl.getCard()->getCorrectedName() + ".full"; + QList picsPaths = QList() << _picsPath + "/CUSTOM/" + ptl.getCard()->getCorrectedName(); QString setName=ptl.getSetName(); if(!setName.isEmpty()) { - picsPaths << _picsPath + "/" + setName + "/" + ptl.getCard()->getCorrectedName() + ".full" - << _picsPath + "/downloadedPics/" + setName + "/" + ptl.getCard()->getCorrectedName() + ".full"; + picsPaths << _picsPath + "/" + setName + "/" + ptl.getCard()->getCorrectedName() + << _picsPath + "/downloadedPics/" + setName + "/" + ptl.getCard()->getCorrectedName(); } QImage image; @@ -153,6 +153,12 @@ void PictureLoader::processLoadQueue() //Iterates through the list of paths, searching for images with the desired name with any QImageReader-supported extension for (int i = 0; i < picsPaths.length() && !found; i ++) { imgReader.setFileName(picsPaths.at(i)); + if (imgReader.read(&image)) { + emit imageLoaded(ptl.getCard(), image); + found = true; + break; + } + imgReader.setFileName(picsPaths.at(i) + ".full"); if (imgReader.read(&image)) { emit imageLoaded(ptl.getCard(), image); found = true; @@ -274,11 +280,7 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply) return; } - QString suffix; - if (!cardBeingDownloaded.getStripped()) - suffix = ".full"; - - QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + extension); + QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + extension); if (!newPic.open(QIODevice::WriteOnly)) return; newPic.write(picData);