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