
commit 69dea1a8901c1e5ecdd6b389bdad732651e6434d Author: Tomás Touceda <chiiph@torproject.org> Date: Fri Feb 3 17:31:07 2012 -0300 Statically provide Torrc access from the Vidalia namespace Just like it is done with the TorControl object. --- src/vidalia/Vidalia.cpp | 8 +++++++- src/vidalia/Vidalia.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/src/vidalia/Vidalia.cpp b/src/vidalia/Vidalia.cpp index 53b41c9..a053e6f 100644 --- a/src/vidalia/Vidalia.cpp +++ b/src/vidalia/Vidalia.cpp @@ -56,6 +56,7 @@ QMap<QString, QString> Vidalia::_args; /**< List of command-line arguments. */ QString Vidalia::_style; /**< The current GUI style. */ QString Vidalia::_language; /**< The current language. */ TorControl* Vidalia::_torControl = 0; /**< Main TorControl object. */ +Torrc* Vidalia::_torrc = 0; /**< Main Torrc object. */ Log Vidalia::_log; QList<QTranslator *> Vidalia::_translators; @@ -124,8 +125,12 @@ Vidalia::Vidalia(QStringList args, int &argc, char **argv) /* Set the GUI style appropriately. */ setStyle(_args.value(ARG_GUISTYLE)); + TorSettings settings; /* Creates a TorControl object, used to talk to Tor. */ - _torControl = new TorControl(TorSettings().getControlMethod()); + _torControl = new TorControl(settings.getControlMethod()); + + /* Creates a Torrc handler */ + _torrc = new Torrc(settings.getTorrc(), settings.getDefaultsTorrc()); /* If we were built with QSslSocket support, then populate the default * CA certificate store. */ @@ -149,6 +154,7 @@ Vidalia::Vidalia(QStringList args, int &argc, char **argv) Vidalia::~Vidalia() { delete _torControl; + delete _torrc; } /** Enters the main event loop and waits until exit() is called. The signal diff --git a/src/vidalia/Vidalia.h b/src/vidalia/Vidalia.h index b7d09f4..0a2ab7c 100644 --- a/src/vidalia/Vidalia.h +++ b/src/vidalia/Vidalia.h @@ -21,6 +21,7 @@ #include "TorSettings.h" #include "Log.h" #include "TorControl.h" +#include "Torrc.h" #include <QApplication> #include <QMap> @@ -74,6 +75,9 @@ public: /** Returns Vidalia's main TorControl object. */ static TorControl* torControl() { return _torControl; } + + /** Returns Vidalia's main TorControl object. */ + static Torrc* torrc() { return _torrc; } /** Returns the location Vidalia uses for its data files. */ static QString dataDirectory(); @@ -156,6 +160,7 @@ private: static QString _style; /**< The current GUI style. */ static QString _language; /**< The current language. */ static TorControl* _torControl; /**< Vidalia's main TorControl object.*/ + static Torrc* _torrc; /**< Vidalia's main Torrc object. */ static Log _log; /**< Logs debugging messages to file or stdout. */ static QList<QTranslator *> _translators; /**< List of installed translators. */ };