2017-09-19 16:12:00 +02:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPLv3+
|
|
|
|
* License-Filename: LICENSES/GPLv3+-ImageRegistry
|
2019-08-13 21:00:36 +02:00
|
|
|
*
|
2019-08-09 16:52:54 +02:00
|
|
|
* Copyright 2019, Adriaan de Groot <groot@kde.org>
|
2017-09-19 16:12:00 +02:00
|
|
|
*/
|
|
|
|
|
2017-09-19 16:08:30 +02:00
|
|
|
/*
|
2014-08-26 15:18:30 +02:00
|
|
|
* Copyright 2012, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
2017-09-19 16:08:30 +02:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
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
|