1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

* AlbumView now uses LoadingSpinner and new OverlayWidget.

This commit is contained in:
Christian Muehlhaeuser
2012-05-31 21:33:05 +02:00
parent 72528ab089
commit 3e8d131c16
2 changed files with 5 additions and 24 deletions

View File

@@ -49,7 +49,7 @@ AlbumView::AlbumView( QWidget* parent )
, m_model( 0 ) , m_model( 0 )
, m_proxyModel( 0 ) , m_proxyModel( 0 )
, m_delegate( 0 ) , m_delegate( 0 )
, m_loadingSpinner( new AnimatedSpinner( this ) ) , m_loadingSpinner( new LoadingSpinner( this ) )
, m_overlay( new OverlayWidget( this ) ) , m_overlay( new OverlayWidget( this ) )
, m_contextMenu( new ContextMenu( this ) ) , m_contextMenu( new ContextMenu( this ) )
, m_inited( false ) , m_inited( false )
@@ -75,6 +75,10 @@ AlbumView::AlbumView( QWidget* parent )
setAutoFitItems( true ); setAutoFitItems( true );
setProxyModel( new AlbumProxyModel( this ) ); setProxyModel( new AlbumProxyModel( this ) );
/* m_overlay->setText( tr( "After you have scanned your music collection you will find your latest album additions right here." ) );
m_overlay->setText( tr( "This collection doesn't have any recent albums." ) );*/
m_overlay->setText( tr( "Nothing found." ) );
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) ); connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) ); connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) ); connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
@@ -124,10 +128,6 @@ AlbumView::setAlbumModel( AlbumModel* model )
connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) ); connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) );
connect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), SLOT( onItemCountChanged( unsigned int ) ) );
connect( m_model, SIGNAL( loadingStarted() ), m_loadingSpinner, SLOT( fadeIn() ) );
connect( m_model, SIGNAL( loadingFinished() ), m_loadingSpinner, SLOT( fadeOut() ) );
emit modelChanged(); emit modelChanged();
} }
@@ -165,23 +165,6 @@ AlbumView::onItemActivated( const QModelIndex& index )
} }
void
AlbumView::onItemCountChanged( unsigned int items )
{
if ( items == 0 )
{
if ( m_model->collection().isNull() || ( !m_model->collection().isNull() && m_model->collection()->source()->isLocal() ) )
m_overlay->setText( tr( "After you have scanned your music collection you will find your latest album additions right here." ) );
else
m_overlay->setText( tr( "This collection doesn't have any recent albums." ) );
m_overlay->show();
}
else
m_overlay->hide();
}
void void
AlbumView::scrollContentsBy( int dx, int dy ) AlbumView::scrollContentsBy( int dx, int dy )
{ {

View File

@@ -50,7 +50,6 @@ public:
AlbumModel* model() const { return m_model; } AlbumModel* model() const { return m_model; }
AlbumProxyModel* proxyModel() const { return m_proxyModel; } AlbumProxyModel* proxyModel() const { return m_proxyModel; }
// PlaylistItemDelegate* delegate() { return m_delegate; }
bool autoFitItems() const { return m_autoFitItems; } bool autoFitItems() const { return m_autoFitItems; }
void setAutoFitItems( bool b ) { m_autoFitItems = b; } void setAutoFitItems( bool b ) { m_autoFitItems = b; }
@@ -86,7 +85,6 @@ protected slots:
virtual void currentChanged( const QModelIndex& current, const QModelIndex& previous ); virtual void currentChanged( const QModelIndex& current, const QModelIndex& previous );
private slots: private slots:
void onItemCountChanged( unsigned int items );
void onFilterChanged( const QString& filter ); void onFilterChanged( const QString& filter );
void onCustomContextMenu( const QPoint& pos ); void onCustomContextMenu( const QPoint& pos );