mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 13:12:32 +00:00
Converted sigc++ slots to std::tr1::function.
This commit is contained in:
@@ -41,7 +41,6 @@
|
||||
#include <rak/file_stat.h>
|
||||
#include <rak/path.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/hash_string.h>
|
||||
#include <torrent/utils/log.h>
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <ctime>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/functional_fun.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
|
||||
#include "core/manager.h"
|
||||
#include "core/view_manager.h"
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
#include <curl/curl.h>
|
||||
#include <sigc++/signal.h>
|
||||
#include <torrent/http.h>
|
||||
|
||||
#include "rak/priority_queue_default.h"
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <curl/multi.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
#include "rak/functional.h"
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
|
||||
#include <deque>
|
||||
#include <string>
|
||||
#include <sigc++/functors/slot.h>
|
||||
|
||||
#include "rak/priority_queue_default.h"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
#define RTORRENT_CORE_DOWNLOAD_FACTORY_H
|
||||
|
||||
#include <iosfwd>
|
||||
#include <sigc++/functors/slot.h>
|
||||
#include <rak/priority_queue_default.h>
|
||||
#include <torrent/object.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
#include "http_queue.h"
|
||||
|
||||
@@ -54,7 +54,7 @@ class Manager;
|
||||
|
||||
class DownloadFactory {
|
||||
public:
|
||||
typedef sigc::slot<void> Slot;
|
||||
typedef std::tr1::function<void ()> slot_void;
|
||||
typedef std::vector<std::string> 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;
|
||||
};
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <torrent/data/file.h>
|
||||
|
||||
@@ -39,19 +39,19 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sigc++/functors/slot.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
#include "download.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class DownloadSlotMap : public std::map<std::string, sigc::slot1<void, Download*> > {
|
||||
class DownloadSlotMap : public std::map<std::string, std::tr1::function<void (Download*)> > {
|
||||
public:
|
||||
typedef sigc::slot1<void, Download*> SlotDownload;
|
||||
typedef std::map<std::string, SlotDownload> Base;
|
||||
typedef std::tr1::function<void (Download*)> slot_download;
|
||||
typedef std::map<std::string, slot_download> 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);
|
||||
};
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <sigc++/adaptors/hide.h>
|
||||
#include <torrent/http.h>
|
||||
|
||||
#include "rak/functional.h"
|
||||
@@ -50,7 +48,7 @@ namespace core {
|
||||
|
||||
HttpQueue::iterator
|
||||
HttpQueue::insert(const std::string& url, std::iostream* s) {
|
||||
std::auto_ptr<CurlGet> h(m_slotFactory());
|
||||
std::auto_ptr<CurlGet> h(m_slot_factory());
|
||||
|
||||
h->set_url(url);
|
||||
h->set_stream(s);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <list>
|
||||
#include <iosfwd>
|
||||
#include <sigc++/signal.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
namespace core {
|
||||
|
||||
@@ -47,9 +48,9 @@ class CurlGet;
|
||||
|
||||
class HttpQueue : private std::list<CurlGet*> {
|
||||
public:
|
||||
typedef std::list<CurlGet*> Base;
|
||||
typedef sigc::signal1<void, CurlGet*> SignalHttp;
|
||||
typedef sigc::slot0<CurlGet*> SlotFactory;
|
||||
typedef std::list<CurlGet*> Base;
|
||||
typedef sigc::signal1<void, CurlGet*> SignalHttp;
|
||||
typedef std::tr1::function<CurlGet* ()> 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;
|
||||
};
|
||||
|
||||
+3
-3
@@ -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<core::DownloadFactory>), f));
|
||||
f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, 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<core::DownloadFactory>), f));
|
||||
f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
|
||||
|
||||
// Bit of a waste to create the bencode repesentation here
|
||||
// only to have the DownloadFactory decode it.
|
||||
|
||||
+2
-2
@@ -69,8 +69,8 @@ public:
|
||||
typedef DownloadList::iterator DListItr;
|
||||
typedef utils::FileStatusCache FileStatusCache;
|
||||
|
||||
typedef sigc::slot1<void, DownloadList::iterator> SlotReady;
|
||||
typedef sigc::slot0<void> SlotFailed;
|
||||
// typedef std::tr1::function<void (DownloadList::iterator)> slot_ready;
|
||||
// typedef std::tr1::function<void ()> slot_void;
|
||||
|
||||
Manager();
|
||||
~Manager();
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <functional>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/functional_fun.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/download.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
|
||||
+16
-16
@@ -38,31 +38,31 @@
|
||||
#define RTORRENT_INPUT_BINDINGS_H
|
||||
|
||||
#include <map>
|
||||
#include <sigc++/functors/slot.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
#include "display/attributes.h"
|
||||
|
||||
namespace input {
|
||||
|
||||
class Bindings : private std::map<int, sigc::slot0<void> > {
|
||||
class Bindings : private std::map<int, std::tr1::function<void ()> > {
|
||||
public:
|
||||
typedef sigc::slot0<void> Slot;
|
||||
typedef std::map<int, Slot > Base;
|
||||
typedef std::tr1::function<void ()> slot_void;
|
||||
typedef std::map<int, slot_void> 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;
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
#ifndef RTORRENT_INPUT_INPUT_EVENT_H
|
||||
#define RTORRENT_INPUT_INPUT_EVENT_H
|
||||
|
||||
#include <sigc++/functors/slot.h>
|
||||
#include <torrent/event.h>
|
||||
#include <torrent/poll.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
namespace input {
|
||||
|
||||
class InputEvent : public torrent::Event {
|
||||
public:
|
||||
typedef sigc::slot<void, int> SlotInt;
|
||||
typedef std::tr1::function<void (int)> 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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ TextInput::pressed(int key) {
|
||||
}
|
||||
}
|
||||
|
||||
m_slotDirty();
|
||||
mark_dirty();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ namespace input {
|
||||
|
||||
class TextInput : private std::string {
|
||||
public:
|
||||
typedef std::string Base;
|
||||
typedef sigc::slot0<void> SlotDirty;
|
||||
typedef std::string Base;
|
||||
typedef std::tr1::function<void ()> 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;
|
||||
};
|
||||
|
||||
+22
-22
@@ -44,7 +44,6 @@
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/http.h>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/exceptions.h>
|
||||
@@ -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<core::DownloadFactory>), f));
|
||||
f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, 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<core::DownloadFactory>), f));
|
||||
f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, 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");
|
||||
|
||||
+9
-11
@@ -43,32 +43,30 @@
|
||||
#include <getopt.h>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <sigc++/adaptors/hide.h>
|
||||
|
||||
#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)
|
||||
|
||||
+11
-12
@@ -39,21 +39,20 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sigc++/functors/slot.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
// Throws std::runtime_error upon receiving bad input.
|
||||
|
||||
class OptionParser {
|
||||
public:
|
||||
typedef sigc::slot0<void> Slot;
|
||||
typedef sigc::slot1<void, const std::string&> SlotString;
|
||||
typedef sigc::slot2<void, const std::string&, const std::string&> SlotStringPair;
|
||||
typedef sigc::slot2<void, int, int> SlotIntPair;
|
||||
typedef std::tr1::function<void (const std::string&)> slot_string;
|
||||
typedef std::tr1::function<void (const std::string&, const std::string&)> slot_string_pair;
|
||||
typedef std::tr1::function<void (int, int)> 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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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]();
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
#define RTORRENT_SIGNAL_HANDLER_H
|
||||
|
||||
#include <sys/signal.h>
|
||||
#include <sigc++/functors/slot.h>
|
||||
#include <tr1/functional>
|
||||
|
||||
class SignalHandler {
|
||||
public:
|
||||
typedef sigc::slot0<void> Slot;
|
||||
typedef std::tr1::function<void ()> 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
|
||||
|
||||
+51
-52
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <rak/functional.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <torrent/exceptions.h>
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+16
-16
@@ -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<ElementStringList*>(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<utils::Directory::iterator>));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,12 +37,9 @@
|
||||
#ifndef RTORRENT_UI_DOWNLOAD_LIST_H
|
||||
#define RTORRENT_UI_DOWNLOAD_LIST_H
|
||||
|
||||
#include <sigc++/functors/slot.h>
|
||||
|
||||
#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<void, const std::string&> SlotOpenUri;
|
||||
typedef std::tr1::function<void (const std::string&)> 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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace ui {
|
||||
|
||||
class ElementBase {
|
||||
public:
|
||||
typedef sigc::slot0<void> slot_type;
|
||||
typedef std::tr1::function<void ()> 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;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/object.h>
|
||||
#include <torrent/utils/log.h>
|
||||
@@ -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
|
||||
|
||||
+10
-11
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <rak/algorithm.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/data/file.h>
|
||||
@@ -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;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#ifndef RTORRENT_UI_ELEMENT_MENU_H
|
||||
#define RTORRENT_UI_ELEMENT_MENU_H
|
||||
|
||||
#include <sigc++/functors/slot.h>
|
||||
|
||||
#include "core/download.h"
|
||||
|
||||
#include "element_base.h"
|
||||
@@ -53,14 +51,13 @@ namespace ui {
|
||||
struct ElementMenuEntry {
|
||||
display::TextElementStringBase* m_element;
|
||||
|
||||
sigc::slot0<void> m_slotFocus;
|
||||
sigc::slot0<void> m_slotSelect;
|
||||
std::tr1::function<void ()> m_slotFocus;
|
||||
std::tr1::function<void ()> m_slotSelect;
|
||||
};
|
||||
|
||||
class ElementMenu : public ElementBase, public std::vector<ElementMenuEntry> {
|
||||
public:
|
||||
typedef std::vector<ElementMenuEntry> base_type;
|
||||
typedef sigc::slot0<void> slot_type;
|
||||
|
||||
typedef display::WindowText WindowText;
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/hash_string.h>
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
#ifndef RTORRENT_UI_ELEMENT_TEXT_H
|
||||
#define RTORRENT_UI_ELEMENT_TEXT_H
|
||||
|
||||
#include <sigc++/functors/slot.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "display/text_element_string.h"
|
||||
#include "display/window_text.h"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+18
-19
@@ -38,7 +38,6 @@
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string.h>
|
||||
#include <sigc++/adaptors/bind.h>
|
||||
#include <torrent/throttle.h>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/download/resource_manager.h>
|
||||
@@ -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<void>());
|
||||
m_windowInput->input()->slot_dirty(ElementBase::slot_type());
|
||||
|
||||
m_windowStatusbar->set_active(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user