File indexing completed on 2024-04-28 15:39:55

0001 // SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org>
0002 // SPDX-FileCopyrightText: 2021 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
0003 //
0004 // SPDX-License-Identifier: GPL-2.0-or-later
0005 
0006 #ifndef FILEINFO_H
0007 #define FILEINFO_H
0008 
0009 #include "ExifMode.h"
0010 
0011 #include <kpaexif/Info.h>
0012 
0013 #include <Utilities/FastDateTime.h>
0014 #include <qstring.h>
0015 
0016 namespace DB
0017 {
0018 class FileName;
0019 
0020 class FileInfo
0021 {
0022 public:
0023     static FileInfo read(const DB::FileName &fileName, DB::ExifMode mode);
0024     Utilities::FastDateTime dateTime() { return m_date; }
0025     int angle() { return m_angle; }
0026     QString description() { return m_description; }
0027     Exiv2::ExifData &getExifData();
0028     const DB::FileName &getFileName() const;
0029 
0030 protected:
0031     void parseEXIV2(const DB::FileName &fileName);
0032     Utilities::FastDateTime fetchEXIV2Date(Exiv2::ExifData &map, const char *key);
0033 
0034     int orientationToAngle(int orientation);
0035 
0036 private:
0037     FileInfo(const DB::FileName &fileName, DB::ExifMode mode);
0038     bool updateDataFromFileTimeStamp(const DB::FileName &fileName, DB::ExifMode mode);
0039     Utilities::FastDateTime m_date;
0040     int m_angle;
0041     QString m_description;
0042     Exiv2::ExifData m_exifMap;
0043     const DB::FileName &m_fileName;
0044 };
0045 
0046 }
0047 
0048 #endif /* FILEINFO_H */
0049 
0050 // vi:expandtab:tabstop=4 shiftwidth=4: