mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +02:00
* Further cleanups and fixed QPixmap warning: We need to store Source's QPixmaps as pointers, since a Source is being constructed in a thread.
This commit is contained in:
@@ -78,8 +78,6 @@ PipelineStatusView::PipelineStatusView( AnimatedSplitter* parent )
|
|||||||
void
|
void
|
||||||
PipelineStatusView::onPipelineUpdate( const query_ptr& query )
|
PipelineStatusView::onPipelineUpdate( const query_ptr& query )
|
||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO << query.isNull();
|
|
||||||
|
|
||||||
QTreeWidgetItem* ti = m_tree->invisibleRootItem()->child( 0 );
|
QTreeWidgetItem* ti = m_tree->invisibleRootItem()->child( 0 );
|
||||||
|
|
||||||
if ( Pipeline::instance()->activeQueryCount() && !query.isNull() )
|
if ( Pipeline::instance()->activeQueryCount() && !query.isNull() )
|
||||||
|
@@ -42,6 +42,8 @@ Source::Source( int id, const QString& username )
|
|||||||
, m_username( username )
|
, m_username( username )
|
||||||
, m_id( id )
|
, m_id( id )
|
||||||
, m_cc( 0 )
|
, m_cc( 0 )
|
||||||
|
, m_avatar( 0 )
|
||||||
|
, m_fancyAvatar( 0 )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << id << username;
|
qDebug() << Q_FUNC_INFO << id << username;
|
||||||
|
|
||||||
@@ -62,6 +64,8 @@ Source::Source( int id, const QString& username )
|
|||||||
Source::~Source()
|
Source::~Source()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << friendlyName();
|
qDebug() << Q_FUNC_INFO << friendlyName();
|
||||||
|
delete m_avatar;
|
||||||
|
delete m_fancyAvatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -122,22 +126,21 @@ Source::friendlyName() const
|
|||||||
void
|
void
|
||||||
Source::setAvatar( const QPixmap& avatar )
|
Source::setAvatar( const QPixmap& avatar )
|
||||||
{
|
{
|
||||||
m_avatar = avatar;
|
delete m_avatar;
|
||||||
|
m_avatar = new QPixmap( avatar );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QPixmap
|
QPixmap
|
||||||
Source::avatar( AvatarStyle style ) const
|
Source::avatar( AvatarStyle style ) const
|
||||||
{
|
{
|
||||||
if ( style == FancyStyle &&
|
if ( style == FancyStyle && m_avatar && !m_fancyAvatar )
|
||||||
!m_avatar.isNull() &&
|
m_fancyAvatar = new QPixmap( TomahawkUtils::createAvatarFrame( QPixmap( *m_avatar ) ) );
|
||||||
m_fancyAvatar.isNull() )
|
|
||||||
m_fancyAvatar = TomahawkUtils::createAvatarFrame( m_avatar );
|
|
||||||
|
|
||||||
if ( style == Original && !m_avatar.isNull() )
|
if ( style == Original && m_avatar )
|
||||||
return m_avatar;
|
return QPixmap( *m_avatar );
|
||||||
else if ( style == FancyStyle && !m_fancyAvatar.isNull() )
|
else if ( style == FancyStyle && m_fancyAvatar )
|
||||||
return m_fancyAvatar;
|
return QPixmap( *m_fancyAvatar );
|
||||||
else
|
else
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
}
|
}
|
||||||
|
@@ -133,8 +133,8 @@ private:
|
|||||||
|
|
||||||
ControlConnection* m_cc;
|
ControlConnection* m_cc;
|
||||||
|
|
||||||
QPixmap m_avatar;
|
QPixmap* m_avatar;
|
||||||
mutable QPixmap m_fancyAvatar;
|
mutable QPixmap* m_fancyAvatar;
|
||||||
|
|
||||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||||
};
|
};
|
||||||
|
@@ -85,6 +85,9 @@ TomahawkLogHandler( QtMsgType type, const char *msg )
|
|||||||
{
|
{
|
||||||
static QMutex s_mutex;
|
static QMutex s_mutex;
|
||||||
|
|
||||||
|
if ( strstr( msg, "Pixmap" ) )
|
||||||
|
Q_ASSERT( false );
|
||||||
|
|
||||||
QMutexLocker locker( &s_mutex );
|
QMutexLocker locker( &s_mutex );
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
|
@@ -505,13 +505,15 @@ setNam( QNetworkAccessManager* nam )
|
|||||||
s_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
s_nam = QWeakPointer< QNetworkAccessManager >( nam );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
void
|
void
|
||||||
bringToFront() {
|
bringToFront()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
QPixmap
|
QPixmap
|
||||||
createAvatarFrame( const QPixmap &avatar )
|
createAvatarFrame( const QPixmap &avatar )
|
||||||
{
|
{
|
||||||
|
@@ -89,7 +89,7 @@ namespace TomahawkUtils
|
|||||||
/// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us
|
/// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us
|
||||||
DLLEXPORT void bringToFront();
|
DLLEXPORT void bringToFront();
|
||||||
|
|
||||||
DLLEXPORT QPixmap createAvatarFrame(const QPixmap &avatar);
|
DLLEXPORT QPixmap createAvatarFrame( const QPixmap &avatar );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TOMAHAWKUTILS_H
|
#endif // TOMAHAWKUTILS_H
|
||||||
|
@@ -46,7 +46,6 @@ CollectionItem::CollectionItem( SourcesModel* mdl, SourceTreeItem* parent, cons
|
|||||||
, m_coolPlaylistsPage( 0 )
|
, m_coolPlaylistsPage( 0 )
|
||||||
, m_lovedTracksPage( 0 )
|
, m_lovedTracksPage( 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
m_lovedTracksItem = new GenericPageItem( model(), this, ( m_source.isNull() ? tr( "Top Loved Tracks" ) : tr( "Loved Tracks" ) ), QIcon( RESPATH "images/loved_playlist.png" ),
|
m_lovedTracksItem = new GenericPageItem( model(), this, ( m_source.isNull() ? tr( "Top Loved Tracks" ) : tr( "Loved Tracks" ) ), QIcon( RESPATH "images/loved_playlist.png" ),
|
||||||
boost::bind( &CollectionItem::lovedTracksClicked, this ),
|
boost::bind( &CollectionItem::lovedTracksClicked, this ),
|
||||||
boost::bind( &CollectionItem::getLovedTracksPage, this )
|
boost::bind( &CollectionItem::getLovedTracksPage, this )
|
||||||
|
Reference in New Issue
Block a user