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) 2006-2011 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
11
* This program is free software; you can redistribute it
12
* and/or modify it under the terms of the GNU General
13
* Public License as published by the Free Software Foundation;
14
* either version 2, or (at your option)
17
* This program is distributed in the hope that it will be useful,
18
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
* GNU General Public License for more details.
22
* ============================================================ */
24
#ifndef LOADING_DESCRIPTION_H
25
#define LOADING_DESCRIPTION_H
34
#include "digikam_export.h"
41
class DIGIKAM_EXPORT LoadingDescription
45
enum ColorManagementSettings
48
ApplyTransform, /// IccData is an IccTransform
51
ConvertForDisplay, /// IccData can be the output profile
52
ConvertForOutput /// IccData is the output profile
57
/// The raw decoding options passed are taken from default, hardcoded settings
58
RawDecodingDefaultSettings,
59
/// The raw decoding options passed are taken from global settings
60
RawDecodingGlobalSettings,
61
/// The raw decoding options may be customly edited by the user
62
RawDecodingCustomSettings,
63
/// The raw decoding options are hardcoded settings optimized for loading time
64
/// The halfSizeColorImage and 16bit settings can be adjusted separately
65
RawDecodingTimeOptimized
70
class PreviewParameters
86
OnlyPregenerate = 1 << 1,
87
/// This prefers large images, but if loading a larger
88
/// image is very much slower, it will give a smaller image.
89
/// Size serves as a lower bound.
92
Q_DECLARE_FLAGS(PreviewFlags, PreviewFlag)
101
bool exifRotate() const
103
return flags & ExifRotate;
106
bool onlyPregenerate() const
108
return flags & OnlyPregenerate;
111
bool fastButLarge() const
113
return flags & FastButLarge;
116
bool operator==(const PreviewParameters& other) const;
123
QVariant extraParameter;
126
class PostProcessingParameters
130
PostProcessingParameters()
132
colorManagement = NoColorConversion;
135
bool needsProcessing() const;
137
void setTransform(const IccTransform& transform);
138
bool hasTransform() const;
139
IccTransform transform() const;
141
void setProfile(const IccProfile& profile);
142
bool hasProfile() const;
143
IccProfile profile() const;
145
bool operator==(const PostProcessingParameters& other) const;
149
ColorManagementSettings colorManagement;
156
* An invalid LoadingDescription
163
* Use this for full loading of non-raw files
165
explicit LoadingDescription(const QString& filePath,
166
ColorManagementSettings = NoColorConversion);
169
* Use this for full loading of raw files
171
LoadingDescription(const QString& filePath, const DRawDecoding& settings,
172
RawDecodingHint rawDecodingHint = RawDecodingCustomSettings,
173
ColorManagementSettings = NoColorConversion);
176
* For preview and thumbnail jobs:
177
* Stores preview max size and Exif rotation.
179
* The Exif rotation is only a hint.
180
* Call LoadSaveThread::exifRotate to make sure that the image is really
181
* rotated. It is safe to call this method even if the image is rotated.
182
* Raw files / preview jobs:
183
* If size is not 0, the embedded preview will be loaded if available.
184
* If size is 0, DImg based loading will be used with default raw decoding settings.
185
* You can also adjust raw decoding settings and hint in this case.
187
LoadingDescription(const QString& filePath, int size, bool exifRotate,
188
ColorManagementSettings = NoColorConversion,
189
PreviewParameters::PreviewType = PreviewParameters::PreviewImage);
192
* Return the cache key for this description
194
QString cacheKey() const;
196
* For some RAW images, the same cache key is not enough to say it is the correct result.
197
* You must check the raw decoding settings in this case.
199
bool needCheckRawDecoding() const;
201
* Return all possible cache keys, starting with the best choice,
202
* for which a result may be found in the cache for this description.
203
* Included in the list are better quality versions, if this description is reduced.
205
QStringList lookupCacheKeys() const;
207
* Returns whether this description describes a loading operation which
208
* loads the image in a reduced version (quality, size etc.)
210
bool isReducedVersion() const;
213
* Returns if this description will load a thumbnail
215
bool isThumbnail() const;
218
* Returns if this description will load a preview
220
bool isPreviewImage() const;
223
* Returns whether the other loading task equals this one
225
bool operator==(const LoadingDescription& other) const;
226
bool operator!=(const LoadingDescription& other) const
228
return !operator==(other);
232
* Returns whether the other loading task equals this one
233
* ignoring parameters used to specify a reduced version.
235
bool equalsIgnoreReducedVersion(const LoadingDescription& other) const;
238
* Returns whether this loading task equals the other one
239
* or is superior to it, if the other one is a reduced version
241
bool equalsOrBetterThan(const LoadingDescription& other) const;
246
* Returns all possible cacheKeys for the given file path
247
* (all cache keys under which the given file could be stored in the cache).
249
static QStringList possibleCacheKeys(const QString& filePath);
250
static QStringList possibleThumbnailCacheKeys(const QString& filePath);
255
DRawDecoding rawDecodingSettings;
256
RawDecodingHint rawDecodingHint;
257
PreviewParameters previewParameters;
258
PostProcessingParameters postProcessingParameters;
261
} // namespace Digikam
263
Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::LoadingDescription::PreviewParameters::PreviewFlags)
265
#endif // LOADING_DESCRIPTION_H