mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-02 10:24:01 +02:00
* Fixed trying to access root-item's name().
This commit is contained in:
@@ -350,11 +350,13 @@ PlayableModel::headerData( int section, Qt::Orientation orientation, int role )
|
|||||||
void
|
void
|
||||||
PlayableModel::setCurrentItem( const QModelIndex& index )
|
PlayableModel::setCurrentItem( const QModelIndex& index )
|
||||||
{
|
{
|
||||||
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
if ( m_currentIndex.isValid() )
|
||||||
if ( oldEntry )
|
|
||||||
{
|
{
|
||||||
tDebug() << "ISNT PLAYING ANYMORE:" << oldEntry->name();
|
PlayableItem* oldEntry = itemFromIndex( m_currentIndex );
|
||||||
oldEntry->setIsPlaying( false );
|
if ( oldEntry )
|
||||||
|
{
|
||||||
|
oldEntry->setIsPlaying( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayableItem* entry = itemFromIndex( index );
|
PlayableItem* entry = itemFromIndex( index );
|
||||||
@@ -362,7 +364,6 @@ PlayableModel::setCurrentItem( const QModelIndex& index )
|
|||||||
{
|
{
|
||||||
m_currentIndex = index;
|
m_currentIndex = index;
|
||||||
m_currentUuid = entry->query()->id();
|
m_currentUuid = entry->query()->id();
|
||||||
tDebug() << "IS PLAYING NOW:" << entry->name();
|
|
||||||
entry->setIsPlaying( true );
|
entry->setIsPlaying( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -769,19 +770,14 @@ PlayableModel::itemFromIndex( const QModelIndex& index ) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayableItem *PlayableModel::itemFromIndex(int itemIndex) const
|
|
||||||
|
PlayableItem*
|
||||||
|
PlayableModel::itemFromIndex( int itemIndex ) const
|
||||||
{
|
{
|
||||||
QModelIndex modelIndex = index( itemIndex, 0, QModelIndex() );
|
return itemFromIndex( index( itemIndex, 0, QModelIndex() ) );
|
||||||
if ( modelIndex.isValid() )
|
|
||||||
{
|
|
||||||
return static_cast<PlayableItem*>( modelIndex.internalPointer() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return m_rootItem;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PlayableModel::appendArtist( const Tomahawk::artist_ptr& artist )
|
PlayableModel::appendArtist( const Tomahawk::artist_ptr& artist )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user