Added start/stop keys.

Added more extensive download status information where only tracker
status used to be.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@279 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-02-15 21:59:35 +00:00
parent f348196f2e
commit 46120cbb30
16 changed files with 182 additions and 71 deletions
+2
View File
@@ -5,6 +5,8 @@ libsub_display_a_SOURCES = \
canvas.h \
manager.cc \
manager.h \
utils.cc \
utils.h \
window.cc \
window.h \
window_download_statusbar.cc \
+2 -1
View File
@@ -13,7 +13,7 @@ Canvas::resize(int x, int y, int w, int h) {
void
Canvas::init() {
initscr();
cbreak();
raw();
noecho();
nodelay(stdscr, TRUE);
keypad(stdscr, TRUE);
@@ -22,6 +22,7 @@ Canvas::init() {
void
Canvas::cleanup() {
noraw();
endwin();
}
+31
View File
@@ -0,0 +1,31 @@
#include "config.h"
#include <sstream>
#include "core/download.h"
#include "utils.h"
namespace display {
std::string
print_download_status(core::Download* d) {
std::stringstream str;
if (d->get_download().is_hash_checking()) {
str << "Checking hash";
} else if (d->get_download().is_tracker_busy()) {
str << "Tracker: Connecting";
} else if (!d->get_download().is_active()) {
str << "Inactive";
} else {
str << "Tracker: " << d->get_tracker_msg();
}
return str.str();
}
}
+16
View File
@@ -0,0 +1,16 @@
#ifndef RTORRENT_DISPLAY_UTILS_H
#define RTORRENT_DISPLAY_UTILS_H
#include <string>
namespace core {
class Download;
}
namespace display {
std::string print_download_status(core::Download* d);
}
#endif
+2 -3
View File
@@ -1,6 +1,7 @@
#include "config.h"
#include "canvas.h"
#include "utils.h"
#include "window_download_list.h"
namespace display {
@@ -70,9 +71,7 @@ WindowDownloadList::redraw() {
(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: %s",
itr == *m_focus ? '*' : ' ',
itr->get_download().is_tracker_busy() ? "Connecting" : itr->get_tracker_msg().c_str());
m_canvas->print(0, pos++, "%c %s", itr == *m_focus ? '*' : ' ', print_download_status(&*itr).c_str());
++itr;
}
+3 -2
View File
@@ -1,6 +1,7 @@
#include "config.h"
#include "canvas.h"
#include "utils.h"
#include "window_download_statusbar.h"
#include "core/download.h"
@@ -43,10 +44,10 @@ WindowDownloadStatusbar::redraw() {
(int)m_download->get_download().get_peers_max(),
(int)m_download->get_download().get_uploads_max());
m_canvas->print(0, 2, "Tracker: [%c:%i] %s",
m_canvas->print(0, 2, "[%c:%i] %s",
m_download->get_download().is_tracker_busy() ? 'C' : ' ',
(int)(m_download->get_download().get_tracker_timeout() / 1000000),
m_download->get_tracker_msg().c_str());
print_download_status(m_download).c_str());
}
}