diff '--color=auto' -ru rtorrent-0.9.8/src/command_network.cc rtorrent-0.9.8_patched/src/command_network.cc --- rtorrent-0.9.8/src/command_network.cc 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/command_network.cc 2019-07-21 15:42:43.880345353 +0200 @@ -237,6 +237,27 @@ CMD2_ANY_STRING ("encoding.add", std::bind(&apply_encoding_list, std::placeholders::_2)); + // Color patch + CMD2_ANY ("colors.color_inactive_fg", std::bind(&ui::Root::get_color_inactive_fg, control->ui())); + CMD2_ANY_VALUE_V ("colors.color_inactive_fg.set", std::bind(&ui::Root::set_color_inactive_fg, control->ui(), std::placeholders::_2)); + CMD2_ANY ("colors.color_inactive_bg", std::bind(&ui::Root::get_color_inactive_bg, control->ui())); + CMD2_ANY_VALUE_V ("colors.color_inactive_bg.set", std::bind(&ui::Root::set_color_inactive_bg, control->ui(), std::placeholders::_2)); + + CMD2_ANY ("colors.color_dead_fg", std::bind(&ui::Root::get_color_dead_fg, control->ui())); + CMD2_ANY_VALUE_V ("colors.color_dead_fg.set", std::bind(&ui::Root::set_color_dead_fg, control->ui(), std::placeholders::_2)); + CMD2_ANY ("colors.color_dead_bg", std::bind(&ui::Root::get_color_dead_bg, control->ui())); + CMD2_ANY_VALUE_V ("colors.color_dead_bg.set", std::bind(&ui::Root::set_color_dead_bg, control->ui(), std::placeholders::_2)); + + CMD2_ANY ("colors.color_active_fg", std::bind(&ui::Root::get_color_active_fg, control->ui())); + CMD2_ANY_VALUE_V ("colors.color_active_fg.set", std::bind(&ui::Root::set_color_active_fg, control->ui(), std::placeholders::_2)); + CMD2_ANY ("colors.color_active_bg", std::bind(&ui::Root::get_color_active_bg, control->ui())); + CMD2_ANY_VALUE_V ("colors.color_active_bg.set", std::bind(&ui::Root::set_color_active_bg, control->ui(), std::placeholders::_2)); + + CMD2_ANY ("colors.color_finished_fg", std::bind(&ui::Root::get_color_finished_fg, control->ui())); + CMD2_ANY_VALUE_V ("colors.color_finished_fg.set", std::bind(&ui::Root::set_color_finished_fg, control->ui(), std::placeholders::_2)); + CMD2_ANY ("colors.color_finished_bg", std::bind(&ui::Root::get_color_finished_bg, control->ui())); + CMD2_ANY_VALUE_V ("colors.color_finished_bg.set", std::bind(&ui::Root::set_color_finished_bg, control->ui(), std::placeholders::_2)); + // Isn't port_open used? CMD2_VAR_BOOL ("network.port_open", true); CMD2_VAR_BOOL ("network.port_random", true); Only in rtorrent-0.9.8_patched/src/core: .deps Only in rtorrent-0.9.8/src/core: Makefile.am Only in rtorrent-0.9.8/src/core: Makefile.in Only in rtorrent-0.9.8_patched/src: .deps diff '--color=auto' -ru rtorrent-0.9.8/src/display/canvas.cc rtorrent-0.9.8_patched/src/display/canvas.cc --- rtorrent-0.9.8/src/display/canvas.cc 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/display/canvas.cc 2019-07-21 15:42:43.873678687 +0200 @@ -111,6 +111,12 @@ if (!m_isDaemon) { initscr(); + start_color(); + use_default_colors(); + init_pair(4, -1, -1); + init_pair(3, -1, -1); + init_pair(2, -1, -1); + init_pair(1, -1, -1); raw(); noecho(); nodelay(stdscr, TRUE); Only in rtorrent-0.9.8_patched/src/display: .deps Only in rtorrent-0.9.8/src/display: Makefile.am Only in rtorrent-0.9.8/src/display: Makefile.in diff '--color=auto' -ru rtorrent-0.9.8/src/display/window_download_list.cc rtorrent-0.9.8_patched/src/display/window_download_list.cc --- rtorrent-0.9.8/src/display/window_download_list.cc 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/display/window_download_list.cc 2019-07-21 15:42:43.873678687 +0200 @@ -37,6 +37,7 @@ #include "config.h" #include +#include #include "core/download.h" #include "core/view.h" @@ -135,7 +136,40 @@ 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); + + /* + There are four states where colors are applied: + 1 inactive # If inactive, e.g. user stopped down/upload + 2 dead # If active but no down/upload + 3 active # If active and download + 4 finished # If finished + */ + m_canvas->print(0, pos, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); + if( (*range.first)->is_done() ) { + if( (*range.first)->download()->info()->up_rate()->rate() != 0 ) { + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_BOLD, 4); // Finished and uploading + } else { + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_NORMAL, 4); // Finished + } + } else if( (*range.first)->is_active() ) { + if( (*range.first)->download()->info()->down_rate()->rate() != 0 ) { + if( (*range.first)->download()->info()->up_rate()->rate() != 0 ) { + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_BOLD, 3); // Active and uploading + } else { + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_NORMAL, 3); // Active + } + } else { + if( (*range.first)->download()->info()->up_rate()->rate() != 0 ) { + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_BOLD, 2); // Dead but still uploading + } else { + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_NORMAL, 2); // Dead + } + } + } else { + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_NORMAL, 1); // Inactive + } + pos++; + 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); @@ -155,4 +189,80 @@ } } +// Inactive +void +WindowDownloadList::set_color_inactive_fg(int64_t color) { + short fg, bg; + pair_content(1, &fg, &bg); + if( color < 0 ) color = -1; + color = color % 8; + init_pair(1, (short)color, bg); +} + +void +WindowDownloadList::set_color_inactive_bg(int64_t color) { + short fg, bg; + pair_content(1, &fg, &bg); + if( color < 0 ) color = -1; + color = color % 8; + init_pair(1, fg, (short)color); +} + +// Dead +void +WindowDownloadList::set_color_dead_fg(int64_t color) { + short fg, bg; + pair_content(2, &fg, &bg); + if( color < 0 ) color = -1; + color = color % 8; + init_pair(2, (short)color, bg); +} + +void +WindowDownloadList::set_color_dead_bg(int64_t color) { + short fg, bg; + pair_content(2, &fg, &bg); + if( color < 0 ) color = -1; + color = color % 8; + init_pair(2, fg, (short)color); +} + +// Active +void +WindowDownloadList::set_color_active_fg(int64_t color) { + short fg, bg; + pair_content(3, &fg, &bg); + if( color < 0 ) color = -1; + color = color % 8; + init_pair(3, (short)color, bg); +} + +void +WindowDownloadList::set_color_active_bg(int64_t color) { + short fg, bg; + pair_content(3, &fg, &bg); + if( color < 0 ) color = -1; + color = color % 8; + init_pair(3, fg, (short)color); +} + +// Finished +void +WindowDownloadList::set_color_finished_fg(int64_t color) { + short fg, bg; + pair_content(4, &fg, &bg); + if( color < 0 ) color = -1; + color = color % 8; + init_pair(4, (short)color, bg); +} + +void +WindowDownloadList::set_color_finished_bg(int64_t color) { + short fg, bg; + pair_content(4, &fg, &bg); + if( color < 0 ) color = -1; + color = color % 8; + init_pair(4, fg, (short)color); +} + } diff '--color=auto' -ru rtorrent-0.9.8/src/display/window_download_list.h rtorrent-0.9.8_patched/src/display/window_download_list.h --- rtorrent-0.9.8/src/display/window_download_list.h 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/display/window_download_list.h 2019-07-21 15:42:43.877012021 +0200 @@ -55,6 +55,15 @@ void set_view(core::View* l); + void set_color_inactive_fg(int64_t color); + void set_color_inactive_bg(int64_t color); + void set_color_dead_fg(int64_t color); + void set_color_dead_bg(int64_t color); + void set_color_active_fg(int64_t color); + void set_color_active_bg(int64_t color); + void set_color_finished_fg(int64_t color); + void set_color_finished_bg(int64_t color); + private: core::View* m_view; Only in rtorrent-0.9.8_patched/src/input: .deps Only in rtorrent-0.9.8/src/input: Makefile.am Only in rtorrent-0.9.8/src/input: Makefile.in diff '--color=auto' -ru rtorrent-0.9.8/src/main.cc rtorrent-0.9.8_patched/src/main.cc --- rtorrent-0.9.8/src/main.cc 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/main.cc 2019-07-21 15:42:43.880345353 +0200 @@ -399,6 +399,15 @@ CMD2_REDIRECT ("ip", "network.local_address.set"); CMD2_REDIRECT ("port_range", "network.port_range.set"); + CMD2_REDIRECT ("color_inactive_fg", "colors.color_inactive_fg.set"); + CMD2_REDIRECT ("color_inactive_bg", "colors.color_inactive_bg.set"); + CMD2_REDIRECT ("color_dead_fg", "colors.color_dead_fg.set"); + CMD2_REDIRECT ("color_dead_bg", "colors.color_dead_bg.set"); + CMD2_REDIRECT ("color_active_fg", "colors.color_active_fg.set"); + CMD2_REDIRECT ("color_active_bg", "colors.color_active_bg.set"); + CMD2_REDIRECT ("color_finished_fg", "colors.color_finished_fg.set"); + CMD2_REDIRECT ("color_finished_bg", "colors.color_finished_bg.set"); + CMD2_REDIRECT_GENERIC("dht", "dht.mode.set"); CMD2_REDIRECT_GENERIC("dht_port", "dht.port.set"); Only in rtorrent-0.9.8/src: Makefile.am Only in rtorrent-0.9.8/src: Makefile.in Only in rtorrent-0.9.8_patched/src/rpc: .deps Only in rtorrent-0.9.8/src/rpc: Makefile.am Only in rtorrent-0.9.8/src/rpc: Makefile.in Only in rtorrent-0.9.8_patched/src/ui: .deps diff '--color=auto' -ru rtorrent-0.9.8/src/ui/download_list.cc rtorrent-0.9.8_patched/src/ui/download_list.cc --- rtorrent-0.9.8/src/ui/download_list.cc 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/ui/download_list.cc 2019-07-21 15:42:43.863678687 +0200 @@ -135,6 +135,11 @@ current_view()->next_focus(); } +display::WindowDownloadList* +DownloadList::current_window_list() { + return dynamic_cast(m_uiArray[DISPLAY_DOWNLOAD_LIST])->window(); +} + void DownloadList::activate_display(Display displayType) { if (!is_active()) diff '--color=auto' -ru rtorrent-0.9.8/src/ui/download_list.h rtorrent-0.9.8_patched/src/ui/download_list.h --- rtorrent-0.9.8/src/ui/download_list.h 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/ui/download_list.h 2019-07-21 15:42:43.863678687 +0200 @@ -100,6 +100,7 @@ void activate_display(Display d); core::View* current_view(); + display::WindowDownloadList* current_window_list(); void set_current_view(const std::string& name); void slot_open_uri(slot_string s) { m_slot_open_uri = s; } diff '--color=auto' -ru rtorrent-0.9.8/src/ui/element_download_list.h rtorrent-0.9.8_patched/src/ui/element_download_list.h --- rtorrent-0.9.8/src/ui/element_download_list.h 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/ui/element_download_list.h 2019-07-21 15:42:43.863678687 +0200 @@ -60,6 +60,7 @@ void disable(); core::View* view() { return m_view; } + WDownloadList* window() { return m_window; } void set_view(core::View* l); void receive_command(const char* cmd); Only in rtorrent-0.9.8/src/ui: Makefile.am Only in rtorrent-0.9.8/src/ui: Makefile.in diff '--color=auto' -ru rtorrent-0.9.8/src/ui/root.cc rtorrent-0.9.8_patched/src/ui/root.cc --- rtorrent-0.9.8/src/ui/root.cc 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/ui/root.cc 2019-07-21 15:42:43.863678687 +0200 @@ -47,6 +47,7 @@ #include "core/manager.h" #include "display/frame.h" +#include "display/window_download_list.h" #include "display/window_http_queue.h" #include "display/window_title.h" #include "display/window_input.h" @@ -70,6 +71,14 @@ m_windowHttpQueue(NULL), m_windowInput(NULL), m_windowStatusbar(NULL), + color_inactive_fg(-1), + color_inactive_bg(-1), + color_dead_fg(-1), + color_dead_bg(-1), + color_active_fg(-1), + color_active_bg(-1), + color_finished_fg(-1), + color_finished_bg(-1), m_input_history_length(99), m_input_history_last_input(""), m_input_history_pointer_get(0) { @@ -111,6 +120,14 @@ setup_keys(); m_downloadList->activate(rootFrame->frame(1)); + m_downloadList->current_window_list()->set_color_inactive_fg(color_inactive_fg); + m_downloadList->current_window_list()->set_color_inactive_bg(color_inactive_bg); + m_downloadList->current_window_list()->set_color_dead_fg(color_dead_fg); + m_downloadList->current_window_list()->set_color_dead_bg(color_dead_bg); + m_downloadList->current_window_list()->set_color_active_fg(color_active_fg); + m_downloadList->current_window_list()->set_color_active_bg(color_active_bg); + m_downloadList->current_window_list()->set_color_finished_fg(color_finished_fg); + m_downloadList->current_window_list()->set_color_finished_bg(color_finished_bg); } void @@ -504,4 +521,88 @@ } } +// Inactive +int +Root::get_color_inactive_fg() { + return color_inactive_fg; +} + +void +Root::set_color_inactive_fg(int64_t color) { + color_inactive_fg = color; +} + +int +Root::get_color_inactive_bg() { + return color_inactive_bg; +} + +void +Root::set_color_inactive_bg(int64_t color) { + color_inactive_bg = color; +} + +// Dead +int +Root::get_color_dead_fg() { + return color_dead_fg; +} + +void +Root::set_color_dead_fg(int64_t color) { + color_dead_fg = color; +} + +int +Root::get_color_dead_bg() { + return color_dead_bg; +} + +void +Root::set_color_dead_bg(int64_t color) { + color_dead_bg = color; +} + +// Active +int +Root::get_color_active_fg() { + return color_active_fg; +} + +void +Root::set_color_active_fg(int64_t color) { + color_active_fg = color; +} + +int +Root::get_color_active_bg() { + return color_active_bg; +} + +void +Root::set_color_active_bg(int64_t color) { + color_active_bg = color; +} + +// Finished +int +Root::get_color_finished_fg() { + return color_finished_fg; +} + +void +Root::set_color_finished_fg(int64_t color) { + color_finished_fg = color; +} + +int +Root::get_color_finished_bg() { + return color_finished_bg; +} + +void +Root::set_color_finished_bg(int64_t color) { + color_finished_bg = color; +} + } diff '--color=auto' -ru rtorrent-0.9.8/src/ui/root.h rtorrent-0.9.8_patched/src/ui/root.h --- rtorrent-0.9.8/src/ui/root.h 2019-07-19 13:43:13.000000000 +0200 +++ rtorrent-0.9.8_patched/src/ui/root.h 2019-07-21 15:42:43.860345355 +0200 @@ -88,6 +88,23 @@ void set_down_throttle_i64(int64_t throttle) { set_down_throttle(throttle >> 10); } void set_up_throttle_i64(int64_t throttle) { set_up_throttle(throttle >> 10); } + int get_color_inactive_fg(); + void set_color_inactive_fg(int64_t color); + int get_color_inactive_bg(); + void set_color_inactive_bg(int64_t color); + int get_color_dead_fg(); + void set_color_dead_fg(int64_t color); + int get_color_dead_bg(); + void set_color_dead_bg(int64_t color); + int get_color_active_fg(); + void set_color_active_fg(int64_t color); + int get_color_active_bg(); + void set_color_active_bg(int64_t color); + int get_color_finished_fg(); + void set_color_finished_fg(int64_t color); + int get_color_finished_bg(); + void set_color_finished_bg(int64_t color); + void adjust_down_throttle(int throttle); void adjust_up_throttle(int throttle); @@ -119,6 +136,15 @@ input::Bindings m_bindings; + int64_t color_inactive_fg; + int64_t color_inactive_bg; + int64_t color_dead_fg; + int64_t color_dead_bg; + int64_t color_active_fg; + int64_t color_active_bg; + int64_t color_finished_fg; + int64_t color_finished_bg; + int m_input_history_length; std::string m_input_history_last_input; int m_input_history_pointer_get; Only in rtorrent-0.9.8_patched/src/utils: .deps Only in rtorrent-0.9.8/src/utils: Makefile.am Only in rtorrent-0.9.8/src/utils: Makefile.in Only in rtorrent-0.9.8_patched: stamp-h1 Only in rtorrent-0.9.8_patched/test: .deps Only in rtorrent-0.9.8/test: Makefile.am Only in rtorrent-0.9.8/test: Makefile.in Only in rtorrent-0.9.8_patched/test/rpc: .deps Only in rtorrent-0.9.8_patched/test/src: .deps