* Added an info screen to the file list and added more information to

the list.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@833 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-12-25 18:26:40 +00:00
parent 25702ea4b7
commit eabbf33a76
6 changed files with 152 additions and 36 deletions
+6 -4
View File
@@ -82,12 +82,14 @@ TextElementValueBase::print(char* first, char* last, Canvas::attributes_list* at
} else if (m_flags & flag_xb) {
if (val < (int64_t(1) << 30))
first += std::max(snprintf(first, last - first + 1, "%5.1f MB", (double)val / (int64_t(1) << 20)), 0);
if (val < (int64_t(1) << 20))
first += std::max(snprintf(first, last - first + 1, "%5.1f Kb", (double)val / (int64_t(1) << 10)), 0);
else if (val < (int64_t(1) << 30))
first += std::max(snprintf(first, last - first + 1, "%5.1f Mb", (double)val / (int64_t(1) << 20)), 0);
else if (val < (int64_t(1) << 40))
first += std::max(snprintf(first, last - first + 1, "%5.1f GB", (double)val / (int64_t(1) << 30)), 0);
first += std::max(snprintf(first, last - first + 1, "%5.1f Gb", (double)val / (int64_t(1) << 30)), 0);
else
first += std::max(snprintf(first, last - first + 1, "%5.1f TB", (double)val / (int64_t(1) << 40)), 0);
first += std::max(snprintf(first, last - first + 1, "%5.1f Tb", (double)val / (int64_t(1) << 40)), 0);
} else if (m_flags & flag_timer) {
if (val == 0)
+23 -12
View File
@@ -97,19 +97,19 @@ WindowFileList::redraw() {
while (pos != m_canvas->height() && itr != iterator(fl->end())) {
if (itr.is_empty()) {
m_canvas->print(0, pos, "EMPTY");
m_canvas->print(12, pos, "EMPTY");
} else if (itr.is_entering()) {
m_canvas->print(itr.depth(), pos, "\\ %s",
m_canvas->print(12 + itr.depth(), pos, "\\ %s",
itr.depth() < (*itr)->path()->size() ? (*itr)->path()->at(itr.depth()).c_str() : "UNKNOWN");
} else if (itr.is_leaving()) {
m_canvas->print(itr.depth(), pos, "/");
m_canvas->print(12 + itr.depth() - 1, pos, "/");
} else if (itr.is_file()) {
torrent::File* e = *itr;
std::string priority;
const char* priority;
switch (e->priority()) {
case torrent::PRIORITY_OFF:
@@ -129,7 +129,18 @@ WindowFileList::redraw() {
break;
};
m_canvas->print(itr.depth(), pos, "| %s",
m_canvas->print(0, pos, "%3d", done_percentage(e));
int64_t val = e->size_bytes();
if (val < (int64_t(1) << 30))
m_canvas->print(4, pos, "%5.1fMb", (double)val / (int64_t(1) << 20));
else if (val < (int64_t(1) << 40))
m_canvas->print(4, pos, "%5.1fGb", (double)val / (int64_t(1) << 30));
else
m_canvas->print(4, pos, "%5.1fTb", (double)val / (int64_t(1) << 40));
m_canvas->print(12 + itr.depth(), pos, "| %s",
itr.depth() < (*itr)->path()->size() ? (*itr)->path()->at(itr.depth()).c_str() : "UNKNOWN");
// %6.1f %s %3d %9s",
@@ -138,13 +149,13 @@ WindowFileList::redraw() {
// done_percentage(e),
// e->path()->encoding().c_str());
m_canvas->print(104, pos, "%i - %i %c%c %u %u",
e->range().first,
e->range().first != e->range().second ? (e->range().second - 1) : e->range().second,
e->is_created() ? 'E' : 'M',
e->is_correct_size() ? 'C' : 'W',
e->match_depth_prev(),
e->match_depth_next());
// m_canvas->print(104, pos, "%i - %i %c%c %u %u",
// e->range().first,
// e->range().first != e->range().second ? (e->range().second - 1) : e->range().second,
// e->is_created() ? 'E' : 'M',
// e->is_correct_size() ? 'C' : 'W',
// e->match_depth_prev(),
// e->match_depth_next());
} else {
m_canvas->print(0, pos, "BORK BORK");