Version: 0.9.1 (using KDE KDE 3.2.0) OS: Linux When displaying Size and Downloaded, only one digit after the decimal point is printed, even when there is room for more. E.g. instead of 1.1G, I would like to see 1.134G, so I can monitor progress better. Patch to accomplish this: --- infolist.old.cpp 2004-01-27 20:22:27.000000000 +0100 +++ infolist.cpp 2004-01-27 21:54:13.760975192 +0100 @@ -185,9 +185,15 @@ { QString foo; double sz = (double)rsz; - if (sz >= (double)(1024 * 1024 * 1024)) { + if (sz >= (100.0 * 1024.0 * 1024.0 * 1024.0)) { sz = sz / (1024 * 1024 * 1024); foo.sprintf(i18n("%.1fG"), sz); + } else if (sz >= (10.0 * 1024.0 * 1024.0 * 1024.0)) { + sz = sz / (1024 * 1024 * 1024); + foo.sprintf(i18n("%.2fG"), sz); + } else if (sz >= (1024.0 * 1024.0 * 1024.0)) { + sz = sz / (1024 * 1024 * 1024); + foo.sprintf(i18n("%.3fG"), sz); } else if (sz >= (double)(1024 * 1024)) { sz = sz / (1024 * 1024); foo.sprintf(i18n("%.1fM"), sz);
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);