From 156f88d8559be50a6b7834e08f0adb9a04f925bb Mon Sep 17 00:00:00 2001 From: Robert Krajewski Date: Sun, 3 Feb 2019 17:57:00 +0100 Subject: [PATCH] Fix minor problems with FileDownloader - Add debug message at beginning of each download - Fix index of current downloaded files in dialoge - Use api file size, if downloader header doesn't provide content-length --- src/filedownloader.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/filedownloader.cpp b/src/filedownloader.cpp index 1a507d4..3b7721a 100644 --- a/src/filedownloader.cpp +++ b/src/filedownloader.cpp @@ -46,8 +46,10 @@ FileDownloader::~FileDownloader() int FileDownloader::startNextDownload(QString fileName, QString courseName, QString filePath, QUrl fileUrl, int itemNummer, int itemSize, int time) { + QLOG_DEBUG() << tr("Starte Download von") << fileUrl.url(); + // Anpassen der Labels - ui->progressLabel->setText(QString("Datei %1/%2").arg(itemNummer).arg(itemNumber)); + ui->progressLabel->setText(QString("Datei %1/%2").arg(itemNummer+1).arg(itemNumber)); ui->veranstaltungLabel->setText(courseName); ui->dateinameLabel->setText(fileName); ui->progressBar->setFormat( "0 Byte / " % QString::number(correctSize(itemSize),'f',2) % " " % correctUnit(itemSize)); @@ -86,6 +88,8 @@ void FileDownloader::downloadProgressSlot(qint64 bytesReceived, qint64 bytesTota (void) bytesTotal; // Aktualisieren der Progressbar anhand der Größe der empfangenen Bytes + if (bytesTotal == -1) + bytesTotal = ui->progressBar->maximum(); ui->progressBar->setFormat( QString::number(correctSize(bytesReceived),'f',2) % " " % correctUnit( bytesReceived ) % " / " %