Browse Source

- Display a ratio of 0.0 if total_upload and total_download are both 0

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
b7c7245fb5
  1. 2
      src/bittorrent.cpp
  2. 1
      src/downloadingTorrents.cpp

2
src/bittorrent.cpp

@ -775,6 +775,8 @@ float bittorrent::getRealRatio(QString hash) const{ @@ -775,6 +775,8 @@ float bittorrent::getRealRatio(QString hash) const{
Q_ASSERT(h.all_time_download() >= 0);
Q_ASSERT(h.all_time_upload() >= 0);
if(h.all_time_download() == 0) {
if(h.all_time_upload() == 0)
return 0;
return 101;
}
float ratio = (float)h.all_time_upload()/(float)h.all_time_download();

1
src/downloadingTorrents.cpp

@ -583,6 +583,7 @@ void DownloadingTorrents::addTorrent(QString hash) { @@ -583,6 +583,7 @@ void DownloadingTorrents::addTorrent(QString hash) {
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.));
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant(QString::fromUtf8("0/0")));
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)h.progress()));
DLListModel->setData(DLListModel->index(row, RATIO), QVariant((double)0.));
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1));
if(BTSession->isQueueingEnabled())
DLListModel->setData(DLListModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(hash)));

Loading…
Cancel
Save