From 6502a182e825745edb1db2a32fad45b9660473c0 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 6 Aug 2014 09:31:22 +0200 Subject: [PATCH] Support loading of files with wrong extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Like M15’s .png that cockatrice wrongly saved as .jpg Additionally, move the QImageReader declaration outside of the inner loop --- cockatrice/src/carddatabase.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/carddatabase.cpp b/cockatrice/src/carddatabase.cpp index 8bedf71e..b3d4bca9 100644 --- a/cockatrice/src/carddatabase.cpp +++ b/cockatrice/src/carddatabase.cpp @@ -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);