diff --git a/src/libtomahawk/context/pages/RelatedArtistsContext.cpp b/src/libtomahawk/context/pages/RelatedArtistsContext.cpp index f3a7edd4a..40dee1281 100644 --- a/src/libtomahawk/context/pages/RelatedArtistsContext.cpp +++ b/src/libtomahawk/context/pages/RelatedArtistsContext.cpp @@ -35,7 +35,7 @@ RelatedArtistsContext::RelatedArtistsContext() m_relatedView->setGuid( "RelatedArtistsContext" ); m_relatedView->setUpdatesContextView( false ); m_relatedModel = new TreeModel( m_relatedView ); - m_relatedModel->setStyle( TreeModel::Large ); + m_relatedView->proxyModel()->setStyle( PlayableProxyModel::Large ); m_relatedView->setTreeModel( m_relatedModel ); m_relatedView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_relatedView->setSortingEnabled( false ); diff --git a/src/libtomahawk/context/pages/TopTracksContext.cpp b/src/libtomahawk/context/pages/TopTracksContext.cpp index b9dff8d3b..c07415c24 100644 --- a/src/libtomahawk/context/pages/TopTracksContext.cpp +++ b/src/libtomahawk/context/pages/TopTracksContext.cpp @@ -33,7 +33,7 @@ TopTracksContext::TopTracksContext() m_topHitsView->setGuid( "TopTracksContext" ); m_topHitsView->setUpdatesContextView( false ); m_topHitsModel = new PlaylistModel( m_topHitsView ); - m_topHitsModel->setStyle( PlayableModel::Short ); + m_topHitsView->proxyModel()->setStyle( PlayableProxyModel::Short ); m_topHitsView->setPlaylistModel( m_topHitsModel ); m_topHitsView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); diff --git a/src/libtomahawk/playlist/CustomPlaylistView.cpp b/src/libtomahawk/playlist/CustomPlaylistView.cpp index 8ae04bbd0..045967a05 100644 --- a/src/libtomahawk/playlist/CustomPlaylistView.cpp +++ b/src/libtomahawk/playlist/CustomPlaylistView.cpp @@ -34,7 +34,7 @@ CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, c , m_model( new PlaylistModel( this ) ) { // Generate the tracks, add them to the playlist - m_model->setStyle( PlayableModel::Large ); + proxyModel()->setStyle( PlayableProxyModel::Large ); setPlaylistModel( m_model ); generateTracks(); diff --git a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp index cc2eec100..2ddf88f98 100644 --- a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp +++ b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp @@ -67,8 +67,8 @@ PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel if ( index.isValid() ) { - int style = index.data( PlayableModel::StyleRole ).toInt(); - if ( style == PlayableModel::Short || style == PlayableModel::ShortWithAvatars ) + int style = index.data( PlayableProxyModel::StyleRole ).toInt(); + if ( style == PlayableProxyModel::Short || style == PlayableProxyModel::ShortWithAvatars ) { int rowHeight = option.fontMetrics.height() + 8; size.setHeight( rowHeight * 2 ); @@ -101,17 +101,17 @@ PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, const void PlaylistItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { - int style = index.data( PlayableModel::StyleRole ).toInt(); + int style = index.data( PlayableProxyModel::StyleRole ).toInt(); switch ( style ) { - case PlayableModel::Detailed: + case PlayableProxyModel::Detailed: paintDetailed( painter, option, index ); break; - case PlayableModel::Short: + case PlayableProxyModel::Short: paintShort( painter, option, index ); break; - case PlayableModel::ShortWithAvatars: + case PlayableProxyModel::ShortWithAvatars: paintShort( painter, option, index, true ); break; } diff --git a/src/libtomahawk/playlist/PlaylistView.cpp b/src/libtomahawk/playlist/PlaylistView.cpp index 5b7fdff59..3453b8709 100644 --- a/src/libtomahawk/playlist/PlaylistView.cpp +++ b/src/libtomahawk/playlist/PlaylistView.cpp @@ -62,15 +62,15 @@ PlaylistView::setPlaylistModel( PlaylistModel* model ) setColumnHidden( PlayableModel::Age, true ); // Hide age column per default setColumnHidden( PlayableModel::Composer, true ); // Hide composer column per default - if ( guid().isEmpty() ) + if ( guid().isEmpty() && proxyModel()->columnCount() > 1 ) { if ( !m_model->playlist().isNull() ) { - setGuid( QString( "playlistview/%1/%2" ).arg( m_model->columnCount() ).arg( m_model->playlist()->guid() ) ); + setGuid( QString( "playlistview/%1/%2" ).arg( proxyModel()->columnCount() ).arg( m_model->playlist()->guid() ) ); } else { - setGuid( QString( "playlistview/%1" ).arg( m_model->columnCount() ) ); + setGuid( QString( "playlistview/%1" ).arg( proxyModel()->columnCount() ) ); } } diff --git a/src/libtomahawk/playlist/QueueView.cpp b/src/libtomahawk/playlist/QueueView.cpp index e939e2b6d..df60a7705 100644 --- a/src/libtomahawk/playlist/QueueView.cpp +++ b/src/libtomahawk/playlist/QueueView.cpp @@ -47,7 +47,7 @@ QueueView::QueueView( AnimatedSplitter* parent ) ui->queue->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Ignored ); PlaylistModel* queueModel = new PlaylistModel( this ); - queueModel->setStyle( PlaylistModel::Short ); + ui->queue->proxyModel()->setStyle( PlayableProxyModel::Short ); queueModel->finishLoading(); ui->queue->setPlaylistModel( queueModel ); queueModel->setReadOnly( false ); diff --git a/src/libtomahawk/playlist/TrackView.cpp b/src/libtomahawk/playlist/TrackView.cpp index 908f0a9fb..2d655bbde 100644 --- a/src/libtomahawk/playlist/TrackView.cpp +++ b/src/libtomahawk/playlist/TrackView.cpp @@ -153,13 +153,13 @@ TrackView::setPlayableModel( PlayableModel* model ) connect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onViewChanged() ) ); setAcceptDrops( true ); - m_header->setDefaultColumnWeights( model->columnWeights() ); + m_header->setDefaultColumnWeights( m_proxyModel->columnWeights() ); - switch( model->style() ) + switch( m_proxyModel->style() ) { - case PlayableModel::Short: - case PlayableModel::ShortWithAvatars: - case PlayableModel::Large: + case PlayableProxyModel::Short: + case PlayableProxyModel::ShortWithAvatars: + case PlayableProxyModel::Large: setHeaderHidden( true ); setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); break; @@ -184,7 +184,7 @@ TrackView::setEmptyTip( const QString& tip ) void TrackView::onViewChanged() { - if ( m_model->style() != PlayableModel::Short && m_model->style() != PlayableModel::Large ) // eventual FIXME? + if ( m_proxyModel->style() != PlayableProxyModel::Short && m_proxyModel->style() != PlayableProxyModel::Large ) // eventual FIXME? return; if ( m_timer.isActive() ) @@ -217,7 +217,7 @@ TrackView::onScrollTimeout() for ( int i = left.row(); i <= max; i++ ) { - m_model->updateDetailedInfo( m_proxyModel->mapToSource( m_proxyModel->index( i, 0 ) ) ); + m_proxyModel->updateDetailedInfo( m_proxyModel->index( i, 0 ) ); } } @@ -621,7 +621,7 @@ TrackView::updateHoverIndex( const QPoint& pos ) repaint(); } - if ( !m_model || m_model->style() != PlayableModel::Detailed ) + if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Detailed ) return; if ( idx.column() == PlayableModel::Artist || idx.column() == PlayableModel::Album || idx.column() == PlayableModel::Track ) @@ -673,7 +673,7 @@ TrackView::mousePressEvent( QMouseEvent* event ) { QTreeView::mousePressEvent( event ); - if ( !m_model || m_model->style() != PlayableModel::Detailed ) + if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Detailed ) return; QModelIndex idx = indexAt( event->pos() ); diff --git a/src/libtomahawk/playlist/TreeModel.cpp b/src/libtomahawk/playlist/TreeModel.cpp index 7066a2085..fd848d292 100644 --- a/src/libtomahawk/playlist/TreeModel.cpp +++ b/src/libtomahawk/playlist/TreeModel.cpp @@ -41,7 +41,6 @@ TreeModel::TreeModel( QObject* parent ) : PlayableModel( parent ) , m_mode( DatabaseMode ) { - setStyle( Collection ); setIcon( QPixmap( RESPATH "images/music-icon.png" ) ); connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlaybackStarted( Tomahawk::result_ptr ) ), Qt::DirectConnection ); @@ -172,7 +171,7 @@ TreeModel::fetchAlbums( const artist_ptr& artist ) connect( artist.data(), SIGNAL( albumsAdded( QList, Tomahawk::ModelMode ) ), SLOT( onAlbumsFound( QList, Tomahawk::ModelMode ) ), Qt::UniqueConnection ); - + const QModelIndex parent = indexFromArtist( artist ); addAlbums( parent, artist->albums( m_mode, m_collection ) ); } diff --git a/src/libtomahawk/playlist/TreeView.cpp b/src/libtomahawk/playlist/TreeView.cpp index a0fc559ae..16755e5d6 100644 --- a/src/libtomahawk/playlist/TreeView.cpp +++ b/src/libtomahawk/playlist/TreeView.cpp @@ -145,8 +145,8 @@ TreeView::setTreeModel( TreeModel* model ) guid(); // this will set the guid on the header - m_header->setDefaultColumnWeights( model->columnWeights() ); - if ( model->style() == PlayableModel::Large ) + m_header->setDefaultColumnWeights( m_proxyModel->columnWeights() ); + if ( m_proxyModel->style() == PlayableProxyModel::Large ) { setHeaderHidden( true ); setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); @@ -158,7 +158,7 @@ TreeView::setTreeModel( TreeModel* model ) } emit modelChanged(); - + /* setColumnHidden( PlayableModel::Score, true ); // Hide score column per default setColumnHidden( PlayableModel::Origin, true ); // Hide origin column per default setColumnHidden( PlayableModel::Composer, true ); //Hide composer column per default @@ -439,7 +439,7 @@ TreeView::updateHoverIndex( const QPoint& pos ) repaint(); } - if ( !m_model || m_model->style() != PlayableModel::Collection ) + if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Collection ) return; PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( idx ) ); @@ -492,7 +492,7 @@ TreeView::mousePressEvent( QMouseEvent* event ) { QTreeView::mousePressEvent( event ); - if ( !m_model || m_model->style() != PlayableModel::Collection ) + if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Collection ) return; QModelIndex idx = indexAt( event->pos() ); diff --git a/src/libtomahawk/widgets/SocialPlaylistWidget.cpp b/src/libtomahawk/widgets/SocialPlaylistWidget.cpp index a7876d4a9..99c5c4d8d 100644 --- a/src/libtomahawk/widgets/SocialPlaylistWidget.cpp +++ b/src/libtomahawk/widgets/SocialPlaylistWidget.cpp @@ -69,7 +69,7 @@ SocialPlaylistWidget::SocialPlaylistWidget ( QWidget* parent ) m_topForeignTracksModel = new PlaylistModel( ui->newTracksView ); ui->newTracksView->setPlaylistModel( m_topForeignTracksModel ); - m_topForeignTracksModel->setStyle( PlayableModel::Short ); + ui->newTracksView->proxyModel()->setStyle( PlayableProxyModel::Short ); ui->newTracksView->overlay()->setEnabled( false ); m_popularNewAlbumsModel = new PlayableModel( ui->newAlbumsView ); diff --git a/src/libtomahawk/widgets/WelcomeWidget.cpp b/src/libtomahawk/widgets/WelcomeWidget.cpp index 5d9b88fce..7456233d2 100644 --- a/src/libtomahawk/widgets/WelcomeWidget.cpp +++ b/src/libtomahawk/widgets/WelcomeWidget.cpp @@ -69,7 +69,7 @@ WelcomeWidget::WelcomeWidget( QWidget* parent ) updatePlaylists(); m_tracksModel = new RecentlyPlayedModel( ui->tracksView ); - m_tracksModel->setStyle( PlayableModel::ShortWithAvatars ); + ui->tracksView->proxyModel()->setStyle( PlayableProxyModel::ShortWithAvatars ); ui->tracksView->overlay()->setEnabled( false ); ui->tracksView->setPlaylistModel( m_tracksModel ); m_tracksModel->setSource( source_ptr() ); diff --git a/src/libtomahawk/widgets/WhatsHotWidget.cpp b/src/libtomahawk/widgets/WhatsHotWidget.cpp index 2c6deff51..8dba1e009 100644 --- a/src/libtomahawk/widgets/WhatsHotWidget.cpp +++ b/src/libtomahawk/widgets/WhatsHotWidget.cpp @@ -262,7 +262,6 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat TreeModel* artistsModel = new TreeModel( ui->artistsViewLeft ); artistsModel->setMode( InfoSystemMode ); - artistsModel->setStyle( PlayableModel::Collection ); artistsModel->startLoading(); m_artistModels[ chartId ] = artistsModel; @@ -293,7 +292,6 @@ WhatsHotWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestDat connect( loader, SIGNAL( tracks( Tomahawk::ChartDataLoader*, QList< Tomahawk::query_ptr > ) ), this, SLOT( chartTracksLoaded( Tomahawk::ChartDataLoader*, QList< Tomahawk::query_ptr > ) ) ); PlaylistModel* trackModel = new PlaylistModel( ui->tracksViewLeft ); - trackModel->setStyle( PlayableModel::Large ); trackModel->startLoading(); m_trackModels[ chartId ] = trackModel; @@ -463,6 +461,7 @@ WhatsHotWidget::setLeftViewAlbums( PlayableModel* model ) void WhatsHotWidget::setLeftViewArtists( TreeModel* model ) { + ui->artistsViewLeft->proxyModel()->setStyle( PlayableProxyModel::Collection ); ui->artistsViewLeft->setTreeModel( model ); ui->artistsViewLeft->proxyModel()->sort( -1 ); // disable sorting, must be called after artistsViewLeft->setTreeModel ui->stackLeft->setCurrentIndex( 1 ); @@ -472,6 +471,7 @@ WhatsHotWidget::setLeftViewArtists( TreeModel* model ) void WhatsHotWidget::setLeftViewTracks( PlaylistModel* model ) { + ui->tracksViewLeft->proxyModel()->setStyle( PlayableProxyModel::Large ); ui->tracksViewLeft->setPlaylistModel( model ); ui->tracksViewLeft->proxyModel()->sort( -1 ); ui->stackLeft->setCurrentIndex( 0 ); diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp index 645bdaace..9227dbe13 100644 --- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp @@ -25,6 +25,7 @@ #include #include "audio/AudioEngine.h" +#include "playlist/GridItemDelegate.h" #include "playlist/PlayableModel.h" #include "playlist/TreeModel.h" #include "playlist/PlaylistModel.h" @@ -73,7 +74,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* ui->topHits->setEmptyTip( tr( "Sorry, we could not find any related artists!" ) ); m_topHitsModel = new PlaylistModel( ui->topHits ); - m_topHitsModel->setStyle( PlayableModel::Short ); + ui->topHits->proxyModel()->setStyle( PlayableProxyModel::Short ); ui->topHits->setPlayableModel( m_topHitsModel ); ui->topHits->setSortingEnabled( false ); ui->topHits->setEmptyTip( tr( "Sorry, we could not find any top hits for this artist!" ) ); @@ -82,13 +83,13 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget* ui->relatedArtists->setWrapping( false ); ui->relatedArtists->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->relatedArtists->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); - m_relatedModel->setItemSize( QSize( 170, 170 ) ); + ui->relatedArtists->delegate()->setItemSize( QSize( 170, 170 ) ); ui->albums->setAutoFitItems( false ); ui->albums->setWrapping( false ); ui->albums->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); ui->albums->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); - m_albumsModel->setItemSize( QSize( 170, 170 ) ); + ui->albums->delegate()->setItemSize( QSize( 170, 170 ) ); ui->albums->proxyModel()->setHideDupeItems( true ); ui->topHits->setFrameShape( QFrame::StyledPanel ); diff --git a/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp index fd15f3d54..421d122f8 100644 --- a/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp +++ b/src/libtomahawk/widgets/infowidgets/SourceInfoWidget.cpp @@ -50,13 +50,13 @@ SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* ui->splitter->setStretchFactor( 1, 1 ); m_recentTracksModel = new RecentlyAddedModel( ui->recentCollectionView ); - m_recentTracksModel->setStyle( PlayableModel::Short ); + ui->recentCollectionView->proxyModel()->setStyle( PlayableProxyModel::Short ); ui->recentCollectionView->setPlayableModel( m_recentTracksModel ); ui->recentCollectionView->sortByColumn( PlayableModel::Age, Qt::DescendingOrder ); m_recentTracksModel->setSource( source ); m_historyModel = new RecentlyPlayedModel( ui->historyView ); - m_historyModel->setStyle( PlayableModel::Short ); + ui->historyView->proxyModel()->setStyle( PlayableProxyModel::Short ); ui->historyView->setPlaylistModel( m_historyModel ); m_historyModel->setSource( source ); diff --git a/src/sourcetree/items/SourceItem.cpp b/src/sourcetree/items/SourceItem.cpp index 5cf8df283..8275f9f81 100644 --- a/src/sourcetree/items/SourceItem.cpp +++ b/src/sourcetree/items/SourceItem.cpp @@ -513,7 +513,7 @@ SourceItem::latestAdditionsClicked() cv->setAttribute( Qt::WA_MacShowFocusRect, 0 ); RecentlyAddedModel* raModel = new RecentlyAddedModel( cv ); - raModel->setStyle( PlayableModel::Large ); + cv->proxyModel()->setStyle( PlayableProxyModel::Large ); raModel->setTitle( tr( "Latest Additions" ) ); if ( m_source->isLocal() ) @@ -556,7 +556,7 @@ SourceItem::recentPlaysClicked() pv->setAttribute( Qt::WA_MacShowFocusRect, 0 ); RecentlyPlayedModel* raModel = new RecentlyPlayedModel( pv ); - raModel->setStyle( PlayableModel::Large ); + pv->proxyModel()->setStyle( PlayableProxyModel::Large ); raModel->setTitle( tr( "Recently Played Tracks" ) ); if ( m_source->isLocal() )