Cockatrice can now load images both with and without .full. Will need to clean-up bool stripped (used to determine .full suffix inclusion).
This commit is contained in:
parent
8b32a1010a
commit
781460d6ac
1 changed files with 10 additions and 8 deletions
|
@ -135,14 +135,14 @@ void PictureLoader::processLoadQueue()
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
|
||||||
//The list of paths to the folders in which to search for images
|
//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();
|
QString setName=ptl.getSetName();
|
||||||
if(!setName.isEmpty())
|
if(!setName.isEmpty())
|
||||||
{
|
{
|
||||||
picsPaths << _picsPath + "/" + setName + "/" + ptl.getCard()->getCorrectedName() + ".full"
|
picsPaths << _picsPath + "/" + setName + "/" + ptl.getCard()->getCorrectedName()
|
||||||
<< _picsPath + "/downloadedPics/" + setName + "/" + ptl.getCard()->getCorrectedName() + ".full";
|
<< _picsPath + "/downloadedPics/" + setName + "/" + ptl.getCard()->getCorrectedName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage image;
|
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
|
//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 ++) {
|
for (int i = 0; i < picsPaths.length() && !found; i ++) {
|
||||||
imgReader.setFileName(picsPaths.at(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)) {
|
if (imgReader.read(&image)) {
|
||||||
emit imageLoaded(ptl.getCard(), image);
|
emit imageLoaded(ptl.getCard(), image);
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -274,11 +280,7 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString suffix;
|
QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + extension);
|
||||||
if (!cardBeingDownloaded.getStripped())
|
|
||||||
suffix = ".full";
|
|
||||||
|
|
||||||
QFile newPic(picsPath + "/downloadedPics/" + setName + "/" + cardBeingDownloaded.getCard()->getCorrectedName() + suffix + extension);
|
|
||||||
if (!newPic.open(QIODevice::WriteOnly))
|
if (!newPic.open(QIODevice::WriteOnly))
|
||||||
return;
|
return;
|
||||||
newPic.write(picData);
|
newPic.write(picData);
|
||||||
|
|
Loading…
Reference in a new issue