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


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

本文整理汇总了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);
}
开发者ID:jeremykross,项目名称:Trek-Browser,代码行数:33,代码来源:DownloadManager.cpp

示例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);
}
开发者ID:navrocky,项目名称:libQtGoogleDrive,代码行数:12,代码来源:command_download_file.cpp

示例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;
}
开发者ID:EntityFXCode,项目名称:arsenalsuite,代码行数:24,代码来源:imageview.cpp

示例4: setReadBufferSize

void QNetworkReplyProto::setReadBufferSize(qint64 size)
{
  QNetworkReply *item = qscriptvalue_cast<QNetworkReply*>(thisObject());
  if (item)
    item->setReadBufferSize(size);
}
开发者ID:Dinesh-Ramakrishnan,项目名称:qt-client,代码行数:6,代码来源:qnetworkreplyproto.cpp


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