Debian Codegraph @

core/libs/threadimageio/thumb/thumbnailinfo.h

raw
1 /* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2014-11-15
7 * Description : Information for thumbnails
8 *
9 * SPDX-FileCopyrightText: 2006-2014 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
10 *
11 * SPDX-License-Identifier: GPL-2.0-or-later
12 *
13 * ============================================================ */
14
15 #pragma once
16
17 // Qt includes
18
19 #include <QDateTime>
20 #include <QString>
21
22 // Local includes
23
24 #include "digikam_export.h"
25 #include "dmetadata.h"
26
27 namespace Digikam
28 {
29
30 class DIGIKAM_EXPORT ThumbnailIdentifier
31 {
32 public:
33
34 ThumbnailIdentifier() = default;
35
36 explicit ThumbnailIdentifier(const QString& path)
37 : filePath(path)
38 {
39 }
40
41 /**
42 * The file path from which the thumbnail shall be generated
43 */
44 QString filePath;
45
46 /**
47 * The database id, which needs to be translated to uniqueHash + fileSize
48 */
49 qlonglong id = 0;
50 };
51
52 class DIGIKAM_EXPORT ThumbnailInfo : public ThumbnailIdentifier
53 {
54 public:
55
56 ThumbnailInfo() = default;
57 ~ThumbnailInfo() = default;
58
59 /**
60 * If available, the uniqueHash + fileSize pair for identification
61 * of the original file by content.
62 */
63 QString uniqueHash;
64 qlonglong fileSize = 0;
65
66 /**
67 * If the original file is at all accessible on disk.
68 * May be false if a file on a removable device is used.
69 */
70 bool isAccessible = false;
71
72 /**
73 * The modification date of the original file.
74 * Thumbnail will be regenerated if thumb's modification date is older than this.
75 */
76 QDateTime modificationDate;
77
78 /**
79 * Gives a hint at the orientation of the image.
80 * This can be used to supersede the Exif information in the file.
81 * Will not be used if DMetadata::ORIENTATION_UNSPECIFIED (default value)
82 */
83 int orientationHint = DMetadata::ORIENTATION_UNSPECIFIED;
84
85 /**
86 * The file name (the name, not the directory)
87 */
88 QString fileName;
89
90 /**
91 * The mime type of the original file.
92 * Currently "image" or "video" otherwise empty.
93 */
94 QString mimeType;
95
96 /**
97 * A custom identifier, if neither filePath nor uniqueHash are applicable.
98 */
99 QString customIdentifier;
100 };
101
102 // ------------------------------------------------------------------------------------------
103
104 class DIGIKAM_EXPORT ThumbnailInfoProvider
105 {
106 public:
107
108 ThumbnailInfoProvider() = default;
109 virtual ~ThumbnailInfoProvider() = default;
110
111 virtual ThumbnailInfo thumbnailInfo(const ThumbnailIdentifier&) = 0;
112
113 private:
114
115 Q_DISABLE_COPY(ThumbnailInfoProvider)
116 };
117
118 } // namespace Digikam