mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 16:29:43 +01:00
* Fixed starting first playlist by triggering play.
This commit is contained in:
parent
a0e3d58561
commit
a79a360ce2
@ -159,12 +159,12 @@ PlaylistInterface::filterTracks( const QList<Tomahawk::query_ptr>& queries )
|
||||
bool
|
||||
PlaylistInterface::hasNextResult() const
|
||||
{
|
||||
return !( siblingResult( 1 ).isNull() );
|
||||
return ( currentItem() && siblingResult( 1 ) );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PlaylistInterface::hasPreviousResult() const
|
||||
{
|
||||
return !( siblingResult( -1 ).isNull() );
|
||||
return ( currentItem() && siblingResult( -1 ) );
|
||||
}
|
||||
|
@ -141,7 +141,14 @@ AudioEngine::play()
|
||||
sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowResumed );
|
||||
}
|
||||
else
|
||||
next();
|
||||
{
|
||||
if ( !m_currentTrack && m_playlist && m_playlist->nextResult() )
|
||||
{
|
||||
loadNextTrack();
|
||||
}
|
||||
else
|
||||
next();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -520,7 +527,7 @@ AudioEngine::loadPreviousTrack()
|
||||
}
|
||||
|
||||
Tomahawk::result_ptr result;
|
||||
if ( m_playlist.data()->hasPreviousResult() )
|
||||
if ( m_playlist.data()->previousResult() )
|
||||
{
|
||||
result = m_playlist.data()->previousResult();
|
||||
m_currentTrackPlaylist = m_playlist;
|
||||
@ -561,7 +568,7 @@ AudioEngine::loadNextTrack()
|
||||
{
|
||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Loading playlist's next item" << m_playlist.data() << m_playlist->shuffled();
|
||||
|
||||
if ( m_playlist.data()->hasNextResult() )
|
||||
if ( m_playlist.data()->nextResult() )
|
||||
{
|
||||
result = m_playlist.data()->nextResult();
|
||||
m_currentTrackPlaylist = m_playlist;
|
||||
|
@ -191,9 +191,6 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !proxyModel->currentIndex().isValid() )
|
||||
return -1;
|
||||
|
||||
// random mode is enabled
|
||||
if ( m_shuffleCache.isValid() )
|
||||
{
|
||||
@ -247,17 +244,13 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd
|
||||
idx = proxyModel->mapFromSource( pitem->index );
|
||||
}
|
||||
|
||||
if ( idx.isValid() )
|
||||
idx = proxyModel->index( idx.row() + itemsAway, 0 );
|
||||
idx = proxyModel->index( idx.row() + itemsAway, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !idx.isValid() && m_repeatMode == PlaylistModes::RepeatAll )
|
||||
{
|
||||
if ( !proxyModel->currentIndex().isValid() )
|
||||
return -1;
|
||||
|
||||
// repeat all tracks
|
||||
if ( itemsAway > 0 )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user