qskinny/src/graphic/QskGraphicProvider.h

51 lines
1.2 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
2023-04-06 09:23:37 +02:00
* SPDX-License-Identifier: BSD-3-Clause
2017-07-21 18:21:34 +02:00
*****************************************************************************/
#ifndef QSK_GRAPHIC_PROVIDER_H
#define QSK_GRAPHIC_PROVIDER_H
#include "QskGlobal.h"
2018-08-03 08:30:23 +02:00
2018-07-19 14:10:48 +02:00
#include <qobject.h>
2017-07-21 18:21:34 +02:00
#include <memory>
class QskGraphic;
class QUrl;
2018-08-03 08:15:28 +02:00
class QSK_EXPORT QskGraphicProvider : public QObject
2017-07-21 18:21:34 +02:00
{
2022-03-08 11:17:48 +01:00
Q_OBJECT
Q_PROPERTY( int cacheSize READ cacheSize WRITE setCacheSize )
2018-08-03 08:15:28 +02:00
public:
2017-07-21 18:21:34 +02:00
QskGraphicProvider( QObject* parent = nullptr );
2018-07-31 17:32:25 +02:00
~QskGraphicProvider() override;
2017-07-21 18:21:34 +02:00
void setCacheSize( int );
int cacheSize() const;
void clearCache();
const QskGraphic* requestGraphic( const QString& id ) const;
2018-08-03 08:15:28 +02:00
protected:
2017-07-21 18:21:34 +02:00
virtual const QskGraphic* loadGraphic( const QString& id ) const = 0;
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
namespace Qsk
{
QSK_EXPORT void addGraphicProvider( const QString& providerId, QskGraphicProvider* );
QSK_EXPORT QskGraphicProvider* graphicProvider( const QString& providerId );
QSK_EXPORT QskGraphic loadGraphic( const QUrl& url );
QSK_EXPORT QskGraphic loadGraphic( const char* source );
}
#endif