1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 15:29:42 +01:00

* The delegates should take care of hooking up the updateIndex( QModelIndex ) signal to the view.

This commit is contained in:
Christian Muehlhaeuser 2013-04-26 07:51:50 +02:00
parent 2a45a53283
commit 6b6b331fa8
10 changed files with 5 additions and 10 deletions

View File

@ -446,7 +446,6 @@ ViewManager::showRecentPlaysPage()
raModel->setDescription( tr( "Recently played tracks from all your friends" ) );
PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv->trackView(), pv->trackView()->proxyModel() );
connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv->trackView(), SLOT( update( QModelIndex ) ) );
pv->trackView()->setItemDelegate( del );
pv->setPlayableModel( raModel );
@ -473,8 +472,6 @@ ViewManager::showInboxPage()
new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::Inbox,
inboxView,
inboxView->proxyModel() );
connect( delegate, SIGNAL( updateIndex( QModelIndex ) ),
inboxView, SLOT( update( QModelIndex ) ) );
inboxView->setItemDelegate( delegate );
inboxView->proxyModel()->setStyle( PlayableProxyModel::Large );

View File

@ -55,7 +55,6 @@ FlexibleView::FlexibleView( QWidget* parent )
m_detailedView->setColumnHidden( PlayableModel::Composer, true ); // Hide composer column per default
PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::LovedTracks, m_trackView, m_trackView->proxyModel() );
connect( del, SIGNAL( updateIndex( QModelIndex ) ), m_trackView, SLOT( update( QModelIndex ) ) );
m_trackView->setItemDelegate( del );
m_trackView->proxyModel()->setStyle( PlayableProxyModel::Large );

View File

@ -54,6 +54,8 @@ GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyMode
if ( m_view && m_view->metaObject()->indexOfSignal( "modelChanged()" ) > -1 )
connect( m_view, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) );
connect( this, SIGNAL( updateIndex( QModelIndex ) ), parent, SLOT( update( QModelIndex ) ) );
connect( proxy, SIGNAL( rowsAboutToBeInserted( QModelIndex, int, int ) ), SLOT( modelChanged() ) );
connect( proxy, SIGNAL( rowsAboutToBeRemoved( QModelIndex, int, int ) ), SLOT( modelChanged() ) );
connect( proxy->playlistInterface().data(), SIGNAL( currentIndexChanged() ), SLOT( onCurrentIndexChanged() ), Qt::UniqueConnection );

View File

@ -113,7 +113,6 @@ GridView::setProxyModel( PlayableProxyModel* model )
delete m_delegate;
m_delegate = new GridItemDelegate( this, m_proxyModel );
connect( m_delegate, SIGNAL( updateIndex( QModelIndex ) ), this, SLOT( update( QModelIndex ) ) );
connect( m_delegate, SIGNAL( startedPlaying( QPersistentModelIndex ) ), this, SLOT( onDelegatePlaying( QPersistentModelIndex ) ) );
connect( m_delegate, SIGNAL( stoppedPlaying( QPersistentModelIndex ) ), this, SLOT( onDelegateStopped( QPersistentModelIndex ) ) );
setItemDelegate( m_delegate );

View File

@ -48,6 +48,8 @@ PlaylistItemDelegate::PlaylistItemDelegate( TrackView* parent, PlayableProxyMode
, m_view( parent )
, m_model( proxy )
{
connect( this, SIGNAL( updateIndex( QModelIndex ) ), parent, SLOT( update( QModelIndex ) ) );
m_topOption = QTextOption( Qt::AlignTop );
m_topOption.setWrapMode( QTextOption::NoWrap );

View File

@ -181,7 +181,6 @@ TrackView::setPlaylistItemDelegate( PlaylistItemDelegate* delegate )
{
m_delegate = delegate;
setItemDelegate( delegate );
connect( delegate, SIGNAL( updateIndex( QModelIndex ) ), SLOT( update( QModelIndex ) ) );
verifySize();
}

View File

@ -45,6 +45,7 @@ TreeItemDelegate::TreeItemDelegate( TreeView* parent, TreeProxyModel* proxy )
, m_view( parent )
, m_model( proxy )
{
connect( this, SIGNAL( updateIndex( QModelIndex ) ), parent, SLOT( update( QModelIndex ) ) );
}

View File

@ -101,7 +101,6 @@ TreeView::setProxyModel( TreeProxyModel* model )
{
m_proxyModel = model;
m_delegate = new TreeItemDelegate( this, m_proxyModel );
connect( m_delegate, SIGNAL( updateIndex( QModelIndex ) ), SLOT( update( QModelIndex ) ) );
setItemDelegate( m_delegate );
QTreeView::setModel( m_proxyModel );

View File

@ -79,7 +79,6 @@ LovedTracksItem::activate()
raModel->setTitle( text() );
PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::LovedTracks, pv->trackView(), pv->trackView()->proxyModel() );
connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv->trackView(), SLOT( update( QModelIndex ) ) );
pv->trackView()->setItemDelegate( del );
pv->setEmptyTip( tr( "Sorry, we could not find any loved tracks!" ) );

View File

@ -613,7 +613,6 @@ SourceItem::latestAdditionsClicked()
raModel->setDescription( tr( "Latest additions to %1's collection" ).arg( m_source->friendlyName() ) );
PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::LatestAdditions, pv->trackView(), pv->trackView()->proxyModel() );
connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv->trackView(), SLOT( update( QModelIndex ) ) );
pv->trackView()->setItemDelegate( del );
pv->setPlayableModel( raModel );
@ -656,7 +655,6 @@ SourceItem::recentPlaysClicked()
raModel->setDescription( tr( "%1's recently played tracks" ).arg( m_source->friendlyName() ) );
PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv->trackView(), pv->trackView()->proxyModel() );
connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv->trackView(), SLOT( update( QModelIndex ) ) );
pv->trackView()->setItemDelegate( del );
pv->setPlayableModel( raModel );