[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r3950: Added back file menu. Plugins menu possibly working as well. (vidalia/branches/extension-api/src/vidalia)
Author: tyree731
Date: 2009-07-08 18:00:46 -0400 (Wed, 08 Jul 2009)
New Revision: 3950
Modified:
vidalia/branches/extension-api/src/vidalia/MainWindow.cpp
vidalia/branches/extension-api/src/vidalia/MainWindow.h
Log:
Added back file menu. Plugins menu possibly working as well.
Modified: vidalia/branches/extension-api/src/vidalia/MainWindow.cpp
===================================================================
--- vidalia/branches/extension-api/src/vidalia/MainWindow.cpp 2009-07-08 19:19:08 UTC (rev 3949)
+++ vidalia/branches/extension-api/src/vidalia/MainWindow.cpp 2009-07-08 22:00:46 UTC (rev 3950)
@@ -461,16 +461,6 @@
connect(_bandwidthAct, SIGNAL(triggered()),
_bandwidthGraph, SLOT(showWindow()));
-#if 0
- _messageAct = new QAction(tr("Message Log"), this);
- connect(_messageAct, SIGNAL(triggered()),
- _messageLog, SLOT(showWindow()));
-
- _networkAct = new QAction(tr("Network Map"), this);
- connect(_networkAct, SIGNAL(triggered()),
- _netViewer, SLOT(showWindow()));
-#endif
-
_controlPanelAct = new QAction(tr("Control Panel"), this);
connect(_controlPanelAct, SIGNAL(triggered()), this, SLOT(show()));
@@ -494,10 +484,6 @@
_startStopAct->setIcon(QIcon(IMG_START_TOR_16));
_exitAct->setIcon(QIcon(IMG_EXIT));
_bandwidthAct->setIcon(QIcon(IMG_BWGRAPH));
-#if 0
- _messageAct->setIcon(QIcon(IMG_MESSAGELOG));
- _networkAct->setIcon(QIcon(IMG_NETWORK));
-#endif
_controlPanelAct->setIcon(QIcon(IMG_CONTROL_PANEL));
_configAct->setIcon(QIcon(IMG_CONFIG));
_aboutAct->setIcon(QIcon(IMG_ABOUT));
@@ -527,10 +513,6 @@
menu->addAction(_startStopAct);
menu->addSeparator();
menu->addAction(_bandwidthAct);
-#if 0
- menu->addAction(_messageAct);
- menu->addAction(_networkAct);
-#endif
menu->addAction(_newIdentityAct);
menu->addSeparator();
menu->addAction(_controlPanelAct);
@@ -548,12 +530,11 @@
}
/** Creates a new menubar with no parent, so Qt will use this as the "default
- * menubar" on Mac. This adds on to the existing actions from the createMens()
+ * menubar" on Mac. This adds on to the existing actions from the createMenu()
* method. */
void
MainWindow::createMenuBar()
{
-#if defined(Q_WS_MAC)
/* Mac users sure like their shortcuts. Actions NOT mentioned below
* don't explicitly need shortcuts, since they are merged to the default
* menubar and get the default shortcuts anyway. */
@@ -563,6 +544,7 @@
_newIdentityAct->setShortcut(tr("Ctrl+I"));
_controlPanelAct->setShortcut(tr("Ctrl+P"));
+#if defined(Q_WS_MAC)
/* Force Qt to put merge the Exit, Configure, and About menubar options into
* the default menu, even if Vidalia is currently not speaking English. */
_configAct->setText("config");
@@ -571,12 +553,13 @@
_aboutAct->setMenuRole(QAction::AboutRole);
_exitAct->setText("quit");
_exitAct->setMenuRole(QAction::QuitRole);
+#endif
/* The File, Help, and Configure menus will get merged into the application
* menu by Qt. */
if (_menuBar)
delete _menuBar;
- _menuBar = new QMenuBar(0);
+ _menuBar = menuBar();
QMenu *fileMenu = _menuBar->addMenu("File");
fileMenu->addAction(_exitAct);
fileMenu->addAction(_configAct);
@@ -585,17 +568,16 @@
torMenu->addAction(_startStopAct);
torMenu->addSeparator();
torMenu->addAction(_newIdentityAct);
+ torMenu->addAction(_bandwidthAct);
- QMenu *viewMenu = _menuBar->addMenu(tr("View"));
- viewMenu->addAction(_controlPanelAct);
- viewMenu->addSeparator();
- viewMenu->addAction(_bandwidthAct);
+ /* Create menu for plugins and populate it with plugin's actions. */
+ QMenu *pluginsMenu = _menuBar->addMenu(tr("Plugins"));
+ populatePluginsFileMenu(_pluginManager->plugins(), pluginsMenu);
QMenu *helpMenu = _menuBar->addMenu(tr("Help"));
_helpAct->setText(tr("Vidalia Help"));
helpMenu->addAction(_helpAct);
helpMenu->addAction(_aboutAct);
-#endif
}
/** Creates the statusbar and its permanent widget */
@@ -716,7 +698,6 @@
MainWindow::populateTabs(QList<VidaliaPluginInterface*> plugins)
{
foreach (VidaliaPluginInterface* plugin, plugins) {
- vInfo("Survey says...");
if (plugin->panel()) {
vInfo(plugin->panel()->tabLabel());
ui.tabMainPanel->addTab(plugin->panel(), plugin->panel()->tabIcon(),
@@ -725,6 +706,18 @@
}
}
+void
+MainWindow::populatePluginsFileMenu(QList<VidaliaPluginInterface*> plugins,
+ QMenu* pluginsMenu)
+{
+ foreach(VidaliaPluginInterface* plugin, plugins) {
+ if (plugin->fileMenuEntry()) {
+ pluginsMenu->addAction(plugin->fileMenuEntry());
+ plugin->fileMenuEntry()->setText(plugin->name());
+ }
+ }
+}
+
/** Starts the web browser and IM client, if appropriately configured */
void
MainWindow::startSubprocesses()
Modified: vidalia/branches/extension-api/src/vidalia/MainWindow.h
===================================================================
--- vidalia/branches/extension-api/src/vidalia/MainWindow.h 2009-07-08 19:19:08 UTC (rev 3949)
+++ vidalia/branches/extension-api/src/vidalia/MainWindow.h 2009-07-08 22:00:46 UTC (rev 3950)
@@ -198,6 +198,10 @@
/** Takes a list of plugin instances and populates the main tab widget with
* the plugin's VidaliaPanel if it has one. */
void populateTabs(QList<VidaliaPluginInterface*> plugins);
+ /** Takes a list of plugin instances and the plugin menu object and populates
+ * said menu with file menu entries for the plugins */
+ void populatePluginsFileMenu(QList<VidaliaPluginInterface*> plugins,
+ QMenu* pluginMenu);
/** Starts the web browser, if appropriately configured */
void startSubprocesses();
/** Starts the proxy server, if appropriately configured */
@@ -278,7 +282,7 @@
/** Set to true if Vidalia should restart Tor after a software upgrade. */
bool _restartTorAfterUpgrade;
#endif
- /** The menubar (Mac OS X only). */
+ /** The menubar */
QMenuBar *_menuBar;
/** The statusbar */
QStatusBar *_statusBar;