[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r2175: Remove vidalia.h's dependence on helpbrowser.h as part of my (in trunk: . src src/gui src/gui/common src/gui/config src/gui/log src/gui/network)
Author: edmanm
Date: 2007-12-05 00:09:22 -0500 (Wed, 05 Dec 2007)
New Revision: 2175
Modified:
trunk/
trunk/src/gui/common/vidaliawindow.h
trunk/src/gui/config/configdialog.cpp
trunk/src/gui/config/configdialog.h
trunk/src/gui/config/configpage.h
trunk/src/gui/config/serverpage.cpp
trunk/src/gui/log/messagelog.cpp
trunk/src/gui/mainwindow.cpp
trunk/src/gui/mainwindow.h
trunk/src/gui/network/netviewer.cpp
trunk/src/vidalia.cpp
trunk/src/vidalia.h
Log:
r2226@lysithea: edmanm | 2007-12-05 00:02:12 -0500
Remove vidalia.h's dependence on helpbrowser.h as part of my ongoing quest to
make CMake happier.
Property changes on: trunk
___________________________________________________________________
svk:merge ticket from /local/vidalia/trunk [r2226] on 0108964c-5b0b-4c9e-969f-e2288315d100
Modified: trunk/src/gui/common/vidaliawindow.h
===================================================================
--- trunk/src/gui/common/vidaliawindow.h 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/common/vidaliawindow.h 2007-12-05 05:09:22 UTC (rev 2175)
@@ -65,6 +65,11 @@
* override, since QMainWindow::show() is non-virtual. */
virtual void showWindow() { QMainWindow::show(); }
+signals:
+ /** Emitted when a VidaliaWindow requests help information on the specified
+ * <b>topic</b>. */
+ void helpRequested(const QString &topic);
+
private:
QString _name; /**< Name associated with this window. */
VSettings* _settings; /**< Object used to store window properties */
Modified: trunk/src/gui/config/configdialog.cpp
===================================================================
--- trunk/src/gui/config/configdialog.cpp 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/config/configdialog.cpp 2007-12-05 05:09:22 UTC (rev 2175)
@@ -77,7 +77,11 @@
ui.stackPages->add(new AdvancedPage(ui.stackPages),
createPageAction(QIcon(IMAGE_ADVANCED),
tr("Advanced"), grp));
-
+ foreach (ConfigPage *page, ui.stackPages->pages()) {
+ connect(page, SIGNAL(helpRequested(QString)),
+ this, SLOT(help(QString)));
+ }
+
/* Create the toolbar */
ui.toolBar->addActions(grp->actions());
ui.toolBar->addSeparator();
@@ -237,23 +241,26 @@
ConfigDialog::help()
{
Page currentPage = static_cast<Page>(ui.stackPages->currentIndex());
-
+
switch (currentPage) {
case Network:
- Vidalia::help("config.network");
- break;
+ help("config.network"); break;
case Server:
- Vidalia::help("server");
- break;
+ help("server"); break;
case Appearance:
- Vidalia::help("config.appearance");
- break;
+ help("config.appearance"); break;
case Advanced:
- Vidalia::help("config.advanced");
- break;
+ help("config.advanced"); break;
default:
- Vidalia::help("config.general");
- break;
+ help("config.general"); break;
}
}
+/** Called when a ConfigPage in the dialog requests help on a specific
+ * <b>topic</b>. */
+void
+ConfigDialog::help(const QString &topic)
+{
+ emit helpRequested(topic);
+}
+
Modified: trunk/src/gui/config/configdialog.h
===================================================================
--- trunk/src/gui/config/configdialog.h 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/config/configdialog.h 2007-12-05 05:09:22 UTC (rev 2175)
@@ -30,8 +30,7 @@
#include <QMainWindow>
#include <QFileDialog>
-#include <gui/help/browser/helpbrowser.h>
-#include <gui/common/vidaliawindow.h>
+#include <vidaliawindow.h>
#include "generalpage.h"
#include "networkpage.h"
@@ -74,8 +73,11 @@
* SAVECONF is successful, then all settings are considered to be
* applied. */
void saveConf();
- /** Shows help information for whichever settings page the user is currently
- * viewing. */
+ /** Called when a ConfigPage in the dialog requests help on a specific
+ * <b>topic</b>. */
+ void help(const QString &topic);
+ /** Shows general help information for whichever settings page the user is
+ * currently viewing. */
void help();
private:
Modified: trunk/src/gui/config/configpage.h
===================================================================
--- trunk/src/gui/config/configpage.h 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/config/configpage.h 2007-12-05 05:09:22 UTC (rev 2175)
@@ -33,6 +33,8 @@
class ConfigPage : public QWidget
{
+ Q_OBJECT
+
public:
/** Default Constructor */
ConfigPage(QWidget *parent = 0, const QString title = QString())
@@ -65,6 +67,11 @@
* settings. */
virtual void revert() {}
+signals:
+ /** Signal emitted when a ConfigPage requests help information on a given
+ * <b>topic</b>. */
+ void helpRequested(const QString &topic);
+
private:
QString _title; /**< Title of this configuration page. */
};
Modified: trunk/src/gui/config/serverpage.cpp
===================================================================
--- trunk/src/gui/config/serverpage.cpp 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/config/serverpage.cpp 2007-12-05 05:09:22 UTC (rev 2175)
@@ -37,11 +37,6 @@
#include "domainvalidator.h"
#include "nicknamevalidator.h"
-
-/** Help topics */
-#define EXIT_POLICY_HELP "server.exitpolicy"
-#define BANDWIDTH_HELP "server.bandwidth"
-
/* These are completely made up values (in bytes/sec). */
#define CABLE256_AVG_RATE (32*1024)
#define CABLE256_MAX_RATE (64*1024)
@@ -317,14 +312,14 @@
void
ServerPage::exitPolicyHelp()
{
- Vidalia::help(EXIT_POLICY_HELP);
+ emit helpRequested("server.exitpolicy");
}
/** Shows the bandwidth rate limiting help information */
void
ServerPage::bandwidthHelp()
{
- Vidalia::help(BANDWIDTH_HELP);
+ emit helpRequested("server.bandwidth");
}
/** Loads the server's bandwidth average and burst limits. */
Modified: trunk/src/gui/log/messagelog.cpp
===================================================================
--- trunk/src/gui/log/messagelog.cpp 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/log/messagelog.cpp 2007-12-05 05:09:22 UTC (rev 2175)
@@ -434,6 +434,6 @@
void
MessageLog::help()
{
- Vidalia::help("log");
+ emit helpRequested("log");
}
Modified: trunk/src/gui/mainwindow.cpp
===================================================================
--- trunk/src/gui/mainwindow.cpp 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/mainwindow.cpp 2007-12-05 05:09:22 UTC (rev 2175)
@@ -118,6 +118,12 @@
_bandwidthGraph = new BandwidthGraph();
_netViewer = new NetViewer();
_configDialog = new ConfigDialog();
+ connect(_messageLog, SIGNAL(helpRequested(QString)),
+ this, SLOT(showHelpDialog(QString)));
+ connect(_netViewer, SIGNAL(helpRequested(QString)),
+ this, SLOT(showHelpDialog(QString)));
+ connect(_configDialog, SIGNAL(helpRequested(QString)),
+ this, SLOT(showHelpDialog(QString)));
/* Create the actions that will go in the tray menu */
createActions();
@@ -302,8 +308,8 @@
connect(_aboutAct, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
_helpAct = new QAction(QIcon(IMG_HELP), tr("Help"), this);
- connect(_helpAct, SIGNAL(triggered()), vApp, SLOT(help()));
- connect(ui.lblHelpBrowser, SIGNAL(clicked()), vApp, SLOT(help()));
+ connect(_helpAct, SIGNAL(triggered()), this, SLOT(showHelpDialog()));
+ connect(ui.lblHelpBrowser, SIGNAL(clicked()), this, SLOT(showHelpDialog()));
_newIdentityAct = new QAction(QIcon(IMG_IDENTITY), tr("New Identity"), this);
_newIdentityAct->setEnabled(false);
@@ -616,7 +622,7 @@
showConfigDialog();
} else if (response == VMessageBox::Help) {
/* Show troubleshooting information about starting Tor */
- Vidalia::help("troubleshooting.start");
+ showHelpDialog("troubleshooting.start");
}
}
@@ -661,7 +667,7 @@
} else {
/* Show the help browser (if requested) */
if (response == VMessageBox::Help)
- Vidalia::help("troubleshooting.connect");
+ showHelpDialog("troubleshooting.connect");
/* Since Vidalia can't connect, we can't really do much, so stop Tor. */
_torControl->stop();
}
@@ -714,7 +720,7 @@
if (response == VMessageBox::Help) {
/* Show some troubleshooting help */
- Vidalia::help("troubleshooting.stop");
+ showHelpDialog("troubleshooting.stop");
}
/* Tor is still running since stopping failed */
_isIntentionalExit = false;
@@ -748,7 +754,7 @@
if (ret == VMessageBox::ShowLog)
_messageLog->showWindow();
else if (ret == VMessageBox::Help)
- Vidalia::help("troubleshooting.torexited");
+ showHelpDialog("troubleshooting.torexited");
}
}
}
@@ -995,6 +1001,24 @@
aboutDialog->showWindow();
}
+/** Displays the help browser and displays the most recently viewed help
+ * topic. */
+void
+MainWindow::showHelpDialog()
+{
+ showHelpDialog(QString());
+}
+
+/**< Shows the help browser and displays the given help <b>topic</b>. */
+void
+MainWindow::showHelpDialog(const QString &topic)
+{
+ static HelpBrowser *helpBrowser = 0;
+ if (!helpBrowser)
+ helpBrowser = new HelpBrowser(this);
+ helpBrowser->showWindow(topic);
+}
+
/** Creates and displays the Configuration dialog with the current page set to
* <b>page</b>. */
void
Modified: trunk/src/gui/mainwindow.h
===================================================================
--- trunk/src/gui/mainwindow.h 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/mainwindow.h 2007-12-05 05:09:22 UTC (rev 2175)
@@ -67,6 +67,11 @@
virtual void customEvent(QEvent *event);
private slots:
+ /** Displays the help browser and displays the most recently viewed help
+ * topic. */
+ void showHelpDialog();
+ /** Called when a child window requests the given help <b>topic</b>. */
+ void showHelpDialog(const QString &topic);
/** Called when the user selects "Start" from the menu. */
void start();
/** Called when the Tor process fails to start. */
Modified: trunk/src/gui/network/netviewer.cpp
===================================================================
--- trunk/src/gui/network/netviewer.cpp 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/gui/network/netviewer.cpp 2007-12-05 05:09:22 UTC (rev 2175)
@@ -287,7 +287,7 @@
void
NetViewer::help()
{
- Vidalia::help("netview");
+ emit helpRequested("netview");
}
/** Loads a list of new descriptors from the given IDs. */
Modified: trunk/src/vidalia.cpp
===================================================================
--- trunk/src/vidalia.cpp 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/vidalia.cpp 2007-12-05 05:09:22 UTC (rev 2175)
@@ -53,7 +53,6 @@
QMap<QString, QString> Vidalia::_args; /**< List of command-line arguments. */
QString Vidalia::_style; /**< The current GUI style. */
QString Vidalia::_language; /**< The current language. */
-HelpBrowser* Vidalia::_help = 0; /**< Vidalia's help system. */
TorControl* Vidalia::_torControl = 0; /**< Main TorControl object. */
Log Vidalia::_log;
@@ -124,8 +123,6 @@
/** Destructor */
Vidalia::~Vidalia()
{
- if (_help)
- delete _help;
delete _torControl;
}
@@ -312,16 +309,6 @@
return false;
}
-/** Displays the help page associated with the specified topic. If no topic is
- * specified, then the default help page will be displayed. */
-void
-Vidalia::help(QString topic)
-{
- if (!_help)
- _help = new HelpBrowser();
- _help->showWindow(topic);
-}
-
/** Returns the directory Vidalia uses for its data files. */
QString
Vidalia::dataDirectory()
Modified: trunk/src/vidalia.h
===================================================================
--- trunk/src/vidalia.h 2007-12-04 20:23:15 UTC (rev 2174)
+++ trunk/src/vidalia.h 2007-12-05 05:09:22 UTC (rev 2175)
@@ -39,7 +39,6 @@
#include <QKeySequence>
#include <log.h>
-#include <helpbrowser.h>
#include <vidaliasettings.h>
#include <torcontrol.h>
@@ -110,10 +109,6 @@
static void createShortcut(const QKeySequence &key, QWidget *sender,
QWidget *receiver, const char *slot);
-public slots:
- /** Shows the specified help topic, or the default if empty. */
- static void help(QString topic = QString());
-
signals:
/** Emitted when the application is running and the main event loop has
* started. */
@@ -146,10 +141,7 @@
static QMap<QString, QString> _args; /**< List of command-line arguments. */
static QString _style; /**< The current GUI style. */
static QString _language; /**< The current language. */
-
static TorControl* _torControl; /**< Vidalia's main TorControl object.*/
- static HelpBrowser* _help; /**< Vidalia's configurable settings. */
-
static Log _log; /**< Logs debugging messages to file or stdout. */
};