Krita Source Code Documentation
Loading...
Searching...
No Matches
KoResourceBundle.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014 Victor Lafon metabolic.ewilan @hotmail.fr
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#ifndef KORESOURCEBUNDLE_H
8#define KORESOURCEBUNDLE_H
9
10#include <QSet>
11#include <QList>
12#include <QSharedPointer>
13#include <QDomDocument>
14
15#include <KoXmlWriter.h>
16
17#include <KoResource.h>
19
20#include "kritaresources_export.h"
21
22#include <KisTag.h>
23
24class KoStore;
25
31class KRITARESOURCES_EXPORT KoResourceBundle
32{
33
34public:
38 KoResourceBundle(QString const& fileName);
39
43 virtual ~KoResourceBundle();
44
49 QString defaultFileExtension() const;
50
55 bool load();
56 bool loadFromDevice(QIODevice *dev);
57
62 bool save();
63
64 bool saveToDevice(QIODevice* dev) const;
65
71 void setMetaData(const QString &key, const QString &value);
72 const QString metaData(const QString &key, const QString &defaultValue = QString()) const;
73
79 void addResource(QString fileType, QString filePath, QVector<KisTagSP> fileTagList, const QString md5sum, const int resourceId = -1, const QString filenameInBundle = "");
80
81 QList<QString> getTagsList();
82
83 void setThumbnail(QImage);
84
89 void saveMetadata(QScopedPointer<KoStore> &store);
90
95 void saveManifest(QScopedPointer<KoStore> &store);
96
97 QStringList resourceTypes() const;
98 int resourceCount() const;
99
100 KoResourceBundleManifest &manifest();
101
102 KoResourceSP resource(const QString &resourceType, const QString &filepath);
103 bool exportResource(const QString &resourceType, const QString &fileName, QIODevice *device);
104 bool loadResource(KoResourceSP resource);
105
106 QImage image() const;
107
108 QString filename() const;
109
110 QString resourceMd5(const QString &url);
111private:
112
113 void writeMeta(const QString &metaTag, KoXmlWriter *writer);
114 void writeUserDefinedMeta(const QString &metaTag, KoXmlWriter *writer);
115 bool readMetaData(KoStore *resourceStore);
116
117private:
120 QMap<QString, QString> m_metadata;
121 QSet<QString> m_bundletags;
128 QString m_filename;
130
131};
132
134
135#endif // KORESOURCEBUNDLE_H
float value(const T *src, size_t ch)
QSharedPointer< KoResourceBundle > KoResourceBundleSP
A KoResourceBundle is a zip file that contains resources, some metadata about the creator of the bund...
QMap< QString, QString > m_metadata
QList< QByteArray > m_patternsMd5Installed
QList< QByteArray > m_brushesMd5Installed
QList< QByteArray > m_gradientsMd5Installed
QSet< QString > m_bundletags
QList< QByteArray > m_workspacesMd5Installed
QList< QByteArray > m_presetsMd5Installed
QList< QByteArray > m_palettesMd5Installed
KoResourceBundleManifest m_manifest
bool loadFromDevice(QIODevice *)