Krita Source Code Documentation
Loading...
Searching...
No Matches
AbrTagIterator Class Reference
+ Inheritance diagram for AbrTagIterator:

Public Member Functions

 AbrTagIterator (KisAbrBrushCollectionSP brushCollection, const QString &location, const QString &resourceType)
 
bool hasNext () const override
 
void next () override
 The iterator is only valid if next() has been called at least once.
 
KisTagSP tag () const override
 A tag object on which we can set properties and which we can save.
 
- Public Member Functions inherited from KisResourceStorage::TagIterator
virtual ~TagIterator ()
 

Private Attributes

KisAbrBrushCollectionSP m_brushCollection
 
QString m_location
 
QString m_resourceType
 
bool m_taggingDone {false}
 

Detailed Description

Definition at line 18 of file KisAbrStorage.cpp.

Constructor & Destructor Documentation

◆ AbrTagIterator()

AbrTagIterator::AbrTagIterator ( KisAbrBrushCollectionSP brushCollection,
const QString & location,
const QString & resourceType )
inline

Definition at line 21 of file KisAbrStorage.cpp.

22 : m_brushCollection(brushCollection)
23 , m_location(location)
24 , m_resourceType(resourceType)
25 {}
KisAbrBrushCollectionSP m_brushCollection

Member Function Documentation

◆ hasNext()

bool AbrTagIterator::hasNext ( ) const
inlineoverridevirtual

Implements KisResourceStorage::TagIterator.

Definition at line 27 of file KisAbrStorage.cpp.

27 {
28 if (m_resourceType != ResourceType::Brushes) return false;
29 return !m_taggingDone;
30 }
const QString Brushes

References ResourceType::Brushes, m_resourceType, and m_taggingDone.

◆ next()

void AbrTagIterator::next ( )
inlineoverridevirtual

The iterator is only valid if next() has been called at least once.

Implements KisResourceStorage::TagIterator.

Definition at line 32 of file KisAbrStorage.cpp.

32{ m_taggingDone = true; }

References m_taggingDone.

◆ tag()

KisTagSP AbrTagIterator::tag ( ) const
inlineoverridevirtual

A tag object on which we can set properties and which we can save.

Implements KisResourceStorage::TagIterator.

Definition at line 34 of file KisAbrStorage.cpp.

35 {
36 KisTagSP abrTag(new KisTag());
37 abrTag->setUrl(QFileInfo(m_location).fileName());
38 abrTag->setName(QFileInfo(m_location).fileName());
39 abrTag->setComment(QFileInfo(m_location).fileName());
40 abrTag->setFilename(QFileInfo(m_location).fileName());
41 abrTag->setResourceType(m_resourceType);
42 abrTag->setValid(true);
43 QStringList brushes;
44 Q_FOREACH(const KisAbrBrushSP brush, m_brushCollection->brushes()) {
45 brushes << brush->filename();
46 }
47 abrTag->setDefaultResources(brushes);
48
49 return abrTag;
50 }
The KisTag loads a tag from a .tag file. A .tag file is a .desktop file. The following fields are imp...
Definition KisTag.h:34

References m_brushCollection, m_location, and m_resourceType.

Member Data Documentation

◆ m_brushCollection

KisAbrBrushCollectionSP AbrTagIterator::m_brushCollection
private

Definition at line 55 of file KisAbrStorage.cpp.

◆ m_location

QString AbrTagIterator::m_location
private

Definition at line 56 of file KisAbrStorage.cpp.

◆ m_resourceType

QString AbrTagIterator::m_resourceType
private

Definition at line 57 of file KisAbrStorage.cpp.

◆ m_taggingDone

bool AbrTagIterator::m_taggingDone {false}
private

Definition at line 54 of file KisAbrStorage.cpp.

54{false};

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