コード例 #1
0
ファイル: MprisPlugin.cpp プロジェクト: seezer/tomahawk
QString
MprisPlugin::loopStatus() const
{
    Tomahawk::playlistinterface_ptr p = AudioEngine::instance()->playlist();
    if ( p.isNull() )
        return "None";
    PlaylistModes::RepeatMode mode = p->repeatMode();
    switch( mode )
    {
        case PlaylistModes::RepeatOne:
            return "Track";
            break;
        case PlaylistModes::RepeatAll:
            return "Playlist";
            break;
        case PlaylistModes::NoRepeat:
            return "None";
            break;
        default:
            return "None";
            break;
    }

    return QString( "None" );
}
コード例 #2
0
ファイル: MprisPlugin.cpp プロジェクト: seezer/tomahawk
bool
MprisPlugin::canPlay() const
{
    // If there is a currently playing track, or if there is a playlist with at least 1 track, you can hit play
    Tomahawk::playlistinterface_ptr p = AudioEngine::instance()->playlist();
    return AudioEngine::instance()->currentTrack() || ( !p.isNull() && p->trackCount() );
}
コード例 #3
0
ファイル: AudioEngine.cpp プロジェクト: nowrep/tomahawk
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
ファイル: AudioEngine.cpp プロジェクト: eowemanuel/tomahawk
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();
    }
}
コード例 #5
0
ファイル: MprisPlugin.cpp プロジェクト: seezer/tomahawk
void
MprisPlugin::setShuffle( bool value )
{
    Tomahawk::playlistinterface_ptr p = AudioEngine::instance()->playlist();
    if ( p.isNull() )
        return;
    return p->setShuffled( value );
}
コード例 #6
0
ファイル: MprisPlugin.cpp プロジェクト: seezer/tomahawk
bool
MprisPlugin::shuffle() const
{
    Tomahawk::playlistinterface_ptr p = AudioEngine::instance()->playlist();
    if ( p.isNull() )
        return false;
    return p->shuffled();
}
コード例 #7
0
ファイル: MprisPlugin.cpp プロジェクト: seezer/tomahawk
bool
MprisPlugin::canSeek() const
{
    Tomahawk::playlistinterface_ptr p = AudioEngine::instance()->playlist();
    if ( p.isNull() )
        return false;
    return p->seekRestrictions() != PlaylistModes::NoSeek;

}
コード例 #8
0
ファイル: MprisPlugin.cpp プロジェクト: seezer/tomahawk
void
MprisPlugin::setLoopStatus( const QString& value )
{
    Tomahawk::playlistinterface_ptr p = AudioEngine::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 );
}
コード例 #9
0
ファイル: AudioEngine.cpp プロジェクト: rockymontana/tomahawk
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 );
}