Ejemplo n.º 1
0
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::SourceInfoWidget )
    , m_source( source )
{
    ui->setupUi( this );

    ui->historyView->setFrameShape( QFrame::NoFrame );
    ui->historyView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
    ui->recentAlbumView->setFrameShape( QFrame::NoFrame );
    ui->recentAlbumView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
    ui->recentCollectionView->setFrameShape( QFrame::NoFrame );
    ui->recentCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 );

    TomahawkUtils::unmarginLayout( layout() );

    ui->historyView->overlay()->setEnabled( false );

    m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView );
    m_recentCollectionModel->setStyle( TrackModel::Short );
    ui->recentCollectionView->setTrackModel( m_recentCollectionModel );
    ui->recentCollectionView->sortByColumn( TrackModel::Age, Qt::DescendingOrder );

    m_historyModel = new PlaylistModel( ui->historyView );
    m_historyModel->setStyle( TrackModel::Short );
    ui->historyView->setPlaylistModel( m_historyModel );
    m_historyModel->loadHistory( source, 25 );

    m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
    ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
    ui->recentAlbumView->proxyModel()->sort( -1 );

    onCollectionChanged();

    connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ) );
    connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );

    m_title = tr( "New Additions" );
    if ( source->isLocal() )
    {
        m_description = tr( "My recent activity" );
    }
    else
    {
        m_description = tr( "Recent activity from %1" ).arg( source->friendlyName() );
    }

    m_pixmap.load( RESPATH "images/new-additions.png" );
}
Ejemplo n.º 2
0
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::SourceInfoWidget )
    , m_source( source )
{
    ui->setupUi( this );

    TomahawkUtils::unmarginLayout( layout() );
    TomahawkUtils::unmarginLayout( ui->horizontalLayout );
    TomahawkUtils::unmarginLayout( ui->verticalLayout );
    TomahawkUtils::unmarginLayout( ui->verticalLayout_2 );
    TomahawkUtils::unmarginLayout( ui->verticalLayout_3 );

    ui->splitter->setStretchFactor( 0, 0 );
    ui->splitter->setStretchFactor( 1, 1 );

    ui->historyView->overlay()->setEnabled( false );

    m_recentTracksModel = new RecentlyAddedModel( source, ui->recentCollectionView );
    m_recentTracksModel->setStyle( PlayableModel::Short );
    ui->recentCollectionView->setPlayableModel( m_recentTracksModel );
    ui->recentCollectionView->sortByColumn( PlayableModel::Age, Qt::DescendingOrder );

    m_historyModel = new RecentlyPlayedModel( source, ui->historyView );
    m_historyModel->setStyle( PlayableModel::Short );
    ui->historyView->setPlaylistModel( m_historyModel );

    m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
    ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
    ui->recentAlbumView->proxyModel()->sort( -1 );

    onCollectionChanged();
    connect( source->collection().data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ) );

    m_title = tr( "New Additions" );
    if ( source->isLocal() )
    {
        m_description = tr( "My recent activity" );
    }
    else
    {
        m_description = tr( "Recent activity from %1" ).arg( source->friendlyName() );
    }

    m_pixmap.load( RESPATH "images/new-additions.png" );
}
Ejemplo n.º 3
0
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::SourceInfoWidget )
{
    ui->setupUi( this );

    ui->historyView->overlay()->setEnabled( false );

    m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView );
    ui->recentCollectionView->setModel( m_recentCollectionModel );
    m_recentCollectionModel->addFilteredCollection( source->collection(), 250, DatabaseCommand_AllTracks::ModificationTime );

    m_historyModel = new PlaylistModel( ui->historyView );
    ui->historyView->setModel( m_historyModel );
    m_historyModel->loadHistory( source );

    connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );

    ui->recentCollectionView->setColumnHidden( TrackModel::Bitrate, true );
    ui->recentCollectionView->setColumnHidden( TrackModel::Origin, true );
    ui->recentCollectionView->setColumnHidden( TrackModel::Filesize, true );

    ui->historyView->setColumnHidden( TrackModel::Bitrate, true );
    ui->historyView->setColumnHidden( TrackModel::Origin, true );
    ui->historyView->setColumnHidden( TrackModel::Filesize, true );

    m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
    ui->recentAlbumView->setModel( m_recentAlbumModel );
    m_recentAlbumModel->addFilteredCollection( source->collection(), 20, DatabaseCommand_AllAlbums::ModificationTime );

    m_title = tr( "Info about %1" ).arg( source->isLocal() ? tr( "Your Collection" ) : source->friendlyName() );
}
Ejemplo n.º 4
0
SourceInfoWidget::SourceInfoWidget( const Tomahawk::source_ptr& source, QWidget* parent )
    : QWidget( parent )
    , ui( new Ui::SourceInfoWidget )
{
    ui->setupUi( this );

    ui->historyView->setFrameShape( QFrame::NoFrame );
    ui->historyView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
    ui->recentAlbumView->setFrameShape( QFrame::NoFrame );
    ui->recentAlbumView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
    ui->recentCollectionView->setFrameShape( QFrame::NoFrame );
    ui->recentCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 );

    TomahawkUtils::unmarginLayout( layout() );

    ui->historyView->overlay()->setEnabled( false );

    m_recentCollectionModel = new CollectionFlatModel( ui->recentCollectionView );
    m_recentCollectionModel->setStyle( TrackModel::Short );
    ui->recentCollectionView->setTrackModel( m_recentCollectionModel );
    m_recentCollectionModel->addFilteredCollection( source->collection(), 250, DatabaseCommand_AllTracks::ModificationTime );

    m_historyModel = new PlaylistModel( ui->historyView );
    m_historyModel->setStyle( TrackModel::Short );
    ui->historyView->setPlaylistModel( m_historyModel );
    m_historyModel->loadHistory( source, 25 );

    connect( source.data(), SIGNAL( playbackFinished( Tomahawk::query_ptr ) ), SLOT( onPlaybackFinished( Tomahawk::query_ptr ) ) );

    m_recentAlbumModel = new AlbumModel( ui->recentAlbumView );
    ui->recentAlbumView->setAlbumModel( m_recentAlbumModel );
    m_recentAlbumModel->addFilteredCollection( source->collection(), 20, DatabaseCommand_AllAlbums::ModificationTime );

    m_title = tr( "New Additions" );
    m_description = tr( "Recent activity from %1" ).arg( source->isLocal() ? tr( "Your Collection" ) : source->friendlyName() );
    m_pixmap.load( RESPATH "images/new-additions.png" );
}