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:
parent
778f352c0f
commit
54b8def06a
@ -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()
|
||||
{
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user