Utils: improve bytes formatting

This commit is contained in:
tobtoht 2020-12-24 13:20:44 +01:00
parent bd4400a7f2
commit 200f16ecf2
No known key found for this signature in database
GPG Key ID: 1CADD27F41F45C3C
1 changed files with 2 additions and 2 deletions

View File

@ -553,14 +553,14 @@ QString Utils::formatBytes(quint64 bytes)
int i;
double _data;
for (i = 0; i < sizes.count() && bytes >= 1000; i++, bytes /= 1000)
for (i = 0; i < sizes.count() && bytes >= 10000; i++, bytes /= 1000)
_data = bytes / 1000.0;
if (_data < 0)
_data = 0;
// unrealistic
if (_data > 1000)
if (_data > 10000)
_data = 0;
return QString("%1 %2").arg(QString::number(_data, 'f', 1), sizes[i]);