Commit 781460d6 authored by Peng Liu's avatar Peng Liu
Browse files

Cockatrice can now load images both with and without .full. Will need to...

Cockatrice can now load images both with and without .full. Will need to clean-up bool stripped (used to determine .full suffix inclusion).
parent 8b32a101
......@@ -135,14 +135,14 @@ void PictureLoader::processLoadQueue()
mutex.unlock();
//The list of paths to the folders in which to search for images
QList<QString> picsPaths = QList<QString>() << _picsPath + "/CUSTOM/" + ptl.getCard()->getCorrectedName() + ".full";
QList<QString> picsPaths = QList<QString>() << _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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment