本文整理汇总了C++中downloadProgress函数的典型用法代码示例。如果您正苦于以下问题:C++ downloadProgress函数的具体用法?C++ downloadProgress怎么用?C++ downloadProgress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了downloadProgress函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dropNetworkConnection
bool PictureContent::loadFromNetwork(const QString & url, QNetworkReply * reply, const QString & title, int width, int height)
{
dropNetworkConnection();
delete m_photo;
m_cachedPhoto = QPixmap();
m_opaquePhoto = false;
m_photo = 0;
m_fileUrl = url;
m_netWidth = width;
m_netHeight = height;
// start a download if not passed as a paramenter
if (!reply) {
// the QNAM will be auto-deleted on closure
QNetworkAccessManager * nam = new QNetworkAccessManager(this);
QNetworkRequest request(url);
m_netReply = nam->get(request);
} else
m_netReply = reply;
// set title
if (!title.isEmpty()) {
setFrameTextEnabled(true);
setFrameText(title);
}
#if QT_VERSION >= 0x040600
// Immediate Decode: just handle the reply if done
if (m_netReply->isFinished())
return slotLoadNetworkData();
#else
// No Precaching ensures signals to be emitted later
#endif
// Deferred Decode: listen to the network job
setAcceptHoverEvents(false);
setControlsVisible(false);
m_progress = 0.01;
connect(m_netReply, SIGNAL(finished()), this, SLOT(slotLoadNetworkData()));
connect(m_netReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotNetworkError()));
connect(m_netReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(slotNetworkProgress(qint64,qint64)));
// reset size, if got the network one
if (m_netWidth > 0 && m_netHeight > 0)
resetContentsRatio();
return true;
}
开发者ID:madjar,项目名称:fotowall,代码行数:47,代码来源:PictureContent.cpp
示例2: QWidget
ShowPicture::ShowPicture(QString bigUrl, QString midUrl, QWidget *parent) :
QWidget(parent)
{
this->setWindowFlags(Qt::FramelessWindowHint);
this->bigUrl = bigUrl;
this->midUrl = midUrl;
if(midUrl.toUpper().endsWith(".GIF"))
this->isGif = true;
else
this->isGif = false;
this->setWindowTitle(tr("图片"));
progressBar = new QProgressBar(this);
progressBar->setValue(0);
label = new QLabel(this);
label->setText("正在下载......");
this->showGif = new QLabel(this);
this->showGif->hide();
this->movie = new QMovie(this);
this->gifImageFile = new QBuffer(&imageByteArray, this);
layout = new QVBoxLayout(this);
layout->addWidget(label);
layout->addWidget(progressBar);
toolBar = new QToolBar(this);
saveFile = new QAction(this);
bigPicture = new QAction(this);
saveFile->setText("保存图片");
bigPicture->setText("查看大图");
QObject::connect(saveFile, SIGNAL(triggered()), this, SLOT(saveImage()));
QObject::connect(bigPicture, SIGNAL(triggered()), this, SLOT(showBigPicture()));
toolBar->addAction(saveFile);
toolBar->addAction(bigPicture);
toolBar->hide();
view = new QGraphicsView(this);
scene = new QGraphicsScene(this);
view->setScene(scene);
view->hide();
http = new Http(this);
QObject::connect(http, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateProgressBar(qint64,qint64)));
//QObject::connect(http, SIGNAL(finished()), this, SLOT(showAfterDownload()));
timer = new QTimer(this);
timer->setSingleShot(true);
QObject::connect(timer, SIGNAL(timeout()), this, SLOT(downloadFile()));
timer->start(500);
}
开发者ID:xiongwang,项目名称:USense,代码行数:47,代码来源:showpicture.cpp
示例3: PathCombine
void LegacyUpdate::lwjglStart()
{
LegacyInstance *inst = (LegacyInstance *)m_inst;
lwjglVersion = inst->lwjglVersion();
lwjglTargetPath = PathCombine(MMC->settings()->get("LWJGLDir").toString(), lwjglVersion);
lwjglNativesPath = PathCombine(lwjglTargetPath, "natives");
// if the 'done' file exists, we don't have to download this again
QFileInfo doneFile(PathCombine(lwjglTargetPath, "done"));
if (doneFile.exists())
{
jarStart();
return;
}
auto list = MMC->lwjgllist();
if (!list->isLoaded())
{
emitFailed("Too soon! Let the LWJGL list load :)");
return;
}
setStatus(tr("Downloading new LWJGL..."));
auto version = list->getVersion(lwjglVersion);
if (!version)
{
emitFailed("Game update failed: the selected LWJGL version is invalid.");
return;
}
QString url = version->url();
QUrl realUrl(url);
QString hostname = realUrl.host();
auto worker = MMC->qnam();
QNetworkRequest req(realUrl);
req.setRawHeader("Host", hostname.toLatin1());
req.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Cached)");
QNetworkReply *rep = worker->get(req);
m_reply = std::shared_ptr<QNetworkReply>(rep);
connect(rep, SIGNAL(downloadProgress(qint64, qint64)), SIGNAL(progress(qint64, qint64)));
connect(worker.get(), SIGNAL(finished(QNetworkReply *)),
SLOT(lwjglFinished(QNetworkReply *)));
// connect(rep, SIGNAL(error(QNetworkReply::NetworkError)),
// SLOT(downloadError(QNetworkReply::NetworkError)));
}
开发者ID:Nightreaver,项目名称:MultiMC5,代码行数:47,代码来源:LegacyUpdate.cpp
示例4: emitFailed
void LegacyUpdate::lwjglFinished(QNetworkReply *reply)
{
if (m_reply.get() != reply)
{
return;
}
if (reply->error() != QNetworkReply::NoError)
{
emitFailed("Failed to download: " + reply->errorString() +
"\nSometimes you have to wait a bit if you download many LWJGL versions in "
"a row. YMMV");
return;
}
auto worker = MMC->qnam();
// Here i check if there is a cookie for me in the reply and extract it
QList<QNetworkCookie> cookies =
qvariant_cast<QList<QNetworkCookie>>(reply->header(QNetworkRequest::SetCookieHeader));
if (cookies.count() != 0)
{
// you must tell which cookie goes with which url
worker->cookieJar()->setCookiesFromUrl(cookies, QUrl("sourceforge.net"));
}
// here you can check for the 302 or whatever other header i need
QVariant newLoc = reply->header(QNetworkRequest::LocationHeader);
if (newLoc.isValid())
{
QString redirectedTo = reply->header(QNetworkRequest::LocationHeader).toString();
QUrl realUrl(redirectedTo);
QString hostname = realUrl.host();
QNetworkRequest req(redirectedTo);
req.setRawHeader("Host", hostname.toLatin1());
req.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Cached)");
QNetworkReply *rep = worker->get(req);
connect(rep, SIGNAL(downloadProgress(qint64, qint64)),
SIGNAL(progress(qint64, qint64)));
m_reply = std::shared_ptr<QNetworkReply>(rep);
return;
}
QFile saveMe("lwjgl.zip");
saveMe.open(QIODevice::WriteOnly);
saveMe.write(m_reply->readAll());
saveMe.close();
setStatus(tr("Installing new LWJGL..."));
extractLwjgl();
jarStart();
}
开发者ID:Nightreaver,项目名称:MultiMC5,代码行数:47,代码来源:LegacyUpdate.cpp
示例5: connect
void ParserAbstract::sendHttpRequest(QUrl url, QByteArray data)
{
QNetworkRequest request;
request.setUrl(url);
request.setRawHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0");
request.setRawHeader("Cache-Control", "no-cache");
if (data.isNull()) {
lastRequest = NetworkManager->get(request);
} else {
lastRequest = NetworkManager->post(request, data);
}
requestTimeout->start(30000);
connect(lastRequest, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(networkReplyDownloadProgress(qint64,qint64)));
}
开发者ID:shentok,项目名称:fahrplan,代码行数:17,代码来源:parser_abstract.cpp
示例6: UINetworkReply
/* Prepare network-reply: */
void UINetworkRequest::prepareNetworkReply()
{
/* Make network-request: */
m_pReply = new UINetworkReply(m_request, m_type);
AssertMsg(m_pReply, ("Unable to make network-request!\n"));
/* Prepare listeners for m_pReply: */
connect(m_pReply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(sltHandleNetworkReplyProgress(qint64, qint64)));
connect(m_pReply, SIGNAL(finished()), this, SLOT(sltHandleNetworkReplyFinish()));
/* Set as running: */
m_fRunning = true;
/* Notify general network-requests listeners: */
emit sigStarted(m_uuid);
/* Notify particular network-request listeners: */
emit sigStarted();
}
开发者ID:MadHacker217,项目名称:VirtualBox-OSE,代码行数:18,代码来源:UINetworkRequest.cpp
示例7: connect
bool Http::get(const QString& url)
{
m_Data.clear();
m_Request.setUrl(url);
m_pReply = m_NetworkManager.get(m_Request);
QEventLoop loop;
connect(m_pReply, SIGNAL(finished()), &loop, SLOT(quit()));
connect(m_pReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(onDownloadProgress(qint64,qint64)));
loop.exec();
m_Data.append(m_pReply->readAll());
m_Error = m_pReply->error();
m_Message = m_pReply->errorString();
return m_Error == QNetworkReply::NoError;
}
开发者ID:LuaxY,项目名称:ARK-Launcher,代码行数:17,代码来源:http.cpp
示例8: connect
void DownLoadFun::down(STATUSID id, QString url)
{
if(reply != NULL)
{
reply->abort();
}
m_id = id;
QNetworkAccessManager *manager = new QNetworkAccessManager;
reply = manager->get(QNetworkRequest(url));
connect(reply, SIGNAL(finished()), this, SLOT(httpFinished()));
connect(reply,SIGNAL(downloadProgress(qint64,qint64)),
this,SLOT(updateDataReadProgress(qint64,qint64)));
}
开发者ID:gateslu,项目名称:renrentest,代码行数:17,代码来源:downloadfun.cpp
示例9: QgsDebugMsg
bool QgsWcsCapabilities::sendRequest( QString const & url )
{
QgsDebugMsg( "url = " + url );
mError = "";
QNetworkRequest request( url );
if ( !setAuthorization( request ) )
{
mError = tr( "Download of capabilities failed: network request update failed for authentication config" );
QgsMessageLog::logMessage( mError, tr( "WCS" ) );
return false;
}
request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true );
request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, mCacheLoadControl );
QgsDebugMsg( QString( "mCacheLoadControl = %1" ).arg( mCacheLoadControl ) );
QgsDebugMsg( QString( "getcapabilities: %1" ).arg( url ) );
mCapabilitiesReply = QgsNetworkAccessManager::instance()->get( request );
connect( mCapabilitiesReply, SIGNAL( finished() ), this, SLOT( capabilitiesReplyFinished() ) );
connect( mCapabilitiesReply, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( capabilitiesReplyProgress( qint64, qint64 ) ) );
while ( mCapabilitiesReply )
{
QCoreApplication::processEvents( QEventLoop::ExcludeUserInputEvents );
}
if ( mCapabilitiesResponse.isEmpty() )
{
if ( mError.isEmpty() )
{
mErrorFormat = "text/plain";
mError = tr( "empty capabilities document" );
}
return false;
}
if ( mCapabilitiesResponse.startsWith( "<html>" ) ||
mCapabilitiesResponse.startsWith( "<HTML>" ) )
{
mErrorFormat = "text/html";
mError = mCapabilitiesResponse;
return false;
}
return true;
}
开发者ID:Benardi-atmadja,项目名称:QGIS,代码行数:45,代码来源:qgswcscapabilities.cpp
示例10: Q_D
void QQuickAnimatedImage::load()
{
Q_D(QQuickAnimatedImage);
if (d->url.isEmpty()) {
if (d->progress != 0) {
d->progress = 0;
emit progressChanged(d->progress);
}
d->setImage(QImage());
d->status = Null;
emit statusChanged(d->status);
if (sourceSize() != d->oldSourceSize) {
d->oldSourceSize = sourceSize();
emit sourceSizeChanged();
}
if (isPlaying() != d->oldPlaying)
emit playingChanged();
} else {
QString lf = QQmlFile::urlToLocalFileOrQrc(d->url);
if (!lf.isEmpty()) {
d->_movie = new QMovie(lf);
movieRequestFinished();
} else {
if (d->status != Loading) {
d->status = Loading;
emit statusChanged(d->status);
}
if (d->progress != 0) {
d->progress = 0;
emit progressChanged(d->progress);
}
QNetworkRequest req(d->url);
req.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
d->reply = qmlEngine(this)->networkAccessManager()->get(req);
QObject::connect(d->reply, SIGNAL(finished()),
this, SLOT(movieRequestFinished()));
QObject::connect(d->reply, SIGNAL(downloadProgress(qint64,qint64)),
this, SLOT(requestProgress(qint64,qint64)));
}
}
}
开发者ID:SamuelNevala,项目名称:qtdeclarative,代码行数:45,代码来源:qquickanimatedimage.cpp
示例11: downloadProgress
/** Report download progress to the user */
void HttpClient::slotDownloadProgress( qint64 bytesReceived, qint64 bytesTotal )
{
// qDebug() << "HttpClient::slotDownloadProgress" << bytesReceived << bytesTotal;
if ( _progressDialog != static_cast<QProgressDialog *> (0) )
{
// Report results to the progress dialog.
_progressDialog->setMaximum( bytesTotal );
_progressDialog->setValue( bytesReceived );
}
else
{
// Emit this signal to the outside, when no progress dialog is set up.
emit downloadProgress( bytesReceived, bytesTotal );
}
timer->start();
}
开发者ID:Exadios,项目名称:KFLog,代码行数:19,代码来源:httpclient.cpp
示例12: request
void GetFileTask::sendRequest()
{
QNetworkRequest request(url_);
if (!network_mgr_) {
static QNetworkAccessManager *manager = new QNetworkAccessManager(qApp);
network_mgr_ = manager;
NetworkManager::instance()->addWatch(network_mgr_);
}
reply_ = network_mgr_->get(request);
connect(reply_, SIGNAL(sslErrors(const QList<QSslError>&)),
this, SLOT(onSslErrors(const QList<QSslError>&)));
connect(reply_, SIGNAL(readyRead()), this, SLOT(httpReadyRead()));
connect(reply_, SIGNAL(downloadProgress(qint64, qint64)),
this, SIGNAL(progressUpdate(qint64, qint64)));
connect(reply_, SIGNAL(finished()), this, SLOT(httpRequestFinished()));
}
开发者ID:DevCybran,项目名称:seafile-client,代码行数:18,代码来源:tasks.cpp
示例13: QNetworkAccessManager
void dbmanager::doDownload(const QVariant& v)
{
if (v.type() == QVariant::StringList) {
QNetworkAccessManager *manager= new QNetworkAccessManager(this);
QUrl url = v.toStringList().at(current);
filename = url.toString().remove("http://restbase.wikitolearn.org/en.wikitolearn.org/v1/media/math/render/svg/");
m_network_reply = manager->get(QNetworkRequest(QUrl(url)));
connect(m_network_reply, SIGNAL(downloadProgress (qint64, qint64)),this, SLOT(updateDownloadProgress(qint64, qint64))); // checks download progress
connect(m_network_reply,SIGNAL(finished()),this,SLOT(downloadFinished())); // signal that download is finished
}
}
开发者ID:hackertron,项目名称:W2L,代码行数:18,代码来源:dbmanager.cpp
示例14: req
bool NetworkHandler::startJSONDownload()
{
QNetworkRequest req(m_Url);
req.setRawHeader(m_headerName,m_headerValue);
m_pNetworkReply = m_Mgr.get(req);
if(m_pNetworkReply)
{
QObject::connect(m_pNetworkReply,SIGNAL(finished()),this,SLOT(readFinished()));
QObject::connect(m_pNetworkReply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(downloadProgress(qint64,qint64)));
QObject::connect(m_pNetworkReply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(error(QNetworkReply::NetworkError)));
QObject::connect(&m_timer,SIGNAL(timeout()),this,SLOT(timeout()));
}
else
{
qDebug() << "Failed to create get request!";
emit readyRead(QByteArray());
}
}
开发者ID:muma7490,项目名称:MTmate-for-Reddit,代码行数:18,代码来源:networkhandler.cpp
示例15: connect
void video::download()
{
_step = 3;
handler->clearDownloads();
connect(handler, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(changeProgress(qint64, qint64)));
if (!this->_supportedQualities.at(_quality).videoUrl.isEmpty())
{
qDebug() << "Downloading video file: " << this->_supportedQualities.at(_quality).videoUrl;
handler->addDownload(this->_supportedQualities.at(_quality).videoUrl, this->_supportedQualities.at(_quality).chunkedDownload);
}
if (!this->_supportedQualities.at(_quality).audioUrl.isEmpty())
{
qDebug() << "Downloading audio file: " << this->_supportedQualities.at(_quality).audioUrl;
handler->addDownload(this->_supportedQualities.at(_quality).audioUrl, this->_supportedQualities.at(_quality).chunkedDownload);
}
}
开发者ID:MegaBedder,项目名称:ClipGrab-1,代码行数:18,代码来源:video.cpp
示例16: sendInfo
//reply finished
void Downloader::finishedSlot(){
if (reply->error() == QNetworkReply::NoError){
QVariant possibleRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if (!possibleRedirectUrl.toUrl().isEmpty()) {
//there is redirect
//make new request
//emit sendInfo("Redirected to "+possibleRedirectUrl.toUrl().toString());
reply->deleteLater();
reply = nam.get(QNetworkRequest(possibleRedirectUrl.toUrl())); //when this reply is finished this slot will get re-triggered
emit sendInfo("Redirecting...");
emit sendInfo("");
tmpBuffer.clear(); //CLEAR THE GODDAMN BUFFER!!!!
file->resize(0);
//reconnect since deleting reply disconnects all slots
QObject::connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot()));
QObject::connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(errorSlot(QNetworkReply::NetworkError)));
QObject::connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(progressSlot(qint64, qint64)));
}
else {
//all ok
emit sendInfo("Downloader exiting with no errors");
//Read whatever is left
tmpBuffer.append(reply->readAll());
file->write(tmpBuffer);
file->close();
emit sendInfo("Handing off work to updater");
emit finisheddl();
}
}
else {
if (!erroremitted) {
emit sendInfo("Network err code: "+reply->errorString());
erroremitted=true;
emit finisheddl();
}
}
}
开发者ID:cen1,项目名称:xpam-client,代码行数:45,代码来源:downloader.cpp
示例17: QUrl
void LoginWindow::doSignIn(QString username,QString password)
{
if(loginInProgress)
return;
if (!username.isEmpty() && !password.isEmpty())
{
QUrl m_loginUrl = QUrl ( QString(Constants::LOGIN_PATH) +
"u=" + username + "&p=" + password );
reply = manager.get(QNetworkRequest(m_loginUrl));
connect(reply, SIGNAL(finished()),
this, SLOT(httpFinished()));
connect(reply, SIGNAL(readyRead()),
this, SLOT(httpReadyRead()));
connect(reply, SIGNAL(downloadProgress(qint64,qint64)),
this, SLOT(updateProgress(qint64,qint64)));
}
}
开发者ID:lotux,项目名称:MediaPort,代码行数:19,代码来源:loginwindow.cpp
示例18: switch
int HttpCommunicator::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: finishedRequest(); break;
case 1: finishedSlot((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break;
case 2: downloadProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break;
case 3: uploadProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break;
case 4: downloadReadyRead(); break;
case 5: construct2(); break;
default: ;
}
_id -= 6;
}
return _id;
}
开发者ID:kmdarshan,项目名称:qt-based-project,代码行数:19,代码来源:moc_httpcommunicator.cpp
示例19: qInfo
void Downloader::doHttpRequest(QString url){
QNetworkRequest request;
request.setUrl(QUrl(url));
request.setRawHeader( "User-Agent" , "Mozilla Firefox" ); // :) Probabilly is not really need!
qInfo() << endl << "Starting http request to" << url;
reply.reset( httpClient.get(request));
if(reply->error() != QNetworkReply::NoError){
throw std::runtime_error(reply->errorString().toStdString());
}
connect(reply.data(), SIGNAL(finished()), this, SIGNAL(downloadFinished()));
connect(reply.data(), SIGNAL(downloadProgress(qint64,qint64)), this, SIGNAL(downloadProgressed(qint64,qint64)));
connect(reply.data(), SIGNAL(readyRead()), this, SLOT(bytesAvailable()));
connect(reply.data(), SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(replyError(QNetworkReply::NetworkError)));
emit downloadStarted();
}
开发者ID:CassianoViana,项目名称:JamTaba,代码行数:19,代码来源:Downloader.cpp
示例20: finished
void ReplyFetcher::start(QNetworkAccessManager *nam, QNetworkRequest request, QByteArray postData)
{
httpStatusCode_= 0;
errorText_.clear();
receivedData_.clear();
success_ = true; // not in finished() signal handler, it might be not called according to the docs
// besides, I've added timeout feature
lastNetworkTime_ = QDateTime::currentMSecsSinceEpoch();
ticker_->start(1000);
if(postData.isNull()) {
reply = QSharedPointer<QNetworkReply>(nam->get(request), &QObject::deleteLater);
} else {
reply = QSharedPointer<QNetworkReply>(nam->post(request, postData), &QObject::deleteLater);
}
connect(reply.data(), SIGNAL(finished()), this, SLOT(onFinished()));
connect(reply.data(), SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onError()));
connect(reply.data(), SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(onSslErrors(QList<QSslError>)));
connect(reply.data(), SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(onDownloadProgress(qint64,qint64)));
}
开发者ID:mgsxx,项目名称:QEverCloudGenerator,代码行数:19,代码来源:http.cpp
注:本文中的downloadProgress函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论