mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 13:12:32 +00:00
Focus iterators moved out of Window*.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@254 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -14,6 +14,8 @@ public:
|
||||
virtual ~Window() {}
|
||||
|
||||
bool is_dynamic() { return m_dynamic; }
|
||||
bool is_dirty() { return m_lastDraw == 0; }
|
||||
|
||||
int get_min_height() { return m_minHeight; }
|
||||
|
||||
void refresh();
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
|
||||
namespace display {
|
||||
|
||||
WindowDownloadList::WindowDownloadList(DList* d) :
|
||||
WindowDownloadList::WindowDownloadList(DList* l, DList::iterator* f) :
|
||||
Window(new Canvas, true),
|
||||
m_downloads(d) {
|
||||
|
||||
if (m_downloads)
|
||||
m_focus = m_downloads->end();
|
||||
m_list(l),
|
||||
m_focus(f) {
|
||||
}
|
||||
|
||||
void
|
||||
@@ -26,14 +24,14 @@ WindowDownloadList::redraw() {
|
||||
|
||||
// Remember to check for end of screen too.
|
||||
|
||||
for (DList::iterator itr = m_downloads->begin(); itr != m_downloads->end(); ++itr) {
|
||||
for (DList::iterator itr = m_list->begin(); itr != m_list->end(); ++itr) {
|
||||
m_canvas->print(0, pos++, "%c %s",
|
||||
itr == m_focus ? '*' : ' ',
|
||||
itr == *m_focus ? '*' : ' ',
|
||||
itr->get_download().get_name().c_str());
|
||||
|
||||
if (itr->get_download().get_chunks_done() != itr->get_download().get_chunks_total() || !itr->get_download().is_open())
|
||||
m_canvas->print(0, pos++, "%c Torrent: %.1f / %.1f MiB Rate:%5.1f /%5.1f KiB Uploaded: %.1f MiB",
|
||||
itr == m_focus ? '*' : ' ',
|
||||
itr == *m_focus ? '*' : ' ',
|
||||
(double)itr->get_download().get_bytes_done() / (double)(1 << 20),
|
||||
(double)itr->get_download().get_bytes_total() / (double)(1 << 20),
|
||||
(double)itr->get_download().get_rate_up() / 1024.0,
|
||||
@@ -42,14 +40,14 @@ WindowDownloadList::redraw() {
|
||||
|
||||
else
|
||||
m_canvas->print(0, pos++, "%c Torrent: Done %.1f MiB Rate:%5.1f /%5.1f KiB Uploaded: %.1f MiB",
|
||||
itr == m_focus ? '*' : ' ',
|
||||
itr == *m_focus ? '*' : ' ',
|
||||
(double)itr->get_download().get_bytes_total() / (double)(1 << 20),
|
||||
(double)itr->get_download().get_rate_up() / 1024.0,
|
||||
(double)itr->get_download().get_rate_down() / 1024.0,
|
||||
(double)itr->get_download().get_bytes_up() / (double)(1 << 20));
|
||||
|
||||
m_canvas->print(0, pos++, "%c Tracker: [%c:%i] %s",
|
||||
itr == m_focus ? '*' : ' ',
|
||||
itr == *m_focus ? '*' : ' ',
|
||||
itr->get_download().is_tracker_busy() ? 'C' : ' ',
|
||||
(int)(itr->get_download().get_tracker_timeout() / 1000000),
|
||||
"");
|
||||
|
||||
@@ -10,18 +10,13 @@ class WindowDownloadList : public Window {
|
||||
public:
|
||||
typedef core::DownloadList DList;
|
||||
|
||||
WindowDownloadList(DList* d);
|
||||
WindowDownloadList(DList* l, DList::iterator* focus);
|
||||
|
||||
DList& get_list() { return *m_downloads; }
|
||||
|
||||
DList::iterator get_focus() { return m_focus; }
|
||||
void set_focus(DList::iterator itr) { m_focus = itr; mark_dirty(); }
|
||||
|
||||
virtual void redraw();
|
||||
virtual void redraw();
|
||||
|
||||
private:
|
||||
DList* m_downloads;
|
||||
DList::iterator m_focus;
|
||||
DList* m_list;
|
||||
DList::iterator* m_focus;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
namespace display {
|
||||
|
||||
WindowPeerList::WindowPeerList(PList* l) :
|
||||
WindowPeerList::WindowPeerList(PList* l, PList::iterator* f) :
|
||||
Window(new Canvas, true),
|
||||
m_list(l),
|
||||
m_focus(l->end()) {
|
||||
m_focus(f) {
|
||||
}
|
||||
|
||||
void
|
||||
@@ -41,9 +41,9 @@ WindowPeerList::redraw() {
|
||||
|
||||
PList::iterator itr, last;
|
||||
|
||||
if (m_focus != m_list->end()) {
|
||||
if (*m_focus != m_list->end()) {
|
||||
int i = 0;
|
||||
itr = last = m_focus;
|
||||
itr = last = *m_focus;
|
||||
|
||||
while (i < m_canvas->get_height() - y && !(itr == m_list->begin() && last == m_list->end())) {
|
||||
if (itr != m_list->begin()) {
|
||||
@@ -71,7 +71,7 @@ WindowPeerList::redraw() {
|
||||
x = 0;
|
||||
|
||||
m_canvas->print(x, y, "%c %s",
|
||||
itr == m_focus ? '*' : ' ',
|
||||
itr == *m_focus ? '*' : ' ',
|
||||
itr->get_dns().c_str());
|
||||
x += 18;
|
||||
|
||||
|
||||
@@ -14,22 +14,17 @@ public:
|
||||
typedef std::list<torrent::Peer> PList;
|
||||
typedef sigc::slot0<uint32_t> SlotChunksTotal;
|
||||
|
||||
WindowPeerList(PList* l);
|
||||
WindowPeerList(PList* l, PList::iterator* f);
|
||||
|
||||
PList& get_list() { return *m_list; }
|
||||
void slot_chunks_total(SlotChunksTotal s) { m_slotChunksTotal = s; }
|
||||
|
||||
PList::iterator get_focus() { return m_focus; }
|
||||
void set_focus(PList::iterator itr) { m_focus = itr; mark_dirty(); }
|
||||
|
||||
void slot_chunks_total(SlotChunksTotal s) { m_slotChunksTotal = s; }
|
||||
|
||||
virtual void redraw();
|
||||
virtual void redraw();
|
||||
|
||||
private:
|
||||
PList* m_list;
|
||||
PList::iterator m_focus;
|
||||
PList* m_list;
|
||||
PList::iterator* m_focus;
|
||||
|
||||
SlotChunksTotal m_slotChunksTotal;
|
||||
SlotChunksTotal m_slotChunksTotal;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -14,8 +14,18 @@ WindowStatusbar::WindowStatusbar() :
|
||||
|
||||
void
|
||||
WindowStatusbar::redraw() {
|
||||
if (Timer::cache() - m_lastDraw < 10000000)
|
||||
return;
|
||||
|
||||
m_lastDraw = Timer::cache();
|
||||
|
||||
m_canvas->erase();
|
||||
m_canvas->print(0, 0, "Loop: %i", ++m_counter);
|
||||
m_canvas->print(0, 0, "Throttle: %i Listen: %s:%i Handshakes: %i Select: %u",
|
||||
(int)torrent::get(torrent::THROTTLE_ROOT_CONST_RATE) / 1024,
|
||||
"",
|
||||
(int)torrent::get(torrent::LISTEN_PORT),
|
||||
(int)torrent::get(torrent::HANDSHAKES_TOTAL),
|
||||
++m_counter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user