Changeset 2324
- Timestamp:
- 01/24/08 20:53:24 (12 months ago)
- Location:
- vidalia/trunk
- Files:
-
- 2 added
- 2 removed
- 6 modified
-
CHANGELOG (modified) (1 diff)
-
src/vidalia/CMakeLists.txt (modified) (3 diffs)
-
src/vidalia/browserprocess.cpp (deleted)
-
src/vidalia/browserprocess.h (deleted)
-
src/vidalia/config/vidaliasettings.cpp (modified) (3 diffs)
-
src/vidalia/config/vidaliasettings.h (modified) (1 diff)
-
src/vidalia/helperprocess.cpp (added)
-
src/vidalia/helperprocess.h (added)
-
src/vidalia/mainwindow.cpp (modified) (5 diffs)
-
src/vidalia/mainwindow.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
vidalia/trunk/CHANGELOG
r2318 r2324 35 35 o Add a 'BrowserExecutable' configuration option to launch a Web browser 36 36 when Tor has built a circuit, and exit Vidalia when the browser is closed. 37 Patch from Steven J. Murdoch <http://www.cl.cam.ac.uk/users/sjm217/>. 38 o Add a 'ProxyExecutable' configuration option to launch a proxy application 39 when Vidalia starts, and close it when Vidalia exits. 37 40 Patch from Steven J. Murdoch <http://www.cl.cam.ac.uk/users/sjm217/>. 38 41 o Respond to the Delete key in the network map by closing whatever circuits -
vidalia/trunk/src/vidalia/CMakeLists.txt
r2319 r2324 183 183 vidaliawindow.cpp 184 184 vmessagebox.cpp 185 browserprocess.cpp185 helperprocess.cpp 186 186 ) 187 187 qt4_wrap_cpp(vidalia_SRCS … … 192 192 vidaliawindow.h 193 193 vmessagebox.h 194 browserprocess.h194 helperprocess.h 195 195 ) 196 196 … … 289 289 endif(NOT WIN32 AND NOT APPLE) 290 290 291 -
vidalia/trunk/src/vidalia/config/vidaliasettings.cpp
r2206 r2324 44 44 #define SETTING_SHOW_MAINWINDOW_AT_START "ShowMainWindowAtStart" 45 45 #define SETTING_BROWSER_EXECUTABLE "BrowserExecutable" 46 #define SETTING_PROXY_EXECUTABLE "ProxyExecutable" 46 47 47 48 #if defined(Q_OS_WIN32) … … 75 76 setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true); 76 77 setDefault(SETTING_BROWSER_EXECUTABLE, ""); 78 setDefault(SETTING_PROXY_EXECUTABLE, ""); 77 79 } 78 80 … … 187 189 } 188 190 191 /** Returns a fully-qualified path to the proxy server, including the 192 * executable name. */ 193 QString 194 VidaliaSettings::getProxyExecutable() const 195 { 196 return QDir::convertSeparators(value(SETTING_PROXY_EXECUTABLE).toString()); 197 } 198 199 /** Sets the location and name of the proxy server executable to the given string. 200 * If set to the empty string, the proxy will not be started. */ 201 void 202 VidaliaSettings::setProxyExecutable(const QString &proxyExecutable) 203 { 204 setValue(SETTING_PROXY_EXECUTABLE, proxyExecutable); 205 } -
vidalia/trunk/src/vidalia/config/vidaliasettings.h
r2206 r2324 79 79 * If set to the empty string, the browser will not be started. */ 80 80 void setBrowserExecutable(const QString &browserExecutable); 81 82 /** Returns a fully-qualified path to the proxy server, including the 83 * executable name. */ 84 QString getProxyExecutable() const; 85 86 /** Sets the location and name of the proxy server executable to the given string. 87 * If set to the empty string, the proxy will not be started. */ 88 void setProxyExecutable(const QString &proxyExecutable); 81 89 }; 82 90 -
vidalia/trunk/src/vidalia/mainwindow.cpp
r2320 r2324 148 148 _torControl->setEvent(TorEvents::GeneralStatus, this, true); 149 149 150 /* Create a new BrowserProcess object, used to start the web browser */151 _browserProcess = new BrowserProcess(this);150 /* Create a new HelperProcess object, used to start the web browser */ 151 _browserProcess = new HelperProcess(this); 152 152 connect(_browserProcess, SIGNAL(finished(int, QProcess::ExitStatus)), 153 153 this, SLOT(onBrowserFinished(int, QProcess::ExitStatus))); 154 154 connect(_browserProcess, SIGNAL(startFailed(QString)), 155 155 this, SLOT(onBrowserFailed(QString))); 156 157 /* Create a new HelperProcess object, used to start the proxy server */ 158 _proxyProcess = new HelperProcess(this); 159 connect(_proxyProcess, SIGNAL(startFailed(QString)), 160 this, SLOT(onProxyFailed(QString))); 156 161 157 162 /* Catch signals when the application is running or shutting down */ … … 227 232 start(); 228 233 } 234 235 /* Start the proxy server, if configured */ 236 startProxy(); 229 237 } 230 238 … … 237 245 /* Kill our Tor process now */ 238 246 _torControl->stop(); 247 } 248 249 if (_proxyProcess->state() != QProcess::NotRunning) { 250 /* Close the proxy server (Polipo ignores the WM_CLOSE event sent by 251 * terminate() so we have to kill() it) */ 252 _proxyProcess->kill(); 239 253 } 240 254 … … 436 450 VMessageBox::warning(this, tr("Error starting web browser"), 437 451 tr("Vidalia was unable to start the configured web browser"), 452 VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape); 453 } 454 455 /** Starts the proxy server, if appropriately configured */ 456 void MainWindow::startProxy() 457 { 458 VidaliaSettings settings; 459 QString executable = settings.getProxyExecutable(); 460 461 if (!executable.isEmpty()) 462 _proxyProcess->start(executable, QStringList()); 463 } 464 465 /** Called when the proxy server fails to start, for example, because 466 * the path specified didn't lead to an executable. */ 467 void 468 MainWindow::onProxyFailed(QString errmsg) 469 { 470 Q_UNUSED(errmsg); 471 472 /* Display an error message and see if the user wants some help */ 473 VMessageBox::warning(this, tr("Error starting proxy server"), 474 tr("Vidalia was unable to start the configured proxy server"), 438 475 VMessageBox::Ok|VMessageBox::Default|VMessageBox::Escape); 439 476 } … … 1152 1189 } 1153 1190 1191 -
vidalia/trunk/src/vidalia/mainwindow.h
r2217 r2324 41 41 #include "network/netviewer.h" 42 42 #include "ui_mainwindow.h" 43 #include " browserprocess.h"43 #include "helperprocess.h" 44 44 45 45 … … 113 113 /** Called web the web browser failed to start */ 114 114 void onBrowserFailed(QString errmsg); 115 /** Called when the proxy server fails to start */ 116 void onProxyFailed(QString errmsg); 115 117 116 118 private: … … 139 141 /** Starts the web browser, if appropriately configured */ 140 142 void startBrowser(); 143 /** Starts the proxy server, if appropriately configured */ 144 void startProxy(); 141 145 /** Converts a TorStatus enum value to a string for debug logging purposes. */ 142 146 QString toString(TorStatus status); … … 176 180 /** A TorControl object that handles communication with Tor */ 177 181 TorControl* _torControl; 178 /** A BrowserProcess object that manages the web browser */ 179 BrowserProcess* _browserProcess; 182 /** A HelperProcess object that manages the web browser */ 183 HelperProcess* _browserProcess; 184 /** A HelperProcess object that manages the proxy server */ 185 HelperProcess* _proxyProcess; 180 186 /** Remembers the control password between when we start Tor with a hash of 181 187 * the password and when we need to provide the password itself. */ … … 201 207 #endif 202 208 209
