[PATCH] Fix case sensitiveness in Image::outputFormat()

Sandor Bodo-Merle sbodomerle at gmail.com
Sun Feb 22 07:22:19 MST 2009


---
 src/image.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/image.cpp b/src/image.cpp
index eb1979e..beca90a 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -74,7 +74,8 @@ QPixmap Image::convertToPixmap(int w_, int h_) const {

 QByteArray Image::outputFormat(const QByteArray& inputFormat) {
   QList<QByteArray> list = QImageWriter::supportedImageFormats();
-  if(list.contains(inputFormat.toUpper())) {
+  if(list.contains(inputFormat.toUpper()) ||
list.contains(inputFormat.toLower())) {
+  // if(list.contains(inputFormat, Qt::CaseInsensitive)) - UNFORTUNATELY
THIS WONT WORK WITH QByteArray
     return inputFormat;
   }
   myDebug() << "writing" << inputFormat << "as PNG";
--
1.6.0.4


The problem is that QImageWriter::supportedImageFormats() returns a list
with both upper and lower case format names.
The inputFormat parameter seems to be in upper case all the time, so wont
match the lower case "jpeg" for example.
But inputFormat has to match both cased formats from the list. (I put a
comment in the patch what seemd to be the best solution, unfortunately it
wont work.)

But there is a bigger problem for me. The supported formats does not contain
"gif" and it seems that all my gif files ended up as PNGs in the tc file :(
Now ill try to write a script to fixup this issue .... hopefully convert
will help .....
Unfortunately i dont know when exactly this happened. Ill try to comprehend
a bit more the image handling of tellico eventualy to make a bit more robust

against silent data corruption.

PS - will tellico have a bugzilla entry on bugs.kde.org???


On Sun, Feb 22, 2009 at 7:04 AM, Robby Stephenson <robby at periapsis.org>wrote:

> On Saturday 21 February 2009, Sandor Bodo-Merle wrote:
> > So obviously all the jpeg images were put as PNGs in tmpDir, which were
> > not showed afterward. The below patch  fix this issue.
>
> Whoa, that's tricky. Thanks for catching it, patch applied.
>
> Robby
> _______________________________________________
> tellico-users mailing list
> tellico-users at forge.novell.com
> http://forge.novell.com/mailman/listinfo/tellico-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://forge.novell.com/pipermail/tellico-users/attachments/20090222/72b7e028/attachment.html


More information about the tellico-users mailing list