* Added file_path_iterator that allows the client to iterate through

FileList in a structured manner. Messed up the file list view to test
it.

* Added operator[] and at(...) to torrent::FileList and torrent::Path.

* Fixed Handshake::fill_read_buffer(...) that was throwing due to a
bad error check. Patch by Josef Drexler.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@830 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-12-22 10:54:39 +00:00
parent aab31e5ea5
commit c65b6aa9ff
4 changed files with 127 additions and 51 deletions
+9 -9
View File
@@ -54,8 +54,8 @@ ElementChunksSeen::ElementChunksSeen(core::Download* d) :
m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementChunksSeen::receive_next);
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementChunksSeen::receive_prev);
m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementChunksSeen::receive_next);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementChunksSeen::receive_prev);
m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementChunksSeen::receive_pagenext);
m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementChunksSeen::receive_pageprev);
}
@@ -137,14 +137,14 @@ ElementChunksSeen::receive_pagenext() {
throw torrent::internal_error("ui::ElementChunksSeen::receive_pagenext(...) called on a disabled object");
unsigned int visible = m_window->height() - 1;
unsigned int scrollable = std::max<int>(m_window->rows() - visible, 0);
unsigned int maxFocus = m_window->max_focus();
if (scrollable == 0 || m_focus == scrollable)
if (maxFocus == 0 || m_focus == maxFocus)
m_focus = 0;
else if (m_focus + visible / 2 < scrollable)
else if (m_focus + visible / 2 < maxFocus)
m_focus += visible / 2;
else
m_focus = scrollable;
m_focus = maxFocus;
m_window->mark_dirty();
}
@@ -155,12 +155,12 @@ ElementChunksSeen::receive_pageprev() {
throw torrent::internal_error("ui::ElementChunksSeen::receive_pageprev(...) called on a disabled object");
unsigned int visible = m_window->height() - 1;
unsigned int scrollable = std::max<int>(m_window->rows() - visible, 0);
unsigned int maxFocus = m_window->max_focus();
if (m_focus > visible / 2)
m_focus -= visible / 2;
else if (scrollable > 0 && m_focus == 0)
m_focus = scrollable;
else if (maxFocus > 0 && m_focus == 0)
m_focus = maxFocus;
else
m_focus = 0;