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;
}
}
+2
View File
@@ -21,6 +21,8 @@ public:
virtual void redraw();
private:
int done_percentage(torrent::Peer& p);
core::Download* m_download;
PList* m_list;
+8 -1
View File
@@ -98,7 +98,7 @@ WindowPeerList::redraw() {
itr->get_incoming_queue_size());
x += 6;
m_canvas->print(x, y, "%3i", (itr->get_chunks_done() * 100) / m_download->get_download().get_chunks_total());
m_canvas->print(x, y, "%3i", done_percentage(*itr));
x += 6;
if (itr->get_incoming_queue_size())
@@ -115,4 +115,11 @@ WindowPeerList::redraw() {
}
}
int
WindowPeerList::done_percentage(torrent::Peer& p) {
int chunks = m_download->get_download().get_chunks_total();
return chunks ? (100 * p.get_chunks_done()) / chunks : 0;
}
}
+2
View File
@@ -21,6 +21,8 @@ public:
virtual void redraw();
private:
int done_percentage(torrent::Peer& p);
core::Download* m_download;
PList* m_list;