mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-18 08:02:29 +00:00
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:
@@ -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 \
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user