12#include <QSharedPointer>
18#include <boost/operators.hpp>
20#include <kritaresources_export.h>
46class KRITARESOURCES_EXPORT
KoResource :
public boost::equality_comparable<KoResource>
79 virtual bool saveToDevice(QIODevice* dev)
const;
88 void setImage(
const QImage &image);
95 virtual void updateThumbnail();
103 virtual QImage thumbnail()
const;
112 virtual QString thumbnailPath()
const;
122 QString md5Sum(
bool generateIfEmpty =
true)
const;
125 void setMD5Sum(
const QString &md5sum);
129 void setFilename(
const QString& filename);
133 void setName(
const QString& name);
137 void setValid(
bool valid);
141 void setActive(
bool active);
144 virtual QString defaultFileExtension()
const;
148 void setPermanent(
bool permanent);
152 void setStorageLocation(
const QString &location);
155 void setDirty(
bool value);
158 bool isDirty()
const;
161 void addMetaData(QString key, QVariant
value);
168 void setVersion(
int version);
172 void setResourceId(
int id);
194 virtual bool isEphemeral()
const;
207 virtual bool isSerializable()
const;
261 virtual void clearSideLoadedResources();
270 virtual QList<int> requiredCanvasResources()
const;
294 dbg.noquote() <<
"NULL Resource";
297 dbg.nospace() <<
"[RESOURCE] Name: " << res->name()
298 <<
" Version: " << res->version()
299 <<
" Filename: " << res->filename()
300 <<
" MD5: " << res->md5Sum(
false)
301 <<
" Type: " << res->resourceType()
302 <<
" Valid: " << res->valid()
303 <<
" Storage: " << res->storageLocation();
float value(const T *src, size_t ch)
static uint qHash(const KoResource &resource)
static bool operator==(const KoResource &resource1, const KoResource &resource2)
QSharedPointer< KoResource > KoResourceSP
QSharedPointer< KisResourcesInterface > KisResourcesInterfaceSP
a provider-like interface class for accessing resource sources in Krita.
A simple wrapper object for the main information about the resource.
Q_DECLARE_METATYPE(KisPaintopLodLimitations)
void overrideResourceVersion(KoResourceSP resource, int version)
virtual QPair< QString, QString > resourceType() const =0
virtual QString name() const
virtual KoResourceSP clone() const =0
KoResource & operator=(const KoResource &rhs)=delete
QMap< QString, QVariant > metadata() const
get a map with all the metadata
QString storageLocation() const
int version() const
Get the version of the resource.
QString md5Sum(bool generateIfEmpty=true) const
virtual bool loadFromDevice(QIODevice *dev, KisResourcesInterfaceSP resourcesInterface)=0