Re: Porting Softimage PIC loader to KDE4 / gwenview

Ruben Lopez <r.lopez-u/[email protected]> Tue, 21 Jul 2009 14:04:30 +0200
Newsgroups gmane.comp.kde.gwenview
Message-ID <[email protected]>
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.

>> At this moment I can't remove the *.pic pattern from the x-hdr desktop
>> file, but I will be able in a couple of days, when the systems
>> administrator is back. This may be enough for us.
>>     
>
> In case you are still stuck with that problem, you can try to copy the
> x-hdr desktop file to the appropriate subdir of your .kde folder and
> remove the "*.pic" from it. This should overload the system one.
>   
I already did this, with no success. I have this directory structure:
/home/rlopez/.kde/share/mimelnk/image
   x-hdr.desktop
   x-pic.desktop

With .pic and .PIC removed from x-hdr.desktop
But it still recognizes the image as x-hdr :(

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 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?

Thanks

Rubén

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge