From c4ce2a2549285c653caf7c94a19fb111986daea5 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 24 Jan 2010 18:06:51 +0000 Subject: [PATCH] Improved user friendlyness of size units (Use 1KiB/s instead of 1024B/s) Optimized transfer list repainting --- src/misc.h | 2 +- src/transferlistwidget.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/misc.h b/src/misc.h index 5e998918d..56264dbf5 100644 --- a/src/misc.h +++ b/src/misc.h @@ -364,7 +364,7 @@ public: return tr("Unknown", "Unknown (size)"); const QString units[5] = {tr("B", "bytes"), tr("KiB", "kibibytes (1024 bytes)"), tr("MiB", "mebibytes (1024 kibibytes)"), tr("GiB", "gibibytes (1024 mibibytes)"), tr("TiB", "tebibytes (1024 gibibytes)")}; char i = 0; - while(val > 1024. && i++<6) + while(val >= 1024. && i++<6) val /= 1024.; return QString(QByteArray::number(val, 'f', 1)) + " " + units[(int)i]; } diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index e82926b6b..1afffa979 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -443,6 +443,8 @@ void TransferListWidget::setRefreshInterval(int t) { } void TransferListWidget::refreshList() { + // Stop updating the display + setUpdatesEnabled(false); // Refresh only if displayed if(main_window->getCurrentTabIndex() != TAB_TRANSFER) return; unsigned int nb_downloading = 0, nb_seeding=0, nb_active=0, nb_inactive = 0; @@ -498,6 +500,8 @@ void TransferListWidget::refreshList() { } // Update status filters counters emit torrentStatusUpdate(nb_downloading, nb_seeding, nb_active, nb_inactive); + // Start updating the display + setUpdatesEnabled(true); } int TransferListWidget::getRowFromHash(QString hash) const{