From 3827a66a3ac26aa06f8bc2f264c1c5120f8d95b2 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 21 Nov 2009 14:42:58 +0000 Subject: [PATCH] - Optimized transfer list refresh --- src/transferlistwidget.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index a7997d741..885897994 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -300,7 +300,7 @@ int TransferListWidget::updateTorrent(int row) { s = STATE_CHECKING_UP; else s = STATE_CHECKING_DL; - listModel->setData(listModel->index(row, TR_STATUS), s); + listModel->setData(listModel->index(row, TR_PROGRESS), QVariant((double)h.progress())); listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)-1)); //setRowColor(row, QString::fromUtf8("grey")); break; @@ -317,23 +317,20 @@ int TransferListWidget::updateTorrent(int row) { s = STATE_STALLED_DL; //setRowColor(row, QApplication::palette().color(QPalette::WindowText)); } - listModel->setData(listModel->index(row, TR_STATUS), s); - listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)h.upload_payload_rate())); + listModel->setData(listModel->index(row, TR_DLSPEED), QVariant((double)h.download_payload_rate())); + listModel->setData(listModel->index(row, TR_PROGRESS), QVariant((double)h.progress())); break; case torrent_status::finished: case torrent_status::seeding: - listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)-1)); - listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)h.upload_payload_rate())); if(h.upload_payload_rate() > 0) { s = STATE_SEEDING; } else { s = STATE_STALLED_UP; } - listModel->setData(listModel->index(row, TR_STATUS), s); } // Common to both downloads and uploads - listModel->setData(listModel->index(row, TR_PROGRESS), QVariant((double)h.progress())); - listModel->setData(listModel->index(row, TR_DLSPEED), QVariant((double)h.download_payload_rate())); + listModel->setData(listModel->index(row, TR_STATUS), s); + listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)h.upload_payload_rate())); // Connected_seeds*100000+total_seeds*10 (if total_seeds is available) // Connected_seeds*100000+1 (if total_seeds is unavailable) qulonglong seeds = h.num_seeds()*1000000;