kimgio: hardcode RAW image MIME types

the plugin is heavy on I/O already because LibRaw requires the whole file
data to determine if it can open it or not so this will reduce that a bit
at the cost of (possibly) requiring update in the future

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-19 19:33:26 +03:00
parent 97bb978c42
commit 9526e164cb

View file

@ -19,7 +19,6 @@
#include "raw.h"
#include <QImage>
#include <kmimetype.h>
#include <kdebug.h>
#include <libraw/libraw.h>
@ -171,16 +170,24 @@ QStringList RAWPlugin::keys() const
QList<QByteArray> RAWPlugin::mimeTypes() const
{
static QList<QByteArray> list;
if (list.isEmpty()) {
foreach (const KMimeType::Ptr &mime, KMimeType::allMimeTypes()) {
// NOTE: RAW MIME types are sub-class of image/x-dcraw
if (mime && mime->is(QString::fromLatin1("image/x-dcraw"))
&& mime->name() != QLatin1String("image/x-dcraw")) {
list.append(mime->name().toLatin1());
}
}
}
static const QList<QByteArray> list = QList<QByteArray>()
<< "image/x-sony-srf"
<< "image/x-fuji-raf"
<< "image/x-adobe-dng"
<< "image/x-olympus-orf"
<< "image/x-panasonic-rw2"
<< "image/x-kodak-dcr"
<< "image/x-kodak-k25"
<< "image/x-sony-arw"
<< "image/x-minolta-mrw"
<< "image/x-kodak-kdc"
<< "image/x-sigma-x3f"
<< "image/x-nikon-nef"
<< "image/x-pentax-pef"
<< "image/x-panasonic-rw"
<< "image/x-canon-crw"
<< "image/x-sony-sr2"
<< "image/x-canon-cr2";
return list;
}