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


C++ query_ptr::toString方法代码示例

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


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

示例1: playbackStarted

void
Source::onPlaybackStarted( const Tomahawk::query_ptr& query )
{
    qDebug() << Q_FUNC_INFO << query->toString();
    m_currentTrack = query;
    emit playbackStarted( query );
}
开发者ID:pauloppenheim,项目名称:tomahawk,代码行数:7,代码来源:source.cpp

示例2: playbackFinished

void
Source::onPlaybackFinished( const Tomahawk::query_ptr& query )
{
    qDebug() << Q_FUNC_INFO << query->toString();
    emit playbackFinished( query );

    m_currentTrackTimer.start();
}
开发者ID:Pritoj,项目名称:tomahawk,代码行数:8,代码来源:source.cpp

示例3: rp

void
ScriptEngine::resolve( const Tomahawk::query_ptr& query )
{
    qDebug() << Q_FUNC_INFO << query->toString();
    QString eval = QString( "resolve( '%1', '%2', '%3', '%4' );" )
                      .arg( query->id().replace( "'", "\\'" ) )
                      .arg( query->artist().replace( "'", "\\'" ) )
                      .arg( query->album().replace( "'", "\\'" ) )
                      .arg( query->track().replace( "'", "\\'" ) );

    QList< Tomahawk::result_ptr > results;

    QVariantMap m = mainFrame()->evaluateJavaScript( eval ).toMap();
    qDebug() << "JavaScript Result:" << m;

    const QString qid = query->id();
    const QVariantList reslist = m.value( "results" ).toList();

    foreach( const QVariant& rv, reslist )
    {
        QVariantMap m = rv.toMap();
        qDebug() << "RES" << m;

        Tomahawk::result_ptr rp( new Tomahawk::Result() );
        Tomahawk::artist_ptr ap = Tomahawk::Artist::get( 0, m.value( "artist" ).toString() );
        rp->setArtist( ap );
        rp->setAlbum( Tomahawk::Album::get( 0, m.value( "album" ).toString(), ap ) );
        rp->setTrack( m.value( "track" ).toString() );
        rp->setBitrate( m.value( "bitrate" ).toUInt() );
        rp->setUrl( m.value( "url" ).toString() );
        rp->setSize( m.value( "size" ).toUInt() );
        rp->setScore( m.value( "score" ).toFloat() * ( (float)m_parent->weight() / 100.0 ) );
        rp->setRID( uuid() );
        rp->setFriendlySource( m_parent->name() );

        if ( m.contains( "year" ) )
        {
            QVariantMap attr;
            attr[ "releaseyear" ] = m.value( "year" );
            rp->setAttributes( attr );
        }

        rp->setDuration( m.value( "duration", 0 ).toUInt() );
        if ( rp->duration() <= 0 && m.contains( "durationString" ) )
        {
            QTime time = QTime::fromString( m.value( "durationString" ).toString(), "hh:mm:ss" );
            rp->setDuration( time.secsTo( QTime( 0, 0 ) ) * -1 );
        }

        rp->setMimetype( m.value( "mimetype" ).toString() );
        if ( rp->mimetype().isEmpty() )
        {
            rp->setMimetype( TomahawkUtils::extensionToMimetype( m.value( "extension" ).toString() ) );
            Q_ASSERT( !rp->mimetype().isEmpty() );
        }

        results << rp;
    }
开发者ID:tdfischer,项目名称:tomahawk,代码行数:58,代码来源:qtscriptresolver.cpp

示例4: playbackFinished

void
Source::onPlaybackFinished( const Tomahawk::query_ptr& query )
{
    tDebug() << Q_FUNC_INFO << query->toString();
    emit playbackFinished( query );

    m_currentTrack.clear();
    emit stateChanged();
}
开发者ID:demelziraptor,项目名称:tomahawk,代码行数:9,代码来源:Source.cpp

示例5: playbackStarted

void
Source::onPlaybackStarted( const Tomahawk::query_ptr& query, unsigned int duration )
{
    qDebug() << Q_FUNC_INFO << query->toString();
    m_currentTrack = query;
    m_currentTrackTimer.start( duration * 1000 + 900000 ); // duration comes in seconds

    if ( m_playlistInterface.isNull() )
        getPlaylistInterface();
    emit playbackStarted( query );
}
开发者ID:Pritoj,项目名称:tomahawk,代码行数:11,代码来源:source.cpp

示例6: lock

QMap< int, float >
FuzzyIndex::search( const Tomahawk::query_ptr& query )
{
    QMutexLocker lock( &m_mutex );

    QMap< int, float > resultsmap;
    try
    {
        if ( !m_luceneReader )
        {
            if ( !IndexReader::indexExists( m_luceneDir ) )
            {
                tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "index didn't exist.";
                return resultsmap;
            }

            m_luceneReader = IndexReader::open( m_luceneDir );
            m_luceneSearcher = newLucene<IndexSearcher>( m_luceneReader );
        }

        float minScore;
        Collection<String> fields; // = newCollection<String>();
        MultiFieldQueryParserPtr parser = newLucene<MultiFieldQueryParser>( LuceneVersion::LUCENE_CURRENT, fields, m_analyzer );
        BooleanQueryPtr qry = newLucene<BooleanQuery>();

        if ( query->isFullTextQuery() )
        {
            QString q = Tomahawk::DatabaseImpl::sortname( query->fullTextQuery() );

            FuzzyQueryPtr fqry = newLucene<FuzzyQuery>( newLucene<Term>( L"track", q.toStdWString() ) );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry ), BooleanClause::SHOULD );

            FuzzyQueryPtr fqry2 = newLucene<FuzzyQuery>( newLucene<Term>( L"artist", q.toStdWString() ) );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry2 ), BooleanClause::SHOULD );

            FuzzyQueryPtr fqry3 = newLucene<FuzzyQuery>( newLucene<Term>( L"fulltext", q.toStdWString() ) );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry3 ), BooleanClause::SHOULD );

            minScore = 0.00;
        }
        else
        {
            QString track = Tomahawk::DatabaseImpl::sortname( query->queryTrack()->track() );
            QString artist = Tomahawk::DatabaseImpl::sortname( query->queryTrack()->artist() );
            //QString album = Tomahawk::DatabaseImpl::sortname( query->queryTrack()->album() );

            FuzzyQueryPtr fqry = newLucene<FuzzyQuery>( newLucene<Term>( L"track", track.toStdWString() ) );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry ), BooleanClause::MUST );

            FuzzyQueryPtr fqry2 = newLucene<FuzzyQuery>( newLucene<Term>( L"artist", artist.toStdWString() ) );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry2 ), BooleanClause::MUST );

            minScore = 0.00;
        }

        TopScoreDocCollectorPtr collector = TopScoreDocCollector::create( 50, false );
        m_luceneSearcher->search( qry, collector );
        Collection<ScoreDocPtr> hits = collector->topDocs()->scoreDocs;

        for ( int i = 0; i < collector->getTotalHits() && i < 50; i++ )
        {
            DocumentPtr d = m_luceneSearcher->doc( hits[i]->doc );
            float score = hits[i]->score;
            int id = QString::fromStdWString( d->get( L"trackid" ) ).toInt();

            if ( score > minScore )
            {
                resultsmap.insert( id, score );
//                tDebug() << "Index hit:" << id << score << QString::fromWCharArray( ((Query*)qry)->toString() );
            }
        }
    }
    catch( LuceneException& error )
    {
        tDebug() << "Caught Lucene error:" << error.what() << query->toString();

        QTimer::singleShot( 0, this, SLOT( wipeIndex() ) );
    }

    return resultsmap;
}
开发者ID:RahulKondi,项目名称:tomahawk,代码行数:81,代码来源:FuzzyIndex.cpp

示例7: catch

QMap< int, float >
FuzzyIndex::search( const Tomahawk::query_ptr& query )
{
//    QMutexLocker lock( &m_mutex );
    QMap< int, float > resultsmap;
    if ( !m_luceneReader || !m_luceneSearcher )
        return resultsmap;

    try
    {
//        float minScore = 0.00;
        Collection<String> fields; // = newCollection<String>();
        MultiFieldQueryParserPtr parser = newLucene<MultiFieldQueryParser>( LuceneVersion::LUCENE_CURRENT, fields, m_analyzer );
        BooleanQueryPtr qry = newLucene<BooleanQuery>();

        if ( query->isFullTextQuery() )
        {
            const QString q = Tomahawk::DatabaseImpl::sortname( query->fullTextQuery() );

            FuzzyQueryPtr fqry = newLucene<FuzzyQuery>( newLucene<Term>( L"track", q.toStdWString() ) );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry ), BooleanClause::SHOULD );

            FuzzyQueryPtr fqry2 = newLucene<FuzzyQuery>( newLucene<Term>( L"artist", q.toStdWString() ) );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry2 ), BooleanClause::SHOULD );

            FuzzyQueryPtr fqry3 = newLucene<FuzzyQuery>( newLucene<Term>( L"fulltext", q.toStdWString() ) );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry3 ), BooleanClause::SHOULD );
        }
        else
        {
            const QString track = Tomahawk::DatabaseImpl::sortname( query->queryTrack()->track() );
            const QString artist = Tomahawk::DatabaseImpl::sortname( query->queryTrack()->artist() );
            //QString album = Tomahawk::DatabaseImpl::sortname( query->queryTrack()->album() );

            FuzzyQueryPtr fqry = newLucene<FuzzyQuery>( newLucene<Term>( L"track", track.toStdWString() ), 0.5, 3 );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry ), BooleanClause::MUST );

            FuzzyQueryPtr fqry2 = newLucene<FuzzyQuery>( newLucene<Term>( L"artist", artist.toStdWString() ), 0.5, 3 );
            qry->add( boost::dynamic_pointer_cast<Query>( fqry2 ), BooleanClause::MUST );
        }

        TopScoreDocCollectorPtr collector = TopScoreDocCollector::create( 20, true );
        m_luceneSearcher->search( qry, collector );
        Collection<ScoreDocPtr> hits = collector->topDocs()->scoreDocs;

        for ( int i = 0; i < collector->getTotalHits() && i < 20; i++ )
        {
            DocumentPtr d = m_luceneSearcher->doc( hits[i]->doc );
            const float score = hits[i]->score;
            const int id = QString::fromStdWString( d->get( L"trackid" ) ).toInt();

//            if ( score > minScore )
            {
                resultsmap.insert( id, score );
//                tDebug() << "Index hit:" << id << score << QString::fromWCharArray( ((Query*)qry)->toString() );
            }
        }
    }
    catch( LuceneException& error )
    {
        tDebug() << "Caught Lucene error:" << QString::fromWCharArray( error.getError().c_str() ) << query->toString();
    }

    return resultsmap;
}
开发者ID:Alex237,项目名称:tomahawk,代码行数:65,代码来源:FuzzyIndex.cpp


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