1
/* ============================================================
3
* This file is a part of digiKam project
4
* http://www.digikam.org
7
* Description : image file IO threaded interface.
9
* Copyright (C) 2005-2011 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
10
* Copyright (C) 2005-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
12
* This program is free software; you can redistribute it
13
* and/or modify it under the terms of the GNU General
14
* Public License as published by the Free Software Foundation;
15
* either version 2, or (at your option)
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
23
* ============================================================ */
25
#include "previewloadthread.moc"
29
#include "iccmanager.h"
30
#include "previewtask.h"
35
PreviewLoadThread::PreviewLoadThread(QObject* parent)
36
: ManagedLoadSaveThread(parent),
39
m_loadingPolicy = LoadingPolicyFirstRemovePrevious;
42
LoadingDescription PreviewLoadThread::createLoadingDescription(const QString& filePath, int size, bool exifRotate)
44
LoadingDescription description(filePath, size, exifRotate);
46
if (DImg::fileFormat(filePath) == DImg::RAW)
48
description.rawDecodingSettings.optimizeTimeLoading();
49
description.rawDecodingSettings.rawPrm.sixteenBitsImage = false;
50
description.rawDecodingSettings.rawPrm.halfSizeColorImage = true;
51
description.rawDecodingHint = LoadingDescription::RawDecodingTimeOptimized;
54
ICCSettingsContainer settings = IccSettings::instance()->settings();
56
if (settings.enableCM && settings.useManagedPreviews)
58
description.postProcessingParameters.colorManagement = LoadingDescription::ConvertForDisplay;
59
description.postProcessingParameters.setProfile(IccManager::displayProfile(m_displayingWidget));
65
void PreviewLoadThread::load(const QString& filePath, int size, bool exifRotate)
67
load(createLoadingDescription(filePath, size, exifRotate));
70
void PreviewLoadThread::loadFastButLarge(const QString& filePath, int size, bool exifRotate)
72
LoadingDescription description = createLoadingDescription(filePath, size, exifRotate);
73
description.previewParameters.flags |= LoadingDescription::PreviewParameters::FastButLarge;
77
void PreviewLoadThread::loadHighQuality(const QString& filePath, bool exifRotate)
79
load(filePath, 0, exifRotate);
82
void PreviewLoadThread::load(LoadingDescription description)
84
// creates a PreviewLoadingTask, which uses different mechanisms than a normal loading task
85
ManagedLoadSaveThread::loadPreview(description, m_loadingPolicy);
88
void PreviewLoadThread::setDisplayingWidget(QWidget* widget)
90
m_displayingWidget = widget;
93
} // namespace Digikam