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


C++ tomahawk::collection_ptr类代码示例

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


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

示例1: qDebug

void
QtScriptResolverHelper::addAlbumTrackResults( const QVariantMap& results )
{
    qDebug() << "Resolver reporting album tracks:" << results;
    QString artistName = results.value( "artist" ).toString();
    if ( artistName.trimmed().isEmpty() )
        return;
    QString albumName = results.value( "album" ).toString();
    if ( albumName.trimmed().isEmpty() )
        return;

    Tomahawk::artist_ptr artist = Tomahawk::Artist::get( artistName, false );
    Tomahawk::album_ptr  album  = Tomahawk::Album::get( artist, albumName, false );

    QList< Tomahawk::result_ptr > tracks = m_resolver->parseResultVariantList( results.value("results").toList() );

    QString qid = results.value("qid").toString();

    Tomahawk::collection_ptr collection = Tomahawk::collection_ptr();
    foreach ( const Tomahawk::collection_ptr& coll, m_resolver->collections() )
    {
        if ( coll->name() == qid )
        {
            collection = coll;
        }
    }
    if ( collection.isNull() )
        return;

    QList< Tomahawk::query_ptr > queries;
    foreach ( const Tomahawk::result_ptr& result, tracks )
    {
        result->setScore( 1.0 );
        queries.append( result->toQuery() );
    }
开发者ID:nelsont,项目名称:tomahawk,代码行数:35,代码来源:QtScriptResolver.cpp

示例2: uuid

QList<album_ptr>
Artist::albums( ModelMode mode, const Tomahawk::collection_ptr& collection ) const
{
    artist_ptr artist = m_ownRef.toStrongRef();

    bool dbLoaded = m_albumsLoaded.value( DatabaseMode );
    const bool infoLoaded = m_albumsLoaded.value( InfoSystemMode );
    if ( !collection.isNull() )
        dbLoaded = false;

    m_uuid = uuid();
    tDebug() << Q_FUNC_INFO << mode;

    if ( ( mode == DatabaseMode || mode == Mixed ) && !dbLoaded )
    {
        DatabaseCommand_AllAlbums* cmd = new DatabaseCommand_AllAlbums( collection, artist );
        cmd->setData( QVariant( collection.isNull() ) );

        connect( cmd, SIGNAL( albums( QList<Tomahawk::album_ptr>, QVariant ) ),
                        SLOT( onAlbumsFound( QList<Tomahawk::album_ptr>, QVariant ) ) );

        Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
    }

    if ( ( mode == InfoSystemMode || mode == Mixed ) && !infoLoaded )
    {
        Tomahawk::InfoSystem::InfoStringHash artistInfo;
        artistInfo["artist"] = name();

        Tomahawk::InfoSystem::InfoRequestData requestData;
        requestData.caller = m_uuid;
        requestData.input = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( artistInfo );
        requestData.type = Tomahawk::InfoSystem::InfoArtistReleases;

        connect( Tomahawk::InfoSystem::InfoSystem::instance(),
                 SIGNAL( info( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ),
                 SLOT( infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData, QVariant ) ), Qt::UniqueConnection );

        connect( Tomahawk::InfoSystem::InfoSystem::instance(),
                 SIGNAL( finished( QString ) ),
                 SLOT( infoSystemFinished( QString ) ), Qt::UniqueConnection );

        m_infoJobs++;
        Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
    }

    if ( !collection.isNull() )
        return QList<album_ptr>();

    switch ( mode )
    {
        case DatabaseMode:
            return m_databaseAlbums;
        case InfoSystemMode:
            return m_officialAlbums;
        default:
            return m_databaseAlbums + m_officialAlbums;
    }
}
开发者ID:seezer,项目名称:tomahawk,代码行数:59,代码来源:Artist.cpp

示例3: source

Tomahawk::AlbumsRequest*
DatabaseCollection::requestAlbums( const Tomahawk::artist_ptr& artist )
{
    //FIXME: assuming there's only one dbcollection per source, and that this is the one
    Tomahawk::collection_ptr thisCollection = source()->dbCollection();
    if ( thisCollection->name() != this->name() )
        return 0;

    Tomahawk::AlbumsRequest* cmd = new DatabaseCommand_AllAlbums( thisCollection, artist );

    return cmd;
}
开发者ID:Alex237,项目名称:tomahawk,代码行数:12,代码来源:DatabaseCollection.cpp

示例4: connect

void
Result::setResolvedByCollection( const Tomahawk::collection_ptr& collection , bool emitOnlineEvents )
{
    m_collection = collection;
    if ( emitOnlineEvents )
    {
        Q_ASSERT( !collection.isNull() );
        connect( collection.data(), SIGNAL( destroyed( QObject * ) ), SLOT( onOffline() ), Qt::QueuedConnection );
        connect( collection.data(), SIGNAL( online() ), SLOT( onOnline() ), Qt::QueuedConnection );
        connect( collection.data(), SIGNAL( offline() ), SLOT( onOffline() ), Qt::QueuedConnection );
    }
}
开发者ID:cash,项目名称:tomahawk,代码行数:12,代码来源:Result.cpp

示例5: source

Tomahawk::TracksRequest*
DatabaseCollection::requestTracks( const Tomahawk::album_ptr& album )
{
    //FIXME: assuming there's only one dbcollection per source, and that this is the one
    Tomahawk::collection_ptr thisCollection = source()->dbCollection();
    if ( thisCollection->name() != this->name() )
        return 0;

    DatabaseCommand_AllTracks* cmd = new DatabaseCommand_AllTracks( thisCollection );
    cmd->setAlbum( album->weakRef() );
    cmd->setSortOrder( DatabaseCommand_AllTracks::AlbumPosition );

    return cmd;
}
开发者ID:purcaro,项目名称:tomahawk,代码行数:14,代码来源:DatabaseCollection.cpp

示例6: connect

AlbumPlaylistInterface::AlbumPlaylistInterface( Tomahawk::Album* album, Tomahawk::ModelMode mode, const Tomahawk::collection_ptr& collection )
    : Tomahawk::PlaylistInterface()
    , m_currentItem( 0 )
    , m_infoSystemLoaded( false )
    , m_databaseLoaded( false )
    , m_mode( mode )
    , m_collection( collection )
    , m_album( QPointer< Tomahawk::Album >( album ) )
    , m_lastQueryTimestamp( 0 )
{
    if ( m_collection )
    {
        connect( collection.data(), SIGNAL( changed() ), SLOT( onCollectionChanged() ), Qt::UniqueConnection );
    }
}
开发者ID:pmpontes,项目名称:tomahawk,代码行数:15,代码来源:AlbumPlaylistInterface.cpp

示例7: QModelIndex

QModelIndex
SourcesModel::collectionToIndex( const Tomahawk::collection_ptr& collection )
{
    for ( int i = 0; i < rowCount(); i++ )
    {
        QModelIndex idx = index( i, 0 );
        SourcesModel::SourceType type = SourcesModel::indexType( idx );
        if ( type == SourcesModel::CollectionSource )
        {
            SourceTreeItem* sti = SourcesModel::indexToTreeItem( idx );
            if ( sti && !sti->source().isNull() && sti->source()->collection().data() == collection.data() )
                return idx;
        }
    }

    return QModelIndex();
}
开发者ID:tiegz,项目名称:tomahawk,代码行数:17,代码来源:sourcesmodel.cpp

示例8: 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类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。