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

[tor-commits] [vidalia/alpha] Fix connection problem



commit 3d3f6312246e5e1d182df6e5f1603b0d527459b3
Author: Tomas Touceda <chiiph@xxxxxxxxxx>
Date:   Fri May 20 00:03:38 2011 -0300

    Fix connection problem
    
    _actionStart and _actionStop have been removed and let _actionStartStopTor
    handle everything
---
 src/vidalia/MainWindow.cpp |   26 +++++++++++++++-----------
 src/vidalia/MainWindow.h   |    2 --
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/vidalia/MainWindow.cpp b/src/vidalia/MainWindow.cpp
index f5907fe..c2cb8e8 100644
--- a/src/vidalia/MainWindow.cpp
+++ b/src/vidalia/MainWindow.cpp
@@ -102,6 +102,11 @@ MainWindow::MainWindow()
 
   createGUI();
   createConnections();
+
+  /* Start with Tor initially stopped */
+  _status = Unset;
+  _isVidaliaRunningTor = false;
+  updateTorStatus(Stopped);
 }
 
 /** Destructor */
@@ -132,8 +137,6 @@ void
 MainWindow::createActions()
 {
   _actionShowControlPanel = new QAction(QIcon(IMG_CONTROL_PANEL), tr("Control Panel"), this);
-  _actionStartTor = new QAction(QIcon(IMG_START_TOR_16), tr("Start"), this);
-  _actionStopTor = new QAction(QIcon(IMG_STOP_TOR_16), tr("Stop"), this);
   _actionRestartTor = new QAction(tr("Restart"), this);
   _actionReloadConfig = new QAction(tr("Reload Tor's config"), this);
   _actionNewIdentity = new QAction(QIcon(IMG_IDENTITY), tr("New Identity"), this);
@@ -156,8 +159,7 @@ MainWindow::createMenuBar()
   menu->clear();
 
   QMenu *torMenu = menu->addMenu(tr("Tor"));
-  torMenu->addAction(_actionStartTor);
-  torMenu->addAction(_actionStopTor);
+  torMenu->addAction(_actionStartStopTor);
   torMenu->addAction(_actionRestartTor);
 #if !defined(Q_WS_WIN)
   torMenu->addAction(_actionReloadConfig);
@@ -278,8 +280,6 @@ MainWindow::retranslateUi()
   updateTorStatus(_status);
 
   _actionShowControlPanel->setText(tr("Control Panel"));
-  _actionStartTor->setText(tr("Start"));
-  _actionStopTor->setText(tr("Stop"));
   _actionRestartTor->setText(tr("Restart"));
   _actionReloadConfig->setText(tr("Reload Tor's config"));
   _actionConfigure->setText(tr("Settings"));
@@ -313,10 +313,9 @@ void
 MainWindow::createConnections()
 {
   connect(_actionExit, SIGNAL(triggered()), this, SLOT(close()));
-  connect(_actionStartTor, SIGNAL(triggered()), this, SLOT(start()));
+  connect(_actionStartStopTor, SIGNAL(triggered()), this, SLOT(start()));
   connect(_actionRestartTor, SIGNAL(triggered()), this, SLOT(restart()));
   connect(_actionReloadConfig, SIGNAL(triggered()), this, SLOT(sighup()));
-  connect(_actionStopTor, SIGNAL(triggered()), this, SLOT(stop()));
   connect(_actionShowControlPanel, SIGNAL(triggered()), this, SLOT(show()));
   connect(_actionNewIdentity, SIGNAL(triggered()), this, SLOT(newIdentity()));
 
@@ -1307,10 +1306,12 @@ MainWindow::updateTorStatus(TorStatus status)
       actionText = tr("Start Tor");
       trayIconFile = IMG_TOR_STOPPED;
       statusIconFile = IMG_TOR_STOPPED_48;
+      _actionRestartTor->setEnabled(false);
+      _actionReloadConfig->setEnabled(false);
+      _actionStartStopTor->setEnabled(true);
       _actionStartStopTor->setEnabled(true);
       _actionStartStopTor->setIcon(QIcon(IMG_START_TOR_16));
       _actionStartStopTor->setText(actionText);
-      _actionStartTor->setEnabled(true);
 
       /* XXX: This might need to be smarter if we ever start connecting other
        * slots to these triggered() and clicked() signals. */
@@ -1318,8 +1319,8 @@ MainWindow::updateTorStatus(TorStatus status)
       connect(_actionStartStopTor, SIGNAL(triggered()), this, SLOT(start()));
       setStartupProgressVisible(false);
   } else if (status == Stopping) {
-      _actionStopTor->setEnabled(false);
       _actionRestartTor->setEnabled(false);
+      _actionReloadConfig->setEnabled(false);
       if (_delayedShutdownStarted) {
         statusText = tr("Your relay is shutting down.\n" 
                         "Click 'Stop' again to stop your relay now.");
@@ -1332,6 +1333,8 @@ MainWindow::updateTorStatus(TorStatus status)
 //      ui.btnStartStopTor->setStatusTip(tr("Stop Tor Now"));
   } else if (status == Started) {
       actionText = tr("Stop Tor");
+      _actionRestartTor->setEnabled(true);
+      _actionReloadConfig->setEnabled(true);
       _actionStartStopTor->setEnabled(true);
       _actionStartStopTor->setIcon(QIcon(IMG_STOP_TOR_16));
       _actionStartStopTor->setText(actionText);
@@ -1345,7 +1348,8 @@ MainWindow::updateTorStatus(TorStatus status)
       trayIconFile = IMG_TOR_STARTING;
       statusIconFile = IMG_TOR_STARTING_48;
       _actionStartStopTor->setEnabled(false);
-      _actionStartTor->setEnabled(false);
+      _actionRestartTor->setEnabled(false);
+      _actionReloadConfig->setEnabled(false);
       setStartupProgressVisible(true);
       setStartupProgress(STARTUP_PROGRESS_STARTING, statusText);
   } else if (status == CircuitEstablished) {
diff --git a/src/vidalia/MainWindow.h b/src/vidalia/MainWindow.h
index a008a08..7d386d5 100644
--- a/src/vidalia/MainWindow.h
+++ b/src/vidalia/MainWindow.h
@@ -285,8 +285,6 @@ private:
   /** Defines the actions for the tray menu */
   QAction *_actionShowControlPanel;
   QAction *_actionStartStopTor;
-  QAction *_actionStartTor;
-  QAction *_actionStopTor;
   QAction *_actionRestartTor;
   QAction *_actionReloadConfig;
   QAction *_actionNewIdentity;

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits