mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-22 00:56:18 +00:00
* Enable custom throttles, both per-download or per-IP. See http://libtorrent.rakshasa.no/ticket/20 for info and instructions. Patch by Josef Drexler.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1091 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -72,6 +72,7 @@ ElementDownloadList::ElementDownloadList() :
|
||||
|
||||
m_bindings['+'] = sigc::mem_fun(*this, &ElementDownloadList::receive_next_priority);
|
||||
m_bindings['-'] = sigc::mem_fun(*this, &ElementDownloadList::receive_prev_priority);
|
||||
m_bindings['T'-'@']= sigc::mem_fun(*this, &ElementDownloadList::receive_cycle_throttle);
|
||||
m_bindings['I'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command),
|
||||
"branch=d.get_ignore_commands=,"
|
||||
"{d.set_ignore_commands=0, print=\"Torrent set to heed commands.\"},"
|
||||
@@ -185,6 +186,27 @@ ElementDownloadList::receive_prev_priority() {
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
|
||||
void
|
||||
ElementDownloadList::receive_cycle_throttle() {
|
||||
if (m_view->focus() == m_view->end_visible())
|
||||
return;
|
||||
|
||||
core::Download* download = *m_view->focus();
|
||||
if (download->is_active()) {
|
||||
control->core()->push_log("Cannot change throttle on active download.");
|
||||
return;
|
||||
}
|
||||
|
||||
core::ThrottleMap::const_iterator itr = control->core()->throttles().find(download->bencode()->get_key("rtorrent").get_key_string("throttle_name"));
|
||||
if (itr == control->core()->throttles().end())
|
||||
itr = control->core()->throttles().begin();
|
||||
else
|
||||
++itr;
|
||||
|
||||
download->set_throttle_name(itr == control->core()->throttles().end() ? std::string() : itr->first);
|
||||
m_window->mark_dirty();
|
||||
}
|
||||
|
||||
void
|
||||
ElementDownloadList::receive_change_view(const std::string& name) {
|
||||
core::ViewManager::iterator itr = control->view_manager()->find(name);
|
||||
|
||||
Reference in New Issue
Block a user