From 39fc2a471e7cbbe4337ad095add6418b6bda256b Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 5 Aug 2011 09:47:23 +0200 Subject: [PATCH] Properly check if a file is a readable image by asking QImageReader. Reviewed by Albert Astals. --- generators/comicbook/document.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/generators/comicbook/document.cpp b/generators/comicbook/document.cpp index 72135da87..75c4334a3 100644 --- a/generators/comicbook/document.cpp +++ b/generators/comicbook/document.cpp @@ -162,16 +162,11 @@ void Document::extractImageFiles( const QStringList &list ) qSort( files.begin(), files.end(), caseSensitiveNaturalOrderLessThen ); - for ( int i = 0; i < files.count(); ++i ) { - const QString lowerFile = files[ i ].toLower(); - - if ( lowerFile.endsWith( ".gif" ) || - lowerFile.endsWith( ".jpg" ) || - lowerFile.endsWith( ".jpeg" ) || - lowerFile.endsWith( ".png" ) || - lowerFile.endsWith( ".tif" ) || - lowerFile.endsWith( ".tiff" ) ) - mPageMap.append( files[ i ] ); + foreach(const QString &f, files) { + const QImageReader r(f); + + if ( r.canRead() ) + mPageMap.append(f); } }