~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to core/libs/threadimageio/loadingdescription.h

  • Committer: Package Import Robot
  • Author(s): Felix Geyer, Rohan Garg, Philip Muškovac, Felix Geyer
  • Date: 2011-09-23 18:18:55 UTC
  • mfrom: (1.2.36 upstream)
  • Revision ID: package-import@ubuntu.com-20110923181855-ifs67wxkugshev9k
Tags: 2:2.1.1-0ubuntu1
[ Rohan Garg ]
* New upstream release (LP: #834190)
  - debian/control
    + Build with libqtwebkit-dev
 - debian/kipi-plugins-common
    + Install libkvkontakte required by kipi-plugins
 - debian/digikam
    + Install panoramagui

[ Philip Muškovac ]
* New upstream release
  - debian/control:
    + Add libcv-dev, libcvaux-dev, libhighgui-dev, libboost-graph1.46-dev,
      libksane-dev, libxml2-dev, libxslt-dev, libqt4-opengl-dev, libqjson-dev,
      libgpod-dev and libqca2-dev to build-deps
    + Add packages for kipi-plugins, libmediawiki, libkface, libkgeomap and
      libkvkontakte
  - debian/rules:
    + Don't build with gphoto2 since it doesn't build with it.
  - Add kubuntu_fix_test_linking.diff to fix linking of the dngconverter test
  - update install files
  - update kubuntu_01_mysqld_executable_name.diff for new cmake layout
    and rename to kubuntu_mysqld_executable_name.diff
* Fix typo in digikam-data description (LP: #804894)
* Fix Vcs links

[ Felix Geyer ]
* Move library data files to the new packages libkface-data, libkgeomap-data
  and libkvkontakte-data.
* Override version of the embedded library packages to 1.0~digikam<version>.
* Exclude the library packages from digikam-dbg to prevent file conflicts in
  the future.
* Call dh_install with --list-missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of digiKam project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2006-01-16
 
7
 * Description : image file IO threaded interface.
 
8
 *
 
9
 * Copyright (C) 2006-2011 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
 
10
 *
 
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)
 
15
 * any later version.
 
16
 *
 
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.
 
21
 *
 
22
 * ============================================================ */
 
23
 
 
24
#ifndef LOADING_DESCRIPTION_H
 
25
#define LOADING_DESCRIPTION_H
 
26
 
 
27
// Qt includes
 
28
 
 
29
#include <QFlags>
 
30
 
 
31
// Local includes
 
32
 
 
33
#include "dimg.h"
 
34
#include "digikam_export.h"
 
35
 
 
36
namespace Digikam
 
37
{
 
38
 
 
39
class IccTransform;
 
40
 
 
41
class DIGIKAM_EXPORT LoadingDescription
 
42
{
 
43
public:
 
44
 
 
45
    enum ColorManagementSettings
 
46
    {
 
47
        NoColorConversion,
 
48
        ApplyTransform,    /// IccData is an IccTransform
 
49
        ConvertForEditor,
 
50
        ConvertToSRGB,
 
51
        ConvertForDisplay, /// IccData can be the output profile
 
52
        ConvertForOutput   /// IccData is the output profile
 
53
    };
 
54
 
 
55
    enum RawDecodingHint
 
56
    {
 
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
 
66
    };
 
67
 
 
68
public:
 
69
 
 
70
    class PreviewParameters
 
71
    {
 
72
    public:
 
73
 
 
74
        enum PreviewType
 
75
        {
 
76
            NoPreview,
 
77
            PreviewImage,
 
78
            Thumbnail,
 
79
            DetailThumbnail
 
80
        };
 
81
 
 
82
        enum PreviewFlag
 
83
        {
 
84
            NoFlags         = 0,
 
85
            ExifRotate      = 1 << 0,
 
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.
 
90
            FastButLarge    = 1 << 2
 
91
        };
 
92
        Q_DECLARE_FLAGS(PreviewFlags, PreviewFlag)
 
93
 
 
94
        PreviewParameters()
 
95
        {
 
96
            type            = NoPreview;
 
97
            size            = 0;
 
98
            flags           = NoFlags;
 
99
        }
 
100
 
 
101
        bool exifRotate() const
 
102
        {
 
103
            return flags & ExifRotate;
 
104
        }
 
105
 
 
106
        bool onlyPregenerate() const
 
107
        {
 
108
            return flags & OnlyPregenerate;
 
109
        }
 
110
 
 
111
        bool fastButLarge() const
 
112
        {
 
113
            return flags & FastButLarge;
 
114
        }
 
115
 
 
116
        bool operator==(const PreviewParameters& other) const;
 
117
 
 
118
    public:
 
119
 
 
120
        PreviewType  type;
 
121
        int          size;
 
122
        PreviewFlags flags;
 
123
        QVariant     extraParameter;
 
124
    };
 
125
 
 
126
    class PostProcessingParameters
 
127
    {
 
128
    public:
 
129
 
 
130
        PostProcessingParameters()
 
131
        {
 
132
            colorManagement = NoColorConversion;
 
133
        }
 
134
 
 
135
        bool needsProcessing() const;
 
136
 
 
137
        void         setTransform(const IccTransform& transform);
 
138
        bool         hasTransform() const;
 
139
        IccTransform transform() const;
 
140
 
 
141
        void       setProfile(const IccProfile& profile);
 
142
        bool       hasProfile() const;
 
143
        IccProfile profile() const;
 
144
 
 
145
        bool operator==(const PostProcessingParameters& other) const;
 
146
 
 
147
    public:
 
148
 
 
149
        ColorManagementSettings colorManagement;
 
150
        QVariant                iccData;
 
151
    };
 
152
 
 
153
public:
 
154
 
 
155
    /**
 
156
     * An invalid LoadingDescription
 
157
     */
 
158
    LoadingDescription()
 
159
    {
 
160
    }
 
161
 
 
162
    /**
 
163
     * Use this for full loading of non-raw files
 
164
     */
 
165
    explicit LoadingDescription(const QString& filePath,
 
166
                                ColorManagementSettings = NoColorConversion);
 
167
 
 
168
    /**
 
169
     * Use this for full loading of raw files
 
170
     */
 
171
    LoadingDescription(const QString& filePath, const DRawDecoding& settings,
 
172
                       RawDecodingHint rawDecodingHint = RawDecodingCustomSettings,
 
173
                       ColorManagementSettings = NoColorConversion);
 
174
 
 
175
    /**
 
176
     * For preview and thumbnail jobs:
 
177
     * Stores preview max size and Exif rotation.
 
178
     * 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.
 
186
     */
 
187
    LoadingDescription(const QString& filePath, int size, bool exifRotate,
 
188
                       ColorManagementSettings = NoColorConversion,
 
189
                       PreviewParameters::PreviewType = PreviewParameters::PreviewImage);
 
190
 
 
191
    /**
 
192
     * Return the cache key for this description
 
193
     */
 
194
    QString             cacheKey() const;
 
195
    /**
 
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.
 
198
     */
 
199
    bool                needCheckRawDecoding() const;
 
200
    /**
 
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.
 
204
     */
 
205
    QStringList         lookupCacheKeys() const;
 
206
    /**
 
207
     * Returns whether this description describes a loading operation which
 
208
     * loads the image in a reduced version (quality, size etc.)
 
209
     */
 
210
    bool                isReducedVersion() const;
 
211
 
 
212
    /**
 
213
     * Returns if this description will load a thumbnail
 
214
     */
 
215
    bool                isThumbnail() const;
 
216
 
 
217
    /**
 
218
     * Returns if this description will load a preview
 
219
     */
 
220
    bool                isPreviewImage() const;
 
221
 
 
222
    /**
 
223
      * Returns whether the other loading task equals this one
 
224
      */
 
225
    bool operator==(const LoadingDescription& other) const;
 
226
    bool operator!=(const LoadingDescription& other) const
 
227
    {
 
228
        return !operator==(other);
 
229
    }
 
230
 
 
231
    /**
 
232
     * Returns whether the other loading task equals this one
 
233
     * ignoring parameters used to specify a reduced version.
 
234
     */
 
235
    bool equalsIgnoreReducedVersion(const LoadingDescription& other) const;
 
236
 
 
237
    /**
 
238
     * Returns whether this loading task equals the other one
 
239
     * or is superior to it, if the other one is a reduced version
 
240
     */
 
241
    bool equalsOrBetterThan(const LoadingDescription& other) const;
 
242
 
 
243
public:
 
244
 
 
245
    /**
 
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).
 
248
     */
 
249
    static QStringList possibleCacheKeys(const QString& filePath);
 
250
    static QStringList possibleThumbnailCacheKeys(const QString& filePath);
 
251
 
 
252
public:
 
253
 
 
254
    QString                  filePath;
 
255
    DRawDecoding             rawDecodingSettings;
 
256
    RawDecodingHint          rawDecodingHint;
 
257
    PreviewParameters        previewParameters;
 
258
    PostProcessingParameters postProcessingParameters;
 
259
};
 
260
 
 
261
}   // namespace Digikam
 
262
 
 
263
Q_DECLARE_OPERATORS_FOR_FLAGS(Digikam::LoadingDescription::PreviewParameters::PreviewFlags)
 
264
 
 
265
#endif // LOADING_DESCRIPTION_H