本文整理汇总了C++中QNetworkReply::setReadBufferSize方法的典型用法代码示例。如果您正苦于以下问题:C++ QNetworkReply::setReadBufferSize方法的具体用法?C++ QNetworkReply::setReadBufferSize怎么用?C++ QNetworkReply::setReadBufferSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QNetworkReply
的用法示例。
在下文中一共展示了QNetworkReply::setReadBufferSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: downloadRequested
void DownloadManager::downloadRequested(const QNetworkRequest& request) {
std::cout << "DownloadManager::DownloadRequested()\n";
QString src = request.url().toString();
QString dest = request.attribute(QNetworkRequest::User, "~").toString();
QFile* fileDestination = new QFile(dest);
fileDestination->open(QIODevice::ReadWrite);
QNetworkReply* reply = mNetworkAccess.get(request);
reply->setReadBufferSize(0);
mActiveDownloads.insert(reply, fileDestination);
connect(reply, SIGNAL(finished()), this, SLOT(downloadFinished()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)));
connect(reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
DownloadData* data = new DownloadData();
data->mRemotePath = src;
data->mLocalPath = dest;
connect(reply, SIGNAL(finished()), data, SLOT(finished()));
connect(reply, SIGNAL(downloadProgress(qint64, qint64)), data, SLOT(catchProgress(qint64, qint64)));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), data, SIGNAL(error(QNetworkReply::NetworkError)));
connect(data, SIGNAL(stopMe()), this, SLOT(stopDownload()));
connect(data, SIGNAL(removeMe()), this, SLOT(removeDownload()));
//connect(data, SIGNAL(reloadMe()), this, SLOT(reloadDownload()));
emit downloadStarted(data);
emit controller_showSystemTrayMessage("", "Download Started: " + data->localName());
mModel.addDownload(data);
mDownloads.insert(data, reply);
}
示例2: reexecuteQuery
void CommandDownloadFile::reexecuteQuery()
{
Q_D(CommandDownloadFile);
QNetworkRequest request( d->downloadUrl );
setRequestAccessToken(request, session()->accessToken());
QNetworkReply* reply = session()->networkManager()->get(request);
reply->setReadBufferSize(d->bufferSize);
connect(reply, SIGNAL(finished()), SLOT(requestFinished()));
connect(reply, SIGNAL(readyRead()), SLOT(readyRead()));
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), SIGNAL(progress(qint64,qint64)));
reply->setParent(this);
}
示例3: startDownload
void NetworkTaskManager::startDownload( LoadImageTask * task )
{
IniConfig & ini = config();
ini.pushSection( "Image_Loading" );
QString prefix = ini.readString( "HttpUrl" );
QString user = ini.readString( "HttpUser" );
QString password = ini.readString( "HttpPassword" );
ini.popSection();
if( task->mPath[0].isLetter() )
task->mPath[0] = task->mPath[0].toLower();
QUrl url( prefix + task->mPath.replace(":","").replace("\\","/") );
LOG_5( "Fetching URL: " + url.toString() );
QNetworkRequest request(url);
request.setRawHeader("Authorization", "Basic " + QByteArray(QString("%1:%2").arg(user).arg(password).toAscii()).toBase64());
QNetworkReply * reply = mNetworkAccessManager->get(request);
reply->setReadBufferSize(0);
connect( reply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(slotError(QNetworkReply::NetworkError)) );
#ifndef QT_NO_OPENSSL
connect( reply, SIGNAL(sslErrors(const QList<QSslError> &)), SLOT(slotSslErrors(const QList<QSslError> &)) );
#endif
mReplyDict[reply] = task;
}
示例4: setReadBufferSize
void QNetworkReplyProto::setReadBufferSize(qint64 size)
{
QNetworkReply *item = qscriptvalue_cast<QNetworkReply*>(thisObject());
if (item)
item->setReadBufferSize(size);
}