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
+3
View File
@@ -1,6 +1,7 @@
#ifndef RTORRENT_UI_CONTROL_H
#define RTORRENT_UI_CONTROL_H
#include "core/manager.h"
#include "display/manager.h"
#include "input/manager.h"
@@ -10,6 +11,7 @@ class Control {
public:
Control() {}
core::Manager& get_core() { return m_core; }
display::Manager& get_display() { return m_display; }
input::Manager& get_input() { return m_input; }
@@ -17,6 +19,7 @@ private:
Control(const Control&);
void operator = (const Control&);
core::Manager m_core;
display::Manager m_display;
input::Manager m_input;
};
+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);
+6 -3
View File
@@ -26,7 +26,7 @@ public:
typedef sigc::slot1<void, const std::string&> SlotOpenUri;
// We own 'window'.
DownloadList(DList* l, Control* c);
DownloadList(Control* c);
~DownloadList();
WList& get_window() { return *m_window; }
@@ -44,11 +44,14 @@ private:
void receive_next();
void receive_prev();
void receive_throttle(int t);
void receive_start_download();
void receive_stop_download();
void receive_view_download();
void receive_exit_download();
void receive_throttle(int t);
void receive_view_input();
void receive_exit_input();