Adding controls for download throttle.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@426 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-05-02 01:20:51 +00:00
parent 98676e5531
commit d898b9db01
7 changed files with 70 additions and 32 deletions
+21 -7
View File
@@ -181,7 +181,14 @@ Download::receive_peer_disconnected(torrent::Peer p) {
}
void
Download::receive_throttle(int t) {
Download::receive_read_throttle(int t) {
m_windowMainStatus->mark_dirty();
torrent::set(torrent::THROTTLE_READ_CONST_RATE, torrent::get(torrent::THROTTLE_READ_CONST_RATE) + t * 1024);
}
void
Download::receive_write_throttle(int t) {
m_windowMainStatus->mark_dirty();
torrent::set(torrent::THROTTLE_ROOT_CONST_RATE, torrent::get(torrent::THROTTLE_ROOT_CONST_RATE) + t * 1024);
@@ -229,12 +236,19 @@ Download::receive_snub_peer() {
void
Download::bind_keys() {
(*m_bindings)['a'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), 1);
(*m_bindings)['z'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), -1);
(*m_bindings)['s'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), 5);
(*m_bindings)['x'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), -5);
(*m_bindings)['d'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), 50);
(*m_bindings)['c'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_throttle), -50);
(*m_bindings)['a'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_write_throttle), 1);
(*m_bindings)['z'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_write_throttle), -1);
(*m_bindings)['s'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_write_throttle), 5);
(*m_bindings)['x'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_write_throttle), -5);
(*m_bindings)['d'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_write_throttle), 50);
(*m_bindings)['c'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_write_throttle), -50);
(*m_bindings)['A'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_read_throttle), 1);
(*m_bindings)['Z'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_read_throttle), -1);
(*m_bindings)['S'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_read_throttle), 5);
(*m_bindings)['X'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_read_throttle), -5);
(*m_bindings)['D'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_read_throttle), 50);
(*m_bindings)['C'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_read_throttle), -50);
(*m_bindings)['1'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_max_uploads), -1);
(*m_bindings)['2'] = sigc::bind(sigc::mem_fun(*this, &Download::receive_max_uploads), 1);
+2 -1
View File
@@ -83,7 +83,8 @@ private:
void receive_peer_connected(torrent::Peer p);
void receive_peer_disconnected(torrent::Peer p);
void receive_throttle(int t);
void receive_read_throttle(int t);
void receive_write_throttle(int t);
void receive_max_uploads(int t);
void receive_min_peers(int t);
void receive_max_peers(int t);
+21 -7
View File
@@ -169,7 +169,14 @@ DownloadList::receive_prev() {
}
void
DownloadList::receive_throttle(int t) {
DownloadList::receive_read_throttle(int t) {
m_windowStatus->mark_dirty();
torrent::set(torrent::THROTTLE_READ_CONST_RATE, torrent::get(torrent::THROTTLE_READ_CONST_RATE) + t * 1024);
}
void
DownloadList::receive_write_throttle(int t) {
m_windowStatus->mark_dirty();
torrent::set(torrent::THROTTLE_ROOT_CONST_RATE, torrent::get(torrent::THROTTLE_ROOT_CONST_RATE) + t * 1024);
@@ -274,12 +281,19 @@ DownloadList::task_update() {
void
DownloadList::setup_keys() {
(*m_bindings)['a'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 1);
(*m_bindings)['z'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -1);
(*m_bindings)['s'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 5);
(*m_bindings)['x'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -5);
(*m_bindings)['d'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), 50);
(*m_bindings)['c'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_throttle), -50);
(*m_bindings)['a'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_write_throttle), 1);
(*m_bindings)['z'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_write_throttle), -1);
(*m_bindings)['s'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_write_throttle), 5);
(*m_bindings)['x'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_write_throttle), -5);
(*m_bindings)['d'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_write_throttle), 50);
(*m_bindings)['c'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_write_throttle), -50);
(*m_bindings)['A'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_read_throttle), 1);
(*m_bindings)['Z'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_read_throttle), -1);
(*m_bindings)['S'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_read_throttle), 5);
(*m_bindings)['X'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_read_throttle), -5);
(*m_bindings)['D'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_read_throttle), 50);
(*m_bindings)['C'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_read_throttle), -50);
(*m_bindings)['\x13'] = sigc::mem_fun(*this, &DownloadList::receive_start_download);
(*m_bindings)['\x04'] = sigc::mem_fun(*this, &DownloadList::receive_stop_download);
+2 -1
View File
@@ -92,7 +92,8 @@ private:
void receive_next();
void receive_prev();
void receive_throttle(int t);
void receive_read_throttle(int t);
void receive_write_throttle(int t);
void receive_start_download();
void receive_stop_download();