mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 15:29:42 +01:00
* PixmapDelegateFader must not create rounded images before cache verification, since it creates a new QPixmap.
This commit is contained in:
parent
a60d4dc364
commit
8fc92ef345
@ -19,14 +19,16 @@
|
||||
*/
|
||||
|
||||
#include "PixmapDelegateFader.h"
|
||||
#include "TomahawkUtilsGui.h"
|
||||
#include "Source.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QBuffer>
|
||||
#include <QPaintEngine>
|
||||
#include <QTimer>
|
||||
|
||||
#include "Source.h"
|
||||
#include "TomahawkUtilsGui.h"
|
||||
#include "Logger.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
QWeakPointer< TomahawkUtils::SharedTimeLine > PixmapDelegateFader::s_stlInstance = QWeakPointer< TomahawkUtils::SharedTimeLine >();
|
||||
@ -161,7 +163,7 @@ PixmapDelegateFader::albumChanged()
|
||||
if ( m_album.isNull() )
|
||||
return;
|
||||
|
||||
QMetaObject::invokeMethod( this, "setPixmap", Qt::QueuedConnection, Q_ARG( QPixmap, TomahawkUtils::createRoundedImage( m_album->cover( m_size ), QSize( 0, 0 ), m_mode == TomahawkUtils::Grid ? 0.00 : 0.20 ) ) );
|
||||
QMetaObject::invokeMethod( this, "setPixmap", Qt::QueuedConnection, Q_ARG( QPixmap, m_album->cover( m_size ) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -171,7 +173,7 @@ PixmapDelegateFader::artistChanged()
|
||||
if ( m_artist.isNull() )
|
||||
return;
|
||||
|
||||
QMetaObject::invokeMethod( this, "setPixmap", Qt::QueuedConnection, Q_ARG( QPixmap, TomahawkUtils::createRoundedImage( m_artist->cover( m_size ), QSize( 0, 0 ), m_mode == TomahawkUtils::Grid ? 0.00 : 0.20 ) ) );
|
||||
QMetaObject::invokeMethod( this, "setPixmap", Qt::QueuedConnection, Q_ARG( QPixmap, m_artist->cover( m_size ) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -181,8 +183,9 @@ PixmapDelegateFader::trackChanged()
|
||||
if ( m_track.isNull() )
|
||||
return;
|
||||
|
||||
connect( m_track->displayQuery().data(), SIGNAL( coverChanged() ), SLOT( trackChanged() ) );
|
||||
QMetaObject::invokeMethod( this, "setPixmap", Qt::QueuedConnection, Q_ARG( QPixmap, TomahawkUtils::createRoundedImage( m_track->displayQuery()->cover( m_size ), QSize( 0, 0 ), m_mode == TomahawkUtils::Grid ? 0.00 : 0.20 ) ) );
|
||||
connect( m_track->displayQuery().data(), SIGNAL( updated() ), SLOT( trackChanged() ), Qt::UniqueConnection );
|
||||
connect( m_track->displayQuery().data(), SIGNAL( coverChanged() ), SLOT( trackChanged() ), Qt::UniqueConnection );
|
||||
QMetaObject::invokeMethod( this, "setPixmap", Qt::QueuedConnection, Q_ARG( QPixmap, m_track->displayQuery()->cover( m_size ) ) );
|
||||
}
|
||||
|
||||
|
||||
@ -193,14 +196,10 @@ PixmapDelegateFader::setPixmap( const QPixmap& pixmap )
|
||||
return;
|
||||
|
||||
m_defaultImage = false;
|
||||
QCryptographicHash hash( QCryptographicHash::Md5 );
|
||||
const QImage img = pixmap.toImage();
|
||||
hash.addData( (const char*)img.constBits(), img.byteCount() );
|
||||
const QString newImageMd5 = hash.result();
|
||||
const qint64 newImageMd5 = pixmap.cacheKey();
|
||||
|
||||
if ( m_oldImageMd5 == newImageMd5 )
|
||||
return;
|
||||
|
||||
m_oldImageMd5 = newImageMd5;
|
||||
|
||||
if ( m_connectedToStl )
|
||||
@ -210,7 +209,7 @@ PixmapDelegateFader::setPixmap( const QPixmap& pixmap )
|
||||
}
|
||||
|
||||
m_oldReference = m_currentReference;
|
||||
m_currentReference = pixmap;
|
||||
m_currentReference = TomahawkUtils::createRoundedImage( pixmap, QSize( 0, 0 ), m_mode == TomahawkUtils::Grid ? 0.00 : 0.20 );
|
||||
|
||||
stlInstance().data()->setUpdateInterval( 20 );
|
||||
m_startFrame = stlInstance().data()->currentFrame();
|
||||
|
@ -81,7 +81,7 @@ private:
|
||||
int m_startFrame;
|
||||
bool m_connectedToStl;
|
||||
float m_fadePct;
|
||||
QString m_oldImageMd5;
|
||||
qint64 m_oldImageMd5;
|
||||
bool m_defaultImage;
|
||||
|
||||
QQueue<QPixmap> m_pixmapQueue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user