1 | /* |
2 | * This file is part of KFileMetaData |
3 | * Copyright (C) 2014 Vishesh Handa <me@vhanda.in> |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it under the terms of the GNU Lesser General Public |
7 | * License as published by the Free Software Foundation; either |
8 | * version 2.1 of the License, or (at your option) any later version. |
9 | * |
10 | * This library is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | * Lesser General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU Lesser General Public |
16 | * License along with this library; if not, write to the Free Software |
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18 | * |
19 | */ |
20 | |
21 | #ifndef KFILEMETADATA_PROPERTIES |
22 | #define KFILEMETADATA_PROPERTIES |
23 | |
24 | #include <QMap> |
25 | #include <QVariant> |
26 | |
27 | namespace KFileMetaData { |
28 | namespace Property { |
29 | |
30 | enum Property { |
31 | FirstProperty = 0, |
32 | Empty = 0, |
33 | |
34 | // Audio |
35 | BitRate, |
36 | Channels, |
37 | Duration, |
38 | Genre, |
39 | SampleRate, |
40 | TrackNumber, |
41 | ReleaseYear, |
42 | |
43 | // Maybe merge this with the description? |
44 | , |
45 | |
46 | // Music |
47 | Artist, |
48 | Album, |
49 | AlbumArtist, |
50 | Composer, |
51 | Lyricist, |
52 | |
53 | // Documents |
54 | Author, |
55 | Title, |
56 | Subject, |
57 | Creator, |
58 | Generator, // What's the difference? |
59 | PageCount, |
60 | WordCount, |
61 | LineCount, |
62 | Langauge, |
63 | Copyright, |
64 | Publisher, |
65 | Description, |
66 | CreationDate, |
67 | Keywords, |
68 | |
69 | Width, |
70 | Height, |
71 | AspectRatio, |
72 | FrameRate, |
73 | |
74 | // Images |
75 | ImageMake, |
76 | ImageModel, |
77 | ImageDateTime, |
78 | ImageOrientation, |
79 | PhotoFlash, |
80 | PhotoPixelXDimension, |
81 | PhotoPixelYDimension, |
82 | PhotoDateTimeOriginal, |
83 | PhotoFocalLength, |
84 | PhotoFocalLengthIn35mmFilm, |
85 | PhotoExposureTime, |
86 | PhotoFNumber, |
87 | PhotoApertureValue, |
88 | PhotoExposureBiasValue, |
89 | PhotoWhiteBalance, |
90 | PhotoMeteringMode, |
91 | PhotoISOSpeedRatings, |
92 | PhotoSaturation, |
93 | PhotoSharpness, |
94 | |
95 | LastProperty = PhotoSharpness |
96 | }; |
97 | |
98 | } // namespace Property |
99 | |
100 | typedef QMap<Property::Property, QVariant> PropertyMap; |
101 | |
102 | inline QVariantMap toVariantMap(const PropertyMap& propMap) { |
103 | QVariantMap varMap; |
104 | PropertyMap::const_iterator it = propMap.constBegin(); |
105 | for (; it != propMap.constEnd(); ++it) { |
106 | int p = static_cast<int>(it.key()); |
107 | varMap.insertMulti(QString::number(p), it.value()); |
108 | } |
109 | |
110 | return varMap; |
111 | } |
112 | |
113 | inline PropertyMap toPropertyMap(const QVariantMap& varMap) { |
114 | PropertyMap propMap; |
115 | QVariantMap::const_iterator it = varMap.constBegin(); |
116 | for (; it != varMap.constEnd(); ++it) { |
117 | int p = it.key().toInt(); |
118 | propMap.insertMulti(static_cast<Property::Property>(p), it.value()); |
119 | } |
120 | |
121 | return propMap; |
122 | } |
123 | |
124 | } // namespace KFileMetaData |
125 | |
126 | #endif |
127 | |