mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 06:02:31 +00:00
Work on peer info display.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@260 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -9,6 +9,8 @@ libsub_display_a_SOURCES = \
|
||||
window.h \
|
||||
window_download_list.cc \
|
||||
window_download_list.h \
|
||||
window_peer_info.cc \
|
||||
window_peer_info.h \
|
||||
window_peer_list.cc \
|
||||
window_peer_list.h \
|
||||
window_statusbar.cc \
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "canvas.h"
|
||||
#include "window_peer_info.h"
|
||||
|
||||
namespace display {
|
||||
|
||||
WindowPeerInfo::WindowPeerInfo(PList* l, PList::iterator* f) :
|
||||
Window(new Canvas, true),
|
||||
m_list(l),
|
||||
m_focus(f) {
|
||||
}
|
||||
|
||||
void
|
||||
WindowPeerInfo::redraw() {
|
||||
if (Timer::cache() - m_lastDraw < 1000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
m_canvas->erase();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef RTORRENT_DISPLAY_PEER_INFO_H
|
||||
#define RTORRENT_DISPLAY_PEER_INFO_H
|
||||
|
||||
#include <list>
|
||||
#include <sigc++/slot.h>
|
||||
#include <torrent/peer.h>
|
||||
|
||||
#include "window.h"
|
||||
|
||||
namespace display {
|
||||
|
||||
class WindowPeerInfo : public Window {
|
||||
public:
|
||||
typedef std::list<torrent::Peer> PList;
|
||||
typedef sigc::slot0<uint32_t> SlotChunksTotal;
|
||||
|
||||
WindowPeerInfo(PList* l, PList::iterator* f);
|
||||
|
||||
void slot_chunks_total(SlotChunksTotal s) { m_slotChunksTotal = s; }
|
||||
|
||||
virtual void redraw();
|
||||
|
||||
private:
|
||||
PList* m_list;
|
||||
PList::iterator* m_focus;
|
||||
|
||||
SlotChunksTotal m_slotChunksTotal;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -14,6 +14,8 @@ WindowStatusbar::WindowStatusbar() :
|
||||
|
||||
void
|
||||
WindowStatusbar::redraw() {
|
||||
m_counter++;
|
||||
|
||||
if (Timer::cache() - m_lastDraw < 10000000)
|
||||
return;
|
||||
|
||||
@@ -25,7 +27,7 @@ WindowStatusbar::redraw() {
|
||||
"",
|
||||
(int)torrent::get(torrent::LISTEN_PORT),
|
||||
(int)torrent::get(torrent::HANDSHAKES_TOTAL),
|
||||
++m_counter);
|
||||
m_counter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user