File indexing completed on 2025-04-27 03:58:09

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2014-11-15
0007  * Description : Information for thumbnails
0008  *
0009  * SPDX-FileCopyrightText: 2006-2014 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #ifndef DIGIKAM_THUMB_NAIL_INFO_H
0016 #define DIGIKAM_THUMB_NAIL_INFO_H
0017 
0018 // Qt includes
0019 
0020 #include <QDateTime>
0021 #include <QString>
0022 
0023 // Local includes
0024 
0025 #include "digikam_export.h"
0026 
0027 namespace Digikam
0028 {
0029 
0030 class DIGIKAM_EXPORT ThumbnailIdentifier
0031 {
0032 public:
0033 
0034     ThumbnailIdentifier();
0035     explicit ThumbnailIdentifier(const QString& filePath);
0036 
0037     /**
0038      * The file path from which the thumbnail shall be generated
0039      */
0040     QString   filePath;
0041 
0042     /**
0043      * The database id, which needs to be translated to uniqueHash + fileSize
0044      */
0045     qlonglong id;
0046 };
0047 
0048 class DIGIKAM_EXPORT ThumbnailInfo : public ThumbnailIdentifier
0049 {
0050 public:
0051 
0052     explicit ThumbnailInfo();
0053     ~ThumbnailInfo()
0054     {
0055     };
0056 
0057     /**
0058      * If available, the uniqueHash + fileSize pair for identification
0059      * of the original file by content.
0060      */
0061     QString   uniqueHash;
0062     qlonglong fileSize;
0063 
0064     /**
0065      * If the original file is at all accessible on disk.
0066      * May be false if a file on a removable device is used.
0067      */
0068     bool      isAccessible;
0069 
0070     /**
0071      * The modification date of the original file.
0072      * Thumbnail will be regenerated if thumb's modification date is older than this.
0073      */
0074     QDateTime modificationDate;
0075 
0076     /**
0077      * Gives a hint at the orientation of the image.
0078      * This can be used to supersede the Exif information in the file.
0079      * Will not be used if DMetadata::ORIENTATION_UNSPECIFIED (default value)
0080      */
0081     int       orientationHint;
0082 
0083     /**
0084      * The file name (the name, not the directory)
0085      */
0086     QString   fileName;
0087 
0088     /**
0089      * The mime type of the original file.
0090      * Currently "image" or "video" otherwise empty.
0091      */
0092     QString   mimeType;
0093 
0094     /**
0095      * A custom identifier, if neither filePath nor uniqueHash are applicable.
0096      */
0097     QString   customIdentifier;
0098 };
0099 
0100 // ------------------------------------------------------------------------------------------
0101 
0102 class DIGIKAM_EXPORT ThumbnailInfoProvider
0103 {
0104 public:
0105 
0106     explicit ThumbnailInfoProvider()
0107     {
0108     };
0109 
0110     virtual ~ThumbnailInfoProvider()
0111     {
0112     };
0113 
0114     virtual ThumbnailInfo thumbnailInfo(const ThumbnailIdentifier&)=0;
0115 
0116 private:
0117 
0118     Q_DISABLE_COPY(ThumbnailInfoProvider)
0119 };
0120 
0121 } // namespace Digikam
0122 
0123 #endif // DIGIKAM_THUMB_NAIL_INFO_H