00001 #include "dcrawplugin.h" 00002 00003 #include "dcrawformats.h" 00004 #include "dcrawhandler.h" 00005 00006 #include <QByteArray> 00007 #include <QImageIOHandler> 00008 #include <QImageIOPlugin> 00009 #include <QIODevice> 00010 #include <QStringList> 00011 00012 QStringList DcrawPlugin::keys() const 00013 { 00014 return QStringList(DcrawFormats::getFormats().toList()); 00015 } 00016 00017 QImageIOPlugin::Capabilities DcrawPlugin::capabilities(QIODevice *device, const QByteArray &format) const 00018 { 00019 if (DcrawFormats::getFormats().contains(format)) 00020 return CanRead; 00021 00022 if (format.isEmpty()) 00023 { 00024 DcrawHandler handler; 00025 handler.setDevice(device); 00026 if (handler.canRead()) 00027 return CanRead; 00028 } 00029 00030 return 0; 00031 } 00032 00033 QImageIOHandler *DcrawPlugin::create(QIODevice *device, const QByteArray &format) const 00034 { 00035 DcrawHandler *handler = new DcrawHandler; 00036 handler->setDevice(device); 00037 handler->setFormat(format); 00038 return handler; 00039 } 00040 00041 // This shouldn't be necessary, but it shuts up the dang compiler warning. 00042 QObject* qt_plugin_instance_dcrawplugin(); 00043 00044 Q_EXPORT_PLUGIN2(dcrawplugin, DcrawPlugin) 00045
1.6.3