mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-07 02:32:32 +00:00
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:
@@ -6,7 +6,4 @@ normal timeout.
|
||||
|
||||
Make clear distinction of upload/download throttle.
|
||||
|
||||
"Caught exception: "Tried to add an existing DownloadMain to DownloadManager""
|
||||
Properly handle duplicate torrents.
|
||||
|
||||
Add log message for failed http requests.
|
||||
Consider basing WindowPeer* on a common base class.
|
||||
|
||||
@@ -32,7 +32,7 @@ DownloadList::erase(iterator itr) {
|
||||
|
||||
void
|
||||
DownloadList::clear() {
|
||||
std::for_each(begin(), end(), func::call_delete());
|
||||
std::for_each(begin(), end(), func::call_delete<Download>());
|
||||
|
||||
Base::clear();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ public:
|
||||
virtual void redraw();
|
||||
|
||||
private:
|
||||
int done_percentage(torrent::Peer& p);
|
||||
|
||||
core::Download* m_download;
|
||||
|
||||
PList* m_list;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ public:
|
||||
virtual void redraw();
|
||||
|
||||
private:
|
||||
int done_percentage(torrent::Peer& p);
|
||||
|
||||
core::Download* m_download;
|
||||
|
||||
PList* m_list;
|
||||
|
||||
+3
-10
@@ -108,20 +108,13 @@ if_then(Cond c, Then t) {
|
||||
return _if_then<Cond, Then>(c, t);
|
||||
}
|
||||
|
||||
struct _call_delete
|
||||
: public std::unary_function<void, void> {
|
||||
|
||||
template <typename Type>
|
||||
void operator () (Type* t) {
|
||||
template <typename T>
|
||||
struct call_delete : public std::unary_function<T*, void> {
|
||||
void operator () (T* t) {
|
||||
delete t;
|
||||
}
|
||||
};
|
||||
|
||||
inline _call_delete
|
||||
call_delete() {
|
||||
return _call_delete();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user