File indexing completed on 2024-05-05 04:33:15
0001 /* 0002 SPDX-FileCopyrightText: 2004-2018 Gilles Caulier <caulier dot gilles at gmail dot com> 0003 SPDX-FileCopyrightText: 2004-2005 Renchi Raju <renchi dot raju at gmail dot com> 0004 SPDX-FileCopyrightText: 2004-2005 Jesper K. Pedersen <blackie at kde dot org> 0005 SPDX-FileCopyrightText: 2004-2005 Aurelien Gateau <aurelien dot gateau at free dot fr> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #ifndef KIPI_IMAGEINFO_H 0011 #define KIPI_IMAGEINFO_H 0012 0013 // Qt includes 0014 0015 #include <QString> 0016 #include <QDateTime> 0017 #include <QMap> 0018 #include <QVariant> 0019 #include <QUrl> 0020 0021 // Local includes 0022 0023 #include "libkipi_export.h" 0024 0025 namespace KIPI 0026 { 0027 0028 class ImageInfoShared; 0029 0030 /** @class ImageInfo imageinfo.h <KIPI/ImageInfo> 0031 Holds info about an image from KIPI host application. 0032 0033 @note If you want to manage item properties from kipi-plugins, use wrapper class KIPIPlugins::KPImageInfo, 0034 not this class directly. See kipi-plugins/common/libkipi-plugins API for details. 0035 0036 @note This class must be re-implemented in KIPI host application through KIPI::ImageInfoShared. This implementation 0037 must be thread-safe, due to possible use into kipi plugins separated thread implementation in the future. 0038 */ 0039 class LIBKIPI_EXPORT ImageInfo 0040 { 0041 0042 public: 0043 0044 /** Constructor and interface for host application. 0045 */ 0046 ImageInfo(ImageInfoShared* const); 0047 ImageInfo(const ImageInfo&); 0048 ~ImageInfo(); 0049 0050 /** 0051 Returns a Map of attributes of the image. 0052 In case the host application supports some special attributes of the image, 0053 this function can be used to return them. Following attributes are supported: 0054 0055 <table><tr> 0056 <th>ATTRIBUTES</th> 0057 <th>VALUE RETURNED</th> 0058 <th>COMMENTS</th> 0059 </tr><tr> 0060 <th>"name"</th> 0061 <td>QString</td> 0062 <td>Returns name of item (usually file name).</td> 0063 </tr><tr> 0064 <th>"comment"</th> 0065 <td>QString</td> 0066 <td>Returns default item comment.</td> 0067 </tr><tr> 0068 <th>"date"</th> 0069 <td>QDateTime</td> 0070 <td>Returns date of item (usually the creation date). In the case the application supports date ranges (like this image is from 1998-2000), this attribute always return the start of date range.</td> 0071 </tr><tr> 0072 <th>"dateto"</th> 0073 <td>QDateTime</td> 0074 <td>In the case the application supports date ranges (like this image is from 1998-2000), this attribute returns the end of date range.</td> 0075 </tr><tr> 0076 <th>"isexactdate"</th> 0077 <td>bool value</td> 0078 <td>In the case the application supports date ranges (like this image is from 1998-2000), this attribute returns true if the date is an exact specification, and thus not a range.</td> 0079 </tr><tr> 0080 <th>"orientation"</th> 0081 <td>integer value</td> 0082 <td>Returns orientation information. See ExifOrientation values for details).</td> 0083 </tr><tr> 0084 <th>"title"</th> 0085 <td>QString</td> 0086 <td>Returns default item title.</td> 0087 </tr><tr> 0088 <th>"rating"</th> 0089 <td>integer value</td> 0090 <td>Returns item starts 0 <= rate <= 5).</td> 0091 </tr><tr> 0092 <th>"colorlabel"</th> 0093 <td>integer value</td> 0094 <td>Return item color flag 0 <= colorlabel <= 10.</td> 0095 </tr><tr> 0096 <th>"picklabel"</th> 0097 <td>integer value</td> 0098 <td>Return item workflow flag 0 <= picklabel <= 4.</td> 0099 </tr><tr> 0100 <th>"latitude"</th> 0101 <td>double value</td> 0102 <td>Return item latitude in degrees (-90.0 >= lat <=90.0).</td> 0103 </tr><tr> 0104 <th>"longitude"</th> 0105 <td>double value</td> 0106 <td>Return item longitude in degrees (-180.0 >= long <=180.0).</td> 0107 </tr><tr> 0108 <th>"altitude"</th> 0109 <td>double value</td> 0110 <td>Return item altitude in meters.</td> 0111 </tr><tr> 0112 <th>"tagspath"</th> 0113 <td>QStringList</td> 0114 <td>Return all tags path list of item, formatted as "Country/France/City/Paris" for ex.</td> 0115 </tr><tr> 0116 <th>"keywords"</th> 0117 <td>QStringList</td> 0118 <td>Return all tags name list (without path).</td> 0119 </tr><tr> 0120 <th>"filesize"</th> 0121 <td>qlonglong value</td> 0122 <td>Return item file size in bytes.</td> 0123 </tr><tr> 0124 <th>"creators"</th> 0125 <td>QStringList</td> 0126 <td>Return creators list of item.</td> 0127 </tr><tr> 0128 <th>"credit"</th> 0129 <td>QString</td> 0130 <td>Return credit of item.</td> 0131 </tr><tr> 0132 <th>"rights"</th> 0133 <td>QString</td> 0134 <td>Return rights of item.</td> 0135 </tr><tr> 0136 <th>"source"</th> 0137 <td>QString</td> 0138 <td>Return source of item.</td> 0139 </tr><tr> 0140 <th>"tags"</th> 0141 <td>QStringList</td> 0142 <td>For compatibility. DEPRECATED and replaced by "keywords" attribute.</td> 0143 </tr><tr> 0144 <th>"angle"</th> 0145 <td>integer value</td> 0146 <td>For compatibility. DEPRECATED and replaced by "orientation" attribute.</td> 0147 </tr></table> 0148 */ 0149 QMap<QString, QVariant> attributes() const; 0150 0151 /** Set the attributes defined from the map to the image. Following keys/values are the same the attributes(), 0152 * excepted "keywords", "filesize", and "isexactdate" properties which are read-only values. 0153 */ 0154 void addAttributes(const QMap<QString, QVariant>&); 0155 0156 /** Remove attributes listed from the image. Following values can be used: 0157 0158 <table><tr> 0159 <th>ATTRIBUTES</th> 0160 <th>COMMENTS</th> 0161 </tr><tr> 0162 <th>"comment"</th> 0163 <td>Remove all comments.</td> 0164 </tr><tr> 0165 <th>"date"</th> 0166 <td>Remove date info.</td> 0167 </tr><tr> 0168 <th>"orientation"</th> 0169 <td>Remove orientation info.</td> 0170 </tr><tr> 0171 <th>"title"</th> 0172 <td>Remove all titles.</td> 0173 </tr><tr> 0174 <th>"rating"</th> 0175 <td>Remove rating info.</td> 0176 </tr><tr> 0177 <th>"colorlabel"</th> 0178 <td>Remove color labels info.</td> 0179 </tr><tr> 0180 <th>"picklabel"</th> 0181 <td>Remove pick labels info.</td> 0182 </tr><tr> 0183 <th>"gpslocation"</th> 0184 <td>Return item altitude in meters.</td> 0185 </tr><tr> 0186 <th>"tagspath"</th> 0187 <td>Remove all tags path.</td> 0188 </tr><tr> 0189 <th>"copyrights"</th> 0190 <td>Remove all copyrights info.</td> 0191 </tr><tr> 0192 <th>"tags"</th> 0193 <td>For compatibility. DEPRECATED and replaced by "keywords" attribute.</td> 0194 </tr><tr> 0195 <th>"angle"</th> 0196 <td>For compatibility. DEPRECATED and replaced by "orientation" attribute.</td> 0197 </tr></table> 0198 */ 0199 void delAttributes(const QStringList&); 0200 0201 /** Remove all attribute from the image. See delAttributes() for list of all attributes removed. 0202 */ 0203 void clearAttributes(); 0204 0205 /** Copies all the attributes from the other imageinfo. 0206 */ 0207 void cloneData(const ImageInfo& other); 0208 0209 /** Return item URL. 0210 */ 0211 QUrl url() const; 0212 0213 private: 0214 0215 ImageInfo(); /// Disable 0216 ImageInfo& operator=(const ImageInfo&); /// Disable 0217 0218 private: 0219 0220 mutable ImageInfoShared* d; 0221 }; 0222 0223 } // namespace KIPI 0224 0225 #endif /* KIPI_IMAGEINFO_H */