Fixed bug in display code for peer percentage progress.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@325 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-03-05 02:20:45 +00:00
parent c15d840962
commit 2dc7ffdb8f
7 changed files with 25 additions and 17 deletions
+8 -1
View File
@@ -43,7 +43,7 @@ WindowPeerInfo::redraw() {
m_canvas->print(0, y++, "Id: %s" , utils::escape_string((*m_focus)->get_id()).c_str());
m_canvas->print(0, y++, "Snubbed: %s", (*m_focus)->get_snubbed() ? "Yes" : "No");
m_canvas->print(0, y++, "Done: %i%", d.get_chunks_total() ? (*m_focus)->get_chunks_done() / d.get_chunks_total() : 0);
m_canvas->print(0, y++, "Done: %i%", done_percentage(**m_focus));
m_canvas->print(0, y++, "Rate: %5.1f/%5.1f KB Total: %.1f/%.1f MB",
(double)(*m_focus)->get_rate_up() / (double)(1 << 10),
@@ -52,4 +52,11 @@ WindowPeerInfo::redraw() {
(double)(*m_focus)->get_transfered_down() / (double)(1 << 20));
}
int
WindowPeerInfo::done_percentage(torrent::Peer& p) {
int chunks = m_download->get_download().get_chunks_total();
return chunks ? (100 * p.get_chunks_done()) / chunks : 0;
}
}