Vidalia
0.3.1
|
#include <MessageLog.h>
Public Member Functions | |
MessageLog (QStatusBar *st=0, QWidget *parent=0) | |
~MessageLog () | |
![]() | |
VidaliaTab (const QString &title, const QString &name="", QWidget *parent=0) | |
~VidaliaTab () | |
QString | getTitle () const |
void | setTitle (const QString &title) |
void | setShortcut (const QString &shortcut, const char *slot) |
QVariant | getSetting (QString name, QVariant defaultValue) |
void | saveSetting (QString name, QVariant value) |
void | setOnTop (bool top) |
Protected Member Functions | |
virtual void | retranslateUi () |
![]() | |
virtual void | changeEvent (QEvent *e) |
virtual void | closeEvent (QCloseEvent *event) |
Private Slots | |
void | log (tc::Severity severity, const QString &msg) |
void | saveAll () |
void | saveSelected () |
void | selectAll () |
void | copy () |
void | clear () |
void | find () |
void | saveSettings () |
void | cancelChanges () |
void | browse () |
void | help () |
Private Member Functions | |
void | createActions () |
void | setToolTips () |
void | loadSettings () |
void | registerLogEvents () |
void | save (const QStringList &messages) |
bool | rotateLogFile (const QString &filename) |
Private Attributes | |
TorControl * | _torControl |
VidaliaSettings * | _settings |
uint | _filter |
bool | _enableLogging |
LogFile | _logFile |
QStatusBar * | _statusBar |
Ui::MessageLog | ui |
Additional Inherited Members | |
![]() | |
void | helpRequested (const QString &topic) |
void | closeTab () |
![]() | |
bool | _onTop |
Definition at line 28 of file MessageLog.h.
MessageLog::MessageLog | ( | QStatusBar * | st = 0 , |
QWidget * | parent = 0 |
||
) |
Default constructor
Constructor. The constructor will load the message log's settings from VidaliSettings and register for log events according to the most recently set severity filter.
torControl | A TorControl object used to register for log events. |
parent | The parent widget of this MessageLog object. |
flags | Any desired window creation flags. |
Definition at line 59 of file MessageLog.cpp.
References _torControl, connect(), createActions(), loadSettings(), log(), setToolTips(), LogTreeWidget::TimeColumn, Vidalia::torControl(), and ui.
MessageLog::~MessageLog | ( | ) |
Default destructor
Default Destructor. Simply frees up any memory allocated for member variables.
Definition at line 89 of file MessageLog.cpp.
References _logFile, and LogFile::close().
|
privateslot |
Called when the user clicks "Browse" to select a new log file.
Definition at line 315 of file MessageLog.cpp.
References ui.
Referenced by createActions().
|
privateslot |
Called when user cancels changed settings
Simply restores the previously saved settings and hides the settings frame.
Definition at line 305 of file MessageLog.cpp.
References loadSettings(), and ui.
Referenced by createActions().
|
privateslot |
Called when the user triggers the "Clear" action.
Clears all log messages or status notifications, depending on which tab is currently visible.
Definition at line 403 of file MessageLog.cpp.
References ui.
Referenced by createActions().
|
privateslot |
Called when the user triggers the "Copy" action.
Copies contents of currently selected messages to the 'clipboard'.
Definition at line 388 of file MessageLog.cpp.
References ui.
Referenced by createActions().
|
private |
Create and bind actions to events
Binds events (signals) to actions (slots).
Definition at line 96 of file MessageLog.cpp.
References browse(), cancelChanges(), clear(), connect(), copy(), Vidalia::createShortcut(), find(), help(), saveAll(), saveSelected(), saveSettings(), selectAll(), and ui.
Referenced by MessageLog().
|
privateslot |
Called when the user triggers the "Find" action. This will search through all currently displayed log entries for text specified by the user, highlighting the entries that contain a match.
Prompts the user for a search string. If the search string is not found in any of the currently displayed log entires, then a message will be displayed for the user informing them that no matches were found.
Definition at line 414 of file MessageLog.cpp.
References VMessageBox::information(), VMessageBox::Ok, p(), and ui.
Referenced by createActions().
|
privateslot |
Called when the user clicks "Help" to see help info about the log.
Displays help information about the message log.
Definition at line 475 of file MessageLog.cpp.
References VidaliaTab::helpRequested().
Referenced by createActions().
|
private |
Loads the saved Message Log settings
Definition at line 178 of file MessageLog.cpp.
References _enableLogging, _filter, _logFile, tc::DebugSeverity, DEFAULT_ENABLE_LOGFILE, DEFAULT_LOGFILE, DEFAULT_MAX_MSG_COUNT, DEFAULT_MSG_FILTER, tc::ErrorSeverity, VidaliaTab::getSetting(), tc::InfoSeverity, LogFile::isOpen(), tc::NoticeSeverity, registerLogEvents(), rotateLogFile(), SETTING_ENABLE_LOGFILE, SETTING_LOGFILE, SETTING_MAX_MSG_COUNT, SETTING_MSG_FILTER, ui, and tc::WarnSeverity.
Referenced by cancelChanges(), and MessageLog().
|
privateslot |
Adds the passed message to the message log as the specified type
Writes a message to the Message History and tags it with the proper date, time and type.
type | The message's severity type. |
message | The log message to be added. |
Definition at line 447 of file MessageLog.cpp.
References _enableLogging, _filter, _logFile, VidaliaTab::_onTop, _statusBar, LogTreeItem::toString(), and ui.
Referenced by MessageLog().
|
private |
Registers the current message filter with Tor
Attempts to register the selected message filter with Tor and displays an error if setting the events fails.
Definition at line 213 of file MessageLog.cpp.
References _filter, _torControl, tc::DebugSeverity, DEFAULT_MSG_FILTER, tc::ErrorSeverity, VidaliaTab::getSetting(), tc::InfoSeverity, TorControl::isConnected(), TorEvents::LogDebug, TorEvents::LogError, TorEvents::LogInfo, TorEvents::LogNotice, TorEvents::LogWarn, tc::NoticeSeverity, VMessageBox::Ok, p(), TorControl::setEvent(), TorControl::setEvents(), SETTING_MSG_FILTER, VMessageBox::warning(), and tc::WarnSeverity.
Referenced by loadSettings(), and saveSettings().
|
protectedvirtual |
Called when the user changes the UI translation.
Reimplemented from VidaliaTab.
Definition at line 169 of file MessageLog.cpp.
References VidaliaTab::setTitle(), setToolTips(), and ui.
|
private |
Rotates the log file based on the filename and the current logging status.
Opens a log file if necessary, or closes it if logging is disabled. If a log file is already opened and a new filename is specified, then the log file will be rotated to the new filename. In the case that the new filename can not be openend, the old file will remain open and writable.
Definition at line 240 of file MessageLog.cpp.
References _enableLogging, _logFile, LogFile::close(), VMessageBox::Ok, LogFile::open(), p(), and VMessageBox::warning().
Referenced by loadSettings(), and saveSettings().
|
private |
Saves the given list of items to a file
Saves the given list of items to a file.
items | A list of log message items to save. |
Definition at line 330 of file MessageLog.cpp.
References VMessageBox::Ok, LogFile::open(), p(), and VMessageBox::warning().
Referenced by saveAll(), and saveSelected().
|
privateslot |
Called when the user triggers the "Save All" action.
Saves all shown messages to a file.
Definition at line 375 of file MessageLog.cpp.
Referenced by createActions().
|
privateslot |
Called when the user triggers "Save Selected" action.
Saves currently selected messages to a file.
Definition at line 368 of file MessageLog.cpp.
Referenced by createActions().
|
privateslot |
Called when user saves settings
Saves the Message Log settings, adjusts the message list if required, and then hides the settings frame.
Definition at line 260 of file MessageLog.cpp.
References _enableLogging, _filter, _logFile, ADD_TO_FILTER, tc::DebugSeverity, tc::ErrorSeverity, tc::InfoSeverity, LogFile::isOpen(), tc::NoticeSeverity, VMessageBox::Ok, p(), registerLogEvents(), rotateLogFile(), VidaliaTab::saveSetting(), SETTING_ENABLE_LOGFILE, SETTING_LOGFILE, SETTING_MAX_MSG_COUNT, SETTING_MSG_FILTER, ui, VMessageBox::warning(), and tc::WarnSeverity.
Referenced by createActions().
|
privateslot |
Called when the user triggers the "Select All" action.
Definition at line 381 of file MessageLog.cpp.
References ui.
Referenced by createActions().
|
private |
Set Tool Tips for various widgets
Set tooltips for Message Filter checkboxes in code because they are long and Designer wouldn't let us insert newlines into the text.
Definition at line 151 of file MessageLog.cpp.
References ui.
Referenced by MessageLog(), and retranslateUi().
|
private |
Set to true if we will log all messages to a file.
Definition at line 89 of file MessageLog.h.
Referenced by loadSettings(), log(), rotateLogFile(), and saveSettings().
|
private |
Stores the current message filter
Definition at line 87 of file MessageLog.h.
Referenced by loadSettings(), log(), registerLogEvents(), and saveSettings().
|
private |
Definition at line 91 of file MessageLog.h.
Referenced by loadSettings(), log(), rotateLogFile(), saveSettings(), and ~MessageLog().
|
private |
A VidaliaSettings object that handles getting/saving settings
Definition at line 85 of file MessageLog.h.
|
private |
Definition at line 93 of file MessageLog.h.
Referenced by log().
|
private |
A pointer to a TorControl object, used to register for log events
Definition at line 83 of file MessageLog.h.
Referenced by MessageLog(), and registerLogEvents().
|
private |
Qt Designer generatated QObject
Definition at line 96 of file MessageLog.h.
Referenced by browse(), cancelChanges(), clear(), copy(), createActions(), find(), loadSettings(), log(), MessageLog(), retranslateUi(), saveAll(), saveSelected(), saveSettings(), selectAll(), and setToolTips().