void NetworkTimeouts::AddReply(QNetworkReply* reply) { if (timers_.contains(reply)) return; connect(reply, SIGNAL(destroyed()), SLOT(ReplyFinished())); connect(reply, SIGNAL(finished()), SLOT(ReplyFinished())); timers_[reply] = startTimer(timeout_msec_); }
void SpotifyBlobDownloader::Start() { qDeleteAll(replies_); replies_.clear(); const QStringList filenames = QStringList() << "blob" << "blob" + QString(kSignatureSuffix) << "libspotify.so.12.1.45" << "libspotify.so.12.1.45" + QString(kSignatureSuffix); for (const QString& filename : filenames) { const QUrl url(SpotifyService::kBlobDownloadUrl + version_ + "/" + filename); qLog(Info) << "Downloading" << url; QNetworkReply* reply = network_->get(QNetworkRequest(url)); connect(reply, SIGNAL(finished()), SLOT(ReplyFinished())); connect(reply, SIGNAL(downloadProgress(qint64, qint64)), SLOT(ReplyProgress())); replies_ << reply; } progress_->show(); }
void RedirectFollower::ConnectReply(QNetworkReply* reply) { connect(reply, SIGNAL(readyRead()), SLOT(ReadyRead())); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SIGNAL(error(QNetworkReply::NetworkError))); connect(reply, SIGNAL(downloadProgress(qint64, qint64)), SIGNAL(downloadProgress(qint64, qint64))); connect(reply, SIGNAL(uploadProgress(qint64, qint64)), SIGNAL(uploadProgress(qint64, qint64))); connect(reply, SIGNAL(finished()), SLOT(ReplyFinished())); }
void ResCalc::reqPrepare(bool correction) { TServer srv = settings.server.at(ui->serverName->currentIndex()); QByteArray reqUrl; reqUrl.append(srv.url); reqUrl.append("/web/rpc/flash.php?interface=TownInterface&method=getDetails"); QString url(reqUrl); QNetworkRequest req(url); req.setRawHeader("Content-Type","application/json"); req.setRawHeader("User-Agent",srv.userAgent); req.setRawHeader("Cookie", srv.cookie); QByteArray strForHash; strForHash.append("[\""); strForHash.append(srv.townId); strForHash.append("\"]"); QByteArray hash; hash = QCryptographicHash::hash ((strForHash),QCryptographicHash::Md5).toHex(); QByteArray post("{\"parameters\":"); post.append(strForHash); post.append(",\"client\":1,\"hash\":\""); post.append(hash); post.append("\",\"checksum\":\""); post.append(srv.checkSum); post.append("\"}"); reply = mgr->post(req, post); connect(reply, SIGNAL(finished()),this, SLOT(ReplyFinished())); if(correction) { ui->log->append("Синхронизация времени."); connect(reply, SIGNAL(readChannelFinished()), this, SLOT(ReadyReadFirstReply())); } else { connect(reply, SIGNAL(readChannelFinished()), this, SLOT(ReadyReadReply())); } }