X-Git-Url: https://gitweb.stoutner.com/?a=blobdiff_plain;f=src%2Fwidgets%2FTabWidget.cpp;h=5ef7fc5aa5c36e1513c3b25bbc53dde44512dcc6;hb=95aa7dff6f4da3aa85775d46600f9be2e2f856eb;hp=5b5a08c630cbae3985ef41b42711d6ba88459bef;hpb=93a1583163ca580a2218ba81836a17c3a6586ccf;p=PrivacyBrowserPC.git diff --git a/src/widgets/TabWidget.cpp b/src/widgets/TabWidget.cpp index 5b5a08c..5ef7fc5 100644 --- a/src/widgets/TabWidget.cpp +++ b/src/widgets/TabWidget.cpp @@ -985,15 +985,21 @@ void TabWidget::showSaveDialog(QWebEngineDownloadItem *webEngineDownloadItemPoin // Update the notification when the download progresses. connect(webEngineDownloadItemPointer, &QWebEngineDownloadItem::downloadProgress, [fileDownloadNotificationPointer, saveFileName] (qint64 bytesReceived, qint64 totalBytes) { - // Calculate the download percentage. - int downloadPercentage = 100 * bytesReceived / totalBytes; - // Set the new text. Total bytes will be 0 if the download size is unknown. if (totalBytes > 0) + { + // Calculate the download percentage. + int downloadPercentage = 100 * bytesReceived / totalBytes; + + // Set the file download notification text. fileDownloadNotificationPointer->setText(i18nc("Download progress notification text", "%1\% of %2 downloaded (%3 of %4 bytes)", downloadPercentage, saveFileName, bytesReceived, totalBytes)); + } else + { + // Set the file download notification text. fileDownloadNotificationPointer->setText(i18nc("Download progress notification text", "%1: %2 bytes downloaded", saveFileName, bytesReceived)); + } // Display the updated notification. fileDownloadNotificationPointer->update();