Krita Source Code Documentation
Loading...
Searching...
No Matches
ExifCheck.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef ExifCHECK_H
8#define ExifCHECK_H
9
11#include <KoID.h>
12#include <klocalizedstring.h>
13#include <kis_assert.h>
14#include <kis_image.h>
15#include <KoColorSpace.h>
16#include <kis_meta_data_store.h>
19
21{
22public:
23
24 ExifCheck(const QString &id, Level level, const QString &customWarning = QString())
25 : KisExportCheckBase(id, level, customWarning)
26 {
27 if (customWarning.isEmpty()) {
28 m_warning = i18nc("image conversion warning", "The image contains <b>Exif</b> metadata. The metadata will not be saved.");
29 }
30 }
31
32 bool checkNeeded(KisImageSP image) const override
33 {
35 eIV.visit(image->rootLayer().data());
36 return eIV.exifInfo();
37 }
38
39 Level check(KisImageSP /*image*/) const override
40 {
41 return m_level;
42 }
43
44};
45
47{
48public:
49
51 {
52 }
53
54 ~ExifCheckFactory() override {}
55
56 KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
57 {
58 return new ExifCheck(id(), level, customWarning);
59 }
60
61 QString id() const override {
62 return "ExifCheck";
63 }
64
65};
66
68{
69public:
70 TiffExifCheck(const QString &id, Level level, const QString &customWarning = QString())
71 : KisExportCheckBase(id, level, customWarning)
72 {
73 if (customWarning.isEmpty()) {
74 m_warning = i18nc("image conversion warning",
75 "The image has <b>Exif</b> metadata and multiple layers. Only metadata <b>in the first "
76 "layer</b> will be saved.");
77 }
78 }
79
80 bool checkNeeded(KisImageSP image) const override
81 {
84 eIV.visit(image->rootLayer().data());
85 return eIV.exifInfo() && image->rootLayer()->childCount() > 1;
86 }
87
88 Level check(KisImageSP /*image*/) const override
89 {
90 return m_level;
91 }
92};
93
95{
96public:
100
102 {
103 }
104
105 KisExportCheckBase *create(KisExportCheckBase::Level level, const QString &customWarning) override
106 {
107 return new TiffExifCheck(id(), level, customWarning);
108 }
109
110 QString id() const override
111 {
112 return "TiffExifCheck";
113 }
114};
115
116#endif // ExifCHECK_H
KisExportCheckBase * create(KisExportCheckBase::Level level, const QString &customWarning) override
Definition ExifCheck.h:56
QString id() const override
Definition ExifCheck.h:61
~ExifCheckFactory() override
Definition ExifCheck.h:54
Level check(KisImageSP) const override
Definition ExifCheck.h:39
ExifCheck(const QString &id, Level level, const QString &customWarning=QString())
Definition ExifCheck.h:24
bool checkNeeded(KisImageSP image) const override
Definition ExifCheck.h:32
The KisExifInfoVisitor class looks for a layer with metadata.
KisMetaData::Store * exifInfo()
bool visit(KisNode *) override
The KisExportCheckBase class defines the interface of the individual checks of an export filter's cap...
virtual QString id() const
KisGroupLayerSP rootLayer() const
KisExportCheckBase * create(KisExportCheckBase::Level level, const QString &customWarning) override
Definition ExifCheck.h:105
QString id() const override
Definition ExifCheck.h:110
~TiffExifCheckFactory() override
Definition ExifCheck.h:101
TiffExifCheck(const QString &id, Level level, const QString &customWarning=QString())
Definition ExifCheck.h:70
Level check(KisImageSP) const override
Definition ExifCheck.h:88
bool checkNeeded(KisImageSP image) const override
Definition ExifCheck.h:80
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:85
quint32 childCount() const
Definition kis_node.cpp:414