[tor-commits] r4521: Get one last patch in for ticket #2186 before The Great Git (vidalia/trunk/src/vidalia/config)

vidalia-svn at svn.torproject.org vidalia-svn at svn.torproject.org
Thu Feb 24 14:49:12 UTC 2011


Author: edmanm
Date: 2011-02-24 14:49:11 +0000 (Thu, 24 Feb 2011)
New Revision: 4521

Modified:
   vidalia/trunk/src/vidalia/config/ServerPage.cpp
Log:

Get one last patch in for ticket #2186 before The Great Git Migration. ;)


Modified: vidalia/trunk/src/vidalia/config/ServerPage.cpp
===================================================================
--- vidalia/trunk/src/vidalia/config/ServerPage.cpp	2011-02-23 12:20:10 UTC (rev 4520)
+++ vidalia/trunk/src/vidalia/config/ServerPage.cpp	2011-02-24 14:49:11 UTC (rev 4521)
@@ -562,15 +562,11 @@
 ServerPage::displayBridgeUsage()
 {
   QString info;
+  QMessageBox dlg(this);
 
   info = Vidalia::torControl()->getInfo("status/clients-seen").toString();
   if (info.isEmpty()) {
-    QMessageBox dlg(QMessageBox::Information, tr("No Recent Usage"),
-                    tr("No clients have used your relay recently."), 
-                    QMessageBox::Ok, this);
-    dlg.setInformativeText(tr("Leave your relay running so clients have "
-                              "a better chance of finding and using it."));
-    dlg.exec();
+    goto none;
   } else {
     QDateTime timeStarted;
     QHash<QString,int> countrySummary;
@@ -588,29 +584,47 @@
     if (!timeStarted.isValid())
       goto err;
 
-    foreach (QString pair, keyvals.value("CountrySummary").split(",")) {
-      QStringList parts = pair.split("=");
-      if (parts.size() != 2)
-        goto err;
+    QStringList summary = keyvals.value("CountrySummary")
+                                 .split(",", QString::SkipEmptyParts);
+    if (summary.isEmpty()) {
+      goto none;
+    } else {
+      foreach (QString pair, summary) {
+        QStringList parts = pair.split("=");
+        if (parts.size() != 2)
+          goto err;
 
-      countrySummary.insert(parts.at(0).toUpper(), parts.at(1).toInt(&ok));
-      if (!ok)
-        goto err;
+        countrySummary.insert(parts.at(0).toUpper(), parts.at(1).toInt(&ok));
+        if (!ok)
+          goto err;
+      }
+
+      dlg.update(timeStarted, countrySummary);
+      dlg.exec();
     }
-
-    dlg.update(timeStarted, countrySummary);
-    dlg.exec();
   }
   return;
 
+none:
+  dlg.setIcon(QMessageBox::Information);
+  dlg.setWindowTitle(tr("No Recent Usage"));
+  dlg.setText(tr("No clients have used your relay recently."));
+  dlg.setInformativeText(tr("Leave your relay running so clients have "
+                            "a better chance of finding and using it."));
+  dlg.setStandardButtons(QMessageBox::Ok);
+  dlg.exec();
+  return;
+
 err:
-  QMessageBox dlg(QMessageBox::Warning, tr("Bridge History"),
-                  tr("Vidalia was unable to retrieve your bridge's usage "
-                     "history."), QMessageBox::Ok, this);
+  dlg.setIcon(QMessageBox::Warning);
+  dlg.setWindowTitle(tr("Bridge History"));
+  dlg.setText(tr("Vidalia was unable to retrieve your bridge's usage "
+                 "history."));
   dlg.setInformativeText(tr("Tor returned an improperly formatted "
                             "response when Vidalia requested your "
                             "bridge's usage history."));
   dlg.setDetailedText(tr("The returned response was: %1").arg(info));
+  dlg.setStandardButtons(QMessageBox::Ok);
   dlg.exec();
 }
 



More information about the tor-commits mailing list