mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-16 22:26:16 +00:00
* Converted some internal sigc++ calls to lightweight function
wrappers. * Some client code cleanup. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@576 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+36
-7
@@ -339,16 +339,22 @@ bind2nd(const Operation& op, const Type& val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Lightweight callback function including pointer to object. Should
|
// Lightweight callback function including pointer to object. Should
|
||||||
// be replaced by TR1 stuff later. Requires an object to bind, instead
|
// be replaced by TR1 stuff later.
|
||||||
// of using a seperate functor for that.
|
|
||||||
|
template <typename Ret>
|
||||||
|
class function0 {
|
||||||
|
public:
|
||||||
|
virtual bool is_valid() const = 0;
|
||||||
|
virtual Ret operator () () = 0;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename Object, typename Ret>
|
template <typename Object, typename Ret>
|
||||||
class mem_fn {
|
class mem_fn0 : public function0<Ret> {
|
||||||
public:
|
public:
|
||||||
typedef Ret (Object::*Function)();
|
typedef Ret (Object::*Function)();
|
||||||
|
|
||||||
mem_fn() : m_object(NULL) {}
|
mem_fn0() : m_object(NULL) {}
|
||||||
mem_fn(Object* o, Function f) : m_object(o), m_function(f) {}
|
mem_fn0(Object* o, Function f) : m_object(o), m_function(f) {}
|
||||||
|
|
||||||
bool is_valid() const { return m_object; }
|
bool is_valid() const { return m_object; }
|
||||||
|
|
||||||
@@ -359,10 +365,33 @@ private:
|
|||||||
Function m_function;
|
Function m_function;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename Object, typename Ret, typename Arg1>
|
||||||
|
class mem_fn1 {
|
||||||
|
public:
|
||||||
|
typedef Ret (Object::*Function)(Arg1);
|
||||||
|
|
||||||
|
mem_fn1() : m_object(NULL) {}
|
||||||
|
mem_fn1(Object* o, Function f) : m_object(o), m_function(f) {}
|
||||||
|
|
||||||
|
bool is_valid() const { return m_object; }
|
||||||
|
|
||||||
|
Ret operator () (Arg1 a1) { return (m_object->*m_function)(a1); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Object* m_object;
|
||||||
|
Function m_function;
|
||||||
|
};
|
||||||
|
|
||||||
template <typename Object, typename Ret>
|
template <typename Object, typename Ret>
|
||||||
inline mem_fn<Object, Ret>
|
inline mem_fn0<Object, Ret>
|
||||||
make_mem_fn(Object* o, Ret (Object::*f)()) {
|
make_mem_fn(Object* o, Ret (Object::*f)()) {
|
||||||
return mem_fn<Object, Ret>(o, f);
|
return mem_fn0<Object, Ret>(o, f);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Object, typename Ret, typename Arg1>
|
||||||
|
inline mem_fn1<Object, Ret, Arg1>
|
||||||
|
make_mem_fn(Object* o, Ret (Object::*f)(Arg1)) {
|
||||||
|
return mem_fn1<Object, Ret, Arg1>(o, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ rtorrent_LDADD = \
|
|||||||
$(top_srcdir)/src/utils/libsub_utils.a
|
$(top_srcdir)/src/utils/libsub_utils.a
|
||||||
|
|
||||||
rtorrent_SOURCES = \
|
rtorrent_SOURCES = \
|
||||||
|
control.cc \
|
||||||
|
control.h \
|
||||||
main.cc \
|
main.cc \
|
||||||
option_file.cc \
|
option_file.cc \
|
||||||
option_file.h \
|
option_file.h \
|
||||||
|
|||||||
@@ -43,8 +43,6 @@
|
|||||||
|
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
|
|
||||||
namespace ui {
|
|
||||||
|
|
||||||
Control::Control() :
|
Control::Control() :
|
||||||
m_shutdownReceived(false) {
|
m_shutdownReceived(false) {
|
||||||
|
|
||||||
@@ -97,5 +95,3 @@ Control::receive_shutdown() {
|
|||||||
m_core.shutdown(true);
|
m_core.shutdown(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
@@ -43,10 +43,7 @@
|
|||||||
#include "display/manager.h"
|
#include "display/manager.h"
|
||||||
#include "input/manager.h"
|
#include "input/manager.h"
|
||||||
#include "input/input_event.h"
|
#include "input/input_event.h"
|
||||||
|
#include "ui/root.h"
|
||||||
#include "root.h"
|
|
||||||
|
|
||||||
namespace ui {
|
|
||||||
|
|
||||||
class Control {
|
class Control {
|
||||||
public:
|
public:
|
||||||
@@ -56,7 +53,7 @@ public:
|
|||||||
bool is_shutdown_completed() { return m_shutdownReceived && torrent::is_inactive(); }
|
bool is_shutdown_completed() { return m_shutdownReceived && torrent::is_inactive(); }
|
||||||
bool is_shutdown_received() { return m_shutdownReceived; }
|
bool is_shutdown_received() { return m_shutdownReceived; }
|
||||||
|
|
||||||
Root& get_ui() { return m_ui; }
|
ui::Root& get_ui() { return m_ui; }
|
||||||
core::Manager& get_core() { return m_core; }
|
core::Manager& get_core() { return m_core; }
|
||||||
display::Manager& get_display() { return m_display; }
|
display::Manager& get_display() { return m_display; }
|
||||||
input::Manager& get_input() { return m_input; }
|
input::Manager& get_input() { return m_input; }
|
||||||
@@ -73,13 +70,11 @@ private:
|
|||||||
|
|
||||||
bool m_shutdownReceived;
|
bool m_shutdownReceived;
|
||||||
|
|
||||||
Root m_ui;
|
ui::Root m_ui;
|
||||||
core::Manager m_core;
|
core::Manager m_core;
|
||||||
display::Manager m_display;
|
display::Manager m_display;
|
||||||
input::Manager m_input;
|
input::Manager m_input;
|
||||||
input::InputEvent* m_inputStdin;
|
input::InputEvent* m_inputStdin;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
+7
-7
@@ -58,13 +58,13 @@
|
|||||||
#include "core/download_factory.h"
|
#include "core/download_factory.h"
|
||||||
#include "display/canvas.h"
|
#include "display/canvas.h"
|
||||||
#include "display/window.h"
|
#include "display/window.h"
|
||||||
#include "ui/control.h"
|
|
||||||
#include "input/bindings.h"
|
#include "input/bindings.h"
|
||||||
|
|
||||||
#include "utils/task.h"
|
#include "utils/task.h"
|
||||||
#include "utils/timer.h"
|
#include "utils/timer.h"
|
||||||
#include "utils/directory.h"
|
#include "utils/directory.h"
|
||||||
|
|
||||||
|
#include "control.h"
|
||||||
#include "signal_handler.h"
|
#include "signal_handler.h"
|
||||||
#include "option_file.h"
|
#include "option_file.h"
|
||||||
#include "option_handler.h"
|
#include "option_handler.h"
|
||||||
@@ -95,7 +95,7 @@ is_resized() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
parse_options(ui::Control* c, OptionHandler* optionHandler, int argc, char** argv) {
|
parse_options(Control* c, OptionHandler* optionHandler, int argc, char** argv) {
|
||||||
OptionParser optionParser;
|
OptionParser optionParser;
|
||||||
|
|
||||||
// Converted.
|
// Converted.
|
||||||
@@ -113,7 +113,7 @@ parse_options(ui::Control* c, OptionHandler* optionHandler, int argc, char** arg
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
initialize_option_handler(ui::Control* c, OptionHandler* optionHandler) {
|
initialize_option_handler(Control* c, OptionHandler* optionHandler) {
|
||||||
optionHandler->insert("max_peers", new OptionHandlerInt(c, &apply_download_max_peers, &validate_download_peers));
|
optionHandler->insert("max_peers", new OptionHandlerInt(c, &apply_download_max_peers, &validate_download_peers));
|
||||||
optionHandler->insert("min_peers", new OptionHandlerInt(c, &apply_download_min_peers, &validate_download_peers));
|
optionHandler->insert("min_peers", new OptionHandlerInt(c, &apply_download_min_peers, &validate_download_peers));
|
||||||
optionHandler->insert("max_uploads", new OptionHandlerInt(c, &apply_download_max_uploads, &validate_download_peers));
|
optionHandler->insert("max_uploads", new OptionHandlerInt(c, &apply_download_max_uploads, &validate_download_peers));
|
||||||
@@ -160,7 +160,7 @@ load_option_file(const std::string& filename, OptionHandler* optionHandler, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
load_session_torrents(ui::Control* c) {
|
load_session_torrents(Control* c) {
|
||||||
// Load session torrents.
|
// Load session torrents.
|
||||||
std::list<std::string> l = c->get_core().get_download_store().get_formated_entries().make_list();
|
std::list<std::string> l = c->get_core().get_download_store().get_formated_entries().make_list();
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ load_session_torrents(ui::Control* c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
load_arg_torrents(ui::Control* c, char** first, char** last) {
|
load_arg_torrents(Control* c, char** first, char** last) {
|
||||||
//std::for_each(begin, end, std::bind1st(std::mem_fun(&core::Manager::insert), &c->get_core()));
|
//std::for_each(begin, end, std::bind1st(std::mem_fun(&core::Manager::insert), &c->get_core()));
|
||||||
for (; first != last; ++first) {
|
for (; first != last; ++first) {
|
||||||
core::DownloadFactory* f = new core::DownloadFactory(*first, &c->get_core());
|
core::DownloadFactory* f = new core::DownloadFactory(*first, &c->get_core());
|
||||||
@@ -194,7 +194,7 @@ main(int argc, char** argv) {
|
|||||||
utils::Timer::update();
|
utils::Timer::update();
|
||||||
|
|
||||||
OptionHandler optionHandler;
|
OptionHandler optionHandler;
|
||||||
ui::Control uiControl;
|
Control uiControl;
|
||||||
|
|
||||||
srandom(utils::Timer::cache().usec());
|
srandom(utils::Timer::cache().usec());
|
||||||
srand48(utils::Timer::cache().usec());
|
srand48(utils::Timer::cache().usec());
|
||||||
@@ -204,7 +204,7 @@ main(int argc, char** argv) {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
SignalHandler::set_ignore(SIGPIPE);
|
SignalHandler::set_ignore(SIGPIPE);
|
||||||
SignalHandler::set_handler(SIGINT, sigc::mem_fun(uiControl, &ui::Control::receive_shutdown));
|
SignalHandler::set_handler(SIGINT, sigc::mem_fun(uiControl, &Control::receive_shutdown));
|
||||||
SignalHandler::set_handler(SIGSEGV, sigc::bind(sigc::ptr_fun(&do_panic), SIGSEGV));
|
SignalHandler::set_handler(SIGSEGV, sigc::bind(sigc::ptr_fun(&do_panic), SIGSEGV));
|
||||||
SignalHandler::set_handler(SIGBUS, sigc::bind(sigc::ptr_fun(&do_panic), SIGBUS));
|
SignalHandler::set_handler(SIGBUS, sigc::bind(sigc::ptr_fun(&do_panic), SIGBUS));
|
||||||
SignalHandler::set_handler(SIGFPE, sigc::bind(sigc::ptr_fun(&do_panic), SIGFPE));
|
SignalHandler::set_handler(SIGFPE, sigc::bind(sigc::ptr_fun(&do_panic), SIGFPE));
|
||||||
|
|||||||
+23
-23
@@ -41,7 +41,7 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
|
||||||
#include "utils/directory.h"
|
#include "utils/directory.h"
|
||||||
#include "ui/control.h"
|
#include "control.h"
|
||||||
#include "option_handler_rules.h"
|
#include "option_handler_rules.h"
|
||||||
|
|
||||||
void receive_tracker_dump(std::istream* s);
|
void receive_tracker_dump(std::istream* s);
|
||||||
@@ -115,22 +115,22 @@ validate_throttle_interval(int arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_download_min_peers(ui::Control* m, int arg) {
|
apply_download_min_peers(Control* m, int arg) {
|
||||||
m->get_core().get_download_list().slot_map_insert()["1_min_peers"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_peers_min>), arg);
|
m->get_core().get_download_list().slot_map_insert()["1_min_peers"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_peers_min>), arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_download_max_peers(ui::Control* m, int arg) {
|
apply_download_max_peers(Control* m, int arg) {
|
||||||
m->get_core().get_download_list().slot_map_insert()["1_max_peers"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_peers_max>), arg);
|
m->get_core().get_download_list().slot_map_insert()["1_max_peers"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_peers_max>), arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_download_max_uploads(ui::Control* m, int arg) {
|
apply_download_max_uploads(Control* m, int arg) {
|
||||||
m->get_core().get_download_list().slot_map_insert()["1_max_uploads"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_uploads_max>), arg);
|
m->get_core().get_download_list().slot_map_insert()["1_max_uploads"] = sigc::bind(sigc::mem_fun(&core::Download::call<void, uint32_t, &torrent::Download::set_uploads_max>), arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_download_directory(ui::Control* m, const std::string& arg) {
|
apply_download_directory(Control* m, const std::string& arg) {
|
||||||
if (!arg.empty())
|
if (!arg.empty())
|
||||||
m->get_core().get_download_list().slot_map_insert()["1_directory"] = sigc::bind(sigc::mem_fun(&core::Download::set_root_directory), arg);
|
m->get_core().get_download_list().slot_map_insert()["1_directory"] = sigc::bind(sigc::mem_fun(&core::Download::set_root_directory), arg);
|
||||||
else
|
else
|
||||||
@@ -138,69 +138,69 @@ apply_download_directory(ui::Control* m, const std::string& arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_connection_leech(ui::Control* m, const std::string& arg) {
|
apply_connection_leech(Control* m, const std::string& arg) {
|
||||||
m->get_core().get_download_list().slot_map_insert()["1_connection_leech"] = sigc::bind(sigc::mem_fun(&core::Download::set_connection_leech), arg);
|
m->get_core().get_download_list().slot_map_insert()["1_connection_leech"] = sigc::bind(sigc::mem_fun(&core::Download::set_connection_leech), arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_connection_seed(ui::Control* m, const std::string& arg) {
|
apply_connection_seed(Control* m, const std::string& arg) {
|
||||||
m->get_core().get_download_list().slot_map_insert()["1_connection_seed"] = sigc::bind(sigc::mem_fun(&core::Download::set_connection_seed), arg);
|
m->get_core().get_download_list().slot_map_insert()["1_connection_seed"] = sigc::bind(sigc::mem_fun(&core::Download::set_connection_seed), arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_global_download_rate(ui::Control* m, int arg) {
|
apply_global_download_rate(Control* m, int arg) {
|
||||||
torrent::set_down_throttle(arg * 1024);
|
torrent::set_down_throttle(arg * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_global_upload_rate(ui::Control* m, int arg) {
|
apply_global_upload_rate(Control* m, int arg) {
|
||||||
torrent::set_up_throttle(arg * 1024);
|
torrent::set_up_throttle(arg * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_hash_read_ahead(ui::Control* m, int arg) {
|
apply_hash_read_ahead(Control* m, int arg) {
|
||||||
torrent::set_hash_read_ahead(arg << 20);
|
torrent::set_hash_read_ahead(arg << 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_hash_interval(ui::Control* m, int arg) {
|
apply_hash_interval(Control* m, int arg) {
|
||||||
torrent::set_hash_interval(arg * 1000);
|
torrent::set_hash_interval(arg * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_hash_max_tries(ui::Control* m, int arg) {
|
apply_hash_max_tries(Control* m, int arg) {
|
||||||
torrent::set_hash_max_tries(arg);
|
torrent::set_hash_max_tries(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_max_open_files(ui::Control* m, int arg) {
|
apply_max_open_files(Control* m, int arg) {
|
||||||
torrent::set_max_open_files(arg);
|
torrent::set_max_open_files(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_max_open_sockets(ui::Control* m, int arg) {
|
apply_max_open_sockets(Control* m, int arg) {
|
||||||
torrent::set_max_open_sockets(arg);
|
torrent::set_max_open_sockets(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_throttle_interval(ui::Control* m, int arg) {
|
apply_throttle_interval(Control* m, int arg) {
|
||||||
torrent::set_throttle_interval(arg * 1000);
|
torrent::set_throttle_interval(arg * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_bind(ui::Control* m, const std::string& arg) {
|
apply_bind(Control* m, const std::string& arg) {
|
||||||
torrent::set_bind_address(arg);
|
torrent::set_bind_address(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_ip(ui::Control* m, const std::string& arg) {
|
apply_ip(Control* m, const std::string& arg) {
|
||||||
torrent::set_local_address(arg);
|
torrent::set_local_address(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The arg string *must* have been checked with validate_port_range
|
// The arg string *must* have been checked with validate_port_range
|
||||||
// first.
|
// first.
|
||||||
void
|
void
|
||||||
apply_port_range(ui::Control* m, const std::string& arg) {
|
apply_port_range(Control* m, const std::string& arg) {
|
||||||
int a = 0, b = 0;
|
int a = 0, b = 0;
|
||||||
|
|
||||||
std::sscanf(arg.c_str(), "%i-%i", &a, &b);
|
std::sscanf(arg.c_str(), "%i-%i", &a, &b);
|
||||||
@@ -209,12 +209,12 @@ apply_port_range(ui::Control* m, const std::string& arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_port_random(ui::Control* m, const std::string& arg) {
|
apply_port_random(Control* m, const std::string& arg) {
|
||||||
m->get_core().set_port_random(arg == "yes");
|
m->get_core().set_port_random(arg == "yes");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_tracker_dump(ui::Control* m, const std::string& arg) {
|
apply_tracker_dump(Control* m, const std::string& arg) {
|
||||||
if (arg == "yes")
|
if (arg == "yes")
|
||||||
m->get_core().get_download_list().slot_map_insert()["1_tracker_dump"] = sigc::bind(sigc::mem_fun(&core::Download::call<sigc::connection, torrent::Download::SlotIStream, &torrent::Download::signal_tracker_dump>), sigc::ptr_fun(&receive_tracker_dump));
|
m->get_core().get_download_list().slot_map_insert()["1_tracker_dump"] = sigc::bind(sigc::mem_fun(&core::Download::call<sigc::connection, torrent::Download::SlotIStream, &torrent::Download::signal_tracker_dump>), sigc::ptr_fun(&receive_tracker_dump));
|
||||||
else
|
else
|
||||||
@@ -222,7 +222,7 @@ apply_tracker_dump(ui::Control* m, const std::string& arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_use_udp_trackers(ui::Control* m, const std::string& arg) {
|
apply_use_udp_trackers(Control* m, const std::string& arg) {
|
||||||
if (arg == "yes")
|
if (arg == "yes")
|
||||||
m->get_core().get_download_list().slot_map_insert().erase("1_use_udp_trackers");
|
m->get_core().get_download_list().slot_map_insert().erase("1_use_udp_trackers");
|
||||||
else
|
else
|
||||||
@@ -230,7 +230,7 @@ apply_use_udp_trackers(ui::Control* m, const std::string& arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_check_hash(ui::Control* m, const std::string& arg) {
|
apply_check_hash(Control* m, const std::string& arg) {
|
||||||
if (arg == "yes")
|
if (arg == "yes")
|
||||||
m->get_core().set_check_hash(true);
|
m->get_core().set_check_hash(true);
|
||||||
else
|
else
|
||||||
@@ -238,6 +238,6 @@ apply_check_hash(ui::Control* m, const std::string& arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
apply_session_directory(ui::Control* m, const std::string& arg) {
|
apply_session_directory(Control* m, const std::string& arg) {
|
||||||
m->get_core().get_download_store().use(arg);
|
m->get_core().get_download_store().use(arg);
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-31
@@ -44,9 +44,7 @@
|
|||||||
#include "option_handler.h"
|
#include "option_handler.h"
|
||||||
#include "core/download_slot_map.h"
|
#include "core/download_slot_map.h"
|
||||||
|
|
||||||
namespace ui {
|
class Control;
|
||||||
class Control;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not pretty, but it is simple and easy to modify.
|
// Not pretty, but it is simple and easy to modify.
|
||||||
|
|
||||||
@@ -65,40 +63,40 @@ bool validate_fd(int arg);
|
|||||||
|
|
||||||
bool validate_throttle_interval(int arg);
|
bool validate_throttle_interval(int arg);
|
||||||
|
|
||||||
void apply_download_min_peers(ui::Control* m, int arg);
|
void apply_download_min_peers(Control* m, int arg);
|
||||||
void apply_download_max_peers(ui::Control* m, int arg);
|
void apply_download_max_peers(Control* m, int arg);
|
||||||
void apply_download_max_uploads(ui::Control* m, int arg);
|
void apply_download_max_uploads(Control* m, int arg);
|
||||||
void apply_download_directory(ui::Control* m, const std::string& arg);
|
void apply_download_directory(Control* m, const std::string& arg);
|
||||||
|
|
||||||
void apply_connection_leech(ui::Control* m, const std::string& arg);
|
void apply_connection_leech(Control* m, const std::string& arg);
|
||||||
void apply_connection_seed(ui::Control* m, const std::string& arg);
|
void apply_connection_seed(Control* m, const std::string& arg);
|
||||||
|
|
||||||
void apply_global_download_rate(ui::Control* m, int arg);
|
void apply_global_download_rate(Control* m, int arg);
|
||||||
void apply_global_upload_rate(ui::Control* m, int arg);
|
void apply_global_upload_rate(Control* m, int arg);
|
||||||
|
|
||||||
void apply_hash_read_ahead(ui::Control* m, int arg);
|
void apply_hash_read_ahead(Control* m, int arg);
|
||||||
void apply_hash_interval(ui::Control* m, int arg);
|
void apply_hash_interval(Control* m, int arg);
|
||||||
void apply_hash_max_tries(ui::Control* m, int arg);
|
void apply_hash_max_tries(Control* m, int arg);
|
||||||
void apply_max_open_files(ui::Control* m, int arg);
|
void apply_max_open_files(Control* m, int arg);
|
||||||
void apply_max_open_sockets(ui::Control* m, int arg);
|
void apply_max_open_sockets(Control* m, int arg);
|
||||||
void apply_throttle_interval(ui::Control* m, int arg);
|
void apply_throttle_interval(Control* m, int arg);
|
||||||
|
|
||||||
void apply_ip(ui::Control* m, const std::string& arg);
|
void apply_ip(Control* m, const std::string& arg);
|
||||||
void apply_bind(ui::Control* m, const std::string& arg);
|
void apply_bind(Control* m, const std::string& arg);
|
||||||
void apply_port_range(ui::Control* m, const std::string& arg);
|
void apply_port_range(Control* m, const std::string& arg);
|
||||||
void apply_port_random(ui::Control* m, const std::string& arg);
|
void apply_port_random(Control* m, const std::string& arg);
|
||||||
void apply_tracker_dump(ui::Control* m, const std::string& arg);
|
void apply_tracker_dump(Control* m, const std::string& arg);
|
||||||
void apply_use_udp_trackers(ui::Control* m, const std::string& arg);
|
void apply_use_udp_trackers(Control* m, const std::string& arg);
|
||||||
void apply_check_hash(ui::Control* m, const std::string& arg);
|
void apply_check_hash(Control* m, const std::string& arg);
|
||||||
|
|
||||||
void apply_session_directory(ui::Control* m, const std::string& arg);
|
void apply_session_directory(Control* m, const std::string& arg);
|
||||||
|
|
||||||
class OptionHandlerInt : public OptionHandlerBase {
|
class OptionHandlerInt : public OptionHandlerBase {
|
||||||
public:
|
public:
|
||||||
typedef bool (*Validate)(int);
|
typedef bool (*Validate)(int);
|
||||||
typedef void (*Apply)(ui::Control*, int);
|
typedef void (*Apply)(Control*, int);
|
||||||
|
|
||||||
OptionHandlerInt(ui::Control* c, Apply a, Validate v) :
|
OptionHandlerInt(Control* c, Apply a, Validate v) :
|
||||||
m_control(c), m_apply(a), m_validate(v) {}
|
m_control(c), m_apply(a), m_validate(v) {}
|
||||||
|
|
||||||
virtual void process(const std::string& key, const std::string& arg) {
|
virtual void process(const std::string& key, const std::string& arg) {
|
||||||
@@ -112,7 +110,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ui::Control* m_control;
|
Control* m_control;
|
||||||
Apply m_apply;
|
Apply m_apply;
|
||||||
Validate m_validate;
|
Validate m_validate;
|
||||||
};
|
};
|
||||||
@@ -120,9 +118,9 @@ private:
|
|||||||
class OptionHandlerString : public OptionHandlerBase {
|
class OptionHandlerString : public OptionHandlerBase {
|
||||||
public:
|
public:
|
||||||
typedef bool (*Validate)(const std::string&);
|
typedef bool (*Validate)(const std::string&);
|
||||||
typedef void (*Apply)(ui::Control*, const std::string&);
|
typedef void (*Apply)(Control*, const std::string&);
|
||||||
|
|
||||||
OptionHandlerString(ui::Control* c, Apply a, Validate v) :
|
OptionHandlerString(Control* c, Apply a, Validate v) :
|
||||||
m_control(c), m_apply(a), m_validate(v) {}
|
m_control(c), m_apply(a), m_validate(v) {}
|
||||||
|
|
||||||
virtual void process(const std::string& key, const std::string& arg) {
|
virtual void process(const std::string& key, const std::string& arg) {
|
||||||
@@ -133,7 +131,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ui::Control* m_control;
|
Control* m_control;
|
||||||
Apply m_apply;
|
Apply m_apply;
|
||||||
Validate m_validate;
|
Validate m_validate;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
noinst_LIBRARIES = libsub_ui.a
|
noinst_LIBRARIES = libsub_ui.a
|
||||||
|
|
||||||
libsub_ui_a_SOURCES = \
|
libsub_ui_a_SOURCES = \
|
||||||
control.cc \
|
|
||||||
control.h \
|
|
||||||
download.cc \
|
download.cc \
|
||||||
download.h \
|
download.h \
|
||||||
download_list.cc \
|
download_list.cc \
|
||||||
|
|||||||
+2
-1
@@ -43,6 +43,8 @@
|
|||||||
|
|
||||||
#include "utils/list_focus.h"
|
#include "utils/list_focus.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowTitle;
|
class WindowTitle;
|
||||||
class WindowStatusbar;
|
class WindowStatusbar;
|
||||||
@@ -55,7 +57,6 @@ namespace core {
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
|
||||||
class ElementBase;
|
class ElementBase;
|
||||||
|
|
||||||
class Download {
|
class Download {
|
||||||
|
|||||||
@@ -43,6 +43,8 @@
|
|||||||
#include "utils/task.h"
|
#include "utils/task.h"
|
||||||
#include "utils/list_focus.h"
|
#include "utils/list_focus.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace input {
|
namespace input {
|
||||||
class Bindings;
|
class Bindings;
|
||||||
}
|
}
|
||||||
@@ -58,7 +60,6 @@ namespace display {
|
|||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
|
||||||
class Download;
|
class Download;
|
||||||
class ElementBase;
|
class ElementBase;
|
||||||
|
|
||||||
|
|||||||
@@ -42,14 +42,14 @@
|
|||||||
|
|
||||||
#include "element_base.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowDownloadList;
|
class WindowDownloadList;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
|
||||||
|
|
||||||
class ElementDownloadList : public ElementBase {
|
class ElementDownloadList : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowDownloadList WDownloadList;
|
typedef display::WindowDownloadList WDownloadList;
|
||||||
|
|||||||
@@ -41,14 +41,14 @@
|
|||||||
|
|
||||||
#include "element_base.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowFileList;
|
class WindowFileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
|
||||||
|
|
||||||
class ElementFileList : public ElementBase {
|
class ElementFileList : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef torrent::Entry::Priority Priority;
|
typedef torrent::Entry::Priority Priority;
|
||||||
|
|||||||
@@ -41,14 +41,14 @@
|
|||||||
|
|
||||||
#include "element_base.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowLogComplete;
|
class WindowLogComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
|
||||||
|
|
||||||
class ElementLogComplete : public ElementBase {
|
class ElementLogComplete : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowLogComplete WLogComplete;
|
typedef display::WindowLogComplete WLogComplete;
|
||||||
|
|||||||
@@ -41,14 +41,14 @@
|
|||||||
|
|
||||||
#include "element_base.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowPeerInfo;
|
class WindowPeerInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
|
||||||
|
|
||||||
class ElementPeerInfo : public ElementBase {
|
class ElementPeerInfo : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowPeerInfo WPeerInfo;
|
typedef display::WindowPeerInfo WPeerInfo;
|
||||||
|
|||||||
@@ -41,14 +41,14 @@
|
|||||||
|
|
||||||
#include "element_base.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowPeerList;
|
class WindowPeerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
|
||||||
|
|
||||||
class ElementPeerList : public ElementBase {
|
class ElementPeerList : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowPeerList WPeerList;
|
typedef display::WindowPeerList WPeerList;
|
||||||
|
|||||||
@@ -46,10 +46,10 @@
|
|||||||
|
|
||||||
#include "display/window_string_list.h"
|
#include "display/window_string_list.h"
|
||||||
|
|
||||||
namespace ui {
|
|
||||||
|
|
||||||
class Control;
|
class Control;
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
|
||||||
class ElementStringList : public ElementBase {
|
class ElementStringList : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowStringList WStringList;
|
typedef display::WindowStringList WStringList;
|
||||||
|
|||||||
@@ -41,14 +41,14 @@
|
|||||||
|
|
||||||
#include "element_base.h"
|
#include "element_base.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowTrackerList;
|
class WindowTrackerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class Control;
|
|
||||||
|
|
||||||
class ElementTrackerList : public ElementBase {
|
class ElementTrackerList : public ElementBase {
|
||||||
public:
|
public:
|
||||||
typedef display::WindowTrackerList WTrackerList;
|
typedef display::WindowTrackerList WTrackerList;
|
||||||
|
|||||||
+2
-1
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
#include "input/bindings.h"
|
#include "input/bindings.h"
|
||||||
|
|
||||||
|
class Control;
|
||||||
|
|
||||||
namespace display {
|
namespace display {
|
||||||
class WindowStatusbar;
|
class WindowStatusbar;
|
||||||
}
|
}
|
||||||
@@ -46,7 +48,6 @@ namespace display {
|
|||||||
namespace ui {
|
namespace ui {
|
||||||
|
|
||||||
class DownloadList;
|
class DownloadList;
|
||||||
class Control;
|
|
||||||
|
|
||||||
class Root {
|
class Root {
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user