Krita Source Code Documentation
Loading...
Searching...
No Matches
KisTag.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 Boudewijn Rempt <boud@valdyas.org>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KISTAGLOADER_H
8#define KISTAGLOADER_H
9
10#include <QDebug>
11#include <QString>
12#include <QScopedPointer>
13#include <QSharedPointer>
14
15class QIODevice;
16
17#include "kritaresources_export.h"
18
19class KisTag;
21
33class KRITARESOURCES_EXPORT KisTag
34{
35public:
36 KisTag();
37 virtual ~KisTag();
38 KisTag(const KisTag &rhs);
39 KisTag &operator=(const KisTag &rhs);
40 KisTagSP clone() const;
41
42 static QString currentLocale();
43
44 bool valid() const;
45
46 int id() const;
47 bool active() const;
48
49 QString filename();
50 void setFilename(const QString &fileName);
51
53 QString url() const;
54 void setUrl(const QString &url);
55
57 QString name(bool translated = true) const;
58 void setName(const QString &name);
59 QMap<QString, QString> names() const;
60 void setNames(const QMap<QString, QString> &names);
61
63 QString comment(bool translated = true) const;
64 void setComment(const QString comment);
65 QMap<QString, QString> comments() const;
66 void setComments(const QMap<QString, QString> &comments);
67
68 QString resourceType() const;
69 void setResourceType(const QString &resourceType);
70
71 QStringList defaultResources() const;
72 void setDefaultResources(const QStringList &defaultResources);
73
74 bool load(QIODevice &io);
75 bool save(QIODevice &io);
76
77private:
78
79 friend class KisTagModel;
80 friend class KisAllTagsModel;
83 friend class KisResourceModel;
84 friend class KisTagChooserWidget;
85 friend class TestTagModel;
86 friend class KisResourceLocator;
87 friend class BundleTagIterator;
88 friend class AbrTagIterator;
89
90 void setId(int id);
91 void setActive(bool active);
92 void setValid(bool valid);
93
94 static const QString s_group;
95 static const QString s_type;
96 static const QString s_tag;
97 static const QString s_name;
98 static const QString s_resourceType;
99 static const QString s_url;
100 static const QString s_comment;
101 static const QString s_defaultResources;
102 static const QString s_desktop;
103
104 class Private;
105 QScopedPointer<Private> d;
106};
107
108
109inline QDebug operator<<(QDebug dbg, const KisTagSP tag)
110{
111 if (tag) {
112 dbg.space() << "[TAG] Name" << tag->name()
113 << "Url" << tag->url()
114 << "Comment" << tag->comment()
115 << "Default resources" << tag->defaultResources().join(", ");
116 } else {
117 dbg.space() << "[TAG] NULL";
118 }
119
120 return dbg.space();
121}
122
124
125#endif // KISTAGLOADER_H
QDebug operator<<(QDebug dbg, const KisTagSP tag)
Definition KisTag.h:109
QSharedPointer< KisTag > KisTagSP
Definition KisTag.h:20
static QString currentLocale()
The KisAllresourcesModel class provides access to the cache database for a particular resource type....
The KisResourceModel class provides the main access to resources. It is possible to filter the resour...
The KisTagChooserWidget class is responsible for all the logic that the tags combobox has in various ...
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
QScopedPointer< Private > d
Definition KisTag.h:105
Q_DECLARE_METATYPE(KisPaintopLodLimitations)