Support loading of files with wrong extension

Like M15’s .png that cockatrice wrongly saved as .jpg
Additionally, move the QImageReader declaration outside of the inner
loop
This commit is contained in:
Fabio Bas 2014-08-06 09:31:22 +02:00
parent 4bb1d28ae7
commit 6502a182e8

View file

@ -132,11 +132,12 @@ void PictureLoader::processLoadQueue()
<< _picsPath + "/downloadedPics/" + ptl.getSetName() + "/" + ptl.getCard()->getCorrectedName() + ".full";
QImage image;
QImageReader imgReader;
imgReader.setDecideFormatFromContent(true);
bool found = false;
//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 ++) {
QImageReader imgReader;
imgReader.setFileName(picsPaths.at(i));
if (imgReader.read(&image)) {
emit imageLoaded(ptl.getCard(), image);