Re: Creating a new image loader
Ruben Lopez <r.lopez-u/[email protected]>
| Newsgroups | gmane.comp.kde.gwenview |
|---|---|
| Message-ID | <[email protected]> |
Hello Aurélien,
Thanks for your response, it was very revealing.
I have already found #1. It is not a big problem for us, because we
don't use the .pic hdr format. We simply removed .pic from the hdr
format. But I may ask KDE team to be able to release this plugin to the
community.
I will be fixing #3 and tell you when it is done.
Thanks again for your help.
Rubén
Aurélien Gâteau wrote:
> On Friday 22 June 2007 18:13:42 Ruben Lopez wrote:
>
>> Aurélien Gâteau wrote:
>>
>>> On Friday 15 June 2007 15:27:38 Ruben Lopez wrote:
>>>
>>>> Sure,
>>>>
>>>> They are small enough to post it here in the list.
>>>>
>>>> test.pic is B&W, test2.pic is RGB
>>>>
>>> I am going to have a look at it, stay tuned.
>>>
>> Thanks!
>>
>
> I found three problems as to why it doesn't work.
>
> 1. There seems to be some conflict between your x-pic.desktop and the
> x-hdr.desktop file installed on my machine (both claim they can represent
> *.pic files). To work around this one, I renamed the images to "*.ppic"
>
> 2. For some unknown reason, KMimeType::findByContent()
> returns "application/octet-stream" for your images :-/, which Gwenview does
> not recognize as a raster image format. In this case it switches to trying to
> display it with a KPart, but it can't find one, as can be seen in the console
> output:
>
> gwenview: WARNING: Couldn't find a KPart for image/x-pic
>
> To work around this one, I applied the ugly attached patch.
>
> 3. Now Gwenview tries to use your decoder, but it fails because your decoder
> needs the IODevice of QImageIO to be a QFile, but Gwenview uses a QBuffer, so
> the dynamic cast in picloader.cpp, kimgio_pic_read() fails.
>
> I believe #3 can be fixed by modifying the decoder to not use QIODevice API
> instead of C file descriptors. Once it's done, we can try to fix #2. I don't
> know the correct way to fix #1, but you might be able to get some answer from
> other KDE devs.
>
> Hope this helps
>
> Aurélien
>
> ------------------------------------------------------------------------
>
> Index: imageloader.cpp
> ===================================================================
> --- imageloader.cpp (révision 671034)
> +++ imageloader.cpp (copie de travail)
> @@ -447,6 +447,7 @@
> memcpy(d->mRawData.data()+oldSize, chunk.data(), chunk.size() );
>
> if (oldSize==0) {
> + #if 0
> // Try to determine the data type
> KMimeType::Ptr ptr = KMimeType::findByContent(d->mRawData);
> d->mMimeType = ptr->name();
> @@ -458,6 +459,9 @@
> emit urlKindDetermined();
> return;
> }
> + #endif
> + d->mMimeType = "image/x-pic";
> + d->mURLKind = MimeTypeUtils::KIND_RASTER_IMAGE;
> LOG("emit urlKindDetermined(raster)");
> emit urlKindDetermined();
> }
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Gwenview-general mailing list
> Gwenview-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/gwenview-general
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/