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


C++ QNetworkReply::setProperty方法代码示例

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


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

示例1: updateRequest

void Update::updateRequest(const QString &strMethod, const QString &strUrl, const QString &strUrlMarker)
{
    QString strAgentPlatform = this->getPlatform();
    QString strAgentUrl = "http://simplechatclien.sourceforge.net";
    QString strAgentProgram = "SimpleChatClient";
    QString strAgentVersion = Settings::instance()->get("version");
    QString strUserAgent = QString("Mozilla/5.0 (%1; +%2) %3/%4").arg(strAgentPlatform, strAgentUrl, strAgentProgram, strAgentVersion);

    QNetworkRequest request;
    request.setUrl(QUrl(strUrl));
    request.setHeader(QNetworkRequest::UserAgentHeader, strUserAgent.toLatin1());

    QString strUUID = Settings::instance()->get("unique_id");
    QRegExp rUUID("^[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$");
    if ((strMethod == "POST") && (!strUUID.isEmpty()) && (rUUID.exactMatch(strUUID)))
    {
        QString strContent = QString("{\"uuid\":\"%1\"}").arg(strUUID);

        request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
        QNetworkReply *pReply = accessManager->post(request, strContent.toLatin1());
        pReply->setProperty("update_url", strUrlMarker);
    }
    else
    {
        QNetworkReply *pReply = accessManager->get(request);
        pReply->setProperty("update_url", strUrlMarker);
    }
}
开发者ID:gitter-badger,项目名称:simplechatclient,代码行数:28,代码来源:update.cpp

示例2: onLoadFinished

void IMDB::onLoadFinished()
{
    QNetworkReply *reply = static_cast<QNetworkReply*>(QObject::sender());
    reply->deleteLater();
    Movie *movie = reply->property("storage").value<Storage*>()->movie();
    QList<int> infos = reply->property("infosToLoad").value<Storage*>()->infosToLoad();
    if (!movie)
        return;

    if (reply->error() == QNetworkReply::NoError ) {
        QString msg = QString::fromUtf8(reply->readAll());
        parseAndAssignInfos(msg, movie, infos);
        QString posterUrl = parsePosters(msg);
        if (infos.contains(MovieScraperInfos::Poster) && !posterUrl.isEmpty()) {
            QNetworkReply *reply = qnam()->get(QNetworkRequest(posterUrl));
            reply->setProperty("storage", Storage::toVariant(reply, movie));
            reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
            connect(reply, SIGNAL(finished()), this, SLOT(onPosterLoadFinished()));
        } else {
            movie->controller()->scraperLoadDone(this);
        }
    } else {
        qWarning() << "Network Error (load)" << reply->errorString();
    }
}
开发者ID:ArgelErx,项目名称:MediaElch,代码行数:25,代码来源:IMDB.cpp

示例3: onActorsFinished

/**
 * @brief Called when the tv show actors are downloaded
 * Starts download of banners
 * @see TheTvDb::parseAndAssignActors
 * @see TheTvDb::onBannersFinished
 */
void TheTvDb::onActorsFinished()
{
    QNetworkReply *reply = static_cast<QNetworkReply*>(QObject::sender());
    reply->deleteLater();
    TvShow *show = reply->property("storage").value<Storage*>()->show();
    TvShowUpdateType updateType = static_cast<TvShowUpdateType>(reply->property("updateType").toInt());
    QList<int> infos = reply->property("infosToLoad").value<Storage*>()->infosToLoad();
    if (!show)
        return;

    if (reply->error() == QNetworkReply::NoError ) {
        QString msg = QString::fromUtf8(reply->readAll());
        if (show->infosToLoad().contains(TvShowScraperInfos::Actors) &&
                (updateType == UpdateShow || updateType == UpdateShowAndAllEpisodes || updateType == UpdateShowAndNewEpisodes))
            parseAndAssignActors(msg, show);
    } else {
        qWarning() << "Network Error" << reply->errorString();
    }
    QString mirror = m_xmlMirrors.at(qrand()%m_xmlMirrors.count());
    QUrl url(QString("%1/api/%2/series/%3/banners.xml").arg(mirror).arg(m_apiKey).arg(show->tvdbId()));
    reply = qnam()->get(QNetworkRequest(url));
    reply->setProperty("storage", Storage::toVariant(reply, show));
    reply->setProperty("updateType", updateType);
    reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
    connect(reply, SIGNAL(finished()), this, SLOT(onBannersFinished()));
}
开发者ID:madsailor,项目名称:MediaElch,代码行数:32,代码来源:TheTvDb.cpp

示例4: get

QString Cache::get(const QString &strChannel, const QString &strUrl)
{
    QString strFileName = QString(QCryptographicHash::hash(strUrl.toLatin1(), QCryptographicHash::Md5).toHex())+"."+QFileInfo(strUrl).suffix();
    QString strPathPlusFileName = getCachePath(strFileName);

    bool bDownloadFile = true;
    if (QFile::exists(strPathPlusFileName))
    {
        QList<QString> lSupportedImages;
        lSupportedImages << "jpg" << "jpeg" << "png" << "bmp";

        if (lSupportedImages.contains(QFileInfo(strFileName).suffix().toLower()))
        {
            QPixmap pixmap;
            if (!pixmap.load(strPathPlusFileName))
                bDownloadFile = true;
            else
                bDownloadFile = false;
        }
        else
            bDownloadFile = false;
    }
    else
        bDownloadFile = true;

    if (bDownloadFile)
    {
        QNetworkReply *reply = accessManager->get(QNetworkRequest(strUrl));
        reply->setProperty("file", strPathPlusFileName);
        reply->setProperty("channel", strChannel);
    }

    return strPathPlusFileName;
}
开发者ID:gitter-badger,项目名称:simplechatclient,代码行数:34,代码来源:cache.cpp

示例5: backdropFinished

/**
 * @brief Called when backdrop scraping has finished
 * Starts the next backdrop download or tells the movie that scraping is done
 */
void Cinefacts::backdropFinished()
{
    QNetworkReply *reply = static_cast<QNetworkReply*>(QObject::sender());
    reply->deleteLater();
    Movie *movie = reply->property("storage").value<Storage*>()->movie();
    QStringList backdrops = reply->property("backdrops").toStringList();
    QList<int> infos = reply->property("infosToLoad").value<Storage*>()->infosToLoad();
    if (!movie)
        return;

    if (reply->error() == QNetworkReply::NoError) {
        QString msg = QString::fromUtf8(reply->readAll());
        QRegExp rx("<a href=\"([^\"]*)\" target=\"_blank\">Bild in Originalgr..e</a>");
        rx.setMinimal(true);
        if (rx.indexIn(msg) != -1) {
            Poster p;
            p.thumbUrl = rx.cap(1);
            p.originalUrl = rx.cap(1);
            movie->addBackdrop(p);
        }

        if (!backdrops.isEmpty()) {
            reply = qnam()->get(QNetworkRequest(QUrl(QString("http://www.cinefacts.de%1").arg(backdrops.takeFirst()))));
            reply->setProperty("storage", Storage::toVariant(reply, movie));
            reply->setProperty("backdrops", backdrops);
            reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
            connect(reply, SIGNAL(finished()), this, SLOT(backdropFinished()));
            return;
        }
    }
    movie->controller()->scraperLoadDone(this);
}
开发者ID:BlitzGLEP1326,项目名称:MediaElch,代码行数:36,代码来源:Cinefacts.cpp

示例6: QObject

EchonestCatalogSynchronizer::EchonestCatalogSynchronizer( QObject *parent )
    : QObject( parent )
{
    m_syncing = TomahawkSettings::instance()->enableEchonestCatalogs();

    qRegisterMetaType<QList<QStringList> >("QList<QStringList>");

    connect( TomahawkSettings::instance(), SIGNAL( changed() ), this, SLOT( checkSettingsChanged() ) );
    connect( SourceList::instance()->getLocal()->dbCollection().data(), SIGNAL( tracksAdded( QList<unsigned int> ) ), this, SLOT( tracksAdded( QList<unsigned int> ) ), Qt::QueuedConnection );
    connect( SourceList::instance()->getLocal()->dbCollection().data(), SIGNAL( tracksRemoved( QList<unsigned int> ) ), this, SLOT( tracksRemoved( QList<unsigned int> ) ), Qt::QueuedConnection );

    const QByteArray artist = TomahawkSettings::instance()->value( "collection/artistCatalog" ).toByteArray();
    const QByteArray song = TomahawkSettings::instance()->value( "collection/songCatalog" ).toByteArray();

    if ( !artist.isEmpty() )
        m_artistCatalog.setId( artist );
    if ( !song.isEmpty() )
        m_songCatalog.setId( song );

    // Sanity check
    if ( !song.isEmpty() && !m_syncing )
    {
        // Not syncing but have a catalog id... lets fix this
        QNetworkReply* r = m_songCatalog.deleteCatalog();
        connect( r, SIGNAL( finished() ), this, SLOT( catalogDeleted() ) );
        r->setProperty( "type", "song" );
    }
    if ( !artist.isEmpty() && !m_syncing )
    {
        QNetworkReply* r = m_artistCatalog.deleteCatalog();
        connect( r, SIGNAL( finished() ), this, SLOT( catalogDeleted() ) );
        r->setProperty( "type", "artist" );
    }
}
开发者ID:Alex237,项目名称:tomahawk,代码行数:34,代码来源:EchonestCatalogSynchronizer.cpp

示例7: onArtistRelsFinished

void UniversalMusicScraper::onArtistRelsFinished()
{
    QNetworkReply *reply = static_cast<QNetworkReply*>(QObject::sender());
    Artist *artist = reply->property("storage").value<Storage*>()->artist();
    QList<int> infos = reply->property("infosToLoad").value<Storage*>()->infosToLoad();
    reply->deleteLater();
    if (!artist)
        return;

    if (reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 302 ||
        reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 301) {
        qDebug() << "Got redirect" << reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
        reply = qnam()->get(QNetworkRequest(reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl()));
        reply->setProperty("storage", Storage::toVariant(reply, artist));
        reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
        connect(reply, SIGNAL(finished()), this, SLOT(onArtistRelsFinished()));
        return;
    }

    QString discogsUrl;
    if (reply->error() == QNetworkReply::NoError) {
        QString msg = QString::fromUtf8(reply->readAll());
        QDomDocument domDoc;
        domDoc.setContent(msg);
        for (int i=0, n=domDoc.elementsByTagName("relation").count() ; i<n ; ++i) {
            QDomElement elem = domDoc.elementsByTagName("relation").at(i).toElement();
            if (elem.attribute("type") == "allmusic" && elem.elementsByTagName("target").count() > 0) {
                QString url = elem.elementsByTagName("target").at(0).toElement().text();
                QRegExp rx("allmusic\\.com/artist/(.*)$");
                if (rx.indexIn(url) != -1)
                    artist->setAllMusicId(rx.cap(1));
            }
            if (elem.attribute("type") == "discogs" && elem.elementsByTagName("target").count() > 0)
                discogsUrl = elem.elementsByTagName("target").at(0).toElement().text();
        }
    }

    if (!m_artistDownloads.contains(artist))
        m_artistDownloads.insert(artist, QList<DownloadElement>());
    m_artistDownloads[artist].clear();

    appendDownloadElement(artist, "theaudiodb", "tadb_data", QUrl(QString("http://www.theaudiodb.com/api/v1/json/%1/artist-mb.php?i=%2").arg(m_tadbApiKey).arg(artist->mbId())));
    appendDownloadElement(artist, "theaudiodb", "tadb_discography", QUrl(QString("http://www.theaudiodb.com/api/v1/json/%1/discography-mb.php?s=%2").arg(m_tadbApiKey).arg(artist->mbId())));
    if (!artist->allMusicId().isEmpty()) {
        appendDownloadElement(artist, "allmusic", "am_data", QUrl(QString("http://www.allmusic.com/artist/%1").arg(artist->allMusicId())));
        appendDownloadElement(artist, "allmusic", "am_biography", QUrl(QString("http://www.allmusic.com/artist/%1/biography").arg(artist->allMusicId())));
    }
    if (!discogsUrl.isEmpty())
        appendDownloadElement(artist, "discogs", "discogs_data", QUrl(discogsUrl + "?type=Releases&subtype=Albums"));

    foreach (DownloadElement elem, m_artistDownloads[artist]) {
        QNetworkRequest request(elem.url);
        request.setRawHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10; rv:33.0) Gecko/20100101 Firefox/33.0");
        QNetworkReply *reply = qnam()->get(request);
        new NetworkReplyWatcher(this, reply);
        reply->setProperty("storage", Storage::toVariant(reply, artist));
        reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
        connect(reply, SIGNAL(finished()), this, SLOT(onArtistLoadFinished()));
    }
开发者ID:Komet,项目名称:MediaElch,代码行数:59,代码来源:UniversalMusicScraper.cpp

示例8: connect

void
EchoNestPlugin::getMiscTopTerms( uint requestId, const Tomahawk::InfoSystem::InfoRequestData &requestData )
{
    QNetworkReply* reply = Echonest::Artist::topTerms( 20 );
    reply->setProperty( "requestId", requestId );
    reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );
    connect( reply, SIGNAL( finished() ), SLOT( getMiscTopSlot() ) );
}
开发者ID:ralepinski,项目名称:tomahawk,代码行数:8,代码来源:echonestplugin.cpp

示例9: httpFinished

void Cache::httpFinished(QNetworkReply *reply)
{
    reply->deleteLater();

    if (reply->error())
        return;

    QString strFileName = reply->property("file").toString();
    QString strChannel = reply->property("channel").toString();

    QVariant possibleRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
    if (!possibleRedirectUrl.toUrl().isEmpty())
    {
        QNetworkReply *replyRedirect = accessManager->get(QNetworkRequest(possibleRedirectUrl.toUrl()));
        replyRedirect->setProperty("file", strFileName);
        replyRedirect->setProperty("channel", strChannel);
        return;
    }

    QByteArray bFileContent = reply->readAll();
    if (bFileContent.isEmpty())
        return;

    QList<QString> lSupportedImages;
    lSupportedImages << "jpg" << "jpeg" << "png" << "bmp";

    if (lSupportedImages.contains(QFileInfo(strFileName).suffix().toLower()))
    {
        QPixmap pixmap;
        if (pixmap.loadFromData(bFileContent))
        {
            pixmap = pixmap.scaled(QSize(75,75), Qt::KeepAspectRatio, Qt::SmoothTransformation);
            pixmap.save(strFileName);

            // refresh
            if (!strChannel.isEmpty())
                Channel::instance()->getChatView(strChannel)->reloadCacheImage(strFileName);
        }
        else
        {
            QFile f(strFileName);
            if (f.open(QIODevice::WriteOnly))
            {
                f.write(bFileContent);
                f.close();
            }
        }
    }
    else
    {
        QFile f(strFileName);
        if (f.open(QIODevice::WriteOnly))
        {
            f.write(bFileContent);
            f.close();
        }
    }
}
开发者ID:gitter-badger,项目名称:simplechatclient,代码行数:58,代码来源:cache.cpp

示例10: parseFolder

void QgsArcGisRestCatalogProvider::parseFolder( const QString& path, const QStringList& catTitles )
{
  mPendingTasks += 1;
  QNetworkRequest req( QUrl( mBaseUrl + QString( "/rest/services%1?f=json" ).arg( path ) ) );
  QNetworkReply* reply = QgsNetworkAccessManager::instance()->get( req );
  reply->setProperty( "path", path );
  reply->setProperty( "catTitles", catTitles );
  connect( reply, SIGNAL( finished() ), this, SLOT( parseFolderDo() ) );
}
开发者ID:sourcepole,项目名称:kadas-albireo,代码行数:9,代码来源:qgsarcgisrestcatalogprovider.cpp

示例11: info

void
ChartsPlugin::notInCacheSlot( QHash<QString, QString> criteria, Tomahawk::InfoSystem::InfoRequestData requestData )
{
    switch ( requestData.type )
    {
        case InfoChart:
        {
            tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChart not in cache! Fetching...";

            /// Fetch the chart, we need source and id
            QUrl url = QUrl( QString( CHART_URL "source/%1/chart/%2" ).arg( criteria["chart_source"] ).arg( criteria["chart_id"] ) );
            tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Getting chart url" << url;

            QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
            reply->setProperty( "requestData", QVariant::fromValue< Tomahawk::InfoSystem::InfoRequestData >( requestData ) );

            connect( reply, SIGNAL( finished() ), SLOT( chartReturned() ) );
            return;

        }

        case InfoChartCapabilities:
        {

            tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChartCapabilities not in cache! Fetching...";
            // we never need to re-fetch
            if ( !m_allChartsMap.isEmpty() )
                return;

            /// Then get each chart from resource

            if ( !m_chartResources.isEmpty() && m_allChartsMap.isEmpty() )
            {
                tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChart fetching possible resources";
                foreach ( QString resource, m_chartResources )
                {
                    QUrl url = QUrl( QString( CHART_URL "source/%1" ).arg( resource ) );
                    QNetworkReply* reply = TomahawkUtils::nam()->get( QNetworkRequest( url ) );
                    reply->setProperty( "chart_resource", resource);

                    tDebug() << "fetching:" << url;
                    connect( reply, SIGNAL( finished() ), SLOT( chartTypes() ) );

                    m_chartsFetchJobs++;
                }
            }

            if ( m_chartsFetchJobs > 0 )
            {
                tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "InfoChartCapabilities still fetching!";
                m_cachedRequests.append( requestData );
                return;
            }

            emit info( requestData, m_allChartsMap );
            return;
        }
开发者ID:chakra-project,项目名称:tomahawk,代码行数:57,代码来源:chartsplugin.cpp

示例12: search

/**
 * @brief Searches for a movie
 * @param searchStr The Movie name/search string
 * @see OFDb::searchFinished
 */
void OFDb::search(QString searchStr)
{
    qDebug() << "Entered, searchStr=" << searchStr;

    QString encodedSearch = Helper::toLatin1PercentEncoding(searchStr);
    QUrl url(QString("http://www.ofdbgw.org/search/%1").arg(encodedSearch).toUtf8());
    QNetworkReply *reply = qnam()->get(QNetworkRequest(url));
    reply->setProperty("searchString", searchStr);
    reply->setProperty("notFoundCounter", 0);
    connect(reply, SIGNAL(finished()), this, SLOT(searchFinished()));
}
开发者ID:googl1,项目名称:MediaElch,代码行数:16,代码来源:OFDb.cpp

示例13: loadConcertData

/**
 * @brief FanartTv::loadConcertData
 * @param tmdbId
 * @param types
 */
void FanartTv::loadConcertData(QString tmdbId, QList<int> types, Concert *concert)
{
    QUrl url;
    QNetworkRequest request;
    request.setRawHeader("Accept", "application/json");
    url.setUrl(QString("http://webservice.fanart.tv/v3/movies/%1?%2").arg(tmdbId).arg(keyParameter()));
    QNetworkReply *reply = qnam()->get(QNetworkRequest(request));
    reply->setProperty("infosToLoad", Storage::toVariant(reply, types));
    reply->setProperty("storage", Storage::toVariant(reply, concert));
    connect(reply, SIGNAL(finished()), this, SLOT(onLoadAllConcertDataFinished()));
}
开发者ID:hathagat,项目名称:MediaElch,代码行数:16,代码来源:FanartTv.cpp

示例14: loadData

/**
 * @brief Starts network requests to download infos from VideoBuster
 * @param id VideoBuster movie ID
 * @param movie Movie object
 * @param infos List of infos to load
 * @see VideoBuster::loadFinished
 */
void VideoBuster::loadData(QString id, Movie *movie, QList<int> infos)
{
    qDebug() << "Entered, id=" << id << "movie=" << movie->name();
    movie->clear(infos);

    QUrl url(QString("https://www.videobuster.de%1").arg(id));
    QNetworkReply *reply = this->qnam()->get(QNetworkRequest(url));
    reply->setProperty("storage", Storage::toVariant(reply, movie));
    reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
    connect(reply, SIGNAL(finished()), this, SLOT(loadFinished()));
}
开发者ID:zabinko,项目名称:MediaElch,代码行数:18,代码来源:VideoBuster.cpp

示例15: loadData

/**
 * @brief Starts network requests to download infos from Cinefacts
 * @param id Cinefacts movie ID
 * @param movie Movie object
 * @param infos List of infos to load
 * @see Cinefacts::loadFinished
 */
void Cinefacts::loadData(QMap<ScraperInterface*, QString> ids, Movie *movie, QList<int> infos)
{
    movie->clear(infos);

    QUrl url(QString("http://www.cinefacts.de/Filme/%1").arg(ids.values().first()));
    QNetworkReply *reply = qnam()->get(QNetworkRequest(url));
    reply->setProperty("storage", Storage::toVariant(reply, movie));
    reply->setProperty("cinefactsId", ids.values().first());
    reply->setProperty("infosToLoad", Storage::toVariant(reply, infos));
    connect(reply, SIGNAL(finished()), this, SLOT(loadFinished()));
}
开发者ID:ArgelErx,项目名称:MediaElch,代码行数:18,代码来源:Cinefacts.cpp


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