Renamed engine to core.

Added focus to WindowDownloadList.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@249 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-01-31 17:59:16 +00:00
parent c3a4a7d554
commit cd9b014eb6
17 changed files with 107 additions and 47 deletions
+9 -8
View File
@@ -3,13 +3,14 @@
#include "canvas.h"
#include "window_download_list.h"
#include "engine/download_list.h"
namespace display {
WindowDownloadList::WindowDownloadList(engine::DownloadList* d) :
WindowDownloadList::WindowDownloadList(List* d) :
Window(new Canvas, true),
m_downloads(d) {
if (m_downloads)
m_focus = m_downloads->end();
}
void
@@ -21,14 +22,14 @@ WindowDownloadList::redraw() {
// Remember to check for end of screen too.
for (engine::DownloadList::iterator itr = m_downloads->begin(); itr != m_downloads->end(); ++itr) {
for (List::iterator itr = m_downloads->begin(); itr != m_downloads->end(); ++itr) {
m_canvas->print(0, pos++, "%c %s",
false ? '*' : ' ',
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",
false ? '*' : ' ',
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,
@@ -37,14 +38,14 @@ WindowDownloadList::redraw() {
else
m_canvas->print(0, pos++, "%c Torrent: Done %.1f MiB Rate:%5.1f /%5.1f KiB Uploaded: %.1f MiB",
false ? '*' : ' ',
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",
false ? '*' : ' ',
itr == m_focus ? '*' : ' ',
itr->get_download().is_tracker_busy() ? 'C' : ' ',
(int)(itr->get_download().get_tracker_timeout() / 1000000),
"");
+10 -7
View File
@@ -2,21 +2,24 @@
#define RTORRENT_DISPLAY_WINDOW_DOWNLOAD_LIST_H
#include "window.h"
namespace engine {
class DownloadList;
}
#include "core/download_list.h"
namespace display {
class WindowDownloadList : public Window {
public:
WindowDownloadList(engine::DownloadList* d);
typedef core::DownloadList List;
virtual void redraw();
WindowDownloadList(List* d);
List::iterator get_focus() { return m_focus; }
void set_focus(core::DownloadList::iterator itr) { m_focus = itr; }
virtual void redraw();
private:
engine::DownloadList* m_downloads;
List* m_downloads;
List::iterator m_focus;
};
}