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


C++ PlayableItem::query方法代码示例

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


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

示例1: if

void
GridItemDelegate::onPlayClicked( const QPersistentModelIndex& index )
{
    QPoint pos = m_playButton[ index ]->pos();
    clearButtons();

    AnimatedSpinner* spinner = new AnimatedSpinner( m_view );
    spinner->setAutoCenter( false );
    spinner->fadeIn();
    spinner->move( pos );
    spinner->setFocusPolicy( Qt::NoFocus );
    spinner->installEventFilter( this );

    m_spinner[ index ] = spinner;

    PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );

    NewClosure(  AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ),
                const_cast<GridItemDelegate*>(this), SLOT( onPlaybackStarted( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );

    if ( item )
    {
        if ( !item->query().isNull() )
            AudioEngine::instance()->playItem( m_model->playlistInterface(), item->query() );
        else if ( !item->album().isNull() )
            AudioEngine::instance()->playItem( item->album() );
        else if ( !item->artist().isNull() )
            AudioEngine::instance()->playItem( item->artist() );
    }
}
开发者ID:ChrisOHu,项目名称:tomahawk,代码行数:30,代码来源:GridItemDelegate.cpp

示例2: indexAt

void
TreeView::mousePressEvent( QMouseEvent* event )
{
    QTreeView::mousePressEvent( event );

    if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Collection )
        return;

    QModelIndex idx = indexAt( event->pos() );
    if ( event->pos().x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 &&
         event->pos().x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) )
    {
        PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( idx ) );
        if ( item->query().isNull() )
            return;

        switch ( idx.column() )
        {
            case 0:
            {
                ViewManager::instance()->show( item->query()->displayQuery() );
                break;
            }

            default:
                break;
        }
    }
}
开发者ID:mokerjoke,项目名称:tomahawk,代码行数:29,代码来源:TreeView.cpp

示例3: itemFromIndex

bool
PlayableProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const
{
    PlayableItem* pi = itemFromIndex( sourceModel()->index( sourceRow, 0, sourceParent ) );
    if ( !pi )
        return false;

    if ( m_maxVisibleItems >= 0 && sourceRow > m_maxVisibleItems - 1 )
        return false;

    if ( m_hideDupeItems )
    {
        for ( int i = 0; i < sourceRow; i++ )
        {
            PlayableItem* di = itemFromIndex( sourceModel()->index( i, 0, sourceParent ) );
            if ( !di )
                continue;

            bool b = ( pi->query() && pi->query()->equals( di->query() ) ) ||
                     ( pi->album() && pi->album() == di->album() ) ||
                     ( pi->artist() && pi->artist()->name() == di->artist()->name() );

            if ( b && filterAcceptsRow( i, sourceParent ) )
                return false;
        }
    }

    if ( pi->query() )
    {
        const Tomahawk::query_ptr& q = pi->query()->displayQuery();
        if ( q.isNull() ) // uh oh? filter out invalid queries i guess
            return false;

        Tomahawk::result_ptr r;
        if ( q->numResults() )
            r = q->results().first();

        if ( !m_showOfflineResults && ( r.isNull() || !r->isOnline() ) )
            return false;

        if ( filterRegExp().isEmpty() )
            return true;

        QStringList sl = filterRegExp().pattern().split( " ", QString::SkipEmptyParts );
        foreach( QString s, sl )
        {
            s = s.toLower();
            if ( !q->artist().toLower().contains( s ) &&
                    !q->album().toLower().contains( s ) &&
                    !q->track().toLower().contains( s ) )
            {
                return false;
            }
        }
    }
开发者ID:keithmadsen,项目名称:tomahawk,代码行数:55,代码来源:PlayableProxyModel.cpp

示例4: query_ptr

Tomahawk::query_ptr
PlayableProxyModelPlaylistInterface::queryAt( qint64 index ) const
{
    if ( m_proxyModel.isNull() )
        return query_ptr();

    PlayableItem* item = reinterpret_cast<PlayableItem*>( (void*)index );
    if ( item && item->query() )
        return item->query();

    return query_ptr();
}
开发者ID:AndyCoder,项目名称:tomahawk,代码行数:12,代码来源:PlayableProxyModelPlaylistInterface.cpp

示例5: result_ptr

Tomahawk::result_ptr
PlayableProxyModelPlaylistInterface::currentItem() const
{
    if ( m_proxyModel.isNull() )
        return Tomahawk::result_ptr();

    PlayableProxyModel* proxyModel = m_proxyModel.data();

    PlayableItem* item = proxyModel->itemFromIndex( proxyModel->mapToSource( proxyModel->currentIndex() ) );
    if ( item && !item->query().isNull() && item->query()->playable() )
        return item->query()->results().at( 0 );
    return Tomahawk::result_ptr();
}
开发者ID:creichert,项目名称:tomahawk,代码行数:13,代码来源:PlayableProxyModelPlaylistInterface.cpp

示例6: querySelected

void
TrackView::currentChanged( const QModelIndex& current, const QModelIndex& previous )
{
    QTreeView::currentChanged( current, previous );

    PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( current ) );
    if ( item && item->query() )
    {
        emit querySelected( item->query() );
    }
    else
    {
        emit querySelected( query_ptr() );
    }
}
开发者ID:RahulKondi,项目名称:tomahawk,代码行数:15,代码来源:TrackView.cpp

示例7: NewClosure

void
TrackView::startAutoPlay( const QModelIndex& index )
{
    if ( tryToPlayItem( index ) )
        return;

    // item isn't playable but still resolving
    PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) );
    if ( item && !item->query().isNull() && !item->query()->resolvingFinished() )
    {
        m_autoPlaying = item->query(); // So we can kill it if user starts autoplaying this playlist again
        NewClosure( item->query().data(), SIGNAL( resolvingFinished( bool ) ), this, SLOT( autoPlayResolveFinished( Tomahawk::query_ptr, int ) ),
                    item->query(), index.row() );
        return;
    }
开发者ID:barovski,项目名称:tomahawk,代码行数:15,代码来源:TrackView.cpp

示例8: index

void
QueueProxyModel::onPlaybackStarted( const Tomahawk::result_ptr& result )
{
    for ( int i = 0; i < rowCount(); i++ )
    {
        QModelIndex idx = index( i, 0 );
        PlayableItem* item = itemFromIndex( mapToSource( idx ) );
        if ( item && item->query() && ( item->query()->results().contains( result ) ||
                                        item->query()->track()->equals( result->track() ) ) )
        {
            removeIndex( idx );
            if ( !rowCount() )
                ViewManager::instance()->hideQueue();
        }
    }
}
开发者ID:AltarBeastiful,项目名称:tomahawk,代码行数:16,代码来源:QueueProxyModel.cpp

示例9: if

void
ColumnView::onCustomContextMenu( const QPoint& pos )
{
    m_contextMenu->clear();

    QModelIndex idx = indexAt( pos );
    idx = idx.sibling( idx.row(), 0 );
    m_contextMenuIndex = idx;

    if ( !idx.isValid() )
        return;

    QList<query_ptr> queries;
    QList<artist_ptr> artists;
    QList<album_ptr> albums;

    QModelIndexList indexes = selectedIndexes();
    if ( !indexes.contains( idx ) )
    {
        indexes.clear();
        indexes << idx;
    }

    foreach ( const QModelIndex& index, indexes )
    {
        if ( index.column() || indexes.contains( index.parent() ) )
            continue;

        PlayableItem* item = m_proxyModel->itemFromIndex( m_proxyModel->mapToSource( index ) );

        if ( item && !item->result().isNull() )
            queries << item->result()->toQuery();
        else if ( item && !item->query().isNull() )
            queries << item->query();
        if ( item && !item->artist().isNull() )
            artists << item->artist();
        if ( item && !item->album().isNull() )
            albums << item->album();
    }

    m_contextMenu->setQueries( queries );
    m_contextMenu->setArtists( artists );
    m_contextMenu->setAlbums( albums );
    m_contextMenu->setPlaylistInterface( proxyModel()->playlistInterface() );

    m_contextMenu->exec( viewport()->mapToGlobal( pos ) );
}
开发者ID:AshotN,项目名称:tomahawk,代码行数:47,代码来源:ColumnView.cpp

示例10: QModelIndex

void
ContextView::onDownloadAll()
{
    for ( int i = 0; i < m_trackView->proxyModel()->rowCount( QModelIndex() ); i++ )
    {
        PlayableItem* item = m_trackView->proxyModel()->itemFromIndex( m_trackView->proxyModel()->mapToSource( m_trackView->proxyModel()->index( i, 0, QModelIndex() ) ) );
        if ( !item || !item->query() || !item->query()->results().count() )
            continue;
        if ( !item->query()->results().first()->downloadFormats().count() )
            continue;

        if ( !DownloadManager::instance()->localFileForDownload( item->query()->results().first()->downloadFormats().first().url.toString() ).isEmpty() )
            continue;
        if ( !item->result()->downloadFormats().isEmpty() )
            DownloadManager::instance()->addJob( item->result()->toDownloadJob( item->result()->downloadFormats().first() ) );
    }
}
开发者ID:TheOneRing,项目名称:tomahawk,代码行数:17,代码来源:ContextView.cpp

示例11: if

void
GridView::onItemActivated( const QModelIndex& index )
{
    PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) );
    if ( item )
    {
//        qDebug() << "Result activated:" << item->album()->tracks().first()->toString() << item->album()->tracks().first()->results().first()->url();
//        APP->audioEngine()->playItem( item->album().data(), item->album()->tracks().first()->results().first() );

        if ( !item->album().isNull() )
            ViewManager::instance()->show( item->album() );
        else if ( !item->artist().isNull() )
            ViewManager::instance()->show( item->artist() );
        else if ( !item->query().isNull() )
            ViewManager::instance()->show( item->query() );
    }
}
开发者ID:AltarBeastiful,项目名称:tomahawk,代码行数:17,代码来源:GridView.cpp

示例12: if

void
GridItemDelegate::onPlayClicked( const QPersistentModelIndex& index )
{
    QPoint pos = m_playButton[ index ]->pos();
    foreach ( ImageButton* button, m_playButton )
        button->deleteLater();
    m_playButton.clear();

    AnimatedSpinner* spinner = new AnimatedSpinner( m_view );
    spinner->setAutoCenter( false );
    spinner->fadeIn();
    spinner->move( pos );
    spinner->setFocusPolicy( Qt::NoFocus );
    spinner->installEventFilter( this );

    m_spinner[ index ] = spinner;

    PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
    if ( item )
    {
        NewClosure( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ),
                    const_cast<GridItemDelegate*>(this), SLOT( onPlaybackStarted( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );

        m_closures.remove( index );

        m_closures.insertMulti( index, NewClosure( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ),
                                const_cast<GridItemDelegate*>(this), SLOT( onPlaylistChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) ) );
        m_closures.insertMulti( index, NewClosure( AudioEngine::instance(), SIGNAL( stopped() ),
                                const_cast<GridItemDelegate*>(this), SLOT( onPlaylistChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) ) );

        foreach ( _detail::Closure* closure, m_closures.values( index ) )
            closure->setAutoDelete( false );

        connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackFinished() ) );

        if ( !item->query().isNull() )
            AudioEngine::instance()->playItem( Tomahawk::playlistinterface_ptr(), item->query() );
        else if ( !item->album().isNull() )
            AudioEngine::instance()->playItem( item->album() );
        else if ( !item->artist().isNull() )
            AudioEngine::instance()->playItem( item->artist() );
    }
}
开发者ID:neojjang,项目名称:tomahawk,代码行数:43,代码来源:GridItemDelegate.cpp

示例13: if

void
TreeView::currentChanged( const QModelIndex& current, const QModelIndex& previous )
{
    QTreeView::currentChanged( current, previous );

    if ( !m_updateContextView )
        return;

    PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( current ) );
    if ( item )
    {
        if ( !item->result().isNull() )
            ViewManager::instance()->context()->setQuery( item->result()->toQuery() );
        else if ( !item->artist().isNull() )
            ViewManager::instance()->context()->setArtist( item->artist() );
        else if ( !item->album().isNull() )
            ViewManager::instance()->context()->setAlbum( item->album() );
        else if ( !item->query().isNull() )
            ViewManager::instance()->context()->setQuery( item->query() );
    }
}
开发者ID:mokerjoke,项目名称:tomahawk,代码行数:21,代码来源:TreeView.cpp

示例14: if

void
PlayableProxyModel::updateDetailedInfo( const QModelIndex& index )
{
    PlayableItem* item = itemFromIndex( mapToSource( index ) );

    if ( item->album() )
    {
        item->album()->cover( QSize( 0, 0 ) );
    }
    else if ( item->artist() )
    {
        item->artist()->cover( QSize( 0, 0 ) );
    }
    else if ( item->query() )
    {
        item->query()->track()->cover( QSize( 0, 0 ) );

/*        if ( style() == PlayableProxyModel::Fancy )
        {
            item->query()->track()->loadSocialActions();
        }*/
    }
}
开发者ID:Teriq,项目名称:tomahawk,代码行数:23,代码来源:PlayableProxyModel.cpp

示例15:

void
TrackView::currentChanged( const QModelIndex& current, const QModelIndex& previous )
{
    QTreeView::currentChanged( current, previous );

    if ( !m_updateContextView )
        return;

    PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( current ) );
    if ( item )
    {
        ViewManager::instance()->context()->setQuery( item->query() );
    }
}
开发者ID:Erreur32,项目名称:tomahawk,代码行数:14,代码来源:TrackView.cpp


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