mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-10 16:14:40 +02:00
Store QPixmap on the heap in Result, as it's created in a db thread
This commit is contained in:
@@ -64,6 +64,7 @@ Result::isCached( const QString& url )
|
||||
Result::Result( const QString& url )
|
||||
: QObject()
|
||||
, m_url( url )
|
||||
, m_sourceIcon( 0 )
|
||||
, m_duration( 0 )
|
||||
, m_bitrate( 0 )
|
||||
, m_size( 0 )
|
||||
@@ -81,6 +82,7 @@ Result::Result( const QString& url )
|
||||
|
||||
Result::~Result()
|
||||
{
|
||||
delete m_sourceIcon;
|
||||
}
|
||||
|
||||
|
||||
@@ -301,7 +303,10 @@ Result::sourceIcon() const
|
||||
{
|
||||
if ( collection().isNull() )
|
||||
{
|
||||
return m_sourceIcon;
|
||||
if ( !m_sourceIcon )
|
||||
return QPixmap();
|
||||
else
|
||||
return *m_sourceIcon;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -89,7 +89,6 @@ public:
|
||||
void setRID( RID id ) { m_rid = id; }
|
||||
void setCollection( const Tomahawk::collection_ptr& collection );
|
||||
void setFriendlySource( const QString& s ) { m_friendlySource = s; }
|
||||
void setSourceIcon( const QPixmap& i ) { m_sourceIcon = i; }
|
||||
void setPurchaseUrl( const QString& u ) { m_purchaseUrl = u; }
|
||||
void setArtist( const Tomahawk::artist_ptr& artist );
|
||||
void setAlbum( const Tomahawk::album_ptr& album );
|
||||
@@ -104,6 +103,9 @@ public:
|
||||
void setYear( unsigned int year ) { m_year = year; }
|
||||
void setDiscNumber( unsigned int discnumber ) { m_discnumber = discnumber; }
|
||||
|
||||
// Takes ownership of the pixmap
|
||||
void setSourceIcon( QPixmap* i ) { m_sourceIcon = i; }
|
||||
|
||||
QVariantMap attributes() const { return m_attributes; }
|
||||
void setAttributes( const QVariantMap& map ) { m_attributes = map; updateAttributes(); }
|
||||
|
||||
@@ -120,7 +122,7 @@ signals:
|
||||
private slots:
|
||||
void onOffline();
|
||||
void onOnline();
|
||||
|
||||
|
||||
void onResolverRemoved( Tomahawk::Resolver* resolver );
|
||||
|
||||
private:
|
||||
@@ -143,7 +145,8 @@ private:
|
||||
QString m_purchaseUrl;
|
||||
QString m_mimetype;
|
||||
QString m_friendlySource;
|
||||
QPixmap m_sourceIcon;
|
||||
|
||||
QPixmap* m_sourceIcon;
|
||||
|
||||
unsigned int m_duration;
|
||||
unsigned int m_bitrate;
|
||||
|
@@ -432,7 +432,7 @@ QtScriptResolver::parseResultVariantList( const QVariantList& reslist )
|
||||
rp->setSize( m.value( "size" ).toUInt() );
|
||||
rp->setRID( uuid() );
|
||||
rp->setFriendlySource( name() );
|
||||
rp->setSourceIcon( icon() );
|
||||
rp->setSourceIcon( new QPixmap( icon() ) );
|
||||
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
|
||||
rp->setScore( m.value( "score" ).toFloat() );
|
||||
rp->setDiscNumber( m.value( "discnumber" ).toUInt() );
|
||||
|
@@ -282,7 +282,7 @@ ScriptResolver::handleMsg( const QByteArray& msg )
|
||||
rp->setSize( m.value( "size" ).toUInt() );
|
||||
rp->setRID( uuid() );
|
||||
rp->setFriendlySource( m_name );
|
||||
rp->setSourceIcon( m_icon );
|
||||
rp->setSourceIcon( new QPixmap( m_icon ) );
|
||||
rp->setPurchaseUrl( m.value( "purchaseUrl" ).toString() );
|
||||
rp->setYear( m.value( "year").toUInt() );
|
||||
rp->setDiscNumber( m.value( "discnumber" ).toUInt() );
|
||||
|
Reference in New Issue
Block a user