[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Kimageio removal
From:       Szombathelyi "György" <gyurco () freemail ! hu>
Date:       2006-01-14 21:43:38
Message-ID: 200601142243.38953.gyurco () freemail ! hu
[Download RAW message or body]

I think only If you give him a QIODevice which read from an URI.

------------------------------------
QImageReader r;
r.setFileName("http://www.index.hu/alma.jpg");
qDebug() << r.canRead();

false

r.setFileName("file:///home/gyuri/kepek/becs/dsc03906.jpg");
qDebug() << r.canRead();

false

r.setFileName("/home/gyuri/kepek/becs/dsc03906.jpg");
qDebug() << r.canRead();

true
------------------------------------------------------------------------------------

I invented the following solution:
Add a new service type, called QImageIOPlugins
Create a .desktop file for each image format, with two custom parameters:
X-KDE-ImageFormat
X-KDE-MimeType

These .desktop files contains the mapping between mime-types and image format names. \
Everything else is in the mime-database already.

Resurrected a very small KImageIO class, which contains only the essential functions \
for the Imageformat-mimetype conversion:

  static QString pattern(Mode mode = Reading);
  static QStringList typeForMime(const QString& mimeType);
  static QStringList mimeTypes( Mode mode = Writing );
  static bool isSupported( const QString& _mimeType, Mode _mode = Writing );
  ( and maybe QString KImageIO::suffix(const QString& type) )

It's more lightweight than .kimgio files and the old KImageIO class.

P.S: as I see, there are commits which uses only the image format list from \
QImageReader|Writer, is it enough? Then I dump out my mini-KImageIO.

e.g:
http://websvn.kde.org/trunk/KDE/kdelibs/kio/kfile/kfiledialog.cpp?rev=497896&r1=497724&r2=497896



2006. január 14. 19.43 dátummal Gregory Hayes ezt írta:
> I vote for option 2. I think QImageReader and friends provide us with most
> of what we need. Do you know if the QimageReader::canRead can handle URIs?
> 
> Greg
> -
> 
> On 1/14/06, Szombathelyi György <gyurco@freemail.hu> wrote:
> > Hi!
> > 
> > I removed kimageio from kdelibs trunk yesterday, now I've got a problem
> > of converting some uses in kdebase.
> > Especially KImageIO::pattern() and KImageIO::mimeTypes() are problematic,
> > since there's no such concept in QImageReader and QImageWriter. Qt only
> > knows
> > the "format", which can be e.g "jpg", "png", etc...
> > Now I see 2 options:
> > 1. Restore KImageIO and the .kimgio files, which has the neccessary
> > information, and clean up KImageIO
> > 2. Add the Qt image format name to the mime database, e.g. with
> > X-KDE-imageformat=jpg. Then new convenience function(s) can be added to
> > kmimetype.h, e.g allImageFormats() or sth. else.
> > 
> > Option 1 is simplest, but .kimgio files store nearly the same data as the
> > mime
> > files, except the image format name.
> > 
> > Any opinions? (or other ideas?)
> > 
> > Bye,
> > György
> > 
> > ____________________________________________________________________
> > Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a
> > FreeStarttol
> > Probald ki most! http://www.freestart.hu

____________________________________________________________________
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol
Probald ki most! http://www.freestart.hu


[Attachment #3 (text/html)]

<html><head><meta name="qrichtext" content="1" /></head><body \
style="font-size:12pt;font-family:Arial"> <p>I think only If you give him a QIODevice \
which read from an URI.</p> <p></p>
<p>------------------------------------</p>
<p>QImageReader r;</p>
<p>r.setFileName(&quot;http://www.index.hu/alma.jpg&quot;);</p>
<p>qDebug() &lt;&lt; r.canRead();</p>
<p></p>
<p>false</p>
<p></p>
<p>r.setFileName(&quot;file:///home/gyuri/kepek/becs/dsc03906.jpg&quot;);</p>
<p>qDebug() &lt;&lt; r.canRead();</p>
<p></p>
<p>false</p>
<p></p>
<p>r.setFileName(&quot;/home/gyuri/kepek/becs/dsc03906.jpg&quot;);</p>
<p>qDebug() &lt;&lt; r.canRead();</p>
<p></p>
<p>true</p>
<p>------------------------------------------------------------------------------------</p>
 <p></p>
<p>I invented the following solution:</p>
<p>Add a new service type, called QImageIOPlugins</p>
<p>Create a .desktop file for each image format, with two custom parameters:</p>
<p>X-KDE-ImageFormat</p>
<p>X-KDE-MimeType</p>
<p></p>
<p>These .desktop files contains the mapping between mime-types and image format \
names. Everything else is in the mime-database already.</p> <p></p>
<p>Resurrected a very small KImageIO class, which contains only the essential \
functions for the Imageformat-mimetype conversion:</p> <p></p>
<p>  static QString pattern(Mode mode = Reading);</p>
<p>  static QStringList typeForMime(const QString&amp; mimeType);</p>
<p>  static QStringList mimeTypes( Mode mode = Writing );</p>
<p>  static bool isSupported( const QString&amp; _mimeType, Mode _mode = Writing \
);</p> <p>  ( and maybe QString KImageIO::suffix(const QString&amp; type) )</p>
<p></p>
<p>It's more lightweight than .kimgio files and the old KImageIO class.</p>
<p></p>
<p>P.S: as I see, there are commits which uses only the image format list from \
QImageReader|Writer, is it enough? Then I dump out my mini-KImageIO.</p> <p></p>
<p>e.g:</p>
<p>http://websvn.kde.org/trunk/KDE/kdelibs/kio/kfile/kfiledialog.cpp?rev=497896&amp;r1=497724&amp;r2=497896</p>
 <p></p>
<p></p>
<p>2006. január 14. 19.43 dátummal Gregory Hayes ezt írta:</p>
<p><span style="color:#008000">&gt; I vote for option 2. I think QImageReader and \
friends provide us with most</span></p> <p><span style="color:#008000">&gt; of what \
we need. Do you know if the QimageReader::canRead can handle URIs?</span></p> \
<p><span style="color:#008000">&gt;</span></p> <p><span style="color:#008000">&gt; \
Greg</span></p> <p><span style="color:#008000">&gt; -</span></p>
<p><span style="color:#008000">&gt;</span></p>
<p><span style="color:#008000">&gt; On 1/14/06, Szombathelyi György \
&lt;gyurco@freemail.hu&gt; wrote:</span></p> <p><span style="color:#007000">&gt; &gt; \
Hi!</span></p> <p><span style="color:#007000">&gt; &gt;</span></p>
<p><span style="color:#007000">&gt; &gt; I removed kimageio from kdelibs trunk \
yesterday, now I've got a problem</span></p> <p><span style="color:#007000">&gt; &gt; \
of converting some uses in kdebase.</span></p> <p><span style="color:#007000">&gt; \
&gt; Especially KImageIO::pattern() and KImageIO::mimeTypes() are \
problematic,</span></p> <p><span style="color:#007000">&gt; &gt; since there's no \
such concept in QImageReader and QImageWriter. Qt only</span></p> <p><span \
style="color:#007000">&gt; &gt; knows</span></p> <p><span style="color:#007000">&gt; \
&gt; the &quot;format&quot;, which can be e.g &quot;jpg&quot;, &quot;png&quot;, \
etc...</span></p> <p><span style="color:#007000">&gt; &gt; Now I see 2 \
options:</span></p> <p><span style="color:#007000">&gt; &gt; 1. Restore KImageIO and \
the .kimgio files, which has the neccessary</span></p> <p><span \
style="color:#007000">&gt; &gt; information, and clean up KImageIO</span></p> \
<p><span style="color:#007000">&gt; &gt; 2. Add the Qt image format name to the mime \
database, e.g. with</span></p> <p><span style="color:#007000">&gt; &gt; \
X-KDE-imageformat=jpg. Then new convenience function(s) can be added to</span></p> \
<p><span style="color:#007000">&gt; &gt; kmimetype.h, e.g allImageFormats() or sth. \
else.</span></p> <p><span style="color:#007000">&gt; &gt;</span></p>
<p><span style="color:#007000">&gt; &gt; Option 1 is simplest, but .kimgio files \
store nearly the same data as the</span></p> <p><span style="color:#007000">&gt; &gt; \
mime</span></p> <p><span style="color:#007000">&gt; &gt; files, except the image \
format name.</span></p> <p><span style="color:#007000">&gt; &gt;</span></p>
<p><span style="color:#007000">&gt; &gt; Any opinions? (or other ideas?)</span></p>
<p><span style="color:#007000">&gt; &gt;</span></p>
<p><span style="color:#007000">&gt; &gt; Bye,</span></p>
<p><span style="color:#007000">&gt; &gt; György</span></p>
<p><span style="color:#007000">&gt; &gt;</span></p>
<p><span style="color:#007000">&gt; &gt; \
____________________________________________________________________</span></p> \
<p><span style="color:#007000">&gt; &gt; Miert fizetsz az internetert? Korlatlan, \
ingyenes internet hozzaferes a</span></p> <p><span style="color:#007000">&gt; &gt; \
FreeStarttol</span></p> <p><span style="color:#007000">&gt; &gt; Probald ki most! \
http://www.freestart.hu</span></p> <p></p>
<BR>
____________________________________________________________________<br>
Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a \
FreeStarttol<br> Probald ki most! <a \
href="http://www.freestart.hu">http://www.freestart.hu</a><br> <BR></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic