diff --git a/src/command_events.cc b/src/command_events.cc index 65d18228..c66fb627 100644 --- a/src/command_events.cc +++ b/src/command_events.cc @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include diff --git a/src/command_ui.cc b/src/command_ui.cc index d5a6a5c8..2456ca71 100644 --- a/src/command_ui.cc +++ b/src/command_ui.cc @@ -41,7 +41,6 @@ #include #include #include -#include #include "core/manager.h" #include "core/view_manager.h" diff --git a/src/control.cc b/src/control.cc index e1893883..cb58c2f2 100644 --- a/src/control.cc +++ b/src/control.cc @@ -76,7 +76,7 @@ Control::Control() : m_viewManager = new core::ViewManager(); m_dhtManager = new core::DhtManager(); - m_inputStdin->slot_pressed(sigc::mem_fun(m_input, &input::Manager::pressed)); + m_inputStdin->slot_pressed(std::tr1::bind(&input::Manager::pressed, m_input, std::tr1::placeholders::_1)); m_taskShutdown.slot() = std::tr1::bind(&Control::handle_shutdown, this); diff --git a/src/core/curl_get.h b/src/core/curl_get.h index 634feffe..88339c88 100644 --- a/src/core/curl_get.h +++ b/src/core/curl_get.h @@ -40,7 +40,6 @@ #include #include #include -#include #include #include "rak/priority_queue_default.h" diff --git a/src/core/curl_stack.cc b/src/core/curl_stack.cc index 2153ab24..f0e6e8ec 100644 --- a/src/core/curl_stack.cc +++ b/src/core/curl_stack.cc @@ -38,7 +38,6 @@ #include #include -#include #include #include "rak/functional.h" diff --git a/src/core/curl_stack.h b/src/core/curl_stack.h index 9bd2f3aa..d17f825c 100644 --- a/src/core/curl_stack.h +++ b/src/core/curl_stack.h @@ -39,7 +39,6 @@ #include #include -#include #include "rak/priority_queue_default.h" diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index 0ac36ba2..d3d23f63 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -216,7 +216,7 @@ DownloadFactory::receive_success() { if (download == NULL) { // core::Manager should already have added the error message to // the log. - m_slotFinished(); + m_slot_finished(); return; } @@ -304,7 +304,7 @@ DownloadFactory::receive_success() { // ATM doesn't really ever get here. delete download; - m_slotFinished(); + m_slot_finished(); return; } @@ -341,7 +341,7 @@ DownloadFactory::receive_success() { } } - m_slotFinished(); + m_slot_finished(); } void @@ -376,7 +376,7 @@ DownloadFactory::receive_failed(const std::string& msg) { if (m_printLog) m_manager->push_log_std(msg + ": \"" + m_uri + "\""); - m_slotFinished(); + m_slot_finished(); } void diff --git a/src/core/download_factory.h b/src/core/download_factory.h index 59d83f0f..8d054466 100644 --- a/src/core/download_factory.h +++ b/src/core/download_factory.h @@ -42,9 +42,9 @@ #define RTORRENT_CORE_DOWNLOAD_FACTORY_H #include -#include #include #include +#include #include "http_queue.h" @@ -54,7 +54,7 @@ class Manager; class DownloadFactory { public: - typedef sigc::slot Slot; + typedef std::tr1::function slot_void; typedef std::vector command_list_type; // Do not destroy this object while it is in a HttpQueue. @@ -80,7 +80,7 @@ public: bool print_log() const { return m_printLog; } void set_print_log(bool v) { m_printLog = v; } - void slot_finished(Slot s) { m_slotFinished = s; } + void slot_finished(slot_void s) { m_slot_finished = s; } private: void receive_load(); @@ -109,7 +109,7 @@ private: command_list_type m_commands; torrent::Object::map_type m_variables; - Slot m_slotFinished; + slot_void m_slot_finished; rak::priority_item m_taskLoad; rak::priority_item m_taskCommit; }; diff --git a/src/core/download_list.cc b/src/core/download_list.cc index 7d7ea96a..125c26e7 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include diff --git a/src/core/download_slot_map.h b/src/core/download_slot_map.h index 2d996ef3..5b4f921b 100644 --- a/src/core/download_slot_map.h +++ b/src/core/download_slot_map.h @@ -39,19 +39,19 @@ #include #include -#include +#include #include "download.h" namespace core { -class DownloadSlotMap : public std::map > { +class DownloadSlotMap : public std::map > { public: - typedef sigc::slot1 SlotDownload; - typedef std::map Base; + typedef std::tr1::function slot_download; + typedef std::map Base; - void insert(const std::string& key, SlotDownload s) { Base::operator[](key) = s; } - void erase(const std::string& key) { Base::erase(key); } + void insert(const std::string& key, slot_download s) { Base::operator[](key) = s; } + void erase(const std::string& key) { Base::erase(key); } void for_each(Download* d); }; diff --git a/src/core/http_queue.cc b/src/core/http_queue.cc index 76b2a659..d65d5ba2 100644 --- a/src/core/http_queue.cc +++ b/src/core/http_queue.cc @@ -38,8 +38,6 @@ #include #include -#include -#include #include #include "rak/functional.h" @@ -50,7 +48,7 @@ namespace core { HttpQueue::iterator HttpQueue::insert(const std::string& url, std::iostream* s) { - std::auto_ptr h(m_slotFactory()); + std::auto_ptr h(m_slot_factory()); h->set_url(url); h->set_stream(s); diff --git a/src/core/http_queue.h b/src/core/http_queue.h index ef0204b1..88e3df77 100644 --- a/src/core/http_queue.h +++ b/src/core/http_queue.h @@ -40,6 +40,7 @@ #include #include #include +#include namespace core { @@ -47,9 +48,9 @@ class CurlGet; class HttpQueue : private std::list { public: - typedef std::list Base; - typedef sigc::signal1 SignalHttp; - typedef sigc::slot0 SlotFactory; + typedef std::list Base; + typedef sigc::signal1 SignalHttp; + typedef std::tr1::function slot_factory; using Base::iterator; using Base::const_iterator; @@ -77,13 +78,13 @@ public: void clear(); - void slot_factory(SlotFactory s) { m_slotFactory = s; } + void set_slot_factory(slot_factory s) { m_slot_factory = s; } - SignalHttp& signal_insert() { return m_signalInsert; } - SignalHttp& signal_erase() { return m_signalErase; } + SignalHttp& signal_insert() { return m_signalInsert; } + SignalHttp& signal_erase() { return m_signalErase; } private: - SlotFactory m_slotFactory; + slot_factory m_slot_factory; SignalHttp m_signalInsert; SignalHttp m_signalErase; }; diff --git a/src/core/manager.cc b/src/core/manager.cc index 63b53443..7cd58b76 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -147,7 +147,7 @@ Manager::get_address_throttle(const sockaddr* addr) { void Manager::initialize_second() { torrent::Http::slot_factory() = std::tr1::bind(&CurlStack::new_object, m_httpStack); - m_httpQueue->slot_factory(sigc::mem_fun(m_httpStack, &CurlStack::new_object)); + m_httpQueue->set_slot_factory(std::tr1::bind(&CurlStack::new_object, m_httpStack)); CurlStack::global_init(); } @@ -332,7 +332,7 @@ Manager::try_create_download(const std::string& uri, int flags, const command_li f->set_start(flags & create_start); f->set_print_log(!(flags & create_quiet)); - f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func), f)); + f->slot_finished(std::tr1::bind(&rak::call_delete_func, f)); if (flags & create_raw_data) f->load_raw_data(uri); @@ -356,7 +356,7 @@ Manager::try_create_download_from_meta_download(torrent::Object* bencode, const f->set_start(meta.get_key_value("start")); f->set_print_log(meta.get_key_value("print_log")); - f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func), f)); + f->slot_finished(std::tr1::bind(&rak::call_delete_func, f)); // Bit of a waste to create the bencode repesentation here // only to have the DownloadFactory decode it. diff --git a/src/core/manager.h b/src/core/manager.h index cfdae66e..d0f6dd85 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -69,8 +69,8 @@ public: typedef DownloadList::iterator DListItr; typedef utils::FileStatusCache FileStatusCache; - typedef sigc::slot1 SlotReady; - typedef sigc::slot0 SlotFailed; + // typedef std::tr1::function slot_ready; + // typedef std::tr1::function slot_void; Manager(); ~Manager(); diff --git a/src/core/view.cc b/src/core/view.cc index d1969449..871f98ee 100644 --- a/src/core/view.cc +++ b/src/core/view.cc @@ -40,7 +40,6 @@ #include #include #include -#include #include #include diff --git a/src/input/bindings.h b/src/input/bindings.h index 6e3b0a9c..c5591b27 100644 --- a/src/input/bindings.h +++ b/src/input/bindings.h @@ -38,31 +38,31 @@ #define RTORRENT_INPUT_BINDINGS_H #include -#include +#include #include "display/attributes.h" namespace input { -class Bindings : private std::map > { +class Bindings : private std::map > { public: - typedef sigc::slot0 Slot; - typedef std::map Base; + typedef std::tr1::function slot_void; + typedef std::map base_type; - using Base::iterator; - using Base::const_iterator; - using Base::reverse_iterator; - using Base::const_reverse_iterator; + using base_type::iterator; + using base_type::const_iterator; + using base_type::reverse_iterator; + using base_type::const_reverse_iterator; - using Base::begin; - using Base::end; - using Base::rbegin; - using Base::rend; - using Base::find; + using base_type::begin; + using base_type::end; + using base_type::rbegin; + using base_type::rend; + using base_type::find; - using Base::erase; + using base_type::erase; - using Base::operator[]; + using base_type::operator[]; Bindings() : m_enabled(true) {} @@ -71,7 +71,7 @@ public: bool pressed(int key); - void ignore(int key) { (*this)[key] = Slot(); } + void ignore(int key) { (*this)[key] = slot_void(); } private: bool m_enabled; diff --git a/src/input/input_event.h b/src/input/input_event.h index a6e946f7..3e3c9a55 100644 --- a/src/input/input_event.h +++ b/src/input/input_event.h @@ -37,15 +37,15 @@ #ifndef RTORRENT_INPUT_INPUT_EVENT_H #define RTORRENT_INPUT_INPUT_EVENT_H -#include #include #include +#include namespace input { class InputEvent : public torrent::Event { public: - typedef sigc::slot SlotInt; + typedef std::tr1::function slot_int; InputEvent(int fd) { m_fileDesc = fd; } @@ -56,10 +56,10 @@ public: void event_write(); void event_error(); - void slot_pressed(SlotInt s) { m_slotPressed = s; } + void slot_pressed(slot_int s) { m_slotPressed = s; } private: - SlotInt m_slotPressed; + slot_int m_slotPressed; }; } diff --git a/src/input/text_input.cc b/src/input/text_input.cc index abb6aa7f..206470eb 100644 --- a/src/input/text_input.cc +++ b/src/input/text_input.cc @@ -123,7 +123,7 @@ TextInput::pressed(int key) { } } - m_slotDirty(); + mark_dirty(); return true; } diff --git a/src/input/text_input.h b/src/input/text_input.h index 265ce7cd..f51949d3 100644 --- a/src/input/text_input.h +++ b/src/input/text_input.h @@ -45,8 +45,8 @@ namespace input { class TextInput : private std::string { public: - typedef std::string Base; - typedef sigc::slot0 SlotDirty; + typedef std::string Base; + typedef std::tr1::function slot_void; using Base::c_str; using Base::empty; @@ -64,8 +64,8 @@ public: void clear() { m_pos = 0; m_alt = false; Base::clear(); } - void slot_dirty(SlotDirty s) { m_slotDirty = s; } - void mark_dirty() { m_slotDirty(); } + void slot_dirty(slot_void s) { m_slot_dirty = s; } + void mark_dirty() { if (m_slot_dirty) m_slot_dirty(); } std::string& str() { return *this; } @@ -75,7 +75,7 @@ private: size_type m_pos; bool m_alt; - SlotDirty m_slotDirty; + slot_void m_slot_dirty; Bindings m_bindings; }; diff --git a/src/main.cc b/src/main.cc index 36ace224..5e826bb1 100644 --- a/src/main.cc +++ b/src/main.cc @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -87,6 +86,7 @@ void print_help(); void initialize_commands(); void do_nothing() {} +void do_nothing_str(const std::string&) {} int parse_options(Control* c, int argc, char** argv) { @@ -94,20 +94,20 @@ parse_options(Control* c, int argc, char** argv) { OptionParser optionParser; // Converted. - optionParser.insert_flag('h', sigc::ptr_fun(&print_help)); - optionParser.insert_flag('n', OptionParser::Slot()); - optionParser.insert_flag('D', OptionParser::Slot()); - optionParser.insert_flag('I', OptionParser::Slot()); - optionParser.insert_flag('K', OptionParser::Slot()); + optionParser.insert_flag('h', std::tr1::bind(&print_help)); + optionParser.insert_flag('n', std::tr1::bind(&do_nothing_str, std::tr1::placeholders::_1)); + optionParser.insert_flag('D', std::tr1::bind(&do_nothing_str, std::tr1::placeholders::_1)); + optionParser.insert_flag('I', std::tr1::bind(&do_nothing_str, std::tr1::placeholders::_1)); + optionParser.insert_flag('K', std::tr1::bind(&do_nothing_str, std::tr1::placeholders::_1)); - optionParser.insert_option('b', sigc::bind<0>(sigc::ptr_fun(&rpc::call_command_set_string), "network.bind_address.set")); - optionParser.insert_option('d', sigc::bind<0>(sigc::ptr_fun(&rpc::call_command_set_string), "directory.default.set")); - optionParser.insert_option('i', sigc::bind<0>(sigc::ptr_fun(&rpc::call_command_set_string), "ip")); - optionParser.insert_option('p', sigc::bind<0>(sigc::ptr_fun(&rpc::call_command_set_string), "network.port_range.set")); - optionParser.insert_option('s', sigc::bind<0>(sigc::ptr_fun(&rpc::call_command_set_string), "session")); + optionParser.insert_option('b', std::tr1::bind(&rpc::call_command_set_string, "network.bind_address.set", std::tr1::placeholders::_1)); + optionParser.insert_option('d', std::tr1::bind(&rpc::call_command_set_string, "directory.default.set", std::tr1::placeholders::_1)); + optionParser.insert_option('i', std::tr1::bind(&rpc::call_command_set_string, "ip", std::tr1::placeholders::_1)); + optionParser.insert_option('p', std::tr1::bind(&rpc::call_command_set_string, "network.port_range.set", std::tr1::placeholders::_1)); + optionParser.insert_option('s', std::tr1::bind(&rpc::call_command_set_string, "session", std::tr1::placeholders::_1)); - optionParser.insert_option('O', sigc::ptr_fun(&rpc::parse_command_single_std)); - optionParser.insert_option_list('o', sigc::ptr_fun(&rpc::call_command_set_std_string)); + optionParser.insert_option('O', std::tr1::bind(&rpc::parse_command_single_std, std::tr1::placeholders::_1)); + optionParser.insert_option_list('o', std::tr1::bind(&rpc::call_command_set_std_string, std::tr1::placeholders::_1, std::tr1::placeholders::_2)); return optionParser.process(argc, argv); @@ -131,7 +131,7 @@ load_session_torrents(Control* c) { // Replace with session torrent flag. f->set_session(true); - f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func), f)); + f->slot_finished(std::tr1::bind(&rak::call_delete_func, f)); f->load(entries.path() + first->d_name); f->commit(); } @@ -145,7 +145,7 @@ load_arg_torrents(Control* c, char** first, char** last) { // Replace with session torrent flag. f->set_start(true); - f->slot_finished(sigc::bind(sigc::ptr_fun(&rak::call_delete_func), f)); + f->slot_finished(std::tr1::bind(&rak::call_delete_func, f)); f->load(*first); f->commit(); } @@ -194,12 +194,12 @@ main(int argc, char** argv) { srand48(cachedTime.usec() ^ (getpid() << 16) ^ getppid()); SignalHandler::set_ignore(SIGPIPE); - SignalHandler::set_handler(SIGINT, sigc::mem_fun(control, &Control::receive_normal_shutdown)); - SignalHandler::set_handler(SIGTERM, sigc::mem_fun(control, &Control::receive_quick_shutdown)); - SignalHandler::set_handler(SIGWINCH, sigc::mem_fun(control->display(), &display::Manager::force_redraw)); - SignalHandler::set_handler(SIGSEGV, sigc::bind(sigc::ptr_fun(&do_panic), SIGSEGV)); - SignalHandler::set_handler(SIGILL, sigc::bind(sigc::ptr_fun(&do_panic), SIGILL)); - SignalHandler::set_handler(SIGFPE, sigc::bind(sigc::ptr_fun(&do_panic), SIGFPE)); + SignalHandler::set_handler(SIGINT, std::tr1::bind(&Control::receive_normal_shutdown, control)); + SignalHandler::set_handler(SIGTERM, std::tr1::bind(&Control::receive_quick_shutdown, control)); + SignalHandler::set_handler(SIGWINCH, std::tr1::bind(&display::Manager::force_redraw, control->display())); + SignalHandler::set_handler(SIGSEGV, std::tr1::bind(&do_panic, SIGSEGV)); + SignalHandler::set_handler(SIGILL, std::tr1::bind(&do_panic, SIGILL)); + SignalHandler::set_handler(SIGFPE, std::tr1::bind(&do_panic, SIGFPE)); SignalHandler::set_sigaction_handler(SIGBUS, &handle_sigbus); @@ -211,7 +211,7 @@ main(int argc, char** argv) { // threads. Use '--enable-interrupt-socket' when configuring // LibTorrent to enable this workaround. if (torrent::thread_base::should_handle_sigusr1()) - SignalHandler::set_handler(SIGUSR1, sigc::ptr_fun(&do_nothing)); + SignalHandler::set_handler(SIGUSR1, std::tr1::bind(&do_nothing)); torrent::log_add_group_output(torrent::LOG_NOTICE, "important"); torrent::log_add_group_output(torrent::LOG_INFO, "complete"); diff --git a/src/option_parser.cc b/src/option_parser.cc index b61541cc..52683675 100644 --- a/src/option_parser.cc +++ b/src/option_parser.cc @@ -43,32 +43,30 @@ #include #include #include -#include -#include #include "option_parser.h" void -OptionParser::insert_flag(char c, Slot s) { - m_container[c].m_slot = sigc::hide(s); +OptionParser::insert_flag(char c, slot_string s) { + m_container[c].m_slot = s; m_container[c].m_useOption = false; } void -OptionParser::insert_option(char c, SlotString s) { +OptionParser::insert_option(char c, slot_string s) { m_container[c].m_slot = s; m_container[c].m_useOption = true; } void -OptionParser::insert_option_list(char c, SlotStringPair s) { - m_container[c].m_slot = sigc::bind<0>(sigc::ptr_fun(&OptionParser::call_option_list), s); +OptionParser::insert_option_list(char c, slot_string_pair s) { + m_container[c].m_slot = std::tr1::bind(&OptionParser::call_option_list, s, std::tr1::placeholders::_1); m_container[c].m_useOption = true; } void -OptionParser::insert_int_pair(char c, SlotIntPair s) { - m_container[c].m_slot = sigc::bind<0>(sigc::ptr_fun(&OptionParser::call_int_pair), s); +OptionParser::insert_int_pair(char c, slot_int_pair s) { + m_container[c].m_slot = std::tr1::bind(&OptionParser::call_int_pair, s, std::tr1::placeholders::_1); m_container[c].m_useOption = true; } @@ -118,7 +116,7 @@ OptionParser::call(char c, const std::string& arg) { } void -OptionParser::call_option_list(SlotStringPair slot, const std::string& arg) { +OptionParser::call_option_list(slot_string_pair slot, const std::string& arg) { std::string::const_iterator itr = arg.begin(); while (itr != arg.end()) { @@ -138,7 +136,7 @@ OptionParser::call_option_list(SlotStringPair slot, const std::string& arg) { } void -OptionParser::call_int_pair(SlotIntPair slot, const std::string& arg) { +OptionParser::call_int_pair(slot_int_pair slot, const std::string& arg) { int a, b; if (std::sscanf(arg.c_str(), "%u-%u", &a, &b) != 2) diff --git a/src/option_parser.h b/src/option_parser.h index 82ae0e4d..23bc0b03 100644 --- a/src/option_parser.h +++ b/src/option_parser.h @@ -39,21 +39,20 @@ #include #include -#include +#include // Throws std::runtime_error upon receiving bad input. class OptionParser { public: - typedef sigc::slot0 Slot; - typedef sigc::slot1 SlotString; - typedef sigc::slot2 SlotStringPair; - typedef sigc::slot2 SlotIntPair; + typedef std::tr1::function slot_string; + typedef std::tr1::function slot_string_pair; + typedef std::tr1::function slot_int_pair; - void insert_flag(char c, Slot s); - void insert_option(char c, SlotString s); - void insert_option_list(char c, SlotStringPair s); - void insert_int_pair(char c, SlotIntPair s); + void insert_flag(char c, slot_string s); + void insert_option(char c, slot_string s); + void insert_option_list(char c, slot_string_pair s); + void insert_int_pair(char c, slot_int_pair s); // Returns the index of the first non-option argument. int process(int argc, char** argv); @@ -64,12 +63,12 @@ private: std::string create_optstring(); void call(char c, const std::string& arg); - static void call_option_list(SlotStringPair slot, const std::string& arg); - static void call_int_pair(SlotIntPair slot, const std::string& arg); + static void call_option_list(slot_string_pair slot, const std::string& arg); + static void call_int_pair(slot_int_pair slot, const std::string& arg); // Use pair instead? struct Node { - SlotString m_slot; + slot_string m_slot; bool m_useOption; }; diff --git a/src/signal_handler.cc b/src/signal_handler.cc index f7fd7ccb..6e5de504 100644 --- a/src/signal_handler.cc +++ b/src/signal_handler.cc @@ -46,7 +46,7 @@ //extern "C" void (*signal (int sig, void (*disp)(int)))(int); #endif -SignalHandler::Slot SignalHandler::m_handlers[HIGHEST_SIGNAL]; +SignalHandler::slot_void SignalHandler::m_handlers[HIGHEST_SIGNAL]; void SignalHandler::set_default(unsigned int signum) { @@ -54,7 +54,7 @@ SignalHandler::set_default(unsigned int signum) { throw std::logic_error("SignalHandler::set_default(...) received invalid signal value."); signal(signum, SIG_DFL); - m_handlers[signum].disconnect(); + m_handlers[signum] = slot_void(); } void @@ -63,15 +63,15 @@ SignalHandler::set_ignore(unsigned int signum) { throw std::logic_error("SignalHandler::set_ignore(...) received invalid signal value."); signal(signum, SIG_IGN); - m_handlers[signum].disconnect(); + m_handlers[signum] = slot_void(); } void -SignalHandler::set_handler(unsigned int signum, Slot slot) { +SignalHandler::set_handler(unsigned int signum, slot_void slot) { if (signum > HIGHEST_SIGNAL) throw std::logic_error("SignalHandler::set_handler(...) received invalid signal value."); - if (slot.empty()) + if (!slot) throw std::logic_error("SignalHandler::set_handler(...) received an empty slot."); signal(signum, &SignalHandler::caught); @@ -98,7 +98,7 @@ SignalHandler::caught(int signum) { if ((unsigned)signum > HIGHEST_SIGNAL) throw std::logic_error("SignalHandler::caught(...) received invalid signal from the kernel, bork bork bork."); - if (m_handlers[signum].empty()) + if (!m_handlers[signum]) throw std::logic_error("SignalHandler::caught(...) received a signal we don't have a handler for."); m_handlers[signum](); diff --git a/src/signal_handler.h b/src/signal_handler.h index 55403e97..a6aba468 100644 --- a/src/signal_handler.h +++ b/src/signal_handler.h @@ -38,11 +38,11 @@ #define RTORRENT_SIGNAL_HANDLER_H #include -#include +#include class SignalHandler { public: - typedef sigc::slot0 Slot; + typedef std::tr1::function slot_void; // typedef void (*handler_slot)(int, siginfo_t *info, ucontext_t *uap); typedef void (*handler_slot)(int, siginfo_t*, void*); @@ -56,7 +56,7 @@ public: static void set_default(unsigned int signum); static void set_ignore(unsigned int signum); - static void set_handler(unsigned int signum, Slot slot); + static void set_handler(unsigned int signum, slot_void slot); static void set_sigaction_handler(unsigned int signum, handler_slot slot); @@ -65,7 +65,7 @@ public: private: static void caught(int signum); - static Slot m_handlers[HIGHEST_SIGNAL]; + static slot_void m_handlers[HIGHEST_SIGNAL]; }; #endif diff --git a/src/ui/download.cc b/src/ui/download.cc index 4f975f59..c6ce5c5c 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -36,7 +36,6 @@ #include "config.h" -#include #include #include #include @@ -85,13 +84,13 @@ Download::Download(core::Download* d) : m_uiArray[DISPLAY_CHUNKS_SEEN] = new ElementChunksSeen(d); m_uiArray[DISPLAY_TRANSFER_LIST] = new ElementTransferList(d); - m_uiArray[DISPLAY_MENU]->slot_exit(sigc::mem_fun(&m_slotExit, &slot_type::operator())); - m_uiArray[DISPLAY_PEER_LIST]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_PEER_LIST)); - m_uiArray[DISPLAY_INFO]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_INFO)); - m_uiArray[DISPLAY_FILE_LIST]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_FILE_LIST)); - m_uiArray[DISPLAY_TRACKER_LIST]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRACKER_LIST)); - m_uiArray[DISPLAY_CHUNKS_SEEN]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_CHUNKS_SEEN)); - m_uiArray[DISPLAY_TRANSFER_LIST]->slot_exit(sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRANSFER_LIST)); + m_uiArray[DISPLAY_MENU]->slot_exit(std::tr1::bind(&slot_type::operator(), &m_slot_exit)); + m_uiArray[DISPLAY_PEER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_PEER_LIST)); + m_uiArray[DISPLAY_INFO]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_INFO)); + m_uiArray[DISPLAY_FILE_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_FILE_LIST)); + m_uiArray[DISPLAY_TRACKER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRACKER_LIST)); + m_uiArray[DISPLAY_CHUNKS_SEEN]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_CHUNKS_SEEN)); + m_uiArray[DISPLAY_TRANSFER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRANSFER_LIST)); bind_keys(); } @@ -110,30 +109,30 @@ Download::create_menu() { ElementMenu* element = new ElementMenu; element->push_back("Peer list", - sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_PEER_LIST), - sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_PEER_LIST)); + std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_PEER_LIST), + std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_PEER_LIST)); element->push_back("Info", - sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_INFO), - sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_INFO)); + std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_INFO), + std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_INFO)); element->push_back("File list", - sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_FILE_LIST), - sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_FILE_LIST)); + std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_FILE_LIST), + std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_FILE_LIST)); element->push_back("Tracker list", - sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_TRACKER_LIST), - sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRACKER_LIST)); + std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_TRACKER_LIST), + std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRACKER_LIST)); element->push_back("Chunks seen", - sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_CHUNKS_SEEN), - sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_CHUNKS_SEEN)); + std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_CHUNKS_SEEN), + std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_CHUNKS_SEEN)); element->push_back("Transfer list", - sigc::bind(sigc::mem_fun(this, &Download::activate_display_focus), DISPLAY_TRANSFER_LIST), - sigc::bind(sigc::mem_fun(this, &Download::activate_display_menu), DISPLAY_TRANSFER_LIST)); + std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_TRANSFER_LIST), + std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRANSFER_LIST)); element->set_entry(0, false); - m_bindings['p'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 0); - m_bindings['o'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 1); - m_bindings['i'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 2); - m_bindings['u'] = sigc::bind(sigc::mem_fun(element, &ElementMenu::set_entry_trigger), 3); + m_bindings['p'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 0); + m_bindings['o'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 1); + m_bindings['i'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 2); + m_bindings['u'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 3); return element; } @@ -376,40 +375,40 @@ Download::adjust_up_throttle(int throttle) { void Download::bind_keys() { - 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); + m_bindings['1'] = std::tr1::bind(&Download::receive_min_uploads, this, -1); + m_bindings['2'] = std::tr1::bind(&Download::receive_min_uploads, this, 1); + m_bindings['3'] = std::tr1::bind(&Download::receive_max_uploads, this, -1); + m_bindings['4'] = std::tr1::bind(&Download::receive_max_uploads, this, 1); + m_bindings['!'] = std::tr1::bind(&Download::receive_min_downloads, this, -1); + m_bindings['@'] = std::tr1::bind(&Download::receive_min_downloads, this, 1); + m_bindings['#'] = std::tr1::bind(&Download::receive_max_downloads, this, -1); + m_bindings['$'] = std::tr1::bind(&Download::receive_max_downloads, this, 1); + m_bindings['5'] = std::tr1::bind(&Download::receive_min_peers, this, -5); + m_bindings['6'] = std::tr1::bind(&Download::receive_min_peers, this, 5); + m_bindings['7'] = std::tr1::bind(&Download::receive_max_peers, this, -5); + m_bindings['8'] = std::tr1::bind(&Download::receive_max_peers, this, 5); + m_bindings['+'] = std::tr1::bind(&Download::receive_next_priority, this); + m_bindings['-'] = std::tr1::bind(&Download::receive_prev_priority, this); - m_bindings['t'] = sigc::bind(sigc::mem_fun(m_download->download(), &torrent::Download::manual_request), false); - m_bindings['T'] = sigc::bind(sigc::mem_fun(m_download->download(), &torrent::Download::manual_request), true); + m_bindings['t'] = std::tr1::bind(&torrent::Download::manual_request, m_download->download(), false); + m_bindings['T'] = std::tr1::bind(&torrent::Download::manual_request, m_download->download(), true); const char* keys = control->ui()->get_throttle_keys(); - m_bindings[keys[ 0]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), 1); - m_bindings[keys[ 1]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), -1); - m_bindings[keys[ 2]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), 1); - m_bindings[keys[ 3]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), -1); + m_bindings[keys[ 0]] = std::tr1::bind(&Download::adjust_up_throttle, this, 1); + m_bindings[keys[ 1]] = std::tr1::bind(&Download::adjust_up_throttle, this, -1); + m_bindings[keys[ 2]] = std::tr1::bind(&Download::adjust_down_throttle, this, 1); + m_bindings[keys[ 3]] = std::tr1::bind(&Download::adjust_down_throttle, this, -1); - m_bindings[keys[ 4]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), 5); - m_bindings[keys[ 5]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), -5); - m_bindings[keys[ 6]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), 5); - m_bindings[keys[ 7]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), -5); + m_bindings[keys[ 4]] = std::tr1::bind(&Download::adjust_up_throttle, this, 5); + m_bindings[keys[ 5]] = std::tr1::bind(&Download::adjust_up_throttle, this, -5); + m_bindings[keys[ 6]] = std::tr1::bind(&Download::adjust_down_throttle, this, 5); + m_bindings[keys[ 7]] = std::tr1::bind(&Download::adjust_down_throttle, this, -5); - m_bindings[keys[ 8]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), 50); - m_bindings[keys[ 9]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_up_throttle), -50); - m_bindings[keys[10]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), 50); - m_bindings[keys[11]] = sigc::bind(sigc::mem_fun(this, &Download::adjust_down_throttle), -50); + m_bindings[keys[ 8]] = std::tr1::bind(&Download::adjust_up_throttle, this, 50); + m_bindings[keys[ 9]] = std::tr1::bind(&Download::adjust_up_throttle, this, -50); + m_bindings[keys[10]] = std::tr1::bind(&Download::adjust_down_throttle, this, 50); + m_bindings[keys[11]] = std::tr1::bind(&Download::adjust_down_throttle, this, -50); } } diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index edacc9b1..78227e83 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -193,7 +193,7 @@ DownloadList::activate_display(Display displayType) { Download* download = new Download(*current_view()->focus()); download->activate(m_frame); - download->slot_exit(sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST)); + download->slot_exit(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD_LIST)); m_uiArray[DISPLAY_DOWNLOAD] = download; break; @@ -270,15 +270,15 @@ DownloadList::receive_view_input(Input type) { ElementStringList* esl = dynamic_cast(m_uiArray[DISPLAY_STRING_LIST]); - input->signal_show_next().connect(sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_STRING_LIST)); - input->signal_show_next().connect(sigc::mem_fun(*esl, &ElementStringList::next_screen)); + input->signal_show_next().connect(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST)); + input->signal_show_next().connect(std::tr1::bind(&ElementStringList::next_screen, *esl)); - input->signal_show_range().connect(sigc::hide(sigc::hide(sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_STRING_LIST)))); + input->signal_show_range().connect(sigc::hide(sigc::hide(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST)))); input->signal_show_range().connect(sigc::mem_fun(*esl, &ElementStringList::set_range_dirent)); - input->bindings()['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), type); - input->bindings()[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), type); - input->bindings()['\x07'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_exit_input), INPUT_NONE); + input->bindings()['\n'] = std::tr1::bind(&DownloadList::receive_exit_input, this, type); + input->bindings()[KEY_ENTER] = std::tr1::bind(&DownloadList::receive_exit_input, this, type); + input->bindings()['\x07'] = std::tr1::bind(&DownloadList::receive_exit_input, this, INPUT_NONE); control->ui()->enable_input(title, input); } @@ -339,20 +339,20 @@ DownloadList::receive_exit_input(Input type) { void DownloadList::setup_keys() { - m_bindings['\x7f'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_DEFAULT); - m_bindings[KEY_BACKSPACE] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_DEFAULT); - m_bindings['\n'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED); - m_bindings[KEY_ENTER] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_LOAD_MODIFIED); - m_bindings['\x0F'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_CHANGE_DIRECTORY); - m_bindings['X' - '@'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::receive_view_input), INPUT_COMMAND); + m_bindings['\x7f'] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_DEFAULT); + m_bindings[KEY_BACKSPACE] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_DEFAULT); + m_bindings['\n'] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_MODIFIED); + m_bindings[KEY_ENTER] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_MODIFIED); + m_bindings['\x0F'] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_CHANGE_DIRECTORY); + m_bindings['X' - '@'] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_COMMAND); m_uiArray[DISPLAY_LOG]->bindings()[KEY_LEFT] = m_uiArray[DISPLAY_LOG]->bindings()['B' - '@'] = - m_uiArray[DISPLAY_LOG]->bindings()[' '] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD_LIST); + m_uiArray[DISPLAY_LOG]->bindings()[' '] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD_LIST); m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()[KEY_RIGHT] = - m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['F' - '@'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_DOWNLOAD); - m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['l'] = sigc::bind(sigc::mem_fun(*this, &DownloadList::activate_display), DISPLAY_LOG); + m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['F' - '@'] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD); + m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['l'] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_LOG); } } diff --git a/src/ui/download_list.h b/src/ui/download_list.h index 803de05d..3712e36d 100644 --- a/src/ui/download_list.h +++ b/src/ui/download_list.h @@ -37,12 +37,9 @@ #ifndef RTORRENT_UI_DOWNLOAD_LIST_H #define RTORRENT_UI_DOWNLOAD_LIST_H -#include - -#include "display/manager.h" - #include "element_base.h" #include "globals.h" +#include "display/manager.h" class Control; @@ -74,7 +71,7 @@ public: typedef display::WindowLog WLog; typedef display::WindowLogComplete WLogComplete; - typedef sigc::slot1 SlotOpenUri; + typedef std::tr1::function slot_string; typedef enum { DISPLAY_DOWNLOAD, @@ -103,7 +100,7 @@ public: core::View* current_view(); void set_current_view(const std::string& name); - void slot_open_uri(SlotOpenUri s) { m_slotOpenUri = s; } + void slot_open_uri(slot_string s) { m_slot_open_uri = s; } void unfocus_download(core::Download* d); @@ -122,7 +119,7 @@ private: ElementBase* m_uiArray[DISPLAY_MAX_SIZE]; WLog* m_windowLog; - SlotOpenUri m_slotOpenUri; + slot_string m_slot_open_uri; }; } diff --git a/src/ui/element_base.h b/src/ui/element_base.h index 0f6e335f..9290d64d 100644 --- a/src/ui/element_base.h +++ b/src/ui/element_base.h @@ -48,7 +48,7 @@ namespace ui { class ElementBase { public: - typedef sigc::slot0 slot_type; + typedef std::tr1::function slot_type; ElementBase() : m_frame(NULL), m_focus(false) {} virtual ~ElementBase() {} @@ -60,7 +60,7 @@ public: virtual void activate(display::Frame* frame, bool focus = true) = 0; virtual void disable() = 0; - void slot_exit(const slot_type& s) { m_slotExit = s; } + void slot_exit(const slot_type& s) { m_slot_exit = s; } void mark_dirty(); @@ -69,7 +69,7 @@ protected: bool m_focus; input::Bindings m_bindings; - slot_type m_slotExit; + slot_type m_slot_exit; }; } diff --git a/src/ui/element_chunks_seen.cc b/src/ui/element_chunks_seen.cc index 2b734c22..71b58603 100644 --- a/src/ui/element_chunks_seen.cc +++ b/src/ui/element_chunks_seen.cc @@ -52,12 +52,12 @@ ElementChunksSeen::ElementChunksSeen(core::Download* d) : m_window(NULL), m_focus(0) { - m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit); - m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementChunksSeen::receive_next); - m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementChunksSeen::receive_prev); - m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementChunksSeen::receive_pagenext); - m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementChunksSeen::receive_pageprev); + m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementChunksSeen::receive_next, this); + m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementChunksSeen::receive_prev, this); + m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementChunksSeen::receive_pagenext, this); + m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementChunksSeen::receive_pageprev, this); } void diff --git a/src/ui/element_download_list.cc b/src/ui/element_download_list.cc index ec8a0126..7d6aff0d 100644 --- a/src/ui/element_download_list.cc +++ b/src/ui/element_download_list.cc @@ -36,7 +36,6 @@ #include "config.h" -#include #include #include #include @@ -64,41 +63,42 @@ ElementDownloadList::ElementDownloadList() : if (m_view == NULL) throw torrent::internal_error("View \"main\" must be present to initialize the main display."); - m_bindings['\x13'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.start="); - m_bindings['\x04'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "branch=d.state=,d.stop=,d.erase="); - m_bindings['\x0B'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.ignore_commands.set=1; d.stop=; d.close="); - m_bindings['\x12'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.complete.set=0; d.check_hash="); - m_bindings['\x05'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), - "f.multicall=,f.set_create_queued=0,f.set_resize_queued=0; print=\"Queued create/resize of files in torrent.\""); + m_bindings['\x13'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.start="); + m_bindings['\x04'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "branch=d.state=,d.stop=,d.erase="); + m_bindings['\x0B'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.ignore_commands.set=1; d.stop=; d.close="); + m_bindings['\x12'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.complete.set=0; d.check_hash="); + m_bindings['\x05'] = std::tr1::bind(&ElementDownloadList::receive_command, this, + "f.multicall=,f.set_create_queued=0,f.set_resize_queued=0; print=\"Queued create/resize of files in torrent.\""); - 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), + m_bindings['+'] = std::tr1::bind(&ElementDownloadList::receive_next_priority, this); + m_bindings['-'] = std::tr1::bind(&ElementDownloadList::receive_prev_priority, this); + m_bindings['T'-'@']= std::tr1::bind(&ElementDownloadList::receive_cycle_throttle, this); + m_bindings['I'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "branch=d.ignore_commands=," "{d.ignore_commands.set=0, print=\"Torrent set to heed commands.\"}," "{d.ignore_commands.set=1, print=\"Torrent set to ignore commands.\"}"); - m_bindings['B'-'@']= sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), + m_bindings['B'-'@']= std::tr1::bind(&ElementDownloadList::receive_command, this, "branch=d.is_active=," "{print=\"Cannot enable initial seeding on an active download.\"}," "{d.connection_seed.set=initial_seed, print=\"Enabled initial seeding for the selected download.\"}"); - m_bindings['U'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_command), "d.delete_tied=; print=\"Cleared tied to file association for the selected download.\""); + m_bindings['U'] = std::tr1::bind(&ElementDownloadList::receive_command, this, + "d.delete_tied=; print=\"Cleared tied to file association for the selected download.\""); // These should also be commands. - m_bindings['1'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "main"); - m_bindings['2'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "name"); - m_bindings['3'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "started"); - m_bindings['4'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "stopped"); - m_bindings['5'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "complete"); - m_bindings['6'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "incomplete"); - m_bindings['7'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "hashing"); - m_bindings['8'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "seeding"); - m_bindings['9'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "leeching"); - m_bindings['0'] = sigc::bind(sigc::mem_fun(*this, &ElementDownloadList::receive_change_view), "active"); + m_bindings['1'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "main"); + m_bindings['2'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "name"); + m_bindings['3'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "started"); + m_bindings['4'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "stopped"); + m_bindings['5'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "complete"); + m_bindings['6'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "incomplete"); + m_bindings['7'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "hashing"); + m_bindings['8'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "seeding"); + m_bindings['9'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "leeching"); + m_bindings['0'] = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "active"); - m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementDownloadList::receive_prev); - m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementDownloadList::receive_next); + m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementDownloadList::receive_prev, this); + m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementDownloadList::receive_next, this); } void diff --git a/src/ui/element_file_list.cc b/src/ui/element_file_list.cc index ac14095b..4653f80c 100644 --- a/src/ui/element_file_list.cc +++ b/src/ui/element_file_list.cc @@ -36,7 +36,6 @@ #include "config.h" -#include #include #include #include @@ -64,17 +63,17 @@ ElementFileList::ElementFileList(core::Download* d) : m_selected(iterator(d->download()->file_list()->begin())), m_collapsed(false) { - m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); - m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_select); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit); + m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementFileList::receive_select, this); - m_bindings[' '] = sigc::mem_fun(*this, &ElementFileList::receive_priority); - m_bindings['*'] = sigc::mem_fun(*this, &ElementFileList::receive_change_all); - m_bindings['/'] = sigc::mem_fun(*this, &ElementFileList::receive_collapse); - m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pagenext); - m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementFileList::receive_pageprev); + m_bindings[' '] = std::tr1::bind(&ElementFileList::receive_priority, this); + m_bindings['*'] = std::tr1::bind(&ElementFileList::receive_change_all, this); + m_bindings['/'] = std::tr1::bind(&ElementFileList::receive_collapse, this); + m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementFileList::receive_pagenext, this); + m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementFileList::receive_pageprev, this); - m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_next); - m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementFileList::receive_prev); + m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementFileList::receive_next, this); + m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementFileList::receive_prev, this); } inline ElementText* @@ -118,7 +117,7 @@ ElementFileList::activate(display::Frame* frame, bool focus) { m_window->set_focused(focus); m_elementInfo = element_file_list_create_info(); - m_elementInfo->slot_exit(sigc::bind(sigc::mem_fun(this, &ElementFileList::activate_display), DISPLAY_LIST)); + m_elementInfo->slot_exit(std::tr1::bind(&ElementFileList::activate_display, this, DISPLAY_LIST)); m_elementInfo->set_target(rpc::make_target(&m_selected)); m_frame = frame; diff --git a/src/ui/element_menu.cc b/src/ui/element_menu.cc index 7bc81cd0..21caf7fc 100644 --- a/src/ui/element_menu.cc +++ b/src/ui/element_menu.cc @@ -72,11 +72,11 @@ ElementMenu::ElementMenu() : m_entry(entry_invalid) { // Move bindings into a function that defines default bindings. - m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); - m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_select); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit); + m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementMenu::entry_select, this); - m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_prev); - m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_next); + m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementMenu::entry_prev, this); + m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementMenu::entry_next, this); } ElementMenu::~ElementMenu() { diff --git a/src/ui/element_menu.h b/src/ui/element_menu.h index a312e823..88ef4e97 100644 --- a/src/ui/element_menu.h +++ b/src/ui/element_menu.h @@ -37,8 +37,6 @@ #ifndef RTORRENT_UI_ELEMENT_MENU_H #define RTORRENT_UI_ELEMENT_MENU_H -#include - #include "core/download.h" #include "element_base.h" @@ -53,14 +51,13 @@ namespace ui { struct ElementMenuEntry { display::TextElementStringBase* m_element; - sigc::slot0 m_slotFocus; - sigc::slot0 m_slotSelect; + std::tr1::function m_slotFocus; + std::tr1::function m_slotSelect; }; class ElementMenu : public ElementBase, public std::vector { public: typedef std::vector base_type; - typedef sigc::slot0 slot_type; typedef display::WindowText WindowText; diff --git a/src/ui/element_peer_list.cc b/src/ui/element_peer_list.cc index d2acf0c7..dc80e5b3 100644 --- a/src/ui/element_peer_list.cc +++ b/src/ui/element_peer_list.cc @@ -36,7 +36,6 @@ #include "config.h" -#include #include #include #include @@ -75,16 +74,16 @@ ElementPeerList::ElementPeerList(core::Download* d) : m_windowList = new display::WindowPeerList(m_download, &m_list, &m_listItr); m_elementInfo = create_info(); - m_elementInfo->slot_exit(sigc::bind(sigc::mem_fun(this, &ElementPeerList::activate_display), DISPLAY_LIST)); + m_elementInfo->slot_exit(std::tr1::bind(&ElementPeerList::activate_display, this, DISPLAY_LIST)); - m_bindings['k'] = sigc::mem_fun(this, &ElementPeerList::receive_disconnect_peer); - m_bindings['*'] = sigc::mem_fun(this, &ElementPeerList::receive_snub_peer); - m_bindings['B'] = sigc::mem_fun(this, &ElementPeerList::receive_ban_peer); - m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); - m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::bind(sigc::mem_fun(this, &ElementPeerList::activate_display), DISPLAY_INFO); + m_bindings['k'] = std::tr1::bind(&ElementPeerList::receive_disconnect_peer, this); + m_bindings['*'] = std::tr1::bind(&ElementPeerList::receive_snub_peer, this); + m_bindings['B'] = std::tr1::bind(&ElementPeerList::receive_ban_peer, this); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit); + m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementPeerList::activate_display, this, DISPLAY_INFO); - m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_prev); - m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(this, &ElementPeerList::receive_next); + m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementPeerList::receive_prev, this); + m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementPeerList::receive_next, this); } ElementPeerList::~ElementPeerList() { diff --git a/src/ui/element_text.cc b/src/ui/element_text.cc index 3d5bb923..c24ac3a9 100644 --- a/src/ui/element_text.cc +++ b/src/ui/element_text.cc @@ -54,11 +54,11 @@ ElementText::ElementText(rpc::target_type target) : m_columnWidth(0) { // Move bindings into a function that defines default bindings. - m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit); -// m_bindings[KEY_UP] = sigc::mem_fun(this, &ElementText::entry_prev); -// m_bindings[KEY_DOWN] = sigc::mem_fun(this, &ElementText::entry_next); -// m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = sigc::mem_fun(this, &ElementText::entry_select); +// m_bindings[KEY_UP] = std::tr1::bind(this, &ElementText::entry_prev); +// m_bindings[KEY_DOWN] = std::tr1::bind(this, &ElementText::entry_next); +// m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(this, &ElementText::entry_select); } ElementText::~ElementText() { diff --git a/src/ui/element_text.h b/src/ui/element_text.h index 60b0516d..980dd419 100644 --- a/src/ui/element_text.h +++ b/src/ui/element_text.h @@ -37,8 +37,6 @@ #ifndef RTORRENT_UI_ELEMENT_TEXT_H #define RTORRENT_UI_ELEMENT_TEXT_H -#include - #include "core/download.h" #include "display/text_element_string.h" #include "display/window_text.h" diff --git a/src/ui/element_tracker_list.cc b/src/ui/element_tracker_list.cc index 33a2774e..0cbf9ba4 100644 --- a/src/ui/element_tracker_list.cc +++ b/src/ui/element_tracker_list.cc @@ -54,13 +54,13 @@ ElementTrackerList::ElementTrackerList(core::Download* d) : m_window(NULL), m_focus(0) { - m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit); - m_bindings[' '] = sigc::mem_fun(*this, &ElementTrackerList::receive_cycle_group); - m_bindings['*'] = sigc::mem_fun(*this, &ElementTrackerList::receive_disable); + m_bindings[' '] = std::tr1::bind(&ElementTrackerList::receive_cycle_group, this); + m_bindings['*'] = std::tr1::bind(&ElementTrackerList::receive_disable, this); - m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_next); - m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(*this, &ElementTrackerList::receive_prev); + m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementTrackerList::receive_next, this); + m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::tr1::bind(&ElementTrackerList::receive_prev, this); } void diff --git a/src/ui/element_transfer_list.cc b/src/ui/element_transfer_list.cc index 045c9e7d..28929668 100644 --- a/src/ui/element_transfer_list.cc +++ b/src/ui/element_transfer_list.cc @@ -52,12 +52,12 @@ ElementTransferList::ElementTransferList(core::Download* d) : m_window(NULL), m_focus(0) { - m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = sigc::mem_fun(&m_slotExit, &slot_type::operator()); + m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit); - m_bindings[KEY_DOWN] = sigc::mem_fun(*this, &ElementTransferList::receive_next); - m_bindings[KEY_UP] = sigc::mem_fun(*this, &ElementTransferList::receive_prev); - m_bindings[KEY_NPAGE] = sigc::mem_fun(*this, &ElementTransferList::receive_pagenext); - m_bindings[KEY_PPAGE] = sigc::mem_fun(*this, &ElementTransferList::receive_pageprev); + m_bindings[KEY_DOWN] = std::tr1::bind(&ElementTransferList::receive_next, this); + m_bindings[KEY_UP] = std::tr1::bind(&ElementTransferList::receive_prev, this); + m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementTransferList::receive_pagenext, this); + m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementTransferList::receive_pageprev, this); } void diff --git a/src/ui/root.cc b/src/ui/root.cc index d109976f..981fcc2c 100644 --- a/src/ui/root.cc +++ b/src/ui/root.cc @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -141,23 +140,23 @@ Root::setup_keys() { const char* keys = get_throttle_keys(); - m_bindings[keys[ 0]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 1); - m_bindings[keys[ 1]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -1); - m_bindings[keys[ 2]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 1); - m_bindings[keys[ 3]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -1); + m_bindings[keys[ 0]] = std::tr1::bind(&Root::adjust_up_throttle, this, 1); + m_bindings[keys[ 1]] = std::tr1::bind(&Root::adjust_up_throttle, this, -1); + m_bindings[keys[ 2]] = std::tr1::bind(&Root::adjust_down_throttle, this, 1); + m_bindings[keys[ 3]] = std::tr1::bind(&Root::adjust_down_throttle, this, -1); - m_bindings[keys[ 4]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 5); - m_bindings[keys[ 5]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -5); - m_bindings[keys[ 6]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 5); - m_bindings[keys[ 7]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -5); + m_bindings[keys[ 4]] = std::tr1::bind(&Root::adjust_up_throttle, this, 5); + m_bindings[keys[ 5]] = std::tr1::bind(&Root::adjust_up_throttle, this, -5); + m_bindings[keys[ 6]] = std::tr1::bind(&Root::adjust_down_throttle, this, 5); + m_bindings[keys[ 7]] = std::tr1::bind(&Root::adjust_down_throttle, this, -5); - m_bindings[keys[ 8]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), 50); - m_bindings[keys[ 9]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_up_throttle), -50); - m_bindings[keys[10]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), 50); - m_bindings[keys[11]] = sigc::bind(sigc::mem_fun(*this, &Root::adjust_down_throttle), -50); + m_bindings[keys[ 8]] = std::tr1::bind(&Root::adjust_up_throttle, this, 50); + m_bindings[keys[ 9]] = std::tr1::bind(&Root::adjust_up_throttle, this, -50); + m_bindings[keys[10]] = std::tr1::bind(&Root::adjust_down_throttle, this, 50); + m_bindings[keys[11]] = std::tr1::bind(&Root::adjust_down_throttle, this, -50); - m_bindings['\x0C'] = sigc::mem_fun(m_control->display(), &display::Manager::force_redraw); // ^L - m_bindings['\x11'] = sigc::mem_fun(m_control, &Control::receive_normal_shutdown); // ^Q + m_bindings['\x0C'] = std::tr1::bind(&display::Manager::force_redraw, m_control->display()); // ^L + m_bindings['\x11'] = std::tr1::bind(&Control::receive_normal_shutdown, m_control); // ^Q } void @@ -235,7 +234,7 @@ Root::enable_input(const std::string& title, input::TextInput* input) { if (m_windowInput->input() != NULL) throw torrent::internal_error("Root::enable_input(...) m_windowInput->input() != NULL."); - input->slot_dirty(sigc::mem_fun(m_windowInput, &WInput::mark_dirty)); + input->slot_dirty(std::tr1::bind(&WInput::mark_dirty, m_windowInput)); m_windowStatusbar->set_active(false); @@ -244,8 +243,8 @@ Root::enable_input(const std::string& title, input::TextInput* input) { m_windowInput->set_title(title); m_windowInput->set_focus(true); - input->bindings()['\x0C'] = sigc::mem_fun(m_control->display(), &display::Manager::force_redraw); // ^L - input->bindings()['\x11'] = sigc::mem_fun(m_control, &Control::receive_normal_shutdown); // ^Q + input->bindings()['\x0C'] = std::tr1::bind(&display::Manager::force_redraw, m_control->display()); // ^L + input->bindings()['\x11'] = std::tr1::bind(&Control::receive_normal_shutdown, m_control); // ^Q control->input()->set_text_input(input); control->display()->adjust_layout(); @@ -256,7 +255,7 @@ Root::disable_input() { if (m_windowInput->input() == NULL) throw torrent::internal_error("Root::disable_input() m_windowInput->input() == NULL."); - m_windowInput->input()->slot_dirty(sigc::slot0()); + m_windowInput->input()->slot_dirty(ElementBase::slot_type()); m_windowStatusbar->set_active(true);