Browse Source

- Optimized transfer list refresh

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
3827a66a3a
  1. 13
      src/transferlistwidget.cpp

13
src/transferlistwidget.cpp

@ -300,7 +300,7 @@ int TransferListWidget::updateTorrent(int row) {
s = STATE_CHECKING_UP; s = STATE_CHECKING_UP;
else else
s = STATE_CHECKING_DL; 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)); listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)-1));
//setRowColor(row, QString::fromUtf8("grey")); //setRowColor(row, QString::fromUtf8("grey"));
break; break;
@ -317,23 +317,20 @@ int TransferListWidget::updateTorrent(int row) {
s = STATE_STALLED_DL; s = STATE_STALLED_DL;
//setRowColor(row, QApplication::palette().color(QPalette::WindowText)); //setRowColor(row, QApplication::palette().color(QPalette::WindowText));
} }
listModel->setData(listModel->index(row, TR_STATUS), s); listModel->setData(listModel->index(row, TR_DLSPEED), QVariant((double)h.download_payload_rate()));
listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)h.upload_payload_rate())); listModel->setData(listModel->index(row, TR_PROGRESS), QVariant((double)h.progress()));
break; break;
case torrent_status::finished: case torrent_status::finished:
case torrent_status::seeding: 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) { if(h.upload_payload_rate() > 0) {
s = STATE_SEEDING; s = STATE_SEEDING;
} else { } else {
s = STATE_STALLED_UP; s = STATE_STALLED_UP;
} }
listModel->setData(listModel->index(row, TR_STATUS), s);
} }
// Common to both downloads and uploads // Common to both downloads and uploads
listModel->setData(listModel->index(row, TR_PROGRESS), QVariant((double)h.progress())); listModel->setData(listModel->index(row, TR_STATUS), s);
listModel->setData(listModel->index(row, TR_DLSPEED), QVariant((double)h.download_payload_rate())); 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+total_seeds*10 (if total_seeds is available)
// Connected_seeds*100000+1 (if total_seeds is unavailable) // Connected_seeds*100000+1 (if total_seeds is unavailable)
qulonglong seeds = h.num_seeds()*1000000; qulonglong seeds = h.num_seeds()*1000000;

Loading…
Cancel
Save