From 035e59e0b595d18765e21cf00abd165e0ca9135e Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Tue, 26 Jun 2012 02:58:12 +0200 Subject: [PATCH] * Use new Recently- Played/Added -Model's API. --- src/libtomahawk/widgets/WelcomeWidget.cpp | 3 ++- src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp | 6 ++++-- src/sourcetree/items/SourceItem.cpp | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/libtomahawk/widgets/WelcomeWidget.cpp b/src/libtomahawk/widgets/WelcomeWidget.cpp index 0280b3285..5d9b88fce 100644 --- a/src/libtomahawk/widgets/WelcomeWidget.cpp +++ b/src/libtomahawk/widgets/WelcomeWidget.cpp @@ -68,10 +68,11 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) ui->playlistWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel ); updatePlaylists(); - m_tracksModel = new RecentlyPlayedModel( source_ptr(), ui->tracksView ); + m_tracksModel = new RecentlyPlayedModel( ui->tracksView ); m_tracksModel->setStyle( PlayableModel::ShortWithAvatars ); ui->tracksView->overlay()->setEnabled( false ); ui->tracksView->setPlaylistModel( m_tracksModel ); + m_tracksModel->setSource( source_ptr() ); m_recentAlbumsModel = new AlbumModel( ui->additionsView ); ui->additionsView->setPlayableModel( m_recentAlbumsModel ); diff --git a/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp index fb02f275a..fd15f3d54 100644 --- a/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp @@ -49,14 +49,16 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* ui->splitter->setStretchFactor( 0, 0 ); ui->splitter->setStretchFactor( 1, 1 ); - m_recentTracksModel = new RecentlyAddedModel( source, ui->recentCollectionView ); + m_recentTracksModel = new RecentlyAddedModel( ui->recentCollectionView ); m_recentTracksModel->setStyle( PlayableModel::Short ); ui->recentCollectionView->setPlayableModel( m_recentTracksModel ); ui->recentCollectionView->sortByColumn( PlayableModel::Age, Qt::DescendingOrder ); + m_recentTracksModel->setSource( source ); - m_historyModel = new RecentlyPlayedModel( source, ui->historyView ); + m_historyModel = new RecentlyPlayedModel( ui->historyView ); m_historyModel->setStyle( PlayableModel::Short ); ui->historyView->setPlaylistModel( m_historyModel ); + m_historyModel->setSource( source ); m_recentAlbumModel = new AlbumModel( ui->recentAlbumView ); ui->recentAlbumView->setPlayableModel( m_recentAlbumModel ); diff --git a/src/sourcetree/items/SourceItem.cpp b/src/sourcetree/items/SourceItem.cpp index 4847d8512..36011745c 100644 --- a/src/sourcetree/items/SourceItem.cpp +++ b/src/sourcetree/items/SourceItem.cpp @@ -541,7 +541,7 @@ SourceItem::latestAdditionsClicked() cv->setFrameShape( QFrame::NoFrame ); cv->setAttribute( Qt::WA_MacShowFocusRect, 0 ); - RecentlyAddedModel* raModel = new RecentlyAddedModel( m_source, cv ); + RecentlyAddedModel* raModel = new RecentlyAddedModel( cv ); raModel->setStyle( PlayableModel::Large ); raModel->setTitle( tr( "Latest Additions" ) ); @@ -558,6 +558,8 @@ SourceItem::latestAdditionsClicked() cv->sortByColumn( PlayableModel::Age, Qt::DescendingOrder ); cv->setEmptyTip( tr( "Sorry, we could not find any recent additions!" ) ); + raModel->setSource( m_source ); + m_latestAdditionsPage = cv; } @@ -582,7 +584,7 @@ SourceItem::recentPlaysClicked() pv->setFrameShape( QFrame::NoFrame ); pv->setAttribute( Qt::WA_MacShowFocusRect, 0 ); - RecentlyPlayedModel* raModel = new RecentlyPlayedModel( m_source, pv ); + RecentlyPlayedModel* raModel = new RecentlyPlayedModel( pv ); raModel->setStyle( PlayableModel::Large ); raModel->setTitle( tr( "Recently Played Tracks" ) ); @@ -597,6 +599,7 @@ SourceItem::recentPlaysClicked() pv->setPlaylistModel( raModel ); pv->setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) ); + raModel->setSource( m_source ); m_recentPlaysPage = pv; }