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

[vidalia-svn] r3967: Added toolbar to MainWindow.ui instead. This fixed nothing. (vidalia/branches/extension-api/src/vidalia)



Author: tyree731
Date: 2009-07-16 18:25:22 -0400 (Thu, 16 Jul 2009)
New Revision: 3967

Modified:
   vidalia/branches/extension-api/src/vidalia/MainWindow.cpp
   vidalia/branches/extension-api/src/vidalia/MainWindow.h
   vidalia/branches/extension-api/src/vidalia/MainWindow.ui
Log:
Added toolbar to MainWindow.ui instead. This fixed nothing.

Modified: vidalia/branches/extension-api/src/vidalia/MainWindow.cpp
===================================================================
--- vidalia/branches/extension-api/src/vidalia/MainWindow.cpp	2009-07-16 21:23:18 UTC (rev 3966)
+++ vidalia/branches/extension-api/src/vidalia/MainWindow.cpp	2009-07-16 22:25:22 UTC (rev 3967)
@@ -166,8 +166,8 @@
   /* Creates a tray icon with a context menu and adds it to the system's
    * notification area. */
   createTrayIcon();
-  /* Creates the toolbar */
-  createToolBar();
+  /* Connects the toolbar actions to the relevant functions*/
+  connectToolBarActions();
   /* Start with Tor initially stopped */
   _status = Unset;
   _isVidaliaRunningTor = false;
@@ -462,6 +462,17 @@
   vApp->quit();
 }
 
+void
+MainWindow::connectToolBarActions()
+{
+  connect(ui.startStopAct32, SIGNAL(triggered()), this, SLOT(start()));
+  connect(ui.newIdentityAct32, SIGNAL(triggered()), this, SLOT(newIdentity()));
+  connect(ui.configAct32, SIGNAL(triggered()), this, SLOT(showConfigDialog()));
+  connect(ui.bandwidthAct32, SIGNAL(triggered()), 
+          _bandwidthGraph, SLOT(showWindow()));
+  connect(ui.helpAct32, SIGNAL(triggered()), this, SLOT(showHelpDialog()()));
+}
+
 /** Create and bind actions to events. Setup for initial
  * tray menu configuration. */
 void 
@@ -469,8 +480,6 @@
 {
   _startStopAct = new QAction(tr("Start Tor"), this);
   connect(_startStopAct, SIGNAL(triggered()), this, SLOT(start()));
-  _startStopAct32 = new QAction(tr("Start Tor"), this);
-  connect(_startStopAct32, SIGNAL(triggered()), this, SLOT(start()));
 
   _exitAct = new QAction(tr("Exit"), this);
   connect(_exitAct, SIGNAL(triggered()), this, SLOT(close()));
@@ -478,32 +487,22 @@
   _bandwidthAct = new QAction(tr("Bandwidth Graph"), this);
   connect(_bandwidthAct, SIGNAL(triggered()), 
           _bandwidthGraph, SLOT(showWindow()));
-  _bandwidthAct32 = new QAction(tr("BandwidthGraph"), this);
-  connect(_bandwidthAct32, SIGNAL(triggered()),
-          _bandwidthGraph, SLOT(showWindow()));
 
   _controlPanelAct = new QAction(tr("Control Panel"), this);
   connect(_controlPanelAct, SIGNAL(triggered()), this, SLOT(show()));
 
   _configAct = new QAction(tr("Settings"), this);
   connect(_configAct, SIGNAL(triggered()), this, SLOT(showConfigDialog()));
-  _configAct32 = new QAction(tr("Settings"), this);
-  connect(_configAct32, SIGNAL(triggered()), this, SLOT(showConfigDialog()));
   
   _aboutAct = new QAction(tr("About"), this);
   connect(_aboutAct, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
 
   _helpAct = new QAction(tr("Help"), this);
   connect(_helpAct, SIGNAL(triggered()), this, SLOT(showHelpDialog()));
-  _helpAct32 = new QAction(tr("Help"), this);
-  connect(_helpAct32, SIGNAL(triggered()), this, SLOT(showHelpDialog()));
 
   _newIdentityAct = new QAction(tr("New Identity"), this);
   _newIdentityAct->setEnabled(false);
   connect(_newIdentityAct, SIGNAL(triggered()), this, SLOT(newIdentity()));
-  _newIdentityAct32 = new QAction(tr("New Identity"), this);
-  _newIdentityAct32->setEnabled(false);
-  connect(_newIdentityAct32, SIGNAL(triggered()), this, SLOT(newIdentity()));
 
 
 #if !defined(Q_WS_MAC)
@@ -519,11 +518,6 @@
   _helpAct->setIcon(QIcon(IMG_HELP));
   _newIdentityAct->setIcon(QIcon(IMG_IDENTITY));
 #endif
-  _startStopAct32->setIcon(QIcon(IMG_START_TOR_32));
-  _bandwidthAct32->setIcon(QIcon(IMG_BWGRAPH_32));
-  _configAct32->setIcon(QIcon(IMG_CONFIG_32));
-  _helpAct32->setIcon(QIcon(IMG_HELP_32));
-  _newIdentityAct32->setIcon(QIcon(IMG_IDENTITY_32));
 }
 
 QMenu*
@@ -673,21 +667,6 @@
   setStatusBar(_statusBar);
 }
 
-void
-MainWindow::createToolBar()
-{
-  QToolBar* toolBar = new QToolBar(this);
-  toolBar->setFloatable(false);
-
-  toolBar->addAction(_startStopAct32);
-  toolBar->addAction(_newIdentityAct32);
-  toolBar->addAction(_configAct32);
-  toolBar->addAction(_bandwidthAct32);
-  toolBar->addAction(_helpAct32);
-
-  addToolBar(toolBar);
-}
-
 /** Start a web browser when given the directory containing the executable and 
  * profile */
 void
@@ -1058,9 +1037,9 @@
       _startStopAct->setEnabled(true);
       _startStopAct->setText(actionText);
       _startStopAct->setIcon(QIcon(IMG_START_TOR_16));
-      _startStopAct32->setEnabled(true);
-      _startStopAct32->setText(actionText);
-      _startStopAct32->setIcon(QIcon(IMG_START_TOR_32));
+      ui.startStopAct32->setEnabled(true);
+      ui.startStopAct32->setText(actionText);
+      ui.startStopAct32->setIcon(QIcon(IMG_START_TOR_32));
 
       /* Notify plugin manager */
       _pluginManager->sendTorStatus(pmStopped);
@@ -1068,9 +1047,9 @@
       /* XXX: This might need to be smarter if we ever start connecting other
        * slots to these triggered() and clicked() signals. */
       QObject::disconnect(_startStopAct, SIGNAL(triggered()), this, 0);
-      QObject::disconnect(_startStopAct32, SIGNAL(triggered()), this, 0);
+      QObject::disconnect(ui.startStopAct32, SIGNAL(triggered()), this, 0);
       connect(_startStopAct, SIGNAL(triggered()), this, SLOT(start()));
-      connect(_startStopAct32, SIGNAL(triggered()), this, SLOT(start()));
+      connect(ui.startStopAct32, SIGNAL(triggered()), this, SLOT(start()));
       setStartupProgressVisible(false);
   } else if (status == Stopping) {
       if (_delayedShutdownStarted) {
@@ -1089,16 +1068,16 @@
       _startStopAct->setEnabled(true);
       _startStopAct->setText(actionText);
       _startStopAct->setIcon(QIcon(IMG_STOP_TOR_16));
-      _startStopAct32->setEnabled(true);
-      _startStopAct32->setText(actionText);
-      _startStopAct32->setIcon(QIcon(IMG_STOP_TOR_32));
+      ui.startStopAct32->setEnabled(true);
+      ui.startStopAct32->setText(actionText);
+      ui.startStopAct32->setIcon(QIcon(IMG_STOP_TOR_32));
 
       /* XXX: This might need to be smarter if we ever start connecting other
        * slots to these triggered() and clicked() signals. */
       QObject::disconnect(_startStopAct, SIGNAL(triggered()), this, 0);
-      QObject::disconnect(_startStopAct32, SIGNAL(triggered()), this, 0);
+      QObject::disconnect(ui.startStopAct32, SIGNAL(triggered()), this, 0);
       connect(_startStopAct, SIGNAL(triggered()), this, SLOT(stop()));
-      connect(_startStopAct32, SIGNAL(triggered()), this, SLOT(stop()));
+      connect(ui.startStopAct32, SIGNAL(triggered()), this, SLOT(stop()));
   } else if (status == Starting)  {
       statusText = tr("Starting the Tor software");
       trayIconFile = IMG_TOR_STARTING;
@@ -1454,7 +1433,7 @@
   
   /*XXX We should warn here if we get disconnected when we didn't intend to */
   _newIdentityAct->setEnabled(false);
-  _newIdentityAct32->setEnabled(false);
+  ui.newIdentityAct32->setEnabled(false);
   _isVidaliaRunningTor = false;
 }
 
@@ -1552,7 +1531,7 @@
   
   /* Let people click on their beloved "New Identity" button */
   _newIdentityAct->setEnabled(true);
-  _newIdentityAct32->setEnabled(true);
+  ui.newIdentityAct32->setEnabled(true);
 
   /* Register for any pertinent asynchronous events. */
   if (!_torControl->setEvents(&errmsg)) {

Modified: vidalia/branches/extension-api/src/vidalia/MainWindow.h
===================================================================
--- vidalia/branches/extension-api/src/vidalia/MainWindow.h	2009-07-16 21:23:18 UTC (rev 3966)
+++ vidalia/branches/extension-api/src/vidalia/MainWindow.h	2009-07-16 22:25:22 UTC (rev 3967)
@@ -181,9 +181,11 @@
     Authenticated,  /**< Vidalia has authenticated to Tor. */
     CircuitEstablished /**< Tor has built a circuit. */
   };
+  /** Connects the toolbar actions which contain useful vidalia commands */
+  void connectToolBarActions();
   /** Create the actions on the tray menu or menubar */
   void createActions();
-  /** Override the parent function in order to remove it */
+  /** Override so it does nothing */
   QMenu* createPopupMenu();
   /** Creates a tray icon with a context menu and adds it to the system
    * notification area. We also set up an application menubar. */
@@ -194,8 +196,6 @@
   void createMenuBar();
   /** Creates the status bar with the permanent Tor Status */
   void createStatusBar();
-  /** Creates the toolbar containing useful vidalia commands */
-  void createToolBar();
   /** Updates the UI to reflect Tor's current <b>status</b>. Returns the
    * previously set TorStatus value. */
   TorStatus updateTorStatus(TorStatus status);

Modified: vidalia/branches/extension-api/src/vidalia/MainWindow.ui
===================================================================
--- vidalia/branches/extension-api/src/vidalia/MainWindow.ui	2009-07-16 21:23:18 UTC (rev 3966)
+++ vidalia/branches/extension-api/src/vidalia/MainWindow.ui	2009-07-16 22:25:22 UTC (rev 3967)
@@ -65,6 +65,62 @@
     </rect>
    </property>
   </widget>
+  <widget class="QToolBar" name="toolBar">
+   <property name="contextMenuPolicy" >
+    <enum>Qt::NoContextMenu</enum>
+   </property>
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+   <addaction name="startStopAct32" />
+   <addaction name="newIdentityAct32" />
+   <addaction name="configAct32" />
+   <addaction name="bandwidthAct32" />
+   <addaction name="helpAct32" />
+  </widget>
+  <action name="startStopAct32">
+   <property name="icon" >
+     <iconset resource="../res/vidalia.qrc" >:/images/32x32/media-playback-start.png</iconset>
+   </property>
+   <property name="text" >
+     <string>Start Tor</string>
+   </property>
+  </action>
+  <action name="newIdentityAct32">
+   <property name="icon" >
+     <iconset resource="../res/vidalia.qrc" >:/images/32x32/view-media-artist.png</iconset>
+   </property>
+   <property name="text" >
+     <string>New Identity</string>
+   </property>
+  </action>
+  <action name="configAct32">
+   <property name="icon" >
+     <iconset resource="../res/vidalia.qrc" >:/images/32x32/preferences-system.png</iconset>
+   </property>
+   <property name="text" >
+     <string>Settings</string>
+   </property>
+  </action>
+  <action name="bandwidthAct32">
+   <property name="icon" >
+     <iconset resource="../res/vidalia.qrc" >:/images/32x32/utilities-system-monitor.png</iconset>
+   </property>
+   <property name="text" >
+     <string>Bandwidth Graph</string>
+   </property>
+  </action>
+  <action name="helpAct32">
+   <property name="icon" >
+     <iconset resource="../res/vidalia.qrc" >:/images/32x32/system-help.png</iconset>
+   </property>
+   <property name="text" >
+     <string>Help</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="res/vidalia.qrc"/>