mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
Fix code using re-imported imageregistry
This commit is contained in:
parent
6010805935
commit
b04a890798
2 changed files with 23 additions and 17 deletions
|
@ -27,8 +27,6 @@
|
|||
#include <QPainter>
|
||||
#include <qicon.h>
|
||||
|
||||
#include "utils/Logger.h"
|
||||
|
||||
static QHash< QString, QHash< int, QHash< qint64, QPixmap > > > s_cache;
|
||||
ImageRegistry* ImageRegistry::s_instance = 0;
|
||||
|
||||
|
@ -47,9 +45,9 @@ ImageRegistry::ImageRegistry()
|
|||
|
||||
|
||||
QIcon
|
||||
ImageRegistry::icon( const QString& image, TomahawkUtils::ImageMode mode )
|
||||
ImageRegistry::icon( const QString& image, CalamaresUtils::ImageMode mode )
|
||||
{
|
||||
return pixmap( image, TomahawkUtils::defaultIconSize(), mode );
|
||||
return pixmap( image, CalamaresUtils::defaultIconSize(), mode );
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,7 +59,7 @@ ImageRegistry::cacheKey( const QSize& size, float opacity, QColor tint )
|
|||
|
||||
|
||||
QPixmap
|
||||
ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::ImageMode mode, float opacity, QColor tint )
|
||||
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, QColor tint )
|
||||
{
|
||||
if ( size.width() < 0 || size.height() < 0 )
|
||||
{
|
||||
|
@ -102,7 +100,17 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::I
|
|||
pixPainter.end();
|
||||
|
||||
if ( tint.alpha() > 0 )
|
||||
p = TomahawkUtils::tinted( p, tint );
|
||||
{
|
||||
QImage resultImage( p.size(), QImage::Format_ARGB32_Premultiplied );
|
||||
QPainter painter( &resultImage );
|
||||
painter.drawPixmap( 0, 0, p );
|
||||
painter.setCompositionMode( QPainter::CompositionMode_Screen );
|
||||
painter.fillRect( resultImage.rect(), tint );
|
||||
painter.end();
|
||||
|
||||
resultImage.setAlphaChannel( p.toImage().alphaChannel() );
|
||||
p = QPixmap::fromImage( resultImage );
|
||||
}
|
||||
|
||||
pixmap = p;
|
||||
}
|
||||
|
@ -113,8 +121,8 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::I
|
|||
{
|
||||
switch ( mode )
|
||||
{
|
||||
case TomahawkUtils::RoundedCorners:
|
||||
pixmap = TomahawkUtils::createRoundedImage( pixmap, size );
|
||||
case CalamaresUtils::RoundedCorners:
|
||||
pixmap = CalamaresUtils::createRoundedImage( pixmap, size );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -143,10 +151,8 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::I
|
|||
|
||||
|
||||
void
|
||||
ImageRegistry::putInCache( const QString& image, const QSize& size, TomahawkUtils::ImageMode mode, float opacity, const QPixmap& pixmap, QColor tint )
|
||||
ImageRegistry::putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, const QPixmap& pixmap, QColor tint )
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Adding to image cache:" << image << size << mode;
|
||||
|
||||
QHash< qint64, QPixmap > subsubcache;
|
||||
QHash< int, QHash< qint64, QPixmap > > subcache;
|
||||
|
||||
|
|
|
@ -26,22 +26,22 @@
|
|||
|
||||
#include <QPixmap>
|
||||
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "DllMacro.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "UiDllMacro.h"
|
||||
|
||||
class DLLEXPORT ImageRegistry
|
||||
class UIDLLEXPORT ImageRegistry
|
||||
{
|
||||
public:
|
||||
static ImageRegistry* instance();
|
||||
|
||||
explicit ImageRegistry();
|
||||
|
||||
QIcon icon( const QString& image, TomahawkUtils::ImageMode mode = TomahawkUtils::Original );
|
||||
QPixmap pixmap( const QString& image, const QSize& size, TomahawkUtils::ImageMode mode = TomahawkUtils::Original, float opacity = 1.0, QColor tint = QColor( 0, 0, 0, 0 ) );
|
||||
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
|
||||
QPixmap pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original, float opacity = 1.0, QColor tint = QColor( 0, 0, 0, 0 ) );
|
||||
|
||||
private:
|
||||
qint64 cacheKey( const QSize& size, float opacity, QColor tint );
|
||||
void putInCache( const QString& image, const QSize& size, TomahawkUtils::ImageMode mode, float opacity, const QPixmap& pixmap, QColor tint );
|
||||
void putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, float opacity, const QPixmap& pixmap, QColor tint );
|
||||
|
||||
static ImageRegistry* s_instance;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue