1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

* Update SourceInfoWidget when collection changes.

This commit is contained in:
Christian Muehlhaeuser 2011-11-23 04:38:07 +01:00
parent 778f352c0f
commit 54b8def06a
2 changed files with 24 additions and 6 deletions

View File

@ -58,19 +58,20 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget*
m_recentCollectionModel->setStyle( TrackModel::Short );
ui->recentCollectionView->setTrackModel( m_recentCollectionModel );
ui->recentCollectionView->sortByColumn( TrackModel::Age, Qt::DescendingOrder );
loadTracks();
m_historyModel = new PlaylistModel( ui->historyView );
m_historyModel->setStyle( TrackModel::Short );
ui->historyView->setPlaylistModel( m_historyModel );
m_historyModel->loadHistory( source, 25 );
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
ui->recentAlbumView->proxyModel()->sort( -1 );
m_recentAlbumModel->addFilteredCollection( source->collection(), 20, DatabaseCommand_AllAlbums::ModificationTime );
onCollectionChanged();
connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ) );
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );
m_title = tr( "New Additions" );
if ( source->isLocal() )
@ -92,6 +93,21 @@ SourceInfoWidget::~SourceInfoWidget()
}
void
SourceInfoWidget::onCollectionChanged()
{
loadTracks();
loadRecentAdditions();
}
void
SourceInfoWidget::loadRecentAdditions()
{
m_recentAlbumModel->addFilteredCollection( m_source->collection(), 20, DatabaseCommand_AllAlbums::ModificationTime, true );
}
void
SourceInfoWidget::loadTracks()
{

View File

@ -58,9 +58,11 @@ protected:
void changeEvent( QEvent* e );
private slots:
void onPlaybackFinished( const Tomahawk::query_ptr& query );
void loadTracks();
void loadRecentAdditions();
void onCollectionChanged();
void onPlaybackFinished( const Tomahawk::query_ptr& query );
void onLoadedTrackHistory( const QList<Tomahawk::query_ptr>& queries );
private: