[PATCH] Fix case sensitiveness in Image::outputFormat()
Sandor Bodo-Merle
sbodomerle at gmail.com
Sat Feb 21 08:49:41 MST 2009
With latest Tellico i encountered a behaviour that after unpacking all the
cover images from the zip file into TempDir,
the cover images suddenly were not showed.
The log contained lines like:
tellico(5636) Tellico::ImageFactory::addCachedImageImpl:
ImageFactory::addCachedImageImpl() - null image loaded
tellico(5636) Tellico::ImageFactory::imageById: img in tmpDir list but not
actually there: "fa80e38caef0f9480d9315c52bdda523.jpeg"
After a bit of debug the culprit seems to be in Image::outputFormat(). With
more extra logging i get output like:
tellico(5636) Tellico::Data::Image::outputFormat: ("BW", "EPS", "EPSF",
"EPSI", "PCX", "RGB", "RGBA", "SGI", "TGA", "bmp", "bw", "eps", "epsf",
"epsi", "ico", "jp2", "jpeg", "jpg", "pcx", "png", "ppm", "rgb", "rgba",
"sgi", "tga", "tif", "tiff", "xbm", "xpm", "xv")
tellico(5636) Tellico::Data::Image::outputFormat: "JPEG"
tellico(5636) Tellico::Data::Image::outputFormat: Image::outputFormat() -
writing "JPEG" as PNG
So obviously all the jpeg images were put as PNGs in tmpDir, which were not
showed afterward. The below patch fix this issue.
(Maybe there is a way to do case insensitive contains() on the QByteArray
list but i did not find in the docs....)
---
src/image.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/image.cpp b/src/image.cpp
index 1253431..3a1de50 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -74,7 +74,7 @@ QPixmap Image::convertToPixmap(int w_, int h_) const {
QByteArray Image::outputFormat(const QByteArray& inputFormat) {
QList<QByteArray> list = QImageWriter::supportedImageFormats();
- if(list.contains(inputFormat)) {
+ if(list.contains(inputFormat.toUpper()) ||
list.contains(inputFormat.toLower())) {
return inputFormat;
}
// myDebug() << "Image::outputFormat() - writing " << inputFormat << " as
PNG" << endl;
--
1.6.0.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://forge.novell.com/pipermail/tellico-users/attachments/20090221/5af672e3/attachment.html
More information about the tellico-users
mailing list