1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-14 01:54:07 +02:00

* Use a FlexibleView for Recently Played playlists.

This commit is contained in:
Christian Muehlhaeuser
2012-07-14 09:49:39 +02:00
parent 2783651537
commit a62a4c354f

View File

@@ -29,6 +29,7 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "widgets/SocialPlaylistWidget.h" #include "widgets/SocialPlaylistWidget.h"
#include "playlist/CustomPlaylistView.h" #include "playlist/CustomPlaylistView.h"
#include "playlist/FlexibleView.h"
#include "playlist/PlaylistView.h" #include "playlist/PlaylistView.h"
#include "playlist/RecentlyAddedModel.h" #include "playlist/RecentlyAddedModel.h"
#include "playlist/RecentlyPlayedModel.h" #include "playlist/RecentlyPlayedModel.h"
@@ -551,12 +552,10 @@ SourceItem::recentPlaysClicked()
{ {
if ( !m_recentPlaysPage ) if ( !m_recentPlaysPage )
{ {
PlaylistView* pv = new PlaylistView( ViewManager::instance()->widget() ); FlexibleView* pv = new FlexibleView( ViewManager::instance()->widget() );
pv->setFrameShape( QFrame::NoFrame ); pv->setPixmap( QPixmap( RESPATH "images/recently-played.png" ) );
pv->setAttribute( Qt::WA_MacShowFocusRect, 0 );
RecentlyPlayedModel* raModel = new RecentlyPlayedModel( pv ); RecentlyPlayedModel* raModel = new RecentlyPlayedModel( pv );
pv->proxyModel()->setStyle( PlayableProxyModel::Large );
raModel->setTitle( tr( "Recently Played Tracks" ) ); raModel->setTitle( tr( "Recently Played Tracks" ) );
if ( m_source->isLocal() ) if ( m_source->isLocal() )
@@ -564,11 +563,11 @@ SourceItem::recentPlaysClicked()
else else
raModel->setDescription( tr( "%1's recently played tracks" ).arg( m_source->friendlyName() ) ); raModel->setDescription( tr( "%1's recently played tracks" ).arg( m_source->friendlyName() ) );
PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv, pv->proxyModel() ); PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv->trackView(), pv->trackView()->proxyModel() );
connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv, SLOT( update( QModelIndex ) ) ); connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv->trackView(), SLOT( update( QModelIndex ) ) );
pv->setItemDelegate( del ); pv->trackView()->setItemDelegate( del );
pv->setPlaylistModel( raModel ); pv->setPlayableModel( raModel );
pv->setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) ); pv->setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) );
raModel->setSource( m_source ); raModel->setSource( m_source );