* Converted some internal sigc++ calls to lightweight function

wrappers.

* Some client code cleanup.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@576 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-10-04 11:06:06 +00:00
parent 33b7217627
commit 65573ec1ee
18 changed files with 120 additions and 99 deletions
+23 -23
View File
@@ -41,7 +41,7 @@
#include <netinet/in.h>
#include "utils/directory.h"
#include "ui/control.h"
#include "control.h"
#include "option_handler_rules.h"
void receive_tracker_dump(std::istream* s);
@@ -115,22 +115,22 @@ validate_throttle_interval(int arg) {
}
void
apply_download_min_peers(ui::Control* m, int arg) {
apply_download_min_peers(Control* m, int arg) {
m->get_core().get_download_list().slot_map_insert()["1_min_peers"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_peers_min>), arg);
}
void
apply_download_max_peers(ui::Control* m, int arg) {
apply_download_max_peers(Control* m, int arg) {
m->get_core().get_download_list().slot_map_insert()["1_max_peers"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_peers_max>), arg);
}
void
apply_download_max_uploads(ui::Control* m, int arg) {
apply_download_max_uploads(Control* m, int arg) {
m->get_core().get_download_list().slot_map_insert()["1_max_uploads"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_uploads_max>), arg);
}
void
apply_download_directory(ui::Control* m, const std::string& arg) {
apply_download_directory(Control* m, const std::string& arg) {
if (!arg.empty())
m->get_core().get_download_list().slot_map_insert()["1_directory"] = sigc::bind(sigc::mem_fun(&core::Download::set_root_directory), arg);
else
@@ -138,69 +138,69 @@ apply_download_directory(ui::Control* m, const std::string& arg) {
}
void
apply_connection_leech(ui::Control* m, const std::string& arg) {
apply_connection_leech(Control* m, const std::string& arg) {
m->get_core().get_download_list().slot_map_insert()["1_connection_leech"] = sigc::bind(sigc::mem_fun(&core::Download::set_connection_leech), arg);
}
void
apply_connection_seed(ui::Control* m, const std::string& arg) {
apply_connection_seed(Control* m, const std::string& arg) {
m->get_core().get_download_list().slot_map_insert()["1_connection_seed"] = sigc::bind(sigc::mem_fun(&core::Download::set_connection_seed), arg);
}
void
apply_global_download_rate(ui::Control* m, int arg) {
apply_global_download_rate(Control* m, int arg) {
torrent::set_down_throttle(arg * 1024);
}
void
apply_global_upload_rate(ui::Control* m, int arg) {
apply_global_upload_rate(Control* m, int arg) {
torrent::set_up_throttle(arg * 1024);
}
void
apply_hash_read_ahead(ui::Control* m, int arg) {
apply_hash_read_ahead(Control* m, int arg) {
torrent::set_hash_read_ahead(arg << 20);
}
void
apply_hash_interval(ui::Control* m, int arg) {
apply_hash_interval(Control* m, int arg) {
torrent::set_hash_interval(arg * 1000);
}
void
apply_hash_max_tries(ui::Control* m, int arg) {
apply_hash_max_tries(Control* m, int arg) {
torrent::set_hash_max_tries(arg);
}
void
apply_max_open_files(ui::Control* m, int arg) {
apply_max_open_files(Control* m, int arg) {
torrent::set_max_open_files(arg);
}
void
apply_max_open_sockets(ui::Control* m, int arg) {
apply_max_open_sockets(Control* m, int arg) {
torrent::set_max_open_sockets(arg);
}
void
apply_throttle_interval(ui::Control* m, int arg) {
apply_throttle_interval(Control* m, int arg) {
torrent::set_throttle_interval(arg * 1000);
}
void
apply_bind(ui::Control* m, const std::string& arg) {
apply_bind(Control* m, const std::string& arg) {
torrent::set_bind_address(arg);
}
void
apply_ip(ui::Control* m, const std::string& arg) {
apply_ip(Control* m, const std::string& arg) {
torrent::set_local_address(arg);
}
// The arg string *must* have been checked with validate_port_range
// first.
void
apply_port_range(ui::Control* m, const std::string& arg) {
apply_port_range(Control* m, const std::string& arg) {
int a = 0, b = 0;
std::sscanf(arg.c_str(), "%i-%i", &a, &b);
@@ -209,12 +209,12 @@ apply_port_range(ui::Control* m, const std::string& arg) {
}
void
apply_port_random(ui::Control* m, const std::string& arg) {
apply_port_random(Control* m, const std::string& arg) {
m->get_core().set_port_random(arg == "yes");
}
void
apply_tracker_dump(ui::Control* m, const std::string& arg) {
apply_tracker_dump(Control* m, const std::string& arg) {
if (arg == "yes")
m->get_core().get_download_list().slot_map_insert()["1_tracker_dump"] = sigc::bind(sigc::mem_fun(&core::Download::call<sigc::connection, torrent::Download::SlotIStream, &torrent::Download::signal_tracker_dump>), sigc::ptr_fun(&receive_tracker_dump));
else
@@ -222,7 +222,7 @@ apply_tracker_dump(ui::Control* m, const std::string& arg) {
}
void
apply_use_udp_trackers(ui::Control* m, const std::string& arg) {
apply_use_udp_trackers(Control* m, const std::string& arg) {
if (arg == "yes")
m->get_core().get_download_list().slot_map_insert().erase("1_use_udp_trackers");
else
@@ -230,7 +230,7 @@ apply_use_udp_trackers(ui::Control* m, const std::string& arg) {
}
void
apply_check_hash(ui::Control* m, const std::string& arg) {
apply_check_hash(Control* m, const std::string& arg) {
if (arg == "yes")
m->get_core().set_check_hash(true);
else
@@ -238,6 +238,6 @@ apply_check_hash(ui::Control* m, const std::string& arg) {
}
void
apply_session_directory(ui::Control* m, const std::string& arg) {
apply_session_directory(Control* m, const std::string& arg) {
m->get_core().get_download_store().use(arg);
}