File indexing completed on 2024-05-12 15:59:48

0001 /*
0002  * SPDX-FileCopyrightText: 2018 Boudewijn Rempt <boud@valdyas.org>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISFOLDERSTORAGE_H
0008 #define KISFOLDERSTORAGE_H
0009 
0010 #include <KisStoragePlugin.h>
0011 
0012 #include <kritaresources_export.h>
0013 
0014 /**
0015  * KisFolderStorage is a KisStoragePlugin which handles resources 
0016  * stored in the user's resource folder. On initial startup, every
0017  * resource that comes as a folder resource is copied to the user's
0018  * resource folder. This is also the default location where the
0019  * resources the user creates are stored. 
0020  */
0021 class KRITARESOURCES_EXPORT KisFolderStorage : public KisStoragePlugin
0022 {
0023 public:
0024     KisFolderStorage(const QString &location);
0025     virtual ~KisFolderStorage();
0026 
0027     /// Adds or updates this resource to the storage
0028     bool saveAsNewVersion(const QString &resourceType, KoResourceSP resource) override;
0029 
0030     KisResourceStorage::ResourceItem resourceItem(const QString &url) override;
0031     bool loadVersionedResource(KoResourceSP resource) override;
0032     QSharedPointer<KisResourceStorage::ResourceIterator> resources(const QString &resourceType) override;
0033     QSharedPointer<KisResourceStorage::TagIterator> tags(const QString &resourceType) override;
0034     bool importResource(const QString &url, QIODevice *device) override;
0035     bool exportResource(const QString &url, QIODevice *device) override;
0036     bool addResource(const QString  &resourceType, KoResourceSP resource) override;
0037 
0038     QStringList metaDataKeys() const override;
0039     QVariant metaData(const QString &key) const override;
0040 
0041     QString resourceMd5(const QString &url) override;
0042     QString resourceFilePath(const QString &url) override;
0043 private:
0044     friend class FolderIterator;
0045 
0046 };
0047 
0048 #endif // KISFOLDERSTORAGE_H