mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Fixed starting first playlist by triggering play.
This commit is contained in:
@@ -159,12 +159,12 @@ PlaylistInterface::filterTracks( const QList<Tomahawk::query_ptr>& queries )
|
|||||||
bool
|
bool
|
||||||
PlaylistInterface::hasNextResult() const
|
PlaylistInterface::hasNextResult() const
|
||||||
{
|
{
|
||||||
return !( siblingResult( 1 ).isNull() );
|
return ( currentItem() && siblingResult( 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
PlaylistInterface::hasPreviousResult() const
|
PlaylistInterface::hasPreviousResult() const
|
||||||
{
|
{
|
||||||
return !( siblingResult( -1 ).isNull() );
|
return ( currentItem() && siblingResult( -1 ) );
|
||||||
}
|
}
|
||||||
|
@@ -140,8 +140,15 @@ AudioEngine::play()
|
|||||||
|
|
||||||
sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowResumed );
|
sendNowPlayingNotification( Tomahawk::InfoSystem::InfoNowResumed );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !m_currentTrack && m_playlist && m_playlist->nextResult() )
|
||||||
|
{
|
||||||
|
loadNextTrack();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
next();
|
next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -520,7 +527,7 @@ AudioEngine::loadPreviousTrack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::result_ptr result;
|
Tomahawk::result_ptr result;
|
||||||
if ( m_playlist.data()->hasPreviousResult() )
|
if ( m_playlist.data()->previousResult() )
|
||||||
{
|
{
|
||||||
result = m_playlist.data()->previousResult();
|
result = m_playlist.data()->previousResult();
|
||||||
m_currentTrackPlaylist = m_playlist;
|
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();
|
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();
|
result = m_playlist.data()->nextResult();
|
||||||
m_currentTrackPlaylist = m_playlist;
|
m_currentTrackPlaylist = m_playlist;
|
||||||
|
@@ -191,9 +191,6 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( !proxyModel->currentIndex().isValid() )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
// random mode is enabled
|
// random mode is enabled
|
||||||
if ( m_shuffleCache.isValid() )
|
if ( m_shuffleCache.isValid() )
|
||||||
{
|
{
|
||||||
@@ -247,7 +244,6 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd
|
|||||||
idx = proxyModel->mapFromSource( pitem->index );
|
idx = proxyModel->mapFromSource( pitem->index );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( idx.isValid() )
|
|
||||||
idx = proxyModel->index( idx.row() + itemsAway, 0 );
|
idx = proxyModel->index( idx.row() + itemsAway, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,9 +251,6 @@ PlayableProxyModelPlaylistInterface::siblingIndex( int itemsAway, qint64 rootInd
|
|||||||
|
|
||||||
if ( !idx.isValid() && m_repeatMode == PlaylistModes::RepeatAll )
|
if ( !idx.isValid() && m_repeatMode == PlaylistModes::RepeatAll )
|
||||||
{
|
{
|
||||||
if ( !proxyModel->currentIndex().isValid() )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
// repeat all tracks
|
// repeat all tracks
|
||||||
if ( itemsAway > 0 )
|
if ( itemsAway > 0 )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user