mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Update SourceInfoWidget when collection changes.
This commit is contained in:
@@ -58,19 +58,20 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget*
|
|||||||
m_recentCollectionModel->setStyle( TrackModel::Short );
|
m_recentCollectionModel->setStyle( TrackModel::Short );
|
||||||
ui->recentCollectionView->setTrackModel( m_recentCollectionModel );
|
ui->recentCollectionView->setTrackModel( m_recentCollectionModel );
|
||||||
ui->recentCollectionView->sortByColumn( TrackModel::Age, Qt::DescendingOrder );
|
ui->recentCollectionView->sortByColumn( TrackModel::Age, Qt::DescendingOrder );
|
||||||
loadTracks();
|
|
||||||
|
|
||||||
m_historyModel = new PlaylistModel( ui->historyView );
|
m_historyModel = new PlaylistModel( ui->historyView );
|
||||||
m_historyModel->setStyle( TrackModel::Short );
|
m_historyModel->setStyle( TrackModel::Short );
|
||||||
ui->historyView->setPlaylistModel( m_historyModel );
|
ui->historyView->setPlaylistModel( m_historyModel );
|
||||||
m_historyModel->loadHistory( source, 25 );
|
m_historyModel->loadHistory( source, 25 );
|
||||||
|
|
||||||
connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );
|
|
||||||
|
|
||||||
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
|
m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
|
||||||
ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
|
ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
|
||||||
ui->recentAlbumView->proxyModel()->sort( -1 );
|
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" );
|
m_title = tr( "New Additions" );
|
||||||
if ( source->isLocal() )
|
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
|
void
|
||||||
SourceInfoWidget::loadTracks()
|
SourceInfoWidget::loadTracks()
|
||||||
{
|
{
|
||||||
|
@@ -58,9 +58,11 @@ protected:
|
|||||||
void changeEvent( QEvent* e );
|
void changeEvent( QEvent* e );
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onPlaybackFinished( const Tomahawk::query_ptr& query );
|
|
||||||
|
|
||||||
void loadTracks();
|
void loadTracks();
|
||||||
|
void loadRecentAdditions();
|
||||||
|
|
||||||
|
void onCollectionChanged();
|
||||||
|
void onPlaybackFinished( const Tomahawk::query_ptr& query );
|
||||||
void onLoadedTrackHistory( const QList<Tomahawk::query_ptr>& queries );
|
void onLoadedTrackHistory( const QList<Tomahawk::query_ptr>& queries );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user