diff --git a/.travis.yml b/.travis.yml index e2c5df1b..9641c06e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ before_install: # prevent `macro `AM_PATH_CPPUNIT' not found in library` in `autogen.sh` - sudo apt-get install libcppunit-dev - - git clone https://github.com/rakshasa/libtorrent.git && cd libtorrent && ./autogen.sh && configure && make -j12 && sudo make install && cd .. + - git clone https://github.com/rakshasa/libtorrent.git && cd libtorrent && ./autogen.sh && ./configure && make -j12 && sudo make install && cd .. # Figure out how to fix the issue running 'make check'. script: ./autogen.sh && ./configure && make -j12 && sudo make install diff --git a/doc/rtorrent.rc b/doc/rtorrent.rc index f58ef4b3..9c940ebe 100644 --- a/doc/rtorrent.rc +++ b/doc/rtorrent.rc @@ -3,61 +3,76 @@ # uncomment the options you wish to enable. # Maximum and minimum number of peers to connect to per torrent. -#min_peers = 40 -#max_peers = 100 +# +#throttle.min_peers.normal.set = 40 +#throttle.max_peers.normal.set = 100 # Same as above but for seeding completed torrents (-1 = same as downloading) -#min_peers_seed = 10 -#max_peers_seed = 50 +# +#throttle.min_peers.seed.set = 10 +#throttle.max_peers.seed.set = 50 # Maximum number of simultanious uploads per torrent. -#max_uploads = 15 +# +#throttle.max_uploads.set = 15 # Global upload and download rate in KiB. "0" for unlimited. -#download_rate = 0 -#upload_rate = 0 +# +#throttle.global_down.max_rate.set_kb = 0 +#throttle.global_up.max_rate.set_kb = 0 # Default directory to save the downloaded torrents. -#directory = ./ +# +#directory.default.set = ./ # Default session directory. Make sure you don't run multiple instance # of rtorrent using the same session directory. Perhaps using a # relative path? -#session = ./session +# +#session.path.set = ./session # Watch a directory for new torrents, and stop those that have been # deleted. -#schedule = watch_directory,5,5,load.start=./watch/*.torrent -#schedule = untied_directory,5,5,stop_untied= +# +#schedule2 = watch_directory,5,5,load.start=./watch/*.torrent +#schedule2 = untied_directory,5,5,stop_untied= # Close torrents when diskspace is low. -#schedule = low_diskspace,5,60,close_low_diskspace=100M +# +#schedule2 = low_diskspace,5,60,close_low_diskspace=100M # The ip address reported to the tracker. -#ip = 127.0.0.1 -#ip = rakshasa.no +# +#network.local_address.set = 127.0.0.1 +#network.local_address.set = rakshasa.no # The ip address the listening socket and outgoing connections is # bound to. -#bind = 127.0.0.1 -#bind = rakshasa.no +# +#network.bind_address.set = 127.0.0.1 +#network.bind_address.set = rakshasa.no # Port range to use for listening. -#port_range = 6890-6999 +# +#network.port_range.set = 6890-6999 # Start opening ports at a random position within the port range. -#port_random = no +# +#network.port_random.set = no # Check hash for finished torrents. Might be usefull until the bug is # fixed that causes lack of diskspace not to be properly reported. -#check_hash = no +# +#pieces.hash.on_completion.set = no # Set whether the client should try to connect to UDP trackers. -#use_udp_trackers = yes +# +#trackers.use_udp.set = yes # Alternative calls to bind and ip that should handle dynamic ip's. -#schedule = ip_tick,0,1800,ip=rakshasa -#schedule = bind_tick,0,1800,bind=rakshasa +# +#schedule2 = ip_tick,0,1800,ip=rakshasa +#schedule2 = bind_tick,0,1800,bind=rakshasa # Encryption options, set to none (default) or any combination of the following: # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext @@ -66,19 +81,23 @@ # outgoing connections but retries with encryption if they fail, preferring # plaintext to RC4 encryption after the encrypted handshake # -# encryption = allow_incoming,enable_retry,prefer_plaintext +# protocol.encryption.set = allow_incoming,enable_retry,prefer_plaintext # Enable DHT support for trackerless torrents or when all trackers are down. # May be set to "disable" (completely disable DHT), "off" (do not start DHT), # "auto" (start and stop DHT as needed), or "on" (start DHT immediately). # The default is "off". For DHT to work, a session directory must be defined. # -# dht = auto +# dht.mode.set = auto # UDP port to use for DHT. -# -# dht_port = 6881 +# +#dht.port.set = 6881 # Enable peer exchange (for torrents not marked private) # -# peer_exchange = yes +#protocol.pex.set = yes + +# Set downlad list layout style. ("full", "compact") +# +#torrent_list_layout = "full" diff --git a/src/command_download.cc b/src/command_download.cc index 5a1b2ed3..40cc5dea 100644 --- a/src/command_download.cc +++ b/src/command_download.cc @@ -683,6 +683,7 @@ initialize_command_download() { CMD2_DL ("d.is_pex_active", CMD2_ON_INFO(is_pex_active)); CMD2_DL ("d.is_partially_done", CMD2_ON_DATA(is_partially_done)); CMD2_DL ("d.is_not_partially_done", CMD2_ON_DATA(is_not_partially_done)); + CMD2_DL ("d.is_meta", CMD2_ON_INFO(is_meta_download)); CMD2_DL_V ("d.resume", std::bind(&core::DownloadList::resume_default, control->core()->download_list(), std::placeholders::_1)); CMD2_DL_V ("d.pause", std::bind(&core::DownloadList::pause_default, control->core()->download_list(), std::placeholders::_1)); diff --git a/src/command_local.cc b/src/command_local.cc index 9236f9bb..741b3000 100644 --- a/src/command_local.cc +++ b/src/command_local.cc @@ -242,7 +242,7 @@ initialize_command_local() { CMD2_VAR_C_STRING("system.client_version", PACKAGE_VERSION); CMD2_VAR_C_STRING("system.library_version", torrent::version()); CMD2_VAR_VALUE ("system.file.allocate", 0); - CMD2_VAR_VALUE ("system.file.max_size", (int64_t)128 << 30); + CMD2_VAR_VALUE ("system.file.max_size", (int64_t)512 << 30); CMD2_VAR_VALUE ("system.file.split_size", -1); CMD2_VAR_STRING ("system.file.split_suffix", ".part"); diff --git a/src/command_ui.cc b/src/command_ui.cc index bc9124dc..69ee2f54 100644 --- a/src/command_ui.cc +++ b/src/command_ui.cc @@ -555,6 +555,9 @@ initialize_command_ui() { CMD2_ANY ("ui.current_view", std::bind(&cmd_ui_current_view)); CMD2_ANY_STRING("ui.current_view.set", std::bind(&cmd_ui_set_view, std::placeholders::_2)); + // TODO: Add 'option_string' for rtorrent-specific options. + CMD2_VAR_STRING("ui.torrent_list.layout", "full"); + // Move. CMD2_ANY("print", &apply_print); CMD2_ANY("cat", &apply_cat); diff --git a/src/core/view.cc b/src/core/view.cc index c57c0f0e..842fdbbf 100644 --- a/src/core/view.cc +++ b/src/core/view.cc @@ -257,6 +257,10 @@ View::sort() { void View::filter() { + // Do NOT allow filter STARTED and STOPPED views: they are special + if (m_name == "started" || m_name == "stopped") + return; + // Parition the list in two steps so we know which elements changed. iterator splitVisible = std::stable_partition(begin_visible(), end_visible(), view_downloads_filter(m_filter)); iterator splitFiltered = std::stable_partition(begin_filtered(), end_filtered(), view_downloads_filter(m_filter)); diff --git a/src/display/utils.cc b/src/display/utils.cc index 2ab4c1a7..93011e82 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -133,7 +133,7 @@ print_download_title(char* first, char* last, core::Download* d) { } char* -print_download_info(char* first, char* last, core::Download* d) { +print_download_info_full(char* first, char* last, core::Download* d) { if (!d->download()->info()->is_open()) first = print_buffer(first, last, "[CLOSED] "); else if (!d->download()->info()->is_active()) @@ -177,7 +177,7 @@ print_download_info(char* first, char* last, core::Download* d) { first = print_buffer(first, last , "]"); if (first > last) - throw torrent::internal_error("print_download_info(...) wrote past end of the buffer."); + throw torrent::internal_error("print_download_info_full(...) wrote past end of the buffer."); return first; } @@ -218,6 +218,68 @@ print_download_status(char* first, char* last, core::Download* d) { return first; } +char* +print_download_column_compact(char* first, char* last) { + first = print_buffer(first, last, " %-64.64s", "Name"); + first = print_buffer(first, last, "| Status | Downloaded | Size | Done | Up Rate | Down Rate | Uploaded | ETA | Ratio| Misc "); + + if (first > last) + throw torrent::internal_error("print_download_column_compact(...) wrote past end of the buffer."); + + return first; +} + +char* +print_download_info_compact(char* first, char* last, core::Download* d) { + first = print_buffer(first, last, " %-64.64s", d->info()->name().c_str()); + first = print_buffer(first, last, "|"); + + if (!d->download()->info()->is_open()) + first = print_buffer(first, last, " CLOSED "); + else if (!d->download()->info()->is_active()) + first = print_buffer(first, last, " OPEN "); + else + first = print_buffer(first, last, " "); + + first = print_buffer(first, last, "| %7.1f MB ", (double)d->download()->bytes_done() / (double)(1 << 20)); + first = print_buffer(first, last, "| %7.1f MB ", (double)d->download()->file_list()->size_bytes() / (double)(1 << 20)); + first = print_buffer(first, last, "|"); + + if (d->is_done()) + first = print_buffer(first, last, " 100%% "); + else if (d->is_open()) + first = print_buffer(first, last, " %2u%% ",(d->download()->file_list()->completed_chunks() * 100) / d->download()->file_list()->size_chunks()); + else + first = print_buffer(first, last, " "); + + first = print_buffer(first, last, "| %6.1f KB ", (double)d->info()->up_rate()->rate() / (1 << 10)); + first = print_buffer(first, last, "| %6.1f KB ", (double)d->info()->down_rate()->rate() / (1 << 10)); + first = print_buffer(first, last, "| %7.1f MB ", (double)d->info()->up_rate()->total() / (1 << 20)); + first = print_buffer(first, last, "| "); + + if (d->download()->info()->is_active() && !d->is_done()) + first = print_download_time_left(first, last, d); + else + first = print_buffer(first, last, " "); + + first = print_buffer(first, last, "| %4.2f ", (double)rpc::call_command_value("d.ratio", rpc::make_target(d)) / 1000.0); + first = print_buffer(first, last, "| %c%c", + rpc::call_command_string("d.tied_to_file", rpc::make_target(d)).empty() ? ' ' : 'T', + rpc::call_command_value("d.ignore_commands", rpc::make_target(d)) == 0 ? ' ' : 'I', + (double)rpc::call_command_value("d.ratio", rpc::make_target(d)) / 1000.0); + + if (d->priority() != 2) + first = print_buffer(first, last, " %s", rpc::call_command_string("d.priority_str", rpc::make_target(d)).c_str()); + + if (!d->bencode()->get_key("rtorrent").get_key_string("throttle_name").empty()) + first = print_buffer(first, last , " %s", rpc::call_command_string("d.throttle_name", rpc::make_target(d)).c_str()); + + if (first > last) + throw torrent::internal_error("print_download_info_compact(...) wrote past end of the buffer."); + + return first; +} + char* print_download_time_left(char* first, char* last, core::Download* d) { uint32_t rate = d->info()->down_rate()->rate(); diff --git a/src/display/utils.h b/src/display/utils.h index 7f75425c..eb2daf8e 100644 --- a/src/display/utils.h +++ b/src/display/utils.h @@ -66,8 +66,12 @@ char* print_ddhhmm(char* first, char* last, time_t t); char* print_ddmmyyyy(char* first, char* last, time_t t); char* print_download_title(char* first, char* last, core::Download* d); -char* print_download_info(char* first, char* last, core::Download* d); +char* print_download_info_full(char* first, char* last, core::Download* d); char* print_download_status(char* first, char* last, core::Download* d); + +char* print_download_column_compact(char* first, char* last); +char* print_download_info_compact(char* first, char* last, core::Download* d); + char* print_download_time_left(char* first, char* last, core::Download* d); char* print_download_percentage_done(char* first, char* last, core::Download* d); diff --git a/src/display/window_download_list.cc b/src/display/window_download_list.cc index 138ea8c9..74911555 100644 --- a/src/display/window_download_list.cc +++ b/src/display/window_download_list.cc @@ -40,6 +40,7 @@ #include "core/download.h" #include "core/view.h" +#include "rpc/parse_commands.h" #include "canvas.h" #include "globals.h" @@ -85,12 +86,24 @@ WindowDownloadList::redraw() { if (m_view->empty_visible() || m_canvas->width() < 5 || m_canvas->height() < 2) return; + int layout_height; + const std::string layout_name = rpc::call_command_string("ui.torrent_list.layout"); + + if (layout_name == "full") { + layout_height = 3; + } else if (layout_name == "compact") { + layout_height = 1; + } else { + m_canvas->print(0, 0, "INVALID ui.torrent_list.layout '%s'", layout_name.c_str()); + return; + } + typedef std::pair Range; Range range = rak::advance_bidirectional(m_view->begin_visible(), m_view->focus() != m_view->end_visible() ? m_view->focus() : m_view->begin_visible(), m_view->end_visible(), - m_canvas->height() / 3); + m_canvas->height() / layout_height); // Make sure we properly fill out the last lines so it looks like // there are more torrents, yet don't hide it if we got the last one @@ -99,22 +112,38 @@ WindowDownloadList::redraw() { ++range.second; int pos = 1; + char buffer[m_canvas->width() + 1]; + char* last = buffer + m_canvas->width() - 2 + 1; - while (range.first != range.second) { - char buffer[m_canvas->width() + 1]; - char* last = buffer + m_canvas->width() - 2 + 1; + // Add a proper 'column info' method. + if (layout_name == "compact") { + print_download_column_compact(buffer, last); - print_download_title(buffer, last, *range.first); - m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); - - print_download_info(buffer, last, *range.first); - m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); + m_canvas->set_default_attributes(A_BOLD); + m_canvas->print(0, pos++, " %s", buffer); + } - print_download_status(buffer, last, *range.first); - m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); + if (layout_name == "full") { + while (range.first != range.second) { + print_download_title(buffer, last, *range.first); + m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); + print_download_info_full(buffer, last, *range.first); + m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); + print_download_status(buffer, last, *range.first); + m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); - ++range.first; - } + range.first++; + } + + } else { + while (range.first != range.second) { + print_download_info_compact(buffer, last, *range.first); + m_canvas->set_default_attributes(range.first == m_view->focus() ? A_REVERSE : A_NORMAL); + m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); + + range.first++; + } + } } } diff --git a/src/display/window_download_statusbar.cc b/src/display/window_download_statusbar.cc index bbf0379f..284b8b54 100644 --- a/src/display/window_download_statusbar.cc +++ b/src/display/window_download_statusbar.cc @@ -66,7 +66,7 @@ WindowDownloadStatusbar::redraw() { char buffer[m_canvas->width()]; char* last = buffer + m_canvas->width() - 2; - print_download_info(buffer, last, m_download); + print_download_info_full(buffer, last, m_download); m_canvas->print(0, 0, "%s", buffer); snprintf(buffer, last - buffer, "Peers: %i(%i) Min/Max: %i/%i Slots: U:%i/%i D:%i/%i U/I/C/A: %i/%i/%i/%i Unchoked: %u/%u Failed: %i", diff --git a/src/main.cc b/src/main.cc index 2bd73815..687e57c8 100644 --- a/src/main.cc +++ b/src/main.cc @@ -233,7 +233,7 @@ main(int argc, char** argv) { if (OptionParser::has_flag('D', argc, argv)) { rpc::call_command_set_value("method.use_deprecated.set", true); - lt_log_print(torrent::LOG_WARN, "Disabled deprecated commands."); + lt_log_print(torrent::LOG_WARN, "Enabled deprecated commands."); } if (OptionParser::has_flag('I', argc, argv)) { @@ -416,6 +416,8 @@ main(int argc, char** argv) { CMD2_REDIRECT_GENERIC("to_xb", "convert.xb"); CMD2_REDIRECT_GENERIC("to_throttle", "convert.throttle"); + CMD2_REDIRECT ("torrent_list_layout", "ui.torrent_list.layout.set"); + // Deprecated commands. Don't use these anymore. if (rpc::call_command_value("method.use_intermediate") == 1) { @@ -434,399 +436,6 @@ main(int argc, char** argv) { #if LT_SLIM_VERSION != 1 if (rpc::call_command_value("method.use_deprecated")) { - // Deprecated in 0.7.0: - - CMD2_REDIRECT_GENERIC("system.method.insert", "method.insert"); - CMD2_REDIRECT_GENERIC("system.method.erase", "method.erase"); - CMD2_REDIRECT_GENERIC("system.method.get", "method.get"); - CMD2_REDIRECT_GENERIC("system.method.set", "method.set"); - CMD2_REDIRECT_GENERIC("system.method.list_keys", "method.list_keys"); - CMD2_REDIRECT_GENERIC("system.method.has_key", "method.has_key"); - CMD2_REDIRECT_GENERIC("system.method.set_key", "method.set_key"); - - CMD2_REDIRECT ("get_directory", "directory.default"); - CMD2_REDIRECT_GENERIC("set_directory", "directory.default.set"); - - CMD2_REDIRECT ("get_session", "session.path"); - CMD2_REDIRECT_GENERIC("set_session", "session.path.set"); - - CMD2_REDIRECT ("session_save", "session.save"); - - CMD2_REDIRECT ("get_name", "session.name"); - CMD2_REDIRECT_GENERIC("set_name", "session.name.set"); - - CMD2_REDIRECT ("system.file_allocate", "system.file.allocate"); - CMD2_REDIRECT ("system.file_allocate.set", "system.file.allocate.set"); - CMD2_REDIRECT ("get_max_file_size", "system.file.max_size"); - CMD2_REDIRECT_GENERIC("set_max_file_size", "system.file.max_size.set"); - CMD2_REDIRECT ("get_split_file_size", "system.file.split_size"); - CMD2_REDIRECT_GENERIC("set_split_file_size", "system.file.split_size.set"); - CMD2_REDIRECT ("get_split_suffix", "system.file.split_suffix"); - CMD2_REDIRECT_GENERIC("set_split_suffix", "system.file.split_suffix.set"); - - CMD2_REDIRECT ("get_timeout_sync", "pieces.sync.timeout"); - CMD2_REDIRECT_GENERIC("set_timeout_sync", "pieces.sync.timeout.set"); - CMD2_REDIRECT ("get_timeout_safe_sync", "pieces.sync.timeout_safe"); - CMD2_REDIRECT_GENERIC("set_timeout_safe_sync", "pieces.sync.timeout_safe.set"); - - CMD2_REDIRECT_GENERIC("get_preload_type", "pieces.preload.type"); - CMD2_REDIRECT_GENERIC("get_preload_min_size", "pieces.preload.min_size"); - CMD2_REDIRECT_GENERIC("get_preload_required_rate", "pieces.preload.min_rate"); - CMD2_REDIRECT_GENERIC("set_preload_type", "pieces.preload.type.set"); - CMD2_REDIRECT_GENERIC("set_preload_min_size", "pieces.preload.min_size.set"); - CMD2_REDIRECT_GENERIC("set_preload_required_rate", "pieces.preload.min_rate.set"); - CMD2_REDIRECT_GENERIC("get_stats_preloaded", "pieces.stats_preloaded"); - CMD2_REDIRECT_GENERIC("get_stats_not_preloaded", "pieces.stats_not_preloaded"); - - CMD2_REDIRECT_GENERIC("get_safe_sync", "pieces.sync.always_safe"); - CMD2_REDIRECT_GENERIC("set_safe_sync", "pieces.sync.always_safe.set"); - - CMD2_REDIRECT ("get_memory_usage", "pieces.memory.current"); - CMD2_REDIRECT_GENERIC("get_max_memory_usage", "pieces.memory.max"); - CMD2_REDIRECT_GENERIC("set_max_memory_usage", "pieces.memory.max.set"); - - CMD2_REDIRECT_GENERIC("load", "load.normal"); - CMD2_REDIRECT_GENERIC("load_verbose", "load.verbose"); - CMD2_REDIRECT_GENERIC("load_start", "load.start"); - CMD2_REDIRECT_GENERIC("load_start_verbose", "load.start_verbose"); - - CMD2_REDIRECT_GENERIC("load_raw", "load.raw"); - CMD2_REDIRECT_GENERIC("load_raw_start", "load.raw_start"); - CMD2_REDIRECT_GENERIC("load_raw_verbose", "load.raw_verbose"); - - CMD2_REDIRECT_GENERIC("get_connection_leech", "protocol.connection.leech"); - CMD2_REDIRECT_GENERIC("get_connection_seed", "protocol.connection.seed"); - CMD2_REDIRECT_GENERIC("set_connection_leech", "protocol.connection.leech.set"); - CMD2_REDIRECT_GENERIC("set_connection_seed", "protocol.connection.seed.set"); - - // - // Throttle: - // - - CMD2_REDIRECT_GENERIC("throttle_up", "throttle.up"); - CMD2_REDIRECT_GENERIC("throttle_down", "throttle.down"); - CMD2_REDIRECT_GENERIC("throttle_ip", "throttle.ip"); - - CMD2_REDIRECT_GENERIC("get_throttle_up_max", "throttle.up.max"); - CMD2_REDIRECT_GENERIC("get_throttle_up_rate", "throttle.up.rate"); - CMD2_REDIRECT_GENERIC("get_throttle_down_max", "throttle.down.max"); - CMD2_REDIRECT_GENERIC("get_throttle_down_rate", "throttle.down.rate"); - - CMD2_REDIRECT_GENERIC("set_min_peers", "throttle.min_peers.normal.set"); - CMD2_REDIRECT_GENERIC("set_max_peers", "throttle.max_peers.normal.set"); - CMD2_REDIRECT_GENERIC("set_min_peers_seed", "throttle.min_peers.seed.set"); - CMD2_REDIRECT_GENERIC("set_max_peers_seed", "throttle.max_peers.seed.set"); - - CMD2_REDIRECT_GENERIC("set_max_uploads", "throttle.max_uploads.set"); - - CMD2_REDIRECT_GENERIC("set_max_uploads_div", "throttle.max_uploads.div.set"); - CMD2_REDIRECT_GENERIC("set_max_uploads_global", "throttle.max_uploads.global.set"); - CMD2_REDIRECT_GENERIC("set_max_downloads_div", "throttle.max_downloads.div.set"); - CMD2_REDIRECT_GENERIC("set_max_downloads_global", "throttle.max_downloads.global.set"); - - CMD2_REDIRECT ("get_min_peers", "throttle.min_peers.normal"); - CMD2_REDIRECT ("get_max_peers", "throttle.max_peers.normal"); - CMD2_REDIRECT ("get_min_peers_seed", "throttle.min_peers.seed"); - CMD2_REDIRECT ("get_max_peers_seed", "throttle.max_peers.seed"); - - CMD2_REDIRECT ("get_max_uploads", "throttle.max_uploads"); - - CMD2_REDIRECT ("get_max_uploads_div", "throttle.max_uploads.div"); - CMD2_REDIRECT ("get_max_uploads_global", "throttle.max_uploads.global"); - CMD2_REDIRECT ("get_max_downloads_div", "throttle.max_downloads.div"); - CMD2_REDIRECT ("get_max_downloads_global", "throttle.max_downloads.global"); - - CMD2_REDIRECT ("get_up_rate", "throttle.global_up.rate"); - CMD2_REDIRECT ("get_up_total", "throttle.global_up.total"); - CMD2_REDIRECT ("get_upload_rate", "throttle.global_up.max_rate"); - CMD2_REDIRECT_GENERIC("set_upload_rate", "throttle.global_up.max_rate.set"); - CMD2_REDIRECT ("get_down_rate", "throttle.global_down.rate"); - CMD2_REDIRECT ("get_down_total", "throttle.global_down.total"); - CMD2_REDIRECT ("get_download_rate", "throttle.global_down.max_rate"); - CMD2_REDIRECT_GENERIC("set_download_rate", "throttle.global_down.max_rate.set"); - - // - // Network: - // - - CMD2_REDIRECT ("get_send_buffer_size", "network.send_buffer.size"); - CMD2_REDIRECT_GENERIC("set_send_buffer_size", "network.send_buffer.size.set"); - CMD2_REDIRECT ("get_receive_buffer_size", "network.receive_buffer.size"); - CMD2_REDIRECT_GENERIC("set_receive_buffer_size", "network.receive_buffer.size.set"); - - CMD2_REDIRECT_GENERIC("set_bind", "network.bind_address.set"); - CMD2_REDIRECT ("get_bind", "network.bind_address"); - - CMD2_REDIRECT_GENERIC("set_ip", "network.local_address.set"); - CMD2_REDIRECT ("get_ip", "network.local_address"); - - CMD2_REDIRECT ("get_port_range", "network.port_range"); - CMD2_REDIRECT_GENERIC("set_port_range", "network.port_range.set"); - - CMD2_REDIRECT ("get_port_random", "network.port_random"); - CMD2_REDIRECT_GENERIC("set_port_random", "network.port_random.set"); - - CMD2_REDIRECT ("port_open", "network.port_open.set"); - CMD2_REDIRECT ("get_port_open", "network.port_open"); - CMD2_REDIRECT_GENERIC("set_port_open", "network.port_open.set"); - - CMD2_REDIRECT_GENERIC("set_proxy_address", "network.proxy_address.set"); - CMD2_REDIRECT ("get_proxy_address", "network.proxy_address"); - - CMD2_REDIRECT_GENERIC("set_scgi_dont_route", "network.scgi.dont_route.set"); - CMD2_REDIRECT ("get_scgi_dont_route", "network.scgi.dont_route"); - - CMD2_REDIRECT ("get_max_open_sockets", "network.max_open_sockets"); - - CMD2_REDIRECT ("get_max_open_files", "network.max_open_files"); - CMD2_REDIRECT_GENERIC("set_max_open_files", "network.max_open_files.set"); - - // - // XMLRPC stuff: - // - - CMD2_REDIRECT_GENERIC("xmlrpc_dialect", "network.xmlrpc.dialect.set"); - CMD2_REDIRECT_GENERIC("set_xmlrpc_dialect", "network.xmlrpc.dialect.set"); - - CMD2_REDIRECT_GENERIC("xmlrpc_size_limit", "network.xmlrpc.size_limit.set"); - CMD2_REDIRECT ("get_xmlrpc_size_limit", "network.xmlrpc.size_limit"); - CMD2_REDIRECT_GENERIC("set_xmlrpc_size_limit", "network.xmlrpc.size_limit.set"); - - // - // HTTP stuff: - // - - CMD2_REDIRECT_GENERIC("http_capath", "network.http.capath.set"); - CMD2_REDIRECT ("get_http_capath", "network.http.capath"); - CMD2_REDIRECT_GENERIC("set_http_capath", "network.http.capath.set"); - - CMD2_REDIRECT_GENERIC("http_cacert", "network.http.cacert.set"); - CMD2_REDIRECT ("get_http_cacert", "network.http.cacert"); - CMD2_REDIRECT_GENERIC("set_http_cacert", "network.http.cacert.set"); - - CMD2_REDIRECT ("get_max_open_http", "network.http.max_open"); - CMD2_REDIRECT_GENERIC("set_max_open_http", "network.http.max_open.set"); - - CMD2_REDIRECT_GENERIC("http_proxy", "network.http.proxy_address.set"); - CMD2_REDIRECT ("get_http_proxy", "network.http.proxy_address"); - CMD2_REDIRECT_GENERIC("set_http_proxy", "network.http.proxy_address.set"); - - CMD2_REDIRECT ("peer_exchange", "protocol.pex.set"); - CMD2_REDIRECT ("get_peer_exchange", "protocol.pex"); - CMD2_REDIRECT_GENERIC("set_peer_exchange", "protocol.pex.set"); - - // - // Trackers: - // - - CMD2_REDIRECT ("tracker_numwant", "trackers.numwant.set"); - CMD2_REDIRECT ("get_tracker_numwant", "trackers.numwant"); - CMD2_REDIRECT_GENERIC("set_tracker_numwant", "trackers.numwant.set"); - - CMD2_REDIRECT ("use_udp_trackers", "trackers.use_udp.set"); - CMD2_REDIRECT ("get_use_udp_trackers", "trackers.use_udp"); - CMD2_REDIRECT_GENERIC("set_use_udp_trackers", "trackers.use_udp.set"); - - // - // DHT stuff - // - - CMD2_REDIRECT ("dht_add_node", "dht.add_node"); - CMD2_REDIRECT ("dht_statistics", "dht.statistics"); - CMD2_REDIRECT ("get_dht_port", "dht.port"); - CMD2_REDIRECT_GENERIC("set_dht_port", "dht.port.set"); - CMD2_REDIRECT ("get_dht_throttle", "dht.throttle.name"); - CMD2_REDIRECT_GENERIC("set_dht_throttle", "dht.throttle.name.set"); - - // - // Various system stuff: - // - - CMD2_REDIRECT ("get_session_lock", "session.use_lock"); - CMD2_REDIRECT_GENERIC("set_session_lock", "session.use_lock.set"); - CMD2_REDIRECT ("get_session_on_completion", "session.on_completion"); - CMD2_REDIRECT_GENERIC("set_session_on_completion", "session.on_completion.set"); - - CMD2_REDIRECT ("get_check_hash", "pieces.hash.on_completion"); - CMD2_REDIRECT_GENERIC("set_check_hash", "pieces.hash.on_completion.set"); - - // - // Download: - // - - CMD2_REDIRECT ("d.get_hash", "d.hash"); - CMD2_REDIRECT ("d.get_local_id", "d.local_id"); - CMD2_REDIRECT ("d.get_local_id_html", "d.local_id_html"); - CMD2_REDIRECT ("d.get_bitfield", "d.bitfield"); - CMD2_REDIRECT ("d.get_base_path", "d.base_path"); - CMD2_REDIRECT ("d.get_base_filename", "d.base_filename"); - - CMD2_REDIRECT ("d.get_name", "d.name"); - CMD2_REDIRECT ("d.get_creation_date", "d.creation_date"); - - CMD2_REDIRECT ("d.get_peer_exchange", "d.peer_exchange"); - - CMD2_REDIRECT ("d.get_up_rate", "d.up.rate"); - CMD2_REDIRECT ("d.get_up_total", "d.up.total"); - CMD2_REDIRECT ("d.get_down_rate", "d.down.rate"); - CMD2_REDIRECT ("d.get_down_total", "d.down.total"); - CMD2_REDIRECT ("d.get_skip_rate", "d.skip.rate"); - CMD2_REDIRECT ("d.get_skip_total", "d.skip.total"); - - // - CMD2_REDIRECT ("d.get_bytes_done", "d.bytes_done"); - CMD2_REDIRECT ("d.get_chunk_size", "d.chunk_size"); - CMD2_REDIRECT ("d.get_chunks_hashed", "d.chunks_hashed"); - CMD2_REDIRECT ("d.get_complete", "d.complete"); - CMD2_REDIRECT ("d.get_completed_bytes", "d.completed_bytes"); - CMD2_REDIRECT ("d.get_completed_chunks", "d.completed_chunks"); - CMD2_REDIRECT ("d.get_connection_current", "d.connection_current"); - CMD2_REDIRECT ("d.get_connection_leech", "d.connection_leech"); - CMD2_REDIRECT ("d.get_connection_seed", "d.connection_seed"); - CMD2_REDIRECT ("d.get_custom", "d.custom"); - CMD2_REDIRECT ("d.get_custom1", "d.custom1"); - CMD2_REDIRECT ("d.get_custom2", "d.custom2"); - CMD2_REDIRECT ("d.get_custom3", "d.custom3"); - CMD2_REDIRECT ("d.get_custom4", "d.custom4"); - CMD2_REDIRECT ("d.get_custom5", "d.custom5"); - CMD2_REDIRECT ("d.get_custom_throw", "d.custom_throw"); - CMD2_REDIRECT ("d.get_directory", "d.directory"); - CMD2_REDIRECT ("d.get_directory_base", "d.directory_base"); - CMD2_REDIRECT ("d.get_free_diskspace", "d.free_diskspace"); - CMD2_REDIRECT ("d.get_hashing", "d.hashing"); - CMD2_REDIRECT ("d.get_hashing_failed", "d.hashing_failed"); - CMD2_REDIRECT ("d.get_ignore_commands", "d.ignore_commands"); - CMD2_REDIRECT ("d.get_left_bytes", "d.left_bytes"); - CMD2_REDIRECT ("d.get_loaded_file", "d.loaded_file"); - CMD2_REDIRECT ("d.get_max_file_size", "d.max_file_size"); - CMD2_REDIRECT ("d.get_max_size_pex", "d.max_size_pex"); - CMD2_REDIRECT ("d.get_message", "d.message"); - CMD2_REDIRECT ("d.get_mode", "d.mode"); - CMD2_REDIRECT ("d.get_peers_accounted", "d.peers_accounted"); - CMD2_REDIRECT ("d.get_peers_complete", "d.peers_complete"); - CMD2_REDIRECT ("d.get_peers_connected", "d.peers_connected"); - CMD2_REDIRECT ("d.get_peers_max", "d.peers_max"); - CMD2_REDIRECT ("d.get_peers_min", "d.peers_min"); - CMD2_REDIRECT ("d.get_peers_not_connected", "d.peers_not_connected"); - CMD2_REDIRECT ("d.get_priority", "d.priority"); - CMD2_REDIRECT ("d.get_priority_str", "d.priority_str"); - CMD2_REDIRECT ("d.get_ratio", "d.ratio"); - CMD2_REDIRECT ("d.get_size_bytes", "d.size_bytes"); - CMD2_REDIRECT ("d.get_size_chunks", "d.size_chunks"); - CMD2_REDIRECT ("d.get_size_files", "d.size_files"); - CMD2_REDIRECT ("d.get_size_pex", "d.size_pex"); - CMD2_REDIRECT ("d.get_state", "d.state"); - CMD2_REDIRECT ("d.get_state_changed", "d.state_changed"); - CMD2_REDIRECT ("d.get_state_counter", "d.state_counter"); - CMD2_REDIRECT ("d.get_throttle_name", "d.throttle_name"); - CMD2_REDIRECT ("d.get_tied_to_file", "d.tied_to_file"); - CMD2_REDIRECT ("d.get_tracker_focus", "d.tracker_focus"); - CMD2_REDIRECT ("d.get_tracker_numwant", "d.tracker_numwant"); - CMD2_REDIRECT ("d.get_tracker_size", "d.tracker_size"); - CMD2_REDIRECT ("d.get_uploads_max", "d.uploads_max"); - - CMD2_REDIRECT ("d.set_connection_current", "d.connection_current.set"); - CMD2_REDIRECT ("d.set_custom", "d.custom.set"); - CMD2_REDIRECT ("d.set_custom1", "d.custom1.set"); - CMD2_REDIRECT ("d.set_custom2", "d.custom2.set"); - CMD2_REDIRECT ("d.set_custom3", "d.custom3.set"); - CMD2_REDIRECT ("d.set_custom4", "d.custom4.set"); - CMD2_REDIRECT ("d.set_custom5", "d.custom5.set"); - CMD2_REDIRECT ("d.set_directory", "d.directory.set"); - CMD2_REDIRECT ("d.set_directory_base", "d.directory_base.set"); - CMD2_REDIRECT ("d.set_hashing_failed", "d.hashing_failed.set"); - CMD2_REDIRECT ("d.set_ignore_commands", "d.ignore_commands.set"); - CMD2_REDIRECT ("d.set_max_file_size", "d.max_file_size.set"); - CMD2_REDIRECT ("d.set_message", "d.message.set"); - CMD2_REDIRECT ("d.set_peers_max", "d.peers_max.set"); - CMD2_REDIRECT ("d.set_peers_min", "d.peers_min.set"); - CMD2_REDIRECT ("d.set_priority", "d.priority.set"); - CMD2_REDIRECT ("d.set_throttle_name", "d.throttle_name.set"); - CMD2_REDIRECT ("d.set_tied_to_file", "d.tied_to_file.set"); - CMD2_REDIRECT ("d.set_tracker_numwant", "d.tracker_numwant.set"); - CMD2_REDIRECT ("d.set_uploads_max", "d.uploads_max.set"); - - CMD2_REDIRECT ("create_link", "d.create_link"); - CMD2_REDIRECT ("delete_link", "d.delete_link"); - CMD2_REDIRECT ("delete_tied", "d.delete_tied"); - - // - // Tracker: - // - - CMD2_REDIRECT_TRACKER("t.get_group", "t.group"); - CMD2_REDIRECT_TRACKER("t.get_id", "t.id"); - CMD2_REDIRECT_TRACKER("t.get_min_interval", "t.min_interval"); - CMD2_REDIRECT_TRACKER("t.get_normal_interval", "t.normal_interval"); - CMD2_REDIRECT_TRACKER("t.get_scrape_complete", "t.scrape_complete"); - CMD2_REDIRECT_TRACKER("t.get_scrape_downloaded", "t.scrape_downloaded"); - CMD2_REDIRECT_TRACKER("t.get_scrape_incomplete", "t.scrape_incomplete"); - CMD2_REDIRECT_TRACKER("t.get_scrape_time_last", "t.scrape_time_last"); - CMD2_REDIRECT_TRACKER("t.get_type", "t.type"); - CMD2_REDIRECT_TRACKER("t.get_url", "t.url"); - CMD2_REDIRECT_TRACKER("t.set_enabled", "t.is_enabled.set"); - - // - // File: - // - - CMD2_REDIRECT_FILE ("f.get_completed_chunks", "f.completed_chunks"); - CMD2_REDIRECT_FILE ("f.get_frozen_path", "f.frozen_path"); - CMD2_REDIRECT_FILE ("f.get_last_touched", "f.last_touched"); - CMD2_REDIRECT_FILE ("f.get_match_depth_next", "f.match_depth_next"); - CMD2_REDIRECT_FILE ("f.get_match_depth_prev", "f.match_depth_prev"); - CMD2_REDIRECT_FILE ("f.get_offset", "f.offset"); - CMD2_REDIRECT_FILE ("f.get_path", "f.path"); - CMD2_REDIRECT_FILE ("f.get_path_components", "f.path_components"); - CMD2_REDIRECT_FILE ("f.get_path_depth", "f.path_depth"); - CMD2_REDIRECT_FILE ("f.get_priority", "f.priority"); - CMD2_REDIRECT_FILE ("f.get_range_first", "f.range_first"); - CMD2_REDIRECT_FILE ("f.get_range_second", "f.range_second"); - CMD2_REDIRECT_FILE ("f.get_size_bytes", "f.size_bytes"); - CMD2_REDIRECT_FILE ("f.get_size_chunks", "f.size_chunks"); - CMD2_REDIRECT_FILE ("f.set_priority", "f.priority.set"); - CMD2_REDIRECT_FILE ("fi.get_filename_last", "fi.filename_last"); - - // - // Peer: - // - - CMD2_REDIRECT ("p.get_address", "p.address"); - CMD2_REDIRECT ("p.get_client_version", "p.client_version"); - CMD2_REDIRECT ("p.get_completed_percent", "p.completed_percent"); - CMD2_REDIRECT ("p.get_down_rate", "p.down_rate"); - CMD2_REDIRECT ("p.get_down_total", "p.down_total"); - CMD2_REDIRECT ("p.get_id", "p.id"); - CMD2_REDIRECT ("p.get_id_html", "p.id_html"); - CMD2_REDIRECT ("p.get_options_str", "p.options_str"); - CMD2_REDIRECT ("p.get_peer_rate", "p.peer_rate"); - CMD2_REDIRECT ("p.get_peer_total", "p.peer_total"); - CMD2_REDIRECT ("p.get_port", "p.port"); - CMD2_REDIRECT ("p.get_up_rate", "p.up_rate"); - CMD2_REDIRECT ("p.get_up_total", "p.up_total"); - - // - // View: - // - - CMD2_REDIRECT_GENERIC("view_add", "view.add"); - CMD2_REDIRECT_GENERIC("view_filter", "view.filter"); - CMD2_REDIRECT_GENERIC("view_filter_on", "view.filter_on"); - CMD2_REDIRECT_GENERIC("view_list", "view.list"); - CMD2_REDIRECT_GENERIC("view_set", "view.set"); - CMD2_REDIRECT_GENERIC("view_sort", "view.sort"); - CMD2_REDIRECT_GENERIC("view_sort_current", "view.sort_current"); - CMD2_REDIRECT_GENERIC("view_sort_new", "view.sort_new"); - - // Rename these to avoid conflicts with old style. - CMD2_REDIRECT_GENERIC("d.multicall", "d.multicall2"); - - CMD2_REDIRECT_GENERIC("execute_throw", "execute.throw"); - CMD2_REDIRECT_GENERIC("execute_nothrow", "execute.nothrow"); - CMD2_REDIRECT_GENERIC("execute_raw", "execute.raw"); - CMD2_REDIRECT_GENERIC("execute_raw_nothrow", "execute.raw_nothrow"); - CMD2_REDIRECT_GENERIC("execute_capture", "execute.capture"); - CMD2_REDIRECT_GENERIC("execute_capture_nothrow", "execute.capture_nothrow"); } #endif diff --git a/src/ui/element_download_list.cc b/src/ui/element_download_list.cc index bc40e7e2..5a782751 100644 --- a/src/ui/element_download_list.cc +++ b/src/ui/element_download_list.cc @@ -99,6 +99,8 @@ ElementDownloadList::ElementDownloadList() : m_bindings[KEY_UP] = m_bindings['P' - '@'] = std::bind(&ElementDownloadList::receive_prev, this); m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::bind(&ElementDownloadList::receive_next, this); + + m_bindings['L'] = std::bind(&ElementDownloadList::toggle_layout, this); } void @@ -221,4 +223,8 @@ ElementDownloadList::receive_change_view(const std::string& name) { set_view(*itr); } +void +ElementDownloadList::toggle_layout() { + rpc::call_command("download.list.layout.set", (rpc::call_command_value("download.list.layout") + 1)%2); +} } diff --git a/src/ui/element_download_list.h b/src/ui/element_download_list.h index 20185b50..5bf4f08f 100644 --- a/src/ui/element_download_list.h +++ b/src/ui/element_download_list.h @@ -77,6 +77,8 @@ public: void receive_change_view(const std::string& name); + void toggle_layout(); + private: WDownloadList* m_window; core::View* m_view;