mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-06 06:09:22 +00:00
* Changed function calls in torrent::Download to be const.
* Cleaned up the code that handles printing of download stats, uses a char* for buffer for output more flexible concatenation. Closed torrents are displayed correctly now. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@497 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -36,8 +36,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <torrent/rate.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "rak/algorithm.h"
|
||||
|
||||
@@ -64,7 +62,7 @@ WindowDownloadList::redraw() {
|
||||
|
||||
m_canvas->erase();
|
||||
|
||||
if (m_list->base().empty())
|
||||
if (m_list->base().empty() || m_canvas->get_width() < 5)
|
||||
return;
|
||||
|
||||
typedef std::pair<DList::iterator, DList::iterator> Range;
|
||||
@@ -83,31 +81,18 @@ WindowDownloadList::redraw() {
|
||||
int pos = 0;
|
||||
|
||||
while (range.first != range.second) {
|
||||
torrent::Download& d = (*range.first)->get_download();
|
||||
char buffer[m_canvas->get_width() - 2];
|
||||
char* position;
|
||||
char* last = buffer + m_canvas->get_width() - 2;
|
||||
|
||||
m_canvas->print(0, pos++, "%c %s",
|
||||
range.first == m_list->get_focus() ? '*' : ' ',
|
||||
d.get_name().c_str());
|
||||
|
||||
if ((*range.first)->is_open() && (*range.first)->is_done())
|
||||
m_canvas->print(0, pos++, "%c Torrent: Done %10.1f MiB Rate: %5.1f / %5.1f KiB Uploaded: %.1f MiB",
|
||||
range.first == m_list->get_focus() ? '*' : ' ',
|
||||
(double)d.get_bytes_total() / (double)(1 << 20),
|
||||
(double)d.get_write_rate().rate() / 1024.0,
|
||||
(double)d.get_read_rate().rate() / 1024.0,
|
||||
(double)d.get_write_rate().total() / (double)(1 << 20));
|
||||
else
|
||||
m_canvas->print(0, pos++, "%c Torrent: %6.1f / %6.1f MiB Rate: %5.1f / %5.1f KiB Uploaded: %.1f MiB",
|
||||
range.first == m_list->get_focus() ? '*' : ' ',
|
||||
(double)d.get_bytes_done() / (double)(1 << 20),
|
||||
(double)d.get_bytes_total() / (double)(1 << 20),
|
||||
(double)d.get_write_rate().rate() / 1024.0,
|
||||
(double)d.get_read_rate().rate() / 1024.0,
|
||||
(double)d.get_write_rate().total() / (double)(1 << 20));
|
||||
position = print_download_title(buffer, last - buffer, *range.first);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
|
||||
|
||||
m_canvas->print(0, pos++, "%c %s",
|
||||
range.first == m_list->get_focus() ? '*' : ' ',
|
||||
print_download_status(*range.first).c_str());
|
||||
position = print_download_info(buffer, last - buffer, *range.first);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
|
||||
|
||||
position = print_download_status(buffer, last - buffer, *range.first);
|
||||
m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
|
||||
|
||||
++range.first;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user