Vidalia 0.2.12
|
#include <TorProcess.h>
Signals | |
void | log (const QString &severity, const QString &message) |
void | startFailed (const QString &errorMessage) |
Public Member Functions | |
TorProcess (QObject *parent=0) | |
void | start (const QString &app, const QStringList &args) |
bool | stop (QString *errmsg=0) |
quint64 | pid () |
void | openStdout () |
void | closeStdout () |
Static Public Member Functions | |
static QString | version (const QString &exe) |
Private Slots | |
void | onReadyRead () |
void | onError (QProcess::ProcessError error) |
Private Member Functions | |
QString | formatArguments (const QStringList &args) |
Definition at line 22 of file TorProcess.h.
TorProcess::TorProcess | ( | QObject * | parent = 0 | ) |
Default constructor.
Default constructor
Definition at line 30 of file TorProcess.cpp.
References tc::error(), onError(), onReadyRead(), and openStdout().
void TorProcess::closeStdout | ( | ) |
Disable reading log messages from stdout.
Closes logging on stdout. When this is closed, the log() signal will not be emitted when Tor prints a message to stdout.
Definition at line 138 of file TorProcess.cpp.
References onReadyRead().
Referenced by TorControl::closeTorStdout().
QString TorProcess::formatArguments | ( | const QStringList & | args | ) | [private] |
Formats the Tor process arguments for logging.
Definition at line 42 of file TorProcess.cpp.
References string_escape().
Referenced by start().
void TorProcess::log | ( | const QString & | severity, |
const QString & | message | ||
) | [signal] |
Emitted when Tor prints a log message to the console
Referenced by onReadyRead().
void TorProcess::onError | ( | QProcess::ProcessError | error | ) | [private, slot] |
Called when an error occurs in the process.
Called when the process encounters an error. If the error tells us that the process failed to start, then we will emit the startFailed() signal and an error message indicating why.
Definition at line 170 of file TorProcess.cpp.
References tc::error(), and startFailed().
Referenced by TorProcess().
void TorProcess::onReadyRead | ( | ) | [private, slot] |
Called when there is data to be read from stdout
Definition at line 148 of file TorProcess.cpp.
Referenced by closeStdout(), and TorProcess().
void TorProcess::openStdout | ( | ) |
Enable reading log messages from stdout.
Opens logging on stdout. When this is open, the log() signal will be emitted when Tor prints a message to stdout.
Definition at line 129 of file TorProcess.cpp.
Referenced by TorControl::onDisconnected(), and TorProcess().
quint64 TorProcess::pid | ( | ) |
Return the Tor process's PID (workaround for some Windows funkiness)
Return the process ID for the current process.
Definition at line 117 of file TorProcess.cpp.
Referenced by stop().
void TorProcess::start | ( | const QString & | app, |
const QStringList & | args | ||
) |
Start the Tor process
Attempts to start the Tor process using the location, executable, and command-line arguments specified in Vidalia's settings. If Tor starts, the signal started() will be emitted. If Tor fails to start, startFailed(errmsg) will be emitted, with an appropriate error message.
Definition at line 56 of file TorProcess.cpp.
References tc::debug(), formatArguments(), and i().
Referenced by TorControl::start().
void TorProcess::startFailed | ( | const QString & | errorMessage | ) | [signal] |
Emitted when Tor fails to start, perhaps because the path to Tor was bogus.
Referenced by onError().
bool TorProcess::stop | ( | QString * | errmsg = 0 | ) |
Stop the Tor process
Stops the Tor process
Definition at line 85 of file TorProcess.cpp.
References tc::debug(), tc::error(), and pid().
Referenced by TorControl::stop().
QString TorProcess::version | ( | const QString & | exe | ) | [static] |
Returns the version reported by the Tor executable specified in exe, or a default-constructed QString on failure.
Definition at line 184 of file TorProcess.cpp.