Example #1
0
bool
PlaylistManager::show( const Tomahawk::album_ptr& album )
{
    PlaylistView* view;
    if ( !m_albumViews.contains( album ) )
    {
        view = new PlaylistView();
        PlaylistModel* model = new PlaylistModel();
        view->setModel( model );
        view->setFrameShape( QFrame::NoFrame );
        view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
        model->append( album );

        m_albumViews.insert( album, view );
    }
    else
    {
        view = m_albumViews.value( album );
    }
    
    setPage( view );
    emit numSourcesChanged( 1 );

    return true;
}
Example #2
0
bool
PlaylistManager::show( const Tomahawk::playlist_ptr& playlist )
{
    PlaylistView* view;
    if ( !m_playlistViews.contains( playlist ) )
    {
        view = new PlaylistView();
        PlaylistModel* model = new PlaylistModel();
        view->setModel( model );
        view->setFrameShape( QFrame::NoFrame );
        view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
        model->loadPlaylist( playlist );
        playlist->resolve();

        m_playlistViews.insert( playlist, view );
    }
    else
    {
        view = m_playlistViews.value( playlist );
    }
    
    setPage( view );
    TomahawkSettings::instance()->appendRecentlyPlayedPlaylist( playlist );
    emit numSourcesChanged( SourceList::instance()->count() );

    return true;
}