diff --git a/src/command_download.cc b/src/command_download.cc index d9cabb43..76544c0d 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -782,6 +782,12 @@ initialize_command_download() { CMD2_DL_VALUE_V ("d.peers_max.set", std::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, std::placeholders::_2)); CMD2_DL ("d.uploads_max", std::bind(&torrent::Download::uploads_max, CMD2_BIND_DL)); CMD2_DL_VALUE_V ("d.uploads_max.set", std::bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL ("d.uploads_min", std::bind(&torrent::Download::uploads_min, CMD2_BIND_DL)); + CMD2_DL_VALUE_V ("d.uploads_min.set", std::bind(&torrent::Download::set_uploads_min, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL ("d.downloads_max", std::bind(&torrent::Download::downloads_max, CMD2_BIND_DL)); + CMD2_DL_VALUE_V ("d.downloads_max.set", std::bind(&torrent::Download::set_downloads_max, CMD2_BIND_DL, std::placeholders::_2)); + CMD2_DL ("d.downloads_min", std::bind(&torrent::Download::downloads_min, CMD2_BIND_DL)); + CMD2_DL_VALUE_V ("d.downloads_min.set", std::bind(&torrent::Download::set_downloads_min, CMD2_BIND_DL, std::placeholders::_2)); CMD2_DL ("d.peers_connected", std::bind(&torrent::ConnectionList::size, CMD2_BIND_CL)); CMD2_DL ("d.peers_not_connected", std::bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL)); diff --git a/src/display/window_download_statusbar.cc b/src/display/window_download_statusbar.cc index 00783cbc..c69bc01c 100644 --- a/src/display/window_download_statusbar.cc +++ b/src/display/window_download_statusbar.cc @@ -68,12 +68,15 @@ WindowDownloadStatusbar::redraw() { position = print_download_info(buffer, last, m_download); m_canvas->print(0, 0, "%s", buffer); - position = buffer + std::min(std::max(snprintf(buffer, last - buffer, "Peers: %i(%i) Min/Max: %i/%i Uploads: %i U/I/C/A: %i/%i/%i/%i Unchoked: %u/%u Failed: %i", + position = buffer + std::min(std::max(snprintf(buffer, last - buffer, "Peers: %i(%i) Min/Max: %i/%i Slots: U:%i/%i D:%i/%i U/I/C/A: %i/%i/%i/%i Unchoked: %u/%u Failed: %i", (int)m_download->download()->connection_list()->size(), (int)m_download->download()->peer_list()->available_list_size(), (int)m_download->download()->connection_list()->min_size(), (int)m_download->download()->connection_list()->max_size(), + (int)m_download->download()->uploads_min(), (int)m_download->download()->uploads_max(), + (int)m_download->download()->downloads_min(), + (int)m_download->download()->downloads_max(), (int)m_download->download()->peers_currently_unchoked(), (int)m_download->download()->peers_currently_interested(), (int)m_download->download()->peers_complete(), diff --git a/src/ui/download.cc b/src/ui/download.cc index e2395576..a772d26f 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -303,6 +303,27 @@ Download::receive_max_uploads(int t) { m_download->download()->set_uploads_max(std::max(m_download->download()->uploads_max() + t, 0)); } +void +Download::receive_min_uploads(int t) { + m_windowDownloadStatus->mark_dirty(); + + m_download->download()->set_uploads_min(std::max(m_download->download()->uploads_min() + t, 0)); +} + +void +Download::receive_max_downloads(int t) { + m_windowDownloadStatus->mark_dirty(); + + m_download->download()->set_downloads_max(std::max(m_download->download()->downloads_max() + t, 0)); +} + +void +Download::receive_min_downloads(int t) { + m_windowDownloadStatus->mark_dirty(); + + m_download->download()->set_downloads_min(std::max(m_download->download()->downloads_min() + t, 0)); +} + void Download::receive_min_peers(int t) { m_windowDownloadStatus->mark_dirty(); @@ -355,12 +376,18 @@ Download::adjust_up_throttle(int throttle) { void Download::bind_keys() { - 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); - m_bindings['3'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), -5); - m_bindings['4'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), 5); - m_bindings['5'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), -5); - m_bindings['6'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), 5); + m_bindings['1'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_uploads), -1); + m_bindings['2'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_uploads), 1); + m_bindings['3'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), -1); + m_bindings['4'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), 1); + m_bindings['!'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_downloads), -1); + m_bindings['@'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_downloads), 1); + m_bindings['#'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_downloads), -1); + m_bindings['$'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_downloads), 1); + m_bindings['5'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), -5); + m_bindings['6'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), 5); + m_bindings['7'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), -5); + m_bindings['8'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), 5); m_bindings['+'] = sigc::mem_fun(this, &Download::receive_next_priority); m_bindings['-'] = sigc::mem_fun(this, &Download::receive_prev_priority); diff --git a/src/ui/download.h b/src/ui/download.h index 3a21da0d..bedf523e 100644 --- a/src/ui/download.h +++ b/src/ui/download.h @@ -99,7 +99,10 @@ private: inline ElementBase* create_menu(); inline ElementBase* create_info(); + void receive_min_uploads(int t); void receive_max_uploads(int t); + void receive_min_downloads(int t); + void receive_max_downloads(int t); void receive_min_peers(int t); void receive_max_peers(int t);