Vidalia
0.3.1
|
#include <UpdateProcess.h>
Public Types | |
enum | BundleInfo { TorBundleInfo } |
Public Slots | |
void | cancel () |
Signals | |
void | checkForUpdatesFailed (QString errmsg) |
void | downloadProgress (QString url, int bytesReceived, int bytesTotal) |
void | updatesAvailable (UpdateProcess::BundleInfo bi, PackageList packages) |
void | updatesInstalled (int nPackagesInstalled) |
void | installUpdatesFailed (QString errmsg) |
Public Member Functions | |
UpdateProcess (QObject *parent=0) | |
void | checkForUpdates (BundleInfo bi) |
void | installUpdates (BundleInfo bi) |
bool | isRunning () const |
void | setSocksPort (quint16 port) |
Static Public Member Functions | |
static QDateTime | nextCheckForUpdates (const QDateTime &lastCheckedAt) |
static bool | shouldCheckForUpdates (const QDateTime &lastCheckedAt) |
static int | checkForUpdatesInterval () |
static QString | updateExecutable () |
static QString | updateRepositoryDir () |
Protected Types | |
enum | UpdateCommand { NoCommand, CheckForUpdates, InstallUpdates } |
Protected Slots | |
void | readStandardOutput () |
void | readStandardError () |
void | onError (QProcess::ProcessError error) |
void | onFinished (int exitCode, QProcess::ExitStatus exitStatus) |
Protected Member Functions | |
QString | bundleInfoToString (BundleInfo bundleInfo) |
Static Protected Member Functions | |
static PackageInfo | packageInfo (const QString &package) |
static PackageInfo | packageInfoFromXml (const QByteArray &xml) |
Private Attributes | |
UpdateCommand | _currentCommand |
BundleInfo | _currentBundle |
PackageList | _packageList |
quint16 | _socksPort |
Definition at line 22 of file UpdateProcess.h.
Enumerator | |
---|---|
TorBundleInfo |
Definition at line 27 of file UpdateProcess.h.
|
protected |
Enumerator | |
---|---|
NoCommand | |
CheckForUpdates | |
InstallUpdates |
Definition at line 134 of file UpdateProcess.h.
UpdateProcess::UpdateProcess | ( | QObject * | parent = 0 | ) |
Default constructor.
Definition at line 22 of file UpdateProcess.cpp.
References _currentCommand, _socksPort, connect(), NoCommand, onFinished(), readStandardError(), and readStandardOutput().
|
protected |
Converts a BundleInfo enum value to its proper Thandy-recognized URL for the current OS and architecture.
Definition at line 249 of file UpdateProcess.cpp.
References TorBundleInfo.
Referenced by checkForUpdates(), and installUpdates().
|
slot |
Cancels the currently running software update operation immediately.
Definition at line 94 of file UpdateProcess.cpp.
References _currentCommand, and CheckForUpdates.
void UpdateProcess::checkForUpdates | ( | BundleInfo | bi | ) |
Begin a check for software updates that may be available for the software package specified by bi.
Definition at line 39 of file UpdateProcess.cpp.
References _currentBundle, _currentCommand, _socksPort, bundleInfoToString(), CheckForUpdates, updateExecutable(), updateRepositoryDir(), and vNotice.
|
signal |
Emitted when the check for available software updates failed. errmsg contains a human-readable description of the problem encountered.
Referenced by onError(), and onFinished().
|
static |
Returns the preferred interval (in seconds) between executions of the Glider process to check for available software updates.
Definition at line 217 of file UpdateProcess.cpp.
Referenced by nextCheckForUpdates().
|
signal |
Emitted while an updated package download is in progress. url is location of the update, bytesReceived is how many bytes have been downloaded so far and bytesTotal is the total size of the package being downloaded.
Referenced by readStandardError().
void UpdateProcess::installUpdates | ( | BundleInfo | bi | ) |
Instructs the software update process to install previously downloaded files for bi.
Definition at line 61 of file UpdateProcess.cpp.
References _currentBundle, _currentCommand, _socksPort, bundleInfoToString(), InstallUpdates, updateExecutable(), updateRepositoryDir(), and vNotice.
|
signal |
Emitted when there is an error installing one or more updated software packages. errmsg might even contain a useful description of the error encountered (but don't bet the farm on it).
Referenced by readStandardError().
bool UpdateProcess::isRunning | ( | ) | const |
Returns true if the update process is currently in the middle of an operation, such as checking for or installing updates.
Definition at line 88 of file UpdateProcess.cpp.
|
static |
Return the time at which we should next check for available updates, given the last we checked was at lastCheckedAt.
Definition at line 224 of file UpdateProcess.cpp.
References checkForUpdatesInterval().
Referenced by MainWindow::running(), and shouldCheckForUpdates().
|
protectedslot |
Called when the underlying QProcess encounters an error.
Definition at line 206 of file UpdateProcess.cpp.
References checkForUpdatesFailed(), tc::error(), updateExecutable(), and vWarn.
|
protectedslot |
Called when the auto-update process has terminated.
Definition at line 186 of file UpdateProcess.cpp.
References _currentBundle, _currentCommand, _packageList, CheckForUpdates, checkForUpdatesFailed(), InstallUpdates, updatesAvailable(), updatesInstalled(), and vInfo.
Referenced by UpdateProcess().
|
staticprotected |
Returns a PackageInfo object containing information about the updated package specified by the /pkginfo/ URL in package.
Definition at line 260 of file UpdateProcess.cpp.
References packageInfoFromXml(), updateExecutable(), updateRepositoryDir(), and vNotice.
Referenced by readStandardError().
|
staticprotected |
Returns a PackageInfo object populated with information extracted from a Thandy-formatted XML document given by xml.
Definition at line 282 of file UpdateProcess.cpp.
References err(), PackageInfo::setLongDescription(), PackageInfo::setName(), PackageInfo::setShortDescription(), PackageInfo::setVersion(), and vWarn.
Referenced by packageInfo().
|
protectedslot |
Called when there is data to be read from the update process's stderr. Reads and parses all available data.
XXX: This is a fucking kludge. If installation fails, Thandy just dumps a Python traceback that (for obvious reasons) doesn't follow the expected format. There isn't a defined control message type for this yet we'd really like the error, so treat this one specially.
Definition at line 106 of file UpdateProcess.cpp.
References _currentCommand, _packageList, CheckForUpdates, downloadProgress(), installUpdatesFailed(), PackageInfo::isValid(), packageInfo(), string_parse_keyvals(), and vInfo.
Referenced by UpdateProcess().
|
protectedslot |
Called when there is data to be read from the update process's stdout. Reads and parses all available data.
Definition at line 174 of file UpdateProcess.cpp.
References vInfo.
Referenced by UpdateProcess().
void UpdateProcess::setSocksPort | ( | quint16 | port | ) |
Sets the port to use as a SOCKS proxy to port. If port is set to 0, then no SOCKS proxy will be used when checking for updates.
Definition at line 82 of file UpdateProcess.cpp.
References _socksPort.
|
static |
Return true if we should check for available software udpates, given the last time we checked was at lastCheckedAt. The returned QDateTime will be in UTC.
Definition at line 230 of file UpdateProcess.cpp.
References nextCheckForUpdates().
Referenced by MainWindow::circuitEstablished(), and MainWindow::running().
|
static |
Returns the path and filename of the software update executable.
Definition at line 237 of file UpdateProcess.cpp.
Referenced by checkForUpdates(), installUpdates(), onError(), and packageInfo().
|
static |
Returns the path in which the software update executable should write all of its state information.
Definition at line 243 of file UpdateProcess.cpp.
References Vidalia::dataDirectory().
Referenced by checkForUpdates(), installUpdates(), and packageInfo().
|
signal |
Emitted when updated software packages in bundle bi are are available. packages contains a collection of PackageInfo objects describing the updates available for installation.
Referenced by onFinished().
|
signal |
Emitted after all available updated packages have been successfully installed.
Referenced by onFinished().
|
private |
Enum value of the last bundle for which we performed some action (e.g., check for updates, install an update, etc.
Definition at line 160 of file UpdateProcess.h.
Referenced by checkForUpdates(), installUpdates(), and onFinished().
|
private |
Enum value of the current auto-update operation.
Definition at line 156 of file UpdateProcess.h.
Referenced by cancel(), checkForUpdates(), installUpdates(), onFinished(), readStandardError(), and UpdateProcess().
|
private |
List of packages that have available updates.
Definition at line 163 of file UpdateProcess.h.
Referenced by onFinished(), and readStandardError().
|
private |
Currently configured SOCKS port.
Definition at line 166 of file UpdateProcess.h.
Referenced by checkForUpdates(), installUpdates(), setSocksPort(), and UpdateProcess().