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

Fix TWK-1712

This commit is contained in:
Uwe L. Korn 2014-09-17 20:25:00 +01:00
parent 8afa54f2de
commit f28bb9ee79
4 changed files with 12 additions and 3 deletions

View File

@ -75,7 +75,7 @@ MetaPlaylistInterface::trackCount() const
result_ptr
MetaPlaylistInterface::currentItem() const
{
if ( m_childInterfaces.count() )
if ( m_childInterfaces.count() && m_childInterfaces.first() )
return m_childInterfaces.first()->currentItem();
else
return Tomahawk::result_ptr();

View File

@ -91,6 +91,15 @@ PlayableProxyModel::isLoading() const
return false;
}
QPersistentModelIndex
PlayableProxyModel::currentIndex() const
{
if ( !m_model )
return QPersistentModelIndex();
return mapFromSource( m_model->currentItem() );
}
void
PlayableProxyModel::setSourceModel( QAbstractItemModel* model )

View File

@ -52,7 +52,7 @@ public:
PlayableProxyModel::PlayableItemStyle style() const { return m_style; }
void setStyle( PlayableProxyModel::PlayableItemStyle style ) { m_style = style; }
virtual QPersistentModelIndex currentIndex() const { return mapFromSource( m_model->currentItem() ); }
virtual QPersistentModelIndex currentIndex() const;
virtual void setCurrentIndex( const QModelIndex& index );
virtual void removeIndex( const QModelIndex& index );

View File

@ -262,7 +262,7 @@ PlayableProxyModelPlaylistInterface::currentItem() const
PlayableProxyModel* proxyModel = m_proxyModel.data();
PlayableItem* item = proxyModel->itemFromIndex( proxyModel->mapToSource( proxyModel->currentIndex() ) );
if ( item && !item->query().isNull() && item->query()->playable() )
if ( item && item->query() && item->query()->playable() )
return item->query()->results().at( 0 );
return result_ptr();