Browse Source

- Progress calculation patch

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
1aedd97d4d
  1. 2
      src/FinishedTorrents.cpp
  2. 2
      src/qtorrenthandle.cpp

2
src/FinishedTorrents.cpp

@ -267,7 +267,7 @@ void FinishedTorrents::updateFinishedList(){ @@ -267,7 +267,7 @@ void FinishedTorrents::updateFinishedList(){
if (reponse == QMessageBox::Yes) {
qDebug("Info: a torrent was moved from finished to download tab");
deleteTorrent(hash);
BTSession->setFinishedTorrent(hash);
BTSession->setUnfinishedTorrent(hash);
emit torrentMovedFromFinishedList(hash);
}
else if (reponse == QMessageBox::No) {

2
src/qtorrenthandle.cpp

@ -57,6 +57,8 @@ float QTorrentHandle::progress() const { @@ -57,6 +57,8 @@ float QTorrentHandle::progress() const {
Q_ASSERT(h.is_valid());
if(!h.status().total_wanted)
return 0.;
if (h.status().total_wanted_done == h.status().total_wanted)
return 1.;
float progress = (float)h.status().total_wanted_done/(float)h.status().total_wanted;
Q_ASSERT(progress >= 0. && progress <= 1.);
return progress;

Loading…
Cancel
Save