Commit 77f7fd8a authored by Marcel Wiesweg's avatar Marcel Wiesweg
Browse files

Remove the extra exifRotate parameter everywhere. Use MetadataSettings directly.

parent ac8fdbcb
......@@ -343,7 +343,6 @@ void AlbumThumbnailLoader::addUrl(Album* album, const KUrl& url)
d->iconTagThumbThread = new ThumbnailLoadThread();
d->iconTagThumbThread->setThumbnailSize(d->iconSize);
d->iconTagThumbThread->setSendSurrogatePixmap(false);
d->iconTagThumbThread->setExifRotate(MetadataSettings::instance()->settings().exifRotate);
connect(d->iconTagThumbThread,
SIGNAL(signalThumbnailLoaded(LoadingDescription,QPixmap)),
SLOT(slotGotThumbnailFromIcon(LoadingDescription,QPixmap)),
......@@ -360,7 +359,6 @@ void AlbumThumbnailLoader::addUrl(Album* album, const KUrl& url)
d->iconAlbumThumbThread = new ThumbnailLoadThread();
d->iconAlbumThumbThread->setThumbnailSize(d->iconSize);
d->iconAlbumThumbThread->setSendSurrogatePixmap(false);
d->iconAlbumThumbThread->setExifRotate(MetadataSettings::instance()->settings().exifRotate);
connect(d->iconAlbumThumbThread,
SIGNAL(signalThumbnailLoaded(LoadingDescription,QPixmap)),
SLOT(slotGotThumbnailFromIcon(LoadingDescription,QPixmap)),
......
......@@ -500,7 +500,6 @@ void ImagePreviewView::slotThemeChanged()
void ImagePreviewView::slotSetupChanged()
{
previewItem()->setLoadFullImageSize(AlbumSettings::instance()->getPreviewLoadFullImageSize());
previewItem()->setExifRotate(MetadataSettings::instance()->settings().exifRotate);
d->toolBar->setVisible(AlbumSettings::instance()->getPreviewShowIcons());
setShowText(AlbumSettings::instance()->getPreviewShowIcons());
......
......@@ -51,8 +51,7 @@ public:
thumbSize(0),
lastGlobalThumbSize(0),
preloadThumbSize(0),
emitDataChanged(true),
exifRotate(true)
emitDataChanged(true)
{
}
......@@ -64,7 +63,6 @@ public:
QRect detailRect;
bool emitDataChanged;
bool exifRotate;
int preloadThumbnailSize() const
{
......@@ -131,7 +129,6 @@ void ImageThumbnailModel::setPreloadThumbnails(bool preload)
{
d->preloadThread = new ThumbnailLoadThread;
d->preloadThread->setPixmapRequested(false);
d->preloadThread->setExifRotate(d->exifRotate);
d->preloadThread->setPriority(QThread::LowestPriority);
}
......@@ -147,21 +144,6 @@ void ImageThumbnailModel::setPreloadThumbnails(bool preload)
}
}
void ImageThumbnailModel::setExifRotate(bool rotate)
{
d->exifRotate = rotate;
if (d->thread)
{
d->thread->setExifRotate(rotate);
}
if (d->preloadThread)
{
d->preloadThread->setExifRotate(rotate);
}
}
void ImageThumbnailModel::prepareThumbnails(const QList<QModelIndex>& indexesToPrepare)
{
prepareThumbnails(indexesToPrepare, d->thumbSize);
......
......@@ -92,7 +92,7 @@ LoadingDescription::LoadingDescription(const QString& filePath, const DRawDecodi
postProcessingParameters.colorManagement = cm;
}
LoadingDescription::LoadingDescription(const QString& filePath, int size, bool exifRotate,
LoadingDescription::LoadingDescription(const QString& filePath, int size,
ColorManagementSettings cm,
LoadingDescription::PreviewParameters::PreviewType type)
: filePath(filePath)
......@@ -102,11 +102,6 @@ LoadingDescription::LoadingDescription(const QString& filePath, int size, bool e
previewParameters.type = type;
previewParameters.size = size;
postProcessingParameters.colorManagement = cm;
if (exifRotate)
{
previewParameters.flags |= PreviewParameters::ExifRotate;
}
}
QString LoadingDescription::cacheKey() const
......
......@@ -82,12 +82,11 @@ public:
enum PreviewFlag
{
NoFlags = 0,
ExifRotate = 1 << 0,
OnlyPregenerate = 1 << 1,
OnlyPregenerate = 1 << 0,
/// This prefers large images, but if loading a larger
/// image is very much slower, it will give a smaller image.
/// Size serves as a lower bound.
FastButLarge = 1 << 2
FastButLarge = 1 << 1
};
Q_DECLARE_FLAGS(PreviewFlags, PreviewFlag)
......@@ -98,11 +97,6 @@ public:
flags = NoFlags;
}
bool exifRotate() const
{
return flags & ExifRotate;
}
bool onlyPregenerate() const
{
return flags & OnlyPregenerate;
......@@ -175,16 +169,12 @@ public:
/**
* For preview and thumbnail jobs:
* Stores preview max size and Exif rotation.
* Exif Rotation:
* The Exif rotation is only a hint.
* Call LoadSaveThread::exifRotate to make sure that the image is really
* rotated. It is safe to call this method even if the image is rotated.
* Raw files / preview jobs:
* If size is not 0, the embedded preview will be loaded if available.
* If size is 0, DImg based loading will be used with default raw decoding settings.
* You can also adjust raw decoding settings and hint in this case.
*/
LoadingDescription(const QString& filePath, int size, bool exifRotate,
LoadingDescription(const QString& filePath, int size,
ColorManagementSettings = NoColorConversion,
PreviewParameters::PreviewType = PreviewParameters::PreviewImage);
......
......@@ -39,9 +39,9 @@ PreviewLoadThread::PreviewLoadThread(QObject* parent)
m_loadingPolicy = LoadingPolicyFirstRemovePrevious;
}
LoadingDescription PreviewLoadThread::createLoadingDescription(const QString& filePath, int size, bool exifRotate)
LoadingDescription PreviewLoadThread::createLoadingDescription(const QString& filePath, int size)
{
LoadingDescription description(filePath, size, exifRotate);
LoadingDescription description(filePath, size);
if (DImg::fileFormat(filePath) == DImg::RAW)
{
......@@ -62,21 +62,21 @@ LoadingDescription PreviewLoadThread::createLoadingDescription(const QString& fi
return description;
}
void PreviewLoadThread::load(const QString& filePath, int size, bool exifRotate)
void PreviewLoadThread::load(const QString& filePath, int size)
{
load(createLoadingDescription(filePath, size, exifRotate));
load(createLoadingDescription(filePath, size));
}
void PreviewLoadThread::loadFastButLarge(const QString& filePath, int size, bool exifRotate)
void PreviewLoadThread::loadFastButLarge(const QString& filePath, int size)
{
LoadingDescription description = createLoadingDescription(filePath, size, exifRotate);
LoadingDescription description = createLoadingDescription(filePath, size);
description.previewParameters.flags |= LoadingDescription::PreviewParameters::FastButLarge;
load(description);
}
void PreviewLoadThread::loadHighQuality(const QString& filePath, bool exifRotate)
void PreviewLoadThread::loadHighQuality(const QString& filePath)
{
load(filePath, 0, exifRotate);
load(filePath, 0);
}
void PreviewLoadThread::load(LoadingDescription description)
......
......@@ -49,21 +49,21 @@ public:
* Load a preview that is optimized for fast loading.
* Raw decoding and color management settings will be adjusted.
*/
void load(const QString& filePath, int size, bool exifRotate);
void load(const QString& filePath, int size);
/**
* Load a preview that is as large as possible without sacrificing speed
* for performance. Especially, raw previews are taken if larger than the given size.
* Raw decoding and color management settings will be adjusted.
*/
void loadFastButLarge(const QString& filePath, int minimumSize, bool exifRotate);
void loadFastButLarge(const QString& filePath, int minimumSize);
/**
* Load a preview with higher resolution, trading more quality
* for less speed.
* Raw decoding and color management settings will be adjusted.
*/
void loadHighQuality(const QString& filePath, bool exifRotate);
void loadHighQuality(const QString& filePath);
/**
* Load a preview. Loading description will not be touched.
......@@ -75,7 +75,7 @@ public:
protected:
LoadingDescription createLoadingDescription(const QString& filePath, int size, bool exifRotate);
LoadingDescription createLoadingDescription(const QString& filePath, int size);
protected:
......
......@@ -52,6 +52,7 @@
#include "dmetadata.h"
#include "jpegutils.h"
#include "metadatasettings.h"
#include "previewloadthread.h"
namespace Digikam
......@@ -110,7 +111,7 @@ void PreviewLoadingTask::execute()
// rotate if needed - images are unrotated in the cache,
// except for RAW images, which are already rotated by dcraw.
if (m_loadingDescription.previewParameters.exifRotate())
if (MetadataSettings::instance()->settings().exifRotate)
{
m_img = m_img.copy();
LoadSaveThread::exifRotate(m_img, m_loadingDescription.filePath);
......@@ -180,7 +181,7 @@ void PreviewLoadingTask::execute()
// The image from the cache may or may not be rotated and post processed.
// exifRotate() and postProcess() will detect if work is needed.
if (m_loadingDescription.previewParameters.exifRotate())
if (MetadataSettings::instance()->settings().exifRotate)
{
LoadSaveThread::exifRotate(m_img, m_loadingDescription.filePath);
}
......@@ -391,7 +392,7 @@ void PreviewLoadingTask::execute()
}
// Scale if hinted, Store previews rotated in the cache (?)
if (m_loadingDescription.previewParameters.exifRotate())
if (MetadataSettings::instance()->settings().exifRotate)
{
LoadSaveThread::exifRotate(m_img, m_loadingDescription.filePath);
}
......
......@@ -108,7 +108,6 @@ public:
{
size = ThumbnailSize::Huge;
wantPixmap = true;
explicitExifRotate = -1;
highlight = true;
sendSurrogate = true;
creator = 0;
......@@ -116,7 +115,6 @@ public:
notifiedForResults = false;
}
int explicitExifRotate;
bool wantPixmap;
bool highlight;
bool sendSurrogate;
......@@ -137,7 +135,6 @@ public:
public:
bool exifRotate() const;
LoadingDescription createLoadingDescription(const QString& filePath, int size, bool setLastDescription = true);
LoadingDescription createLoadingDescription(const QString& filePath, int size,
const QRect& detailRect, bool setLastDescription = true);
......@@ -257,21 +254,6 @@ int ThumbnailLoadThread::maximumThumbnailPixmapSize(bool highlight)
}
}
void ThumbnailLoadThread::setExifRotate(bool exifRotate)
{
d->explicitExifRotate = exifRotate ? 1 : 0;
}
bool ThumbnailLoadThread::exifRotate() const
{
return d->exifRotate();
}
bool ThumbnailLoadThread::ThumbnailLoadThreadPriv::exifRotate() const
{
return explicitExifRotate == -1 ? MetadataSettings::instance()->exifRotate() : explicitExifRotate;
}
void ThumbnailLoadThread::setSendSurrogatePixmap(bool send)
{
d->sendSurrogate = send;
......@@ -340,7 +322,7 @@ LoadingDescription ThumbnailLoadThread::ThumbnailLoadThreadPriv
{
size = thumbnailSizeForPixmapSize(size);
LoadingDescription description(filePath, size, exifRotate(),
LoadingDescription description(filePath, size,
LoadingDescription::NoColorConversion,
LoadingDescription::PreviewParameters::Thumbnail);
......@@ -364,7 +346,7 @@ LoadingDescription ThumbnailLoadThread::ThumbnailLoadThreadPriv
{
size = thumbnailSizeForPixmapSize(size);
LoadingDescription description(filePath, size, exifRotate(),
LoadingDescription description(filePath, size,
LoadingDescription::NoColorConversion,
LoadingDescription::PreviewParameters::DetailThumbnail);
......
......@@ -172,20 +172,6 @@ public:
static int maximumThumbnailSize();
static int maximumThumbnailPixmapSize(bool withHighlighting);
/**
* Specify if the thumbnails shall be rotated by Exif.
* Note: This only applies to newly created thumbnails. The rotation state of thumbnails
* found in the disk cache is unknown, so they are not rotated.
* (The only, unsatisfactory solution is the forced recreation of all thumbnails)
* Per default, the setting is taken from MetadataSettings
*/
void setExifRotate(bool exifRotate);
/**
* Return true is thumbnails shall be rotated by Exif.
*/
bool exifRotate() const;
/**
* If you enable this, the signal thumbnailLoaded(LoadingDescription, QPixmap) will be emitted.
* If you do not enable this, only the QImage-based signal (see LoadSaveThread) will be emitted.
......
......@@ -48,6 +48,7 @@
#include "dmetadata.h"
#include "iccmanager.h"
#include "jpegutils.h"
#include "metadatasettings.h"
#include "thumbnailloadthread.h"
#include "thumbnailcreator.h"
......@@ -229,7 +230,7 @@ void ThumbnailLoadingTask::execute()
void ThumbnailLoadingTask::setupCreator()
{
m_creator->setThumbnailSize(m_loadingDescription.previewParameters.size);
m_creator->setExifRotate(m_loadingDescription.previewParameters.exifRotate());
m_creator->setExifRotate(MetadataSettings::instance()->settings().exifRotate);
m_creator->setLoadingProperties(this, m_loadingDescription.rawDecodingSettings);
}
......
......@@ -59,7 +59,6 @@ DImgPreviewItem::DImgPreviewItem(DImgPreviewItemPrivate& dd, QGraphicsItem* pare
DImgPreviewItem::DImgPreviewItemPrivate::DImgPreviewItemPrivate()
{
state = DImgPreviewItem::NoImage;
exifRotate = true;
previewSize = 1024;
loadFullImageSize = false;
previewThread = 0;
......@@ -118,12 +117,6 @@ void DImgPreviewItem::setLoadFullImageSize(bool b)
reload();
}
void DImgPreviewItem::setExifRotate(bool b)
{
Q_D(DImgPreviewItem);
d->exifRotate = b;
}
QString DImgPreviewItem::path() const
{
Q_D(const DImgPreviewItem);
......@@ -152,11 +145,11 @@ void DImgPreviewItem::setPath(const QString& path)
if (d->loadFullImageSize)
{
d->previewThread->loadHighQuality(d->path, d->exifRotate);
d->previewThread->loadHighQuality(d->path);
}
else
{
d->previewThread->load(d->path, d->previewSize, d->exifRotate);
d->previewThread->load(d->path, d->previewSize);
}
emit stateChanged(d->state);
......@@ -300,11 +293,11 @@ void DImgPreviewItem::preloadNext()
if (d->loadFullImageSize)
{
d->preloadThread->loadHighQuality(preloadPath, d->exifRotate);
d->preloadThread->loadHighQuality(preloadPath);
}
else
{
d->preloadThread->load(preloadPath, d->previewSize, d->exifRotate);
d->preloadThread->load(preloadPath, d->previewSize);
}
}
......
......@@ -62,7 +62,6 @@ public:
void setDisplayingWidget(QWidget* widget);
void setLoadFullImageSize(bool b);
void setExifRotate(bool rotate);
QString path() const;
void setPath(const QString& path);
......
......@@ -155,7 +155,7 @@ public:
// -------------------------------------------------------------------------
ThumbBarView::ThumbBarView(QWidget* parent, int orientation, bool exifRotate,
ThumbBarView::ThumbBarView(QWidget* parent, int orientation,
const ThumbBarToolTipSettings& settings)
: Q3ScrollView(parent), d(new ThumbBarViewPriv)
{
......@@ -165,7 +165,6 @@ ThumbBarView::ThumbBarView(QWidget* parent, int orientation, bool exifRotate,
d->preloadTimer = new QTimer(this);
d->preloadTimer->setSingleShot(true);
d->thumbLoadThread = ThumbnailLoadThread::defaultThumbBarThread();
d->thumbLoadThread->setExifRotate(exifRotate);
d->maxTileSize = d->thumbLoadThread->maximumThumbnailSize();
connect(d->thumbLoadThread, SIGNAL(signalThumbnailLoaded(LoadingDescription,QPixmap)),
......@@ -268,28 +267,6 @@ void ThumbBarView::resizeEvent(QResizeEvent* e)
ensureItemVisible(currentItem());
}
void ThumbBarView::setExifRotate(bool exifRotate)
{
if (d->thumbLoadThread->exifRotate() == exifRotate)
{
return;
}
d->thumbLoadThread->setExifRotate(exifRotate);
for (ThumbBarItem* item = d->firstItem; item; item = item->d->next)
{
invalidateThumb(item);
}
triggerUpdate();
}
bool ThumbBarView::getExifRotate()
{
return d->thumbLoadThread->exifRotate();
}
int ThumbBarView::getOrientation()
{
return d->orientation;
......
......@@ -128,7 +128,7 @@ class DIGIKAM_EXPORT ThumbBarView : public Q3ScrollView
public:
explicit ThumbBarView(QWidget* parent, int orientation=Qt::Vertical, bool exifRotate=true,
explicit ThumbBarView(QWidget* parent, int orientation=Qt::Vertical,
const ThumbBarToolTipSettings& settings=ThumbBarToolTipSettings());
virtual ~ThumbBarView();
......@@ -143,9 +143,6 @@ public:
void setSelected(ThumbBarItem* item);
void setExifRotate(bool exifRotate);
bool getExifRotate();
void setToolTipSettings(const ThumbBarToolTipSettings& settings);
ThumbBarToolTipSettings& getToolTipSettings() const;
......
......@@ -559,11 +559,8 @@ void ShowFoto::applySettings()
m_fileDeleteAction->setText(i18n("Delete File"));
}
bool exifRotate = group.readEntry("EXIF Rotate", true);
m_canvas->setExifOrient(exifRotate);
d->thumbBar->setExifRotate(exifRotate);
m_setExifOrientationTag = group.readEntry("EXIF Set Orientation", true);
/*bool exifRotate = group.readEntry("EXIF Rotate", true);
m_setExifOrientationTag = group.readEntry("EXIF Set Orientation", true);*/
Digikam::ThumbBarToolTipSettings settings;
settings.showToolTips = group.readEntry("Show ToolTips", true);
......
......@@ -141,9 +141,7 @@ void FingerPrintsGenerator::processOne()
}
QString path = d->allPicturesPath.first();
LoadingDescription description(path, HaarIface::preferredSize(),
MetadataSettings::instance()->settings().exifRotate,
LoadingDescription::ConvertToSRGB);
LoadingDescription description(path, HaarIface::preferredSize(), LoadingDescription::ConvertToSRGB);
description.rawDecodingSettings.rawPrm.sixteenBitsImage = false;
d->previewLoadThread->load(description);
}
......
......@@ -403,7 +403,7 @@ void PreviewLoader::process(FacePipelineExtendedPackage::Ptr package)
}
scheduledPackages << package;
loadFastButLarge(package->filePath, 1600, MetadataSettings::instance()->settings().exifRotate);
loadFastButLarge(package->filePath, 1600);
//load(package->filePath, 800, MetadataSettings::instance()->settings().exifRotate);
//loadHighQuality(package->filePath, MetadataSettings::instance()->settings().exifRotate);
......@@ -1114,7 +1114,6 @@ void FacePipeline::FacePipelinePriv::createThumbnailLoadThread()
thumbnailLoadThread->setPixmapRequested(false);
thumbnailLoadThread->setThumbnailSize(ThumbnailLoadThread::maximumThumbnailSize());
// KFaceIface::Image::recommendedSizeForRecognition()
thumbnailLoadThread->setExifRotate(MetadataSettings::instance()->settings().exifRotate);
thumbnailLoadThread->setPriority(priority);
}
......
......@@ -288,7 +288,7 @@ void SlideShow::loadNextImage()
{
d->currentImage = d->settings.fileList[d->fileIndex];
d->previewThread->load(d->currentImage.toLocalFile(),
qMax(d->deskWidth, d->deskHeight), d->settings.exifRotate);
qMax(d->deskWidth, d->deskHeight));
}
else
{
......@@ -322,7 +322,7 @@ void SlideShow::loadPrevImage()
{
d->currentImage = d->settings.fileList[d->fileIndex];
d->previewThread->load(d->currentImage.toLocalFile(),
qMax(d->deskWidth, d->deskHeight), d->settings.exifRotate);
qMax(d->deskWidth, d->deskHeight));
}
else
{
......@@ -373,7 +373,7 @@ void SlideShow::preloadNextImage()
if (index < num)
{
d->previewPreloadThread->load(d->settings.fileList[index].toLocalFile(),
qMax(d->deskWidth, d->deskHeight), d->settings.exifRotate);
qMax(d->deskWidth, d->deskHeight));
}
}
......
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