Ejemplo n.º 1
0
Tomahawk::ViewPage*
ViewManager::showRecentPlaysPage()
{
    if ( !m_recentPlaysWidget )
    {
        FlexibleView* pv = new FlexibleView( m_widget );
        pv->setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::RecentlyPlayed ) );

        RecentlyPlayedModel* raModel = new RecentlyPlayedModel( pv );
        raModel->setTitle( tr( "Recently Played Tracks" ) );
        raModel->setDescription( tr( "Recently played tracks from all your friends" ) );

        PlaylistLargeItemDelegate* del = new PlaylistLargeItemDelegate( PlaylistLargeItemDelegate::RecentlyPlayed, pv->trackView(), pv->trackView()->proxyModel() );
        connect( del, SIGNAL( updateIndex( QModelIndex ) ), pv->trackView(), SLOT( update( QModelIndex ) ) );
        pv->trackView()->setItemDelegate( del );

        pv->setPlayableModel( raModel );
        pv->setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) );
        raModel->setSource( source_ptr() );

        pv->setGuid( "recentlyplayed" );

        m_recentPlaysWidget = pv;
    }

    return show( m_recentPlaysWidget );
}
Ejemplo n.º 2
0
FlexibleView*
ViewManager::createPageForPlaylist( const playlist_ptr& playlist )
{
    FlexibleView* view = new FlexibleView();
    PlaylistModel* model = new PlaylistModel();

    PlaylistView* pv = new PlaylistView();
    view->setDetailedView( pv );
    view->setPixmap( pv->pixmap() );
    view->setEmptyTip( tr( "This playlist is empty!" ) );

    // We need to set the model on the view before loading the playlist, so spinners & co are connected
    view->setPlaylistModel( model );
    pv->setPlaylistModel( model );

    model->loadPlaylist( playlist );
    playlist->resolve();

    return view;
}
Ejemplo n.º 3
0
FlexibleView*
ViewManager::createPageForList( const QString& title, const QList< query_ptr >& queries )
{
    FlexibleView* view = new FlexibleView();
    PlaylistModel* model = new PlaylistModel();

    PlaylistView* pv = new PlaylistView();
    view->setDetailedView( pv );
    view->setPixmap( pv->pixmap() );
    view->setEmptyTip( tr( "This playlist is empty!" ) );
    view->setTemporaryPage( true );

    // We need to set the model on the view before loading the playlist, so spinners & co are connected
    view->setPlaylistModel( model );
    pv->setPlaylistModel( model );

    model->setTitle( title );
    model->appendQueries( queries );

    return view;
}