• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ query_ptr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: openLink

QUrl
GlobalActionManager::openLinkFromQuery( const query_ptr& query ) const
{
    QString title = query->track()->track();
    QString artist = query->track()->artist();
    QString album = query->track()->album();

    return openLink( title, artist, album );
}
开发者ID:avtobiff,项目名称:tomahawk,代码行数:9,代码来源:GlobalActionManager.cpp


示例2: uuid

QList<Tomahawk::query_ptr>
PlaylistInterface::filterTracks( const QList<Tomahawk::query_ptr>& queries )
{
    QList<Tomahawk::query_ptr> result;

    for ( int i = 0; i < queries.count(); i++ )
    {
        bool picked = true;
        const query_ptr q1 = queries.at( i );

        for ( int j = 0; j < result.count(); j++ )
        {
            if ( !picked )
                break;

            const query_ptr& q2 = result.at( j );

            if ( q1->track() == q2->track() )
            {
                picked = false;
            }
        }

        if ( picked )
        {
            query_ptr q = Query::get( q1->artist(), q1->track(), q1->album(), uuid(), false );
            q->setAlbumPos( q1->results().first()->albumpos() );
            q->setDiscNumber( q1->discnumber() );
            result << q;
        }
    }

    Pipeline::instance()->resolve( result );
    return result;
}
开发者ID:rockymontana,项目名称:tomahawk,代码行数:35,代码来源:PlaylistInterface.cpp


示例3: connect

void
GlobalActionManager::handleOpenTrack ( const query_ptr& q )
{
    ViewManager::instance()->queue()->model()->append( q );
    ViewManager::instance()->showQueue();

    if( !AudioEngine::instance()->isPlaying() && !AudioEngine::instance()->isPaused() ) {
        connect( q.data(), SIGNAL( resolvingFinished( bool ) ), this, SLOT( waitingForResolved( bool ) ) );
        m_waitingToPlay = q;
    }
开发者ID:MechanisM,项目名称:tomahawk,代码行数:10,代码来源:globalactionmanager.cpp


示例4: resolve

void
Pipeline::resolve( const query_ptr& q, bool prioritized )
{
    if ( q.isNull() )
        return;

    QList< query_ptr > qlist;
    qlist << q;
    resolve( qlist, prioritized );
}
开发者ID:pauloppenheim,项目名称:tomahawk,代码行数:10,代码来源:pipeline.cpp


示例5: openLink

QUrl
GlobalActionManager::openLinkFromQuery( const query_ptr& query ) const
{
    QString title, artist, album;

    if( !query->results().isEmpty() && !query->results().first().isNull() )
    {
        title = query->results().first()->track();
        artist = query->results().first()->artist().isNull() ? QString() : query->results().first()->artist()->name();
        album = query->results().first()->album().isNull() ? QString() : query->results().first()->album()->name();
    } else
    {
        title = query->track();
        artist = query->artist();
        album = query->album();
    }

    return openLink( title, artist, album );
}
开发者ID:xevix,项目名称:tomahawk,代码行数:19,代码来源:globalactionmanager.cpp


示例6: QString

void
TrackInfoWidget::load( const query_ptr& query )
{
    m_query = query;
    m_artist = Artist::get( m_query->artist() );
    m_title = QString( "%1 - %2" ).arg( query->artist() ).arg( query->track() );

    if ( !m_query.isNull() )
    {
        disconnect( m_query.data(), SIGNAL( lyricsLoaded() ), this, SLOT( onLyricsLoaded() ) );
        disconnect( m_query.data(), SIGNAL( similarTracksLoaded() ), this, SLOT( onSimilarTracksLoaded() ) );
        disconnect( m_query.data(), SIGNAL( statsLoaded() ), this, SLOT( onStatsLoaded() ) );
        disconnect( m_query.data(), SIGNAL( updated() ), this, SLOT( onCoverUpdated() ) );
        disconnect( m_artist.data(), SIGNAL( statsLoaded() ), this, SLOT( onStatsLoaded() ) );
        disconnect( m_artist.data(), SIGNAL( similarArtistsLoaded() ), this, SLOT( onSimilarArtistsLoaded() ) );
    }

    connect( m_artist.data(), SIGNAL( similarArtistsLoaded() ), SLOT( onSimilarArtistsLoaded() ) );
    connect( m_artist.data(), SIGNAL( statsLoaded() ), SLOT( onStatsLoaded() ) );
    connect( m_query.data(), SIGNAL( lyricsLoaded() ), SLOT( onLyricsLoaded() ) );
    connect( m_query.data(), SIGNAL( similarTracksLoaded() ), SLOT( onSimilarTracksLoaded() ) );
    connect( m_query.data(), SIGNAL( updated() ), SLOT( onCoverUpdated() ) );
    connect( m_query.data(), SIGNAL( statsLoaded() ), SLOT( onStatsLoaded() ) );

    m_artist->loadStats();
    m_query->loadStats();
//    m_query->lyrics();
    onCoverUpdated();

    ui->trackLabel->setText( query->track() );
    ui->artistLabel->setQuery( query );
    ui->albumLabel->setQuery( query );
    ui->albumLabel->setVisible( !query->album().isEmpty() );
    ui->cover->setQuery( query );

    m_relatedTracksModel->clear();
    m_relatedTracksModel->startLoading();

    if ( !m_query->similarTracks().isEmpty() )
        onSimilarTracksLoaded();
}
开发者ID:norrs,项目名称:tomahawk,代码行数:41,代码来源:TrackInfoWidget.cpp


示例7: onItemActivated

void
TrackView::autoPlayResolveFinished( const query_ptr& query, int row )
{
    Q_ASSERT( !query.isNull() );
    Q_ASSERT( row >= 0 );

    if ( query.isNull() || row < 0  || query != m_autoPlaying )
        return;

    const QModelIndex index = m_proxyModel->index( row, 0 );
    if ( query->playable() )
    {
        onItemActivated( index );
        return;
    }

    // Try the next one..
    const QModelIndex sib = index.sibling( index.row() + 1, index.column() );
    if ( sib.isValid() )
        startAutoPlay( sib );
}
开发者ID:barovski,项目名称:tomahawk,代码行数:21,代码来源:TrackView.cpp


示例8: Q_ASSERT

void
PlaylistItemDelegate::paintShort( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index, bool useAvatars ) const
{
    PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
    Q_ASSERT( item );

    QStyleOptionViewItemV4 opt = option;
    prepareStyleOption( &opt, index, item );
    opt.text.clear();

    qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );

    if ( m_view->header()->visualIndex( index.column() ) > 0 )
        return;

    const query_ptr q = item->query()->displayQuery();
    QString artist = q->artist();
    QString track = q->track();
    QPixmap pixmap;
    QString upperText, lowerText;
    source_ptr source = item->query()->playedBy().first;

    if ( source.isNull() )
    {
        upperText = track;
        lowerText = artist;
    }
    else
    {
        upperText = QString( "%1 - %2" ).arg( artist ).arg( track );
        QString playtime = TomahawkUtils::ageToString( QDateTime::fromTime_t( item->query()->playedBy().second ), true );

        if ( source == SourceList::instance()->getLocal() )
            lowerText = QString( tr( "played %1 by you" ) ).arg( playtime );
        else
            lowerText = QString( tr( "played %1 by %2" ) ).arg( playtime ).arg( source->friendlyName() );
    }

    painter->save();
    {
        QRect r = opt.rect.adjusted( 3, 6, 0, -6 );

        // Paint Now Playing Speaker Icon
        if ( item->isPlaying() )
        {
            const int pixMargin = 2;
            const int pixHeight = r.height() - pixMargin * 2;
            QRect npr = r.adjusted( pixMargin, pixMargin + 1, pixHeight - r.width() + pixMargin, -pixMargin + 1 );
            painter->drawPixmap( npr, TomahawkUtils::defaultPixmap( TomahawkUtils::NowPlayingSpeaker, TomahawkUtils::Original, npr.size() ) );
            r.adjust( pixHeight + 8, 0, 0, 0 );
        }

        painter->setPen( opt.palette.text().color() );

        QRect ir = r.adjusted( 4, 0, -option.rect.width() + option.rect.height() - 8 + r.left(), 0 );

        if ( useAvatars )
        {
            if ( !source.isNull() )
                pixmap = source->avatar( TomahawkUtils::RoundedCorners, ir.size() );
        }
        else
            pixmap = item->query()->cover( ir.size(), false );

        if ( pixmap.isNull() )
        {
            if ( !useAvatars )
                pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultTrackImage, TomahawkUtils::Original, ir.size() );
            else
                pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultSourceAvatar, TomahawkUtils::RoundedCorners, ir.size() );
        }

        painter->drawPixmap( ir, pixmap );

        QFont boldFont = opt.font;
        boldFont.setBold( true );

        r.adjust( ir.width() + 12, 0, -12, 0 );
        painter->setFont( boldFont );
        QString text = painter->fontMetrics().elidedText( upperText, Qt::ElideRight, r.width() );
        painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, m_topOption );

        painter->setFont( opt.font );
        if ( !( option.state & QStyle::State_Selected || item->isPlaying() ) )
            painter->setPen( Qt::gray );

        text = painter->fontMetrics().elidedText( lowerText, Qt::ElideRight, r.width() );
        painter->drawText( r.adjusted( 0, 1, 0, 0 ), text, m_bottomOption );
    }
    painter->restore();
}
开发者ID:rockymontana,项目名称:tomahawk,代码行数:91,代码来源:PlaylistItemDelegate.cpp


示例9: Q_ASSERT

void
PlaylistChartItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
    PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
    Q_ASSERT( item );

    QStyleOptionViewItemV4 opt = option;
    prepareStyleOption( &opt, index, item );
    opt.text.clear();

    qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );

    if ( m_view->header()->visualIndex( index.column() ) > 0 )
        return;

    const query_ptr q = item->query()->displayQuery();
    unsigned int duration = q->duration();
    QString artist = q->artist();
    QString track = q->track();
    QPixmap avatar;
    QString upperText, lowerText;

    painter->save();
    {
        QRect r = opt.rect.adjusted( 4, 6, 0, -6 );
        
        // Paint Now Playing Speaker Icon
        if ( item->isPlaying() )
        {
            const int pixMargin = 4;
            const int pixHeight = r.height() - pixMargin * 2;
            QRect npr = r.adjusted( pixMargin, pixMargin + 1, pixHeight - r.width() + pixMargin, -pixMargin + 1 );
            painter->drawPixmap( npr, TomahawkUtils::defaultPixmap( TomahawkUtils::NowPlayingSpeaker, TomahawkUtils::Original, npr.size() ) );
            r.adjust( pixHeight + 8, 0, 0, 0 );
        }

        QFont figureFont = opt.font;
        figureFont.setPointSize( TomahawkUtils::defaultFontSize() + 6 );
        figureFont.setWeight( 99 );

        QFont boldFont = opt.font;
        boldFont.setPointSize( TomahawkUtils::defaultFontSize() + 1 );
        boldFont.setWeight( 99 );

        QFont smallBoldFont = opt.font;
        smallBoldFont.setPointSize( TomahawkUtils::defaultFontSize() );
        smallBoldFont.setWeight( 60 );

        QFont durationFont = opt.font;
        durationFont.setPointSize( TomahawkUtils::defaultFontSize() );
        durationFont.setWeight( 80 );
        QFontMetrics durationFontMetrics( durationFont );

        if ( index.row() == 0 )
        {
            figureFont.setPointSize( TomahawkUtils::defaultFontSize() + 33 );
            boldFont.setPointSize( TomahawkUtils::defaultFontSize() + 13 );
            smallBoldFont.setPointSize( TomahawkUtils::defaultFontSize() + 9 );
        }
        else if ( index.row() == 1 )
        {
            figureFont.setPointSize( TomahawkUtils::defaultFontSize() + 17 );
            boldFont.setPointSize( TomahawkUtils::defaultFontSize() + 9 );
            smallBoldFont.setPointSize( TomahawkUtils::defaultFontSize() + 4 );
        }
        else if ( index.row() == 2 )
        {
            figureFont.setPointSize( TomahawkUtils::defaultFontSize() + 9 );
            boldFont.setPointSize( TomahawkUtils::defaultFontSize() + 4 );
            smallBoldFont.setPointSize( TomahawkUtils::defaultFontSize() + 2 );
        }
        else if ( index.row() >= 10 )
        {
            boldFont.setPointSize( TomahawkUtils::defaultFontSize() );
            smallBoldFont.setPointSize( TomahawkUtils::defaultFontSize() - 1 );
        }

        QRect figureRect = r.adjusted( 0, 0, -option.rect.width() + 60 - 6 + r.left(), 0 );
        painter->setFont( figureFont );
        painter->setPen( option.palette.text().color().lighter( 450 ) );
        painter->drawText( figureRect, QString::number( index.row() + 1 ), m_centerOption );
        painter->setPen( opt.palette.text().color() );

        QRect pixmapRect = r.adjusted( figureRect.width() + 6, 0, -option.rect.width() + figureRect.width() + option.rect.height() - 6 + r.left(), 0 );

        if ( !m_pixmaps.contains( index ) )
        {
            m_pixmaps.insert( index, QSharedPointer< Tomahawk::PixmapDelegateFader >( new Tomahawk::PixmapDelegateFader( item->query(), pixmapRect.size(), TomahawkUtils::Original, false ) ) );
            _detail::Closure* closure = NewClosure( m_pixmaps[ index ], SIGNAL( repaintRequest() ), const_cast<PlaylistChartItemDelegate*>(this), SLOT( doUpdateIndex( const QPersistentModelIndex& ) ), QPersistentModelIndex( index ) );
            closure->setAutoDelete( false );
        }

        const QPixmap pixmap = m_pixmaps[ index ]->currentPixmap();
        painter->drawPixmap( pixmapRect, pixmap );

        r.adjust( pixmapRect.width() + figureRect.width() + 18, 1, -28, 0 );
        QRect leftRect = r.adjusted( 0, 0, -durationFontMetrics.width( TomahawkUtils::timeToString( duration ) ) - 8, 0 );

        painter->setFont( boldFont );
        QString text = painter->fontMetrics().elidedText( track, Qt::ElideRight, leftRect.width() );
//.........这里部分代码省略.........
开发者ID:R4md4c,项目名称:tomahawk,代码行数:101,代码来源:PlaylistChartItemDelegate.cpp


示例10: DatabaseCommand

DatabaseCommand_CalculatePlaytime::DatabaseCommand_CalculatePlaytime( const query_ptr& query, QDateTime from, QDateTime to, QObject* parent)
    : DatabaseCommand( parent, new DatabaseCommand_CalculatePlaytimePrivate( this , from, to ) )
{
    Q_D( DatabaseCommand_CalculatePlaytime );
    d->trackIds.append( QString::number( query->track()->trackId() ) );
}
开发者ID:AidedPolecat6,项目名称:tomahawk,代码行数:6,代码来源:DatabaseCommand_CalculatePlaytime.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ query_type类代码示例发布时间:2022-05-31
下一篇:
C++ query类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap