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


C++ QUrl::addEncodedQueryItem方法代码示例

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


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

示例1: searchJourney

void ParserHafasBinary::searchJourney(const QString &departureStation, const QString &arrivalStation, const QString &viaStation, const QDate &date, const QTime &time, Mode mode, int trainrestrictions)
{
    if (currentRequestState != FahrplanNS::noneRequest) {
        return;
    }

    currentRequestState = FahrplanNS::searchJourneyRequest;
    hafasContext.seqNr = "";
    lastJourneyResultList = NULL;

    QString trainrestr = getTrainRestrictionsCodes(trainrestrictions);

    QUrl uri = baseBinaryUrl;
    uri.addQueryItem("start", "Suchen");
    uri.addEncodedQueryItem("REQ0JourneyStopsS0ID", QUrl::toPercentEncoding("[email protected]=" + departureStation));
    uri.addEncodedQueryItem("REQ0JourneyStopsZ0ID", QUrl::toPercentEncoding("[email protected]=" + arrivalStation));

    if (!viaStation.isEmpty()) {
        uri.addQueryItem("REQ0JourneyStops1.0A", "1");
        uri.addQueryItem("REQ0JourneyStops1.0G", viaStation);
    }

    uri.addQueryItem("REQ0JourneyDate", date.toString("dd.MM.yyyy"));
    uri.addQueryItem("REQ0JourneyTime", time.toString("hh:mm"));
    uri.addQueryItem("REQ0HafasSearchForw", QString::number(mode));
    uri.addQueryItem("REQ0JourneyProduct_prod_list_1", trainrestr);
    uri.addQueryItem("h2g-direct", "11");
    sendHttpRequest(uri);
}
开发者ID:pirast,项目名称:fahrplan,代码行数:29,代码来源:parser_hafasbinary.cpp

示例2: request

LegacyTuner::LegacyTuner( const RadioStation& station, const QString& password_md5 )
    : m_retry_counter( 0 ),
      m_station( station )
{
#ifdef WIN32
    static const char *PLATFORM = "win32";
#elif defined Q_WS_X11
    static const char *PLATFORM = "linux";
#elif defined Q_WS_MAC
    static const char *PLATFORM = "mac";
#else
    static const char *PLATFORM = "unknown";
#endif

    QUrl url;
    url.setScheme( "http" );
    url.setHost( "ws.audioscrobbler.com" );
    url.setPath( "/radio/handshake.php" );
    url.addEncodedQueryItem( "version", QCoreApplication::applicationVersion().toAscii() );
    url.addEncodedQueryItem( "platform", PLATFORM );
    url.addEncodedQueryItem( "username", QUrl::toPercentEncoding(lastfm::ws::Username) );
    url.addEncodedQueryItem( "passwordmd5", password_md5.toAscii() );
    url.addEncodedQueryItem( "language", iso3166() );

    QNetworkRequest request( url );
    QNetworkReply* reply = lastfm::nam()->get( request );
    connect( reply, SIGNAL(finished()), SLOT(onHandshakeReturn()) );
}
开发者ID:perXautomatik,项目名称:lastfm-desktop,代码行数:28,代码来源:LegacyTuner.cpp

示例3: qDebug

QNetworkReply* Echonest::Track::profileFromMD5( const QByteArray& md5 )
{
    QUrl url = Echonest::baseGetQuery( "track", "profile" );
    url.addEncodedQueryItem( "md5", md5 );
    url.addEncodedQueryItem( "bucket", "audio_summary" );
    
    qDebug() << "Creating profileFromMD5 URL" << url;
    return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:9,代码来源:Track.cpp

示例4: QNetworkRequest

QNetworkReply* Echonest::Artist::suggest( const QString& name, int results )
{
    QUrl url = Echonest::baseGetQuery( "artist", "suggest" );
    QString realname = name;
    url.addEncodedQueryItem( "name", Echonest::escapeSpacesAndPluses( realname ) );
    url.addEncodedQueryItem( "results", QByteArray::number( results ) );

    return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
}
开发者ID:Meartan,项目名称:clementine_nonfork,代码行数:9,代码来源:Artist.cpp

示例5: if

QNetworkReply* Echonest::Artist::fetchTerms( Echonest::Artist::TermSorting sorting ) const
{
    QUrl url = setupQuery( "terms", 0, -1 );
    if( sorting == Echonest::Artist::Weight )
        url.addEncodedQueryItem( "sort", "weight" );
    else if( sorting == Echonest::Artist::Frequency )
        url.addEncodedQueryItem( "sort", "frequency" );
    
    return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:10,代码来源:Artist.cpp

示例6: searchParamToString

QNetworkReply* Echonest::Artist::search(const Echonest::Artist::SearchParams& params, Echonest::ArtistInformation information, bool limit)
{
    QUrl url = Echonest::baseGetQuery( "artist", "search" );

    Echonest::Artist::SearchParams::const_iterator iter = params.constBegin();
    for( ; iter < params.constEnd(); ++iter )
        url.addEncodedQueryItem( searchParamToString( iter->first ), Echonest::escapeSpacesAndPluses( iter->second.toString() ) );
    url.addEncodedQueryItem( "limit", limit ? "true" : "false" );
    addQueryInformation( url, information );

    return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
}
开发者ID:Meartan,项目名称:clementine_nonfork,代码行数:12,代码来源:Artist.cpp

示例7: trendingPastes

void Pastebin::trendingPastes()
{
    QUrl requestUrl(PASTEBIN_URL + PASTEBIN_POST);
    QUrl requestArgs;
    QNetworkRequest request(requestUrl);
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

    requestArgs.addEncodedQueryItem("api_dev_key", m_developerKey.toUtf8());
    requestArgs.addEncodedQueryItem("api_option",  "trends");

    m_networkAccess->post(request, requestArgs.encodedQuery());
}
开发者ID:Antidote,项目名称:QtPastebin,代码行数:12,代码来源:pastebin.cpp

示例8: info

QNetworkReply* Echonest::Track::uploadLocalFile( const QUrl& localFile, const QByteArray& data, bool waitForResult )
{
    QUrl url = Echonest::baseGetQuery( "track", "upload" );
    QFileInfo info( localFile.path() );
    url.addQueryItem( QLatin1String( "filetype" ), info.suffix() );
    url.addEncodedQueryItem( "bucket", "audio_summary" );
    url.addEncodedQueryItem( "wait", ( waitForResult ? "true" : "false" ) );
    QNetworkRequest request( url );
    
    request.setHeader( QNetworkRequest::ContentTypeHeader, QLatin1String( "application/octet-stream" ) );
//     qDebug() << "Uploading local file to" << url;
    return Echonest::Config::instance()->nam()->post( request, data );
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:13,代码来源:Track.cpp

示例9: login

void Pastebin::login()
{
    QUrl requestUrl(PASTEBIN_URL + PASTEBIN_LOGIN);
    QUrl requestArgs;
    QNetworkRequest request(requestUrl);
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

    requestArgs.addEncodedQueryItem("api_dev_key",       m_developerKey.toUtf8());
    requestArgs.addEncodedQueryItem("api_user_name",     QUrl::toPercentEncoding(m_userName));
    requestArgs.addEncodedQueryItem("api_user_password", QUrl::toPercentEncoding(m_password));

    m_networkAccess->post(request, requestArgs.encodedQuery());
}
开发者ID:Antidote,项目名称:QtPastebin,代码行数:13,代码来源:pastebin.cpp

示例10: postPaste

void Pastebin::postPaste(const QByteArray& data, Language lang, const QString& title, const QString& expire, quint32 vis)
{
    QUrl requestUrl(PASTEBIN_URL + PASTEBIN_POST);
    QUrl requestArgs;
    QNetworkRequest request(requestUrl);
    QString langOpt = "text";

    if (lang != PlainText)
        langOpt = languageString(lang);
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

    requestArgs.addEncodedQueryItem("api_dev_key",           m_developerKey.toUtf8());
    requestArgs.addEncodedQueryItem("api_option",            "paste");
    requestArgs.addEncodedQueryItem("api_paste_expire_date", expire.toUtf8());
    requestArgs.addEncodedQueryItem("api_paste_private",     QString("%1").arg(vis).toUtf8());
    requestArgs.addEncodedQueryItem("api_paste_format",      langOpt.toUtf8());
    requestArgs.addEncodedQueryItem("api_paste_code",        QUrl::toPercentEncoding(QString(data).toAscii()));

    if (!title.isEmpty())
        requestArgs.addEncodedQueryItem("api_paste_name", QUrl::toPercentEncoding(title.toAscii()));

    if (!m_userKey.isEmpty())
        requestArgs.addEncodedQueryItem("api_user_key", m_userKey.toUtf8());

    m_networkAccess->post(request, requestArgs.encodedQuery());
}
开发者ID:Antidote,项目名称:QtPastebin,代码行数:26,代码来源:pastebin.cpp

示例11: addQueryInformation

QNetworkReply* Echonest::Artist::topHottt(Echonest::Artist::ArtistInformation information, int numResults, int offset, bool limit)
{
    QUrl url = Echonest::baseGetQuery( "artist", "top_hottt" );
    addQueryInformation( url, information );
    
    if( numResults > 0 )
        url.addEncodedQueryItem( "results", QByteArray::number( numResults ) );
    if( offset >= 0 ) 
        url.addEncodedQueryItem( "start", QByteArray::number( offset ) );
    
    url.addEncodedQueryItem( "limit", limit ? "true" : "false" );
    
    return Echonest::Config::instance()->nam()->get( QNetworkRequest( url ) );
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:14,代码来源:Artist.cpp

示例12: QNetworkRequest

void
SendLogsRequest::send()
{
    QUrl url;
    url.setScheme( "http" );
    url.setHost( "oops.last.fm" );
    url.setPath( "logsubmission/add" );
    url.addEncodedQueryItem( "username", QUrl::toPercentEncoding(Ws::Username) );
    #ifdef Q_WS_MAC
        url.addQueryItem( "platform", "macosx" );
    #elif defined WIN32
        url.addQueryItem( "platform", "win32" );
    #else
        url.addQueryItem( "platform", "linux" );
    #endif
    url.addQueryItem( "clientname", QCoreApplication::applicationName() );
    url.addQueryItem( "clientversion", QCoreApplication::applicationVersion() );

    QNetworkRequest request = QNetworkRequest( url );
    request.setRawHeader( "Content-Type", "multipart/form-data;boundary=8e61d618ca16" );
    request.setRawHeader( "Accept", "*/*" );

    m_data.append( postData( "usernotes", escapeString( m_usernotes ).toLatin1() ) );
    m_data.append( postData( "logs", m_logs.join(",").toLatin1() ) );
    m_data.append( "--8e61d618ca16--" ); // close the post request
    
    m_error = false;
    QNetworkReply *reply = (new WsAccessManager( this ))->post( request, m_data );
    
    connect( reply, SIGNAL( finished() ),
             this, SLOT( onFinished() ) );
    connect( reply, SIGNAL( error( QNetworkReply::NetworkError ) ),
             this, SLOT( onError( QNetworkReply::NetworkError ) ) );
}
开发者ID:AICIDNN,项目名称:lastfm-desktop,代码行数:34,代码来源:SendLogsRequest.cpp

示例13: deletePaste

void Pastebin::deletePaste(const QString& pasteKey)
{
    QUrl requestUrl(PASTEBIN_URL + PASTEBIN_POST);
    QUrl requestArgs;
    QNetworkRequest request(requestUrl);

    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    requestArgs.addEncodedQueryItem("api_dev_key",   m_developerKey.toUtf8());
    requestArgs.addEncodedQueryItem("api_option",    "delete");
    requestArgs.addEncodedQueryItem("api_paste_key", pasteKey.toUtf8());

    if (!m_userKey.isEmpty())
        requestArgs.addEncodedQueryItem("api_user_key", m_userKey.toUtf8());

    m_networkAccess->post(request, requestArgs.encodedQuery());
}
开发者ID:Antidote,项目名称:QtPastebin,代码行数:16,代码来源:pastebin.cpp

示例14: updateDisplay

void SongdisplayWidget::updateDisplay()
{
    if (currentTrack->isValid())
    {
        this->title->setText( currentTrack->getUrl().toString() );
        this->artist->setText( "artist" );
        this->album->setText( "album" );

        QUrl url = preferences->getBaseUrl();
        url.setPath( url.path() + "/track/image" );

        url.addEncodedQueryItem(
            QString( "track_id" ).toUtf8(),
            QString::number( currentTrack->getID() ).toUtf8()
        );

        QNetworkRequest request = QNetworkRequest( url );
        manager->get( request );
    }
    else
    {
        setDefaultIcon();
    }

}
开发者ID:ewasser,项目名称:wave-player,代码行数:25,代码来源:SongdisplayWidget.cpp

示例15: send

void SeafileApiRequest::send()
{
    if (token_.size() > 0) {
        api_client_->setToken(token_);
    }

    switch (method_) {
    case METHOD_GET:
        url_.setQueryItems(params_);
        api_client_->get(url_);
        break;
    case METHOD_POST:
        QUrl params;
        for (int i = 0; i < params_.size(); i++) {
            QPair<QString, QString> pair = params_[i];
            params.addEncodedQueryItem(QUrl::toPercentEncoding(pair.first),
                                       QUrl::toPercentEncoding(pair.second));
        }
        api_client_->post(url_, params.encodedQuery());
        break;
    }

    connect(api_client_, SIGNAL(requestSuccess(QNetworkReply&)),
            this, SLOT(requestSuccess(QNetworkReply&)));

    connect(api_client_, SIGNAL(networkError(const QNetworkReply::NetworkError&, const QString&)),
            this, SIGNAL(networkError(const QNetworkReply::NetworkError&, const QString&)));

    connect(api_client_, SIGNAL(requestFailed(int)),
            this, SIGNAL(failed(int)));

    connect(api_client_, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
            this, SLOT(onSslErrors(QNetworkReply*, const QList<QSslError>&)));

}
开发者ID:antofa,项目名称:seafile-client,代码行数:35,代码来源:api-request.cpp


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