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


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

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


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

示例1: f

void
M3uLoader::getTags( const QFileInfo& info )
{
    QByteArray fileName = QFile::encodeName( info.canonicalFilePath() );
    const char *encodedName = fileName.constData();

    TagLib::FileRef f( encodedName );
    if( f.isNull() )
        return;
    TagLib::Tag *tag = f.tag();
    if( !tag )
        return;
    QString artist = TStringToQString( tag->artist() ).trimmed();
    QString album  = TStringToQString( tag->album() ).trimmed();
    QString track  = TStringToQString( tag->title() ).trimmed();

    if ( artist.isEmpty() || track.isEmpty() )
    {
        qDebug() << "Error parsing" << info.fileName();
        return;
    }
    else
    {
        qDebug() << Q_FUNC_INFO << artist << track << album;
        Tomahawk::query_ptr q = Tomahawk::Query::get( artist, track, album, uuid(), !m_createNewPlaylist );
        if ( !q.isNull() )
        {
            q->setResultHint( "file://" + info.absoluteFilePath() );
            q->setSaveHTTPResultHint( true );
            qDebug() << "Adding resulthint" << q->resultHint();
            m_tracks << q;
        }
    }
}
开发者ID:AndyCoder,项目名称:tomahawk,代码行数:34,代码来源:M3uLoader.cpp

示例2: e

void
DatabaseCommand_LoadPlaylistEntries::generateEntries( DatabaseImpl* dbi )
{
    TomahawkSqlQuery query_entries = dbi->newquery();
    query_entries.prepare("SELECT entries, playlist, author, timestamp, previous_revision "
                          "FROM playlist_revision "
                          "WHERE guid = :guid");
    query_entries.bindValue( ":guid", m_revguid );
    query_entries.exec();
    
//    qDebug() << "trying to load entries:" << m_revguid;
    QString prevrev;
    QJson::Parser parser; bool ok;
    
    if( query_entries.next() )
    {
        // entries should be a list of strings:
        QVariant v = parser.parse( query_entries.value(0).toByteArray(), &ok );
        Q_ASSERT( ok && v.type() == QVariant::List ); //TODO
        m_guids = v.toStringList();
        
        QString inclause = QString("('%1')").arg(m_guids.join("', '"));
        
        TomahawkSqlQuery query = dbi->newquery();
        QString sql = QString("SELECT guid, trackname, artistname, albumname, annotation, "
                              "duration, addedon, addedby, result_hint "
                              "FROM playlist_item "
                              "WHERE guid IN %1").arg( inclause );
        //qDebug() << sql;
        
        query.exec( sql );
        while( query.next() )
        {
            plentry_ptr e( new PlaylistEntry );
            e->setGuid( query.value( 0 ).toString() );
            e->setAnnotation( query.value( 4 ).toString() );
            e->setDuration( query.value( 5 ).toUInt() );
            e->setLastmodified( 0 ); // TODO e->lastmodified = query.value(6).toInt();
            e->setResultHint( query.value( 8 ).toString() );
            
            Tomahawk::query_ptr q = Tomahawk::Query::get( query.value( 2 ).toString(), query.value( 1 ).toString(), query.value( 3 ).toString() );
            q->setResultHint( query.value( 8 ).toString() );
            e->setQuery( q );
            
            m_entrymap.insert( e->guid(), e );
        }
        
        prevrev = query_entries.value( 4 ).toString();

    }
    else
    {
        qDebug() << "Playlist has no current revision data";
    }
    
    if( prevrev.length() )
    {
        TomahawkSqlQuery query_entries_old = dbi->newquery();
        query_entries_old.prepare( "SELECT entries, "
                                   "(SELECT currentrevision = ? FROM playlist WHERE guid = ?) "
                                   "FROM playlist_revision "
                                   "WHERE guid = ?" );
        query_entries_old.addBindValue( m_revguid );
        query_entries_old.addBindValue( query_entries.value( 1 ).toString() );
        query_entries_old.addBindValue( prevrev );
        
        query_entries_old.exec();
        if( !query_entries_old.next() )
        {
            return;
            Q_ASSERT( false );
        }
        
        QVariant v = parser.parse( query_entries_old.value( 0 ).toByteArray(), &ok );
        Q_ASSERT( ok && v.type() == QVariant::List ); //TODO
        m_oldentries = v.toStringList();
        m_islatest = query_entries_old.value( 1 ).toBool();
    }
    
//    qDebug() << Q_FUNC_INFO << "entrymap:" << m_entrymap;
}
开发者ID:LittleForker,项目名称:tomahawk,代码行数:81,代码来源:databasecommand_loadplaylistentries.cpp


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