Re: Porting Softimage PIC loader to KDE4 / gwenview

Aurélien Gâteau <[email protected]> Tue, 21 Jul 2009 22:49:19 +0200
Newsgroups gmane.comp.kde.gwenview
Message-ID <[email protected]>
Ruben Lopez wrote:
> Aurélien Gâteau escribió:
>> Ruben Lopez wrote:
>>   
>>> Aurélien Gâteau escribió:
>>>     
>>>> What's interesting is this part:
>>>>
>>>> gwenview(5570) Gwenview::LoadingDocumentImplPrivate::startLoading:
>>>> mimeType: "image/x-hdr"
>>>> gwenview(5570) Gwenview::LoadingDocumentImplPrivate::startLoading:
>>>> kind: 4
>>>>
>>>> 4 means that the MimeTypeUtils::mimeTypeKind() method recognized the
>>>> image as an archive...  This happens when the .desktop file describing
>>>> the mimetype contains some special entries. Can you send this .destop
>>>> file?
>>>>   
>>>>       
>>> It seems that gwenview or KDE is using the wrong desktop file. The
>>> x-hdr.desktop file matches both .hdr and .pic extensions. I have
>>> installed an x-pic.desktop (attached) that matches *.pic, but the other
>>> one is being used instead. Can I write something in the .desktop file to
>>> help gwenview differentiate between HDR pic and Softimage pic?
>>>     
>> One thing you can try is to open lib/mimetypeutils.cpp, go to the
>> mimeTypeKind() function, and move the if which returns KIND_DIR and
>> KIND_ARCHIVE to the end of the function.
>>
>> But I do not understand why Gwenview would consider image/x-hdr to be an
>> archive. Even if it's the wrong mimetype, it's an image mimetype, so it
>> should return KIND_RASTER_IMAGE.
>>   
> I think that this is OK:
> enum Kind { KIND_UNKNOWN, KIND_DIR, KIND_ARCHIVE, KIND_FILE, 
> KIND_RASTER_IMAGE, KIND_SVG_IMAGE };
> 
> So 4 is actually KIND_RASTER_IMAGE. In fact, png files also return 4.

Oh... I must have reordered the enum between version... it makes sense now.
> I have modified the gwenview sources to force the x-pic mime type, but 
> then it doesn't recognize it as a raster image, but a generic file 
> instead. It seems that gwenview is still using the old KImageIO plugin 
> architecture instead of the strigi analyzers to find out which raster 
> image formats are supported. I am using the version from kdegraphics 
> 4.2.4. Is there a newer stable version with support for the strigi 
> analyzers? If not, I can rescue the old KImageIO plugin and port it.

I have never heard about using strigi analyzers to determine image
formats. Can you tell me more about this?
> 
> I imagine that gwenview is using KImageIO because most file formats 
> aren't still ported to strigi analyzers, as the cmake says when you run 
> it on kdegraphics sources. Would it make sense to use an hybrid 
> solution, asking to KImageIO and the strigi analyzers and joining both 
> lists?

As I said, I don't know much about using strigi analyzers this way, but
I am interested in what you can suggest here, so patches are welcomed!

Aurélien

------------------------------------------------------------------------------