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


C++ ContentFetcher类代码示例

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


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

示例1: sender

void
Reader::contentCodesReceived( int /* id */, bool error )
{
    DEBUG_BLOCK
    ContentFetcher* http = (ContentFetcher*) sender();
    disconnect( http, SIGNAL(requestFinished(int,bool)), this, SLOT(contentCodesReceived(int,bool)) );
    if( error )
    {
        http->deleteLater();
        return;
    }

    QDataStream raw( http->results() );
    Map contentCodes = parse( raw );
    QList<QVariant> root = contentCodes["mccr"].toList();
    if( root.isEmpty() )
        return; //error
    root = root[0].toMap().value( "mdcl" ).toList();
    foreach( QVariant v, root )
    {
        Map entry = v.toMap();
        QString code = entry.value( "mcnm" ).toList().value( 0 ).toString();
        QString name = entry.value( "mcna" ).toList().value( 0 ).toString();
        ContentTypes type = ContentTypes( entry.value( "mcty" ).toList().value( 0 ).toInt() );
        if( !m_codes.contains( code ) && !code.isEmpty() && type > 0 )
        {
            m_codes[code] = Code( name, type );
            debug() << "Added DAAP code" << code << ":" << name << "with type" << type;
        }
    }
开发者ID:netrunner-debian-kde-extras,项目名称:amarok,代码行数:30,代码来源:Reader.cpp

示例2: sender

void
Reader::updateFinished( int /*id*/, bool error )
{
    DEBUG_BLOCK
    ContentFetcher* http = (ContentFetcher*) sender();
    disconnect( http, SIGNAL( requestFinished( int, bool ) ), this, SLOT( updateFinished( int, bool ) ) );
    if( error )
    {
        http->deleteLater();
        warning() << "what is going on here? " << http->error();
        return;
    }

    QDataStream raw( http->results() );
    Map updateResults = parse( raw, 0, true );
    if( updateResults["mupd"].toList().isEmpty() )
        return; //error
    if( updateResults["mupd"].toList()[0].toMap()["musr"].toList().isEmpty() )
        return; //error
    m_loginString = m_loginString + "&revision-number="  +
            QString::number( updateResults["mupd"].toList()[0].toMap()["musr"].toList()[0].toInt() );

    connect( http, SIGNAL( requestFinished( int, bool ) ), this, SLOT( databaseIdFinished( int, bool ) ) );
    http->getDaap( "/databases?" + m_loginString );

}
开发者ID:weiligang512,项目名称:apue-test,代码行数:26,代码来源:Reader.cpp

示例3: ContentFetcher

void
Reader::logoutRequest()
{
    ContentFetcher* http = new ContentFetcher( m_host, m_port, m_password, this, "readerLogoutHttp" );
    connect( http, SIGNAL( httpError( const QString& ) ), this, SLOT( fetchingError( const QString& ) ) );
    connect( http, SIGNAL( requestFinished( int, bool ) ), this, SLOT( logoutRequest( int, bool ) ) );
    http->getDaap( "/logout?" + m_loginString );
}
开发者ID:weiligang512,项目名称:apue-test,代码行数:8,代码来源:Reader.cpp

示例4: ContentFetcher

void
Reader::loginRequest()
{
    DEBUG_BLOCK
    ContentFetcher* http = new ContentFetcher( m_host, m_port, m_password, this, "readerHttp");
    connect( http, SIGNAL(httpError(QString)), this, SLOT(fetchingError(QString)) );
    connect( http, SIGNAL(requestFinished(int,bool)), this, SLOT(contentCodesReceived(int,bool)) );
    http->getDaap( "/content-codes" );
}
开发者ID:netrunner-debian-kde-extras,项目名称:amarok,代码行数:9,代码来源:Reader.cpp

示例5: sender

void
Reader::songListFinished( int /*id*/, bool error )
{
    ContentFetcher* http = (ContentFetcher*) sender();
    disconnect( http, SIGNAL( requestFinished( int, bool ) ), this, SLOT( songListFinished( int, bool ) ) );
    if( error )
    {
        http->deleteLater();
        return;
    }

    Map songResults = parse( http->results(), 0, true );

    SongList result;
    QValueList<QVariant> songList;
    songList = songResults["adbs"].asList()[0].asMap()["mlcl"].asList()[0].asMap()["mlit"].asList();
    debug() << "songList.count() = " << songList.count() << endl;
    QValueList<QVariant>::iterator it;
    for( it = songList.begin(); it != songList.end(); ++it )
    {
        MetaBundle* bundle = new MetaBundle();
        bundle->setTitle( (*it).asMap()["minm"].asList()[0].toString() );
//input url: daap://host:port/databaseId/music.ext
        bundle->setUrl( Amarok::QStringx("daap://%1:%2/%3/%4.%5").args(
            QStringList() << m_host
                        << QString::number( m_port )
                        << m_databaseId
                        << QString::number( (*it).asMap()["miid"].asList()[0].asInt() )
                        << (*it).asMap()["asfm"].asList()[0].asString() ) );
        bundle->setLength( (*it).asMap()["astm"].asList()[0].toInt()/1000 );
        bundle->setTrack( (*it).asMap()["astn"].asList()[0].toInt() );

        QString album = (*it).asMap()["asal"].asList()[0].toString();
        bundle->setAlbum( album );

        QString artist = (*it).asMap()["asar"].asList()[0].toString();
        bundle->setArtist( artist );
        result[ artist.lower() ][ album.lower() ].append(bundle);

        bundle->setYear( (*it).asMap()["asyr"].asList()[0].toInt() );

        bundle->setGenre( (*it).asMap()["asgn"].asList()[0].toString() );
    }
    emit daapBundles( m_host , result );
    http->deleteLater();
}
开发者ID:gms8994,项目名称:amarok-1.4,代码行数:46,代码来源:reader.cpp


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