mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kimgio: rename jpeg plugin to jpg to match the more common extension
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
cd7d01a484
commit
aadf9d5164
3 changed files with 32 additions and 32 deletions
|
@ -63,18 +63,18 @@ endif(LIBRAW_FOUND)
|
|||
|
||||
if(LIBJPEG_FOUND)
|
||||
include_directories(${LIBJPEG_INCLUDE_DIR})
|
||||
kde4_add_plugin(kimg_jpeg jpeg.cpp)
|
||||
target_link_libraries(kimg_jpeg
|
||||
kde4_add_plugin(kimg_jpg jpg.cpp)
|
||||
target_link_libraries(kimg_jpg
|
||||
${KDE4_KDECORE_LIBS}
|
||||
${QT_QTGUI_LIBRARY}
|
||||
${LIBJPEG_LIBRARIES}
|
||||
)
|
||||
set_target_properties(kimg_jpeg PROPERTIES
|
||||
OUTPUT_NAME jpeg
|
||||
set_target_properties(kimg_jpg PROPERTIES
|
||||
OUTPUT_NAME jpg
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS kimg_jpeg
|
||||
TARGETS kimg_jpg
|
||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}/plugins/imageformats
|
||||
)
|
||||
endif(LIBJPEG_FOUND)
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "jpeg.h"
|
||||
#include "jpg.h"
|
||||
|
||||
#include <QImage>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include <turbojpeg.h>
|
||||
|
||||
static const char* const s_jpegpluginformat = "jpg";
|
||||
static const char* const s_jpgpluginformat = "jpg";
|
||||
|
||||
static const ushort s_peekbuffsize = 32;
|
||||
static const TJPF s_jpegpixelformat = TJPF_ARGB;
|
||||
|
@ -45,24 +45,24 @@ static const struct HeadersTblData {
|
|||
};
|
||||
static const qint16 HeadersTblSize = sizeof(HeadersTbl) / sizeof(HeadersTblData);
|
||||
|
||||
JPEGHandler::JPEGHandler()
|
||||
JPGHandler::JPGHandler()
|
||||
{
|
||||
}
|
||||
|
||||
JPEGHandler::~JPEGHandler()
|
||||
JPGHandler::~JPGHandler()
|
||||
{
|
||||
}
|
||||
|
||||
bool JPEGHandler::canRead() const
|
||||
bool JPGHandler::canRead() const
|
||||
{
|
||||
if (canRead(device())) {
|
||||
setFormat(s_jpegpluginformat);
|
||||
setFormat(s_jpgpluginformat);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool JPEGHandler::read(QImage *image)
|
||||
bool JPGHandler::read(QImage *image)
|
||||
{
|
||||
const QByteArray data = device()->readAll();
|
||||
|
||||
|
@ -134,18 +134,18 @@ bool JPEGHandler::read(QImage *image)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool JPEGHandler::write(const QImage &image)
|
||||
bool JPGHandler::write(const QImage &image)
|
||||
{
|
||||
// this plugin is a read-only kind of plugin
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray JPEGHandler::name() const
|
||||
QByteArray JPGHandler::name() const
|
||||
{
|
||||
return s_jpegpluginformat;
|
||||
return s_jpgpluginformat;
|
||||
}
|
||||
|
||||
bool JPEGHandler::canRead(QIODevice *device)
|
||||
bool JPGHandler::canRead(QIODevice *device)
|
||||
{
|
||||
if (Q_UNLIKELY(!device)) {
|
||||
kWarning() << "Called with no device";
|
||||
|
@ -169,38 +169,38 @@ bool JPEGHandler::canRead(QIODevice *device)
|
|||
return false;
|
||||
}
|
||||
|
||||
QStringList JPEGPlugin::keys() const
|
||||
QStringList JPGPlugin::keys() const
|
||||
{
|
||||
return QStringList() << s_jpegpluginformat;
|
||||
return QStringList() << s_jpgpluginformat;
|
||||
}
|
||||
|
||||
QList<QByteArray> JPEGPlugin::mimeTypes() const
|
||||
QList<QByteArray> JPGPlugin::mimeTypes() const
|
||||
{
|
||||
static const QList<QByteArray> list = QList<QByteArray>()
|
||||
<< "image/jpeg";
|
||||
return list;
|
||||
}
|
||||
|
||||
QImageIOPlugin::Capabilities JPEGPlugin::capabilities(QIODevice *device, const QByteArray &format) const
|
||||
QImageIOPlugin::Capabilities JPGPlugin::capabilities(QIODevice *device, const QByteArray &format) const
|
||||
{
|
||||
if (format == s_jpegpluginformat) {
|
||||
if (format == s_jpgpluginformat) {
|
||||
return QImageIOPlugin::Capabilities(QImageIOPlugin::CanRead);
|
||||
}
|
||||
if (!device || !device->isOpen()) {
|
||||
return 0;
|
||||
}
|
||||
if (device->isReadable() && JPEGHandler::canRead(device)) {
|
||||
if (device->isReadable() && JPGHandler::canRead(device)) {
|
||||
return QImageIOPlugin::Capabilities(QImageIOPlugin::CanRead);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QImageIOHandler *JPEGPlugin::create(QIODevice *device, const QByteArray &format) const
|
||||
QImageIOHandler *JPGPlugin::create(QIODevice *device, const QByteArray &format) const
|
||||
{
|
||||
QImageIOHandler *handler = new JPEGHandler();
|
||||
QImageIOHandler *handler = new JPGHandler();
|
||||
handler->setDevice(device);
|
||||
handler->setFormat(format);
|
||||
return handler;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN2(jpeg, JPEGPlugin)
|
||||
Q_EXPORT_PLUGIN2(jpg, JPGPlugin)
|
|
@ -16,17 +16,17 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KIMG_JPEG_H
|
||||
#define KIMG_JPEG_H
|
||||
#ifndef KIMG_JPG_H
|
||||
#define KIMG_JPG_H
|
||||
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtGui/qimageiohandler.h>
|
||||
|
||||
class JPEGHandler : public QImageIOHandler
|
||||
class JPGHandler : public QImageIOHandler
|
||||
{
|
||||
public:
|
||||
JPEGHandler();
|
||||
~JPEGHandler();
|
||||
JPGHandler();
|
||||
~JPGHandler();
|
||||
|
||||
bool canRead() const final;
|
||||
bool read(QImage *image) final;
|
||||
|
@ -37,7 +37,7 @@ public:
|
|||
static bool canRead(QIODevice *device);
|
||||
};
|
||||
|
||||
class JPEGPlugin : public QImageIOPlugin
|
||||
class JPGPlugin : public QImageIOPlugin
|
||||
{
|
||||
public:
|
||||
QStringList keys() const;
|
||||
|
@ -46,5 +46,5 @@ public:
|
|||
QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const final;
|
||||
};
|
||||
|
||||
#endif // KIMG_JPEG_H
|
||||
#endif // KIMG_JPG_H
|
||||
|
Loading…
Add table
Reference in a new issue