Krita Source Code Documentation
Loading...
Searching...
No Matches
KisEmbeddedResourceStorageProxy.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include "kis_assert.h"
11
13 : m_storageLocation(storageLocation),
14 m_stylesModel(ResourceType::LayerStyles),
15 m_patternsModel(ResourceType::Patterns),
16 m_gradientsModel(ResourceType::Gradients)
17{
18 if (m_storageLocation.isEmpty()) {
21 } else {
23 }
24}
25
27{
29 if (resource->resourceType().first == ResourceType::LayerStyles) {
30 resource = resource->clone();
31 } else {
32 m_fallbackResourcesInterface->addResource(resource);
33 }
34 } else {
35 if (resource->resourceType().first == ResourceType::LayerStyles) {
37 } else if (resource->resourceType().first == ResourceType::Patterns) {
39 } else if (resource->resourceType().first == ResourceType::Gradients) {
41 } else {
42 qWarning() << "WARNING: fallback resource proxy is not implemented for type" << resource->resourceType().first;
43 KIS_SAFE_ASSERT_RECOVER_NOOP(0 && "fallback resource proxy is not implemented");
44 }
45 }
46}
47
52
static KisResourcesInterfaceSP instance()
a KisResourcesInterface-like resources storage for preloaded resources
bool addResource(KoResourceSP resource, const QString &storageId=QString("")) override
addResource adds the given resource to the database and storage. If the resource already exists in th...
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
QSharedPointer< KisResourcesInterface > KisResourcesInterfaceSP
const QString LayerStyles
const QString Patterns
const QString Gradients
KisEmbeddedResourceStorageProxy(const QString &storageLocation)
QSharedPointer< KisLocalStrokeResources > m_fallbackResourcesInterface