diff --git a/rak/priority_queue_default.h b/rak/priority_queue_default.h index e4106bc1..f2d8902d 100644 --- a/rak/priority_queue_default.h +++ b/rak/priority_queue_default.h @@ -47,7 +47,7 @@ namespace rak { class priority_item { public: - typedef std::tr1::function slot_void; + typedef std::tr1::function slot_void; priority_item() {} ~priority_item() { @@ -55,19 +55,19 @@ public: throw std::logic_error("priority_item::~priority_item() called on a queued item."); m_time = timer(); + m_slot = slot_void(); } - bool is_valid() const { return !!m_slot; } - bool is_queued() const { return m_time != timer(); } + bool is_valid() const { return (bool)m_slot; } + bool is_queued() const { return m_time != timer(); } - void call() { m_slot(); } - void set_slot(const slot_void& s) { m_slot = s; } - - const timer& time() const { return m_time; } - void clear_time() { m_time = timer(); } - void set_time(const timer& t) { m_time = t; } + slot_void& slot() { return m_slot; } - bool compare(const timer& t) const { return m_time > t; } + const timer& time() const { return m_time; } + void clear_time() { m_time = timer(); } + void set_time(const timer& t) { m_time = t; } + + bool compare(const timer& t) const { return m_time > t; } private: priority_item(const priority_item&); @@ -94,7 +94,7 @@ priority_queue_perform(priority_queue_default* queue, timer t) { queue->pop(); v->clear_time(); - v->call(); + v->slot()(); } } diff --git a/src/control.cc b/src/control.cc index c1513e45..17aa6e81 100644 --- a/src/control.cc +++ b/src/control.cc @@ -77,7 +77,7 @@ Control::Control() : m_inputStdin->slot_pressed(sigc::mem_fun(m_input, &input::Manager::pressed)); - m_taskShutdown.set_slot(std::tr1::bind(&Control::handle_shutdown, this)); + m_taskShutdown.slot() = std::tr1::bind(&Control::handle_shutdown, this); m_commandScheduler->set_slot_error_message(rak::mem_fn(m_core, &core::Manager::push_log_std)); } diff --git a/src/core/curl_get.cc b/src/core/curl_get.cc index 81f345c6..fe9f8d62 100644 --- a/src/core/curl_get.cc +++ b/src/core/curl_get.cc @@ -82,7 +82,7 @@ CurlGet::start() { // Normally libcurl should handle the timeout. But sometimes that doesn't // work right so we do a fallback timeout that just aborts the transfer. - m_taskTimeout.set_slot(std::tr1::bind(&CurlGet::receive_timeout, this)); + m_taskTimeout.slot() = std::tr1::bind(&CurlGet::receive_timeout, this); priority_queue_erase(&taskScheduler, &m_taskTimeout); priority_queue_insert(&taskScheduler, &m_taskTimeout, cachedTime + rak::timer::from_seconds(m_timeout + 5)); } diff --git a/src/core/curl_stack.cc b/src/core/curl_stack.cc index 9da8082b..2153ab24 100644 --- a/src/core/curl_stack.cc +++ b/src/core/curl_stack.cc @@ -55,7 +55,7 @@ CurlStack::CurlStack() : m_ssl_verify_peer(true), m_dns_timeout(60) { - m_taskTimeout.set_slot(std::tr1::bind(&CurlStack::receive_timeout, this)); + m_taskTimeout.slot() = std::tr1::bind(&CurlStack::receive_timeout, this); #if (LIBCURL_VERSION_NUM >= 0x071000) curl_multi_setopt((CURLM*)m_handle, CURLMOPT_TIMERDATA, this); diff --git a/src/core/dht_manager.cc b/src/core/dht_manager.cc index 628fe4a7..0472d686 100644 --- a/src/core/dht_manager.cc +++ b/src/core/dht_manager.cc @@ -114,7 +114,7 @@ DhtManager::start_dht() { torrent::dht_manager()->start(port); torrent::dht_manager()->reset_statistics(); - m_updateTimeout.set_slot(std::tr1::bind(&DhtManager::update, this)); + m_updateTimeout.slot() = std::tr1::bind(&DhtManager::update, this); priority_queue_insert(&taskScheduler, &m_updateTimeout, (cachedTime + rak::timer::from_seconds(60)).round_seconds()); m_dhtPrevCycle = 0; @@ -197,7 +197,7 @@ DhtManager::update() { break; if (itr == end) { - m_stopTimeout.set_slot(std::tr1::bind(&DhtManager::stop_dht, this)); + m_stopTimeout.slot() = std::tr1::bind(&DhtManager::stop_dht, this); priority_queue_insert(&taskScheduler, &m_stopTimeout, (cachedTime + rak::timer::from_seconds(15 * 60)).round_seconds()); } } diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index 07324a0c..3f63dc4b 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -106,8 +106,8 @@ DownloadFactory::DownloadFactory(Manager* m) : m_printLog(true), m_isFile(false) { - m_taskLoad.set_slot(std::tr1::bind(&DownloadFactory::receive_load, this)); - m_taskCommit.set_slot(std::tr1::bind(&DownloadFactory::receive_commit, this)); + m_taskLoad.slot() = std::tr1::bind(&DownloadFactory::receive_load, this); + m_taskCommit.slot() = std::tr1::bind(&DownloadFactory::receive_commit, this); // m_variables["connection_leech"] = rpc::call_command_void("protocol.connection.leech"); // m_variables["connection_seed"] = rpc::call_command_void("protocol.connection.seed"); diff --git a/src/core/view.cc b/src/core/view.cc index f63998a4..8f637396 100644 --- a/src/core/view.cc +++ b/src/core/view.cc @@ -172,7 +172,7 @@ View::initialize(const std::string& name) { m_focus = 0; set_last_changed(rak::timer()); - m_delayChanged.set_slot(std::tr1::bind(&signal_type::operator(), &m_signalChanged)); + m_delayChanged.slot() = std::tr1::bind(&signal_type::operator(), &m_signalChanged); } void diff --git a/src/display/manager.cc b/src/display/manager.cc index 09a11229..dde6a615 100644 --- a/src/display/manager.cc +++ b/src/display/manager.cc @@ -50,7 +50,7 @@ namespace display { Manager::Manager() : m_forceRedraw(false) { - m_taskUpdate.set_slot(std::tr1::bind(&Manager::receive_update, this)); + m_taskUpdate.slot() = std::tr1::bind(&Manager::receive_update, this); } Manager::~Manager() { diff --git a/src/display/window.cc b/src/display/window.cc index fe312332..1246a681 100644 --- a/src/display/window.cc +++ b/src/display/window.cc @@ -59,7 +59,7 @@ Window::Window(Canvas* canvas, int flags, extent_type minWidth, extent_type minH m_maxWidth(maxWidth), m_maxHeight(maxHeight) { - m_taskUpdate.set_slot(std::tr1::bind(&Window::redraw, this)); + m_taskUpdate.slot() = std::tr1::bind(&Window::redraw, this); } Window::~Window() { diff --git a/src/display/window_log.cc b/src/display/window_log.cc index 928b7fb8..3b36dbe3 100644 --- a/src/display/window_log.cc +++ b/src/display/window_log.cc @@ -48,7 +48,7 @@ WindowLog::WindowLog(core::Log* l) : Window(new Canvas, 0, 0, 0, extent_full, extent_static), m_log(l) { - m_taskUpdate.set_slot(std::tr1::bind(&WindowLog::receive_update, this)), + m_taskUpdate.slot() = std::tr1::bind(&WindowLog::receive_update, this); // We're trying out scheduled tasks instead. m_connUpdate = l->signal_update().connect(sigc::mem_fun(*this, &WindowLog::receive_update)); diff --git a/src/rpc/command_scheduler.cc b/src/rpc/command_scheduler.cc index 50047cf4..4968e8da 100644 --- a/src/rpc/command_scheduler.cc +++ b/src/rpc/command_scheduler.cc @@ -71,7 +71,7 @@ CommandScheduler::insert(const std::string& key) { delete *itr; *itr = new CommandSchedulerItem(key); - (*itr)->set_slot(std::tr1::bind(&CommandScheduler::call_item, this, *itr)); + (*itr)->slot() = std::tr1::bind(&CommandScheduler::call_item, this, *itr); return itr; } diff --git a/src/rpc/command_scheduler_item.h b/src/rpc/command_scheduler_item.h index a7ca71db..e897d314 100644 --- a/src/rpc/command_scheduler_item.h +++ b/src/rpc/command_scheduler_item.h @@ -51,22 +51,22 @@ public: CommandSchedulerItem(const std::string& key) : m_key(key), m_interval(0) {} ~CommandSchedulerItem(); - bool is_queued() const { return m_task.is_queued(); } + bool is_queued() const { return m_task.is_queued(); } void enable(rak::timer t); void disable(); - const std::string& key() const { return m_key; } - torrent::Object& command() { return m_command; } + const std::string& key() const { return m_key; } + torrent::Object& command() { return m_command; } // 'interval()' should in the future return some more dynamic values. - uint32_t interval() const { return m_interval; } - void set_interval(uint32_t v) { m_interval = v; } + uint32_t interval() const { return m_interval; } + void set_interval(uint32_t v) { m_interval = v; } - rak::timer time_scheduled() const { return m_timeScheduled; } + rak::timer time_scheduled() const { return m_timeScheduled; } rak::timer next_time_scheduled() const; - void set_slot(const slot_void& s) { m_task.set_slot(s); } + slot_void& slot() { return m_task.slot(); } private: CommandSchedulerItem(const CommandSchedulerItem&); diff --git a/src/thread_base.cc b/src/thread_base.cc index c886456b..0640cac6 100644 --- a/src/thread_base.cc +++ b/src/thread_base.cc @@ -108,7 +108,7 @@ public: void throw_shutdown_exception() { throw torrent::shutdown_exception(); } ThreadBase::ThreadBase() { - m_taskShutdown.set_slot(rak::ptr_fn(&throw_shutdown_exception)); + m_taskShutdown.slot() = std::tr1::bind(&throw_shutdown_exception); m_threadQueue = new thread_queue_hack; } diff --git a/src/thread_worker.cc b/src/thread_worker.cc index d80e2335..79cd49ea 100644 --- a/src/thread_worker.cc +++ b/src/thread_worker.cc @@ -52,7 +52,7 @@ #include "rpc/parse_commands.h" ThreadWorker::ThreadWorker() { - m_taskTouchLog.set_slot(std::tr1::bind(&ThreadWorker::task_touch_log, this)); + m_taskTouchLog.slot() = std::tr1::bind(&ThreadWorker::task_touch_log, this); } ThreadWorker::~ThreadWorker() {