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 * Copyright (C) 2006-2014 by Marcel Wiesweg <marcel dot wiesweg at gmx dot 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 DIGIKAM_THUMB_NAIL_INFO_H 25 #define DIGIKAM_THUMB_NAIL_INFO_H 26 27 // Qt includes 28 29 #include <QDateTime> 30 #include <QString> 31 32 // Local includes 33 34 #include "digikam_export.h" 35 36 namespace Digikam 37 { 38 39 class DIGIKAM_EXPORT ThumbnailIdentifier 40 { 41 public: 42 43 ThumbnailIdentifier(); 44 explicit ThumbnailIdentifier(const QString& filePath); 45 46 /** 47 * The file path from which the thumbnail shall be generated 48 */ 49 QString filePath; 50 51 /** 52 * The database id, which needs to be translated to uniqueHash + fileSize 53 */ 54 qlonglong id; 55 }; 56 57 class DIGIKAM_EXPORT ThumbnailInfo : public ThumbnailIdentifier 58 { 59 public: 60 61 explicit ThumbnailInfo(); ~ThumbnailInfo()62 ~ThumbnailInfo() 63 { 64 }; 65 66 /** 67 * If available, the uniqueHash + fileSize pair for identification 68 * of the original file by content. 69 */ 70 QString uniqueHash; 71 qlonglong fileSize; 72 73 /** 74 * If the original file is at all accessible on disk. 75 * May be false if a file on a removable device is used. 76 */ 77 bool isAccessible; 78 79 /** 80 * The modification date of the original file. 81 * Thumbnail will be regenerated if thumb's modification date is older than this. 82 */ 83 QDateTime modificationDate; 84 85 /** 86 * Gives a hint at the orientation of the image. 87 * This can be used to supersede the Exif information in the file. 88 * Will not be used if DMetadata::ORIENTATION_UNSPECIFIED (default value) 89 */ 90 int orientationHint; 91 92 /** 93 * The file name (the name, not the directory) 94 */ 95 QString fileName; 96 97 /** 98 * The mime type of the original file. 99 * Currently "image" or "video" otherwise empty. 100 */ 101 QString mimeType; 102 103 /** 104 * A custom identifier, if neither filePath nor uniqueHash are applicable. 105 */ 106 QString customIdentifier; 107 }; 108 109 // ------------------------------------------------------------------------------------------ 110 111 class DIGIKAM_EXPORT ThumbnailInfoProvider 112 { 113 public: 114 ThumbnailInfoProvider()115 explicit ThumbnailInfoProvider() 116 { 117 }; 118 ~ThumbnailInfoProvider()119 virtual ~ThumbnailInfoProvider() 120 { 121 }; 122 123 virtual ThumbnailInfo thumbnailInfo(const ThumbnailIdentifier&)=0; 124 125 private: 126 127 Q_DISABLE_COPY(ThumbnailInfoProvider) 128 }; 129 130 } // namespace Digikam 131 132 #endif // DIGIKAM_THUMB_NAIL_INFO_H 133