2017-09-19 16:12:00 +02:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
|
|
|
*
|
2020-08-20 22:42:19 +02:00
|
|
|
* SPDX-FileCopyrightText: 2012 Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
|
|
|
* SPDX-FileCopyrightText: 2019 Adriaan de Groot <groot@kde.org>
|
2020-05-29 23:11:24 +02:00
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2019-08-13 21:00:36 +02:00
|
|
|
*
|
2017-09-19 16:12:00 +02:00
|
|
|
*/
|
|
|
|
|
2014-08-26 15:18:30 +02:00
|
|
|
#ifndef IMAGE_REGISTRY_H
|
|
|
|
#define IMAGE_REGISTRY_H
|
|
|
|
|
|
|
|
#include <QPixmap>
|
|
|
|
|
2020-02-17 11:32:28 +01:00
|
|
|
#include "DllMacro.h"
|
2019-08-09 16:52:54 +02:00
|
|
|
#include "utils/CalamaresUtilsGui.h"
|
2014-08-26 15:18:30 +02:00
|
|
|
|
2020-02-17 16:52:45 +01:00
|
|
|
class UIDLLEXPORT ImageRegistry
|
2014-08-26 15:18:30 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
static ImageRegistry* instance();
|
|
|
|
|
|
|
|
explicit ImageRegistry();
|
|
|
|
|
2017-09-19 16:22:59 +02:00
|
|
|
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
|
2019-08-09 16:52:54 +02:00
|
|
|
QPixmap pixmap( const QString& image,
|
|
|
|
const QSize& size,
|
|
|
|
CalamaresUtils::ImageMode mode = CalamaresUtils::Original,
|
|
|
|
qreal opacity = 1.0,
|
|
|
|
QColor tint = QColor( 0, 0, 0, 0 ) );
|
2014-08-26 15:18:30 +02:00
|
|
|
|
|
|
|
private:
|
2019-08-09 16:52:54 +02:00
|
|
|
qint64 cacheKey( const QSize& size, qreal opacity, QColor tint );
|
|
|
|
void putInCache( const QString& image,
|
|
|
|
const QSize& size,
|
|
|
|
CalamaresUtils::ImageMode mode,
|
|
|
|
qreal opacity,
|
|
|
|
const QPixmap& pixmap,
|
|
|
|
QColor tint );
|
2014-08-26 15:18:30 +02:00
|
|
|
};
|
|
|
|
|
2019-08-09 16:52:54 +02:00
|
|
|
#endif // IMAGE_REGISTRY_H
|