Commit 3a28b5e7 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add KoSvgSymbolCollectioNResource

This is a KoResource that can be created from the symbols in the
defs section of an svg file. It will be compatible with the files
inkscape uses for symbols.
parent b634e5e1
......@@ -202,6 +202,8 @@ set(kritaflake_SRCS
svg/SvgShapeFactory.cpp
svg/parsers/SvgTransformParser.cpp
resources/KoSvgSymbolCollectionResource.cpp
FlakeDebug.cpp
tests/MockShapes.cpp
)
......@@ -229,3 +231,9 @@ set_target_properties(kritaflake PROPERTIES
)
install(TARGETS kritaflake ${INSTALL_TARGETS_DEFAULT_ARGS})
install( FILES
resources/BalloonSymbols.svg
DESTINATION ${DATA_INSTALL_DIR}/krita/symbols)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
width="1200"
height="900"
viewBox="0,0,1200,900"
version="1.1"
style="fill:black;stroke:black">
<title>Word Balloons</title>
<desc>Ballons for holding text.</desc>
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>Word Balloons</dc:title>
<dc:date>2013-04-22</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Martin Owens, Tavmjong Bah</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Public Domain</dc:title>
</cc:Agent>
</dc:rights>
<dc:language>English</dc:language>
<dc:subject>
<rdf:Bag>
<rdf:li>word</rdf:li>
<rdf:li>balloon</rdf:li>
<rdf:li>comic</rdf:li>
<rdf:li>cartoon</rdf:li>
<rdf:li>speach</rdf:li>
<rdf:li>exclaim</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
</cc:Work>
<cc:License rdf:about="http://creativecommons.org/licenses/publicdomain/">
<cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<defs>
<symbol id="ThoughtBalloon">
<title>Thought Balloon</title>
<path d="m 170,60 c -18,-14 -51,-11 -62,7 -32,-19 -57,36 -22,56 -30,10 -30,50 3,57 -2,30 53,29 59,8 10,23 47,29 60,9 14,10 36,5 43,-9 11,25 41,21 50,1 35,4 40,-31 29,-50 24,-9 22,-39 3,-48 16,-26 -17,-58 -39,-29 -13,-14.3 -47,-14 -56,1 -16,-19 -53,-21 -68,-3 z" style="stroke:none"/>
<path d="m 165,55 c -18,-14 -51,-11 -62,7 -32,-19 -57,36 -22,56 -30,10 -30,50 3,57 -2,30 53,29 59,8 10,23 47,29 60,9 14,10 36,5 43,-9 11,25 41,21 50,1 35,4 40,-31 29,-50 24,-9 22,-39 3,-48 16,-26 -17,-58 -39,-29 -13,-14.3 -47,-14 -56,1 -16,-19 -53,-21 -68,-3 z" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 163,58 c -17,-12 -48,-11 -58,6 -37,-14 -46,42 -17,53 -33,14 -20,48 2,50 -5,29 47,29 53,7 10,25 43,24 58,8 13,9 34,4 40,-8 10,22 41,19 48,1 31,7 37,-28 27,-43 23,-7 21,-38 3,-46 14,-26 -15,-52 -30,-22 -19,-15.6 -43,-23 -59,-1 -15,-20 -51,-23 -67,-5 z" style="fill:white;stroke:none"/>
<ellipse cx="117" cy="239" rx="30" ry="21" style="stroke:none"/>
<ellipse cx="113" cy="235" rx="30" ry="21" style="fill:#eeeeee;stroke-width:3.5"/>
<ellipse cx="110" cy="233" rx="23" ry="17" style="fill:white;stroke:none"/>
<ellipse cx="74" cy="275" rx="15" ry="11" style="stroke:none"/>
<ellipse cx="70" cy="271" rx="15" ry="11" style="fill:#eeeeee;stroke-width:3.5"/>
<ellipse cx="67" cy="269" rx=" 8" ry="7" style="fill:white;stroke:none"/>
</symbol>
<symbol id="DreamSpeaking">
<title>Dream Speaking</title>
<path d="m 170,60 c -18,-14 -51,-11 -62,7 -32,-19 -57,36 -22,56 -30,10 -30,50 3,57 -2,30 53,29 59,8 10,23 47,29 60,9 14,10 36,5 43,-9 11,25 41,21 50,1 35,4 40,-31 29,-50 24,-9 22,-39 3,-48 16,-26 -17,-58 -39,-29 -13,-14.3 -47,-14 -56,1 -16,-19 -53,-21 -68,-3 z" style="stroke:none"/>
<path d="m 160,180 c -33,35 58,-6 -53,96 57.1,-21 93,-56 111,-102" style="stroke:none"/>
<path d="m 165,55 c -18,-14 -51,-11 -62,7 -32,-19 -57,36 -22,56 -30,10 -30,50 3,57 -2,30 53,29 59,8 10,23 47,29 60,9 14,10 36,5 43,-9 11,25 41,21 50,1 35,4 40,-31 29,-50 24,-9 22,-39 3,-48 16,-26 -17,-58 -39,-29 -13,-14.3 -47,-14 -56,1 -16,-19 -53,-21 -68,-3 z" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 155,176 c -33,35 58,-6 -53,96 57.1,-21 93,-56 111,-102" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 163,58 c -17,-12 -48,-11 -58,6 -37,-14 -46,42 -17,53 -33,14 -20,48 2,50 -5,29 47,29 53,7 10,25 43,24 58,8 13,9 34,4 40,-8 10,22 41,19 48,1 31,7 37,-28 27,-43 23,-7 21,-38 3,-46 14,-26 -15,-52 -30,-22 -19,-15.6 -43,-23 -59,-1 -15,-20 -51,-23 -67,-5 z" style="fill:white;stroke:none"/>
<path d="m 150,168 c -31,33 67,1 -38,97 56,-37 78,-67 93,-102" style="fill:white;stroke:none"/>
</symbol>
<symbol id="RoundedBalloon" style="stroke-linejoin:miter;stroke-miterlimit:10">
<title>Rounded Balloon</title>
<rect x="80" y="65" width="250" height="120" rx="32" style="stroke:none" />
<path d="m 124,179 -30,53 78,-53" style="stroke:none" />
<rect x="75" y="60" width="250" height="120" rx="30" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 120,175 -30,53 78,-53" style="fill:#eeeeee;stroke-width:3.5" />
<rect x="80" y="65" width="235" height="105" rx="25" style="fill:white;stroke:none" />
<path d="m 132,160 -30,53 78,-53" style="fill:white;stroke:none" />
</symbol>
<symbol id="SquaredBalloon" style="stroke-linejoin:miter;stroke-miterlimit:10">
<title>Squared Balloon</title>
<rect x="80" y="65" width="250" height="140" rx="17" style="stroke:none" />
<path d="m 126,199 25,43 30,-43" style="stroke:none" />
<rect x="75" y="60" width="250" height="140" rx="15" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 120,195 25,43 30,-43" style="fill:#eeeeee;stroke-width:3.5" />
<rect x="80" y="65" width="235" height="125" rx="10" style="fill:white;stroke:none" />
<path d="m 118,180 25,43 30,-43" style="fill:white;stroke:none" />
</symbol>
<symbol id="OverThePhone" style="stroke-linejoin:miter;stroke-miterlimit:10">
<title>Over the Phone</title>
<rect x="80" y="65" width="250" height="120" style="stroke:none" />
<path d="m 124,179 -15,41 -21,-16 -35,76 40,-49 32,17 53,-70" style="stroke:none" />
<rect x="75" y="60" width="250" height="120" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 120,175 -15,41 -21,-16 -35,76 40,-49 32,17 53,-70" style="fill:#eeeeee;stroke-width:3.5" />
<rect x="80" y="65" width="235" height="105" style="fill:white;stroke:none" />
<path d="m 125,166 -18,53 -22,-15 -26,56 29,-40 28,12 55,-68" style="fill:white;stroke:none" />
</symbol>
<symbol id="HipBalloon" style="stroke-linejoin:miter;stroke-miterlimit:10">
<title>Hip Balloon</title>
<path d="m 97,65 216,0 c 9,0 17,7.6 17,17 0,0 -14,35 -14,53 0,18 14,53 14,53 0,9 -8,17 -17,17 l -216,0 c -9.4,0 -17,-8 -17,-17 0,0 14,-35 14,-53 0,-18 -14,-53 -14,-53 0,-9.4 7.6,-17 17,-17 z" style="stroke:none"/>
<path d="m 126,199 -5,43 60,-43" style="stroke:none"/>
<path d="m 90,60 216,0 c 9,0 17,7.6 17,17 0,0 -14,35 -14,53 0,18 14,53 14,53 0,9 -8,17 -17,17 l -216,0 c -9.4,0 -17,-8 -17,-17 0,0 14,-35 14,-53 0,-18 -14,-53 -14,-53 0,-9.4 7.6,-17 17,-17 z" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 120,195 -5,43 60,-43" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 90,65 215,0 c 6,0 10,4.5 10,10 0,0 -14,36 -14,53 0,18 14,52 14,52 0,6 -4,10 -10,10 l -215,0 c -5.5,0 -10,-4 -10,-10 0,0 14,-34 14,-52 0,-17 -14,-53 -14,-53 0,-5.5 4.5,-10 10,-10 z" style="fill:white;stroke:none"/>
<path d="m 124,180 -5,43 60,-43" style="fill:white;stroke:none"/>
</symbol>
<symbol id="CircleBalloon" style="stroke-linejoin:miter;stroke-miterlimit:10">
<title>Circle Balloon</title>
<ellipse cx="205" cy="125" rx="125" ry="70" style="stroke:none" />
<path d="m 110,166 c 11,21 -10,30 -22,43 32,-3 59,-7 70,-26" style="stroke:none" />
<ellipse cx="200" cy="120" rx="125" ry="70" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 106,162 c 11,21 -10,30 -22,43 32,-3 59,-7 70,-26" style="fill:#eeeeee;stroke-width:3.5" />
<ellipse cx="197" cy="117" rx="117" ry="63" style="fill:white;stroke:none" />
<path d="m 103,149 c 14,25 9,34 -6,47 30,-3 50,-10 58,-31" style="fill:white;stroke:none" />
</symbol>
<symbol id="ExclaimBalloon" style="stroke-linejoin:miter;stroke-miterlimit:10">
<title>Exclaim Balloon</title>
<path d="m 117,183 -88,110 146,-98 10,31 53,-46 39,49 0,-46 69,28 -29,-57 66,-33 -68,-23.9 29,-58 -58,29 -15,-46 -48,46 -18,-42 -35,42 -20,-42 -33,40 -36.2,-42 0,50 -55,-2 42,42 -42,29 48,9 -24,46 z" style="stroke:none"/>
<path d="m 110,177 -88,110 146,-98 10,31 53,-46 39,49 0,-46 69,28 -29,-57 66,-33 -68,-23.9 29,-58 -58,29 -15,-46 -48,46 -18,-42 -35,42 -20,-42 -33,40 -36.2,-42 0,50 -55,-2 42,42 -42,29 48,9 -24,46 z" style="fill:#eeeeee;stroke-width:3.5"/>
<path d="m 122,166 -82,102 129,-89 9,28 52,-45 30,39 0,-38 58,23 -24,-45 57,-28 -56,-20 23,-47 -47,23 -14,-42 -47,44 -17,-40 -33,40 -21,-44 -31,38 -32.9,-38 0,43 -46,-2 38,38 -36,25 43,8 -21,41 z" style="fill:white;stroke:none"/>
</symbol>
</defs>
<use x="0" y="0" xlink:href="#RoundedBalloon" style="fill:blue;stroke:blue"/>
<use x="0" y="300" xlink:href="#SquaredBalloon" style="fill:blue;stroke:blue"/>
<use x="0" y="600" xlink:href="#CircleBalloon" style="fill:blue;stroke:blue"/>
<use x="400" y="0" xlink:href="#OverThePhone" style="fill:blue;stroke:blue"/>
<use x="400" y="300" xlink:href="#HipBalloon" style="fill:blue;stroke:blue"/>
<use x="400" y="600" xlink:href="#ExclaimBalloon" style="fill:blue;stroke:blue"/>
<use x="800" y="0" xlink:href="#DreamSpeaking" style="fill:blue;stroke:blue"/>
<use x="800" y="300" xlink:href="#ThoughtBalloon" style="fill:blue;stroke:blue"/>
</svg>
/* This file is part of the KDE project
Copyright (c) 2017 L. E. Segovia <leo.segovia@siggraph.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <resources/KoSvgSymbolCollectionResource.h>
#include <QDebug>
#include <QVector>
#include <QFile>
#include <QFileInfo>
#include <QBuffer>
#include <QByteArray>
#include <QImage>
#include <QPainter>
#include <klocalizedstring.h>
#include <KoStore.h>
#include <KoDocumentResourceManager.h>
#include "kis_debug.h"
#include <KoShape.h>
#include <KoViewConverter.h>
#include <KoShapePaintingContext.h>
#include <SvgParser.h>
struct KoSvgSymbolCollectionResource::Private {
QVector<KoSvgSymbol> symbols;
};
KoSvgSymbolCollectionResource::KoSvgSymbolCollectionResource(const QString& filename)
: KoResource(filename)
, d(new Private())
{
}
KoSvgSymbolCollectionResource::KoSvgSymbolCollectionResource()
: KoResource(QString())
, d(new Private())
{
}
KoSvgSymbolCollectionResource::KoSvgSymbolCollectionResource(const KoSvgSymbolCollectionResource& rhs)
: QObject(0)
, KoResource(QString())
, d(new Private())
{
setFilename(rhs.filename());
d->symbols = rhs.d->symbols;
setValid(true);
}
KoSvgSymbolCollectionResource::~KoSvgSymbolCollectionResource()
{
}
bool KoSvgSymbolCollectionResource::load()
{
qDebug() << "Going to load" << filename();
QFile file(filename());
if (file.size() == 0) return false;
if (!file.open(QIODevice::ReadOnly)) {
return false;
}
bool res = loadFromDevice(&file);
file.close();
return res;
}
bool KoSvgSymbolCollectionResource::loadFromDevice(QIODevice *dev)
{
if (!dev->isOpen()) dev->open(QIODevice::ReadOnly);
KoXmlDocument doc;
QString errorMsg;
int errorLine = 0;
int errorColumn;
bool ok = doc.setContent(dev->readAll(), false, &errorMsg, &errorLine, &errorColumn);
if (!ok) {
errKrita << "Parsing error in " << filename() << "! Aborting!" << endl
<< " In line: " << errorLine << ", column: " << errorColumn << endl
<< " Error message: " << errorMsg << endl;
errKrita << i18n("Parsing error in the main document at line %1, column %2\nError message: %3"
, errorLine , errorColumn , errorMsg);
return false;
}
KoDocumentResourceManager manager;
SvgParser parser(&manager);
parser.setResolution(QRectF(0,0,100,100), 72); // initialize with default values
QSizeF fragmentSize;
QList<KoShape*> shapes = parser.parseSvg(doc.documentElement(), &fragmentSize);
KoViewConverter converter;
KoShapePaintingContext context;
return true;
}
bool KoSvgSymbolCollectionResource::save()
{
QFile file(filename());
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
return false;
}
saveToDevice(&file);
file.close();
return true;
}
bool KoSvgSymbolCollectionResource::saveToDevice(QIODevice *dev) const
{
bool res;
// XXX
if (res) {
KoResource::saveToDevice(dev);
}
return res;
}
QString KoSvgSymbolCollectionResource::defaultFileExtension() const
{
return QString(".svg");
}
/* This file is part of the KDE project
Copyright (c) 2017 Boudewijn Rempt <boud@valdyas.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef KOSVGSYMBOLCOLLECTIONRESOURCE
#define KOSVGSYMBOLCOLLECTIONRESOURCE
#include <QObject>
#include <QColor>
#include <QVector>
#include <QScopedPointer>
#include <resources/KoResource.h>
class KoShape;
#include "kritaflake_export.h"
struct KoSvgSymbol {
KoSvgSymbol() {}
KoSvgSymbol(const QString &_name)
: name(_name) {}
QString name;
QString id;
KoShape *shape;
bool operator==(const KoSvgSymbol& rhs) const {
return name == rhs.name;
}
};
/**
* Loads an svg file that contains "symbol" objects and creates a collection of those objects.
*/
class KRITAFLAKE_EXPORT KoSvgSymbolCollectionResource : public QObject, public KoResource
{
Q_OBJECT
public:
/**
*/
explicit KoSvgSymbolCollectionResource(const QString &filename);
/// Create an empty color set
KoSvgSymbolCollectionResource();
/// Explicit copy constructor (KoResource copy constructor is private)
KoSvgSymbolCollectionResource(const KoSvgSymbolCollectionResource& rhs);
~KoSvgSymbolCollectionResource() override;
bool load() override;
bool loadFromDevice(QIODevice *dev) override;
bool save() override;
bool saveToDevice(QIODevice* dev) const override;
QString defaultFileExtension() const override;
private:
struct Private;
const QScopedPointer<Private> d;
};
#endif // KoSvgSymbolCollectionResource
......@@ -1506,7 +1506,7 @@ KoShape * SvgParser::createShapeFromElement(const KoXmlElement &element, SvgLoad
return object;
}
KoShape * SvgParser::createShape(const QString &shapeID)
KoShape *SvgParser::createShape(const QString &shapeID)
{
KoShapeFactoryBase *factory = KoShapeRegistry::instance()->get(shapeID);
if (!factory) {
......
......@@ -37,7 +37,7 @@
#include "SvgLoadingContext.h"
#include "SvgStyleParser.h"
#include "KoClipMask.h"
#include <resources/KoSvgSymbolCollectionResource.h>
class KoShape;
class KoShapeGroup;
......@@ -64,6 +64,9 @@ public:
/// Returns the list of all shapes of the svg document
QList<KoShape*> shapes() const;
/// Returns the collection of symbols contained in the svg document.
QVector<KoSvgSymbol*> symbols() const;
typedef std::function<QByteArray(const QString&)> FileFetcherFunc;
void setFileFetcher(FileFetcherFunc func);
......@@ -165,6 +168,8 @@ private:
QMap<QString, QExplicitlySharedDataPointer<KoMarker>> m_markers;
KoDocumentResourceManager *m_documentResourceManager;
QList<KoShape*> m_shapes;
QList<KoSvgSymbol*> m_symbols;
QList<KoShape*> m_symbolShapes;
QList<KoShape*> m_toplevelShapes;
};
......
......@@ -246,6 +246,7 @@ void KisApplication::addResourceTypes()
KoResourcePaths::addResourceType("tags", "data", "/tags/");
KoResourcePaths::addResourceType("templates", "data", "/templates");
KoResourcePaths::addResourceType("pythonscripts", "data", "/pykrita");
KoResourcePaths::addResourceType("symbols", "data", "/symbols");
// // Extra directories to look for create resources. (Does anyone actually use that anymore?)
// KoResourcePaths::addResourceDir("ko_gradients", "/usr/share/create/gradients/gimp");
......@@ -269,6 +270,8 @@ void KisApplication::addResourceTypes()
d.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/taskset/");
d.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/workspaces/");
d.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/input/");
d.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/pykrita/");
d.mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/symbols/");
}
void KisApplication::loadResources()
......@@ -296,6 +299,11 @@ void KisApplication::loadResources()
processEvents();
KisResourceServerProvider::instance()->paintOpPresetServer(true);
// load symbols
setSplashScreenLoadingText(i18n("Loading SVG Symbol Collections..."));
processEvents();
KoResourceServerProvider::instance()->svgSymbolCollectionServer(true);
setSplashScreenLoadingText(i18n("Loading Resource Bundles..."));
processEvents();
KisResourceServerProvider::instance()->resourceBundleServer();
......
......@@ -159,10 +159,12 @@ struct Q_DECL_HIDDEN KoResourceServerProvider::Private
KoResourceServer<KoPattern>* patternServer;
KoResourceServer<KoAbstractGradient>* gradientServer;
KoResourceServer<KoColorSet>* paletteServer;
KoResourceServer<KoSvgSymbolCollectionResource> *svgSymbolCollectionServer;
KoResourceLoaderThread *paletteThread;
KoResourceLoaderThread *gradientThread;
KoResourceLoaderThread *patternThread;
KoResourceLoaderThread *svgSymbolCollectionThread;
};
KoResourceServerProvider::KoResourceServerProvider() : d(new Private)
......@@ -200,6 +202,15 @@ KoResourceServerProvider::KoResourceServerProvider() : d(new Private)
// if (qApp->applicationName().contains(QLatin1String("test"), Qt::CaseInsensitive)) {
// d->paletteThread->barrier();
// }
d->svgSymbolCollectionServer = new KoResourceServerSimpleConstruction<KoSvgSymbolCollectionResource>("symbols", "*.svg");
if (!QFileInfo(d->svgSymbolCollectionServer->saveLocation()).exists()) {
QDir().mkpath(d->svgSymbolCollectionServer->saveLocation());
}
d->svgSymbolCollectionThread = new KoResourceLoaderThread(d->svgSymbolCollectionServer);
d->svgSymbolCollectionThread ->loadSynchronously();
}
KoResourceServerProvider::~KoResourceServerProvider()
......@@ -207,10 +218,12 @@ KoResourceServerProvider::~KoResourceServerProvider()
delete d->patternThread;
delete d->gradientThread;
delete d->paletteThread;
delete d->svgSymbolCollectionThread;
delete d->patternServer;
delete d->gradientServer;
delete d->paletteServer;
delete d->svgSymbolCollectionServer;
delete d;
}
......@@ -240,3 +253,9 @@ KoResourceServer<KoColorSet>* KoResourceServerProvider::paletteServer(bool block
return d->paletteServer;
}
KoResourceServer<KoSvgSymbolCollectionResource> *KoResourceServerProvider::svgSymbolCollectionServer(bool block)
{
if (block) d->svgSymbolCollectionThread->barrier();
return d->svgSymbolCollectionServer;
}
......@@ -32,6 +32,8 @@
#include <resources/KoPattern.h>
#include <resources/KoAbstractGradient.h>
#include <resources/KoColorSet.h>
#include <resources/KoAbstractGradient.h>
#include <resources/KoSvgSymbolCollectionResource.h>
/**
* KoResourceLoaderThread allows threaded loading of the resources of a resource server
......@@ -84,6 +86,7 @@ public:
KoResourceServer<KoPattern>* patternServer(bool block = true);
KoResourceServer<KoAbstractGradient>* gradientServer(bool block = true);
KoResourceServer<KoColorSet>* paletteServer(bool block = true);
KoResourceServer<KoSvgSymbolCollectionResource>* svgSymbolCollectionServer(bool block = true);
private:
KoResourceServerProvider(const KoResourceServerProvider&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment