1 /* ============================================================ 2 * 3 * Date : 2008-02-10 4 * Description : a tool to fix automatically camera lens aberrations 5 * 6 * Copyright (C) 2008 by Adrian Schroeter <adrian at suse dot de> 7 * Copyright (C) 2008-2021 by Gilles Caulier <caulier dot gilles at gmail dot com> 8 * 9 * This program is free software; you can redistribute it 10 * and/or modify it under the terms of the GNU General 11 * Public License as published by the Free Software Foundation; 12 * either version 2, or (at your option) 13 * any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * ============================================================ */ 21 22 #ifndef DIGIKAM_LENS_FUN_IFACE_H 23 #define DIGIKAM_LENS_FUN_IFACE_H 24 25 // LensFun includes 26 27 /* 28 * Pragma directives to reduce warnings from Lensfun header files. 29 * 30 * TODO: lensfun version > 0.3.2 introduce deprecated methods for the future. 31 * digiKam Code need to be ported to new API when Lensfun 0.4.0 will be releaed. 32 * 33 */ 34 #if defined(Q_CC_GNU) 35 # pragma GCC diagnostic push 36 # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" 37 # pragma GCC diagnostic ignored "-Wdeprecated-declarations" 38 #endif 39 40 #if defined(Q_CC_CLANG) 41 # pragma clang diagnostic push 42 # pragma clang diagnostic ignored "-Wmismatched-tags" 43 # pragma clang diagnostic ignored "-Wdeprecated-declarations" 44 #endif 45 46 #include <lensfun.h> 47 48 // Restore warnings 49 #if defined(Q_CC_GNU) 50 # pragma GCC diagnostic pop 51 #endif 52 53 #if defined(Q_CC_CLANG) 54 # pragma clang diagnostic pop 55 #endif 56 57 // Local includes 58 59 #include "dmetadata.h" 60 #include "digikam_export.h" 61 #include "lensfunfilter.h" 62 63 namespace Digikam 64 { 65 66 class DIGIKAM_EXPORT LensFunIface 67 { 68 public: 69 70 typedef const lfCamera* DevicePtr; 71 typedef const lfLens* LensPtr; 72 typedef QList<LensPtr> LensList; 73 74 enum MetadataMatch 75 { 76 MetadataUnavailable = -2, 77 MetadataNoMatch = -1, 78 MetadataPartialMatch = 0, 79 MetadataExactMatch = 1 80 }; 81 82 public: 83 84 explicit LensFunIface(); 85 ~LensFunIface(); 86 87 void setFilterSettings(const LensFunContainer& other); 88 89 void setSettings(const LensFunContainer& other); 90 LensFunContainer settings() const; 91 92 LensPtr usedLens() const; 93 void setUsedLens(LensPtr lens); 94 95 DevicePtr usedCamera() const; 96 void setUsedCamera(DevicePtr cam); 97 98 lfDatabase* lensFunDataBase() const; 99 const lfCamera* const* lensFunCameras() const; 100 101 DevicePtr findCamera(const QString& make, const QString& model) const; 102 LensPtr findLens(const QString& model) const; 103 104 MetadataMatch findFromMetadata(DMetadata* const meta); 105 106 bool supportsDistortion() const; 107 bool supportsCCA() const; 108 bool supportsVig() const; 109 bool supportsGeometry() const; 110 111 /** 112 * Return Camera maker string description found in metadata 113 */ 114 QString makeDescription() const; 115 116 /** 117 *Return Camera model string description found in metadata 118 */ 119 QString modelDescription() const; 120 121 /** 122 * Return Lens string description found in metadata 123 */ 124 QString lensDescription() const; 125 126 static QString lensFunVersion(); 127 128 private: 129 130 QString metadataMatchDebugStr(MetadataMatch val) const; 131 LensList findLenses(const lfCamera* const camera, 132 const QString& lensDesc, 133 const QString& lensMaker=QString()) const; 134 135 double checkSimilarity(const QString& a, const QString& b) const; 136 137 private: 138 139 // Disable 140 LensFunIface(const LensFunIface&) = delete; 141 LensFunIface& operator=(const LensFunIface&) = delete; 142 143 private: 144 145 class Private; 146 Private* const d; 147 }; 148 149 } // namespace Digikam 150 151 Q_DECLARE_METATYPE(Digikam::LensFunIface::DevicePtr) 152 Q_DECLARE_METATYPE(Digikam::LensFunIface::LensPtr) 153 154 #endif // DIGIKAM_LENS_FUN_IFACE_H 155