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 KISBUNDLESTORAGE_H 0008 #define KISBUNDLESTORAGE_H 0009 0010 #include <KisStoragePlugin.h> 0011 #include "kritaresources_export.h" 0012 0013 /** 0014 * KisBundleStorage is KisStoragePlugin that can load resources 0015 * from bundles. It can also manage overridden resources from bundles, 0016 * which are not stored in the bundles themselves. 0017 */ 0018 class KRITARESOURCES_EXPORT KisBundleStorage : public KisStoragePlugin 0019 { 0020 public: 0021 KisBundleStorage(const QString &location); 0022 virtual ~KisBundleStorage(); 0023 0024 KisResourceStorage::ResourceItem resourceItem(const QString &url) override; 0025 0026 /// Note: this should find resources in a folder that override a resource in the bundle first 0027 bool loadVersionedResource(KoResourceSP resource) override; 0028 QString resourceMd5(const QString &url) override; 0029 QSharedPointer<KisResourceStorage::ResourceIterator> resources(const QString &resourceType) override; 0030 QSharedPointer<KisResourceStorage::TagIterator> tags(const QString &resourceType) override; 0031 QImage thumbnail() const override; 0032 QStringList metaDataKeys() const override; 0033 QVariant metaData(const QString &key) const override; 0034 0035 /// Add a resource to this bundle: note, the bundle itself should NOT be rewritten, but we need to 0036 /// put these tags in a place in the file system 0037 bool saveAsNewVersion(const QString &resourceType, KoResourceSP resource) override; 0038 0039 bool exportResource(const QString &url, QIODevice *device) override; 0040 0041 private: 0042 friend class BundleIterator; 0043 0044 private: 0045 class Private; 0046 QScopedPointer<Private> d; 0047 }; 0048 0049 #endif // KISBUNDLESTORAGE_H