* Added pageup/down to chunks seen and file list. Patch by Josef

Drexler, all future patches to lib/rtorrent will be under public
domain.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@712 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-06-04 23:37:39 +00:00
parent 46dd41e956
commit d0f6719e50
7 changed files with 151 additions and 18 deletions
+41
View File
@@ -56,6 +56,8 @@ ElementFileList::ElementFileList(core::Download* d) :
m_bindings['*'] = sigc::mem_fun(*this, &ElementFileList::receive_change_all);
m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementFileList::receive_next);
m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementFileList::receive_prev);
m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pagenext);
m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pageprev);
}
void
@@ -108,6 +110,45 @@ ElementFileList::receive_prev() {
m_window->mark_dirty();
}
void
ElementFileList::receive_pagenext() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::receive_pagenext(...) called on a disabled object");
unsigned int count = (m_window->get_height() - 1) / 2;
if (m_focus + count < m_download->download()->file_list().size())
m_focus += count;
else if (m_focus == m_download->download()->file_list().size() - 1)
m_focus = 0;
else
m_focus = m_download->download()->file_list().size() - 1;
m_window->mark_dirty();
}
void
ElementFileList::receive_pageprev() {
if (m_window == NULL)
throw torrent::client_error("ui::ElementFileList::receive_pageprev(...) called on a disabled object");
torrent::FileList fl = m_download->download()->file_list();
if (fl.size() == 0)
return;
unsigned int count = (m_window->get_height() - 1) / 2;
if (m_focus > count)
m_focus -= count;
else if (m_focus == 0)
m_focus = fl.size() - 1;
else
m_focus = 0;
m_window->mark_dirty();
}
void
ElementFileList::receive_priority() {
if (m_window == NULL)