Krita Source Code Documentation
Loading...
Searching...
No Matches
KisPreExportChecker Class Reference

#include <KisPreExportChecker.h>

Public Member Functions

bool check (KisImageSP image, QMap< QString, KisExportCheckBase * > filterChecks)
 check checks the image against the capabilities of the export filter
 
QStringList errors () const
 
 KisPreExportChecker ()
 
QStringList warnings () const
 

Private Attributes

QStringList m_errors
 
QStringList m_warnings
 

Detailed Description

Definition at line 16 of file KisPreExportChecker.h.

Constructor & Destructor Documentation

◆ KisPreExportChecker()

KisPreExportChecker::KisPreExportChecker ( )

Definition at line 13 of file KisPreExportChecker.cpp.

14{
16}
static KisExportCheckRegistry * instance()

References KisExportCheckRegistry::instance().

Member Function Documentation

◆ check()

bool KisPreExportChecker::check ( KisImageSP image,
QMap< QString, KisExportCheckBase * > filterChecks )

check checks the image against the capabilities of the export filter

Parameters
imagethe current image
filterChecksthe list of capabilities the filter possesses
Returns
true if no warnings and no conversions are needed

Definition at line 18 of file KisPreExportChecker.cpp.

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}
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
bool check(KisImageSP image, QMap< QString, KisExportCheckBase * > filterChecks)
check checks the image against the capabilities of the export filter
T get(const QString &id) const

References KisExportCheckBase::check(), check(), KisExportCheckFactory::create(), KoGenericRegistry< T >::get(), KisExportCheckRegistry::instance(), m_errors, m_warnings, KisExportCheckBase::PARTIALLY, KisExportCheckBase::SUPPORTED, KisExportCheckBase::UNSUPPORTED, and KisExportCheckBase::warning().

◆ errors()

QStringList KisPreExportChecker::errors ( ) const

Definition at line 59 of file KisPreExportChecker.cpp.

60{
61 return m_errors;
62}

References m_errors.

◆ warnings()

QStringList KisPreExportChecker::warnings ( ) const

Definition at line 65 of file KisPreExportChecker.cpp.

66{
67 return m_warnings;
68}

References m_warnings.

Member Data Documentation

◆ m_errors

QStringList KisPreExportChecker::m_errors
private

Definition at line 33 of file KisPreExportChecker.h.

◆ m_warnings

QStringList KisPreExportChecker::m_warnings
private

Definition at line 34 of file KisPreExportChecker.h.


The documentation for this class was generated from the following files: