Commit 4a489778 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

factorize

parent dca06c9e
...@@ -43,12 +43,16 @@ ...@@ -43,12 +43,16 @@
// Local includes // Local includes
#include "slideshowkb.h" #include "slideshowkb.h"
#include "kpmetadata.h"
using namespace KIPIPlugins;
using namespace KDcrawIface;
namespace KIPIAdvancedSlideshowPlugin namespace KIPIAdvancedSlideshowPlugin
{ {
ImageLoadThread::ImageLoadThread(QList<QPair<QString, int> >& fileList, int width, int height, bool loop) ImageLoadThread::ImageLoadThread(QList<QPair<QString, int> >& fileList, int width, int height, bool loop)
: QThread() : QThread()
{ {
m_initialized = false; m_initialized = false;
m_needImage = true; m_needImage = true;
...@@ -149,7 +153,6 @@ void ImageLoadThread::run() ...@@ -149,7 +153,6 @@ void ImageLoadThread::run()
m_haveImages = ok; m_haveImages = ok;
m_initialized = true; m_initialized = true;
} }
} }
else else
{ {
...@@ -162,23 +165,20 @@ void ImageLoadThread::run() ...@@ -162,23 +165,20 @@ void ImageLoadThread::run()
bool ImageLoadThread::loadImage() bool ImageLoadThread::loadImage()
{ {
QPair<QString, int> fileAngle = m_fileList[m_fileIndex]; QPair<QString, int> fileAngle = m_fileList[m_fileIndex];
QString path(fileAngle.first); QString path(fileAngle.first);
int angle(fileAngle.second); int angle(fileAngle.second);
QImage image;
QImage image;
// check if it's a RAW file. // check if it's a RAW file.
QString rawFilesExt(KDcrawIface::KDcraw::rawFiles()); if (KPMetadata::isRawFile(path))
QFileInfo fileInfo(path);
if (rawFilesExt.toUpper().contains( fileInfo.suffix().toUpper() ))
{ {
// it's a RAW file, use the libkdcraw loader // it's a RAW file, use the libkdcraw loader
KDcrawIface::KDcraw::loadDcrawPreview(image, path); KDcraw::loadDcrawPreview(image, path);
} }
else else
{ {
// use the standard loader // use the standard loader
image=QImage(path); image = QImage(path);
} }
if (angle != 0) if (angle != 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment