[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [vidalia/alpha] Make widgets microdescriptor friendly



commit 79599ac7c838d3ba0c87af1e91c9605be30cc21f
Author: Tomás Touceda <chiiph@xxxxxxxxxxxxxx>
Date:   Mon Feb 13 12:49:56 2012 -0300

    Make widgets microdescriptor friendly
---
 src/vidalia/network/RouterDescriptorView.cpp |   10 ++++---
 src/vidalia/network/RouterInfoDialog.cpp     |   34 ++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/src/vidalia/network/RouterDescriptorView.cpp b/src/vidalia/network/RouterDescriptorView.cpp
index 6d9370c..44376d7 100644
--- a/src/vidalia/network/RouterDescriptorView.cpp
+++ b/src/vidalia/network/RouterDescriptorView.cpp
@@ -106,10 +106,11 @@ RouterDescriptorView::display(QList<RouterDescriptor> rdlist)
     
     /* Add the IP address and router platform information */
     html.append(trow(tcol(b(tr("IP Address:"))) + tcol(rd.ip().toString())));
-    html.append(trow(tcol(b(tr("Platform:")))   + tcol(rd.platform())));
+    if(!rd.platform().isEmpty())
+      html.append(trow(tcol(b(tr("Platform:")))   + tcol(rd.platform())));
 
     /* If the router is online, then show the uptime and bandwidth stats. */
-    if (!rd.offline()) {
+    if (!rd.offline() and rd.uptime() != 0) {
       qint64 minBandwidth = (qint64)qMin(rd.observedBandwidth(), 
                                 qMin(rd.averageBandwidth(),
                                      rd.burstBandwidth()));
@@ -121,8 +122,9 @@ RouterDescriptorView::display(QList<RouterDescriptor> rdlist)
     }
 
     /* Date the router was published */
-    html.append(trow(tcol(b(tr("Last Updated:")))  +
-                     tcol(string_format_datetime(rd.published()) + " GMT")));
+    if(!string_format_datetime(rd.published()).isEmpty())
+      html.append(trow(tcol(b(tr("Last Updated:")))  +
+                       tcol(string_format_datetime(rd.published()) + " GMT")));
 
     html.append("</table>");
 
diff --git a/src/vidalia/network/RouterInfoDialog.cpp b/src/vidalia/network/RouterInfoDialog.cpp
index 806d3e9..f3074d1 100644
--- a/src/vidalia/network/RouterInfoDialog.cpp
+++ b/src/vidalia/network/RouterInfoDialog.cpp
@@ -41,13 +41,31 @@ RouterInfoDialog::setRouterInfo(const QStringList &desc,
 {
   RouterDescriptor rd(desc);
 
-  ui.lblName->setText(rd.name());
-  ui.lblIPAddress->setText(rd.ip().toString());
-  ui.lblPlatform->setText(rd.platform());
-  ui.lblBandwidth->setText(string_format_bandwidth(rd.observedBandwidth()));
-  ui.lblLastUpdated->setText(string_format_datetime(rd.published()) + " GMT");
-  ui.lblUptime->setText(string_format_uptime(adjustUptime(rd.uptime(),
-                                                          rd.published())));
+  ui.lblName->setText(status.name());
+  ui.lblIPAddress->setText(status.ipAddress().toString());
+  if(rd.platform().isEmpty()) {
+    ui.lblPlatformLabel->setVisible(false);
+    ui.lblPlatform->setVisible(false);
+  } else {
+    ui.lblPlatform->setText(rd.platform());
+  }
+
+  if(rd.observedBandwidth() == 0) {
+    ui.lblBandwidthLabel->setVisible(false);
+    ui.lblBandwidth->setVisible(false);
+  } else {
+    ui.lblBandwidth->setText(string_format_bandwidth(rd.observedBandwidth()));
+  }
+
+  ui.lblLastUpdated->setText(string_format_datetime(status.published()) + " GMT");
+  
+  if(rd.uptime() == 0) {
+    ui.lblUptimeLabel->setVisible(false);
+    ui.lblUptime->setVisible(false);
+  } else {
+    ui.lblUptime->setText(string_format_uptime(adjustUptime(rd.uptime(),
+                                                            status.published())));
+  }
 
   if (rd.hibernating()) {
     ui.lblStatus->setText(tr("Hibernating"));
@@ -74,5 +92,7 @@ void
 RouterInfoDialog::setLocation(const QString &location)
 {
   ui.lblLocation->setText(location);
+  ui.lblLocation->setVisible(!location.isEmpty());
+  ui.lblLocationLabel->setVisible(!location.isEmpty());
 }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits