Krita Source Code Documentation
Loading...
Searching...
No Matches
KoSvgSymbolCollectionResource.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 SPDX-FileCopyrightText: 2017 Boudewijn Rempt <boud@valdyas.org>
3
4 SPDX-License-Identifier: LGPL-2.1-or-later
5
6 */
7#ifndef KOSVGSYMBOLCOLLECTIONRESOURCE
8#define KOSVGSYMBOLCOLLECTIONRESOURCE
9
10#include <QObject>
11#include <QColor>
12#include <QVector>
13#include <QScopedPointer>
14#include <QImage>
15#include <QPainter>
16
17#include <KoResource.h>
18
19#include <KoShape.h>
20#include <KoShapeGroup.h>
21#include <KoShapeManager.h>
22
23
24#include "kritaflake_export.h"
25
26struct KRITAFLAKE_EXPORT KoSvgSymbol {
28 KoSvgSymbol(const QString &_title)
29 : title(_title) {}
30
32 : id(rhs.id),
33 title(rhs.title),
34 shape(rhs.shape->cloneShape())
35 {
36 }
37
39 {
40 delete shape;
41 }
42
43 QString id;
44 QString title;
45 KoShape *shape {0};
46 QImage icon(int size);
47
48 bool operator==(const KoSvgSymbol& rhs) const {
49 return title == rhs.title;
50 }
51};
52
56class KRITAFLAKE_EXPORT KoSvgSymbolCollectionResource : public KoResource
57{
58public:
59
62 explicit KoSvgSymbolCollectionResource(const QString &filename);
63
67
70 KoResourceSP clone() const override;
71
72 bool loadFromDevice(QIODevice *dev, KisResourcesInterfaceSP resourcesInterface) override;
73 bool saveToDevice(QIODevice* dev) const override;
74
75 QString defaultFileExtension() const override;
76
77 QPair<QString, QString> resourceType() const override
78 {
79 return QPair<QString, QString>(ResourceType::Symbols, "");
80 }
81
82 QString title() const;
83 QString description() const;
84 QString creator() const;
85 QString rights() const;
86 QString language() const;
87 QStringList subjects() const;
88 QString license() const;
89 QStringList permits() const;
90
91 QVector<KoSvgSymbol *> symbols() const;
92
93
94private:
95
96 struct Private;
97 const QScopedPointer<Private> d;
98
99};
100#endif // KOSVGSYMBOLCOLLECTIONRESOURCE
101
QPair< QString, QString > resourceType() const override
const QScopedPointer< Private > d
KoSvgSymbolCollectionResource & operator=(const KoSvgSymbolCollectionResource &rhs)=delete
bool loadFromDevice(QIODevice *)
const QString Symbols
bool operator==(const KoSvgSymbol &rhs) const
KoSvgSymbol(const QString &_title)
KoSvgSymbol(const KoSvgSymbol &rhs)