* Added ^E for setting 'create/resize queued' on files in a torrent.

* Minor cleanup of the API.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1030 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-01-22 15:50:48 +00:00
parent c19af8f389
commit 728c6ac9bd
7 changed files with 78 additions and 51 deletions
+24 -20
View File
@@ -63,15 +63,22 @@ ElementDownloadList::ElementDownloadList() :
if (m_view == NULL)
throw torrent::internal_error("View \"main\" must be present to initialize the main display.");
m_bindings['\x13'] = sigc::mem_fun(*this, &ElementDownloadList::receive_start_download);
m_bindings['\x13'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.start=");
m_bindings['\x04'] = sigc::mem_fun(*this, &ElementDownloadList::receive_stop_download);
m_bindings['\x0B'] = sigc::mem_fun(*this, &ElementDownloadList::receive_close_download);
m_bindings['\x12'] = sigc::mem_fun(*this, &ElementDownloadList::receive_check_hash);
// m_bindings['\x04'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.stop=");
// m_bindings['\x0B'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.close=");
m_bindings['\x12'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.check_hash=");
m_bindings['\x05'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command),
"f.multicall=,f.set_create_queued=,f.set_resize_queued= ; print=\"Queued create/resize of files in torrent.\"");
m_bindings['+'] = sigc::mem_fun(*this, &ElementDownloadList::receive_next_priority);
m_bindings['-'] = sigc::mem_fun(*this, &ElementDownloadList::receive_prev_priority);
m_bindings['I'] = sigc::mem_fun(*this, &ElementDownloadList::receive_ignore_ratio);
m_bindings['U'] = sigc::mem_fun(*this, &ElementDownloadList::receive_clear_tied);
// These should also be commands.
m_bindings['1'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "main");
m_bindings['2'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "name");
m_bindings['3'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "started");
@@ -126,6 +133,21 @@ ElementDownloadList::set_view(core::View* l) {
m_window->mark_dirty();
}
void
ElementDownloadList::receive_command(const char* cmd) {
try {
if (m_view->focus() == m_view->end_visible())
rpc::parse_command_multiple(rpc::make_target(), cmd, cmd + strlen(cmd));
else
rpc::parse_command_multiple(rpc::make_target(*m_view->focus()), cmd, cmd + strlen(cmd));
m_view->set_last_changed();
} catch (torrent::input_error& e) {
control->core()->push_log(e.what());
}
}
void
ElementDownloadList::receive_next() {
m_view->next_focus();
@@ -138,15 +160,6 @@ ElementDownloadList::receive_prev() {
m_view->set_last_changed();
}
void
ElementDownloadList::receive_start_download() {
if (m_view->focus() == m_view->end_visible())
return;
control->core()->download_list()->start_normal(*m_view->focus());
m_view->set_last_changed();
}
void
ElementDownloadList::receive_stop_download() {
if (m_view->focus() == m_view->end_visible())
@@ -192,15 +205,6 @@ ElementDownloadList::receive_prev_priority() {
m_window->mark_dirty();
}
void
ElementDownloadList::receive_check_hash() {
if (m_view->focus() == m_view->end_visible())
return;
// Catch here?
control->core()->download_list()->check_hash(*m_view->focus());
}
void
ElementDownloadList::receive_ignore_ratio() {
if (m_view->focus() == m_view->end_visible())
+2 -3
View File
@@ -62,18 +62,17 @@ public:
core::View* view() { return m_view; }
void set_view(core::View* l);
void receive_command(const char* cmd);
void receive_next();
void receive_prev();
void receive_start_download();
void receive_stop_download();
void receive_close_download();
void receive_next_priority();
void receive_prev_priority();
void receive_check_hash();
void receive_ignore_ratio();
void receive_clear_tied();
+3 -1
View File
@@ -93,9 +93,11 @@ element_file_list_create_info() {
element->push_back("");
element->push_column("Size:", te_command("if=$fi.is_file=,$to_xb=$f.get_size_bytes=,---"));
element->push_column("Chunks:", te_command("cat=$f.get_completed_chunks=,\" / \",$f.get_size_chunks="));
element->push_column("Range:", te_command("cat=$f.get_range_first=,\" - \",$f.get_range_second="));
element->push_back("");
element->push_column("Queued:", te_command("cat=\"$if=$f.is_create_queued=,create\",\" \",\"$if=$f.is_resize_queued=,resize\""));
element->set_column_width(element->column_width() + 1);