Added start/stop keys.

Added more extensive download status information where only tracker
status used to be.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@279 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-02-15 21:59:35 +00:00
parent f348196f2e
commit 46120cbb30
16 changed files with 182 additions and 71 deletions
+34 -16
View File
@@ -17,17 +17,16 @@
namespace ui {
DownloadList::DownloadList(core::DownloadList* l, Control* c) :
DownloadList::DownloadList(Control* c) :
m_title(new WTitle("rtorrent " VERSION " - " + torrent::get(torrent::LIBRARY_NAME))),
m_status(new WStatus),
m_download(NULL),
m_list(l),
m_focus(l->end()),
m_focus(c->get_core().get_download_list().end()),
m_control(c),
m_bindings(new input::Bindings),
m_windowInput(new WInput(new input::TextInput)) {
m_window = new WList(m_list, &m_focus);
m_window = new WList(&m_control->get_core().get_download_list(), &m_focus);
bind_keys(m_bindings);
@@ -64,27 +63,50 @@ DownloadList::disable() {
void
DownloadList::receive_next() {
if (m_focus != m_list->end())
if (m_focus != m_control->get_core().get_download_list().end())
++m_focus;
else
m_focus = m_list->begin();
m_focus = m_control->get_core().get_download_list().begin();
mark_dirty();
}
void
DownloadList::receive_prev() {
if (m_focus != m_list->begin())
if (m_focus != m_control->get_core().get_download_list().begin())
--m_focus;
else
m_focus = m_list->end();
m_focus = m_control->get_core().get_download_list().end();
mark_dirty();
}
void
DownloadList::receive_throttle(int t) {
m_status->mark_dirty();
torrent::set(torrent::THROTTLE_ROOT_CONST_RATE, torrent::get(torrent::THROTTLE_ROOT_CONST_RATE) + t * 1024);
}
void
DownloadList::receive_start_download() {
if (m_focus == m_control->get_core().get_download_list().end())
return;
m_control->get_core().start(&*m_focus);
}
void
DownloadList::receive_stop_download() {
if (m_focus == m_control->get_core().get_download_list().end())
return;
m_control->get_core().stop(&*m_focus);
}
void
DownloadList::receive_view_download() {
if (m_focus == m_list->end())
if (m_focus == m_control->get_core().get_download_list().end())
return;
if (m_download != NULL)
@@ -112,13 +134,6 @@ DownloadList::receive_exit_download() {
m_control->get_display().adjust_layout();
}
void
DownloadList::receive_throttle(int t) {
m_status->mark_dirty();
torrent::set(torrent::THROTTLE_ROOT_CONST_RATE, torrent::get(torrent::THROTTLE_ROOT_CONST_RATE) + t * 1024);
}
void
DownloadList::receive_view_input() {
m_control->get_input().set_text_input(m_windowInput->get_input());
@@ -151,6 +166,9 @@ DownloadList::bind_keys(input::Bindings* b) {
(*b)['d'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 50);
(*b)['c'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -50);
(*b)['\x13'] = sigc::mem_fun(*this, &DownloadList::receive_start_download);
(*b)['\x04'] = sigc::mem_fun(*this, &DownloadList::receive_stop_download);
(*b)[KEY_UP] = sigc::mem_fun(*this, &DownloadList::receive_prev);
(*b)[KEY_DOWN] = sigc::mem_fun(*this, &DownloadList::receive_next);
(*b)[KEY_RIGHT] = sigc::mem_fun(*this, &DownloadList::receive_view_download);