1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 22:26:32 +02:00

* NewReleasesWidget now uses PlayableModels.

This commit is contained in:
Christian Muehlhaeuser
2012-05-31 23:11:17 +02:00
parent b14985bf81
commit 790120836d
2 changed files with 8 additions and 7 deletions

View File

@@ -186,13 +186,12 @@ NewReleasesWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData request
if ( type == "albums" ) if ( type == "albums" )
{ {
loader->setType( ChartDataLoader::Album ); loader->setType( ChartDataLoader::Album );
loader->setData( returnedData[ "albums" ].value< QList< Tomahawk::InfoSystem::InfoStringHash > >() ); 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<Tomahawk::album_ptr> ) ) ); connect( loader, SIGNAL( albums( Tomahawk::ChartDataLoader*, QList< Tomahawk::album_ptr > ) ), this, SLOT( newReleasesLoaded( Tomahawk::ChartDataLoader*, QList<Tomahawk::album_ptr> ) ) );
AlbumModel* albumModel = new AlbumModel( ui->albumsView ); PlayableModel* albumModel = new PlayableModel( ui->albumsView );
m_albumModels[ releaseId ] = albumModel; m_albumModels[ releaseId ] = albumModel;
@@ -344,12 +343,13 @@ NewReleasesWidget::parseNode( QStandardItem* parentItem, const QString &label, c
void 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 ui->albumsView->proxyModel()->sort( -1 ); // disable sorting, must be called after artistsViewLeft->setTreeModel
} }
void void
NewReleasesWidget::newReleasesLoaded( ChartDataLoader* loader, const QList< album_ptr >& albums ) 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 ) ); Q_ASSERT( m_albumModels.contains( chartId ) );
if ( m_albumModels.contains( chartId ) ) if ( m_albumModels.contains( chartId ) )
m_albumModels[ chartId ]->addAlbums( albums ); m_albumModels[ chartId ]->append( albums );
m_workers.remove( loader ); m_workers.remove( loader );
loader->deleteLater(); loader->deleteLater();

View File

@@ -40,6 +40,7 @@ class PlaylistModel;
class OverlayWidget; class OverlayWidget;
class TreeProxyModel; class TreeProxyModel;
class AlbumModel; class AlbumModel;
class PlayableModel;
namespace Ui namespace Ui
{ {
@@ -95,7 +96,7 @@ private slots:
private: private:
void setLeftViewArtists( TreeModel* artistModel ); void setLeftViewArtists( TreeModel* artistModel );
void setLeftViewAlbums( AlbumModel* albumModel ); void setLeftViewAlbums( PlayableModel* albumModel );
void setLeftViewTracks( PlaylistModel* trackModel ); void setLeftViewTracks( PlaylistModel* trackModel );
@@ -113,7 +114,7 @@ private:
QSet< Tomahawk::ChartDataLoader* > m_workers; QSet< Tomahawk::ChartDataLoader* > m_workers;
// Cache our model data // Cache our model data
QHash< QString, AlbumModel* > m_albumModels; QHash< QString, PlayableModel* > m_albumModels;
QString m_queueItemToShow; QString m_queueItemToShow;
QSet< QString > m_queuedFetches; QSet< QString > m_queuedFetches;
QTimer* m_timer; QTimer* m_timer;