mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-08 07:09:21 +00:00
Peer info properly displays data, added parse.* with escape_string(...).
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@261 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -2,13 +2,17 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "core/download.h"
|
||||
|
||||
#include "parse.h"
|
||||
#include "canvas.h"
|
||||
#include "window_peer_info.h"
|
||||
|
||||
namespace display {
|
||||
|
||||
WindowPeerInfo::WindowPeerInfo(PList* l, PList::iterator* f) :
|
||||
WindowPeerInfo::WindowPeerInfo(core::Download* d, PList* l, PList::iterator* f) :
|
||||
Window(new Canvas, true),
|
||||
m_download(d),
|
||||
m_list(l),
|
||||
m_focus(f) {
|
||||
}
|
||||
@@ -21,12 +25,29 @@ WindowPeerInfo::redraw() {
|
||||
m_lastDraw = Timer::cache();
|
||||
m_canvas->erase();
|
||||
|
||||
int y = 0;
|
||||
|
||||
m_canvas->print(0, y++, "Hash: %s", escape_string(m_download->get_download().get_hash()).c_str());
|
||||
m_canvas->print(0, y++, "Chunks: %u / %u * %u",
|
||||
m_download->get_download().get_chunks_done(),
|
||||
m_download->get_download().get_chunks_total(),
|
||||
m_download->get_download().get_chunks_size());
|
||||
|
||||
if (*m_focus == m_list->end())
|
||||
mvprintw(0, 0, "No focus");
|
||||
else
|
||||
mvprintw(0, 0, "Focus on: %s:%i",
|
||||
(*m_focus)->get_dns().c_str(),
|
||||
(*m_focus)->get_port());
|
||||
return;
|
||||
|
||||
y++;
|
||||
|
||||
m_canvas->print(0, y++, "DNS: %s:%hu", (*m_focus)->get_dns().c_str(), (*m_focus)->get_port());
|
||||
m_canvas->print(0, y++, "Id: %s" , 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%", (*m_focus)->get_chunks_done());
|
||||
|
||||
m_canvas->print(0, y++, "Rate: %5.1f/%5.1f KB Total: %.1f/%.1f MB",
|
||||
(double)(*m_focus)->get_rate_up() / (double)(1 << 10),
|
||||
(double)(*m_focus)->get_rate_down() / (double)(1 << 10),
|
||||
(double)(*m_focus)->get_transfered_up() / (double)(1 << 20),
|
||||
(double)(*m_focus)->get_transfered_down() / (double)(1 << 20));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
|
||||
#include "window.h"
|
||||
|
||||
namespace core {
|
||||
class Download;
|
||||
}
|
||||
|
||||
namespace display {
|
||||
|
||||
class WindowPeerInfo : public Window {
|
||||
@@ -14,13 +18,15 @@ public:
|
||||
typedef std::list<torrent::Peer> PList;
|
||||
typedef sigc::slot0<uint32_t> SlotChunksTotal;
|
||||
|
||||
WindowPeerInfo(PList* l, PList::iterator* f);
|
||||
WindowPeerInfo(core::Download* d, PList* l, PList::iterator* f);
|
||||
|
||||
void slot_chunks_total(SlotChunksTotal s) { m_slotChunksTotal = s; }
|
||||
|
||||
virtual void redraw();
|
||||
|
||||
private:
|
||||
core::Download* m_download;
|
||||
|
||||
PList* m_list;
|
||||
PList::iterator* m_focus;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user