- diff --git a/src/command_network.cc b/src/command_network.cc
- index 82155b7..3e163b3 100644
- --- a/src/command_network.cc
- +++ b/src/command_network.cc
- @@ -241,6 +241,15 @@ initialize_command_network() {
- CMD2_VAR_BOOL ("log.handshake", false);
- + CMD2_ANY ("colors.done_fg_color", tr1::bind(&ui::Root::get_done_fg_color, control->ui()));
- + CMD2_ANY_VALUE_V ("colors.done_fg_color.set", tr1::bind(&ui::Root::set_done_fg_color, control->ui(), tr1::placeholders::_2));
- + CMD2_ANY ("colors.done_bg_color", tr1::bind(&ui::Root::get_done_bg_color, control->ui()));
- + CMD2_ANY_VALUE_V ("colors.done_bg_color.set", tr1::bind(&ui::Root::set_done_bg_color, control->ui(), tr1::placeholders::_2));
- + CMD2_ANY ("colors.active_fg_color", tr1::bind(&ui::Root::get_active_fg_color, control->ui()));
- + CMD2_ANY_VALUE_V ("colors.active_fg_color.set", tr1::bind(&ui::Root::set_active_fg_color, control->ui(), tr1::placeholders::_2));
- + CMD2_ANY ("colors.active_bg_color", tr1::bind(&ui::Root::get_active_bg_color, control->ui()));
- + CMD2_ANY_VALUE_V ("colors.active_bg_color.set", tr1::bind(&ui::Root::set_active_bg_color, control->ui(), tr1::placeholders::_2));
- +
- // CMD2_ANY_STRING ("encoding_list", tr1::bind(&apply_encoding_list, tr1::placeholders::_2));
- CMD2_ANY_STRING ("encoding.add", tr1::bind(&apply_encoding_list, tr1::placeholders::_2));
- diff --git a/src/display/canvas.cc b/src/display/canvas.cc
- index 4394b89..61abf7b 100644
- --- a/src/display/canvas.cc
- +++ b/src/display/canvas.cc
- @@ -99,6 +99,10 @@ Canvas::initialize() {
- m_isInitialized = true;
- initscr();
- + start_color();
- + use_default_colors();
- + init_pair(2, -1, -1);
- + init_pair(1, -1, -1);
- raw();
- noecho();
- nodelay(stdscr, TRUE);
- diff --git a/src/display/window_download_list.cc b/src/display/window_download_list.cc
- index 0b40713..93b0a8f 100644
- --- a/src/display/window_download_list.cc
- +++ b/src/display/window_download_list.cc
- @@ -37,6 +37,7 @@
- #include "config.h"
- #include <rak/algorithm.h>
- +#include <torrent/rate.h>
- #include "core/download.h"
- #include "core/view.h"
- @@ -96,8 +97,22 @@ WindowDownloadList::redraw() {
- char* last = buffer + m_canvas->width() - 2 + 1;
- print_download_title(buffer, last, *range.first);
- - m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
- -
- + 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, 2);
- + } else {
- + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_NORMAL, 2);
- + }
- + } else if( (*range.first)->is_active() ) {
- + if( (*range.first)->download()->info()->down_rate()->rate() != 0 ) {
- + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_BOLD, 1);
- + } else {
- + m_canvas->set_attr(0, pos, m_canvas->width()-1, A_NORMAL, 1);
- + }
- + }
- + pos++;
- +
- print_download_info(buffer, last, *range.first);
- m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
- @@ -105,7 +120,43 @@ WindowDownloadList::redraw() {
- m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
- ++range.first;
- - }
- + }
- +}
- +
- +void
- +WindowDownloadList::set_done_fg_color(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_done_bg_color(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);
- +}
- +
- +void
- +WindowDownloadList::set_active_fg_color(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_active_bg_color(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);
- }
- }
- diff --git a/src/display/window_download_list.h b/src/display/window_download_list.h
- index 0fed0c1..0e8731b 100644
- --- a/src/display/window_download_list.h
- +++ b/src/display/window_download_list.h
- @@ -60,6 +60,11 @@ public:
- void set_view(core::View* l);
- + void set_done_fg_color(int64_t color);
- + void set_done_bg_color(int64_t color);
- + void set_active_fg_color(int64_t color);
- + void set_active_bg_color(int64_t color);
- +
- private:
- core::View* m_view;
- diff --git a/src/main.cc b/src/main.cc
- index 796a96a..9ab8f0d 100644
- --- a/src/main.cc
- +++ b/src/main.cc
- @@ -400,6 +400,11 @@ main(int argc, char** argv) {
- CMD2_REDIRECT ("ip", "network.local_address.set");
- CMD2_REDIRECT ("port_range", "network.port_range.set");
- + CMD2_REDIRECT ("done_fg_color", "colors.done_fg_color.set");
- + CMD2_REDIRECT ("done_bg_color", "colors.done_bg_color.set");
- + CMD2_REDIRECT ("active_fg_color", "colors.active_fg_color.set");
- + CMD2_REDIRECT ("active_bg_color", "colors.active_bg_color.set");
- +
- CMD2_REDIRECT_GENERIC("dht", "dht.mode.set");
- CMD2_REDIRECT_GENERIC("dht_port", "dht.port.set");
- diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc
- index edacc9b..a7e20ad 100644
- --- a/src/ui/download_list.cc
- +++ b/src/ui/download_list.cc
- @@ -138,6 +138,11 @@ DownloadList::unfocus_download(core::Download* d) {
- current_view()->next_focus();
- }
- +display::WindowDownloadList*
- +DownloadList::current_window_list() {
- + return dynamic_cast<ElementDownloadList*>(m_uiArray[DISPLAY_DOWNLOAD_LIST])->window();
- +}
- +
- void
- DownloadList::activate_display(Display displayType) {
- if (!is_active())
- diff --git a/src/ui/download_list.h b/src/ui/download_list.h
- index 803de05..36ce3f2 100644
- --- a/src/ui/download_list.h
- +++ b/src/ui/download_list.h
- @@ -101,6 +101,7 @@ public:
- 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(SlotOpenUri s) { m_slotOpenUri = s; }
- diff --git a/src/ui/element_download_list.h b/src/ui/element_download_list.h
- index 20185b5..00ef880 100644
- --- a/src/ui/element_download_list.h
- +++ b/src/ui/element_download_list.h
- @@ -60,6 +60,7 @@ public:
- 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);
- diff --git a/src/ui/root.cc b/src/ui/root.cc
- index d109976..2461b19 100644
- --- a/src/ui/root.cc
- +++ b/src/ui/root.cc
- @@ -45,6 +45,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"
- @@ -66,7 +67,11 @@ Root::Root() :
- m_windowTitle(NULL),
- m_windowHttpQueue(NULL),
- m_windowInput(NULL),
- - m_windowStatusbar(NULL) {
- + m_windowStatusbar(NULL),
- + done_fg_color(-1),
- + done_bg_color(-1),
- + active_fg_color(-1),
- + active_bg_color(-1) {
- }
- void
- @@ -98,6 +103,10 @@ Root::init(Control* c) {
- setup_keys();
- m_downloadList->activate(rootFrame->frame(1));
- + m_downloadList->current_window_list()->set_done_fg_color(done_fg_color);
- + m_downloadList->current_window_list()->set_done_bg_color(done_bg_color);
- + m_downloadList->current_window_list()->set_active_fg_color(active_fg_color);
- + m_downloadList->current_window_list()->set_active_bg_color(active_bg_color);
- }
- void
- @@ -273,4 +282,44 @@ Root::current_input() {
- return m_windowInput->input();
- }
- +int
- +Root::get_done_fg_color() {
- + return done_fg_color;
- +}
- +
- +void
- +Root::set_done_fg_color(int64_t color) {
- + done_fg_color = color;
- +}
- +
- +int
- +Root::get_done_bg_color() {
- + return done_bg_color;
- +}
- +
- +void
- +Root::set_done_bg_color(int64_t color) {
- + done_bg_color = color;
- +}
- +
- +int
- +Root::get_active_fg_color() {
- + return active_fg_color;
- +}
- +
- +void
- +Root::set_active_fg_color(int64_t color) {
- + active_fg_color = color;
- +}
- +
- +int
- +Root::get_active_bg_color() {
- + return active_bg_color;
- +}
- +
- +void
- +Root::set_active_bg_color(int64_t color) {
- + active_bg_color = color;
- +}
- +
- }
- diff --git a/src/ui/root.h b/src/ui/root.h
- index cbc5ff4..6558d77 100644
- --- a/src/ui/root.h
- +++ b/src/ui/root.h
- @@ -83,6 +83,15 @@ public:
- 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_done_fg_color();
- + void set_done_fg_color(int64_t color);
- + int get_done_bg_color();
- + void set_done_bg_color(int64_t color);
- + int get_active_fg_color();
- + void set_active_fg_color(int64_t color);
- + int get_active_bg_color();
- + void set_active_bg_color(int64_t color);
- +
- void adjust_down_throttle(int throttle);
- void adjust_up_throttle(int throttle);
- @@ -105,6 +114,11 @@ private:
- WStatusbar* m_windowStatusbar;
- input::Bindings m_bindings;
- +
- + int64_t done_fg_color;
- + int64_t done_bg_color;
- + int64_t active_fg_color;
- + int64_t active_bg_color;
- };
- }

