[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:55:21
Message-ID: 200601142255.22050.gyurco () freemail ! hu
[Download RAW message or body]
And the mini-KImageIO, with one samble .desktop file.
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
["kimageio-mini.diff" (text/x-diff)]
Index: kimgio/Makefile.am
===================================================================
--- kimgio/Makefile.am (revision 498012)
+++ kimgio/Makefile.am (working copy)
@@ -1,14 +1,17 @@
if include_TIFF_MODULES
KIMGIO_TIFF_MODULES=kimg_tiff.la # kimg_g3.la
+KIMGIO_TIFF_SERVICEFILES=tiff.desktop
endif
if include_JP2_MODULES
KIMGIO_JP2_MODULES=kimg_jp2.la
+KIMGIO_JP2_SERVICEFILES=jp2.desktop
endif
if include_EXR_MODULES
KIMGIO_EXR_MODULES=kimg_exr.la
+KIMGIO_EXR_SERVICEFILES=exr.desktop
endif
KDE_CXXFLAGS = $(USE_EXCEPTIONS)
@@ -83,5 +86,15 @@
INCLUDES = -I$(top_srcdir)/kio -I$(top_srcdir)/dcop -I$(top_srcdir)/libltdl \
$(all_includes) -Drestrict= $(EXR_FLAGS)
+servicetypedir = $(kde_servicetypesdir)
+servicetype_DATA = qimageio_plugin.desktop
+
+servicedir = $(kde_servicesdir)/qimageioplugins
+service_DATA = png.desktop xpm.desktop bmp.desktop pbm.desktop pgm.desktop \
+ ppm.desktop xbm.desktop jpeg.desktop xv.desktop eps.desktop \
+ $(KIMGIO_TIFF_SERVICEFILES) ico.desktop $(KIMGIO_JP2_SERVICEFILES) \
+ gif.desktop pcx.desktop tga.desktop rgb.desktop xcf.desktop dds.desktop \
+ $(KIMGIO_EXR_SERVICEFILES) mng.desktop psd.desktop hdr.desktop
+
include $(top_srcdir)/admin/Doxyfile.am
Index: kio/kio/Makefile.am
===================================================================
--- kio/kio/Makefile.am (revision 498012)
+++ kio/kio/Makefile.am (working copy)
@@ -28,7 +28,7 @@
kdirwatch.cpp \
kfileshare.cpp ksambashare.cpp knfsshare.cpp \
ktrader.cpp ktraderparse.cpp ktraderparsetree.cpp \
- kservicetypefactory.cpp kservicetype.cpp \
+ kservicetypefactory.cpp kservicetype.cpp kimageio.cpp \
kmimetype.cpp kservicegroup.cpp \
kservice.cpp kservicefactory.cpp \
kuserprofile.cpp kservicegroupfactory.cpp \
@@ -62,7 +62,7 @@
kmimetypechooser.cpp
include_HEADERS = \
- kservicetype.h kmimetype.h kmimemagic.h kservice.h \
+ kservicetype.h kmimetype.h kmimemagic.h kservice.h kimageio.h \
krun.h kdirwatch.h kautomount.h kuserprofile.h \
kar.h ktar.h kzip.h ktrader.h kurifilter.h kurlcompletion.h \
kshellcompletion.h kfileitem.h kfileshare.h ksambashare.h knfsshare.h \
["qimageio_plugin.desktop" (application/x-desktop)]
["jpeg.desktop" (application/x-desktop)]
["kimageio.h" (text/x-c++hdr)]
/*
* kimageio.h -- Declaration of interface to the KDE Image IO library.
* Sirtaj Singh Kang <taj@kde.org>, 23 Sep 1998.
*
* This library is distributed under the conditions of the GNU LGPL.
*/
#ifndef SSK_KIMGIO_H
#define SSK_KIMGIO_H
#include <QStringList>
#include <QString>
#include <kdelibs_export.h>
/**
* A small convenience class to get information about image format names and
* the corresponding mime type.
*
* The image processing backends are written as image handlers compatible
* with the QImageIOHandler format. The backends are Qt imageformat plugins.
* Each format can be identified by a unique type id string.
*
* \b Formats:
*
* Currently supported formats include:
* @li BMP \<read\> \<write\>
* @li EPS \<read\> \<write\>
* @li EXR \<read\>
* @li G3 \<read\>
* @li GIF \<read\>
* @li ICO \<read\>
* @li JP2 \<read\> \<write\>
* @li JPEG \<read\> \<write\>
* @li NETPBM \<read\> \<write\>
* @li PCX \<read\> \<write\>
* @li PNG \<read\> \<write, only with newer libraries\>
* @li TGA \<read\> \<write\>
* @li TIFF \<read\>
* @li XBM \<read\> \<write\>
* @li XPM \<read\> \<write\>
* @li XV \<read\> \<write\>
*
*/
class KIO_EXPORT KImageIO
{
public:
/**
* Possible image file access modes.
*
* Used in various KImageIO static function.
**/
enum Mode { Reading, Writing };
/**
* Returns a list of patterns of all KImageIO supported formats.
*
* These patterns can be passed to KFileDialog::getOpenFileName()
* or KFileDialog::getSaveFileName(), for example.
*
* @param mode Tells whether to retrieve modes that can be read or written.
* @return a space-separated list of file globs that describe the
* supported formats
*/
static QString pattern(Mode mode = Reading);
/**
* Returns the type of a MIME type.
* @param mimeType the MIME type to search
* @return type id of the MIME type or QString() if the MIME type
* is not supported
* @since 3.1
*/
static QStringList typeForMime(const QString& mimeType);
/**
* Returns a list of MIME types for all KImageIO supported formats.
*
* @param mode Tells whether to retrieve modes that can be read or written.
* @return a list if MIME types of the supported formats
*/
static QStringList mimeTypes( Mode mode = Writing );
/**
* Test to see whether a MIME type is supported to reading/writing.
* @param _mimeType the MIME type to check
* @param _mode Tells whether to check for reading or writing capabilities
* @return true if the type is supported
**/
static bool isSupported( const QString& _mimeType, Mode _mode = Writing );
};
#endif
["kimageio.cpp" (text/x-c++src)]
// -*- c-basic-offset: 3 -*-
/**
* kimgio.h -- Implementation of interface to the KDE Image IO library.
* Sirtaj Singh Kang <taj@kde.org>, 23 Sep 1998.
*
* This library is distributed under the conditions of the GNU LGPL.
*/
#include <QImageReader>
#include <QImageWriter>
#include <kmimetype.h>
#include <klocale.h>
#include <kdebug.h>
#include "kimageio.h"
QString
KImageIO::pattern(Mode _mode)
{
QStringList patterns;
QString allPatterns;
QString separator("|");
QList<QByteArray> formats = ( _mode == KImageIO::Reading ) ?
QImageReader::supportedImageFormats() :
QImageWriter::supportedImageFormats();
KService::List services = KServiceType::offers("QImageIOPlugins");
KService::Ptr service;
foreach(service, services)
{
QString format = service->property("X-KDE-ImageFormat").toStringList()[0];
if ( formats.contains( format.toLatin1() ) ) {
QString mimeType = service->property("X-KDE-MimeType").toString();
KMimeType::Ptr mime = KMimeType::mimeType( mimeType );
QString pattern = mime->patterns().join(" ");
patterns.append( pattern + separator + mime->comment() );
if (!allPatterns.isEmpty() )
allPatterns += " ";
allPatterns += pattern;
}
}
allPatterns = allPatterns + separator + i18n("All Pictures");
patterns.sort();
patterns.prepend(allPatterns);
QString pattern = patterns.join(QLatin1String("\n"));
return pattern;
}
QStringList KImageIO::typeForMime(const QString& mimeType)
{
KService::List services = KServiceType::offers("QImageIOPlugins");
KService::Ptr service;
foreach(service, services) {
if ( mimeType == service->property("X-KDE-MimeType").toString() )
return ( service->property("X-KDE-ImageFormat").toStringList() );
}
return QStringList();
}
QStringList KImageIO::mimeTypes( Mode _mode )
{
QStringList mimeList;
QList<QByteArray> formats = ( _mode == KImageIO::Reading ) ?
QImageReader::supportedImageFormats() :
QImageWriter::supportedImageFormats();
KService::List services = KServiceType::offers("QImageIOPlugins");
KService::Ptr service;
foreach(service, services) {
if ( formats.contains( service->property("X-KDE-ImageFormat").toStringList()[0].toLatin1() ) )
mimeList.append( service->property("X-KDE-MimeType").toString() );
}
return mimeList;
}
bool KImageIO::isSupported( const QString& _mimeType, Mode _mode )
{
QString type = typeForMime( _mimeType )[0];
QList<QByteArray> formats = ( _mode == KImageIO::Reading ) ?
QImageReader::supportedImageFormats() :
QImageWriter::supportedImageFormats();
QByteArray format;
return formats.contains( type.toLatin1() );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic