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


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

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


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

示例1: 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

示例2: 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

示例3: postPairs

void SohuMiniBlog::postPairs(const QString& aUrl, const QString& aKey1, const QString& aValue1,
                                 const QString& aKey2, const QString& aValue2)
{
    qDebug() << "SohuMiniBlog:postPairs" << aUrl << aKey1 << aValue1 << aKey2 << aValue2;
    qDebug() << aUrl;

    if(aUrl.isEmpty())
    {
        return;
    }

    mRequest->setUrl(QUrl(aUrl));

    QByteArray data;
    QUrl params;

    params.addQueryItem(aKey1, aValue1);//addQueryItem
    params.addQueryItem(aKey2, aValue2);//addQueryItem
    data = params.encodedQuery();

    if(NULL != gUniqueNetwrkManager)
    {
        mRequestTimeoutTimer->setInterval(KRequestTimeOut);
        mRequestTimeoutTimer->start();
        mReply = gUniqueNetwrkManager->post(*mRequest, data);
        connect(mReply, SIGNAL(finished()), this, SLOT(onReplyFinished()));
    }
}
开发者ID:jiecuoren,项目名称:rmr,代码行数:28,代码来源:sohuminiblog.cpp

示例4: search

void SearchController::search(const QString &search,
							  const QString &author,
							  const QString &hashKey,
							  int searchType,
							  int categoryType,
							  int searchIn,
							  int numberOfMessages,
							  int sortBy) {

	const QUrl url(DefineConsts::FORUM_URL + "/search.php?config=hfr.inc");

	QNetworkRequest request(url);
	request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

	QUrl params;
	params.addQueryItem("hash_check", hashKey);
	params.addQueryItem("cat", QString::number(categoryType));
	params.addQueryItem("titre", QString::number(searchIn));
	params.addQueryItem("search", search);
	params.addQueryItem("searchtype", QString::number(searchType));
	params.addQueryItem("pseud", author);
	params.addQueryItem("resSearch", QString::number(numberOfMessages));
	params.addQueryItem("orderSearch", QString::number(sortBy));

	QNetworkReply* reply = HFRNetworkAccessManager::get()->post(request, params.encodedQuery());
	bool ok = connect(reply, SIGNAL(finished()), this, SLOT(checkReply()));
	Q_ASSERT(ok);
	Q_UNUSED(ok);

}
开发者ID:Jendorski,项目名称:HFRBlack,代码行数:30,代码来源:SearchController.cpp

示例5: connect

void
StravaUploadDialog::requestLogin()
{
    progressLabel->setText(tr("Login..."));
    progressBar->setValue(5);

    QString username = appsettings->cvalue(mainWindow->cyclist, GC_STRUSER).toString();
    QString password = appsettings->cvalue(mainWindow->cyclist, GC_STRPASS).toString();

    QNetworkAccessManager networkMgr;
    QEventLoop eventLoop;
    connect(&networkMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(requestLoginFinished(QNetworkReply*)));
    connect(&networkMgr, SIGNAL(finished(QNetworkReply *)), &eventLoop, SLOT(quit()));

    QByteArray data;
    /*data += "{\"email\": \"" + username + "\",";
    data += "\"password\": \"" + password + "\",";
    data += "\"agreed_to_terms\": \"true\"}";*/

    QUrl params;

    params.addQueryItem("email", username);
    params.addQueryItem("password",password);
    params.addQueryItem("agreed_to_terms", "true");
    data = params.encodedQuery();

    QUrl url = QUrl( STRAVA_URL_SSL + "/authentication/login");
    QNetworkRequest request = QNetworkRequest(url);
    //request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

    request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");

    networkMgr.post( request, data);
    eventLoop.exec();
}
开发者ID:27sparks,项目名称:GoldenCheetah,代码行数:35,代码来源:StravaUploadDialog.cpp

示例6: encodedQuery

QByteArray QUrlProto::encodedQuery() const
{
  QUrl *item = qscriptvalue_cast<QUrl*>(thisObject());
  if (item)
    return item->encodedQuery();
  return QByteArray();
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例7: if

void Snap2ChatAPISimple::request(QVariant params)
{
	QUrl dataToSend;

	QVariantMap paramsMap = params.toMap();

	const QString endpoint		= paramsMap.value("endpoint").toString();

	if(endpoint == "listen")
	{
		dataToSend.addQueryItem("userid", paramsMap.value("userid").toString());
	}
	else if(endpoint == "login" || endpoint == "register")
	{
		dataToSend.addQueryItem("username", paramsMap.value("username").toString());
		dataToSend.addQueryItem("password", paramsMap.value("password").toString());
	}

	QNetworkRequest request;
	request.setUrl(QUrl(PROTOCOL + API_ENDPOINT + endpoint + ".php"));
	request.setHeader(QNetworkRequest::ContentTypeHeader, CONTENT_TYPE);

	QNetworkReply* reply = m_manager.post(request, dataToSend.encodedQuery());
	reply->setProperty("endpoint", endpoint);
	connect (reply, SIGNAL(finished()), this, SLOT(onComplete()));
}
开发者ID:NemOry,项目名称:NemSMS,代码行数:26,代码来源:NemAPI.cpp

示例8: login

void STULogin::login(const QString &user, const QString &passwd){

//    qDebug() << "now login " + user + "\t" + passwd;

    logining = true;  // QtNetWorkAccessManager works asynchronously
    this->user_copy = user;
//    qDebug() << this->user;
    this->passwd = passwd;  // record the user info for try again untill MAX_COUNT or login
    if (is_connected){
        wrongCount = 0;
        return;
    }
    requestAddr->setUrl(LOGIN_REQUEST_ADDR);
    QUrl params;
    params.addQueryItem(USERNAME_INPUT,user);
    params.addQueryItem(PASSWD_INPUT,passwd);
    params.addQueryItem(LOGIN_INPUT,"");

    QByteArray postData = params.encodedQuery();
    QNetworkRequest request(*requestAddr);
    request.setHeader(QNetworkRequest::ContentTypeHeader,
                      "application/x-www-form-urlencoded");
    delayForSomeTime(600);
    QNetworkReply *reply = syncHttpPost(request, postData);
    handleReply(reply);
    processStates(replyData);
    emit stateChanged(is_connected,user,used,total,left);
    //qDebug() << replyData;
}
开发者ID:Hjsmallfly,项目名称:stulogin,代码行数:29,代码来源:stulogin.cpp

示例9: encodedQuery

int Url::encodedQuery ( lua_State * L )// const : QByteArray
{
	QUrl* lhs = ValueInstaller2<QUrl>::check( L, 1 );
	//QByteArray* res = ValueInstaller2<QByteArray>::create( L );
	Util::push( L, lhs->encodedQuery().data() );
	return 1;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:7,代码来源:QtlUrl.cpp

示例10: checkUserActivated

bool ActivatePage::checkUserActivated(int user_id)
{
    serverQueryFinished = false;
    serverQueryError = false;
    label_message->setText("Logging in...");
    QString url( "https://screencloud.net/1.0/users/check_activated.xml");

    QString token, tokenSecret;

    // create a request parameters map
    QUrl bodyParams;
    bodyParams.addQueryItem("user_id", QString::number(user_id));
    bodyParams.addQueryItem("oauth_version", "1.0");
    bodyParams.addQueryItem("oauth_signature_method", "PLAINTEXT");
    bodyParams.addQueryItem("oauth_consumer_key", CONSUMER_KEY_SCREENCLOUD);
    bodyParams.addQueryItem("oauth_signature", CONSUMER_SECRET_SCREENCLOUD);

    QByteArray body = bodyParams.encodedQuery();

    QNetworkRequest request;
    request.setUrl(QUrl(url));
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
    manager->post(request, body);
    return true;
}
开发者ID:Nothing4You,项目名称:screencloud,代码行数:25,代码来源:activatepage.cpp

示例11: submitPaste

void Pastebin::submitPaste(const QString& pasteContent, const QString& pasteTitle, const QString& format, const QString& expiration, const PasteListing::Visibility visibility) {
    qDebug() << "submitPaste()";

    QNetworkRequest request(buildUrl("http://pastebin.com/api/api_post.php"));
    request.setHeader(QNetworkRequest::ContentTypeHeader, URLENCODED_CONTENT_TYPE);

    QUrl params;
    params.addQueryItem("api_dev_key", PASTEBIN_DEV_KEY);
    params.addQueryItem("api_user_key", apiKey());
    params.addQueryItem("api_option", "paste");
    params.addQueryItem("api_paste_code", pasteContent);
    params.addQueryItem("api_paste_private", QString("%1").arg(static_cast<int>(visibility)));
    if(!pasteTitle.isEmpty()) {
        params.addQueryItem("api_paste_name", pasteTitle);
    }
    if(!expiration.isEmpty()) {
        params.addQueryItem("api_paste_expire_date", expiration);
    }
    if(!format.isEmpty()) {
        params.addQueryItem("api_paste_format", format);
    }

    QNetworkReply *reply = accessManager_.post(request, params.encodedQuery());
    connect(reply, SIGNAL(finished()), this, SLOT(onSubmitPasteFinished()));
}
开发者ID:dkonigsberg,项目名称:LogicPaste,代码行数:25,代码来源:Pastebin.cpp

示例12: on_button_logout_clicked

void PreferencesDialog::on_button_logout_clicked()
{
    QMessageBox msgBox;
    msgBox.addButton(QMessageBox::Yes);
    msgBox.addButton(QMessageBox::No);
    msgBox.setText("Are you sure that you want to log out? This will remove the saved account details and quit the application.");
    msgBox.setIcon(QMessageBox::Information);
    int selection = msgBox.exec();
    if(selection == QMessageBox::Yes)
    {
        //Send logout request
        QUrl url( "https://api.screencloud.net/1.0/users/logout.xml" );

        // construct the parameters string
        url.addQueryItem("oauth_version", "1.0");
        url.addQueryItem("oauth_signature_method", "PLAINTEXT");
        url.addQueryItem("oauth_token", token);
        url.addQueryItem("oauth_consumer_key", CONSUMER_KEY_SCREENCLOUD);
        url.addQueryItem("oauth_signature", CONSUMER_SECRET_SCREENCLOUD + QString("&") + tokenSecret);
        url.addQueryItem("oauth_timestamp", QString::number(QDateTime::currentDateTimeUtc().toTime_t()));
        url.addQueryItem("oauth_nonce", NetworkUtils::generateNonce(15));

        QUrl bodyParams;
        bodyParams.addQueryItem("token", token);
        QByteArray body = bodyParams.encodedQuery();

        QNetworkRequest request;
        request.setUrl(url);
        manager->post(request, body);
        userHasLoggedOut = true;
    }
}
开发者ID:Storesau,项目名称:screencloud,代码行数:32,代码来源:preferencesdialog.cpp

示例13: connectToServer

void AJAXChat::connectToServer(const QString &server, const QString &userName, const QString &password,
                               const QString &channel, const QString &forumLoginUrl)
{
    _server = server;

    // setup request parameters
    QUrl params;
    params.addQueryItem("login", "login");
    params.addQueryItem("redirect", server);
    params.addQueryItem("username", userName);
    params.addQueryItem("password", password);
    params.addQueryItem("channelName", channel);
    params.addQueryItem("lang", "en");
    params.addQueryItem("submit", "Login");

    // if the forum login url is set, then login to the forum and then go to the chat,
    // otherwise, directly go to the chat
    QString connectUrl = forumLoginUrl.isEmpty() ? server : forumLoginUrl;

    QUrl url(connectUrl);
    QNetworkRequest request(url);
    // content type is needed or you will get runtime debug warnings. This kind of header is needed or
    // the chat will just asks the bot to logout
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

    QNetworkReply *reply = net->post(request, params.encodedQuery());
    connect(reply, SIGNAL(finished()), this, SLOT(connectFinished()));
    connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater()));
}
开发者ID:Maluen,项目名称:botanna,代码行数:29,代码来源:AJAXChat.cpp

示例14: deletePrivateMessage

void PrivateMessageController::deletePrivateMessage(const QString &urlFirstPage) {

    QRegExp catIDRegExp("cat=([0-9prive]+)");
    if(catIDRegExp.indexIn(urlFirstPage) == -1)
        return;

    const QUrl url(DefineConsts::FORUM_URL + "/modo/manageaction.php?config=hfr.inc&cat=" + catIDRegExp.cap(1) + "&type_page=forum1&moderation=0");

    QRegExp postIDRegExp("post=([0-9]+)");
    if(postIDRegExp.indexIn(urlFirstPage) == -1)
        return;

    QNetworkRequest request(url);
    request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");

    QUrl params;
    params.addQueryItem("action_reaction", "valid_eff_prive");
    params.addQueryItem("topic1", postIDRegExp.cap(1));
    params.addQueryItem("hash_check", m_HashCheck);

    QNetworkReply* reply = HFRNetworkAccessManager::get()->post(request, params.encodedQuery());
    bool ok = connect(reply, SIGNAL(finished()), this, SLOT(checkMessageDeleted()));
    Q_ASSERT(ok);
    Q_UNUSED(ok);
}
开发者ID:gonztirado,项目名称:HeadlessHFR,代码行数:25,代码来源:PrivateMessageController.cpp

示例15: sendHttpPost

//! HTTP POST request
void GoogleReader::sendHttpPost(QUrl url, QUrl params)
{
  QNetworkRequest request(url);
  request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded");
  request.setRawHeader("Authorization", QString("GoogleLogin auth=%1").arg(auth_).toUtf8());

  managerHttpPost_.post(request, params.encodedQuery());
}
开发者ID:DanMan,项目名称:quiterss,代码行数:9,代码来源:googlereader.cpp


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