mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-04 13:17:34 +02:00
Fix TWK-1712
This commit is contained in:
@@ -75,7 +75,7 @@ MetaPlaylistInterface::trackCount() const
|
|||||||
result_ptr
|
result_ptr
|
||||||
MetaPlaylistInterface::currentItem() const
|
MetaPlaylistInterface::currentItem() const
|
||||||
{
|
{
|
||||||
if ( m_childInterfaces.count() )
|
if ( m_childInterfaces.count() && m_childInterfaces.first() )
|
||||||
return m_childInterfaces.first()->currentItem();
|
return m_childInterfaces.first()->currentItem();
|
||||||
else
|
else
|
||||||
return Tomahawk::result_ptr();
|
return Tomahawk::result_ptr();
|
||||||
|
@@ -91,6 +91,15 @@ PlayableProxyModel::isLoading() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPersistentModelIndex
|
||||||
|
PlayableProxyModel::currentIndex() const
|
||||||
|
{
|
||||||
|
if ( !m_model )
|
||||||
|
return QPersistentModelIndex();
|
||||||
|
|
||||||
|
return mapFromSource( m_model->currentItem() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlayableProxyModel::setSourceModel( QAbstractItemModel* model )
|
PlayableProxyModel::setSourceModel( QAbstractItemModel* model )
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
PlayableProxyModel::PlayableItemStyle style() const { return m_style; }
|
PlayableProxyModel::PlayableItemStyle style() const { return m_style; }
|
||||||
void setStyle( PlayableProxyModel::PlayableItemStyle style ) { m_style = 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 setCurrentIndex( const QModelIndex& index );
|
||||||
|
|
||||||
virtual void removeIndex( const QModelIndex& index );
|
virtual void removeIndex( const QModelIndex& index );
|
||||||
|
@@ -262,7 +262,7 @@ PlayableProxyModelPlaylistInterface::currentItem() const
|
|||||||
PlayableProxyModel* proxyModel = m_proxyModel.data();
|
PlayableProxyModel* proxyModel = m_proxyModel.data();
|
||||||
|
|
||||||
PlayableItem* item = proxyModel->itemFromIndex( proxyModel->mapToSource( proxyModel->currentIndex() ) );
|
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 item->query()->results().at( 0 );
|
||||||
|
|
||||||
return result_ptr();
|
return result_ptr();
|
||||||
|
Reference in New Issue
Block a user