rtorrent: Polling http and torrent. Improved the download list.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@247 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-01-30 17:14:53 +00:00
parent b17dc37a3b
commit 3357b5caab
15 changed files with 212 additions and 116 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ libsub_display_a_SOURCES = \
manager.h \
window.cc \
window.h \
window_downloads.cc \
window_downloads.h
window_download_list.cc \
window_download_list.h
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)
+8
View File
@@ -35,6 +35,14 @@ public:
template <typename A1, typename A2>
void print(int x, int y, const char* str, A1 a1, A2 a2) { mvwprintw(m_window, y, x, str, a1, a2); }
template <typename A1, typename A2, typename A3>
void print(int x, int y, const char* str,
A1 a1, A2 a2, A3 a3) { mvwprintw(m_window, y, x, str, a1, a2, a3); }
template <typename A1, typename A2, typename A3, typename A4>
void print(int x, int y, const char* str,
A1 a1, A2 a2, A3 a3, A4 a4) { mvwprintw(m_window, y, x, str, a1, a2, a3, a4); }
void print_border(chtype ls, chtype rs,
chtype ts, chtype bs,
chtype tl, chtype tr,
+30
View File
@@ -0,0 +1,30 @@
#include "config.h"
#include "canvas.h"
#include "window_download_list.h"
#include "engine/download_list.h"
namespace display {
WindowDownloadList::WindowDownloadList(engine::DownloadList* d) :
Window(new Canvas, true),
m_downloads(d) {
}
void
WindowDownloadList::redraw() {
m_canvas->erase();
m_canvas->print_border(' ', ' ', '-', '-', ' ', ' ', ' ', ' ');
int pos = 1;
for (engine::DownloadList::iterator itr = m_downloads->begin(); itr != m_downloads->end(); ++itr, ++pos)
m_canvas->print(1, pos, "Download: %s Open: %c Tracker: %c Active: %c",
itr->get_download().get_name().c_str(),
itr->get_download().is_open() ? 'Y' : 'N',
itr->get_download().is_tracker_busy() ? 'Y' : 'N',
itr->get_download().is_active() ? 'Y' : 'N');
}
}
+24
View File
@@ -0,0 +1,24 @@
#ifndef RTORRENT_DISPLAY_WINDOW_DOWNLOAD_LIST_H
#define RTORRENT_DISPLAY_WINDOW_DOWNLOAD_LIST_H
#include "window.h"
namespace engine {
class DownloadList;
}
namespace display {
class WindowDownloadList : public Window {
public:
WindowDownloadList(engine::DownloadList* d);
virtual void redraw();
private:
engine::DownloadList* m_downloads;
};
}
#endif
-24
View File
@@ -1,24 +0,0 @@
#include "config.h"
#include "canvas.h"
#include "window_downloads.h"
namespace display {
WindowDownloads::WindowDownloads(engine::Downloads* d) :
Window(new Canvas, true),
m_downloads(d) {
}
void
WindowDownloads::redraw() {
m_canvas->erase();
m_canvas->print_border(' ', ' ', '-', '-', ' ', ' ', ' ', ' ');
int pos = 1;
for (engine::Downloads::iterator itr = m_downloads->begin(); itr != m_downloads->end(); ++itr, ++pos)
m_canvas->print(1, pos, "Download: %s", itr->get_name().c_str());
}
}
-21
View File
@@ -1,21 +0,0 @@
#ifndef RTORRENT_DISPLAY_WINDOW_DOWNLOADS_H
#define RTORRENT_DISPLAY_WINDOW_DOWNLOADS_H
#include "window.h"
#include "engine/downloads.h"
namespace display {
class WindowDownloads : public Window {
public:
WindowDownloads(engine::Downloads* d);
virtual void redraw();
private:
engine::Downloads* m_downloads;
};
}
#endif