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:
parent
8afa54f2de
commit
f28bb9ee79
@ -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();
|
||||
|
@ -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 )
|
||||
|
@ -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 );
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user