当前位置: 首页>>代码示例>>C++>>正文


C++ collection_ptr::backendType方法代码示例

本文整理汇总了C++中tomahawk::collection_ptr::backendType方法的典型用法代码示例。如果您正苦于以下问题:C++ collection_ptr::backendType方法的具体用法?C++ collection_ptr::backendType怎么用?C++ collection_ptr::backendType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tomahawk::collection_ptr的用法示例。


在下文中一共展示了collection_ptr::backendType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fm

CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collection, QWidget* parent )
    : QWidget( parent )
    , m_header( new FilterHeader( this ) )
    , m_columnView( new ColumnView() )
    , m_trackView( new TrackView() )
    , m_albumView( new GridView() )
    , m_model( 0 )
    , m_flatModel( 0 )
    , m_albumModel( 0 )
    , m_playlistInterface( new MetaPlaylistInterface() )
{
    qRegisterMetaType< CollectionViewPageMode >( "CollectionViewPageMode" );

    m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background.png", QSize( 0, 0 ) ), false );
    setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultCollection, TomahawkUtils::Original, QSize( 256, 256 ) ) );

    m_columnView->proxyModel()->setStyle( PlayableProxyModel::SingleColumn );

    if ( collection->backendType() == Collection::ScriptCollectionType )
    {
        m_trackView->proxyModel()->setStyle( PlayableProxyModel::Locker );
    }
    else
    {
        m_trackView->proxyModel()->setStyle( PlayableProxyModel::Collection );
    }

    m_trackView->setGuid( QString( "trackview/flat" ) );

    {
        m_albumView->setAutoResize( false );
        m_albumView->setAutoFitItems( true );
        m_albumView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
        m_albumView->setItemWidth( TomahawkUtils::DpiScaler::scaledX( this, 170 ) );
        m_albumView->delegate()->setWordWrapping( true );

        m_albumView->setEmptyTip( tr( "Sorry, there are no albums in this collection!" ) );

        TomahawkStyle::stylePageFrame( m_albumView );

        m_albumView->setStyleSheet( QString( "QListView { background-color: %1; }" ).arg( TomahawkStyle::PAGE_BACKGROUND.name() ) );
    }

    m_stack = new QStackedWidget();
    setLayout( new QVBoxLayout() );
    TomahawkUtils::unmarginLayout( layout() );

    {
        m_header->ui->anchor1Label->setText( tr( "Artists" ) );
        m_header->ui->anchor2Label->setText( tr( "Albums" ) );
        m_header->ui->anchor3Label->setText( tr( "Songs" ) );

        if ( collection->browseCapabilities().contains( Collection::CapabilityBrowseArtists ) )
            m_header->ui->anchor1Label->show();

        if ( collection->browseCapabilities().contains( Collection::CapabilityBrowseAlbums ) )
            m_header->ui->anchor2Label->show();

        if ( collection->browseCapabilities().contains( Collection::CapabilityBrowseTracks ) )
            m_header->ui->anchor3Label->show();

        const float lowOpacity = 0.8;
        m_header->ui->anchor1Label->setOpacity( 1 );
        m_header->ui->anchor2Label->setOpacity( lowOpacity );
        m_header->ui->anchor3Label->setOpacity( lowOpacity );

        QFontMetrics fm( m_header->ui->anchor1Label->font() );
        m_header->ui->anchor1Label->setFixedWidth( fm.width( m_header->ui->anchor1Label->text() ) + 16 );
        m_header->ui->anchor2Label->setFixedWidth( fm.width( m_header->ui->anchor2Label->text() ) + 16 );
        m_header->ui->anchor3Label->setFixedWidth( fm.width( m_header->ui->anchor3Label->text() ) + 16 );

        NewClosure( m_header->ui->anchor1Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Columns )->setAutoDelete( false );
        NewClosure( m_header->ui->anchor2Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Albums )->setAutoDelete( false );
        NewClosure( m_header->ui->anchor3Label, SIGNAL( clicked() ), const_cast< CollectionViewPage* >( this ), SLOT( setCurrentMode( CollectionViewPageMode ) ), CollectionViewPage::Flat )->setAutoDelete( false );
    }

    if ( collection->backendType() == Collection::ScriptCollectionType )
    {
        QAbstractButton* downloadButton = m_header->addButton( tr( "Download All" ) );
        connect( downloadButton, SIGNAL( clicked() ), SLOT( onDownloadAll() ) );

        m_header->setRefreshVisible( true );
        connect( m_header, SIGNAL( refresh() ), SLOT( onCollectionChanged() ) );
    }

    layout()->addWidget( m_header );
    layout()->addWidget( m_stack );

    m_stack->addWidget( m_columnView );
    m_stack->addWidget( m_albumView );
    m_stack->addWidget( m_trackView );

    connect( m_header, SIGNAL( filterTextChanged( QString ) ), SLOT( setFilter( QString ) ) );

    m_playlistInterface->addChildInterface( m_trackView->playlistInterface() );
    m_playlistInterface->addChildInterface( m_albumView->playlistInterface() );
    m_playlistInterface->addChildInterface( m_columnView->proxyModel()->playlistInterface() );

    loadCollection( collection );
}
开发者ID:pmpontes,项目名称:tomahawk,代码行数:100,代码来源:CollectionViewPage.cpp


注:本文中的tomahawk::collection_ptr::backendType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。