Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPreExportChecker.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2016 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
10
11#include <kis_image.h>
12
17
18bool KisPreExportChecker::check(KisImageSP image, QMap<QString, KisExportCheckBase*> filterChecks)
19{
20 bool doPerLayerChecks = false;
21 if (filterChecks.contains("MultiLayerCheck") && filterChecks["MultiLayerCheck"]->check(image) == KisExportCheckBase::SUPPORTED) {
22 doPerLayerChecks = true;
23 }
24
25 Q_FOREACH(const QString &id, KisExportCheckRegistry::instance()->keys()) {
26
29
30 if (!doPerLayerChecks && check->perLayerCheck()) {
31 continue;
32 }
33
34 if (check->checkNeeded(image)) {
35 if (!filterChecks.contains(id)) {
36 m_warnings << check->warning();
37 }
38 else {
39 KisExportCheckBase *filterCheck = filterChecks[id];
40 KisExportCheckBase::Level level = filterCheck->check(image);
41 QString warning = filterCheck->warning();
42
43 if (level == KisExportCheckBase::PARTIALLY) {
44 m_warnings << warning;
45 }
46 else if (level == KisExportCheckBase::UNSUPPORTED) {
47 m_errors << warning;
48 }
49 else {
50 continue;
51 }
52 }
53 }
54 delete check;
55 }
56 return m_warnings.isEmpty() && m_errors.isEmpty();
57}
58
63
64
69
The KisExportCheckBase class defines the interface of the individual checks of an export filter's cap...
virtual Level check(KisImageSP image) const =0
virtual KisExportCheckBase * create(KisExportCheckBase::Level level, const QString &customWarning=QString())=0
static KisExportCheckRegistry * instance()
bool check(KisImageSP image, QMap< QString, KisExportCheckBase * > filterChecks)
check checks the image against the capabilities of the export filter
QStringList errors() const
QStringList warnings() const
T get(const QString &id) const