1 /* 2 * Copyright (C) 2016 Boudewijn Rempt <boud@valdyas.org> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public License 15 * along with this library; see the file COPYING.LIB. If not, write to 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef ExifCHECK_H 21 #define ExifCHECK_H 22 23 #include "KisExportCheckRegistry.h" 24 #include <KoID.h> 25 #include <klocalizedstring.h> 26 #include <kis_image.h> 27 #include <KoColorSpace.h> 28 #include <kis_meta_data_store.h> 29 #include <kis_meta_data_filter_registry_model.h> 30 #include <kis_exif_info_visitor.h> 31 32 class ExifCheck : public KisExportCheckBase 33 { 34 public: 35 36 ExifCheck(const QString &id, Level level, const QString &customWarning = QString()) KisExportCheckBase(id,level,customWarning)37 : KisExportCheckBase(id, level, customWarning) 38 { 39 if (customWarning.isEmpty()) { 40 m_warning = i18nc("image conversion warning", "The image contains <b>Exif</b> metadata. The metadata will not be saved."); 41 } 42 } 43 checkNeeded(KisImageSP image)44 bool checkNeeded(KisImageSP image) const override 45 { 46 KisExifInfoVisitor eIV; 47 eIV.visit(image->rootLayer().data()); 48 return eIV.exifInfo(); 49 } 50 check(KisImageSP)51 Level check(KisImageSP /*image*/) const override 52 { 53 return m_level; 54 } 55 56 }; 57 58 class ExifCheckFactory : public KisExportCheckFactory 59 { 60 public: 61 ExifCheckFactory()62 ExifCheckFactory() 63 { 64 } 65 ~ExifCheckFactory()66 ~ExifCheckFactory() override {} 67 create(KisExportCheckBase::Level level,const QString & customWarning)68 KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override 69 { 70 return new ExifCheck(id(), level, customWarning); 71 } 72 id()73 QString id() const override { 74 return "ExifCheck"; 75 } 76 77 }; 78 79 #endif // ExifCHECK_H 80