Commit 7ae38ce8 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Use QSharedPointer for the resource in the resource loader

parent 42be937d
......@@ -19,6 +19,8 @@
#include "KisResourceLoader.h"
#include <KoResource.h>
class KisResourceLoader::Private
{
public:
......@@ -27,7 +29,7 @@ public:
QString name;
QImage thumbnail {QString("UNKNOWN")};
QStringList mimetypes;
KoResource *resource {0};
KoResourceSP resource {0};
};
......@@ -52,7 +54,7 @@ QString KisResourceLoader::folder() const
return d->folder;
}
KoResource *KisResourceLoader::resource() const
KoResourceSP KisResourceLoader::resource() const
{
return d->resource;
}
......@@ -72,7 +74,7 @@ void KisResourceLoader::setName(const QString &name)
d->name = name;
}
void KisResourceLoader::setResource(KoResource *resource)
void KisResourceLoader::setResource(KoResourceSP resource)
{
d->resource = resource;
}
......@@ -26,9 +26,10 @@
#include <QScopedPointer>
#include <QSharedPointer>
#include <KoResource.h>
#include <kritaresources_export.h>
class KoResource;
/**
* @brief The KisResourceLoader class is an abstract interface
......@@ -73,9 +74,7 @@ public:
QString name() const;
/// XXX: make shared pointer
KoResource *resource() const;
KoResourceSP resource() const;
protected:
......@@ -85,7 +84,7 @@ protected:
void setName(const QString &name);
void setResource(KoResource *resource);
void setResource(KoResourceSP resource);
private:
......
......@@ -97,7 +97,7 @@ public:
/// @return the default file extension which should be used when saving the resource
virtual QString defaultFileExtension() const;
/// @return true if the resource is permanent and can't be removed by the user
/// @return true if the resource is permanent and can't be removed by the user
bool permanent() const;
void setPermanent(bool permanent);
......@@ -127,5 +127,7 @@ static inline uint qHash(const KoResource &resource)
return qHash(resource.md5());
}
typedef QSharedPointer<KoResource> KoResourceSP;
#endif // KORESOURCE_H_
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