Fix code using re-imported imageregistry
This commit is contained in:
parent
6010805935
commit
b04a890798
@ -27,8 +27,6 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <qicon.h>
|
#include <qicon.h>
|
||||||
|
|
||||||
#include "utils/Logger.h"
|
|
||||||
|
|
||||||
static QHash< QString, QHash< int, QHash< qint64, QPixmap > > > s_cache;
|
static QHash< QString, QHash< int, QHash< qint64, QPixmap > > > s_cache;
|
||||||
ImageRegistry* ImageRegistry::s_instance = 0;
|
ImageRegistry* ImageRegistry::s_instance = 0;
|
||||||
|
|
||||||
@ -47,9 +45,9 @@ ImageRegistry::ImageRegistry()
|
|||||||
|
|
||||||
|
|
||||||
QIcon
|
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
|
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 )
|
if ( size.width() < 0 || size.height() < 0 )
|
||||||
{
|
{
|
||||||
@ -102,7 +100,17 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::I
|
|||||||
pixPainter.end();
|
pixPainter.end();
|
||||||
|
|
||||||
if ( tint.alpha() > 0 )
|
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;
|
pixmap = p;
|
||||||
}
|
}
|
||||||
@ -113,8 +121,8 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::I
|
|||||||
{
|
{
|
||||||
switch ( mode )
|
switch ( mode )
|
||||||
{
|
{
|
||||||
case TomahawkUtils::RoundedCorners:
|
case CalamaresUtils::RoundedCorners:
|
||||||
pixmap = TomahawkUtils::createRoundedImage( pixmap, size );
|
pixmap = CalamaresUtils::createRoundedImage( pixmap, size );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -143,10 +151,8 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, TomahawkUtils::I
|
|||||||
|
|
||||||
|
|
||||||
void
|
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< qint64, QPixmap > subsubcache;
|
||||||
QHash< int, QHash< qint64, QPixmap > > subcache;
|
QHash< int, QHash< qint64, QPixmap > > subcache;
|
||||||
|
|
||||||
|
@ -26,22 +26,22 @@
|
|||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "DllMacro.h"
|
#include "UiDllMacro.h"
|
||||||
|
|
||||||
class DLLEXPORT ImageRegistry
|
class UIDLLEXPORT ImageRegistry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static ImageRegistry* instance();
|
static ImageRegistry* instance();
|
||||||
|
|
||||||
explicit ImageRegistry();
|
explicit ImageRegistry();
|
||||||
|
|
||||||
QIcon icon( const QString& image, TomahawkUtils::ImageMode mode = TomahawkUtils::Original );
|
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::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 ) );
|
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:
|
private:
|
||||||
qint64 cacheKey( const QSize& size, float opacity, QColor tint );
|
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;
|
static ImageRegistry* s_instance;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user