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

[vidalia-svn] r1638: Show the number of online servers in the status tip for the (in trunk: . src/gui/network)



Author: edmanm
Date: 2007-02-16 16:51:40 -0500 (Fri, 16 Feb 2007)
New Revision: 1638

Modified:
   trunk/
   trunk/src/gui/network/routerlistwidget.cpp
   trunk/src/gui/network/routerlistwidget.h
Log:
 r1674@adrastea:  edmanm | 2007-02-16 16:46:04 -0500
 Show the number of online servers in the status tip for the server list, as
 well as the total number of servers.



Property changes on: trunk
___________________________________________________________________
 svk:merge ticket from /vidalia/local/trunk [r1674] on 54b3572a-7227-0410-958f-53ecd705b71a

Modified: trunk/src/gui/network/routerlistwidget.cpp
===================================================================
--- trunk/src/gui/network/routerlistwidget.cpp	2007-02-09 19:01:54 UTC (rev 1637)
+++ trunk/src/gui/network/routerlistwidget.cpp	2007-02-16 21:51:40 UTC (rev 1638)
@@ -36,6 +36,8 @@
 RouterListWidget::RouterListWidget(QWidget *parent)
 : QTreeWidget(parent)
 {
+  _onlineRouterCount = 0;
+  
   /* Create and initialize columns */
   setHeaderLabels(QStringList() << QString("")
                                 << QString("")
@@ -92,6 +94,7 @@
 RouterListWidget::clearRouters()
 {
   _idmap.clear();
+  _onlineRouterCount = 0;
   QTreeWidget::clear();
 }
 
@@ -210,6 +213,8 @@
     if (item) {
       /* This is an updated descriptor, so remove the old item and we'll 
        * add a new, updated item. */
+      if (item->descriptor().online())
+        _onlineRouterCount--;
       delete takeTopLevelItem(indexOfTopLevelItem(item));
       _idmap.remove(id);
     }
@@ -220,7 +225,11 @@
     _idmap.insert(id, item);
 
     /* Set our status tip to the number of servers in the list */
-    setStatusTip(tr("%1 servers total").arg(topLevelItemCount()));
+    if (rd.online())
+      _onlineRouterCount++;
+    setStatusTip(tr("%1 servers online (%2 total)")
+                              .arg(_onlineRouterCount)
+                              .arg(topLevelItemCount()));
   }
 }
 
@@ -234,7 +243,7 @@
   QList<QTreeWidgetItem *> items = selectedItems();
 
   if (items.count() > 0) {
-      rd = ((RouterListItem *)items[0])->descriptor();
+    rd = ((RouterListItem *)items[0])->descriptor();
   }
   emit routerSelected(rd);
 }

Modified: trunk/src/gui/network/routerlistwidget.h
===================================================================
--- trunk/src/gui/network/routerlistwidget.h	2007-02-09 19:01:54 UTC (rev 1637)
+++ trunk/src/gui/network/routerlistwidget.h	2007-02-16 21:51:40 UTC (rev 1638)
@@ -100,6 +100,7 @@
   /** Router item context menu and items. */
   QMenu* _routerContextMenu; /**< Context menu for router items. */
   QAction* _zoomToRouterAct; /**< Zooms in on the selected router. */
+  quint32  _onlineRouterCount; /**< Number of online routers. */
 };
 
 #endif