From c03e0def25a0cb89f5fbdfd7b6ae6d90d24e51b9 Mon Sep 17 00:00:00 2001 From: Veloman Yunkan Date: Mon, 12 Feb 2024 16:48:19 +0400 Subject: [PATCH] Changed the parameter type --- src/rownode.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/rownode.cpp b/src/rownode.cpp index 6a0cf12ff..57ce5ac4a 100644 --- a/src/rownode.cpp +++ b/src/rownode.cpp @@ -10,11 +10,10 @@ namespace { -QString convertToUnits(QString size) +QString convertToUnits(double bytes) { QStringList units = {"bytes", "KB", "MB", "GB", "TB", "PB", "EB"}; int unitIndex = 0; - auto bytes = size.toDouble(); while (bytes >= 1024 && unitIndex < units.size()) { bytes /= 1024; unitIndex++; @@ -31,8 +30,8 @@ void DownloadState::update(const DownloadInfo& downloadInfos) double percent = downloadInfos["completedLength"].toDouble() / downloadInfos["totalLength"].toDouble(); percent *= 100; percent = QString::number(percent, 'g', 3).toDouble(); - auto completedLength = convertToUnits(downloadInfos["completedLength"].toString()); - auto downloadSpeed = convertToUnits(downloadInfos["downloadSpeed"].toString()) + "/s"; + auto completedLength = convertToUnits(downloadInfos["completedLength"].toDouble()); + auto downloadSpeed = convertToUnits(downloadInfos["downloadSpeed"].toDouble()) + "/s"; *this = {percent, completedLength, downloadSpeed, false}; }