SOURCES: rtorrent-colors.patch - new for 0.5.x

charles charles at pld-linux.org
Sat May 6 03:23:34 CEST 2006


Author: charles                      Date: Sat May  6 01:23:34 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- new for 0.5.x

---- Files affected:
SOURCES:
   rtorrent-colors.patch (1.10 -> 1.11) 

---- Diffs:

================================================================
Index: SOURCES/rtorrent-colors.patch
diff -u SOURCES/rtorrent-colors.patch:1.10 SOURCES/rtorrent-colors.patch:1.11
--- SOURCES/rtorrent-colors.patch:1.10	Tue Jan 10 13:15:51 2006
+++ SOURCES/rtorrent-colors.patch	Sat May  6 03:23:29 2006
@@ -1,7 +1,6 @@
-diff -U 3 -H -d -r -N -- rtorrent-0.3.0.orig/src/display/canvas.cc rtorrent-0.3.0/src/display/canvas.cc
---- rtorrent-0.3.0.orig/src/display/canvas.cc	2005-07-01 22:45:24.000000000 +0200
-+++ rtorrent-0.3.0/src/display/canvas.cc	2005-07-29 18:09:37.000000000 +0200
-@@ -54,6 +54,7 @@
+--- rtorrent-0.5.0/src/display/canvas.cc.orig	2006-02-11 17:12:24.000000000 +0100
++++ rtorrent-0.5.0/src/display/canvas.cc	2006-05-04 14:40:32.000000000 +0200
+@@ -65,6 +65,7 @@
    nodelay(stdscr, TRUE);
    keypad(stdscr, TRUE);
    curs_set(0);
@@ -9,73 +8,129 @@
  }
  
  void
---- rtorrent-0.4.2/src/display/utils.cc.orig	2005-12-22 01:38:00.000000000 +0100
-+++ rtorrent-0.4.2/src/display/utils.cc	2006-01-10 05:41:47.000000000 +0100
-@@ -101,7 +101,7 @@
+--- rtorrent-0.5.0/src/display/window_download_statusbar.cc.orig	2006-03-31 23:41:20.000000000 +0200
++++ rtorrent-0.5.0/src/display/window_download_statusbar.cc	2006-05-04 14:34:05.000000000 +0200
+@@ -88,6 +88,11 @@
+ 		  m_download->tracker_list()->is_busy() ? 'C' : ' ',
+ 		  (int)(m_download->download()->tracker_list().timeout() / 1000000),
+ 		  buffer);
++
++  m_canvas->set_attr(0, 0, m_canvas->get_screen_width(), A_REVERSE, 0);
++  m_canvas->set_attr(0, 1, m_canvas->get_screen_width(), A_REVERSE, 0);
++  m_canvas->set_attr(0, 2, m_canvas->get_screen_width(), A_REVERSE, 0);
++
+ }
+ 
+ }
+--- rtorrent-0.5.0/src/display/window_statusbar.cc.orig	2006-02-09 17:23:36.000000000 +0100
++++ rtorrent-0.5.0/src/display/window_statusbar.cc	2006-05-04 14:36:04.000000000 +0200
+@@ -103,6 +103,7 @@
+   if (last > buffer) {
+     position = print_status_extra(buffer, last, m_control);
+     m_canvas->print(m_canvas->get_width() - (position - buffer), 0, "%s", buffer);
++    m_canvas->set_attr(0, 0, m_canvas->get_screen_width(), A_REVERSE, 0);
+   }
+ 
+ 
+--- rtorrent-0.5.0/src/display/window_title.cc.orig	2006-02-09 17:23:36.000000000 +0100
++++ rtorrent-0.5.0/src/display/window_title.cc	2006-05-04 14:36:43.000000000 +0200
+@@ -53,6 +53,7 @@
+ 
+   m_canvas->print(std::max(0, (m_canvas->get_width() - (int)m_title.size()) / 2 - 4), 0,
+ 		  "*** %s ***", m_title.c_str());
++  m_canvas->set_attr(0, 0, m_canvas->get_screen_width(), A_REVERSE, 0);
  }
  
- char*
--print_download_info(char* buf, unsigned int length, core::Download* d) {
-+print_download_info(char* buf, unsigned int length, core::Download* d, double ratio) {
-   char* last = buf + length;
- 
-   buf += std::max(snprintf(buf, last - buf, "Torrent: "), 0);
-@@ -116,10 +116,10 @@
- 			     (double)d->get_download().bytes_done() / (double)(1 << 20),
- 			     (double)d->get_download().bytes_total() / (double)(1 << 20)), 0);
-   
--  buf += std::max(snprintf(buf, last - buf, " Rate: %5.1f / %5.1f KB Uploaded: %7.1f MB ",
-+  buf += std::max(snprintf(buf, last - buf, " Rate: %5.1f / %5.1f KB Uploaded: %6.1f MB Ratio: %5.2f ",
- 			   (double)d->get_download().up_rate()->rate() / (1 << 10),
- 			   (double)d->get_download().down_rate()->rate() / (1 << 10),
--			   (double)d->get_download().up_rate()->total() / (1 << 20)), 0);
-+			   (double)d->get_download().up_rate()->total() / (1 << 20), ratio), 0);
- 
-   //buf += std::max(0, snprintf(buf, length, " Left: "));
-   buf = print_download_time_left(buf, length, d);
-diff -U 3 -H -d -r -N -- rtorrent-0.3.0.orig/src/display/utils.h rtorrent-0.3.0/src/display/utils.h
---- rtorrent-0.3.0.orig/src/display/utils.h	2005-07-13 13:59:51.000000000 +0200
-+++ rtorrent-0.3.0/src/display/utils.h	2005-07-29 18:09:37.000000000 +0200
-@@ -51,7 +51,7 @@
- namespace display {
- 
- char*       print_download_title(char* buf, unsigned int length, core::Download* d);
--char*       print_download_info(char* buf, unsigned int length, core::Download* d);
-+char*       print_download_info(char* buf, unsigned int length, core::Download* d, double ratio);
- char*       print_download_status(char* buf, unsigned int length, core::Download* d);
- 
- std::string print_hhmmss(utils::Timer t);
---- rtorrent-0.4.0/src/display/window_download_list.cc.orig	2005-11-22 03:24:28.000000000 +0100
-+++ rtorrent-0.4.0/src/display/window_download_list.cc	2005-11-22 03:25:22.000000000 +0100
-@@ -36,6 +36,8 @@
+ }
+--- rtorrent-0.5.0/src/display/client_info.cc.orig	2006-04-05 22:05:13.000000000 +0200
++++ rtorrent-0.5.0/src/display/client_info.cc	2006-05-04 14:42:20.000000000 +0200
+@@ -133,7 +133,7 @@
+ 				client_info_equal(id + 1, sizeof_key(TYPE_AZUREUS)));
+ 
+     if (itr != m_containers[TYPE_AZUREUS].end())
+-      first = print_buffer(first, last, "%s %hhu.%hhu.%hhu.%hhu", itr->second,
++      first = print_buffer(first, last, "%-12s %hhu.%hhu.%hhu.%hhu", itr->second,
+ 			   rak::hexchar_to_value(id[3]), rak::hexchar_to_value(id[4]),
+ 			   rak::hexchar_to_value(id[5]), rak::hexchar_to_value(id[6]));
+     
+@@ -142,7 +142,7 @@
+ 			   rak::hexchar_to_value(id[3]), rak::hexchar_to_value(id[4]),
+ 			   rak::hexchar_to_value(id[5]), rak::hexchar_to_value(id[6]));
+ 
+-  } else if (std::isalpha(id[0]) && id[4] == '-' &&
++  } else if (std::isalpha(id[0]) && id[5] == '-' &&
+ 	     std::isxdigit(id[1]) && std::isxdigit(id[2]) && std::isxdigit(id[3])) {
+     // TYPE_THREE_COMPACT.
+ 
+@@ -150,7 +150,7 @@
+ 				client_info_equal(id, sizeof_key(TYPE_COMPACT)));
+ 
+     if (itr != m_containers[TYPE_COMPACT].end())
+-      first = print_buffer(first, last, "%s %hhu.%hhu.%hhu", itr->second,
++      first = print_buffer(first, last, "%-12s %hhu.%hhu.%hhu", itr->second,
+ 			   rak::hexchar_to_value(id[1]), rak::hexchar_to_value(id[2]), rak::hexchar_to_value(id[3]));
+     
+     else
+@@ -165,7 +165,7 @@
+ 				client_info_equal(id, sizeof_key(TYPE_MAINLINE)));
+ 
+     if (itr != m_containers[TYPE_MAINLINE].end())
+-      first = print_buffer(first, last, "%s %hhu.%hhu.%hhu", itr->second,
++      first = print_buffer(first, last, "%-12s %hhu.%hhu.%hhu", itr->second,
+ 			   rak::hexchar_to_value(id[1]), rak::hexchar_to_value(id[3]), rak::hexchar_to_value(id[5]));
+     
+     else
+@@ -179,8 +179,16 @@
+   // Well... fuck this... I don't feel like adding the rest of the
+   // checks as they wouldn't be possible to remove/modify.
+ 
+-  } else {
+-    first = print_buffer(first, last, "unknown");
++  } else if (id[0] == 'e' && id[1] == 'x' && id[2] == 'b' && id[3] == 'c' &&
++  	     id[6] == 'L' && id[7] == 'O' && id[8] == 'R' && id[9] == 'D') {
++      first = print_buffer(first, last, "%-12s %hhu.%hhu", "BitLord", id[4], id[5]);
++
++  } else if (id[0] == '-' && id[1] == 'M' && id[2] == 'L') {
++      first = print_buffer(first, last, "%-12s %hhu.%hhu.%hhu", "MLDonkey",
++			   rak::hexchar_to_value(id[3]), rak::hexchar_to_value(id[5]), rak::hexchar_to_value(id[7]));
++  }
++  else {
++    first = print_buffer(first, last, "");
+   }
+ 
+   return first;
+--- rtorrent-0.5.1/src/display/window_download_list.cc.orig	2006-05-01 18:30:08.000000000 +0200
++++ rtorrent-0.5.1/src/display/window_download_list.cc	2006-05-06 03:05:16.000000000 +0200
+@@ -38,6 +38,8 @@
  
- #include "config.h"
+ #include <rak/algorithm.h>
  
 +#include <torrent/rate.h>
 +
  #include "core/download.h"
- #include "rak/algorithm.h"
+ #include "core/view.h"
  
-@@ -80,22 +82,59 @@
- 
-   int pos = 0;
+@@ -89,21 +91,47 @@
+   if (range.second != m_view->end())
+     ++range.second;
  
 +  init_pair(1, COLOR_GREEN, COLOR_BLACK);
 +  init_pair(2, COLOR_YELLOW, COLOR_BLACK);
 +  init_pair(3, COLOR_RED, COLOR_BLACK);
 +  init_pair(4, COLOR_BLUE, COLOR_BLACK);
 +
+   int pos = 1;
+ 
    while (range.first != range.second) {
-     char buffer[m_canvas->get_width() - 2];
+     char buffer[m_canvas->get_width()];
      char* position;
      char* last = buffer + m_canvas->get_width() - 2;
 +    int col = 0;
 +    double ratio = 0;
 +    core::Download* d = *range.first;
 +
-+    if (d->get_download().bytes_done())
-+      ratio = (double)d->get_download().up_rate()->total() / (double)d->get_download().bytes_done();
-+
++    if (d->download()->bytes_done())
++      ratio = (double)d->download()->up_rate()->total() / (double)d->download()->bytes_done();
 +    if (ratio >= 1.0)
 +      col = 1;
 +    else if (ratio >= 0.5)
@@ -83,104 +138,27 @@
 +    else
 +      col = 3;
  
-     position = print_download_title(buffer, last - buffer, *range.first);
--    m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
+     position = print_download_title(buffer, last, *range.first);
+-    m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
 -    
--    position = print_download_info(buffer, last - buffer, *range.first);
--    m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
-+    m_canvas->print(0, pos, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
-+
-+    if (d->get_download().is_open())
++    m_canvas->print(0, pos, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer);
++    if (d->download()->is_open())
 +      m_canvas->set_attr(0, pos, m_canvas->get_screen_width(), (d->is_done())?0:A_BOLD, (d->is_done())?col:4);
 +    pos++;
 +
-+    position = print_download_info(buffer, last - buffer, *range.first, ratio);
-+    m_canvas->print(0, pos, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
-+
-+    if (col > 0)
-+      m_canvas->set_attr(80, pos, 5, 0, col);
-+
-+    if (d->get_download().bytes_total() > 0) {
-+      double per = (double)d->get_download().bytes_done() / (double)d->get_download().bytes_total();
-+      if (per >= 1.0)
-+        col = 1;
-+      else if (per >= 0.5)
-+        col = 2;
-+      else
-+        col = 3;
-+      m_canvas->set_attr(11, pos, 6, 0, col);
-+    }
+     position = print_download_info(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 (!d->download()->is_active())
++      m_canvas->set_attr(0, pos, m_canvas->get_screen_width(), A_BOLD, 8);
 +    pos++;
  
-     position = print_download_status(buffer, last - buffer, *range.first);
-     m_canvas->print(0, pos++, "%c %s", range.first == m_list->get_focus() ? '*' : ' ', buffer);
+     position = print_download_status(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 (!d->download()->is_active())
++      m_canvas->set_attr(0, pos, m_canvas->get_screen_width(), A_BOLD, 8);
++    pos++;
  
      ++range.first;
--  }    
-+  }
- }
- 
- }
-diff -U 3 -H -d -r -N -- rtorrent-0.3.0.orig/src/display/window_download_list.h rtorrent-0.3.0/src/display/window_download_list.h
---- rtorrent-0.3.0.orig/src/display/window_download_list.h	2005-07-13 13:58:23.000000000 +0200
-+++ rtorrent-0.3.0/src/display/window_download_list.h	2005-07-29 19:39:40.000000000 +0200
-@@ -44,6 +44,11 @@
- #include "core/download_list.h"
- #include "utils/list_focus.h"
- 
-+
-+namespace core {
-+  class Download;
-+}
-+
- namespace display {
- 
- class WindowDownloadList : public Window {
---- rtorrent-0.4.0/src/display/window_download_statusbar.cc.orig	2005-11-14 15:38:49.000000000 +0100
-+++ rtorrent-0.4.0/src/display/window_download_statusbar.cc	2005-11-22 03:20:07.000000000 +0100
-@@ -60,8 +60,13 @@
-   char buffer[m_canvas->get_width() - 2];
-   char* position;
-   char* last = buffer + m_canvas->get_width() - 2;
-+  double ratio = 0;
-+  core::Download* d = m_download;
- 
--  position = print_download_info(buffer, last - buffer, m_download);
-+   if (d->get_download().bytes_done())
-+      ratio = (double)d->get_download().up_rate()->total() / (double)d->get_download().bytes_done();
-+
-+  position = print_download_info(buffer, last - buffer, m_download, ratio);
-   m_canvas->print(0, 0, "%s", buffer);
- 
-   m_canvas->print(0, 1, "Peers: %i(%i) Min/Max: %i/%i Uploads: %i U/I: %i/%i",
-@@ -78,6 +83,9 @@
- 		  m_download->get_download().is_tracker_busy() ? 'C' : ' ',
- 		  (int)(m_download->get_download().tracker_timeout() / 1000000),
- 		  buffer);
-+  m_canvas->set_attr(0, 0, m_canvas->get_screen_width(), A_REVERSE, 0);
-+  m_canvas->set_attr(0, 1, m_canvas->get_screen_width(), A_REVERSE, 0);
-+  m_canvas->set_attr(0, 2, m_canvas->get_screen_width(), A_REVERSE, 0);
- }
- 
- }
---- rtorrent-0.4.2/src/display/window_statusbar.cc.orig	2006-01-09 18:15:39.000000000 +0100
-+++ rtorrent-0.4.2/src/display/window_statusbar.cc	2006-01-10 05:34:47.000000000 +0100
-@@ -94,6 +94,7 @@
- 		 torrent::max_open_files());
- 
-   m_canvas->print(m_canvas->get_width() - pos, 0, "%s", buf);
-+  m_canvas->set_attr(0, 0, m_canvas->get_screen_width(), A_REVERSE, 0);
- 
-   m_lastTick = m_control->tick();
- }
-diff -U 3 -H -d -r -N -- rtorrent-0.3.0.orig/src/display/window_title.cc rtorrent-0.3.0/src/display/window_title.cc
---- rtorrent-0.3.0.orig/src/display/window_title.cc	2005-07-01 22:45:24.000000000 +0200
-+++ rtorrent-0.3.0/src/display/window_title.cc	2005-07-29 18:09:37.000000000 +0200
-@@ -53,6 +53,7 @@
- 
-   m_canvas->print(std::max(0, (m_canvas->get_width() - (int)m_title.size()) / 2 - 4), 0,
- 		  "*** %s ***", m_title.c_str());
-+  m_canvas->set_attr(0, 0, m_canvas->get_screen_width(), A_REVERSE, 0);
- }
- 
- }
+   }    
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/rtorrent-colors.patch?r1=1.10&r2=1.11&f=u



More information about the pld-cvs-commit mailing list