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

Move KoResource to the resources library

parent 3512309e
......@@ -22,7 +22,7 @@
#include <QImage>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <kis_types.h>
#include <kis_shared.h>
......
......@@ -23,7 +23,7 @@
#include <QGlobalStatic>
#include <KoResourcePaths.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceServerProvider.h>
#include <kis_debug.h>
......
......@@ -23,7 +23,7 @@
#include <QMap>
#include <QString>
#include <resources/KoResource.h>
#include <KoResource.h>
#include "kis_gbr_brush.h"
#include "kis_global.h"
......
......@@ -27,7 +27,7 @@
#include <QImage>
#include <QPainter>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoShape.h>
#include <KoShapeGroup.h>
......
......@@ -19,7 +19,7 @@
#ifndef KIS_PAINTOP_PRESET_H
#define KIS_PAINTOP_PRESET_H
#include <resources/KoResource.h>
#include <KoResource.h>
#include "KoID.h"
#include "kis_types.h"
......
......@@ -78,9 +78,6 @@ set(kritapigment_SRCS
resources/KoColorSet.cpp
resources/KoColorSetEntry.cpp
resources/KoPattern.cpp
resources/KoResource.cpp
resources/KoMD5Generator.cpp
resources/KoHashGeneratorProvider.cpp
resources/KoStopGradient.cpp
resources/KoSegmentGradient.cpp
)
......@@ -106,6 +103,7 @@ target_link_libraries( kritapigment
kritaplugin
kritastore
kritaglobal
kritaresources
${EXTRA_LIBRARIES}
KF5::I18n
KF5::ConfigCore
......
......@@ -22,7 +22,7 @@
#include <QMetaType>
#include "KoColorSpace.h"
#include <resources/KoResource.h>
#include <KoResource.h>
#include <kritapigment_export.h>
class KoAbstractGradient;
......
......@@ -25,7 +25,7 @@
#include <QVector>
#include <QScopedPointer>
#include <resources/KoResource.h>
#include <KoResource.h>
#include "KoColor.h"
#include "KoColorSetEntry.h"
......
......@@ -18,7 +18,7 @@
#ifndef KOPATTERN_H
#define KOPATTERN_H
#include <resources/KoResource.h>
#include <KoResource.h>
#include <kritapigment_export.h>
#include <QMetaType>
......
......@@ -26,7 +26,7 @@
#include <QList>
#include <QColor>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <resources/KoAbstractGradient.h>
#include "KoColor.h"
......
......@@ -23,7 +23,7 @@
#include "KoColor.h"
#include <resources/KoAbstractGradient.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <kritapigment_export.h>
#include <boost/operators.hpp>
......
......@@ -4,6 +4,9 @@ set(kritaresources_LIB_SRCS
KisResourceCacheDb.cpp
KisResourceLoader.cpp
KisResourceLoaderRegistry.cpp
KoResource.cpp
KoMD5Generator.cpp
KoHashGeneratorProvider.cpp
)
qt5_add_resources(kritaresources_LIB_SRCS sql.qrc)
......
......@@ -37,7 +37,8 @@ const QStringList KisResourceCacheDb::resourceTypes = QStringList() << "BRUSH_TI
<< "SYMBOL_LIBRARY"
<< "TEMPLATE"
<< "WORKSPACE"
<< "SESSION";
<< "SESSION"
<< "UNKNOWN";
const QStringList KisResourceCacheDb::originTypes = QStringList() << "INSTALLATION" // Installed by Krita
<< "BUNDLE" // Bundle installed by the user
......
......@@ -23,7 +23,11 @@ class KisResourceLoader::Private
{
public:
QString folder;
QString type;
QString name;
QImage thumbnail {QString("UNKNOWN")};
QStringList mimetypes;
KoResource *resource {0};
};
......@@ -47,3 +51,28 @@ QString KisResourceLoader::folder() const
{
return d->folder;
}
KoResource *KisResourceLoader::resource() const
{
return d->resource;
}
void KisResourceLoader::setType(const QString &type)
{
d->type = type;
}
void KisResourceLoader::setThumbnail(const QImage &thumbnail)
{
d->thumbnail = thumbnail;
}
void KisResourceLoader::setName(const QString &name)
{
d->name = name;
}
void KisResourceLoader::setResource(KoResource *resource)
{
d->resource = resource;
}
......@@ -28,6 +28,8 @@
#include <kritaresources_export.h>
class KoResource;
/**
* @brief The KisResourceLoader class is an abstract interface
* class that must be implemented by actual resource classes and
......@@ -67,9 +69,23 @@ public:
*/
virtual bool save(QIODevice &dev) const = 0;
virtual QImage thumbnail() const = 0;
QImage thumbnail() const;
QString name() const;
/// XXX: make shared pointer
KoResource *resource() const;
protected:
void setType(const QString &type);
void setThumbnail(const QImage &thumbnail);
void setName(const QString &name);
virtual QString name() const = 0;
void setResource(KoResource *resource);
private:
......
......@@ -22,11 +22,11 @@
#include <QHash>
#include <QMutex>
#include <kritapigment_export.h>
#include <kritaresources_export.h>
class KoHashGenerator;
class KRITAPIGMENT_EXPORT KoHashGeneratorProvider
class KRITARESOURCES_EXPORT KoHashGeneratorProvider
{
public:
KoHashGeneratorProvider();
......
......@@ -21,9 +21,9 @@
#include "KoHashGenerator.h"
#include <kritapigment_export.h>
#include <kritaresources_export.h>
class KRITAPIGMENT_EXPORT KoMD5Generator : public KoHashGenerator
class KRITARESOURCES_EXPORT KoMD5Generator : public KoHashGenerator
{
public:
KoMD5Generator();
......
......@@ -17,7 +17,7 @@
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/KoResource.h>
#include <KoResource.h>
#include <QDomElement>
#include <QFileInfo>
......
......@@ -23,7 +23,7 @@
#include <QString>
#include <QHash>
#include <kritapigment_export.h>
#include <kritaresources_export.h>
class QDomDocument;
class QDomElement;
......@@ -32,7 +32,7 @@ class QDomElement;
* The KoResource class provides a representation of resources. This
* includes, but not limited to, brushes and patterns.
*/
class KRITAPIGMENT_EXPORT KoResource
class KRITARESOURCES_EXPORT KoResource
{
public:
......
......@@ -30,7 +30,9 @@ class DummyResourceLoader : public KisResourceLoader {
public:
DummyResourceLoader()
: KisResourceLoader("dummy", QStringList() << "x-application/dummy")
{}
{
setType("UNKNOWN");
}
QString id() const override
{
......@@ -47,15 +49,6 @@ public:
return true;
}
QImage thumbnail() const override
{
return QImage();
}
QString name() const override
{
return ("onedummy");
}
};
......
......@@ -57,7 +57,7 @@
#include <KoShapeRegistry.h>
#include <KoDpi.h>
#include "KoConfig.h"
#include <resources/KoHashGeneratorProvider.h>
#include <KoHashGeneratorProvider.h>
#include <KoResourcePaths.h>
#include <KisMimeDatabase.h>
#include "thememanager.h"
......
......@@ -30,7 +30,7 @@
#include <KoResourceItemChooser.h>
#include <KoResourceServerAdapter.h>
#include <KoResourceServerProvider.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <resources/KoColorSet.h>
#include <resources/KoPattern.h>
......
......@@ -38,8 +38,8 @@
#include <QStringList>
#include <QMessageBox>
#include <resources/KoHashGeneratorProvider.h>
#include <resources/KoHashGenerator.h>
#include <KoHashGeneratorProvider.h>
#include <KoHashGenerator.h>
#include <KisResourceServerProvider.h>
#include <kis_workspace_resource.h>
#include <brushengine/kis_paintop_preset.h>
......
......@@ -25,7 +25,7 @@
#include <KoXmlWriter.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include "KisResourceBundleManifest.h"
#include "kritaui_export.h"
......
......@@ -30,7 +30,7 @@
#include <kis_debug.h>
#include <KoResourcePaths.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceServer.h>
#include <KoResourceServerProvider.h>
#include <KoResourceServerAdapter.h>
......
......@@ -30,7 +30,7 @@
#include <KoResourcePaths.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceServer.h>
#include <KoResourceServerProvider.h>
#include <KoResourceServerAdapter.h>
......
......@@ -16,7 +16,7 @@
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <resources/KoMD5Generator.h>
#include <KoMD5Generator.h>
#include "kritaui_export.h"
class KRITAUI_EXPORT KisMD5Generator : public KoMD5Generator
{
......
......@@ -18,7 +18,7 @@
#ifndef KIS_PSD_LAYER_STYLE_RESOURCE_H
#define KIS_PSD_LAYER_STYLE_RESOURCE_H
#include <resources/KoResource.h>
#include <KoResource.h>
#include <QVector>
#include <kritaui_export.h>
......
......@@ -20,7 +20,7 @@
#ifndef KIS_WORKSPACE_RESOURCE_H
#define KIS_WORKSPACE_RESOURCE_H
#include <resources/KoResource.h>
#include <KoResource.h>
#include <kis_properties_configuration.h>
#include "kritaui_export.h"
......
......@@ -23,7 +23,7 @@
#include <QApplication>
#include <KoCheckerBoardPainter.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <resources/KoAbstractGradient.h>
#include "kis_gradient_chooser.h"
......
......@@ -27,7 +27,7 @@
#include <klocalizedstring.h>
#include <resources/KoAbstractGradient.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <resources/KoSegmentGradient.h>
#include <KoStopGradient.h>
#include <KoColorSpaceRegistry.h>
......
......@@ -22,7 +22,7 @@
#include <QPainter>
#include <QIcon>
#include <QStyleOption>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceServerAdapter.h>
......
......@@ -26,7 +26,7 @@
#include <QWidgetAction>
#include <QSlider>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceItemChooser.h>
#include <ui_wdgpaintoppresets.h>
......
......@@ -32,7 +32,7 @@
#include <KoResourceItemChooser.h>
#include <KoResourceServerAdapter.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include "KisResourceServerProvider.h"
#include "kis_workspace_resource.h"
......
......@@ -47,7 +47,7 @@
#include "KoResourceItemView.h"
#include "KoResourceItemDelegate.h"
#include "KoResourceModel.h"
#include <resources/KoResource.h>
#include <KoResource.h>
#include "KoResourceTaggingManager.h"
#include "KoTagFilterWidget.h"
#include "KoTagChooserWidget.h"
......
......@@ -28,7 +28,7 @@
#include <klocalizedstring.h>
#include <qlineedit.h>
#include <resources/KoResource.h>
#include <KoResource.h>
KoLineEditAction::KoLineEditAction(QObject* parent)
: QWidgetAction(parent)
......
......@@ -24,7 +24,7 @@
#include "KoResourceItemView.h"
#include "KoResourceModel.h"
#include "KoResourceItemDelegate.h"
#include <resources/KoResource.h>
#include <KoResource.h>
#include "KoCheckerBoardPainter.h"
#include "KoShapeBackground.h"
#include <resources/KoAbstractGradient.h>
......
......@@ -34,7 +34,7 @@
#include <QTemporaryFile>
#include <QDomDocument>
#include "resources/KoResource.h"
#include "KoResource.h"
#include "KoResourceServerPolicies.h"
#include "KoResourceServerObserver.h"
#include "KoResourceTagStore.h"
......
......@@ -24,7 +24,7 @@
#define KO_RESOURCESERVER_ADAPTER_H_
#include "KoResourceServer.h"
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceFiltering.h>
#include "kritawidgets_export.h"
......
......@@ -38,7 +38,7 @@
#include "KoTagFilterWidget.h"
#include "KoTagChooserWidget.h"
#include "KoResourceModel.h"
#include <resources/KoResource.h>
#include <KoResource.h>
#include "KoResourceItemChooserContextMenu.h"
#include <kconfiggroup.h>
......
......@@ -24,7 +24,7 @@
#include <kactioncollection.h>
#include <WidgetsDebug.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include "KoResourceServerProvider.h"
void KoResourceTaggingTest::testInitialization()
......
......@@ -19,7 +19,7 @@
#ifndef TASKSET_RESOURCE_H
#define TASKSET_RESOURCE_H
#include <resources/KoResource.h>
#include <KoResource.h>
#include <QStringList>
......@@ -29,14 +29,14 @@ class TasksetResource : public KoResource
public:
TasksetResource(const QString& filename);
~TasksetResource() override;
bool load() override;
bool loadFromDevice(QIODevice *dev) override;
bool save() override;
bool saveToDevice(QIODevice* dev) const override;
QString defaultFileExtension() const override;
void setActionList(const QStringList actions);
QStringList actionList();
......
......@@ -23,7 +23,7 @@
#include <QCommandLineOption>
#include <KisApplication.h>
#include <resources/KoHashGeneratorProvider.h>
#include <KoHashGeneratorProvider.h>
#include "kis_md5_generator.h"
#include "PythonPluginManager.h"
#include <opengl/kis_opengl.h>
......
......@@ -32,7 +32,7 @@
#include <KoDocumentInfo.h>
#include <KoFileDialog.h>
#include <kis_icon.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceServer.h>
#include <KoResourceServerProvider.h>
......
......@@ -34,7 +34,7 @@
#include <kpluginfactory.h>
#include <KoFileDialog.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceServer.h>
#include <KoResourceServerProvider.h>
......
......@@ -32,7 +32,7 @@
#include <KoPatternBackground.h>
#include <KoImageCollection.h>
#include <KoShapeController.h>
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoResourceServerProvider.h>
#include <KoResourceItemChooser.h>
#include <KoResourceServerAdapter.h>
......
......@@ -20,7 +20,7 @@
#ifndef FILTEREFFECTRESOURCE_H
#define FILTEREFFECTRESOURCE_H
#include <resources/KoResource.h>
#include <KoResource.h>
#include <KoXmlReader.h>
#include <QDomDocument>
......
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