Cleaned up option_handler_rules.*, it now uses the slot_map_* properly.

Erases the screen upon quit.

Added option for checking the hash for completed downloads.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@471 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-06-21 16:23:34 +00:00
parent 7e77635353
commit bc27fd19cb
11 changed files with 122 additions and 108 deletions
+18 -16
View File
@@ -89,7 +89,7 @@ do_shutdown(ui::Control* c) {
// Close all torrents, this will stop all tracker connections and cause
// a quick shutdown.
std::for_each(c->get_core().get_download_list().begin(), c->get_core().get_download_list().end(),
std::mem_fun(&core::Download::close));
std::mem_fun(&core::Download::call<void, &torrent::Download::close>));
}
}
@@ -113,23 +113,22 @@ parse_options(ui::Control* c, OptionHandler* optionHandler, int argc, char** arg
void
initialize_option_handler(ui::Control* c, OptionHandler* optionHandler) {
core::DownloadSlotMap* dsmInsert = &c->get_core().get_download_list().slot_map_insert();
optionHandler->insert("min_peers", new OptionHandlerDownloadInt(dsmInsert, &apply_download_min_peers, &validate_download_peers));
optionHandler->insert("max_peers", new OptionHandlerDownloadInt(dsmInsert, &apply_download_max_peers, &validate_download_peers));
optionHandler->insert("max_uploads", new OptionHandlerDownloadInt(dsmInsert, &apply_download_max_uploads, &validate_download_peers));
optionHandler->insert("max_peers", new OptionHandlerInt(c, &apply_download_max_peers, &validate_download_peers));
optionHandler->insert("max_uploads", new OptionHandlerInt(c, &apply_download_max_uploads, &validate_download_peers));
optionHandler->insert("min_peers", new OptionHandlerInt(c, &apply_download_min_peers, &validate_download_peers));
optionHandler->insert("download_rate", new OptionHandlerInt(c, &apply_global_download_rate, &validate_rate));
optionHandler->insert("upload_rate", new OptionHandlerInt(c, &apply_global_upload_rate, &validate_rate));
optionHandler->insert("hash_read_ahead", new OptionHandlerInt(c, &apply_hash_read_ahead, &validate_read_ahead));
optionHandler->insert("max_open_files", new OptionHandlerInt(c, &apply_max_open_files, &validate_fd));
optionHandler->insert("upload_rate", new OptionHandlerInt(c, &apply_global_upload_rate, &validate_rate));
optionHandler->insert("directory", new OptionHandlerDownloadString(dsmInsert, &apply_download_directory, &validate_directory));
optionHandler->insert("dump_tracker", new OptionHandlerDownloadString(dsmInsert, &apply_download_dump_tracker, &validate_yes_no));
optionHandler->insert("check_hash", new OptionHandlerString(c, &apply_check_hash, &validate_yes_no));
optionHandler->insert("directory", new OptionHandlerString(c, &apply_download_directory, &validate_directory));
optionHandler->insert("tracker_dump", new OptionHandlerString(c, &apply_tracker_dump, &validate_yes_no));
optionHandler->insert("ip", new OptionHandlerString(c, &apply_ip, &validate_ip));
optionHandler->insert("bind", new OptionHandlerString(c, &apply_bind, &validate_ip));
optionHandler->insert("port", new OptionHandlerString(c, &apply_port_range, &validate_port_range));
optionHandler->insert("bind", new OptionHandlerString(c, &apply_bind, &validate_ip));
optionHandler->insert("ip", new OptionHandlerString(c, &apply_ip, &validate_ip));
optionHandler->insert("port", new OptionHandlerString(c, &apply_port_range, &validate_port_range));
}
void
@@ -231,10 +230,13 @@ main(int argc, char** argv) {
}
uiRoot.cleanup();
display::Canvas::cleanup();
uiControl.get_core().cleanup();
display::Canvas::erase_std();
display::Canvas::refresh_std();
display::Canvas::do_update();
display::Canvas::cleanup();
} catch (std::exception& e) {
display::Canvas::cleanup();
@@ -247,7 +249,7 @@ main(int argc, char** argv) {
void
do_panic(int signum) {
// Use the default signal handler in the future to avoid infint
// Use the default signal handler in the future to avoid infinit
// loops.
SignalHandler::set_default(signum);
display::Canvas::cleanup();
@@ -275,7 +277,7 @@ do_panic(int signum) {
}
void
receive_dump_tracker(std::istream* s) {
receive_tracker_dump(std::istream* s) {
std::stringstream filename;
filename << "./tracker_dump." << utils::Timer::current().sec();