mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
* PixmapDelegateFader must not create rounded images before cache verification, since it creates a new QPixmap.
This commit is contained in:
@@ -19,14 +19,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PixmapDelegateFader.h"
|
#include "PixmapDelegateFader.h"
|
||||||
#include "TomahawkUtilsGui.h"
|
|
||||||
#include "Source.h"
|
|
||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QPaintEngine>
|
#include <QPaintEngine>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
|
#include "Source.h"
|
||||||
|
#include "TomahawkUtilsGui.h"
|
||||||
|
#include "Logger.h"
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
QWeakPointer< TomahawkUtils::SharedTimeLine > PixmapDelegateFader::s_stlInstance = QWeakPointer< TomahawkUtils::SharedTimeLine >();
|
QWeakPointer< TomahawkUtils::SharedTimeLine > PixmapDelegateFader::s_stlInstance = QWeakPointer< TomahawkUtils::SharedTimeLine >();
|
||||||
@@ -161,7 +163,7 @@ PixmapDelegateFader::albumChanged()
|
|||||||
if ( m_album.isNull() )
|
if ( m_album.isNull() )
|
||||||
return;
|
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() )
|
if ( m_artist.isNull() )
|
||||||
return;
|
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() )
|
if ( m_track.isNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
connect( m_track->displayQuery().data(), SIGNAL( coverChanged() ), SLOT( trackChanged() ) );
|
connect( m_track->displayQuery().data(), SIGNAL( updated() ), SLOT( trackChanged() ), Qt::UniqueConnection );
|
||||||
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( 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;
|
return;
|
||||||
|
|
||||||
m_defaultImage = false;
|
m_defaultImage = false;
|
||||||
QCryptographicHash hash( QCryptographicHash::Md5 );
|
const qint64 newImageMd5 = pixmap.cacheKey();
|
||||||
const QImage img = pixmap.toImage();
|
|
||||||
hash.addData( (const char*)img.constBits(), img.byteCount() );
|
|
||||||
const QString newImageMd5 = hash.result();
|
|
||||||
|
|
||||||
if ( m_oldImageMd5 == newImageMd5 )
|
if ( m_oldImageMd5 == newImageMd5 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_oldImageMd5 = newImageMd5;
|
m_oldImageMd5 = newImageMd5;
|
||||||
|
|
||||||
if ( m_connectedToStl )
|
if ( m_connectedToStl )
|
||||||
@@ -210,7 +209,7 @@ PixmapDelegateFader::setPixmap( const QPixmap& pixmap )
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_oldReference = m_currentReference;
|
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 );
|
stlInstance().data()->setUpdateInterval( 20 );
|
||||||
m_startFrame = stlInstance().data()->currentFrame();
|
m_startFrame = stlInstance().data()->currentFrame();
|
||||||
|
@@ -81,7 +81,7 @@ private:
|
|||||||
int m_startFrame;
|
int m_startFrame;
|
||||||
bool m_connectedToStl;
|
bool m_connectedToStl;
|
||||||
float m_fadePct;
|
float m_fadePct;
|
||||||
QString m_oldImageMd5;
|
qint64 m_oldImageMd5;
|
||||||
bool m_defaultImage;
|
bool m_defaultImage;
|
||||||
|
|
||||||
QQueue<QPixmap> m_pixmapQueue;
|
QQueue<QPixmap> m_pixmapQueue;
|
||||||
|
Reference in New Issue
Block a user