Summary: | File size info for large files (>1GB) shows too few digits | ||
---|---|---|---|
Product: | [Applications] kmldonkey | Reporter: | Henk de Leeuw <bugs.kde.org> |
Component: | general | Assignee: | Petter Stokke <ummo> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | ||
Priority: | NOR | ||
Version: | 0.9.1 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
Henk de Leeuw
2004-01-27 22:37:47 UTC
Subject: kdeextragear-2/kmldonkey/kmldonkey CVS commit by pstokke: Use higher precision when displaying gigabytes if there's room available. Thanks to Henk de Leeuw for the idea. CCMAIL: 73643-done@bugs.kde.org M +16 -10 infolist.cpp 1.19 --- kdeextragear-2/kmldonkey/kmldonkey/infolist.cpp #1.18:1.19 @@ -226,12 +226,18 @@ QString humanReadableSize(int64 rsz) if (KMLDonkey::App->humanReadableSizes) { - if (sz >= (double)(1024 * 1024 * 1024)) { - sz = sz / (1024 * 1024 * 1024); + if (sz >= (100.0 * 1024.0 * 1024.0 * 1024.0)) { + sz = sz / (1024.0 * 1024.0 * 1024.0); foo = i18n("gigabyte suffix", "%1G").arg(KGlobal::locale()->formatNumber(sz, 1)); - } else if (sz >= (double)(1024 * 1024)) { - sz = sz / (1024 * 1024); + } else if (sz >= (10.0 * 1024.0 * 1024.0 * 1024.0)) { + sz = sz / (1024.0 * 1024.0 * 1024.0); + foo = i18n("gigabyte suffix", "%1G").arg(KGlobal::locale()->formatNumber(sz, 2)); + } else if (sz >= (1024.0 * 1024.0 * 1024.0)) { + sz = sz / (1024.0 * 1024.0 * 1024.0); + foo = i18n("gigabyte suffix", "%1G").arg(KGlobal::locale()->formatNumber(sz, 3)); + } else if (sz >= (1024.0 * 1024.0)) { + sz = sz / (1024.0 * 1024.0); foo = i18n("megabyte suffix", "%1M").arg(KGlobal::locale()->formatNumber(sz, 1)); - } else if (sz >= (double)1024) { - sz = sz / 1024; + } else if (sz >= 1024.0) { + sz = sz / 1024.0; foo = i18n("kilobyte suffix", "%1K").arg(KGlobal::locale()->formatNumber(sz, 1)); } else foo = KGlobal::locale()->formatNumber(sz, 0); |