Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.4 KB
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2020 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */
#ifndef KISLOCALSTROKERESOURCES_H
#define KISLOCALSTROKERESOURCES_H

#include <KisResourcesInterface.h>

class KisLocalStrokeResourcesPrivate;


/**
 * @brief a KisResourcesInterface-like resources storage for preloaded resources
 *
 * KisLocalStrokeResources stores preloaded resources and dispatches them
 * to the consumers as a resources source.
 *
 * It is used by the strokes to avoid accessing global resource storage
 * from non-gui threads.
 */
class KRITARESOURCES_EXPORT KisLocalStrokeResources : public KisResourcesInterface
{
public:
    KisLocalStrokeResources();
    KisLocalStrokeResources(const QList<KoResourceSP> &localResources);

    /**
     * Add a resource to this local resources storage
     */
    void addResource(KoResourceSP resource);

    /**
     * Remove a resource from this local resources storage
     */
    void removeResource(KoResourceSP resource);

    KisLocalStrokeResources* clone() const;

    /**
     * Return all the resources that are present in this local resources storage
     */
    QList<KoResourceSP> resources() const;

protected:
    ResourceSourceAdapter* createSourceImpl(const QString &type) const override;

private:
    Q_DECLARE_PRIVATE(KisLocalStrokeResources);
};

#endif // KISLOCALSTROKERESOURCES_H