Пример #1
0
void
MprisPlugin::setLoopStatus( const QString& value )
{
    Tomahawk::playlistinterface_ptr p = MainAudioEngine::instance()->playlist();
    if ( p.isNull() )
        return;
    if ( value == "Track" )
        p->setRepeatMode( PlaylistModes::RepeatOne );
    else if ( value == "Playlist" )
        p->setRepeatMode( PlaylistModes::RepeatAll );
    else if ( value == "None" )
        p->setRepeatMode( PlaylistModes::NoRepeat );
}
Пример #2
0
void
AudioEngine::playItem( Tomahawk::playlistinterface_ptr playlist, const Tomahawk::result_ptr& result, const Tomahawk::query_ptr& fromQuery )
{
    tDebug( LOGEXTRA ) << Q_FUNC_INFO << ( result.isNull() ? QString() : result->url() );

    if ( !m_playlist.isNull() )
        m_playlist.data()->reset();

    setPlaylist( playlist );

    if ( playlist.isNull() && !fromQuery.isNull() )
        m_currentTrackPlaylist = playlistinterface_ptr( new SingleTrackPlaylistInterface( fromQuery ) );
    else
        m_currentTrackPlaylist = playlist;

    if ( !result.isNull() )
    {
        loadTrack( result );
    }
    else if ( !m_playlist.isNull() && m_playlist.data()->retryMode() == PlaylistModes::Retry )
    {
        m_waitingOnNewTrack = true;
        if ( isStopped() )
            emit sendWaitingNotification();
        else
            stop();
    }
}
Пример #3
0
void
AudioEngine::setPlaylist( Tomahawk::playlistinterface_ptr playlist )
{
    if ( m_playlist == playlist )
        return;

    if ( !m_playlist.isNull() )
    {
        if ( m_playlist.data() && m_playlist.data()->retryMode() == PlaylistModes::Retry )
            disconnect( m_playlist.data(), SIGNAL( nextTrackReady() ) );
        m_playlist.data()->reset();
    }

    if ( playlist.isNull() )
    {
        m_playlist.clear();
        emit playlistChanged( playlist );
        return;
    }

    m_playlist = playlist;
    m_stopAfterTrack.clear();

    if ( !m_playlist.isNull() && m_playlist.data() && m_playlist.data()->retryMode() == PlaylistModes::Retry )
        connect( m_playlist.data(), SIGNAL( nextTrackReady() ), SLOT( onPlaylistNextTrackReady() ) );

    emit playlistChanged( playlist );
}
Пример #4
0
void
AudioEngine::setPlaylist( Tomahawk::playlistinterface_ptr playlist )
{
    if ( m_playlist == playlist )
        return;

    if ( !m_playlist.isNull() )
    {
        if ( m_playlist.data() )
        {
            disconnect( m_playlist.data(), SIGNAL( previousTrackAvailable() ) );
            disconnect( m_playlist.data(), SIGNAL( nextTrackAvailable() ) );
        }

        m_playlist.data()->reset();
    }

    if ( playlist.isNull() )
    {
        m_playlist.clear();
        emit playlistChanged( playlist );
        return;
    }

    m_playlist = playlist;
    m_stopAfterTrack.clear();

    if ( !m_playlist.isNull() )
    {
        connect( m_playlist.data(), SIGNAL( nextTrackAvailable() ), SLOT( onPlaylistNextTrackAvailable() ) );

        connect( m_playlist.data(), SIGNAL( previousTrackAvailable() ), SIGNAL( controlStateChanged() ) );
        connect( m_playlist.data(), SIGNAL( nextTrackAvailable() ), SIGNAL( controlStateChanged() ) );
    }

    emit playlistChanged( playlist );
}