mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 12:42:31 +00:00
* Made ThrottleNode an object held by PCB, rather than ThrottleList
which now holds ThrottleNode*. Moved Rate from PCB to ThrottleNode. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@596 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+32
-24
@@ -59,6 +59,30 @@ print_string(char* buf, unsigned int length, char* str) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
char*
|
||||
print_hhmmss(char* buf, unsigned int length, time_t t) {
|
||||
std::tm *u = std::localtime(&t);
|
||||
|
||||
if (u == NULL)
|
||||
return "inv_time";
|
||||
|
||||
unsigned int s = snprintf(buf, length, "%02u:%02u:%02u", u->tm_hour, u->tm_min, u->tm_sec);
|
||||
|
||||
return buf + std::min(s, length);
|
||||
}
|
||||
|
||||
char*
|
||||
print_ddmmyyyy(char* buf, unsigned int length, time_t t) {
|
||||
std::tm *u = std::gmtime(&t);
|
||||
|
||||
if (u == NULL)
|
||||
return "inv_time";
|
||||
|
||||
unsigned int s = snprintf(buf, length, "%02u/%02u/%04u", u->tm_mday, (u->tm_mon + 1), (1900 + u->tm_year));
|
||||
|
||||
return buf + std::min(s, length);
|
||||
}
|
||||
|
||||
char*
|
||||
print_download_title(char* buf, unsigned int length, core::Download* d) {
|
||||
return buf + std::max(0, snprintf(buf, length, "%s",
|
||||
@@ -82,9 +106,9 @@ print_download_info(char* buf, unsigned int length, core::Download* d) {
|
||||
(double)d->get_download().bytes_total() / (double)(1 << 20)));
|
||||
|
||||
buf += std::max(0, snprintf(buf, last - buf, " Rate: %5.1f / %5.1f KB Uploaded: %.1f MB",
|
||||
(double)d->get_download().up_rate().rate() / (1 << 10),
|
||||
(double)d->get_download().down_rate().rate() / (1 << 10),
|
||||
(double)d->get_download().up_rate().total() / (1 << 20)));
|
||||
(double)d->get_download().up_rate()->rate() / (1 << 10),
|
||||
(double)d->get_download().down_rate()->rate() / (1 << 10),
|
||||
(double)d->get_download().up_rate()->total() / (1 << 20)));
|
||||
|
||||
return buf;
|
||||
}
|
||||
@@ -113,28 +137,12 @@ print_download_status(char* buf, unsigned int length, core::Download* d) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
char*
|
||||
print_hhmmss(char* buf, unsigned int length, time_t t) {
|
||||
std::tm *u = std::localtime(&t);
|
||||
// char*
|
||||
// print_entry_tags(char* buf, unsigned int length) {
|
||||
|
||||
if (u == NULL)
|
||||
return "inv_time";
|
||||
// }
|
||||
|
||||
unsigned int s = snprintf(buf, length, "%02u:%02u:%02u", u->tm_hour, u->tm_min, u->tm_sec);
|
||||
|
||||
return buf + std::min(s, length);
|
||||
}
|
||||
|
||||
char*
|
||||
print_ddmmyyyy(char* buf, unsigned int length, time_t t) {
|
||||
std::tm *u = std::gmtime(&t);
|
||||
|
||||
if (u == NULL)
|
||||
return "inv_time";
|
||||
|
||||
unsigned int s = snprintf(buf, length, "%02u/%02u/%04u", u->tm_mday, (u->tm_mon + 1), (1900 + u->tm_year));
|
||||
|
||||
return buf + std::min(s, length);
|
||||
}
|
||||
// char*
|
||||
// print_entry_file(char* buf, unsigned int length, const torrent::Entry& entry);
|
||||
|
||||
}
|
||||
|
||||
+9
-2
@@ -48,16 +48,23 @@ namespace utils {
|
||||
class Timer;
|
||||
}
|
||||
|
||||
namespace torrent {
|
||||
class Entry;
|
||||
}
|
||||
|
||||
namespace display {
|
||||
|
||||
char* print_string(char* buf, unsigned int length, char* str);
|
||||
|
||||
char* print_hhmmss(char* buf, unsigned int length, time_t t);
|
||||
char* print_ddmmyyyy(char* buf, unsigned int length, time_t t);
|
||||
|
||||
char* print_download_title(char* buf, unsigned int length, core::Download* d);
|
||||
char* print_download_info(char* buf, unsigned int length, core::Download* d);
|
||||
char* print_download_status(char* buf, unsigned int length, core::Download* d);
|
||||
|
||||
char* print_hhmmss(char* buf, unsigned int length, time_t t);
|
||||
char* print_ddmmyyyy(char* buf, unsigned int length, time_t t);
|
||||
char* print_entry_tags(char* buf, unsigned int length);
|
||||
char* print_entry_file(char* buf, unsigned int length, const torrent::Entry& entry);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -64,21 +64,6 @@ WindowDownloadStatusbar::redraw() {
|
||||
position = print_download_info(buffer, last - buffer, m_download);
|
||||
m_canvas->print(0, 0, "%s", buffer);
|
||||
|
||||
// if (m_download->get_download().get_chunks_done() != m_download->get_download().get_chunks_total() || !m_download->get_download().is_open())
|
||||
// m_canvas->print(0, 0, "Torrent: %.1f / %.1f MiB Rate: %5.1f / %5.1f KiB Uploaded: %.1f MiB",
|
||||
// (double)m_download->get_download().get_bytes_done() / (double)(1 << 20),
|
||||
// (double)m_download->get_download().get_bytes_total() / (double)(1 << 20),
|
||||
// (double)m_download->get_download().get_write_rate().rate() / 1024.0,
|
||||
// (double)m_download->get_download().get_read_rate().rate() / 1024.0,
|
||||
// (double)m_download->get_download().get_write_rate().total() / (double)(1 << 20));
|
||||
|
||||
// else
|
||||
// m_canvas->print(0, 0, "Torrent: Done %.1f MiB Rate: %5.1f / %5.1f KiB Uploaded: %.1f MiB",
|
||||
// (double)m_download->get_download().get_bytes_total() / (double)(1 << 20),
|
||||
// (double)m_download->get_download().get_write_rate().rate() / 1024.0,
|
||||
// (double)m_download->get_download().get_read_rate().rate() / 1024.0,
|
||||
// (double)m_download->get_download().get_write_rate().total() / (double)(1 << 20));
|
||||
|
||||
m_canvas->print(0, 1, "Peers: %i(%i) Min/Max: %i/%i Uploads: %i U/I: %i/%i",
|
||||
(int)m_download->get_download().peers_connected(),
|
||||
(int)m_download->get_download().peers_not_connected(),
|
||||
|
||||
@@ -103,10 +103,10 @@ WindowPeerInfo::redraw() {
|
||||
m_canvas->print(0, y++, "Done: %i%", done_percentage(**m_focus));
|
||||
|
||||
m_canvas->print(0, y++, "Rate: %5.1f/%5.1f KB Total: %.1f/%.1f MB",
|
||||
(double)(*m_focus)->up_rate().rate() / (double)(1 << 10),
|
||||
(double)(*m_focus)->down_rate().rate() / (double)(1 << 10),
|
||||
(double)(*m_focus)->up_rate().total() / (double)(1 << 20),
|
||||
(double)(*m_focus)->down_rate().total() / (double)(1 << 20));
|
||||
(double)(*m_focus)->up_rate()->rate() / (double)(1 << 10),
|
||||
(double)(*m_focus)->down_rate()->rate() / (double)(1 << 10),
|
||||
(double)(*m_focus)->up_rate()->total() / (double)(1 << 20),
|
||||
(double)(*m_focus)->down_rate()->total() / (double)(1 << 20));
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -97,9 +97,9 @@ WindowPeerList::redraw() {
|
||||
p.address().c_str());
|
||||
x += 18;
|
||||
|
||||
m_canvas->print(x, y, "%.1f", (double)p.up_rate().rate() / 1024); x += 7;
|
||||
m_canvas->print(x, y, "%.1f", (double)p.down_rate().rate() / 1024); x += 7;
|
||||
m_canvas->print(x, y, "%.1f", (double)p.peer_rate().rate() / 1024); x += 7;
|
||||
m_canvas->print(x, y, "%.1f", (double)p.up_rate()->rate() / 1024); x += 7;
|
||||
m_canvas->print(x, y, "%.1f", (double)p.down_rate()->rate() / 1024); x += 7;
|
||||
m_canvas->print(x, y, "%.1f", (double)p.peer_rate()->rate() / 1024); x += 7;
|
||||
|
||||
m_canvas->print(x, y, "%c/%c%c/%c%c",
|
||||
p.is_incoming() ? 'r' : 'l',
|
||||
|
||||
@@ -76,8 +76,8 @@ WindowStatusbar::redraw() {
|
||||
|
||||
m_canvas->print(0, 0, "Throttle U/D: %s Rate: %5.1f / %5.1f KB Listen: %s:%i%s",
|
||||
buf,
|
||||
(double)torrent::up_rate().rate() / 1024.0,
|
||||
(double)torrent::down_rate().rate() / 1024.0,
|
||||
(double)torrent::up_rate()->rate() / 1024.0,
|
||||
(double)torrent::down_rate()->rate() / 1024.0,
|
||||
!torrent::local_address().empty() ? torrent::local_address().c_str() : "<default>",
|
||||
(int)torrent::listen_port(),
|
||||
!torrent::bind_address().empty() ? (" Bind: " + torrent::bind_address()).c_str() : "");
|
||||
|
||||
Reference in New Issue
Block a user