1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01:00

* WhatsHotWidget uses new AlbumView/AlbumModel API.

This commit is contained in:
Christian Muehlhaeuser 2012-05-31 23:13:32 +02:00
parent 088ff60339
commit cd198db31d
2 changed files with 8 additions and 9 deletions

View File

@ -34,6 +34,7 @@
#include "audio/AudioEngine.h"
#include "dynamic/GeneratorInterface.h"
#include "playlist/PlayableModel.h"
#include "playlist/PlaylistModel.h"
#include "playlist/TreeProxyModel.h"
#include "playlist/PlaylistChartItemDelegate.h"
@ -272,13 +273,12 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
}
else 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( chartAlbumsLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::album_ptr > ) ) );
AlbumModel* albumModel = new AlbumModel( ui->albumsView );
PlayableModel* albumModel = new PlayableModel( ui->albumsView );
m_albumModels[ chartId ] = albumModel;
@ -287,7 +287,6 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat
}
else if ( type == "tracks" )
{
loader->setType( ChartDataLoader::Track );
loader->setData( returnedData[ "tracks" ].value< QList< Tomahawk::InfoSystem::InfoStringHash > >() );
@ -452,9 +451,9 @@ WhatsHotWidget::parseNode( QStandardItem* parentItem, const QString &label, cons
void
WhatsHotWidget::setLeftViewAlbums( AlbumModel* model )
WhatsHotWidget::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->stackLeft->setCurrentIndex( 2 );
}
@ -522,7 +521,7 @@ WhatsHotWidget::chartAlbumsLoaded( ChartDataLoader* loader, const QList< album_p
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();

View File

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