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

This commit is contained in:
Christophe Dumez
2009-07-12 08:26:01 +00:00
parent 935de375b9
commit 7f3832a73d
3 changed files with 5 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
- BUGFIX: Cleanly fixed popup menus position in lists (no more workarounds) - BUGFIX: Cleanly fixed popup menus position in lists (no more workarounds)
- BUGFIX: Fixed memory leak in search engine - BUGFIX: Fixed memory leak in search engine
- BUGFIX: Torrents with an infinite ratio are no longer affected by ratio_limit set in program preferences - BUGFIX: Torrents with an infinite ratio are no longer affected by ratio_limit set in program preferences
- BUGFIX: Display a ratio of 0.0 if total_upload and total_download are both 0
* Sun Apr 5 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.3 * Sun Apr 5 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.3.3
- BUGFIX: Fixed Web UI torrent upload form - BUGFIX: Fixed Web UI torrent upload form

View File

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

View File

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