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

[vidalia-svn] r2699: Catch bootstrapping status events and add a stub for handlin (in vidalia: . trunk/src/vidalia)



Author: edmanm
Date: 2008-06-12 02:50:17 -0400 (Thu, 12 Jun 2008)
New Revision: 2699

Modified:
   vidalia/
   vidalia/trunk/src/vidalia/mainwindow.cpp
   vidalia/trunk/src/vidalia/mainwindow.h
Log:
 r515@thebe:  edmanm | 2008-06-12 02:49:13 -0400
 Catch bootstrapping status events and add a stub for handling them. A couple
 UI elements need to be added and then updated from the stub.



Property changes on: vidalia
___________________________________________________________________
 svk:merge ticket from /local/vidalia [r515] on 45a62a8a-8088-484c-baad-c7b3e776dd32

Modified: vidalia/trunk/src/vidalia/mainwindow.cpp
===================================================================
--- vidalia/trunk/src/vidalia/mainwindow.cpp	2008-06-12 06:50:15 UTC (rev 2698)
+++ vidalia/trunk/src/vidalia/mainwindow.cpp	2008-06-12 06:50:17 UTC (rev 2699)
@@ -181,21 +181,30 @@
   delete _configDialog;
 }
 
-/** Catches and processes Tor client status events. */
+/** Catches and processes Tor client and general status events. */
 void
 MainWindow::customEvent(QEvent *event)
 {
   if (event->type() == CustomEventType::ClientStatusEvent) {
     ClientStatusEvent *cse = dynamic_cast<ClientStatusEvent *>(event);
+    if (!cse)
+      return;
 
-    if (cse && cse->status() == ClientStatusEvent::CircuitEstablished) {
+    if (cse->status() == ClientStatusEvent::CircuitEstablished) {
       circuitEstablished();
       cse->accept();
+    } else if (cse->status() == ClientStatusEvent::BootstrapStatus) {
+      BootstrapStatusEvent *bse = dynamic_cast<BootstrapStatusEvent *>(cse);
+      if (bse)
+        bootstrapStatusChanged(bse);
+      cse->accept();
     }
   } else if (event->type() == CustomEventType::GeneralStatusEvent) {
     GeneralStatusEvent *gse = dynamic_cast<GeneralStatusEvent *>(event);
-    
-    if (gse && gse->status() == GeneralStatusEvent::DangerousTorVersion) {
+    if (!gse)
+      return;
+
+    if (gse->status() == GeneralStatusEvent::DangerousTorVersion) {
       DangerousVersionEvent *dve = dynamic_cast<DangerousVersionEvent *>(gse);
       if (dve && (dve->reason() == DangerousVersionEvent::ObsoleteVersion
            || dve->reason() == DangerousVersionEvent::UnrecommendedVersion)) {
@@ -502,6 +511,14 @@
               VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape);
 }
 
+/** Called when Tor's bootstrapping status changes. <b>bse</b> represents
+ * Tor's current estimate of its bootstrapping progress. */
+void
+MainWindow::bootstrapStatusChanged(const BootstrapStatusEvent *bse)
+{
+  Q_UNUSED(bse);
+}
+
 /** Updates the UI to reflect Tor's current <b>status</b>. Returns the
  * previously set TorStatus value.*/
 MainWindow::TorStatus

Modified: vidalia/trunk/src/vidalia/mainwindow.h
===================================================================
--- vidalia/trunk/src/vidalia/mainwindow.h	2008-06-12 06:50:15 UTC (rev 2698)
+++ vidalia/trunk/src/vidalia/mainwindow.h	2008-06-12 06:50:17 UTC (rev 2699)
@@ -19,6 +19,7 @@
 
 #include <QMainWindow>
 #include <torcontrol.h>
+#include <bootstrapstatusevent.h>
 
 #include "vidaliawindow.h"
 #include "tray/trayicon.h"
@@ -160,7 +161,10 @@
   /** Called when Tor thinks its version is old or unrecommended, and displays
    * a message notifying the user. */
   void dangerousTorVersion();
-
+  /** Called when Tor's bootstrapping status changes. <b>bse</b> represents
+   * Tor's current estimate of its bootstrapping progress. */
+  void bootstrapStatusChanged(const BootstrapStatusEvent *bse);
+  
   /** The current status of Tor. */
   TorStatus _status;
   /** Used to determine if the Tor process exiting was intentional or not */