[Aptitude-svn-commit] r3537 - in branches/aptitude-0.3/aptitude: . src

Daniel Burrows dburrows@costa.debian.org
Sat, 02 Jul 2005 14:12:26 +0000


Author: dburrows
Date: Sat Jul  2 14:12:23 2005
New Revision: 3537

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/download_item.cc
   branches/aptitude-0.3/aptitude/src/download_item.h
Log:
Update the download-item class for wide characters.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Sat Jul  2 14:12:23 2005
@@ -1,5 +1,9 @@
 2005-07-02  Daniel Burrows  <dburrows@debian.org>
 
+	* src/download_item.cc, src/download_item.h:
+
+	  Update the download-item class for wide characters.
+
 	* src/vscreen/vs_subtree.h:
 
 	  Update the current display column properly in vs_subtree::paint.

Modified: branches/aptitude-0.3/aptitude/src/download_item.cc
==============================================================================
--- branches/aptitude-0.3/aptitude/src/download_item.cc	(original)
+++ branches/aptitude-0.3/aptitude/src/download_item.cc	Sat Jul  2 14:12:23 2005
@@ -24,7 +24,8 @@
 #include <apt-pkg/acquire-worker.h>
 #include <apt-pkg/strutl.h>
 
-#include "vscreen/vs_tree.h"
+#include <vscreen/transcode.h>
+#include <vscreen/vs_tree.h>
 
 style download_item::get_normal_style()
 {
@@ -63,6 +64,7 @@
 
   const style progress_style=st+get_style("DownloadProgress");
   const style normal_style=st+get_normal_style();
+  int barsize=width;
 
   switch(item.Owner->Status)
     {
@@ -79,7 +81,7 @@
 	  if(worker->TotalSize>0)
 	    {
 	      char intbuf[50]; // Waay more than enough.
-	      int barsize=(width*worker->CurrentSize)/worker->TotalSize;
+	      barsize=(width*worker->CurrentSize)/worker->TotalSize;
 	      win->apply_style(progress_style);
 
 	      if(barsize>width)
@@ -91,14 +93,6 @@
 		      SizeToStr(worker->CurrentSize).c_str(),
 		      SizeToStr(worker->TotalSize).c_str());
 	      output+=string(" [ ")+intbuf+" ]";
-	      win->show_string_as_progbar(0,
-					  y,
-					  output,
-					  progress_style.get_attrs(),
-					  normal_style.get_attrs(),
-					  barsize,
-					  width);
-	      return;
 	    }
 	  else
 	    output+=_(" [Working]");
@@ -115,12 +109,7 @@
       break;
     }
 
-  win->mvaddnstr(y, 0, output.c_str(), width);
-
-  int newy,newx;
-  win->getyx(newy, newx);
-  if(newy!=y)
-    return;
-  for( ; newx<width; newx++)
-    win->addch(' ');
+  win->show_string_as_progbar(0, y, transcode(output),
+			      progress_style, normal_style,
+			      barsize, width);
 }

Modified: branches/aptitude-0.3/aptitude/src/download_item.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/download_item.h	(original)
+++ branches/aptitude-0.3/aptitude/src/download_item.h	Sat Jul  2 14:12:23 2005
@@ -50,8 +50,9 @@
   void download_done(bool _hit) {hit=_hit;}
   void set_worker(pkgAcquire::Worker *_worker) {worker=_worker;}
 
-  const char *tag() const {return item.Description.c_str();}
-  const char *label() const {return item.Description.c_str();}
+  // Nothing sensible to return here.
+  const wchar_t *tag() {return L"";}
+  const wchar_t *label() {return L"";}
 };
 
 #endif