MCPcopy Create free account
hub / github.com/OneMoreGres/ScreenTranslator / start

Method start

src/service/updates.cpp:538–565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536}
537
538void Loader::start(const Urls &urls, const QUrl &previous, const QString &error)
539{
540 if (!error.isEmpty())
541 qCritical() << error;
542
543 if (urls.isEmpty()) {
544 if (!previous.isEmpty())
545 updater_.downloadFailed(previous, error);
546 return;
547 }
548
549 auto leftUrls = urls;
550 const auto current = leftUrls.takeFirst();
551 auto reply = network_->get(QNetworkRequest(current));
552 downloads_.insert(reply, leftUrls);
553
554 connect(reply, &QNetworkReply::downloadProgress, //
555 this, [this, current](qint64 bytesSent, qint64 bytesTotal) {
556 updater_.updateProgress(current, bytesSent, bytesTotal);
557 });
558
559 if (reply->error() == QNetworkReply::NoError) {
560 updater_.updateProgress(current, -1, -1);
561 return;
562 }
563
564 handleReply(reply);
565}
566
567void Loader::handleReply(QNetworkReply *reply)
568{

Callers 4

setIconMethod · 0.45
scheduleNextCheckMethod · 0.45
RecognizerMethod · 0.45
CorrectorMethod · 0.45

Calls 2

downloadFailedMethod · 0.80
updateProgressMethod · 0.80

Tested by

no test coverage detected