mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 06:02:31 +00:00
* Set Content::m_chunkSize before adding files.
* Removed the old FileList and replaced it with the cleaned up EntryList code. The API now gives a FileList* instead of FileList. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@810 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -95,6 +95,12 @@ te_value(Return (torrent::Download::*fptr)() const, int flags = TextElementValue
|
||||
return display::text_element_value_slot(rak::on(std::mem_fun(&core::Download::c_download), std::mem_fun(fptr)), flags, attributes);
|
||||
}
|
||||
|
||||
template <typename Return>
|
||||
inline TextElementValueBase*
|
||||
te_value(Return (torrent::FileList::*fptr)() const, int flags = TextElementValueBase::flag_normal, int attributes = Attributes::a_invalid) {
|
||||
return display::text_element_value_slot(rak::on(std::mem_fun(&core::Download::c_file_list), std::mem_fun(fptr)), flags, attributes);
|
||||
}
|
||||
|
||||
inline TextElementValueBase*
|
||||
te_variable_value(const std::string& variable, int flags = TextElementValueBase::flag_normal, int attributes = Attributes::a_invalid) {
|
||||
return display::text_element_value_slot(rak::bind2nd(std::mem_fun(&core::Download::variable_value), variable), flags, attributes);
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <rak/timer.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/connection_manager.h>
|
||||
#include <torrent/file_list.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/tracker.h>
|
||||
#include <torrent/tracker_list.h>
|
||||
@@ -132,11 +133,11 @@ print_download_info(char* first, char* last, core::Download* d) {
|
||||
first = print_buffer(first, last, " ");
|
||||
|
||||
if (d->is_done())
|
||||
first = print_buffer(first, last, "done %10.1f MB", (double)d->download()->bytes_total() / (double)(1 << 20));
|
||||
first = print_buffer(first, last, "done %10.1f MB", (double)d->download()->file_list()->size_bytes() / (double)(1 << 20));
|
||||
else
|
||||
first = print_buffer(first, last, "%6.1f / %6.1f MB",
|
||||
(double)d->download()->bytes_done() / (double)(1 << 20),
|
||||
(double)d->download()->bytes_total() / (double)(1 << 20));
|
||||
(double)d->download()->file_list()->size_bytes() / (double)(1 << 20));
|
||||
|
||||
first = print_buffer(first, last, " Rate: %5.1f / %5.1f KB Uploaded: %7.1f MB",
|
||||
(double)d->download()->up_rate()->rate() / (1 << 10),
|
||||
@@ -208,7 +209,7 @@ print_download_time_left(char* first, char* last, core::Download* d) {
|
||||
if (rate < 512)
|
||||
return print_buffer(first, last, "--d --:--");
|
||||
|
||||
time_t remaining = (d->download()->bytes_total() - d->download()->bytes_done()) / (rate & ~(uint32_t)(512 - 1));
|
||||
time_t remaining = (d->download()->file_list()->size_bytes() - d->download()->bytes_done()) / (rate & ~(uint32_t)(512 - 1));
|
||||
|
||||
return print_ddhhmm(first, last, remaining);
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ WindowFileList::redraw() {
|
||||
m_slotSchedule(this, (cachedTime + rak::timer::from_seconds(10)).round_seconds());
|
||||
m_canvas->erase();
|
||||
|
||||
torrent::FileList fl = m_download->download()->file_list();
|
||||
torrent::FileList* fl = m_download->download()->file_list();
|
||||
|
||||
if (fl.size() == 0 || m_canvas->height() < 2)
|
||||
if (fl->size_files() == 0 || m_canvas->height() < 2)
|
||||
return;
|
||||
|
||||
int pos = 0;
|
||||
@@ -92,13 +92,13 @@ WindowFileList::redraw() {
|
||||
|
||||
++pos;
|
||||
|
||||
if (*m_focus >= fl.size())
|
||||
if (*m_focus >= fl->size_files())
|
||||
throw std::logic_error("WindowFileList::redraw() called on an object with a bad focus value");
|
||||
|
||||
Range range = rak::advance_bidirectional<unsigned int>(0, *m_focus, fl.size(), m_canvas->height() - pos);
|
||||
Range range = rak::advance_bidirectional<unsigned int>(0, *m_focus, fl->size_files(), m_canvas->height() - pos);
|
||||
|
||||
while (range.first != range.second) {
|
||||
torrent::File* e = fl.get(range.first);
|
||||
torrent::File* e = fl->at_index(range.first);
|
||||
|
||||
std::string path = e->path()->as_string();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user