[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3462: Catch the map widget's displayRouterInfo() signal and connec (vidalia/branches/marble/src/vidalia/network)
Author: edmanm
Date: 2009-01-19 02:05:55 -0500 (Mon, 19 Jan 2009)
New Revision: 3462
Modified:
vidalia/branches/marble/src/vidalia/network/netviewer.cpp
vidalia/branches/marble/src/vidalia/network/netviewer.h
Log:
Catch the map widget's displayRouterInfo() signal and connect a slot to
display the selected router's information in a RouterInfoDialog.
Modified: vidalia/branches/marble/src/vidalia/network/netviewer.cpp
===================================================================
--- vidalia/branches/marble/src/vidalia/network/netviewer.cpp 2009-01-19 07:02:48 UTC (rev 3461)
+++ vidalia/branches/marble/src/vidalia/network/netviewer.cpp 2009-01-19 07:05:55 UTC (rev 3462)
@@ -17,8 +17,10 @@
#include <QMessageBox>
#include <QHeaderView>
#include <vidalia.h>
+#include <vmessagebox.h>
#include "netviewer.h"
+#include "routerinfodialog.h"
#define IMG_MOVE ":/images/22x22/move-map.png"
#define IMG_ZOOMIN ":/images/22x22/zoom-in.png"
@@ -67,8 +69,10 @@
/* Create the TorMapWidget and add it to the dialog */
_map = new TorMapWidget();
ui.gridLayout->addWidget(_map);
+ connect(_map, SIGNAL(displayRouterInfo(QString)),
+ this, SLOT(displayRouterInfo(QString)));
- /* Connect zoom buttons to ZImageView zoom slots */
+ /* Connect zoom buttons to TorMapWidget zoom slots */
connect(ui.actionZoomIn, SIGNAL(triggered()), _map, SLOT(zoomIn()));
connect(ui.actionZoomOut, SIGNAL(triggered()), _map, SLOT(zoomOut()));
connect(ui.actionZoomToFit, SIGNAL(triggered()), _map, SLOT(zoomToFit()));
@@ -484,3 +488,35 @@
_map->update();
}
+/** Called when the user selects a router on the network map. Displays a
+ * dialog with detailed information for the router specified by
+ * <b>id</b>.*/
+void
+NetViewer::displayRouterInfo(const QString &id)
+{
+ RouterInfoDialog dlg(this);
+
+ /* Fetch the specified router's descriptor */
+ QStringList rd = _torControl->getRouterDescriptorText(id);
+ if (rd.isEmpty()) {
+ VMessageBox::warning(this, tr("Relay Not Found"),
+ tr("No details on the selected relay are available."),
+ VMessageBox::Ok);
+ return;
+ }
+
+ /* Fetch the router's network status information */
+ RouterStatus rs = _torControl->getRouterStatus(id);
+
+ dlg.setRouterInfo(rd, rs);
+
+ /* Populate the UI with information learned from a previous GeoIP request */
+ RouterListItem *item = ui.treeRouterList->findRouterById(id);
+ if (item)
+ dlg.setLocation(item->location());
+ else
+ dlg.setLocation(tr("Unknown"));
+
+ dlg.exec();
+}
+
Modified: vidalia/branches/marble/src/vidalia/network/netviewer.h
===================================================================
--- vidalia/branches/marble/src/vidalia/network/netviewer.h 2009-01-19 07:02:48 UTC (rev 3461)
+++ vidalia/branches/marble/src/vidalia/network/netviewer.h 2009-01-19 07:05:55 UTC (rev 3462)
@@ -74,7 +74,11 @@
void onDisconnected();
/** Resolves IP addresses in the resolve queue to geographic information. */
void resolve();
-
+ /** Called when the user selects a router on the network map. Displays a
+ * dialog with detailed information for the router specified by
+ * <b>id</b>.*/
+ void displayRouterInfo(const QString &id);
+
private:
/** Adds an IP address to the resolve queue and updates the queue timers. */
void addToResolveQueue(const QHostAddress &ip, const QString &id);