Ejemplo n.º 1
0
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_);
}
Ejemplo n.º 2
0
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();
}
Ejemplo n.º 3
0
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()));
}
Ejemplo n.º 4
0
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()));
  }
}