From 790120836d14e5ad76f66eee6b64e2cd26311834 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Thu, 31 May 2012 23:11:17 +0200 Subject: [PATCH] * NewReleasesWidget now uses PlayableModels. --- src/libtomahawk/widgets/NewReleasesWidget.cpp | 10 +++++----- src/libtomahawk/widgets/NewReleasesWidget.h | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libtomahawk/widgets/NewReleasesWidget.cpp b/src/libtomahawk/widgets/NewReleasesWidget.cpp index 68636a8f1..6c91799c7 100644 --- a/src/libtomahawk/widgets/NewReleasesWidget.cpp +++ b/src/libtomahawk/widgets/NewReleasesWidget.cpp @@ -186,13 +186,12 @@ NewReleasesWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData request if ( type == "albums" ) { - loader->setType( ChartDataLoader::Album ); loader->setData( returnedData[ "albums" ].value< QList< Tomahawk::InfoSystem::InfoStringHash > >() ); connect( loader, SIGNAL( albums( Tomahawk::ChartDataLoader*, QList< Tomahawk::album_ptr > ) ), this, SLOT( newReleasesLoaded( Tomahawk::ChartDataLoader*, QList ) ) ); - AlbumModel* albumModel = new AlbumModel( ui->albumsView ); + PlayableModel* albumModel = new PlayableModel( ui->albumsView ); m_albumModels[ releaseId ] = albumModel; @@ -344,12 +343,13 @@ NewReleasesWidget::parseNode( QStandardItem* parentItem, const QString &label, c void -NewReleasesWidget::setLeftViewAlbums( AlbumModel* model ) +NewReleasesWidget::setLeftViewAlbums( PlayableModel* model ) { - ui->albumsView->setAlbumModel( model ); + ui->albumsView->setPlayableModel( model ); ui->albumsView->proxyModel()->sort( -1 ); // disable sorting, must be called after artistsViewLeft->setTreeModel } + void NewReleasesWidget::newReleasesLoaded( ChartDataLoader* loader, const QList< album_ptr >& albums ) { @@ -357,7 +357,7 @@ NewReleasesWidget::newReleasesLoaded( ChartDataLoader* loader, const QList< albu Q_ASSERT( m_albumModels.contains( chartId ) ); if ( m_albumModels.contains( chartId ) ) - m_albumModels[ chartId ]->addAlbums( albums ); + m_albumModels[ chartId ]->append( albums ); m_workers.remove( loader ); loader->deleteLater(); diff --git a/src/libtomahawk/widgets/NewReleasesWidget.h b/src/libtomahawk/widgets/NewReleasesWidget.h index c26e4eefc..333266852 100644 --- a/src/libtomahawk/widgets/NewReleasesWidget.h +++ b/src/libtomahawk/widgets/NewReleasesWidget.h @@ -40,6 +40,7 @@ class PlaylistModel; class OverlayWidget; class TreeProxyModel; class AlbumModel; +class PlayableModel; namespace Ui { @@ -95,7 +96,7 @@ private slots: private: void setLeftViewArtists( TreeModel* artistModel ); - void setLeftViewAlbums( AlbumModel* albumModel ); + void setLeftViewAlbums( PlayableModel* albumModel ); void setLeftViewTracks( PlaylistModel* trackModel ); @@ -113,7 +114,7 @@ private: QSet< Tomahawk::ChartDataLoader* > m_workers; // Cache our model data - QHash< QString, AlbumModel* > m_albumModels; + QHash< QString, PlayableModel* > m_albumModels; QString m_queueItemToShow; QSet< QString > m_queuedFetches; QTimer* m_timer;