1 // SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
2 // SPDX-FileCopyrightText: 2021 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
3 //
4 // SPDX-License-Identifier: GPL-2.0-or-later
5 
6 #ifndef EXIF_INFO_H
7 #define EXIF_INFO_H
8 #include <kpabase/StringSet.h>
9 
10 #include <exiv2/exif.hpp>
11 #include <exiv2/iptc.hpp>
12 #include <qmap.h>
13 #include <qstringlist.h>
14 
15 namespace DB
16 {
17 class FileName;
18 }
19 
20 namespace Exif
21 {
22 
23 using Utilities::StringSet;
24 
25 struct Metadata {
26     Exiv2::ExifData exif;
27     Exiv2::IptcData iptc;
28     std::string comment;
29 };
30 
31 class Info
32 {
33 public:
34     Info();
35     static Info *instance();
36     QMap<QString, QStringList> info(const DB::FileName &fileName, StringSet wantedKeys, bool returnFullExifName, const QString &charset);
37     QMap<QString, QStringList> infoForViewer(const DB::FileName &fileName, const QString &charset);
38     QMap<QString, QStringList> infoForDialog(const DB::FileName &fileName, const QString &charset);
39     StringSet availableKeys();
40     StringSet standardKeys();
41     Metadata metadata(const DB::FileName &fileName);
42 
43 protected:
44     DB::FileName exifInfoFile(const DB::FileName &fileName);
45 
46 private:
47     static Info *s_instance;
48     StringSet m_keys;
49 };
50 
51 /**
52      * @brief Writes the exif information from one file to another.
53      * The given description is overwrites the exif description field of the destination file.
54      * @param srcName the image file in the database
55      * @param destName the destination image file
56      * @param imageDescription the image description text (usually DB::ImageInfo::description())
57      */
58 void writeExifInfoToFile(const DB::FileName &srcName, const QString &destName, const QString &imageDescription);
59 
60 }
61 
62 #endif /* EXIF_INFO_H */
63 
64 // vi:expandtab:tabstop=4 shiftwidth=4:
65