[vidalia/alpha] Add labels to the Network Map to link to documentation

commit 89138b72788cf741106ef109bc0f210e6dfb905c Author: Tomás Touceda <chiiph@torproject.org> Date: Sat Mar 17 13:53:36 2012 -0300 Add labels to the Network Map to link to documentation --- src/vidalia/network/NetViewer.cpp | 31 ++++++++++++++++++++++++++++++- src/vidalia/network/NetViewer.h | 3 +++ src/vidalia/network/NetViewer.ui | 24 +++++++++++++++++++++--- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/vidalia/network/NetViewer.cpp b/src/vidalia/network/NetViewer.cpp index 4407588..25a96b9 100644 --- a/src/vidalia/network/NetViewer.cpp +++ b/src/vidalia/network/NetViewer.cpp @@ -48,6 +48,9 @@ NetViewer::NetViewer(QWidget *parent) /* Invoke Qt Designer generated QObject setup routine */ ui.setupUi(this); + ui.lblConsensus->setVisible(false); + ui.lblOffline->setVisible(false); + #if defined(Q_WS_MAC) ui.actionHelp->setShortcut(QString("Ctrl+?")); #endif @@ -79,6 +82,15 @@ NetViewer::NetViewer(QWidget *parent) connect(_torControl, SIGNAL(newDescriptors(QStringList)), this, SLOT(newDescriptors(QStringList))); + _torControl->setEvent(TorEvents::NewDescriptor); + connect(_torControl, SIGNAL(newConsensus()), + this, SLOT(refresh())); + + connect(ui.lblOffline, SIGNAL(linkActivated(QString)), + this, SLOT(linkActivated(QString))); + connect(ui.lblConsensus, SIGNAL(linkActivated(QString)), + this, SLOT(linkActivated(QString))); + /* Change the column widths of the tree widgets */ ui.treeRouterList->header()-> resizeSection(RouterListWidget::StatusColumn, 25); @@ -347,8 +359,12 @@ NetViewer::preLoadNetworkStatus() NetworkStatus networkStatus = _torControl->getNetworkStatus(); ServerSettings settings(_torControl); - if(settings.isServerEnabled()) + if(_torControl->isConnected() and settings.isServerEnabled()) _routers << *RouterDescriptor::fromTorControl(_torControl); + else { + ui.lblConsensus->setVisible(false); + ui.lblOffline->setVisible(true); + } foreach(RouterStatus rs, networkStatus) { if (!rs.isRunning()) @@ -382,6 +398,13 @@ NetViewer::loadNetworkStatus() if(_it != _routers.constEnd()) QTimer::singleShot(10, this, SLOT(loadNetworkStatus())); else { + QString id = _torControl->getInfo("fingerprint").toString(); + RouterListItem *item = ui.treeRouterList->findRouterById(id); + if(item) { + ui.lblConsensus->setVisible(true); + ui.lblOffline->setVisible(false); + } + /* Load existing address mappings */ loadAddressMap(); /* Load Circuits and Streams information */ @@ -545,3 +568,9 @@ NetViewer::toggleFullScreen() } } +/** Called when the user clicks on a QLabel containing a hyperlink. */ +void +NetViewer::linkActivated(const QString &url) +{ + emit helpRequested(url); +} diff --git a/src/vidalia/network/NetViewer.h b/src/vidalia/network/NetViewer.h index 511b242..c442a8c 100644 --- a/src/vidalia/network/NetViewer.h +++ b/src/vidalia/network/NetViewer.h @@ -113,6 +113,9 @@ private slots: * in the internal _router list */ void loadNetworkStatus(); + /** Called when the user clicks on a QLabel containing a hyperlink. */ + void linkActivated(const QString &url); + private: /** */ void setupGeoIpResolver(); diff --git a/src/vidalia/network/NetViewer.ui b/src/vidalia/network/NetViewer.ui index b7bc0e9..b5477a3 100644 --- a/src/vidalia/network/NetViewer.ui +++ b/src/vidalia/network/NetViewer.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>736</width> - <height>630</height> + <width>740</width> + <height>628</height> </rect> </property> <property name="windowTitle"> @@ -18,6 +18,24 @@ <layout class="QHBoxLayout" name="horizontalLayout"/> </item> <item> + <layout class="QGridLayout" name="notificationLayout"> + <item row="1" column="0"> + <widget class="QLabel" name="lblOffline"> + <property name="text"> + <string><a href="server.offline">Why is my relay offline?</a></string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="lblConsensus"> + <property name="text"> + <string>If your relay isn't listed among the others, it may be because it doesn't have a Running flag yet. <a href="server.consensus">What's this?</a></string> + </property> + </widget> + </item> + </layout> + </item> + <item> <layout class="QGridLayout" name="gridLayout_6"> <item row="0" column="1"> <widget class="QLineEdit" name="lineRouterSearch"> @@ -123,7 +141,7 @@ </property> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> - <number>2</number> + <number>0</number> </property> <widget class="QWidget" name="tab"> <attribute name="title">
participants (1)
-
chiiph@torproject.org