#include <StatusEventWidget.h>
Public Member Functions | |
StatusEventWidget (QWidget *parent=0) | |
void | setMaximumItemCount (int maximumItemCount) |
int | maximumItemCount () const |
QStringList | selectedEvents () const |
QStringList | allEvents () const |
QList< StatusEventItem * > | find (const QString &text, bool highlight=true) |
Protected Member Functions | |
virtual void | retranslateUi () |
Private Slots | |
void | customContextMenuRequested (const QPoint &pos) |
void | authenticated () |
void | disconnected () |
void | dangerousTorVersion (tc::TorVersionStatus reason, const QString &version, const QStringList &recommended) |
void | circuitEstablished () |
void | bug (const QString &reason) |
void | clockSkewed (int skew, const QString &source) |
void | dangerousPort (quint16 port, bool rejected) |
void | socksError (tc::SocksError type, const QString &destination) |
void | externalAddressChanged (const QHostAddress &ip, const QString &hostname) |
void | dnsHijacked () |
void | dnsUseless () |
void | checkingOrPortReachability (const QHostAddress &ip, quint16 port) |
void | orPortReachabilityFinished (const QHostAddress &ip, quint16 port, bool reachable) |
void | checkingDirPortReachability (const QHostAddress &ip, quint16 port) |
void | dirPortReachabilityFinished (const QHostAddress &ip, quint16 port, bool reachable) |
void | serverDescriptorRejected (const QHostAddress &ip, quint16 port, const QString &reason) |
void | serverDescriptorAccepted (const QHostAddress &ip, quint16 port) |
Private Member Functions | |
void | addNotification (const QPixmap &icon, const QString &title, const QString &description, const QString &helpUrl=QString()) |
Static Private Member Functions | |
static QPixmap | addBadgeToPixmap (const QPixmap &pixmap, const QPixmap &badge) |
static QPixmap | addBadgeToPixmap (const QString &pixmap, const QString &badge) |
static QPixmap | addBadgeToPixmap (const QPixmap &pixmap, const QString &badge) |
Private Attributes | |
int | _maximumItemCount |
bool | _squelchDescriptorAcceptedEvent |
Definition at line 33 of file StatusEventWidget.h.
StatusEventWidget::StatusEventWidget | ( | QWidget * | parent = 0 |
) |
Default constructor.
Definition at line 40 of file StatusEventWidget.cpp.
References authenticated(), bug(), checkingDirPortReachability(), checkingOrPortReachability(), circuitEstablished(), TorEvents::ClientStatus, clockSkewed(), customContextMenuRequested(), dangerousPort(), dangerousTorVersion(), dirPortReachabilityFinished(), disconnected(), dnsHijacked(), dnsUseless(), externalAddressChanged(), TorEvents::GeneralStatus, orPortReachabilityFinished(), serverDescriptorAccepted(), serverDescriptorRejected(), TorEvents::ServerStatus, TorControl::setEvent(), socksError(), and Vidalia::torControl().
QPixmap StatusEventWidget::addBadgeToPixmap | ( | const QPixmap & | pixmap, | |
const QString & | badge | |||
) | [static, private] |
Overloaded method provided for convenience. Constructs a QPixmap object for the Qt resource URL badge, and applies it to pixmap.
Definition at line 246 of file StatusEventWidget.cpp.
References addBadgeToPixmap().
QPixmap StatusEventWidget::addBadgeToPixmap | ( | const QString & | pixmap, | |
const QString & | badge | |||
) | [static, private] |
Overloaded method provided for convenience. Constructs QPixmap objects from the Qt resource URLs pixmap and badge.
Definition at line 253 of file StatusEventWidget.cpp.
References addBadgeToPixmap().
QPixmap StatusEventWidget::addBadgeToPixmap | ( | const QPixmap & | pixmap, | |
const QPixmap & | badge | |||
) | [static, private] |
Creates a new QPixmap using pixmap as the main image and overlays badge in the lower-right corner of the image.
Definition at line 234 of file StatusEventWidget.cpp.
Referenced by addBadgeToPixmap(), authenticated(), bug(), clockSkewed(), dangerousPort(), dangerousTorVersion(), dirPortReachabilityFinished(), disconnected(), dnsHijacked(), dnsUseless(), orPortReachabilityFinished(), serverDescriptorAccepted(), serverDescriptorRejected(), and socksError().
void StatusEventWidget::addNotification | ( | const QPixmap & | icon, | |
const QString & | title, | |||
const QString & | description, | |||
const QString & | helpUrl = QString() | |||
) | [private] |
Adds a new status event notification item to the widget. The item will be drawn using the specified icon, short event title, and a longer detailed description. If helpUrl is not empty, the item will also have a clickable question mark icon in the corner.
Definition at line 202 of file StatusEventWidget.cpp.
References maximumItemCount(), StatusEventItem::setDescription(), StatusEventItem::setHelpUrl(), StatusEventItem::setIcon(), StatusEventItem::setTimestamp(), StatusEventItem::setTitle(), StatusEventItem::setToolTip(), and string_wrap().
Referenced by authenticated(), bug(), checkingDirPortReachability(), checkingOrPortReachability(), circuitEstablished(), clockSkewed(), dangerousPort(), dangerousTorVersion(), dirPortReachabilityFinished(), disconnected(), dnsHijacked(), dnsUseless(), externalAddressChanged(), orPortReachabilityFinished(), serverDescriptorAccepted(), serverDescriptorRejected(), and socksError().
QStringList StatusEventWidget::allEvents | ( | ) | const |
Returns a QStringList of all current status events formatted as human-readable text. Each item in the returned QStringList represents a single status event.
Definition at line 140 of file StatusEventWidget.cpp.
References compareStatusEventItems(), and i().
void StatusEventWidget::authenticated | ( | ) | [private, slot] |
Called when the control socket is connected and authenticated.
Definition at line 260 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), addNotification(), circuitEstablished(), dangerousTorVersion(), TorControl::getInfo(), TorControl::getTorVersionString(), TorControl::isCircuitEstablished(), tc::ObsoleteTorVersion, Vidalia::torControl(), and tc::UnrecommendedTorVersion.
Referenced by StatusEventWidget().
void StatusEventWidget::bug | ( | const QString & | reason | ) | [private, slot] |
Emitted when Tor has encountered an internal bug. reason is Tor's description of the bug.
Definition at line 345 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::checkingDirPortReachability | ( | const QHostAddress & | ip, | |
quint16 | port | |||
) | [private, slot] |
Indicates Tor has started testing the reachability of its directory port using the IP address ip and port port.
Definition at line 540 of file StatusEventWidget.cpp.
References addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::checkingOrPortReachability | ( | const QHostAddress & | ip, | |
quint16 | port | |||
) | [private, slot] |
Indicates Tor has started testing the reachability of its OR port using the IP address ip and port port.
Definition at line 503 of file StatusEventWidget.cpp.
References addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::circuitEstablished | ( | ) | [private, slot] |
Indicates Tor has been able to successfully establish one or more circuits.
Definition at line 335 of file StatusEventWidget.cpp.
References addNotification().
Referenced by authenticated(), and StatusEventWidget().
void StatusEventWidget::clockSkewed | ( | int | skew, | |
const QString & | source | |||
) | [private, slot] |
Indicates that Tor has determined the client's clock is potentially skewed by skew seconds relative to source.
Definition at line 357 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), addNotification(), TorControl::getTorVersion(), TorControl::getTorVersionString(), and Vidalia::torControl().
Referenced by StatusEventWidget().
void StatusEventWidget::customContextMenuRequested | ( | const QPoint & | pos | ) | [private, slot] |
Copies the text for all selected event items to the system clipboard.
Definition at line 160 of file StatusEventWidget.cpp.
References selectedEvents().
Referenced by StatusEventWidget().
void StatusEventWidget::dangerousPort | ( | quint16 | port, | |
bool | rejected | |||
) | [private, slot] |
Called when the user attempts to establish a connection to some destination on port port, which is a port known to use plaintext connections (as determined by Tor's WarnPlaintextPorts and RejectPlaintextPorts torrc options). rejected indicates whether Tor rejected the connection or permitted it to connect anyway.
Definition at line 394 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::dangerousTorVersion | ( | tc::TorVersionStatus | reason, | |
const QString & | version, | |||
const QStringList & | recommended | |||
) | [private, slot] |
Indicates that Tor has decided the user's Tor software version is no longer recommended for some reason. recommended is a list of Tor software versions that are considered current.
Definition at line 303 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), addNotification(), tc::ObsoleteTorVersion, and tc::UnrecommendedTorVersion.
Referenced by authenticated(), and StatusEventWidget().
void StatusEventWidget::dirPortReachabilityFinished | ( | const QHostAddress & | ip, | |
quint16 | port, | |||
bool | reachable | |||
) | [private, slot] |
Tor has completed testing the reachability of its directory port using the IP address ip and port port. If the user's directory port was reachable, reachable will be set to true.
Definition at line 551 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::disconnected | ( | ) | [private, slot] |
Called when the controller has disconnected from Tor
Definition at line 288 of file StatusEventWidget.cpp.
References _squelchDescriptorAcceptedEvent, addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::dnsHijacked | ( | ) | [private, slot] |
Called when Tor determines that the user's DNS provider is providing an address for non-existent domains when it should really be saying "NXDOMAIN".
Definition at line 477 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::dnsUseless | ( | ) | [private, slot] |
Called when Tor determines that the user's DNS provider is providing a hijacked address even for well-known websites.
Definition at line 490 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::externalAddressChanged | ( | const QHostAddress & | ip, | |
const QString & | hostname | |||
) | [private, slot] |
Called when Tor decides the client's external IP address has changed to ip. If hostname is non-empty, Tor obtained the new value for ip by resolving hostname.
Definition at line 463 of file StatusEventWidget.cpp.
References addNotification().
Referenced by StatusEventWidget().
QList< StatusEventItem * > StatusEventWidget::find | ( | const QString & | text, | |
bool | highlight = true | |||
) |
Searches the list of current status event items for any items that contain text in either the event title or description. Searching is done case-insensitively. If highlight is true, any previously selected items will be deselected and the matching items will be highlighted. Returns a (possibly empty) list of matching items.
Definition at line 180 of file StatusEventWidget.cpp.
References StatusEventItem::description(), i(), and StatusEventItem::title().
int StatusEventWidget::maximumItemCount | ( | ) | const |
Returns the maximum number of status items that can be displayed in this StatusEventWidget.
Definition at line 114 of file StatusEventWidget.cpp.
References _maximumItemCount.
Referenced by addNotification().
void StatusEventWidget::orPortReachabilityFinished | ( | const QHostAddress & | ip, | |
quint16 | port, | |||
bool | reachable | |||
) | [private, slot] |
Tor has completed testing the reachability of its OR port using the IP address ip and port port. If the user's OR port was reachable, reachable will be set to true.
Definition at line 514 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::retranslateUi | ( | ) | [protected, virtual] |
Called when the user has changed the UI display language in Vidalia indicating all the displayed text widgets need to be updated to display their value in the newly chosen language.
Definition at line 85 of file StatusEventWidget.cpp.
QStringList StatusEventWidget::selectedEvents | ( | ) | const |
Returns a QStringList of the currently selected status events formatted as human-readable text. Each item in the returned QStringList represents a single status event.
Definition at line 120 of file StatusEventWidget.cpp.
References compareStatusEventItems(), and i().
Referenced by customContextMenuRequested().
void StatusEventWidget::serverDescriptorAccepted | ( | const QHostAddress & | ip, | |
quint16 | port | |||
) | [private, slot] |
Emitted when the directory authority with IP address ip and port port accepted the user's server descriptor.
Definition at line 593 of file StatusEventWidget.cpp.
References _squelchDescriptorAcceptedEvent, addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::serverDescriptorRejected | ( | const QHostAddress & | ip, | |
quint16 | port, | |||
const QString & | reason | |||
) | [private, slot] |
Called when the directory authority with IP address ip and port port rejected the user's server descriptor. reason describes why the descriptor was rejected (e.g., malformed, skewed clock, etc.).
Definition at line 577 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), and addNotification().
Referenced by StatusEventWidget().
void StatusEventWidget::setMaximumItemCount | ( | int | maximumItemCount | ) |
Sets the maximum number of status event items displayed to maximumItemCount. If the current number of items displayed exceeds maximumItemCount, the oldest items will be removed until topLevelItemCount() is equal to the new limit.
Definition at line 97 of file StatusEventWidget.cpp.
References _maximumItemCount.
void StatusEventWidget::socksError | ( | tc::SocksError | type, | |
const QString & | destination | |||
) | [private, slot] |
Called when Tor detects a problem with a SOCKS connection from the user, such as a bad hostname, dangerous SOCKS protocol type, or a bad hostname. type indicates the type of error encountered and destination (if non-empty) specifies the attempted connection destination address or hostname.
Definition at line 423 of file StatusEventWidget.cpp.
References addBadgeToPixmap(), addNotification(), tc::BadSocksHostnameError, tc::DangerousSocksTypeError, and tc::UnknownSocksProtocolError.
Referenced by StatusEventWidget().
int StatusEventWidget::_maximumItemCount [private] |
Maximum number of event notifications contained in the StatusEventWidget at any given time.
Definition at line 223 of file StatusEventWidget.h.
Referenced by maximumItemCount(), and setMaximumItemCount().
bool StatusEventWidget::_squelchDescriptorAcceptedEvent [private] |
Tor sends a ACCEPTED_SERVER_DESCRIPTOR event every time it manages to upload the user's relay's descriptor to a directory authority. So we squelch any such events after the first to avoid blasting the user with "Hey, your relay is working!" messages.
Definition at line 230 of file StatusEventWidget.h.
Referenced by disconnected(), and serverDescriptorAccepted().